From 023251dee1fcd948b1d78640474cc9d74f03ae45 Mon Sep 17 00:00:00 2001 From: uyjulian Date: Sun, 15 Apr 2018 16:00:38 -0500 Subject: [PATCH] Get rid of cxmon and SheepShaver (focus is on BasiliskII) --- SheepShaver/COPYING | 340 - SheepShaver/Makefile | 104 - SheepShaver/NEWS | 105 - SheepShaver/doc/BeOS/acknowledgements.html | 24 - SheepShaver/doc/BeOS/contact.html | 47 - SheepShaver/doc/BeOS/graphics.gif | Bin 8854 -> 0 bytes SheepShaver/doc/BeOS/history.html | 59 - SheepShaver/doc/BeOS/icon.gif | Bin 2011 -> 0 bytes SheepShaver/doc/BeOS/iconsmall.gif | Bin 1297 -> 0 bytes SheepShaver/doc/BeOS/index.html | 28 - SheepShaver/doc/BeOS/installation.html | 25 - SheepShaver/doc/BeOS/introduction.html | 45 - SheepShaver/doc/BeOS/memory.gif | Bin 5510 -> 0 bytes SheepShaver/doc/BeOS/quickstart.html | 38 - SheepShaver/doc/BeOS/serial.gif | Bin 4844 -> 0 bytes SheepShaver/doc/BeOS/settings.html | 127 - SheepShaver/doc/BeOS/troubleshooting.html | 79 - SheepShaver/doc/BeOS/using.html | 76 - SheepShaver/doc/BeOS/volumes.gif | Bin 7456 -> 0 bytes SheepShaver/doc/Linux/acknowledgements.html | 24 - SheepShaver/doc/Linux/contact.html | 47 - SheepShaver/doc/Linux/graphics.gif | Bin 5480 -> 0 bytes SheepShaver/doc/Linux/history.html | 25 - SheepShaver/doc/Linux/icon.gif | Bin 2011 -> 0 bytes SheepShaver/doc/Linux/iconsmall.gif | Bin 1297 -> 0 bytes SheepShaver/doc/Linux/index.html | 28 - SheepShaver/doc/Linux/installation.html | 25 - SheepShaver/doc/Linux/introduction.html | 44 - SheepShaver/doc/Linux/memory.gif | Bin 5697 -> 0 bytes SheepShaver/doc/Linux/quickstart.html | 39 - SheepShaver/doc/Linux/serial.gif | Bin 5325 -> 0 bytes SheepShaver/doc/Linux/settings.html | 117 - SheepShaver/doc/Linux/troubleshooting.html | 65 - SheepShaver/doc/Linux/using.html | 113 - SheepShaver/doc/Linux/volumes.gif | Bin 7705 -> 0 bytes SheepShaver/doc/PowerPC-Testsuite.txt | 28 - .../src/BeOS/CreatePCIDrivers/Ethernet.cpp | 256 - .../src/BeOS/CreatePCIDrivers/Makefile | 25 - .../src/BeOS/CreatePCIDrivers/Video.cpp | 78 - .../src/BeOS/CreatePCIDrivers/hexconv.cpp | 34 - SheepShaver/src/BeOS/Makefile | 117 - SheepShaver/src/BeOS/NetPeek/Makefile | 110 - SheepShaver/src/BeOS/NetPeek/NetPeek.cpp | 49 - SheepShaver/src/BeOS/SaveROM/Makefile | 110 - SheepShaver/src/BeOS/SaveROM/README | 8 - SheepShaver/src/BeOS/SaveROM/SaveROM.cpp | 128 - SheepShaver/src/BeOS/SaveROM/SaveROM.rsrc | Bin 4323 -> 0 bytes SheepShaver/src/BeOS/SheepDriver | 1 - SheepShaver/src/BeOS/SheepNet | 1 - SheepShaver/src/BeOS/SheepShaver.rsrc | Bin 4247 -> 0 bytes SheepShaver/src/BeOS/about_window_beos.cpp | 289 - SheepShaver/src/BeOS/audio_beos.cpp | 1 - SheepShaver/src/BeOS/clip_beos.cpp | 374 -- SheepShaver/src/BeOS/ether_beos.cpp | 400 -- SheepShaver/src/BeOS/extfs_beos.cpp | 1 - SheepShaver/src/BeOS/main_beos.cpp | 2015 ------ SheepShaver/src/BeOS/prefs_beos.cpp | 112 - SheepShaver/src/BeOS/prefs_editor_beos.cpp | 877 --- SheepShaver/src/BeOS/scsi_beos.cpp | 1 - SheepShaver/src/BeOS/serial_beos.cpp | 1 - SheepShaver/src/BeOS/sys_beos.cpp | 1 - SheepShaver/src/BeOS/sysdeps.h | 74 - SheepShaver/src/BeOS/timer_beos.cpp | 1 - SheepShaver/src/BeOS/user_strings_beos.cpp | 73 - SheepShaver/src/BeOS/user_strings_beos.h | 37 - SheepShaver/src/BeOS/video_beos.cpp | 787 --- SheepShaver/src/BeOS/video_screen.h | 262 - SheepShaver/src/BeOS/video_window.h | 523 -- SheepShaver/src/BeOS/xpram_beos.cpp | 1 - SheepShaver/src/CrossPlatform/sigsegv.cpp | 1 - SheepShaver/src/CrossPlatform/sigsegv.h | 1 - SheepShaver/src/CrossPlatform/video_blit.cpp | 1 - SheepShaver/src/CrossPlatform/video_blit.h | 1 - SheepShaver/src/CrossPlatform/video_vosf.h | 1 - SheepShaver/src/CrossPlatform/vm_alloc.cpp | 1 - SheepShaver/src/CrossPlatform/vm_alloc.h | 1 - .../src/EthernetDriver/.finf/Ethernet.mcp | Bin 32 -> 0 bytes .../src/EthernetDriver/.finf/ethernet.ndrv | Bin 32 -> 0 bytes .../src/EthernetDriver/.rsrc/ethernet.ndrv | Bin 398 -> 0 bytes .../Ethernet Data/.finf/CWSettingsMacOS.stg | Bin 32 -> 0 bytes .../.finf/PPC Debug MacOS Toolbox | Bin 32 -> 0 bytes .../.finf/PPC Final MacOS Toolbox | Bin 32 -> 0 bytes .../Ethernet Data/CWSettingsMacOS.stg | Bin 4344 -> 0 bytes .../.finf/TargetDataMacOS.tdt | Bin 32 -> 0 bytes .../.rsrc/TargetDataMacOS.tdt | Bin 286 -> 0 bytes .../TargetDataMacOS.tdt | Bin 46180 -> 0 bytes .../.finf/TargetDataMacOS.tdt | Bin 32 -> 0 bytes .../.rsrc/TargetDataMacOS.tdt | Bin 286 -> 0 bytes .../TargetDataMacOS.tdt | Bin 46304 -> 0 bytes SheepShaver/src/EthernetDriver/Ethernet.cpp | 308 - SheepShaver/src/EthernetDriver/Ethernet.mcp | Bin 103293 -> 0 bytes .../src/EthernetDriver/cpu_emulation.h | 1 - SheepShaver/src/EthernetDriver/debug.h | 1 - SheepShaver/src/EthernetDriver/ether.cpp | 1738 ------ SheepShaver/src/EthernetDriver/ether.h | 113 - SheepShaver/src/EthernetDriver/ether_defs.h | 552 -- SheepShaver/src/EthernetDriver/ethernet.ndrv | Bin 11780 -> 0 bytes SheepShaver/src/EthernetDriver/macos_util.cpp | 1 - SheepShaver/src/EthernetDriver/macos_util.h | 1 - SheepShaver/src/EthernetDriver/sysdeps.h | 1 - SheepShaver/src/EthernetDriver/xlowmem.h | 64 - SheepShaver/src/EthernetDriverFull.i | 737 --- SheepShaver/src/EthernetDriverStub.i | 43 - SheepShaver/src/MacOSX/.gitignore | 7 - SheepShaver/src/MacOSX/AudioBackEnd.cpp | 1 - SheepShaver/src/MacOSX/AudioBackEnd.h | 1 - SheepShaver/src/MacOSX/AudioDevice.cpp | 1 - SheepShaver/src/MacOSX/AudioDevice.h | 1 - SheepShaver/src/MacOSX/Info.plist.in | 56 - .../src/MacOSX/Launcher/AppController.h | 30 - .../src/MacOSX/Launcher/AppController.mm | 44 - SheepShaver/src/MacOSX/Launcher/DiskType.h | 23 - SheepShaver/src/MacOSX/Launcher/DiskType.m | 35 - .../Launcher/English.lproj/InfoPlist.strings | Bin 276 -> 0 bytes .../English.lproj/MainMenu.nib/classes.nib | 32 - .../English.lproj/MainMenu.nib/info.nib | 18 - .../MainMenu.nib/keyedobjects.nib | Bin 12048 -> 0 bytes .../VMListWindow.nib/designable.nib | 713 --- .../VMListWindow.nib/keyedobjects.nib | Bin 8475 -> 0 bytes .../VMSettingsWindow.nib/designable.nib | 4438 ------------- .../VMSettingsWindow.nib/keyedobjects.nib | Bin 43067 -> 0 bytes SheepShaver/src/MacOSX/Launcher/Info.plist | 28 - .../src/MacOSX/Launcher/LauncherPrefix.h | 42 - .../project.pbxproj | 399 -- .../src/MacOSX/Launcher/VMListController.h | 49 - .../src/MacOSX/Launcher/VMListController.mm | 390 -- .../MacOSX/Launcher/VMSettingsController.h | 87 - .../MacOSX/Launcher/VMSettingsController.mm | 480 -- SheepShaver/src/MacOSX/Launcher/main.m | 26 - SheepShaver/src/MacOSX/MacOSX_sound_if.cpp | 1 - SheepShaver/src/MacOSX/MacOSX_sound_if.h | 1 - .../English.lproj/InfoPlist.strings | Bin 216 -> 0 bytes .../English.lproj/MainMenu.nib/classes.nib | 50 - .../English.lproj/MainMenu.nib/info.nib | 23 - .../MainMenu.nib/keyedobjects.nib | Bin 39269 -> 0 bytes SheepShaver/src/MacOSX/PrefsEditor/Info.plist | 28 - .../src/MacOSX/PrefsEditor/PrefsEditor.h | 70 - .../src/MacOSX/PrefsEditor/PrefsEditor.mm | 347 -- .../project.pbxproj | 309 - SheepShaver/src/MacOSX/PrefsEditor/main.m | 26 - .../English.lproj/InfoPlist.strings | Bin 90 -> 0 bytes .../English.lproj/MainMenu.nib/classes.nib | 103 - .../English.lproj/MainMenu.nib/info.nib | 16 - .../MainMenu.nib/keyedobjects.nib | Bin 31674 -> 0 bytes SheepShaver/src/MacOSX/SheepShaver.icns | Bin 59840 -> 0 bytes .../SheepShaver.xcodeproj/project.pbxproj | 2445 -------- SheepShaver/src/MacOSX/XcodeBuildHowTo.txt | 26 - SheepShaver/src/MacOSX/audio_macosx.cpp | 1 - SheepShaver/src/MacOSX/autorelease.h | 1 - SheepShaver/src/MacOSX/clip_macosx.cpp | 1 - SheepShaver/src/MacOSX/clip_macosx64.mm | 1 - .../src/MacOSX/config/config-macosx-ppc_32.h | 513 -- .../src/MacOSX/config/config-macosx-x86_32.h | 527 -- .../src/MacOSX/config/config-macosx-x86_64.h | 527 -- SheepShaver/src/MacOSX/config/config.h | 9 - SheepShaver/src/MacOSX/extfs_macosx.cpp | 1 - SheepShaver/src/MacOSX/macos_util_macosx.h | 1 - SheepShaver/src/MacOSX/prefs_macosx.mm | 131 - SheepShaver/src/MacOSX/sys_darwin.cpp | 1 - SheepShaver/src/MacOSX/utils_macosx.h | 1 - SheepShaver/src/MacOSX/utils_macosx.mm | 1 - SheepShaver/src/SDL | 1 - SheepShaver/src/Unix/.gitignore | 25 - SheepShaver/src/Unix/Darwin/.gitignore | 3 - SheepShaver/src/Unix/Darwin/lowmem.c | 1 - SheepShaver/src/Unix/Darwin/mkstandalone | 1 - SheepShaver/src/Unix/Darwin/pagezero.c | 1 - SheepShaver/src/Unix/Darwin/testlmem.sh | 1 - SheepShaver/src/Unix/Irix/audio_irix.cpp | 1 - SheepShaver/src/Unix/Linux/NetDriver | 1 - SheepShaver/src/Unix/Linux/scsi_linux.cpp | 1 - SheepShaver/src/Unix/Linux/sheepthreads.c | 445 -- SheepShaver/src/Unix/Makefile.in | 260 - SheepShaver/src/Unix/NetBSD/sheepthreads.c | 462 -- SheepShaver/src/Unix/SheepShaver.1 | 29 - SheepShaver/src/Unix/about_window_unix.cpp | 30 - SheepShaver/src/Unix/audio_oss_esd.cpp | 1 - SheepShaver/src/Unix/autogen.sh | 61 - SheepShaver/src/Unix/bincue_unix.cpp | 1 - SheepShaver/src/Unix/bincue_unix.h | 1 - SheepShaver/src/Unix/clip_unix.cpp | 1 - SheepShaver/src/Unix/config.guess | 1 - SheepShaver/src/Unix/config.sub | 1 - SheepShaver/src/Unix/configure.ac | 1687 ----- SheepShaver/src/Unix/cpr.sh | 1 - SheepShaver/src/Unix/disk_sparsebundle.cpp | 1 - SheepShaver/src/Unix/disk_unix.h | 1 - SheepShaver/src/Unix/ether_unix.cpp | 1 - SheepShaver/src/Unix/extfs_unix.cpp | 1 - SheepShaver/src/Unix/install-sh | 238 - SheepShaver/src/Unix/keycodes | 1 - SheepShaver/src/Unix/ldscripts | 1 - SheepShaver/src/Unix/m4 | 1 - SheepShaver/src/Unix/main_unix.cpp | 2292 ------- SheepShaver/src/Unix/mkinstalldirs | 40 - SheepShaver/src/Unix/paranoia.cpp | 346 -- SheepShaver/src/Unix/posix_sem.cpp | 1 - SheepShaver/src/Unix/ppc_asm.S | 932 --- SheepShaver/src/Unix/ppc_asm.tmpl | 156 - SheepShaver/src/Unix/prefs_editor_gtk.cpp | 1594 ----- SheepShaver/src/Unix/prefs_unix.cpp | 140 - SheepShaver/src/Unix/rpc.h | 1 - SheepShaver/src/Unix/rpc_unix.cpp | 1 - SheepShaver/src/Unix/semaphore.h | 1 - SheepShaver/src/Unix/serial_unix.cpp | 1 - SheepShaver/src/Unix/sigregs.h | 128 - SheepShaver/src/Unix/sshpty.c | 1 - SheepShaver/src/Unix/sshpty.h | 1 - SheepShaver/src/Unix/strlcpy.c | 1 - SheepShaver/src/Unix/strlcpy.h | 1 - SheepShaver/src/Unix/sys_unix.cpp | 1 - SheepShaver/src/Unix/sysdeps.h | 491 -- SheepShaver/src/Unix/timer_unix.cpp | 1 - SheepShaver/src/Unix/tinyxml2.cpp | 1 - SheepShaver/src/Unix/tinyxml2.h | 1 - SheepShaver/src/Unix/tunconfig | 1 - SheepShaver/src/Unix/user_strings_unix.cpp | 117 - SheepShaver/src/Unix/user_strings_unix.h | 86 - SheepShaver/src/Unix/vhd_unix.cpp | 1 - SheepShaver/src/Unix/video_x.cpp | 2584 -------- SheepShaver/src/Unix/xpram_unix.cpp | 1 - SheepShaver/src/VideoDriverStub.i | 24 - SheepShaver/src/Windows/Makefile.in | 221 - SheepShaver/src/Windows/SheepShaver.ico | Bin 2238 -> 0 bytes SheepShaver/src/Windows/SheepShaver.rc | 1 - SheepShaver/src/Windows/SheepShaverGUI.ico | Bin 1078 -> 0 bytes SheepShaver/src/Windows/SheepShaverGUI.rc | 2 - .../src/Windows/about_window_windows.cpp | 30 - SheepShaver/src/Windows/b2ether | 1 - SheepShaver/src/Windows/cd_defs.h | 1 - SheepShaver/src/Windows/cdenable | 1 - SheepShaver/src/Windows/clip_windows.cpp | 1 - SheepShaver/src/Windows/configure.ac | 266 - SheepShaver/src/Windows/ether_windows.cpp | 1 - SheepShaver/src/Windows/ether_windows.h | 1 - SheepShaver/src/Windows/extfs_windows.cpp | 1 - SheepShaver/src/Windows/kernel_windows.cpp | 1 - SheepShaver/src/Windows/kernel_windows.h | 1 - SheepShaver/src/Windows/main_windows.cpp | 828 --- SheepShaver/src/Windows/posix_emu.cpp | 1 - SheepShaver/src/Windows/posix_emu.h | 1 - SheepShaver/src/Windows/prefs_editor_gtk.cpp | 1 - SheepShaver/src/Windows/prefs_windows.cpp | 146 - SheepShaver/src/Windows/router | 1 - SheepShaver/src/Windows/serial_windows.cpp | 1 - SheepShaver/src/Windows/sys_windows.cpp | 1 - SheepShaver/src/Windows/sysdeps.h | 400 -- SheepShaver/src/Windows/timer_windows.cpp | 1 - .../src/Windows/user_strings_windows.cpp | 166 - .../src/Windows/user_strings_windows.h | 72 - SheepShaver/src/Windows/util_windows.cpp | 1 - SheepShaver/src/Windows/util_windows.h | 1 - SheepShaver/src/Windows/xpram_windows.cpp | 1 - SheepShaver/src/adb.cpp | 1 - SheepShaver/src/audio.cpp | 1 - SheepShaver/src/cdrom.cpp | 1 - SheepShaver/src/disk.cpp | 1 - SheepShaver/src/dummy/audio_dummy.cpp | 1 - SheepShaver/src/dummy/clip_dummy.cpp | 1 - SheepShaver/src/dummy/ether_dummy.cpp | 92 - SheepShaver/src/dummy/prefs_dummy.cpp | 38 - SheepShaver/src/dummy/prefs_editor_dummy.cpp | 1 - SheepShaver/src/dummy/scsi_dummy.cpp | 1 - SheepShaver/src/dummy/serial_dummy.cpp | 1 - SheepShaver/src/emul_op.cpp | 496 -- SheepShaver/src/emul_ppc/emul_ppc.cpp | 1661 ----- SheepShaver/src/ether.cpp | 1738 ------ SheepShaver/src/extfs.cpp | 1 - SheepShaver/src/gfxaccel.cpp | 461 -- SheepShaver/src/include/about_window.h | 26 - SheepShaver/src/include/adb.h | 1 - SheepShaver/src/include/audio.h | 1 - SheepShaver/src/include/audio_defs.h | 1 - SheepShaver/src/include/cdrom.h | 1 - SheepShaver/src/include/clip.h | 1 - SheepShaver/src/include/cpu_emulation.h | 123 - SheepShaver/src/include/debug.h | 1 - SheepShaver/src/include/disk.h | 1 - SheepShaver/src/include/emul_op.h | 113 - SheepShaver/src/include/ether.h | 101 - SheepShaver/src/include/ether_defs.h | 563 -- SheepShaver/src/include/extfs.h | 1 - SheepShaver/src/include/extfs_defs.h | 1 - SheepShaver/src/include/macos_util.h | 376 -- SheepShaver/src/include/main.h | 80 - SheepShaver/src/include/name_registry.h | 27 - SheepShaver/src/include/pict.h | 1 - SheepShaver/src/include/prefs.h | 1 - SheepShaver/src/include/prefs_editor.h | 30 - SheepShaver/src/include/rom_patches.h | 42 - SheepShaver/src/include/rsrc_patches.h | 28 - SheepShaver/src/include/scsi.h | 1 - SheepShaver/src/include/serial.h | 1 - SheepShaver/src/include/serial_defs.h | 1 - SheepShaver/src/include/sony.h | 1 - SheepShaver/src/include/sys.h | 1 - SheepShaver/src/include/thunks.h | 222 - SheepShaver/src/include/timer.h | 1 - SheepShaver/src/include/user_strings.h | 194 - SheepShaver/src/include/version.h | 27 - SheepShaver/src/include/video.h | 162 - SheepShaver/src/include/video_defs.h | 413 -- SheepShaver/src/include/xlowmem.h | 66 - SheepShaver/src/include/xpram.h | 1 - SheepShaver/src/kpx_cpu/dis-asm.h | 483 -- SheepShaver/src/kpx_cpu/include/a.out-defs.h | 443 -- .../src/kpx_cpu/include/basic-blockinfo.hpp | 118 - SheepShaver/src/kpx_cpu/include/basic-cpu.hpp | 89 - .../src/kpx_cpu/include/basic-plugin.hpp | 29 - .../src/kpx_cpu/include/block-alloc.hpp | 126 - SheepShaver/src/kpx_cpu/include/elf-defs.h | 2360 ------- SheepShaver/src/kpx_cpu/include/nvmemfun.hpp | 167 - .../src/kpx_cpu/include/task-plugin.hpp | 53 - SheepShaver/src/kpx_cpu/ppc-dis.c | 5489 ----------------- SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp | 1235 ---- .../src/kpx_cpu/src/cpu/block-cache.hpp | 277 - .../src/cpu/jit/amd64/dyngen-target-exec.h | 94 - .../src/cpu/jit/amd64/jit-target-cache.hpp | 1 - .../src/cpu/jit/amd64/jit-target-codegen.hpp | 108 - .../kpx_cpu/src/cpu/jit/basic-dyngen-ops.cpp | 481 -- .../src/kpx_cpu/src/cpu/jit/basic-dyngen.cpp | 183 - .../src/kpx_cpu/src/cpu/jit/basic-dyngen.hpp | 374 -- .../src/kpx_cpu/src/cpu/jit/cxxdemangle.cpp | 4495 -------------- .../src/kpx_cpu/src/cpu/jit/cxxdemangle.h | 55 - .../src/cpu/jit/dummy/jit-target-cache.hpp | 28 - .../src/kpx_cpu/src/cpu/jit/dyngen-exec.h | 182 - SheepShaver/src/kpx_cpu/src/cpu/jit/dyngen.c | 3027 --------- .../src/kpx_cpu/src/cpu/jit/jit-cache.cpp | 149 - .../src/kpx_cpu/src/cpu/jit/jit-cache.hpp | 126 - .../src/kpx_cpu/src/cpu/jit/jit-codegen.hpp | 39 - .../src/kpx_cpu/src/cpu/jit/jit-config.hpp | 62 - .../kpx_cpu/src/cpu/jit/jit-target-dispatch.h | 70 - .../src/cpu/jit/mips/dyngen-target-exec.h | 45 - .../src/cpu/jit/mips/jit-target-cache.hpp | 34 - .../src/cpu/jit/ppc/dyngen-target-exec.h | 71 - .../src/cpu/jit/ppc/jit-target-cache.hpp | 44 - .../src/kpx_cpu/src/cpu/jit/x86/codegen_x86.h | 1 - .../src/cpu/jit/x86/dyngen-target-exec.h | 55 - .../src/cpu/jit/x86/jit-target-cache.hpp | 1 - .../src/cpu/jit/x86/jit-target-codegen.hpp | 760 --- .../src/kpx_cpu/src/cpu/ppc/genexec.pl | 52 - .../src/kpx_cpu/src/cpu/ppc/ppc-bitfields.hpp | 229 - .../src/kpx_cpu/src/cpu/ppc/ppc-blockinfo.hpp | 84 - .../src/kpx_cpu/src/cpu/ppc/ppc-config.hpp | 150 - .../src/kpx_cpu/src/cpu/ppc/ppc-cpu.cpp | 825 --- .../src/kpx_cpu/src/cpu/ppc/ppc-cpu.hpp | 514 -- .../src/kpx_cpu/src/cpu/ppc/ppc-decode.cpp | 1869 ------ .../kpx_cpu/src/cpu/ppc/ppc-dyngen-ops.cpp | 1769 ------ .../src/kpx_cpu/src/cpu/ppc/ppc-dyngen.cpp | 313 - .../src/kpx_cpu/src/cpu/ppc/ppc-dyngen.hpp | 260 - .../src/kpx_cpu/src/cpu/ppc/ppc-execute.cpp | 1787 ------ .../src/kpx_cpu/src/cpu/ppc/ppc-execute.hpp | 380 -- .../kpx_cpu/src/cpu/ppc/ppc-instructions.hpp | 366 -- .../src/kpx_cpu/src/cpu/ppc/ppc-jit.cpp | 942 --- .../src/kpx_cpu/src/cpu/ppc/ppc-jit.hpp | 106 - .../src/kpx_cpu/src/cpu/ppc/ppc-operands.hpp | 591 -- .../kpx_cpu/src/cpu/ppc/ppc-operations.hpp | 405 -- .../src/kpx_cpu/src/cpu/ppc/ppc-registers.hpp | 251 - .../src/kpx_cpu/src/cpu/ppc/ppc-translate.cpp | 1589 ----- SheepShaver/src/kpx_cpu/src/cpu/spcflags.hpp | 66 - SheepShaver/src/kpx_cpu/src/cpu/vm.hpp | 298 - .../src/kpx_cpu/src/mathlib/ieeefp-i386.cpp | 111 - .../src/kpx_cpu/src/mathlib/ieeefp-i386.hpp | 58 - .../src/kpx_cpu/src/mathlib/ieeefp-mips.hpp | 58 - .../src/kpx_cpu/src/mathlib/ieeefp.cpp | 29 - .../src/kpx_cpu/src/mathlib/ieeefp.hpp | 123 - .../src/kpx_cpu/src/mathlib/mathlib-i386.cpp | 38 - .../src/kpx_cpu/src/mathlib/mathlib-i386.hpp | 52 - .../src/kpx_cpu/src/mathlib/mathlib-ppc.hpp | 63 - .../kpx_cpu/src/mathlib/mathlib-x86_64.hpp | 33 - .../src/kpx_cpu/src/mathlib/mathlib.cpp | 228 - .../src/kpx_cpu/src/mathlib/mathlib.hpp | 339 - .../src/kpx_cpu/src/test/test-powerpc.cpp | 2242 ------- .../src/kpx_cpu/src/utils/utils-cpuinfo.cpp | 151 - .../src/kpx_cpu/src/utils/utils-cpuinfo.hpp | 51 - .../src/kpx_cpu/src/utils/utils-sentinel.hpp | 47 - SheepShaver/src/macos_util.cpp | 354 -- SheepShaver/src/main.cpp | 326 - SheepShaver/src/name_registry.cpp | 368 -- SheepShaver/src/pict.c | 1 - SheepShaver/src/prefs.cpp | 1 - SheepShaver/src/prefs_items.cpp | 95 - SheepShaver/src/rom_patches.cpp | 2499 -------- SheepShaver/src/rsrc_patches.cpp | 1051 ---- SheepShaver/src/scsi.cpp | 1 - SheepShaver/src/serial.cpp | 315 - SheepShaver/src/slirp | 1 - SheepShaver/src/sony.cpp | 1 - SheepShaver/src/thunks.cpp | 406 -- SheepShaver/src/timer.cpp | 677 -- SheepShaver/src/user_strings.cpp | 186 - SheepShaver/src/video.cpp | 1097 ---- SheepShaver/src/xpram.cpp | 1 - cxmon/.gitignore | 26 - cxmon/AUTHORS | 8 - cxmon/COPYING | 340 - cxmon/ChangeLog | 20 - cxmon/INSTALL | 182 - cxmon/Makefile.am | 17 - cxmon/README | 437 -- cxmon/bootstrap | 2 - cxmon/configure.ac | 47 - cxmon/cxmon.1 | 56 - cxmon/cxmon.spec.in | 42 - cxmon/src/Makefile.am | 10 - cxmon/src/disass/Makefile.am | 8 - cxmon/src/disass/ansidecl.h | 295 - cxmon/src/disass/bfd.h | 66 - cxmon/src/disass/dis-asm.h | 315 - cxmon/src/disass/floatformat.c | 401 -- cxmon/src/disass/floatformat.h | 111 - cxmon/src/disass/i386-dis.c | 4146 ------------- cxmon/src/disass/m68k-dis.c | 1248 ---- cxmon/src/disass/m68k-opc.c | 2066 ------- cxmon/src/disass/m68k.h | 315 - cxmon/src/disass/opintl.h | 34 - cxmon/src/main.cpp | 118 - cxmon/src/mon.cpp | 1255 ---- cxmon/src/mon.h | 100 - cxmon/src/mon_6502.cpp | 232 - cxmon/src/mon_atraps.h | 1212 ---- cxmon/src/mon_cmd.cpp | 669 -- cxmon/src/mon_cmd.h | 46 - cxmon/src/mon_disass.cpp | 204 - cxmon/src/mon_disass.h | 30 - cxmon/src/mon_lowmem.cpp | 579 -- cxmon/src/mon_lowmem.h | 32 - cxmon/src/mon_ppc.cpp | 1129 ---- cxmon/src/mon_z80.cpp | 604 -- cxmon/src/sysdeps.h | 96 - 430 files changed, 107195 deletions(-) delete mode 100644 SheepShaver/COPYING delete mode 100644 SheepShaver/Makefile delete mode 100644 SheepShaver/NEWS delete mode 100644 SheepShaver/doc/BeOS/acknowledgements.html delete mode 100644 SheepShaver/doc/BeOS/contact.html delete mode 100644 SheepShaver/doc/BeOS/graphics.gif delete mode 100644 SheepShaver/doc/BeOS/history.html delete mode 100644 SheepShaver/doc/BeOS/icon.gif delete mode 100644 SheepShaver/doc/BeOS/iconsmall.gif delete mode 100644 SheepShaver/doc/BeOS/index.html delete mode 100644 SheepShaver/doc/BeOS/installation.html delete mode 100644 SheepShaver/doc/BeOS/introduction.html delete mode 100644 SheepShaver/doc/BeOS/memory.gif delete mode 100644 SheepShaver/doc/BeOS/quickstart.html delete mode 100644 SheepShaver/doc/BeOS/serial.gif delete mode 100644 SheepShaver/doc/BeOS/settings.html delete mode 100644 SheepShaver/doc/BeOS/troubleshooting.html delete mode 100644 SheepShaver/doc/BeOS/using.html delete mode 100644 SheepShaver/doc/BeOS/volumes.gif delete mode 100644 SheepShaver/doc/Linux/acknowledgements.html delete mode 100644 SheepShaver/doc/Linux/contact.html delete mode 100644 SheepShaver/doc/Linux/graphics.gif delete mode 100644 SheepShaver/doc/Linux/history.html delete mode 100644 SheepShaver/doc/Linux/icon.gif delete mode 100644 SheepShaver/doc/Linux/iconsmall.gif delete mode 100644 SheepShaver/doc/Linux/index.html delete mode 100644 SheepShaver/doc/Linux/installation.html delete mode 100644 SheepShaver/doc/Linux/introduction.html delete mode 100644 SheepShaver/doc/Linux/memory.gif delete mode 100644 SheepShaver/doc/Linux/quickstart.html delete mode 100644 SheepShaver/doc/Linux/serial.gif delete mode 100644 SheepShaver/doc/Linux/settings.html delete mode 100644 SheepShaver/doc/Linux/troubleshooting.html delete mode 100644 SheepShaver/doc/Linux/using.html delete mode 100644 SheepShaver/doc/Linux/volumes.gif delete mode 100644 SheepShaver/doc/PowerPC-Testsuite.txt delete mode 100644 SheepShaver/src/BeOS/CreatePCIDrivers/Ethernet.cpp delete mode 100644 SheepShaver/src/BeOS/CreatePCIDrivers/Makefile delete mode 100644 SheepShaver/src/BeOS/CreatePCIDrivers/Video.cpp delete mode 100644 SheepShaver/src/BeOS/CreatePCIDrivers/hexconv.cpp delete mode 100644 SheepShaver/src/BeOS/Makefile delete mode 100644 SheepShaver/src/BeOS/NetPeek/Makefile delete mode 100644 SheepShaver/src/BeOS/NetPeek/NetPeek.cpp delete mode 100644 SheepShaver/src/BeOS/SaveROM/Makefile delete mode 100644 SheepShaver/src/BeOS/SaveROM/README delete mode 100644 SheepShaver/src/BeOS/SaveROM/SaveROM.cpp delete mode 100644 SheepShaver/src/BeOS/SaveROM/SaveROM.rsrc delete mode 120000 SheepShaver/src/BeOS/SheepDriver delete mode 120000 SheepShaver/src/BeOS/SheepNet delete mode 100644 SheepShaver/src/BeOS/SheepShaver.rsrc delete mode 100644 SheepShaver/src/BeOS/about_window_beos.cpp delete mode 120000 SheepShaver/src/BeOS/audio_beos.cpp delete mode 100644 SheepShaver/src/BeOS/clip_beos.cpp delete mode 100644 SheepShaver/src/BeOS/ether_beos.cpp delete mode 120000 SheepShaver/src/BeOS/extfs_beos.cpp delete mode 100644 SheepShaver/src/BeOS/main_beos.cpp delete mode 100644 SheepShaver/src/BeOS/prefs_beos.cpp delete mode 100644 SheepShaver/src/BeOS/prefs_editor_beos.cpp delete mode 120000 SheepShaver/src/BeOS/scsi_beos.cpp delete mode 120000 SheepShaver/src/BeOS/serial_beos.cpp delete mode 120000 SheepShaver/src/BeOS/sys_beos.cpp delete mode 100644 SheepShaver/src/BeOS/sysdeps.h delete mode 120000 SheepShaver/src/BeOS/timer_beos.cpp delete mode 100644 SheepShaver/src/BeOS/user_strings_beos.cpp delete mode 100644 SheepShaver/src/BeOS/user_strings_beos.h delete mode 100644 SheepShaver/src/BeOS/video_beos.cpp delete mode 100644 SheepShaver/src/BeOS/video_screen.h delete mode 100644 SheepShaver/src/BeOS/video_window.h delete mode 120000 SheepShaver/src/BeOS/xpram_beos.cpp delete mode 120000 SheepShaver/src/CrossPlatform/sigsegv.cpp delete mode 120000 SheepShaver/src/CrossPlatform/sigsegv.h delete mode 120000 SheepShaver/src/CrossPlatform/video_blit.cpp delete mode 120000 SheepShaver/src/CrossPlatform/video_blit.h delete mode 120000 SheepShaver/src/CrossPlatform/video_vosf.h delete mode 120000 SheepShaver/src/CrossPlatform/vm_alloc.cpp delete mode 120000 SheepShaver/src/CrossPlatform/vm_alloc.h delete mode 100644 SheepShaver/src/EthernetDriver/.finf/Ethernet.mcp delete mode 100644 SheepShaver/src/EthernetDriver/.finf/ethernet.ndrv delete mode 100644 SheepShaver/src/EthernetDriver/.rsrc/ethernet.ndrv delete mode 100644 SheepShaver/src/EthernetDriver/Ethernet Data/.finf/CWSettingsMacOS.stg delete mode 100644 SheepShaver/src/EthernetDriver/Ethernet Data/.finf/PPC Debug MacOS Toolbox delete mode 100644 SheepShaver/src/EthernetDriver/Ethernet Data/.finf/PPC Final MacOS Toolbox delete mode 100644 SheepShaver/src/EthernetDriver/Ethernet Data/CWSettingsMacOS.stg delete mode 100644 SheepShaver/src/EthernetDriver/Ethernet Data/PPC Debug MacOS Toolbox/.finf/TargetDataMacOS.tdt delete mode 100644 SheepShaver/src/EthernetDriver/Ethernet Data/PPC Debug MacOS Toolbox/.rsrc/TargetDataMacOS.tdt delete mode 100644 SheepShaver/src/EthernetDriver/Ethernet Data/PPC Debug MacOS Toolbox/TargetDataMacOS.tdt delete mode 100644 SheepShaver/src/EthernetDriver/Ethernet Data/PPC Final MacOS Toolbox/.finf/TargetDataMacOS.tdt delete mode 100644 SheepShaver/src/EthernetDriver/Ethernet Data/PPC Final MacOS Toolbox/.rsrc/TargetDataMacOS.tdt delete mode 100644 SheepShaver/src/EthernetDriver/Ethernet Data/PPC Final MacOS Toolbox/TargetDataMacOS.tdt delete mode 100644 SheepShaver/src/EthernetDriver/Ethernet.cpp delete mode 100644 SheepShaver/src/EthernetDriver/Ethernet.mcp delete mode 100644 SheepShaver/src/EthernetDriver/cpu_emulation.h delete mode 100644 SheepShaver/src/EthernetDriver/debug.h delete mode 100644 SheepShaver/src/EthernetDriver/ether.cpp delete mode 100644 SheepShaver/src/EthernetDriver/ether.h delete mode 100644 SheepShaver/src/EthernetDriver/ether_defs.h delete mode 100644 SheepShaver/src/EthernetDriver/ethernet.ndrv delete mode 100644 SheepShaver/src/EthernetDriver/macos_util.cpp delete mode 100644 SheepShaver/src/EthernetDriver/macos_util.h delete mode 100644 SheepShaver/src/EthernetDriver/sysdeps.h delete mode 100644 SheepShaver/src/EthernetDriver/xlowmem.h delete mode 100644 SheepShaver/src/EthernetDriverFull.i delete mode 100644 SheepShaver/src/EthernetDriverStub.i delete mode 100644 SheepShaver/src/MacOSX/.gitignore delete mode 120000 SheepShaver/src/MacOSX/AudioBackEnd.cpp delete mode 120000 SheepShaver/src/MacOSX/AudioBackEnd.h delete mode 120000 SheepShaver/src/MacOSX/AudioDevice.cpp delete mode 120000 SheepShaver/src/MacOSX/AudioDevice.h delete mode 100644 SheepShaver/src/MacOSX/Info.plist.in delete mode 100644 SheepShaver/src/MacOSX/Launcher/AppController.h delete mode 100644 SheepShaver/src/MacOSX/Launcher/AppController.mm delete mode 100755 SheepShaver/src/MacOSX/Launcher/DiskType.h delete mode 100755 SheepShaver/src/MacOSX/Launcher/DiskType.m delete mode 100755 SheepShaver/src/MacOSX/Launcher/English.lproj/InfoPlist.strings delete mode 100755 SheepShaver/src/MacOSX/Launcher/English.lproj/MainMenu.nib/classes.nib delete mode 100755 SheepShaver/src/MacOSX/Launcher/English.lproj/MainMenu.nib/info.nib delete mode 100755 SheepShaver/src/MacOSX/Launcher/English.lproj/MainMenu.nib/keyedobjects.nib delete mode 100755 SheepShaver/src/MacOSX/Launcher/English.lproj/VMListWindow.nib/designable.nib delete mode 100755 SheepShaver/src/MacOSX/Launcher/English.lproj/VMListWindow.nib/keyedobjects.nib delete mode 100755 SheepShaver/src/MacOSX/Launcher/English.lproj/VMSettingsWindow.nib/designable.nib delete mode 100755 SheepShaver/src/MacOSX/Launcher/English.lproj/VMSettingsWindow.nib/keyedobjects.nib delete mode 100644 SheepShaver/src/MacOSX/Launcher/Info.plist delete mode 100644 SheepShaver/src/MacOSX/Launcher/LauncherPrefix.h delete mode 100644 SheepShaver/src/MacOSX/Launcher/SheepShaverLauncher.xcodeproj/project.pbxproj delete mode 100644 SheepShaver/src/MacOSX/Launcher/VMListController.h delete mode 100644 SheepShaver/src/MacOSX/Launcher/VMListController.mm delete mode 100755 SheepShaver/src/MacOSX/Launcher/VMSettingsController.h delete mode 100755 SheepShaver/src/MacOSX/Launcher/VMSettingsController.mm delete mode 100644 SheepShaver/src/MacOSX/Launcher/main.m delete mode 120000 SheepShaver/src/MacOSX/MacOSX_sound_if.cpp delete mode 120000 SheepShaver/src/MacOSX/MacOSX_sound_if.h delete mode 100644 SheepShaver/src/MacOSX/PrefsEditor/English.lproj/InfoPlist.strings delete mode 100644 SheepShaver/src/MacOSX/PrefsEditor/English.lproj/MainMenu.nib/classes.nib delete mode 100644 SheepShaver/src/MacOSX/PrefsEditor/English.lproj/MainMenu.nib/info.nib delete mode 100644 SheepShaver/src/MacOSX/PrefsEditor/English.lproj/MainMenu.nib/keyedobjects.nib delete mode 100644 SheepShaver/src/MacOSX/PrefsEditor/Info.plist delete mode 100644 SheepShaver/src/MacOSX/PrefsEditor/PrefsEditor.h delete mode 100644 SheepShaver/src/MacOSX/PrefsEditor/PrefsEditor.mm delete mode 100644 SheepShaver/src/MacOSX/PrefsEditor/SheepShaverPrefs.xcodeproj/project.pbxproj delete mode 100644 SheepShaver/src/MacOSX/PrefsEditor/main.m delete mode 100644 SheepShaver/src/MacOSX/PrefsEditor/standalone_nib/English.lproj/InfoPlist.strings delete mode 100644 SheepShaver/src/MacOSX/PrefsEditor/standalone_nib/English.lproj/MainMenu.nib/classes.nib delete mode 100644 SheepShaver/src/MacOSX/PrefsEditor/standalone_nib/English.lproj/MainMenu.nib/info.nib delete mode 100644 SheepShaver/src/MacOSX/PrefsEditor/standalone_nib/English.lproj/MainMenu.nib/keyedobjects.nib delete mode 100644 SheepShaver/src/MacOSX/SheepShaver.icns delete mode 100644 SheepShaver/src/MacOSX/SheepShaver.xcodeproj/project.pbxproj delete mode 100644 SheepShaver/src/MacOSX/XcodeBuildHowTo.txt delete mode 120000 SheepShaver/src/MacOSX/audio_macosx.cpp delete mode 120000 SheepShaver/src/MacOSX/autorelease.h delete mode 120000 SheepShaver/src/MacOSX/clip_macosx.cpp delete mode 120000 SheepShaver/src/MacOSX/clip_macosx64.mm delete mode 100644 SheepShaver/src/MacOSX/config/config-macosx-ppc_32.h delete mode 100644 SheepShaver/src/MacOSX/config/config-macosx-x86_32.h delete mode 100644 SheepShaver/src/MacOSX/config/config-macosx-x86_64.h delete mode 100644 SheepShaver/src/MacOSX/config/config.h delete mode 120000 SheepShaver/src/MacOSX/extfs_macosx.cpp delete mode 120000 SheepShaver/src/MacOSX/macos_util_macosx.h delete mode 100644 SheepShaver/src/MacOSX/prefs_macosx.mm delete mode 120000 SheepShaver/src/MacOSX/sys_darwin.cpp delete mode 120000 SheepShaver/src/MacOSX/utils_macosx.h delete mode 120000 SheepShaver/src/MacOSX/utils_macosx.mm delete mode 120000 SheepShaver/src/SDL delete mode 100644 SheepShaver/src/Unix/.gitignore delete mode 100644 SheepShaver/src/Unix/Darwin/.gitignore delete mode 120000 SheepShaver/src/Unix/Darwin/lowmem.c delete mode 120000 SheepShaver/src/Unix/Darwin/mkstandalone delete mode 120000 SheepShaver/src/Unix/Darwin/pagezero.c delete mode 120000 SheepShaver/src/Unix/Darwin/testlmem.sh delete mode 120000 SheepShaver/src/Unix/Irix/audio_irix.cpp delete mode 120000 SheepShaver/src/Unix/Linux/NetDriver delete mode 120000 SheepShaver/src/Unix/Linux/scsi_linux.cpp delete mode 100644 SheepShaver/src/Unix/Linux/sheepthreads.c delete mode 100644 SheepShaver/src/Unix/Makefile.in delete mode 100644 SheepShaver/src/Unix/NetBSD/sheepthreads.c delete mode 100644 SheepShaver/src/Unix/SheepShaver.1 delete mode 100644 SheepShaver/src/Unix/about_window_unix.cpp delete mode 120000 SheepShaver/src/Unix/audio_oss_esd.cpp delete mode 100755 SheepShaver/src/Unix/autogen.sh delete mode 120000 SheepShaver/src/Unix/bincue_unix.cpp delete mode 120000 SheepShaver/src/Unix/bincue_unix.h delete mode 120000 SheepShaver/src/Unix/clip_unix.cpp delete mode 120000 SheepShaver/src/Unix/config.guess delete mode 120000 SheepShaver/src/Unix/config.sub delete mode 100644 SheepShaver/src/Unix/configure.ac delete mode 120000 SheepShaver/src/Unix/cpr.sh delete mode 120000 SheepShaver/src/Unix/disk_sparsebundle.cpp delete mode 120000 SheepShaver/src/Unix/disk_unix.h delete mode 120000 SheepShaver/src/Unix/ether_unix.cpp delete mode 120000 SheepShaver/src/Unix/extfs_unix.cpp delete mode 100755 SheepShaver/src/Unix/install-sh delete mode 120000 SheepShaver/src/Unix/keycodes delete mode 120000 SheepShaver/src/Unix/ldscripts delete mode 120000 SheepShaver/src/Unix/m4 delete mode 100644 SheepShaver/src/Unix/main_unix.cpp delete mode 100755 SheepShaver/src/Unix/mkinstalldirs delete mode 100644 SheepShaver/src/Unix/paranoia.cpp delete mode 120000 SheepShaver/src/Unix/posix_sem.cpp delete mode 100644 SheepShaver/src/Unix/ppc_asm.S delete mode 100644 SheepShaver/src/Unix/ppc_asm.tmpl delete mode 100644 SheepShaver/src/Unix/prefs_editor_gtk.cpp delete mode 100644 SheepShaver/src/Unix/prefs_unix.cpp delete mode 120000 SheepShaver/src/Unix/rpc.h delete mode 120000 SheepShaver/src/Unix/rpc_unix.cpp delete mode 120000 SheepShaver/src/Unix/semaphore.h delete mode 120000 SheepShaver/src/Unix/serial_unix.cpp delete mode 100644 SheepShaver/src/Unix/sigregs.h delete mode 120000 SheepShaver/src/Unix/sshpty.c delete mode 120000 SheepShaver/src/Unix/sshpty.h delete mode 120000 SheepShaver/src/Unix/strlcpy.c delete mode 120000 SheepShaver/src/Unix/strlcpy.h delete mode 120000 SheepShaver/src/Unix/sys_unix.cpp delete mode 100644 SheepShaver/src/Unix/sysdeps.h delete mode 120000 SheepShaver/src/Unix/timer_unix.cpp delete mode 120000 SheepShaver/src/Unix/tinyxml2.cpp delete mode 120000 SheepShaver/src/Unix/tinyxml2.h delete mode 120000 SheepShaver/src/Unix/tunconfig delete mode 100644 SheepShaver/src/Unix/user_strings_unix.cpp delete mode 100644 SheepShaver/src/Unix/user_strings_unix.h delete mode 120000 SheepShaver/src/Unix/vhd_unix.cpp delete mode 100644 SheepShaver/src/Unix/video_x.cpp delete mode 120000 SheepShaver/src/Unix/xpram_unix.cpp delete mode 100644 SheepShaver/src/VideoDriverStub.i delete mode 100755 SheepShaver/src/Windows/Makefile.in delete mode 100755 SheepShaver/src/Windows/SheepShaver.ico delete mode 100755 SheepShaver/src/Windows/SheepShaver.rc delete mode 100755 SheepShaver/src/Windows/SheepShaverGUI.ico delete mode 100644 SheepShaver/src/Windows/SheepShaverGUI.rc delete mode 100755 SheepShaver/src/Windows/about_window_windows.cpp delete mode 120000 SheepShaver/src/Windows/b2ether delete mode 120000 SheepShaver/src/Windows/cd_defs.h delete mode 120000 SheepShaver/src/Windows/cdenable delete mode 120000 SheepShaver/src/Windows/clip_windows.cpp delete mode 100755 SheepShaver/src/Windows/configure.ac delete mode 120000 SheepShaver/src/Windows/ether_windows.cpp delete mode 120000 SheepShaver/src/Windows/ether_windows.h delete mode 120000 SheepShaver/src/Windows/extfs_windows.cpp delete mode 120000 SheepShaver/src/Windows/kernel_windows.cpp delete mode 120000 SheepShaver/src/Windows/kernel_windows.h delete mode 100755 SheepShaver/src/Windows/main_windows.cpp delete mode 120000 SheepShaver/src/Windows/posix_emu.cpp delete mode 120000 SheepShaver/src/Windows/posix_emu.h delete mode 120000 SheepShaver/src/Windows/prefs_editor_gtk.cpp delete mode 100755 SheepShaver/src/Windows/prefs_windows.cpp delete mode 120000 SheepShaver/src/Windows/router delete mode 120000 SheepShaver/src/Windows/serial_windows.cpp delete mode 120000 SheepShaver/src/Windows/sys_windows.cpp delete mode 100755 SheepShaver/src/Windows/sysdeps.h delete mode 120000 SheepShaver/src/Windows/timer_windows.cpp delete mode 100755 SheepShaver/src/Windows/user_strings_windows.cpp delete mode 100755 SheepShaver/src/Windows/user_strings_windows.h delete mode 120000 SheepShaver/src/Windows/util_windows.cpp delete mode 120000 SheepShaver/src/Windows/util_windows.h delete mode 120000 SheepShaver/src/Windows/xpram_windows.cpp delete mode 120000 SheepShaver/src/adb.cpp delete mode 120000 SheepShaver/src/audio.cpp delete mode 120000 SheepShaver/src/cdrom.cpp delete mode 120000 SheepShaver/src/disk.cpp delete mode 120000 SheepShaver/src/dummy/audio_dummy.cpp delete mode 120000 SheepShaver/src/dummy/clip_dummy.cpp delete mode 100644 SheepShaver/src/dummy/ether_dummy.cpp delete mode 100644 SheepShaver/src/dummy/prefs_dummy.cpp delete mode 120000 SheepShaver/src/dummy/prefs_editor_dummy.cpp delete mode 120000 SheepShaver/src/dummy/scsi_dummy.cpp delete mode 120000 SheepShaver/src/dummy/serial_dummy.cpp delete mode 100644 SheepShaver/src/emul_op.cpp delete mode 100644 SheepShaver/src/emul_ppc/emul_ppc.cpp delete mode 100644 SheepShaver/src/ether.cpp delete mode 120000 SheepShaver/src/extfs.cpp delete mode 100644 SheepShaver/src/gfxaccel.cpp delete mode 100644 SheepShaver/src/include/about_window.h delete mode 120000 SheepShaver/src/include/adb.h delete mode 120000 SheepShaver/src/include/audio.h delete mode 120000 SheepShaver/src/include/audio_defs.h delete mode 120000 SheepShaver/src/include/cdrom.h delete mode 120000 SheepShaver/src/include/clip.h delete mode 100644 SheepShaver/src/include/cpu_emulation.h delete mode 120000 SheepShaver/src/include/debug.h delete mode 120000 SheepShaver/src/include/disk.h delete mode 100644 SheepShaver/src/include/emul_op.h delete mode 100644 SheepShaver/src/include/ether.h delete mode 100644 SheepShaver/src/include/ether_defs.h delete mode 120000 SheepShaver/src/include/extfs.h delete mode 120000 SheepShaver/src/include/extfs_defs.h delete mode 100644 SheepShaver/src/include/macos_util.h delete mode 100644 SheepShaver/src/include/main.h delete mode 100644 SheepShaver/src/include/name_registry.h delete mode 120000 SheepShaver/src/include/pict.h delete mode 120000 SheepShaver/src/include/prefs.h delete mode 100644 SheepShaver/src/include/prefs_editor.h delete mode 100644 SheepShaver/src/include/rom_patches.h delete mode 100644 SheepShaver/src/include/rsrc_patches.h delete mode 120000 SheepShaver/src/include/scsi.h delete mode 120000 SheepShaver/src/include/serial.h delete mode 120000 SheepShaver/src/include/serial_defs.h delete mode 120000 SheepShaver/src/include/sony.h delete mode 120000 SheepShaver/src/include/sys.h delete mode 100644 SheepShaver/src/include/thunks.h delete mode 120000 SheepShaver/src/include/timer.h delete mode 100644 SheepShaver/src/include/user_strings.h delete mode 100644 SheepShaver/src/include/version.h delete mode 100644 SheepShaver/src/include/video.h delete mode 100644 SheepShaver/src/include/video_defs.h delete mode 100644 SheepShaver/src/include/xlowmem.h delete mode 120000 SheepShaver/src/include/xpram.h delete mode 100644 SheepShaver/src/kpx_cpu/dis-asm.h delete mode 100644 SheepShaver/src/kpx_cpu/include/a.out-defs.h delete mode 100644 SheepShaver/src/kpx_cpu/include/basic-blockinfo.hpp delete mode 100644 SheepShaver/src/kpx_cpu/include/basic-cpu.hpp delete mode 100644 SheepShaver/src/kpx_cpu/include/basic-plugin.hpp delete mode 100644 SheepShaver/src/kpx_cpu/include/block-alloc.hpp delete mode 100644 SheepShaver/src/kpx_cpu/include/elf-defs.h delete mode 100644 SheepShaver/src/kpx_cpu/include/nvmemfun.hpp delete mode 100644 SheepShaver/src/kpx_cpu/include/task-plugin.hpp delete mode 100644 SheepShaver/src/kpx_cpu/ppc-dis.c delete mode 100644 SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/block-cache.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/jit/amd64/dyngen-target-exec.h delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/jit/amd64/jit-target-cache.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/jit/amd64/jit-target-codegen.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/jit/basic-dyngen-ops.cpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/jit/basic-dyngen.cpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/jit/basic-dyngen.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/jit/cxxdemangle.cpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/jit/cxxdemangle.h delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/jit/dummy/jit-target-cache.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/jit/dyngen-exec.h delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/jit/dyngen.c delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/jit/jit-cache.cpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/jit/jit-cache.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/jit/jit-codegen.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/jit/jit-config.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/jit/jit-target-dispatch.h delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/jit/mips/dyngen-target-exec.h delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/jit/mips/jit-target-cache.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/jit/ppc/dyngen-target-exec.h delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/jit/ppc/jit-target-cache.hpp delete mode 120000 SheepShaver/src/kpx_cpu/src/cpu/jit/x86/codegen_x86.h delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/jit/x86/dyngen-target-exec.h delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/jit/x86/jit-target-cache.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/jit/x86/jit-target-codegen.hpp delete mode 100755 SheepShaver/src/kpx_cpu/src/cpu/ppc/genexec.pl delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-bitfields.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-blockinfo.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-config.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-cpu.cpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-cpu.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-decode.cpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-dyngen-ops.cpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-dyngen.cpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-dyngen.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-execute.cpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-execute.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-instructions.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-jit.cpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-jit.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-operands.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-operations.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-registers.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-translate.cpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/spcflags.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/cpu/vm.hpp delete mode 100755 SheepShaver/src/kpx_cpu/src/mathlib/ieeefp-i386.cpp delete mode 100755 SheepShaver/src/kpx_cpu/src/mathlib/ieeefp-i386.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/mathlib/ieeefp-mips.hpp delete mode 100755 SheepShaver/src/kpx_cpu/src/mathlib/ieeefp.cpp delete mode 100755 SheepShaver/src/kpx_cpu/src/mathlib/ieeefp.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/mathlib/mathlib-i386.cpp delete mode 100644 SheepShaver/src/kpx_cpu/src/mathlib/mathlib-i386.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/mathlib/mathlib-ppc.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/mathlib/mathlib-x86_64.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/mathlib/mathlib.cpp delete mode 100644 SheepShaver/src/kpx_cpu/src/mathlib/mathlib.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/test/test-powerpc.cpp delete mode 100644 SheepShaver/src/kpx_cpu/src/utils/utils-cpuinfo.cpp delete mode 100644 SheepShaver/src/kpx_cpu/src/utils/utils-cpuinfo.hpp delete mode 100644 SheepShaver/src/kpx_cpu/src/utils/utils-sentinel.hpp delete mode 100644 SheepShaver/src/macos_util.cpp delete mode 100644 SheepShaver/src/main.cpp delete mode 100644 SheepShaver/src/name_registry.cpp delete mode 120000 SheepShaver/src/pict.c delete mode 120000 SheepShaver/src/prefs.cpp delete mode 100644 SheepShaver/src/prefs_items.cpp delete mode 100644 SheepShaver/src/rom_patches.cpp delete mode 100644 SheepShaver/src/rsrc_patches.cpp delete mode 120000 SheepShaver/src/scsi.cpp delete mode 100644 SheepShaver/src/serial.cpp delete mode 120000 SheepShaver/src/slirp delete mode 120000 SheepShaver/src/sony.cpp delete mode 100644 SheepShaver/src/thunks.cpp delete mode 100644 SheepShaver/src/timer.cpp delete mode 100644 SheepShaver/src/user_strings.cpp delete mode 100644 SheepShaver/src/video.cpp delete mode 120000 SheepShaver/src/xpram.cpp delete mode 100644 cxmon/.gitignore delete mode 100644 cxmon/AUTHORS delete mode 100644 cxmon/COPYING delete mode 100644 cxmon/ChangeLog delete mode 100644 cxmon/INSTALL delete mode 100644 cxmon/Makefile.am delete mode 100644 cxmon/README delete mode 100755 cxmon/bootstrap delete mode 100644 cxmon/configure.ac delete mode 100644 cxmon/cxmon.1 delete mode 100644 cxmon/cxmon.spec.in delete mode 100644 cxmon/src/Makefile.am delete mode 100644 cxmon/src/disass/Makefile.am delete mode 100644 cxmon/src/disass/ansidecl.h delete mode 100644 cxmon/src/disass/bfd.h delete mode 100644 cxmon/src/disass/dis-asm.h delete mode 100644 cxmon/src/disass/floatformat.c delete mode 100644 cxmon/src/disass/floatformat.h delete mode 100644 cxmon/src/disass/i386-dis.c delete mode 100644 cxmon/src/disass/m68k-dis.c delete mode 100644 cxmon/src/disass/m68k-opc.c delete mode 100644 cxmon/src/disass/m68k.h delete mode 100644 cxmon/src/disass/opintl.h delete mode 100644 cxmon/src/main.cpp delete mode 100644 cxmon/src/mon.cpp delete mode 100644 cxmon/src/mon.h delete mode 100644 cxmon/src/mon_6502.cpp delete mode 100644 cxmon/src/mon_atraps.h delete mode 100644 cxmon/src/mon_cmd.cpp delete mode 100644 cxmon/src/mon_cmd.h delete mode 100644 cxmon/src/mon_disass.cpp delete mode 100644 cxmon/src/mon_disass.h delete mode 100644 cxmon/src/mon_lowmem.cpp delete mode 100644 cxmon/src/mon_lowmem.h delete mode 100644 cxmon/src/mon_ppc.cpp delete mode 100644 cxmon/src/mon_z80.cpp delete mode 100644 cxmon/src/sysdeps.h diff --git a/SheepShaver/COPYING b/SheepShaver/COPYING deleted file mode 100644 index 60549be5..00000000 --- a/SheepShaver/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) 19yy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/SheepShaver/Makefile b/SheepShaver/Makefile deleted file mode 100644 index 2fec37a1..00000000 --- a/SheepShaver/Makefile +++ /dev/null @@ -1,104 +0,0 @@ -# Makefile for creating SheepShaver distributions -# Written in 1999 by Christian Bauer - -VERSION := 2.3 -VERNAME := SheepShaver-$(VERSION) -CVSDATE := $(shell date "+%Y%m%d") - -SRCARCHIVE := $(VERNAME)-$(CVSDATE).tar.gz - -TMPDIR := $(shell date +/tmp/build%m%s) -ISODATE := $(shell date "+%Y-%m-%d %H:%M") -DOCS := NEWS -SRCS := src - -# Where Basilisk II directory can be found -B2_TOPDIR := ../BasiliskII - -default: help - -help: - @echo "This top-level Makefile is for creating SheepShaver distributions." - @echo "The following targets are available:" - @echo " tarball source tarball ($(SRCARCHIVE))" - @echo " links create links to Basilisk II sources" - -clean: - -rm -f $(SRCARCHIVE) - -# -# Source tarball -# -tarball: $(SRCARCHIVE) - -$(SRCARCHIVE): $(SRCS) $(DOCS) - -rm -rf $(TMPDIR) - mkdir $(TMPDIR) - cd $(TMPDIR); cvs export -D "$(ISODATE)" BasiliskII SheepShaver - cd $(TMPDIR)/SheepShaver/src/Unix && mkdir Darwin - cd $(TMPDIR)/SheepShaver && make links - cd $(TMPDIR)/SheepShaver/src/Unix && NO_CONFIGURE=1 ./autogen.sh - cd $(TMPDIR)/SheepShaver/src/Windows && NO_CONFIGURE=1 ../Unix/autogen.sh - rm $(TMPDIR)/SheepShaver/Makefile - cp -aL $(TMPDIR)/SheepShaver $(TMPDIR)/$(VERNAME) - cd $(TMPDIR); tar cfz $@ $(VERNAME) - mv $(TMPDIR)/$@ . - rm -rf $(TMPDIR) - -# -# Links to Basilisk II sources -# -links: - @list='adb.cpp audio.cpp cdrom.cpp disk.cpp extfs.cpp pict.c \ - prefs.cpp scsi.cpp sony.cpp xpram.cpp \ - include/adb.h include/audio.h include/audio_defs.h \ - include/cdrom.h include/clip.h include/debug.h include/disk.h \ - include/extfs.h include/extfs_defs.h include/pict.h \ - include/prefs.h include/scsi.h include/serial.h \ - include/serial_defs.h include/sony.h include/sys.h \ - include/timer.h include/xpram.h \ - BeOS/audio_beos.cpp BeOS/extfs_beos.cpp BeOS/scsi_beos.cpp \ - BeOS/serial_beos.cpp BeOS/sys_beos.cpp BeOS/timer_beos.cpp \ - BeOS/xpram_beos.cpp BeOS/SheepDriver BeOS/SheepNet \ - CrossPlatform/sigsegv.h CrossPlatform/sigsegv.cpp CrossPlatform/vm_alloc.h CrossPlatform/vm_alloc.cpp \ - CrossPlatform/video_vosf.h CrossPlatform/video_blit.h CrossPlatform/video_blit.cpp \ - Unix/audio_oss_esd.cpp Unix/bincue_unix.cpp Unix/bincue_unix.h \ - Unix/vhd_unix.cpp \ - Unix/extfs_unix.cpp Unix/serial_unix.cpp \ - Unix/sshpty.h Unix/sshpty.c Unix/strlcpy.h Unix/strlcpy.c \ - Unix/sys_unix.cpp Unix/timer_unix.cpp Unix/xpram_unix.cpp \ - Unix/semaphore.h Unix/posix_sem.cpp Unix/config.sub Unix/config.guess Unix/m4 \ - Unix/keycodes Unix/tunconfig Unix/clip_unix.cpp Unix/Irix/audio_irix.cpp \ - Unix/Linux/scsi_linux.cpp Unix/Linux/NetDriver Unix/ether_unix.cpp \ - Unix/rpc.h Unix/rpc_unix.cpp Unix/ldscripts \ - Unix/tinyxml2.h Unix/tinyxml2.cpp Unix/disk_unix.h \ - Unix/disk_sparsebundle.cpp Unix/Darwin/mkstandalone \ - Unix/Darwin/lowmem.c Unix/Darwin/pagezero.c Unix/Darwin/testlmem.sh \ - dummy/audio_dummy.cpp dummy/clip_dummy.cpp dummy/serial_dummy.cpp \ - dummy/prefs_editor_dummy.cpp dummy/scsi_dummy.cpp SDL slirp \ - MacOSX/sys_darwin.cpp MacOSX/clip_macosx.cpp MacOSX/clip_macosx64.mm \ - MacOSX/macos_util_macosx.h Unix/cpr.sh \ - MacOSX/extfs_macosx.cpp Windows/clip_windows.cpp \ - MacOSX/MacOSX_sound_if.cpp MacOSX/MacOSX_sound_if.h \ - MacOSX/AudioBackEnd.cpp MacOSX/AudioBackEnd.h \ - MacOSX/AudioDevice.cpp MacOSX/AudioDevice.h MacOSX/audio_macosx.cpp \ - MacOSX/utils_macosx.mm MacOSX/utils_macosx.h \ - Windows/cd_defs.h Windows/cdenable Windows/extfs_windows.cpp \ - Windows/posix_emu.cpp Windows/posix_emu.h Windows/sys_windows.cpp \ - Windows/timer_windows.cpp Windows/util_windows.cpp \ - Windows/util_windows.h Windows/xpram_windows.cpp \ - Windows/kernel_windows.h Windows/kernel_windows.cpp \ - Windows/serial_windows.cpp Windows/router Windows/b2ether \ - Windows/ether_windows.h Windows/ether_windows.cpp \ - Windows/serial_windows.cpp Windows/prefs_editor_gtk.cpp \ - uae_cpu/compiler/codegen_x86.h'; \ - PREFIX="../"; case $(B2_TOPDIR) in /*) PREFIX="";; esac; \ - for i in $$list; do \ - if test "$$i" != "\\"; then \ - echo $$i; o=$$i; \ - case $$i in *codegen_x86.h) o=kpx_cpu/src/cpu/jit/x86/codegen_x86.h;; esac; \ - SUB=`echo $$o | sed 's;[^/]*/;../;g' | sed 's;[^/]*$$;;'` ;\ - ln -sf "$$PREFIX$$SUB$(B2_TOPDIR)/src/$$i" src/$$o; \ - fi; \ - done; \ - ln -sf ../../../../../SheepShaver/src/Unix/config.h $(B2_TOPDIR)/src/Unix/Linux/NetDriver/config.h diff --git a/SheepShaver/NEWS b/SheepShaver/NEWS deleted file mode 100644 index 42719c15..00000000 --- a/SheepShaver/NEWS +++ /dev/null @@ -1,105 +0,0 @@ -SheepShaver NEWS -- history of user-visible changes. 2006-05-14 -Copyright (C) 1997-2006 Christian Bauer and Marc Hellwig - -Version 2.3 (snapshot) - 14.May.2006 -* Handle up to 1 GB of Mac memory -* Improve SLiRP network emulation performance -* Fix Native QuickDraw acceleration -* Fix a crash during MacOS 9 installation -* Fix a crash in the AppleShare extension -* Fix support for MacOS 7.5.3 Revision 2.2 -* Fix gigantic window dimensions on first boot -* Fix extfs volume name to "Unix" (Toshimitsu Tanaka) -* Fix unaligned accesses in SLiRP network emulation (Brian J. Johnson) -* Initial port to IRIX/mips -* MacOS X: - o Port to MacOS X for Intel, including the JIT - o Add a primitive graphical preferences editor - o Add support for run-time CD-ROM auto-detection - o Fix clipboard (copy/paste of text from/to the host OS) - o Fix extfs to preserve native folder attributes - o Fix extfs to handle file/folder creation times - o Fix SLiRP network emulation (workaround MacOS X bugs) - o Improve overall performance on PowerPC (by a factor 2) -* Windows: - o Add SLiRP network emulation ("ether slirp") - o Add TAP-Win32 network emulation ("ether tap") - o Fix CD-ROM auto-detection ("pollmedia" now works) - o Fix idle sleep ("idlewait" now works) - o Fix native cursor to be updated as soon as MacOS modified it - o Improve GUI for network configuration - -Version 2.3 (snapshot) - 30.Nov.2005 -* Add fullscreen DGA mode via fbdev in Linux -* Add "screen" prefs item a-la Basilisk II -* Add missing lvsl/lvsr instructions in AltiVec emulation (Adobe FrameMaker) -* Add support for old toolchain (gcc "2.96", glibc 2.2) -* Add user-space network emulation ("ether slirp" in prefs file) -* Add Ethernet and Serial support to Windows -* Add GTK+2 based GUI to Windows -* Add initial port to Darwin/x86 with JIT -* Improve portability of FPU emulation code to non C99 capable systems -* Improve interrupt processing in emulated mode -* Improve idle wait on Linux platforms -* Properly fail to load MacOS < 8.1 with NewWorld ROMs -* Fix native execution in Linux/PowerPC -* Fix PowerPC test-and-set implementation (fix clipboard) -* Fix Ethernet support in Linux, avoid hangs -* Fix occasional hangs during interrupt processing -* Fix High Resolution Timing code for Linux -* Fix support for 4+ GB hard disk images -* Fix SDL/x11 native cursor acceleration -* Fix sheep_net driver to properly work with Linux kernels up to 2.6.11 - -Version 2.3 (snapshot) - 21.Mar.2005 -* Implement high-precision timings on POSIX systems -* Add other SDL keysym translations -* Add some SSE2 optimizations to the AltiVec emulation core -* Add port to FreeBSD 5.3 and NetBSD 2.0 systems (x86 tested) -* Add initial port to Windows with SDL graphics -* Fix interrupt handling, registers are now fully preserved -* Fix support for native execution on recent Linux/PPC systems -* Fix support for Gossamer ROMs (PowerMac G3 Beige) -* Fix crash in Apple Personal Diagnostics on MacOS 9 -* Fix crash in Power Management on MacOS 9 - -Version 2.3 (snapshot) - 07.Jul.2004 -* Add support for MacOS 9.0.4 -* Add native port to MacOS X with SDL graphics -* Fix timebase emulation. UpTime() is now more accurate -* Fix hardware cursor acceleration in X11 -* Fix 'r' and key mappings for Apple X11 servers -* Fix video thread cancellation on MacOS X -* Fix detection of PowerPC 750FX and 970 processors - -Version 2.3 (snapshot) - 09.Jun.2004 -* Improve generic JIT engine to reach around 1/8-th of native speeds -* Improve 68k audio processing with "reentrant" JIT generated code -* Add Native QuickDraw acceleration for BitBlt (srcCopy) and FillRect -* Add TUN/TAP device support on Linux systems -* Add run-time depth switching. Support at least 1-bpp screens -* Add "idlewait" option to pause SheepShaver when MacOS is idle -* Fix ethernet support on little endian and 64-bit systems -* Fix initialization of NVRAM on first-time use - -Version 2.3 (snapshot) - 25.Feb.2004 -* Improved generic JIT, FPU instructions are now translated -* Add AltiVec emulation, emulated CPU is now a PowerPC 7400 (G4) -* Add initial port to MacOS X with an X11 server - -Version 2.3 (snapshot) - 14.Jan.2004 -* Fix several CPU emulation bugs, extended testsuite -* Fix FPU emulation, "scrollbar" & Graphing Calculator bugs are gone -* Add support for 64-bit platforms, more precisely AMD64 with JIT -* Add support for copy-paste of text on Unix/X11 systems -* Add support for wheel mice -* Better support for PowerMac PCI ROMs with more generic patches -* Better support for audio output (with pre-G3 PowerMac PCI ROMs) -* Improve native Linux/PPC port - -Version 2.3 (snapshot) - 25.Nov.2003 -* Initial public release with PowerPC CPU emulator for testing - -Version 2.2 (release) - 04.Feb.2002 -* Source released under GPL -* Integrated code from Basilisk II diff --git a/SheepShaver/doc/BeOS/acknowledgements.html b/SheepShaver/doc/BeOS/acknowledgements.html deleted file mode 100644 index 204e8d20..00000000 --- a/SheepShaver/doc/BeOS/acknowledgements.html +++ /dev/null @@ -1,24 +0,0 @@ - - -Acknowledgements - - - -

Acknowledgements

- -The following persons/companies deserve special thanks from us as they -made a significant contribution to the development of SheepShaver: - -

-

- -
-
-SheepShaver User's Guide -
- - diff --git a/SheepShaver/doc/BeOS/contact.html b/SheepShaver/doc/BeOS/contact.html deleted file mode 100644 index b4c00075..00000000 --- a/SheepShaver/doc/BeOS/contact.html +++ /dev/null @@ -1,47 +0,0 @@ - - -Contact Information - - - -

Contact Information and Copyright

- -SheepShaver was brought to you by - - -

SheepShaver WWW Site:

-
-www.sheepshaver.com
-
- -

EMail:

-
-Christian.Bauer@uni-mainz.de
-
- -

License

- -

SheepShaver is available under the terms of the GNU General Public License. -See the file "COPYING" that is included in the distribution for details. - -

© Copyright 1997-2004 Christian Bauer and Marc Hellwig - -

Names of hardware and software items mentioned in this manual and -in program texts are in most cases registered trade marks of the respective -companies and not marked as such. So the lack of such a note may not be -used as an indication that these names are free. - -

SheepShaver is not designed, intended, or authorized for use as a component -in systems intended for surgical implant within the body, or other applications intended -to support or sustain life, or for any other application in which the failure of SheepShaver -could create a situation where personal injury or death may occur (so-called "killer application"). - -


-
-SheepShaver User's Guide -
- - diff --git a/SheepShaver/doc/BeOS/graphics.gif b/SheepShaver/doc/BeOS/graphics.gif deleted file mode 100644 index 10a33553808ea9b69dd054448f4fe53f5cb227ee..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8854 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 diff --git a/SheepShaver/doc/BeOS/history.html b/SheepShaver/doc/BeOS/history.html deleted file mode 100644 index 8d016a73..00000000 --- a/SheepShaver/doc/BeOS/history.html +++ /dev/null @@ -1,59 +0,0 @@ - - -Revision History - - - -

SheepShaver Revision History

- -

V2.2 (04-Feb-2002)

-
    -
  • Integrated code from Basilisk II -
  • Source released under GPL -
- -

V2.1 (31-Mar-2001)

-
    -
  • Support for MacOS 8.5 and 8.6 -
  • Support for G3 ROMs -
  • It's possible to select which video modes are to be used by MacOS -
  • SheepShaver will not use up all CPU time when "nothing" is running -
  • More stable networking -
  • 16 and 32 bit window modes -
  • Small bug fixes -
- -

V2.0 (20-Jan-1999)

-
    -
  • "BeOS" icon on the Mac desktop to access files on BeOS volumes from Mac applications. -
  • Handling of removable media (i.e. automatic detection of disk insertion) -
  • More flexible parallel port selection on BeBox -
  • Greatly improved Time Manager (higher accuracy) -
  • Fixed "audio lags" -
  • Option to ignore illegal memory accesses -
  • Adapted for (and requires) BeOS R4 -
  • MacOS 7.5.5/7.6/7.6.1 run better on some systems -
  • Small bug fixes -
- -

V1.1 (13-Jul-1998)

-
    -
  • Support for more machine types (esp. PowerMac 4400) -
  • Corrected time zone handling -
  • Volume list in preferences handles dropped volumes and files -
  • BeBox: 16/24 bit modes have correct colors with a Millennium II -
  • Video/SetEntries didn't set last palette entry -
  • Mac programs trying to use the (non-existant) SCSI Manager shouldn't crash any longer -
- -

V1.0 (18-May-1998)

-
    -
  • Initial release -
- -
-
-SheepShaver User's Guide -
- - diff --git a/SheepShaver/doc/BeOS/icon.gif b/SheepShaver/doc/BeOS/icon.gif deleted file mode 100644 index 51368b117dcc38bde6f0ac4457387bad5fd31efa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2011 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 Kyw<#mUj7$_>qdM4 diff --git a/SheepShaver/doc/BeOS/index.html b/SheepShaver/doc/BeOS/index.html deleted file mode 100644 index 52328333..00000000 --- a/SheepShaver/doc/BeOS/index.html +++ /dev/null @@ -1,28 +0,0 @@ - - -The SheepShaver User's Guide - - - -

SheepShaver V2.2 Installation and User's Guide (BeOS)

- -

Contents

- - - -
-
-SheepShaver User's Guide -
- - diff --git a/SheepShaver/doc/BeOS/installation.html b/SheepShaver/doc/BeOS/installation.html deleted file mode 100644 index 105d9c8f..00000000 --- a/SheepShaver/doc/BeOS/installation.html +++ /dev/null @@ -1,25 +0,0 @@ - - -Installation - - - -

Installation

- -You need BeOS/PowerPC R4. R3 or earlier versions will not work. - -
    -
  1. Unpack the SheepShaver package (if you are reading this, you probably have already done this) -
  2. On a BeBox, you need a copy of a PCI PowerMac ROM (4MB) in a file -called "ROM" in the same folder SheepShaver is in (but you can select a different -location in the settings window). SheepShaver can also use the "Mac OS ROM" file -that comes with MacOS 8.5/8.6 (look in the System Folder on your MacOS CD). In -order to legally use SheepShaver, you have to own the ROM the image file was taken from. -
- -
-
-SheepShaver User's Guide -
- - diff --git a/SheepShaver/doc/BeOS/introduction.html b/SheepShaver/doc/BeOS/introduction.html deleted file mode 100644 index f3356787..00000000 --- a/SheepShaver/doc/BeOS/introduction.html +++ /dev/null @@ -1,45 +0,0 @@ - - -Introduction - - - -

Introduction

- -SheepShaver is a MacOS run-time environment for BeOS that allows you -to run MacOS applications at native speed inside the BeOS multitasking -environment on PowerPC-based BeOS systems. This means that both BeOS -and MacOS applications can run at the same time and data can be exchanged -between them. - -

SheepShaver is neither a MacOS replacement nor an emulator. It runs an -unmodified PowerPC MacOS under control of the BeOS at full speed without -any kind of emulation. So it also uses the MacOS 68k emulator to run 68k -applications. In this way, SheepShaver is comparable to the "Blue Box" of -Apple's Rhapsody operating system. - -

Some of SheepShaver's features:

- -
    -
  • Compatibility: SheepShaver runs MacOS 7.5.2 thru 8.6 with all system - extensions like AppleGuide, AppleScript, QuickTime, QuickTime VR, - QuickDraw 3D, Open Transport, PPP, Language Kits, ColorSync, etc. -
  • Graphics: The MacOS user interface is displayed in a BeOS window or - full-screen (with QuickDraw acceleration) in resolutions up to - 1600x1200 in 24 bit. -
  • Sound: CD-quality stereo sound output -
  • Networking: SheepShaver supports Internet and LAN networking via - Ethernet and PPP with all Open Transport compatible MacOS applications. -
  • Volumes: Any HFS or HFS+ volume can be used with SheepShaver (this - includes Zip/Jaz/SyQuest drives etc.). It also features a built-in - CD-ROM driver and a driver for HD floppy disks. -
  • Data Exchange: You can access BeOS files from the MacOS via a "BeOS" - icon on the Mac desktop and copy and paste text between BeOS and MacOS -
- -
-
-SheepShaver User's Guide -
- - diff --git a/SheepShaver/doc/BeOS/memory.gif b/SheepShaver/doc/BeOS/memory.gif deleted file mode 100644 index 9867b003e7f6922b967f969903d0154343e986f2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5510 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 I^&tQNJBtH3EC2ui diff --git a/SheepShaver/doc/BeOS/quickstart.html b/SheepShaver/doc/BeOS/quickstart.html deleted file mode 100644 index 62f9be15..00000000 --- a/SheepShaver/doc/BeOS/quickstart.html +++ /dev/null @@ -1,38 +0,0 @@ - - -Quick Start - - - -

Quick Start

- -The following is a step-by-step guide that shows you how to get SheepShaver -up and running in the quickest possible way. We assume that you are running -on a PowerMac that already has MacOS installed on a partition of your hard drive -and that you have booted into BeOS. - -

-

    -
  1. Double-click the SheepShaver icon. The "SheepShaver Settings" window will appear. -
  2. Click on "Start". SheepShaver will try to detect on which partition MacOS is installed and should then start booting MacOS. -
  3. If this is the first time you start SheepShaver you will be asked if you want your -network configuration to be modified to enable Ethernet networking under SheepShaver. -If you want to use Ethernet with SheepShaver you should press "OK" (this will change the -file /boot/home/config/settings/network; a backup of the the original file will -be stored in network.orig). -
  4. To quit SheepShaver, select "Shutdown" from the Finder's "Special" menu. -
- -

One word of caution:

- -Volumes which are used by SheepShaver must not also be mounted under BeOS -while SheepShaver is running. You will lose data and corrupt the -volume if you do this! Don't press the "Mount all disks now" button in the -BeOS "Disk Mount Settings" window while SheepShaver is running! - -
-
-SheepShaver User's Guide -
- - diff --git a/SheepShaver/doc/BeOS/serial.gif b/SheepShaver/doc/BeOS/serial.gif deleted file mode 100644 index b491d769dea310cfd695607bf91ca7b1749fd6cf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4844 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 Sec70u*_yrCoISlE0029JP30i~ diff --git a/SheepShaver/doc/BeOS/settings.html b/SheepShaver/doc/BeOS/settings.html deleted file mode 100644 index 7c05c2a9..00000000 --- a/SheepShaver/doc/BeOS/settings.html +++ /dev/null @@ -1,127 +0,0 @@ - - -Setting up SheepShaver - - - -

Setting up SheepShaver

- -In the "SheepShaver Settings" window that pops up when you double-click on -the SheepShaver icon, you can configure certain features of SheepShaver. -When you click on "Start", the current settings are saved to disk and will be -available next time you start SheepShaver. - -

The settings are divided into four groups: Volumes, Graphics/Sound, Serial/Network and Memory/Misc. - -

Volumes

- - - -

The main part of the volumes pane is a list that contains all volumes to be mounted -by SheepShaver. If this list is empty, SheepShaver will try to detect and mount all HFS partitions -it can find. CD-ROM drives are always automatically detected and used. - -

SheepShaver can use HFS partitions, whole HFS formatted drives, and it can also -emulate hard disks in single BeOS files ("hardfiles"). - -

To add a Mac volume to the list, mount it on the BeOS side, click on "Add...", go to the "Disks" -level in the topmost popup menu of the file panel, click once on the volume you want and -click on "Add". A line beginning with "/dev/disk/" should then appear in the volume list. -After adding volumes to the list, you should unmount them on the BeOS side again.To remove -a Mac volume, select it in the list and click on "Remove". - -

You can create a new, empty hardfile by clicking on "Create...". Enter the file -name and the size of the hardfile and click on "Create". The hardfile will be created (this may -take some seconds) and added to the volume list. The so-created hardfile will have to be -formatted under MacOS before you can store something in it. If you start up SheepShaver, -the Finder will display a message about an "unreadable" volume being found and give you the -option to format it. - -

Double-clicking on an entry in the volume list will add or remove a "*" in front of the -device name. Volumes marked with a "*" are read-only for the MacOS under SheepShaver. - -

SheepShaver will show a "BeOS" disk icon on the Mac desktop that allows access to BeOS -files from Mac applications. In "BeOS Root" you specify which BeOS directory will -be at the root of this virtual "BeOS" disk. You can enter a path name here or drag and drop a -Tracker folder onto it. The default setting of "/boot" means that the "BeOS" icon in the MacOS -Finder will correspond to your BeOS boot volume. If you want to access files on other BeOS -volumes, you should enter "/" here. The "BeOS" disk will then contain folders for each BeOS -volume (among other things). The MacOS will create files and folders like "Desktop", "Trash", -"OpenFolderListDF" etc. in the directory you specify as "BeOS Root". If they annoy you, you -can delete them. - -

To boot from CD-ROM, set the "Boot From" setting to "CD-ROM". -The "Disable CD-ROM Driver" box is used to disable SheepShaver's built-in CD-ROM driver. -This is currently of not much use and you should leave the box unselected. - -

Graphics/Sound

- - - -

WIth "Window Refresh Rate" you can set the refresh rate of the MacOS window. -Higher rates mean faster screen updates and less "sluggish" behaviour, but also require more CPU time. - -

The "QuickDraw Acceleration" box should always be enabled. It allows for faster graphics in -full-screen modes. But if your machine uses the "IXMicro" BeOS video driver, you have to disable the -QuickDraw acceleration or full-screen modes won't work (this is because of BeOS bug #981112-032247). - -

The main part of the window is occupied by a list of checkboxes that allows you to select -which graphics modes are available for displaying the MacOS desktop. You can, for -example, disable the modes that your monitor or graphics card can't display, or disable the -window modes when you want to run some Mac programs in full-screen mode that would otherwise -erroneously switch to a window mode. The actual mode to be used is selected in the "Monitors" -control panel under MacOS. - -

The "Disable Sound Output" box allows you to disable all sound output by SheepShaver. -This is useful if the sound takes too much CPU time on your machine or to get rid of warning -messages if SheepShaver can't use your audio hardware. - -

Serial/Network

- - - -

You can select to which ports the MacOS modem and printer ports are redirected. -This doesn't make much sense on a PowerMac, but on a BeBox you can assign the modem -and printer ports to any of the four serial ports (or com3/com4) or even parallel ports of -the BeBox (useful for printing if you have Mac drivers for parallel printers, like the PowerPrint -package from www.gdt.com). - -

If you don't want SheepShaver's Ethernet support to be enabled for some reason, you -can use the "Disable Ethernet" checkbox to disable it (this will also get rid of the annoying -"no network hardware" messages if your Mac is not equipped with Ethernet). - -

Memory/Misc

- - - -

With "MacOS RAM Size" you select how much RAM will be available to the MacOS -(and all MacOS applications running under it). SheepShaver uses the BeOS virtual memory system, -so you can select more RAM than you physically have in your machine. The MacOS virtual memory -system is not available under SheepShaver (i.e. if you have 32MB of RAM in your computer and -select 64MB to be used for MacOS in the SheepShaver settings, MacOS will behave as if it's running on -a computer that has 64MB of RAM but no virtual memory). - -

The "Ignore Illegal Memory Accesses" option is there to make some broken Mac -programs work that access addresses where there is no RAM or ROM. With this option unchecked, -SheepShaver will in this case display an error message and quit. When the option is activated, -SheepShaver will try to continue as if the illegal access never happened (writes are ignored, reads -return 0). This may or may not make the program work (when a program performs an illegal access, -it is most likely that something else went wrong). When a Mac program behaves strangely or hangs, -you can quit SheepShaver, uncheck this option and retry. If you get an "illegal access" message, -you will know that something is broken. - -

If the "Don't Use CPU When Idle" option is enabled, SheepShaver will try to reduce -CPU usage to a minimum when the MacOS is doing "nothing" but waiting for user input. This doesn't -work with all programs and it may confuse the timing of some games but in general you should -leave it enabled. - -

"ROM File" specifies the path name of the Mac ROM file to be used. If it is left -blank, SheepShaver expects the ROM file to be called "ROM" and be in the same directory as -the SheepShaver application. - -


-
-SheepShaver User's Guide -
- - diff --git a/SheepShaver/doc/BeOS/troubleshooting.html b/SheepShaver/doc/BeOS/troubleshooting.html deleted file mode 100644 index b46aa585..00000000 --- a/SheepShaver/doc/BeOS/troubleshooting.html +++ /dev/null @@ -1,79 +0,0 @@ - - -Troubleshooting - - - -

Troubleshooting

- -

SheepShaver doesn't boot

- -SheepShaver should boot all MacOS versions >=7.5.2, except MacOS X. However, -your mileage may vary. If it doesn't boot, try again with extensions disabled -(by pressing the shift key) and then remove some of these extensions: -"MacOS Licensing Extension", Speed Doubler, 68k FPU extensions and MacsBug. - -

The colors are wrong in 16 or 32 bit graphics modes

- -If you're running SheepShaver on a BeBox, the only graphics modes that have -the right colors are the 8 bit modes (this is actually a hardware problem -and has to do with frame buffers being little-endian on the BeBox), unless -you are using a Matrox Milennium I/II. -

You should also be aware that not all graphics cards support 16 bit modes -under BeOS (especially S3 cards don't). Check the BeOS "Screen" preferences -application to see if your card does. - -

SheepShaver appears to be very slow

- -
    -
  • Don't use the window modes, the fullscreen modes are much faster. -
  • If you nevertheless want (or have) to use a window mode, you should set the -color depth in MacOS to the same as the BeOS workspace you are running SheepShaver on -(e.g. if you are on a 16-bit workspace, set the color depth in MacOS to "Thousands"). -Also, set the window refresh rate to a low value (high values like 30Hz will make SheepShaver -(and BeOS) slower, not faster!). -
- -

Full-screen mode doesn't work

- -If your machine uses the "IXMicro" BeOS video driver (TwinTurbo cards), you -will have to disable the "QuickDraw Acceleration" in the "Video" pane of the -SheepShaver settings. - -

Ethernet doesn't work

- -
    -
  • Is the Ethernet set up under BeOS? Ethernet will not work in SheepShaver if you didn't set it up in the BeOS "Network" preferences. -
  • If you're using TCP/IP on the MacOS side, you have to set up different IP addresses for the BeOS and for the MacOS. -
  • Try disabling AppleTalk in the BeOS Network preferences (there might be conflicts between BeOS AppleTalk and SheepShaver networking). -
- -

SheepShaver crashes, but yesterday it worked

- -Try the "Zap PRAM File" item in the main menu of the SheepShaver preferences editor. -When you are using a ROM file and switching to a different ROM version, you have -to zap the PRAM file or SheepShaver might behave very weird. - -

Known incompatibilities

- -
    -
  • MacOS programs or drivers which access Mac hardware directly are not supported by SheepShaver. -
  • Speed Doubler, RAM Doubler, 68k FPU emulators and similar programs don't run under SheepShaver. -
  • MacsBug is not compatible with SheepShaver. -
  • If you want to run RealPC on a BeBox, you have to disable one CPU in the "Pulse" application or it will crash. -
- -

Known bugs

- -
    -
  • The QuickTime 2.5 Cinepak codec crashes the emulator. -
  • Programs that use InputSprockets crash the emulator when in window mode. -
  • The mouse cursor hotspot in window mode is not correct. -
- -
-
-SheepShaver User's Guide -
- - diff --git a/SheepShaver/doc/BeOS/using.html b/SheepShaver/doc/BeOS/using.html deleted file mode 100644 index 8f9395bc..00000000 --- a/SheepShaver/doc/BeOS/using.html +++ /dev/null @@ -1,76 +0,0 @@ - - -Using SheepShaver - - - -

Using SheepShaver

- -

Changing the display mode

- -SheepShaver can display the MacOS user interface in a BeOS window or full-screen -(much faster) in several resolutions and color depths. You select the display mode -as usual under MacOS in the "Monitors" control panel (under System 7.x, click on "Options"). -The "75Hz" modes are full-screen modes, the "60Hz" modes are window modes -(this doesn't mean that the video refresh rate is 75 or 60Hz in the respective modes; -the rate displayed has no meaning; it's simply there to distinguish full screen modes -from window modes). - -

Window mode

- -The SheepShaver window has a menu at the bottom that allows you to change the -graphics refresh rate and to mount floppy disks (see below). The window refresh is -disabled as long as the "Scroll Lock" key is pressed (the graphics output is then frozen). - -

Full-screen mode

- -The full-screen mode uses a whole BeOS workspace for displaying the MacOS user -interface. You can switch workspaces with Command-F1/F2/F3/etc. Please note that -the MacOS (and all MacOS applications) will be suspended when you switch to a different -workspace. It will only be resumed when you go back to the SheepShaver workspace. - -

Networking

- -SheepShaver only supports Ethernet networking (and PPP via the serial -ports). If there are multiple Ethernet cards installed, only the first -card will be used. The Ethernet support is implemented at the data-link -level. This implies that the "Mac" and the "Be" side must have two different -network addresses. - -

Using floppy disks

- -Floppy disks are not automatically detected when they are inserted. They have to be -mounted explicitly. After inserting a floppy disk, select the "Mount Floppy" item in the -"SheepShaver" menu (when running in window mode), or press Ctrl-F1 (when running in -full-screen mode). BeBox users should note that floppy disks also have to be unmounted -under MacOS before ejecting them from the drive. - -

Accessing BeOS files

- -SheepShaver will display a "BeOS" disk icon on the Mac desktop that allows you -to access any BeOS files/folders which are in the directory specified as "BeOS Root" -in the "Volumes" pane of the SheepShaver settings. You can open and save files on the -"BeOS" disk from Mac applications, copy, move or rename files from the Finder etc. -Putting files/folder to the trash may however not always work. SheepShaver translates -some BeOS file types to MacOS types and vice versa, so e.g. JPEG and PDF files will -show up the correct icons in the Finder. To store Mac resources and other additional -data, SheepShaver uses the following BeOS file attributes: - -
    -
  • MACOS:RFORK contains the complete Mac resource fork of the file -
  • MACOS:HFS_FLAGS contains Finder flags -
  • MACOS:CREATOR contains the MacOS creator application ID -
- -

Copying text via the clipboard

- -SheepShaver tries to keep the BeOS and MacOS clipboards synchronized. That means, -when you copy a piece of text under BeOS, you can paste it into a MacOS application -and vice versa. - -
-
-SheepShaver User's Guide -
- - diff --git a/SheepShaver/doc/BeOS/volumes.gif b/SheepShaver/doc/BeOS/volumes.gif deleted file mode 100644 index 857dd0a21e5144e9ab9a4de2309c827b8c3193ed..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7456 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 diff --git a/SheepShaver/doc/Linux/acknowledgements.html b/SheepShaver/doc/Linux/acknowledgements.html deleted file mode 100644 index 5d8c9fd6..00000000 --- a/SheepShaver/doc/Linux/acknowledgements.html +++ /dev/null @@ -1,24 +0,0 @@ - - -Acknowledgements - - - -

Acknowledgements

- -The following persons/companies deserve special thanks from us as they -made a significant contribution to the development of SheepShaver: - -

-

- -
-
-SheepShaver User's Guide -
- - diff --git a/SheepShaver/doc/Linux/contact.html b/SheepShaver/doc/Linux/contact.html deleted file mode 100644 index f8a640e1..00000000 --- a/SheepShaver/doc/Linux/contact.html +++ /dev/null @@ -1,47 +0,0 @@ - - -Contact Information - - - -

Contact Information and Copyright

- -SheepShaver was brought to you by - - -

SheepShaver WWW Site:

-
-www.sheepshaver.com
-
- -

EMail:

-
-sheep@sheepshaver.com
-
- -

License

- -

SheepShaver is available under the terms of the GNU General Public License. -See the file "COPYING" that is included in the distribution for details. - -

© Copyright 1997-2004 Christian Bauer and Marc Hellwig - -

Names of hardware and software items mentioned in this manual and -in program texts are in most cases registered trade marks of the respective -companies and not marked as such. So the lack of such a note may not be -used as an indication that these names are free. - -

SheepShaver is not designed, intended, or authorized for use as a component -in systems intended for surgical implant within the body, or other applications intended -to support or sustain life, or for any other application in which the failure of SheepShaver -could create a situation where personal injury or death may occur (so-called "killer application"). - -


-
-SheepShaver User's Guide -
- - diff --git a/SheepShaver/doc/Linux/graphics.gif b/SheepShaver/doc/Linux/graphics.gif deleted file mode 100644 index 267a4f9e23bfbc42241480af5595afebb54cecb1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5480 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 Uze4t5g<^T-ZlVK - -Revision History - - - -

SheepShaver Revision History

- -

V2.2 (04-Feb-2002)

-
    -
  • Integrated code from Basilisk II -
  • Source released under GPL -
- -

V2.1 (31-Mar-2001)

-
    -
  • Initial Linux PPC release -
- -
-
-SheepShaver User's Guide -
- - diff --git a/SheepShaver/doc/Linux/icon.gif b/SheepShaver/doc/Linux/icon.gif deleted file mode 100644 index 51368b117dcc38bde6f0ac4457387bad5fd31efa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2011 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 Kyw<#mUj7$_>qdM4 diff --git a/SheepShaver/doc/Linux/index.html b/SheepShaver/doc/Linux/index.html deleted file mode 100644 index 3fb408d0..00000000 --- a/SheepShaver/doc/Linux/index.html +++ /dev/null @@ -1,28 +0,0 @@ - - -The SheepShaver User's Guide - - - -

SheepShaver V2.2 Installation and User's Guide (Linux)

- -

Contents

- - - -
-
-SheepShaver User's Guide -
- - diff --git a/SheepShaver/doc/Linux/installation.html b/SheepShaver/doc/Linux/installation.html deleted file mode 100644 index 75f588fc..00000000 --- a/SheepShaver/doc/Linux/installation.html +++ /dev/null @@ -1,25 +0,0 @@ - - -Installation - - - -

Installation

- -You need at least a 2.2.x kernel, glibc 2.1 and GTK+ 1.2. Earlier versions will not work. - -
    -
  1. Unpack the SheepShaver archive (if you are reading this, you probably have already done this) -
  2. Even when running on a PowerMac, you need a copy of a PCI PowerMac ROM (4MB) in -a file called "ROM" in the same folder SheepShaver is in (but you can select a different location -in the settings window). SheepShaver can also use the "Mac OS ROM" file that comes with -MacOS 8.5/8.6 (look in the System Folder on your MacOS CD). In order to legally use SheepShaver, -you have to own the ROM the image file was taken from. -
- -
-
-SheepShaver User's Guide -
- - diff --git a/SheepShaver/doc/Linux/introduction.html b/SheepShaver/doc/Linux/introduction.html deleted file mode 100644 index 42d78a4e..00000000 --- a/SheepShaver/doc/Linux/introduction.html +++ /dev/null @@ -1,44 +0,0 @@ - - -Introduction - - - -

Introduction

- -SheepShaver is a MacOS run-time environment for Linux that allows you -to run MacOS applications at native speed inside the Linux multitasking -environment on PowerPC-based Linux systems. This means that both Linux -and MacOS applications can run at the same time and data can be exchanged -between them. - -

SheepShaver is neither a MacOS replacement nor an emulator. It runs an -unmodified PowerPC MacOS under control of Linux at full speed without any -kind of emulation. So it also uses the MacOS 68k emulator to run 68k -applications. In this way, SheepShaver is comparable to the "Blue Box" of -Apple's Rhapsody operating system. - -

Some of SheepShaver's features:

- -
    -
  • Compatibility: SheepShaver runs MacOS 7.5.2 thru 8.6 with all system - extensions like AppleGuide, AppleScript, QuickTime, QuickTime VR, - QuickDraw 3D, Open Transport, PPP, Language Kits, ColorSync, etc. -
  • Graphics: The MacOS user interface is displayed in an X11 window or - full-screen (requires DGA) -
  • Sound: CD-quality stereo sound output -
  • Networking: SheepShaver supports Internet and LAN networking via - Ethernet and PPP with all Open Transport compatible MacOS applications. -
  • Volumes: Any HFS or HFS+ volume can be used with SheepShaver (this - includes Zip/Jaz/SyQuest drives etc.). It also features a built-in - CD-ROM driver and a driver for HD floppy disks. -
  • Data Exchange: You can access Linux files from the MacOS via a "Linux" - icon on the Mac desktop and copy and paste text between Linux and MacOS -
- -
-
-SheepShaver User's Guide -
- - diff --git a/SheepShaver/doc/Linux/memory.gif b/SheepShaver/doc/Linux/memory.gif deleted file mode 100644 index f09a46076f5524ad6585b455fffd104826784efa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5697 zcmajecRUn;|HpAjWkhA3z1JC;$5~~B>}(=*arUZg$v$M9v&oFJ!&!%uy~#Lx?<2~} zD(?IH{-5vf`FQ>Jc|6|#ebk<-N`q}OZ#}tnMnHi7e?ai~eDK2ne=sj^KX~{O|3*zwne8Pw3PkUegyX~zL~1_C?XO;$iO>(RFQT%{u=C%{#N;W z=F`wiZ2$4HUY-$P*-LW12k)Tr&M2VmSHea6kA$f zG2a04Kf3HC6CNzJI^JCzZ1}Y#OW@~&RxYSo?SxSYyc%k(Uhhrd)XdgG*K7`^i90O~ zp;6G`k9Q_W<JAaD)VcnlD*NusGVf6lqZ3`u1)oE!wT<=2& zSdFxxkGDq)G;?$?GVbFAw^Qq1Es&vuHdH+Dth%i&7st4XGOHjK*&W%v^}!t7Z>?8< z&I_BTDRO*Q{&tLo%moqLm9`H4PU6E5Oq^e2{op?BxpnB!KCfxez%yKi%ePrChRE7L zz#5FHV{7#ZwpKOkBf|&SsuSmF)k__YXrI?GmZFIK=+5eyMaSB7K!J<+63jeKa;bxZIJ+sJUza>GpQo>#6ex0Z&tA8J*?s(q|TY>fr+viY9W- z!^0wgj=8FpUi`(c%r7$$-RyJQ#Z^6c;E(cCdcTaaE+K{m$Fh^%A79(<3hY&N(K_u_ z_gy<~)(nAu?4d?g1@>#P#!mZnGj?VB^$T9j6_phA8C(8e$4i%zaO3troA$<`Wsd7d zCaxZ6%L|)02|s(c=D(+dt}e->r_AoVcfo6|^3eheX!PZegU*NXm%^2u!HkF90BHGA z*J0(XySK3scBGG1afaLF;8AB@GLzCko{wpM>6ci3&gX@RC3AgZgM4MDM->88d&PtD zYCu#{=4)_Ck5+2$VaL&jg%hlyiO}N2tKxnn*4TUh_jJ2W#rynrv-_vB_J0IGoixb( z(|NkD%Ggf*AAPdN*ipRavdzb8H0mcDqtk)(EZ z-jWQh1iw#xi@Dg&6_`e^UhI@-Dm1NC^uD_MQ8Vq@>`uL0+58jDsTM;Q zK6W&F5KE$~Jk<u%7uJNEjNXKdPdCG4mwBBR<`+hchRjtK(&SI%5?& zFYRmzdRO7ym>Y>4`R46Wxx*DYp6l}m(?R%yU;a9Ovn0OZ>GguXujdf1PFJ@H9Rz2- z{jOo|nL?V_EesgSy(`t%Uc1u$nC*TZu^MqlRV@*ZBz^l`RT0A4Vs2hp@PMvgNM&9c zj!%qBgThQnxnSiW0u)A0f%nMoWFdS6RM=yG5Ic@2I(NVQ@!^`Gf_ewg{4m<|MBSdP zFF=nXC&G~}R1#sI595Lu*jUcaLGnk3@z%$j zdre{NY@he!EasA<2)&px6?x%|GBh3oNnA#XKNH@G(I<(h^lOMA5yegh?WFbDM1&d% zwtuL&@@^08lcKOp;VhPm&rM`l5`__kBFV2b>VgOJ1eHjLXRyX$Xwi&%ZP`TDSr}#_*eN++;R7Q+ybf(SBVW@h zszn@cdBeot|6=gmkkjcwW{)HKr*)5OVJNiD7ceuM-S9rC&A*X1+x_7`=>1WrE)?b&aIp*rh|OE zto!YPtdrdQn?!cyXlmy!@e<8pzUk)5q>9kk0xJ`JtL_nU6!fjLanzB&*ckY{P){N=xMd|_DB=3>q$0JM)Izo0|w9O~;Ue@9)JEn7jx5T8M zVBya@&)`Wv^?VpUE4}-x*Zf}Pz5U=xcHwaG=uV->{5!NIvn_k=D_ighu&dA6V~WJQK546_Hx@$N**;09^~6)nI1u|8Td zEbA~sanJtwgqg5+)G>;J<%m?pkJUmRU$1(6)!mUooK0;P{3uJl+HhG0ays3^6Lhcw z$S1E6;>vjJbUe$#yJb)8y^_p!U9qFolh43rsju*_cIomh(2Gbf+#9c*NPcN02~enr z`!r)pJ^oDTE(vq!&>vNPVnc1ghu#EMKa!DJ`FY<*8Sq(heIf<&MpEU=K` zqL6BX5Mg^+5kP2-c&NmT49F)Gi3pXEmKB@{g?5ELJqIgEhh-RqshWb-)4~v_Fs(jm zo%678s&IX2X+zWSz_;P1K2qk5;qNEHU!8-j0TB-35pR4zc0LhShzQ3SNz=&)G6@HF zds$EE$eP;@6PzY^h^dz;n@_P>`jnZoQNZsB>vxk(LF)2b1(C~~umHTYk9{{R)dOZv z>4m0c`)Ep!&y^2JrbvjyeoSfA*F*HP((Fb_%k z83a{U-~EMS6MS1tqAj4!GEV=MIJFs^))x*)hclqzTg8;52XHp} zL=JEwmsui@Zz5lMA`qP@IGZSZk;t?2MqUabK|-L`^F|tBrR|Xmc~Z$ zQL+ZyLR6HyyW8UTGYFtwg|o=Ul3wMaJLO52&EfA9krNfrhQ$F*>g9W7Rf%MsQHb^% z4pA)QxIS&?8J*r62s$c*v5owRC>_Yos+GjD!NKai zs6{J@b%{g99WU$KcFBrk8DG(#O{p`fR5Nwah#7oT(sNMuCw|02diEk%vE^CP&*#}l zk{tCZORfmTxsvSj9XcugoWHX<%!V{%^tpsGxkP>s9gpIJBx3J0<=&smrMS#}NSbF8 zkxSqZ^;$LW?*tUy6#!t6VaTwHCCX>kkY@GsXz^n7I#mVbd#P|h&9>ij%1CniiG8M4 z+nMJ3S|lbyRiGta(CVR+mG8kK<`KKbE>6hV+Fl?gleeo#zFS|Qp&=>GP*@Sl_sFl% zG^5bGsn9~^;k9~Uok67aob+p%q8NiBJB@s+j3OjwB+VF`n}!3F5_x+(uI zWrO%>5m&j4r+lv11z{mqzMDX(#GiW{-5Rc}XW|*2;yi><;>H3g$_m=)GAVP;r->Z- zm*us$oUc+1>wp0sT?}8_#WyY=h*0sTA)RV#N-$ex_w6NAIC$O}zyC>F`rZ7?i?atq zr9l+Z!6cj-Ua0|UkP0UvT|HhGq@Vgvwddgf8+5<->f_g6(ZFLF&mdm@wDD@Sj?$Bi zGSXev$J@vT4a3x3VFa+`F_~Vl$yX=5Ba`?`=48i`ts0a_CdveYYRX`GT80vr(hAY9 zRTL2LDy&u2EK&c%tJ7RtMX2qZ5&p!dE}%2QoKe7HzOHH`pj6qwItJ7NE%PH}ys~jJ zh;%9z6*=qpz^~yBa8!3@Z1C`}utNGOI~hKQx~33{4;rg0Dp#{4LYXP6j3R+3xTg^x zlvhc@;9jFhlV?C?%^LxU5`C`hclpNN?0VZSF<&a%MFFpsD6T}g-xN1(tMGJ8d$04< zf1?hp*6{oj&9S}Z#_QLhvFt;_28NHS1|TS%9Ge>&-=ZST>+RF(Mt^{; zWHEXI&C4f-Q)HmYX3XPA%qTw9e>qKf<7MlXe=9Dtb+@^7Z@%^CpVkA$Z%4A$7-+tI7h@K6MqAqLtQyPP$rB zCmZI<^b~;{`!WI9G2QIuok|8hgWf&EbloU{R(m-~0lD6@7rkBqZ$-0u>1evr2YV?( zdp|OQ&4rplw2ES9CM@8B4?gpqxLXbEExnbG#8%bBHoe6fSDg-` z-NqxnKm-Fw&)hmsouiwbQJ{fkV>R25##Vp+5@%=EmoD|jF4V>S?SuWF{}yc_B_R4k zrEBU|`i!|9=*iMbYq6U5c0+G98!AehYR9;y%Uw|LVaRFVI`0P#&JS=Vu2U~puu_Y~ zrxE;?`|wcDmjKVR6i?fh#vP5v0mFf$wTxGvck$xt!ZB8vI*cwzmx zU|{X_Uc+PNdLBHcUA$skl(|PLwpbW5QG=aOSnL1?jwuFWB$-E_k@InW#->YPJ%_L& zf!Lt?lS)F9c&*8ZT`XnnWJJLv-|%DtDb{-N#VckMB(V2&;1p-_l%sZ^^Ws#V@l@pf z>3hzTV%pR8LeoBrlU@}Q{@PQ4+Snj+l%MSENLWqAA28U}WH1vskU z-CpF}!7Tq}UYavqCR_qs#WI~#EW@j#B-%{caez=G`g6;b`wH~90tNaJ0F{pErlko! zHfl(Fm?M_>6D2{?1MhDWEWx!W@t5+T`t$cd6zHn^HyR?dUvD$RD z1g~Cg;xh}P`Si4Pi8T(!&H}piVdWG1M!nibO10b&WPS8_!%}ihUtyC-VdL)gW>nrL zhJ5pt&Xz69mXX4iqbtDf)f9)$6N%BnJ7a5iT(^nXV@9vG5=9rOt|I9Ig!cC_{S^y) tJRUe$B};TG4mXC2b7k>Q%t?B+lX6W%CXUN!-N{ - -Quick Start - - - -

Quick Start

- -The following is a step-by-step guide that shows you how to get SheepShaver -up and running in the quickest possible way. We assume that you are running -on a PowerMac that already has MacOS installed on a partition of your hard drive -and that you have booted into Linux. - -

-

    -
  1. Start the "SheepShaver" program. The "SheepShaver Settings" window will appear. -
  2. Click on "Start". SheepShaver will try to detect on which partition MacOS is installed and should then start booting MacOS. -
  3. To quit SheepShaver, select "Shutdown" from the Finder's "Special" menu. -
- -When SheepShaver hangs or crashes in fullscreen mode, pressing Ctrl-Esc should -quit it and restore the display. - -

In fullscreen mode, press Ctrl-Tab to suspend SheepShaver and return to the -normal X11 destop. Press space inside the "SheepShaver suspended" window to -reactivate it. - -

One word of caution:

- -Volumes which are used by SheepShaver must not also be mounted under Linux -while SheepShaver is running. You will lose data and corrupt the -volume if you do this! - -
-
-SheepShaver User's Guide -
- - diff --git a/SheepShaver/doc/Linux/serial.gif b/SheepShaver/doc/Linux/serial.gif deleted file mode 100644 index 49ca90f95d9d0525684991a2611d9fecb741dc77..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5325 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 O30 - -Setting up SheepShaver - - - -

Setting up SheepShaver

- -In the "SheepShaver Settings" window that pops up when you start SheepShaver, -you can configure certain features of SheepShaver. When you click on "Start", -the current settings are saved to disk and will be available next time you start -SheepShaver. - -

The settings are divided into four groups: Volumes, Graphics/Sound, Serial/Network and Memory/Misc. - -

Volumes

- - - -

The main part of the volumes pane is a list that contains all volumes to be mounted -by SheepShaver. If this list is empty, SheepShaver will try to detect and mount all -HFS partitions it can find. A CD-ROM drive is always automatically detected and used. - -

SheepShaver can use HFS partitions, whole HFS formatted drives, and it can also -emulate hard disks in single Linux files ("hardfiles"). - -

To add a Mac volume to the list, click on "Add...", go to the "/dev" directory -in the file panel, click once on the partition you want and click on "OK". The selected -partition device name should then appear in the volume list. After adding volumes to -the list, you should unmount them on the Linux side. To remove a Mac volume, select it -in the list and click on "Remove". - -

You can create a new, empty hardfile by clicking on "Create...". Enter the file -name and the size of the hardfile and click on "Create". The hardfile will be created (this may -take some seconds) and added to the volume list. The so-created hardfile will have to be -formatted under MacOS before you can store something in it. If you start up SheepShaver, -the Finder will display a message about an "unreadable" volume being found and give you the -option to format it. - -

Double-clicking on an entry in the volume list will add or remove a "*" in front of the -device name. Volumes marked with a "*" are read-only for the MacOS under SheepShaver. - -

SheepShaver will show a "Linux" disk icon on the Mac desktop that allows access to Linux -files from Mac applications. In "Linux Root" you specify which Linux directory will -be at the root of this virtual "Linux" disk. The default setting of "/" means that the -"Linux" icon in the MacOS Finder will correspond to your Linux root directory. The MacOS -will try to create files and folders like "Desktop", "Trash", "OpenFolderListDF" etc. -in the directory you specify as "Linux Root" (provided that you have access rights -to that directory). If they annoy you, you can delete them. - -

To boot from CD-ROM, set the "Boot From" setting to "CD-ROM". -The "Disable CD-ROM Driver" box is used to disable SheepShaver's built-in CD-ROM driver. -This is currently of not much use and you should leave the box unselected. - -

Graphics/Sound

- - - -

With "Window Refresh Rate" you can set the refresh rate of the MacOS window. -Higher rates mean faster screen updates and less "sluggish" behaviour, but also require more CPU time. - -

The "Enabled Video Modes" controls allow you to select which graphics modes -are available for displaying the MacOS desktop. You can, for example, disable the window modes -when you want to run some Mac programs in full-screen mode that would otherwise erroneously -switch to a window mode. If your X server doesn't support DGA you should disable the Fullscreen -mode. The actual mode to be used is selected in the "Monitors" control panel under MacOS. The -color depth is always that of the X11 screen and cannot be changed. - -

The "Disable Sound Output" box allows you to disable all sound output by SheepShaver. -This is useful if the sound takes too much CPU time on your machine or to get rid of warning -messages if SheepShaver can't use your audio hardware. - -

Serial/Network

- - - -

You can select to which devices the MacOS modem and printer ports are redirected. -You can assign them to any serial ports you have (/dev/ttyS*), or even to parallel -ports (/dev/lp*, useful for printing if you have Mac drivers for parallel printers, -like the PowerPrint package from www.gdt.com). - -

With "Ethernet Interface" you select which Ethernet card is to be used for -networking. It can either be the name of a real Ethernet card (e.g. "eth0") or of an ethertap -interface (e.g. "tap0"). Using a real Ethernet card requires the "sheep_net" driver to be installed -and accessible. See Using SheepShaver for more -information about setting up networking. - -

Memory/Misc

- - - -

With "MacOS RAM Size" you select how much RAM will be available to the MacOS -(and all MacOS applications running under it). SheepShaver uses the Linux virtual memory system, -so you can select more RAM than you physically have in your machine. The MacOS virtual memory -system is not available under SheepShaver (i.e. if you have 32MB of RAM in your computer and -select 64MB to be used for MacOS in the SheepShaver settings, MacOS will behave as if it's running on -a computer that has 64MB of RAM but no virtual memory). - -

"ROM File" specifies the path name of the Mac ROM file to be used. If it is left -blank, SheepShaver expects the ROM file to be called "ROM" and be in the same directory as -the SheepShaver application. - -

The "Ignore Illegal Memory Accesses" option is there to make some broken Mac -programs work that access addresses where there is no RAM or ROM. With this option unchecked, -SheepShaver will in this case display an error message and quit. When the option is activated, -SheepShaver will try to continue as if the illegal access never happened (writes are ignored, reads -return 0). This may or may not make the program work (when a program performs an illegal access, -it is most likely that something else went wrong). When a Mac program behaves strangely or hangs, -you can quit SheepShaver, uncheck this option and retry. If you get an "illegal access" message, -you will know that something is broken. - -


-
-SheepShaver User's Guide -
- - diff --git a/SheepShaver/doc/Linux/troubleshooting.html b/SheepShaver/doc/Linux/troubleshooting.html deleted file mode 100644 index 4dc3e293..00000000 --- a/SheepShaver/doc/Linux/troubleshooting.html +++ /dev/null @@ -1,65 +0,0 @@ - - -Troubleshooting - - - -

Troubleshooting

- -

SheepShaver doesn't boot

- -SheepShaver should boot all MacOS versions >=7.5.2, except MacOS X. However, -your mileage may vary. If it doesn't boot, try again with extensions disabled -(by pressing the shift key) and then remove some of these extensions: -"MacOS Licensing Extension", Speed Doubler, 68k FPU extensions and MacsBug. - -

The colors are wrong in 16 or 32 bit graphics modes

- -If you're running SheepShaver on a something other than a PowerMac, it may be -that 16 or 32 bit graphics modes show false colors due to the frame buffer being -little-endian. Apart from patching the X server, there's unfortunately nothing -that you or SheepShaver can do about this. - -

Full-screen mode doesn't work

- -Some X servers on Linux PPC don't support DGA and full-screen mode cannot be used -with these (in this case, you should disable it in the "Graphics" settings). If you -are seeing a message like "cannot map /dev/kmem (permission denied)", you have to -either run SheepShaver as root (not recommended) or give yourself appropriate access -rights to /dev/kmem if you can login as root. - -

Ethernet doesn't work

- -
    -
  • You have to either install the sheep_net driver or configure the ethertap device in the Linux kernel to use Ethernet. See Using SheepShaver for more information. -
  • If you're using TCP/IP on the MacOS side, you have to set up different IP addresses for Linux and for the MacOS. -
- -

SheepShaver crashes, but yesterday it worked

- -Try the "Zap PRAM File" item in the main menu of the SheepShaver preferences editor. -When you are using a ROM file and switching to a different ROM version, you have -to zap the PRAM file or SheepShaver might behave very weird. - -

Known incompatibilities

- -
    -
  • MacOS programs or drivers which access Mac hardware directly are not supported by SheepShaver. -
  • Speed Doubler, RAM Doubler, 68k FPU emulators and similar programs don't run under SheepShaver. -
  • MacsBug is not compatible with SheepShaver. -
- -

Known bugs

- -
    -
  • The QuickTime 2.5 Cinepak codec crashes the emulator. -
  • Programs that use InputSprockets crash the emulator when in window mode. -
  • The mouse cursor hotspot in window mode is not correct. -
- -
-
-SheepShaver User's Guide -
- - diff --git a/SheepShaver/doc/Linux/using.html b/SheepShaver/doc/Linux/using.html deleted file mode 100644 index 9fbceec5..00000000 --- a/SheepShaver/doc/Linux/using.html +++ /dev/null @@ -1,113 +0,0 @@ - - -Using SheepShaver - - - -

Using SheepShaver

- -

Changing the display mode

- -SheepShaver can display the MacOS user interface in an X11 window or full-screen -(much faster). You select the display mode as usual under MacOS in the "Monitors" -control panel (under System 7.x, click on "Options"). The "75Hz" modes are full-screen -modes, the "60Hz" modes are window modes (this doesn't mean that the video refresh -rate is 75 or 60Hz in the respective modes; the rate displayed has no meaning; it's -simply there to distinguish full screen modes from window modes). - -

Full-screen mode

- -The full-screen mode uses the whole X11 screen for displaying the MacOS user interface. -You can temporarily switch back to the X11 desktop by pressing Ctrl-Tab. The MacOS (and -all MacOS applications) will now be suspended. You can resume SheepShaver by activating -the "SheepShaver suspended" window and pressing the space key. Using full-screen mode -requires a DGA capable X server. - -

Networking

- -There are three approaches to networking with SheepShaver: - -
    -
  1. Direct access to an Ethernet card via the "sheep_net" driver. -In this case, the "ethernet card description" must be the name -of a real Ethernet card, e.g. "eth0". It also requires the "sheep_net" -driver to be installed and accessible. This approach will allow you -to run all networking protocols under MacOS (TCP/IP, AppleTalk, IPX -etc.) but there is no connection between Linux networking and MacOS -networking. MacOS will only be able to talk to other machines on -the Ethernet, but not to other networks that your Linux box routes -(e.g. a second Ethernet or a PPP connection to the Internet). - -
  2. Putting SheepShaver on a virtual Ethernet via the "ethertap" device. -In this case, the "ethernet card description" must be the name -of an ethertap interface, e.g. "tap0". It also requires that you -configure your kernel to enable routing and the ethertap device: -under "Networking options", enable "Kernel/User netlink socket" and -"Netlink device emulation", under "Network device support", activate -"Ethertap network tap". You also have to modify devices/net/ethertap.c -a bit before compiling the new kernel: - -
      -
    • insert #define CONFIG_ETHERTAP_MC 1 near the top (after the #include lines) -
    • comment out the line dev->flags|=IFF_NOARP; in ethertap_probe() -
    - -

    -Next, see /usr/src/linux/Documentation/networking/ethertap.txt for -information on how to set up /dev/tap* device nodes and activate the -ethertap interface. Under MacOS, select an IP address that is on the -virtual network and set the default gateway to the IP address of the -ethertap interface. This approach will let you access all networks -that your Linux box has access to (especially, if your Linux box has -a dial-up Internet connection and is configured for IP masquerading, -you can access the Internet from MacOS). The drawback is that you -can only use network protocols that Linux can route, so you have to -install and configure netatalk if you want to use AppleTalk. Here is -an example /etc/atalk/atalkd.conf for a LAN: - -

    -eth0 -seed -phase 2 -net 1 -addr 1.47 -zone "Ethernet"
    -tap0 -seed -phase 2 -net 2 -addr 2.47 -zone "Sheepnet"
    -
    - -(the "47" is an arbitrary node number). This will set up a zone -"Ethernet" (net 1) for the Ethernet and a zone "Sheepnet" (net 2) -for the internal network connection of the ethertap interface. -MacOS should automatically recognize the nets and zones upon startup. -If you are in an existing AppleTalk network, you should contact -your network administrator about the nets and zones you can use -(instead of the ones given in the example above). - -
  3. Networking protocols for serial connections (PPP and SLIP, for example) -can be used provided that you have the appropriate MacOS system components -installed (e.g. Open Transport/PPP). -
- -

Using floppy disks

- -Floppy disks are not automatically detected when they are inserted. They have to be -mounted explicitly: after inserting a floppy disk, press Ctrl-F1. - -

Accessing Linux files

- -SheepShaver will display a "Linux" disk icon on the Mac desktop that allows you -to access any Linux files which are in the directory specified as "Linux Root" -in the "Volumes" pane of the SheepShaver settings. You can open and save files on the -"Linux" disk from Mac applications, copy, move or rename files from the Finder etc. -SheepShaver translates some file name extensions to MacOS types and vice versa, -so e.g. *.jpg and *.pdf files will show the correct icons in the Finder. MacOS -resources and Finder attributes are stored in hidden .rsrc and -.finf directories. - -

Copying text via the clipboard

- -SheepShaver tries to keep the Linux and MacOS clipboards synchronized. That means, -when you copy a piece of text under Linux, you can paste it into a MacOS application -and vice versa. - -
-
-SheepShaver User's Guide -
- - diff --git a/SheepShaver/doc/Linux/volumes.gif b/SheepShaver/doc/Linux/volumes.gif deleted file mode 100644 index 676248b7acd71ad6e381e0c209561415e925aeca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7705 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 4.0.1 is used. The more accurate engine is enabled with ''PPC_ENABLE_FPU_EXCEPTIONS''. - -===== Features ===== - - * Self-contained. No guest OS nor any complicated run-time environment is required. Your CPU emulator simply needs to support a special opcode (''0x18000000'', OP=6) that terminates execution of the current basic block. - - * Supports several CPU cores: SheepShaver, [[http://microlib.org/projects/ppc750sim/|Microlib PPC 750 Simulator]], [[http://model3emu.sourceforge.net/|Sega Model 3 Arcade Emulator]], [[http://www.qemu.org/|QEMU]]. - - * Supports the AltiVec ISA. - - * Generates more than 2 million tests with specific values to trigger condition codes changes, unspecified results (matches a PowerPC 7410, aka my Powerbook G4). - -===== Downloads ===== - - * The primary source is available in SheepShaver CVS. - - * It is recommended that you first run the tester on a native PowerPC platform to generate a results file. For reference, here is the [[this>projects/ppctester/files/ppc-testresults.dat.bz2|PowerPC Emulator Tester results file]] I use for SheepShaver. This was generated with AltiVec tests enabled. This is for revision 1.30+ of the file. md5sum is: ''3e29432abb6e21e625a2eef8cf2f0840''. - -===== Links ===== - - * [[http://www.valgrind.org/|Valgrind]] contains an interesting testsuite for the VEX. - * [[http://perso.magic.fr/l_indien/qemu-ppc/|Qemu-PPC]] contains part of the original ALU tests used in VEX. \ No newline at end of file diff --git a/SheepShaver/src/BeOS/CreatePCIDrivers/Ethernet.cpp b/SheepShaver/src/BeOS/CreatePCIDrivers/Ethernet.cpp deleted file mode 100644 index c6c0fbf4..00000000 --- a/SheepShaver/src/BeOS/CreatePCIDrivers/Ethernet.cpp +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Ethernet.cpp - SheepShaver ethernet PCI driver stub - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" -#include -#include "xlowmem.h" -#include "ether_defs.h" - - -/* - * Driver Description structure - */ - -struct DriverDescription { - uint32 driverDescSignature; - uint32 driverDescVersion; - char nameInfoStr[32]; - uint32 version; - uint32 driverRuntime; - char driverName[32]; - uint32 driverDescReserved[8]; - uint32 nServices; - uint32 serviceCategory; - uint32 serviceType; - uint32 serviceVersion; -}; - -#pragma export on -DriverDescription TheDriverDescription = { - 'mtej', - 0, - "\pSheepShaver Ethernet", - 0x01008000, // V1.0.0final - 4, // kDriverIsUnderExpertControl - "\penet", - 0, 0, 0, 0, 0, 0, 0, 0, - 1, - 'otan', - 0x000a0b01, // Ethernet, Framing: Ethernet/EthernetIPX/802.2, IsDLPI - 0x01000000, // V1.0.0 -}; -#pragma export off - - -/* - * install_info and related structures - */ - -static int ether_open(queue_t *rdq, void *dev, int flag, int sflag, void *creds); -static int ether_close(queue_t *rdq, int flag, void *creds); -static int ether_wput(queue_t *q, msgb *mp); -static int ether_wsrv(queue_t *q); -static int ether_rput(queue_t *q, msgb *mp); -static int ether_rsrv(queue_t *q); - -struct ot_module_info { - uint16 mi_idnum; - char *mi_idname; - int32 mi_minpsz; // Minimum packet size - int32 mi_maxpsz; // Maximum packet size - uint32 mi_hiwat; // Queue hi-water mark - uint32 mi_lowat; // Queue lo-water mark -}; - -static ot_module_info module_information = { - kEnetModuleID, - "SheepShaver Ethernet", - 0, - kEnetTSDU, - 6000, - 5000 -}; - -typedef int (*putp_t)(queue_t *, msgb *); -typedef int (*srvp_t)(queue_t *); -typedef int (*openp_t)(queue_t *, void *, int, int, void *); -typedef int (*closep_t)(queue_t *, int, void *); - -struct qinit { - putp_t qi_putp; - srvp_t qi_srvp; - openp_t qi_qopen; - closep_t qi_qclose; - void *qi_qadmin; - struct ot_module_info *qi_minfo; - void *qi_mstat; -}; - -static qinit read_side = { - NULL, - ether_rsrv, - ether_open, - ether_close, - NULL, - &module_information, - NULL -}; - -static qinit write_side = { - ether_wput, - NULL, - ether_open, - ether_close, - NULL, - &module_information, - NULL -}; - -struct streamtab { - struct qinit *st_rdinit; - struct qinit *st_wrinit; - struct qinit *st_muxrinit; - struct qinit *st_muxwinit; -}; - -static streamtab the_streamtab = { - &read_side, - &write_side, - NULL, - NULL -}; - -struct install_info { - struct streamtab *install_str; - uint32 install_flags; - uint32 install_sqlvl; - char *install_buddy; - void *ref_load; - uint32 ref_count; -}; - -enum { - kOTModIsDriver = 0x00000001, - kOTModUpperIsDLPI = 0x00002000, - SQLVL_MODULE = 3, -}; - -static install_info the_install_info = { - &the_streamtab, - kOTModIsDriver /*| kOTModUpperIsDLPI */, - SQLVL_MODULE, - NULL, - NULL, - 0 -}; - - -// Prototypes for exported functions -extern "C" { -#pragma export on -extern uint32 ValidateHardware(void *theID); -extern install_info* GetOTInstallInfo(); -extern uint8 InitStreamModule(void *theID); -extern void TerminateStreamModule(void); -#pragma export off -} - - -/* - * Validate that our hardware is available (always available) - */ - -uint32 ValidateHardware(void *theID) -{ - return 0; -} - - -/* - * Return pointer to install_info structure - */ - -install_info *GetOTInstallInfo(void) -{ - return &the_install_info; -} - - -/* - * Init module - */ - -asm uint8 InitStreamModule(register void *theID) -{ - lwz r2,XLM_TOC - lwz r0,XLM_ETHER_INIT - mtctr r0 - bctr -} - - -/* - * Terminate module - */ - -asm void TerminateStreamModule(void) -{ - lwz r2,XLM_TOC - lwz r0,XLM_ETHER_TERM - mtctr r0 - bctr -} - - -/* - * DLPI functions - */ - -static asm int ether_open(register queue_t *rdq, register void *dev, register int flag, register int sflag, register void *creds) -{ - lwz r2,XLM_TOC - lwz r0,XLM_ETHER_OPEN - mtctr r0 - bctr -} - -static asm int ether_close(register queue_t *rdq, register int flag, register void *creds) -{ - lwz r2,XLM_TOC - lwz r0,XLM_ETHER_CLOSE - mtctr r0 - bctr -} - -static asm int ether_wput(register queue_t *q, register msgb *mp) -{ - lwz r2,XLM_TOC - lwz r0,XLM_ETHER_WPUT - mtctr r0 - bctr -} - -static asm int ether_rsrv(register queue_t *q) -{ - lwz r2,XLM_TOC - lwz r0,XLM_ETHER_RSRV - mtctr r0 - bctr -} diff --git a/SheepShaver/src/BeOS/CreatePCIDrivers/Makefile b/SheepShaver/src/BeOS/CreatePCIDrivers/Makefile deleted file mode 100644 index f9f12eee..00000000 --- a/SheepShaver/src/BeOS/CreatePCIDrivers/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -all: ../../EthernetDriverStub.i ../../VideoDriverStub.i - -clean: - -rm *.o hexconv Ethernet Video - -../../EthernetDriverStub.i: Ethernet hexconv - hexconv $< $@ - -../../VideoDriverStub.i: Video hexconv - hexconv $< $@ - -hexconv: hexconv.cpp - mwcc -o hexconv hexconv.cpp - -Ethernet.o: Ethernet.cpp - mwcc -I.. -I../../include -o $@ -c $< - -Video.o: Video.cpp - mwcc -I.. -I../../include -o $@ -c $< - -Ethernet: Ethernet.o - mwldppc -xms -export pragma -nostdentry -nostdlib -o $@ $< - -Video: Video.o - mwldppc -xms -export pragma -nostdentry -nostdlib -o $@ $< diff --git a/SheepShaver/src/BeOS/CreatePCIDrivers/Video.cpp b/SheepShaver/src/BeOS/CreatePCIDrivers/Video.cpp deleted file mode 100644 index 1e1c9b24..00000000 --- a/SheepShaver/src/BeOS/CreatePCIDrivers/Video.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Video.cpp - SheepShaver video PCI driver stub - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" -#include "xlowmem.h" - - -/* - * Driver Description structure - */ - -struct DriverDescription { - uint32 driverDescSignature; - uint32 driverDescVersion; - char nameInfoStr[32]; - uint32 version; - uint32 driverRuntime; - char driverName[32]; - uint32 driverDescReserved[8]; - uint32 nServices; - uint32 serviceCategory; - uint32 serviceType; - uint32 serviceVersion; -}; - -#pragma export on -struct DriverDescription TheDriverDescription = { - 'mtej', - 0, - "\pvideo", - 0x01008000, // V1.0.0final - 6, // kDriverIsUnderExpertControl, kDriverIsOpenedUponLoad - "\pDisplay_Video_Apple_Sheep", - 0, 0, 0, 0, 0, 0, 0, 0, - 1, - 'ndrv', - 'vido', - 0x01000000, // V1.0.0 -}; -#pragma export off - - -// Prototypes for exported functions -extern "C" { -#pragma export on -extern int16 DoDriverIO(void *spaceID, void *commandID, void *commandContents, uint32 commandCode, uint32 commandKind); -#pragma export off -} - - -/* - * Do driver IO - */ - -asm int16 DoDriverIO(void *spaceID, void *commandID, void *commandContents, uint32 commandCode, uint32 commandKind) -{ - lwz r2,XLM_TOC - lwz r0,XLM_VIDEO_DOIO - mtctr r0 - bctr -} diff --git a/SheepShaver/src/BeOS/CreatePCIDrivers/hexconv.cpp b/SheepShaver/src/BeOS/CreatePCIDrivers/hexconv.cpp deleted file mode 100644 index 59a0a3e0..00000000 --- a/SheepShaver/src/BeOS/CreatePCIDrivers/hexconv.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include - -int main(int argc, char **argv) -{ - if (argc != 3) { - printf("Usage: %s \n", argv[0]); - return 0; - } - - FILE *fin = fopen(argv[1], "rb"); - if (fin == NULL) { - printf("Can't open '%s' for reading\n", argv[1]); - return 0; - } - - FILE *fout = fopen(argv[2], "w"); - if (fout == NULL) { - printf("Can't open '%s' for writing\n", argv[2]); - return 0; - } - - unsigned char buf[16]; - while (!feof(fin)) { - fprintf(fout, "\t"); - int actual = fread(buf, 1, 16, fin); - for (int i=0; i@ - -# specify the source files to use -# full paths or paths relative to the makefile can be included -# all files, regardless of directory, will have their object -# files created in the common object directory. -# Note that this means this makefile will not work correctly -# if two source files with the same name (source.c or source.cpp) -# are included from different directories. Also note that spaces -# in folder names do not work well with this makefile. -SRCS= ../main.cpp main_beos.cpp ../prefs.cpp ../prefs_items.cpp prefs_beos.cpp \ - prefs_editor_beos.cpp sys_beos.cpp ../rom_patches.cpp ../rsrc_patches.cpp \ - ../emul_op.cpp ../name_registry.cpp ../macos_util.cpp ../timer.cpp \ - timer_beos.cpp ../xpram.cpp xpram_beos.cpp ../adb.cpp clip_beos.cpp \ - ../sony.cpp ../disk.cpp ../cdrom.cpp ../scsi.cpp scsi_beos.cpp \ - ../video.cpp video_beos.cpp ../audio.cpp audio_beos.cpp ../ether.cpp \ - ether_beos.cpp ../serial.cpp serial_beos.cpp ../extfs.cpp extfs_beos.cpp \ - about_window_beos.cpp ../user_strings.cpp user_strings_beos.cpp ../thunks.cpp - -# specify the resource files to use -# full path or a relative path to the resource file can be used. -RSRCS= SheepShaver.rsrc - -# @<-src@ -#%} - -# end support for Pe and Eddie - -# specify additional libraries to link against -# there are two acceptable forms of library specifications -# - if your library follows the naming pattern of: -# libXXX.so or libXXX.a you can simply specify XXX -# library: libbe.so entry: be -# -# - if your library does not follow the standard library -# naming scheme you need to specify the path to the library -# and it's name -# library: my_lib.a entry: my_lib.a or path/my_lib.a -LIBS= be tracker game media translation textencoding device GL - -# specify additional paths to directories following the standard -# libXXX.so or libXXX.a naming scheme. You can specify full paths -# or paths relative to the makefile. The paths included may not -# be recursive, so include all of the paths where libraries can -# be found. Directories where source files are found are -# automatically included. -LIBPATHS= - -# additional paths to look for system headers -# thes use the form: #include
-# source file directories are NOT auto-included here -SYSTEM_INCLUDE_PATHS = - -# additional paths to look for local headers -# thes use the form: #include "header" -# source file directories are automatically included -LOCAL_INCLUDE_PATHS = ../include SheepDriver SheepNet - -# specify the level of optimization that you desire -# NONE, SOME, FULL -OPTIMIZE= FULL - -# specify any preprocessor symbols to be defined. The symbols will not -# have their values set automatically; you must supply the value (if any) -# to use. For example, setting DEFINES to "DEBUG=1" will cause the -# compiler option "-DDEBUG=1" to be used. Setting DEFINES to "DEBUG" -# would pass "-DDEBUG" on the compiler's command line. -DEFINES= - -# specify special warning levels -# if unspecified default warnings will be used -# NONE = supress all warnings -# ALL = enable all warnings -WARNINGS = - -# specify whether image symbols will be created -# so that stack crawls in the debugger are meaningful -# if TRUE symbols will be created -SYMBOLS = - -# specify debug settings -# if TRUE will allow application to be run from a source-level -# debugger. Note that this will disable all optimzation. -DEBUGGER = - -# specify additional compiler flags for all files -COMPILER_FLAGS = -prefix BeHeaders - -# specify additional linker flags -LINKER_FLAGS = - - -## include the makefile-engine -include /boot/develop/etc/makefile-engine - diff --git a/SheepShaver/src/BeOS/NetPeek/Makefile b/SheepShaver/src/BeOS/NetPeek/Makefile deleted file mode 100644 index 233c7e5f..00000000 --- a/SheepShaver/src/BeOS/NetPeek/Makefile +++ /dev/null @@ -1,110 +0,0 @@ -## BeOS Generic Makefile v2.1 ## - -## Fill in this file to specify the project being created, and the referenced -## makefile-engine will do all of the hard work for you. This handles both -## Intel and PowerPC builds of the BeOS. - -## Application Specific Settings --------------------------------------------- - -# specify the name of the binary -NAME= NetPeek - -# specify the type of binary -# APP: Application -# SHARED: Shared library or add-on -# STATIC: Static library archive -# DRIVER: Kernel Driver -TYPE= APP - -# add support for new Pe and Eddie features -# to fill in generic makefile - -#%{ -# @src->@ - -# specify the source files to use -# full paths or paths relative to the makefile can be included -# all files, regardless of directory, will have their object -# files created in the common object directory. -# Note that this means this makefile will not work correctly -# if two source files with the same name (source.c or source.cpp) -# are included from different directories. Also note that spaces -# in folder names do not work well with this makefile. -SRCS= NetPeek.cpp - -# specify the resource files to use -# full path or a relative path to the resource file can be used. -RSRCS= - -# @<-src@ -#%} - -# end support for Pe and Eddie - -# specify additional libraries to link against -# there are two acceptable forms of library specifications -# - if your library follows the naming pattern of: -# libXXX.so or libXXX.a you can simply specify XXX -# library: libbe.so entry: be -# -# - if your library does not follow the standard library -# naming scheme you need to specify the path to the library -# and it's name -# library: my_lib.a entry: my_lib.a or path/my_lib.a -LIBS= - -# specify additional paths to directories following the standard -# libXXX.so or libXXX.a naming scheme. You can specify full paths -# or paths relative to the makefile. The paths included may not -# be recursive, so include all of the paths where libraries can -# be found. Directories where source files are found are -# automatically included. -LIBPATHS= - -# additional paths to look for system headers -# thes use the form: #include
-# source file directories are NOT auto-included here -SYSTEM_INCLUDE_PATHS = - -# additional paths to look for local headers -# thes use the form: #include "header" -# source file directories are automatically included -LOCAL_INCLUDE_PATHS = ../ ../../include ../NetAddOn - -# specify the level of optimization that you desire -# NONE, SOME, FULL -OPTIMIZE= FULL - -# specify any preprocessor symbols to be defined. The symbols will not -# have their values set automatically; you must supply the value (if any) -# to use. For example, setting DEFINES to "DEBUG=1" will cause the -# compiler option "-DDEBUG=1" to be used. Setting DEFINES to "DEBUG" -# would pass "-DDEBUG" on the compiler's command line. -DEFINES= - -# specify special warning levels -# if unspecified default warnings will be used -# NONE = supress all warnings -# ALL = enable all warnings -WARNINGS = - -# specify whether image symbols will be created -# so that stack crawls in the debugger are meaningful -# if TRUE symbols will be created -SYMBOLS = - -# specify debug settings -# if TRUE will allow application to be run from a source-level -# debugger. Note that this will disable all optimzation. -DEBUGGER = - -# specify additional compiler flags for all files -COMPILER_FLAGS = - -# specify additional linker flags -LINKER_FLAGS = - - -## include the makefile-engine -include /boot/develop/etc/makefile-engine - diff --git a/SheepShaver/src/BeOS/NetPeek/NetPeek.cpp b/SheepShaver/src/BeOS/NetPeek/NetPeek.cpp deleted file mode 100644 index ccf5629a..00000000 --- a/SheepShaver/src/BeOS/NetPeek/NetPeek.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * NetPeek.cpp - Utility program for monitoring SheepNet add-on - */ - -#include "sysdeps.h" -#include "sheep_net.h" - -#include - -static area_id buffer_area; // Packet buffer area -static net_buffer *net_buffer_ptr; // Pointer to packet buffer - -int main(void) -{ - area_id handler_buffer; - if ((handler_buffer = find_area("packet buffer")) < B_NO_ERROR) { - printf("Can't find packet buffer\n"); - return 10; - } - if ((buffer_area = clone_area("local packet buffer", &net_buffer_ptr, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, handler_buffer)) < B_NO_ERROR) { - printf("Can't clone packet buffer\n"); - return 10; - } - - uint8 *p = net_buffer_ptr->ether_addr; - printf("Ethernet address : %02x %02x %02x %02x %02x %02x\n", p[0], p[1], p[2], p[3], p[4], p[5]); - printf("read_sem : %d\n", net_buffer_ptr->read_sem); - printf("read_ofs : %d\n", net_buffer_ptr->read_ofs); - printf("read_packet_size : %d\n", net_buffer_ptr->read_packet_size); - printf("read_packet_count : %d\n", net_buffer_ptr->read_packet_count); - printf("write_sem : %d\n", net_buffer_ptr->write_sem); - printf("write_ofs : %d\n", net_buffer_ptr->write_ofs); - printf("write_packet_size : %d\n", net_buffer_ptr->write_packet_size); - printf("write_packet_count: %d\n", net_buffer_ptr->write_packet_count); - - printf("\nRead packets:\n"); - for (int i=0; iread[i]; - printf("cmd : %08lx\n", p->cmd); - printf("length: %d\n", p->length); - } - printf("\nWrite packets:\n"); - for (int i=0; iwrite[i]; - printf("cmd : %08lx\n", p->cmd); - printf("length: %d\n", p->length); - } - return 0; -} diff --git a/SheepShaver/src/BeOS/SaveROM/Makefile b/SheepShaver/src/BeOS/SaveROM/Makefile deleted file mode 100644 index cba232e1..00000000 --- a/SheepShaver/src/BeOS/SaveROM/Makefile +++ /dev/null @@ -1,110 +0,0 @@ -## BeOS Generic Makefile v2.1 ## - -## Fill in this file to specify the project being created, and the referenced -## makefile-engine will do all of the hard work for you. This handles both -## Intel and PowerPC builds of the BeOS. - -## Application Specific Settings --------------------------------------------- - -# specify the name of the binary -NAME= SaveROM - -# specify the type of binary -# APP: Application -# SHARED: Shared library or add-on -# STATIC: Static library archive -# DRIVER: Kernel Driver -TYPE= APP - -# add support for new Pe and Eddie features -# to fill in generic makefile - -#%{ -# @src->@ - -# specify the source files to use -# full paths or paths relative to the makefile can be included -# all files, regardless of directory, will have their object -# files created in the common object directory. -# Note that this means this makefile will not work correctly -# if two source files with the same name (source.c or source.cpp) -# are included from different directories. Also note that spaces -# in folder names do not work well with this makefile. -SRCS= SaveROM.cpp - -# specify the resource files to use -# full path or a relative path to the resource file can be used. -RSRCS= SaveROM.rsrc - -# @<-src@ -#%} - -# end support for Pe and Eddie - -# specify additional libraries to link against -# there are two acceptable forms of library specifications -# - if your library follows the naming pattern of: -# libXXX.so or libXXX.a you can simply specify XXX -# library: libbe.so entry: be -# -# - if your library does not follow the standard library -# naming scheme you need to specify the path to the library -# and it's name -# library: my_lib.a entry: my_lib.a or path/my_lib.a -LIBS= be - -# specify additional paths to directories following the standard -# libXXX.so or libXXX.a naming scheme. You can specify full paths -# or paths relative to the makefile. The paths included may not -# be recursive, so include all of the paths where libraries can -# be found. Directories where source files are found are -# automatically included. -LIBPATHS= - -# additional paths to look for system headers -# thes use the form: #include
-# source file directories are NOT auto-included here -SYSTEM_INCLUDE_PATHS = - -# additional paths to look for local headers -# thes use the form: #include "header" -# source file directories are automatically included -LOCAL_INCLUDE_PATHS = ../ ../../include ../NetAddOn - -# specify the level of optimization that you desire -# NONE, SOME, FULL -OPTIMIZE= FULL - -# specify any preprocessor symbols to be defined. The symbols will not -# have their values set automatically; you must supply the value (if any) -# to use. For example, setting DEFINES to "DEBUG=1" will cause the -# compiler option "-DDEBUG=1" to be used. Setting DEFINES to "DEBUG" -# would pass "-DDEBUG" on the compiler's command line. -DEFINES= - -# specify special warning levels -# if unspecified default warnings will be used -# NONE = supress all warnings -# ALL = enable all warnings -WARNINGS = - -# specify whether image symbols will be created -# so that stack crawls in the debugger are meaningful -# if TRUE symbols will be created -SYMBOLS = - -# specify debug settings -# if TRUE will allow application to be run from a source-level -# debugger. Note that this will disable all optimzation. -DEBUGGER = - -# specify additional compiler flags for all files -COMPILER_FLAGS = - -# specify additional linker flags -LINKER_FLAGS = - - -## include the makefile-engine -include /boot/develop/etc/makefile-engine - diff --git a/SheepShaver/src/BeOS/SaveROM/README b/SheepShaver/src/BeOS/SaveROM/README deleted file mode 100644 index 37214b34..00000000 --- a/SheepShaver/src/BeOS/SaveROM/README +++ /dev/null @@ -1,8 +0,0 @@ -"SaveROM" is a program that allows you to save the ROM of -a PowerMac running under BeOS to a file. - -1. Copy "sheep_driver" to ~/config/add-ons/kernel/drivers. -2. Double-click the "SaveROM" icon. - -This will create a file called "ROM" which should be 4MB -in size. diff --git a/SheepShaver/src/BeOS/SaveROM/SaveROM.cpp b/SheepShaver/src/BeOS/SaveROM/SaveROM.cpp deleted file mode 100644 index 5796ad5d..00000000 --- a/SheepShaver/src/BeOS/SaveROM/SaveROM.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * SaveROM - Save Mac ROM to file - * - * Copyright (C) 1998-2004 Christian Bauer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include - -#include -#include - - -// Constants -const char APP_SIGNATURE[] = "application/x-vnd.cebix-SaveROM"; -const char ROM_FILE_NAME[] = "ROM"; - -// Global variables -static uint8 buf[0x400000]; - -// Application object -class SaveROM : public BApplication { -public: - SaveROM() : BApplication(APP_SIGNATURE) - { - // Find application directory and cwd to it - app_info the_info; - GetAppInfo(&the_info); - BEntry the_file(&the_info.ref); - BEntry the_dir; - the_file.GetParent(&the_dir); - BPath the_path; - the_dir.GetPath(&the_path); - chdir(the_path.Path()); - } - virtual void ReadyToRun(void); -}; - - -/* - * Create application object and start it - */ - -int main(int argc, char **argv) -{ - SaveROM *the_app = new SaveROM(); - the_app->Run(); - delete the_app; - return 0; -} - - -/* - * Display error alert - */ - -static void ErrorAlert(const char *text) -{ - BAlert *alert = new BAlert("SaveROM Error", text, "Quit", NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); - alert->Go(); -} - - -/* - * Display OK alert - */ - -static void InfoAlert(const char *text) -{ - BAlert *alert = new BAlert("SaveROM Message", text, "Quit", NULL, NULL, B_WIDTH_AS_USUAL, B_INFO_ALERT); - alert->Go(); -} - - -/* - * Main program - */ - -void SaveROM::ReadyToRun(void) -{ - int fd = open("/dev/sheep", 0); - if (fd < 0) { - ErrorAlert("Cannot open '/dev/sheep'."); - goto done; - } - - if (read(fd, buf, 0x400000) != 0x400000) { - ErrorAlert("Cannot read ROM."); - close(fd); - goto done; - } - - FILE *f = fopen(ROM_FILE_NAME, "wb"); - if (f == NULL) { - ErrorAlert("Cannot open ROM file."); - close(fd); - goto done; - } - - if (fwrite(buf, 1, 0x400000, f) != 0x400000) { - ErrorAlert("Cannot write ROM."); - fclose(f); - close(fd); - goto done; - } - - InfoAlert("ROM saved."); - - fclose(f); - close(fd); -done: - PostMessage(B_QUIT_REQUESTED); -} diff --git a/SheepShaver/src/BeOS/SaveROM/SaveROM.rsrc b/SheepShaver/src/BeOS/SaveROM/SaveROM.rsrc deleted file mode 100644 index a61919ba80a170f7ce863bf1ad107b503bfc093d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4323 zcmeHJzfV(96h6f&rP24E(N+frH8D6QW?ns-6xt+7^FW7WT>UY0}-HVCQy(3rt zn>hVvJNZ83w3D0s5Rv~eBL7oF{%2gJO0i(alx@S-quaErI*MKyc5>5*x50OwMdZJT z$bS`)|E7U|PWonzY{R#%tGi>0;l%5r}tv*2g^iobY&t+cS@Q$4o6e5-HKUno~HUTNK*Di-)c^gjl+ zkMf_H%YE6tEL-~SJyXW`f_E12x1ilD#UTT}sLKuO)+AO1Y`M z86@CTx;2BvkqsELc^4%vVNeW*M!99uSC^+GL@q89kCT8I z#b8wWA|O!VTNdtCqe34Ms|TOy@H}t>kE8IE579&+KRkie$2>#M^^u}CP#Ey0b94FO z;zW=q9LY*6)_5~(XmWBCI{cdRDPZ)XSqM9`-#4?%nOTr}u>bP2 z!|3_Xr}Zy>JZXP}lZ7{<)35&eE|9=ca$>@jrPD)QZDjqh2rcIqF!>jk!NLe_rS(z|5;$w|?bZI$ZLZFFPmG z_?Opj)7(yTJMDpK5BxtpAn(!-i{h)SX=r{E@D*CREsDH{ueYga8LH`Kv)2_Ip9|1* zAu?N{H#BTpWrE4Lp<9534DHHPdfv~VZ4RHPqdmShVbQR1GxcceMx&wmfuTJyGZ$@N zx8Vb+m&g(269g{z@e;u+A*0g&rSbs}#LoL6B~=u~%s|B#aRomPf*>YK#VWp59Hhwa zB4Wb%;L@C+%%PHeo5V8}IlLCH<(n%o;bs1vyY zvc4tkYA+$&!np9y>zxO7wUauD>!39je}|6<=^rQ_%+rp69iDS+`~{anAoY<32vT}W zuDLem)H1kvhy-gXJ4m>+v&=DQg(p4|j~!(|=S&P&l0g4NDD*8YFfqi}Xck_g?wloaMkdy>tbcIubgmNmjvgZtc<(~xJCZOBj z-3(U_Ukq1AgJ+Sfe4L#3Ux|iCgTwvdvuHS4*}ir2+m8!2Wlu9uWT4x*`-rM^WDN`7 zZES|OySKx~>rXm&Hy@QZF*8QankiTh-)D6@-H>sl_phK~Vm -#include -#include -#include - -#include "about_window.h" -#include "video.h" -#include "version.h" -#include "user_strings.h" - - -// About window dimensions -static const BRect about_frame = BRect(0, 0, 383, 99); - -// Special colors -const rgb_color fill_color = {216, 216, 216, 0}; - -// SheepShaver icon -static const uint8 sheep_icon[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xda, 0x15, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0xff, 0x00, 0x00, 0x00, 0x16, 0xda, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, - 0x00, 0x1d, 0xda, 0x1e, 0x1e, 0x1e, 0xda, 0x16, 0x00, 0x00, 0x16, 0xda, 0x16, 0xda, 0x08, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0x00, 0x00, 0x00, 0x0b, 0xff, 0xff, 0x11, 0x00, 0xda, - 0x1d, 0xda, 0x1e, 0xda, 0x1e, 0xda, 0x1e, 0xda, 0x1e, 0x16, 0x00, 0x00, 0x0c, 0xff, 0xff, 0xff, - 0xff, 0x0b, 0x00, 0x00, 0x16, 0x16, 0x00, 0x12, 0xfd, 0x1d, 0x0b, 0x00, 0x00, 0x1d, 0xfd, 0x1d, - 0xfd, 0x1e, 0xda, 0x1e, 0xda, 0x1e, 0xda, 0x3f, 0xda, 0x3f, 0xda, 0x15, 0x00, 0xff, 0xff, 0xff, - 0x16, 0x00, 0x17, 0x16, 0x00, 0x00, 0x1d, 0xfd, 0x1d, 0xfd, 0x1d, 0xfd, 0x16, 0x0f, 0x0b, 0x1d, - 0x1e, 0xfd, 0x1e, 0xda, 0x1e, 0xda, 0x3f, 0xda, 0x3f, 0xda, 0x1d, 0x5a, 0x15, 0xff, 0xff, 0xff, - 0x05, 0x17, 0x16, 0x00, 0x12, 0x1d, 0x00, 0x1d, 0xfd, 0x00, 0xfd, 0x00, 0x00, 0x16, 0x0b, 0x00, - 0x00, 0x0e, 0x1d, 0x3f, 0xda, 0x3f, 0xda, 0x1d, 0xda, 0x1b, 0x5a, 0x1b, 0x0f, 0x1d, 0xff, 0xff, - 0xff, 0x05, 0x00, 0x00, 0x1d, 0xfd, 0x1d, 0xfd, 0x1d, 0xfd, 0x1a, 0xfd, 0x00, 0x0f, 0x14, 0x14, - 0x16, 0x00, 0x15, 0xfd, 0x1d, 0xda, 0x1b, 0xda, 0x1b, 0x5a, 0x1b, 0x5a, 0x0f, 0x14, 0xff, 0xff, - 0xff, 0xff, 0x00, 0x1d, 0xfd, 0x1d, 0xfd, 0x1d, 0xfd, 0x1a, 0xfd, 0x12, 0x00, 0x16, 0x00, 0x0f, - 0x00, 0x1b, 0xfd, 0x1e, 0xfd, 0x1b, 0xda, 0x1b, 0x5a, 0x1b, 0x5a, 0x1b, 0x5a, 0x14, 0xff, 0xff, - 0xff, 0x00, 0x1d, 0xfd, 0x1d, 0xfd, 0x1d, 0xfd, 0x1a, 0xfd, 0x12, 0x00, 0x16, 0x1b, 0x16, 0x0e, - 0x1b, 0xfd, 0x1b, 0xfd, 0x1b, 0xfd, 0x1b, 0x5a, 0x18, 0x00, 0x00, 0x5a, 0x1b, 0x00, 0xff, 0xff, - 0xff, 0x00, 0xfd, 0x14, 0xfd, 0x14, 0xfd, 0x1d, 0xfd, 0x12, 0x00, 0x16, 0xfd, 0x1b, 0xfd, 0x1b, - 0xfd, 0x1b, 0xfd, 0x1e, 0xfd, 0x1b, 0x5a, 0x18, 0x5a, 0x00, 0x00, 0x1b, 0x9b, 0x00, 0xff, 0xff, - 0xff, 0x00, 0x0f, 0xfd, 0x1d, 0xfd, 0x0f, 0xfd, 0x12, 0x00, 0x16, 0xfd, 0x1b, 0xfd, 0x1b, 0xfd, - 0x1b, 0xfd, 0x18, 0xfd, 0x1b, 0xf9, 0x18, 0x5a, 0x00, 0x12, 0x00, 0x9b, 0x1b, 0x00, 0xff, 0xff, - 0xff, 0x00, 0xfd, 0x0a, 0x0a, 0x0a, 0xfd, 0x10, 0x00, 0x1b, 0xfd, 0x1b, 0xfd, 0x1b, 0xfd, 0x18, - 0xfd, 0x15, 0xfa, 0x15, 0xf9, 0x18, 0x15, 0x00, 0x12, 0x9b, 0x00, 0x1b, 0x9b, 0x00, 0x15, 0x15, - 0xff, 0xff, 0x00, 0xfd, 0x1d, 0xfd, 0x1d, 0x00, 0x16, 0x00, 0x1b, 0xfd, 0x1b, 0xfd, 0x15, 0xfd, - 0x15, 0xfa, 0x15, 0xf9, 0x15, 0x16, 0x00, 0x0f, 0x9b, 0x12, 0x00, 0x9b, 0x1b, 0x00, 0x15, 0x15, - 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x1d, 0x00, 0xfa, 0x1e, 0x00, 0x1e, 0xfa, 0x15, - 0xfa, 0x15, 0x16, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x9b, 0x00, 0x00, 0x00, 0x12, 0x15, 0x15, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x1d, 0xf9, 0x00, 0x3f, 0xfa, 0x00, 0xfa, 0x1b, 0x00, - 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x15, 0x00, 0x00, 0x12, 0x15, 0x15, 0x15, 0x15, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf9, 0x1d, 0x00, 0xf9, 0x1b, 0x00, 0x1b, 0xf9, 0x00, - 0xff, 0xff, 0xff, 0xff, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x1d, 0xf9, 0x00, 0x3f, 0xf9, 0x00, 0xf9, 0x1b, 0x00, - 0xff, 0xff, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x16, 0x1d, 0x00, 0xf9, 0x1b, 0x00, 0x1b, 0xf9, 0x00, - 0xff, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0x00, 0x00, 0x00, 0x16, 0xf9, 0x00, 0x1b, 0x16, 0x00, - 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x00, 0x00, 0x00, 0x00, 0x12, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0x00, 0x00, 0x16, 0x00, 0x16, 0x00, 0x16, - 0x15, 0x15, 0x15, 0x15, 0x00, 0x00, 0x15, 0x00, 0x0a, 0x19, 0x0a, 0x00, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x12, 0x00, 0x00, 0x00, 0x16, 0xff, - 0xff, 0xff, 0xff, 0xff, 0x00, 0x0a, 0x00, 0x15, 0x00, 0x19, 0x1c, 0x18, 0x00, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, - 0x0f, 0xff, 0xff, 0xff, 0x00, 0x18, 0x11, 0x00, 0x15, 0x00, 0x1c, 0x18, 0x00, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x13, 0x00, 0x00, 0x00, 0x0b, 0x0b, - 0x00, 0x00, 0x0f, 0xff, 0x12, 0x00, 0x18, 0x19, 0x00, 0x15, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x13, 0x00, 0x00, 0x14, 0x1e, 0xfd, 0x01, 0xfd, 0x14, - 0xfa, 0xf9, 0x00, 0xff, 0xff, 0x00, 0x0a, 0x19, 0x1c, 0x00, 0x18, 0x1c, 0x00, 0x00, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x14, 0xfd, 0x1e, 0xf9, 0x1e, 0xfa, 0x1e, 0xf9, - 0x14, 0xfa, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x1c, 0x00, 0x18, 0x00, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x14, 0x1e, 0xf9, 0x14, 0xfa, 0x1e, 0xf9, 0x1e, - 0xfd, 0x1e, 0x00, 0x15, 0xff, 0xff, 0xff, 0x15, 0x15, 0x15, 0x00, 0x00, 0x18, 0x00, 0x1c, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x13, 0x00, 0xfd, 0x1e, 0xfd, 0x14, 0xfd, 0x1e, 0xfd, - 0x1e, 0x01, 0x00, 0x15, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x15, 0x00, 0x00, 0x1c, 0x00, 0x15, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x14, 0xfa, 0x01, 0xf9, 0x1e, 0xf9, 0x14, - 0x14, 0x00, 0x0f, 0x15, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x15, 0x00, 0x00, 0x15, 0x15, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0f, 0x15, 0x15, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x15, 0x15, 0x15, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, - 0x15, 0x15, 0x15, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff -}; - - -// View class -class AboutViewT : public BView { -public: - AboutViewT(BRect r) : BView(r, "", B_FOLLOW_NONE, B_WILL_DRAW) {} - - virtual void Draw(BRect update) - { - char str[256]; - sprintf(str, GetString(STR_ABOUT_TEXT1), VERSION_MAJOR, VERSION_MINOR); - - SetFont(be_bold_font); - SetDrawingMode(B_OP_OVER); - MovePenTo(20, 20); - DrawString(str); - SetFont(be_plain_font); - MovePenTo(20, 40); - DrawString(GetString(STR_ABOUT_TEXT2)); - MovePenTo(20, 60); - DrawString(B_UTF8_COPYRIGHT "1997-2008 Christian Bauer and Marc Hellwig"); - } - - virtual void MouseDown(BPoint point) - { - Window()->PostMessage(B_QUIT_REQUESTED); - } -}; - - -// 3D view class -class AboutView3D : public BGLView { -public: - AboutView3D(BRect r) : BGLView(r, "", B_FOLLOW_NONE, 0, BGL_RGB | BGL_DOUBLE) - { - rot_x = rot_y = 0; - - if (!VideoSnapshot(64, 64, texture)) { - uint8 *p = texture; - const uint8 *q = sheep_icon; - const color_map *cm = system_colors(); - for (int i=0; i<32*32; i++) { - uint8 red = cm->color_list[*q].red; - uint8 green = cm->color_list[*q].green; - uint8 blue = cm->color_list[*q++].blue; - p[0] = p[3] = p[64*3] = p[65*3] = red; - p[1] = p[4] = p[64*3+1] = p[65*3+1] = green; - p[2] = p[5] = p[64*3+2] = p[65*3+2] = blue; - p += 6; - if ((i & 31) == 31) - p += 64*3; - } - } - } - - virtual void AttachedToWindow(void) - { - BGLView::AttachedToWindow(); - LockGL(); - - glDisable(GL_DEPTH_TEST); - glDepthMask(GL_FALSE); - - glShadeModel(GL_SMOOTH); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - gluPerspective(30, 1, 0.5, 20); - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - GLfloat light_color[4] = {1, 1, 1, 1}; - GLfloat light_dir[4] = {1, 2, 1.5, 1}; - glLightfv(GL_LIGHT0, GL_DIFFUSE, light_color); - glLightfv(GL_LIGHT0, GL_POSITION, light_dir); - glEnable(GL_LIGHT0); - glEnable(GL_LIGHTING); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - glTexImage2D(GL_TEXTURE_2D, 0, 4, 64, 64, 0, GL_RGB, GL_UNSIGNED_BYTE, texture); - glEnable(GL_TEXTURE_2D); - - UnlockGL(); - - tick_thread_active = true; - tick_thread = spawn_thread(tick_func, "OpenGL Animation", B_NORMAL_PRIORITY, this); - resume_thread(tick_thread); - } - - virtual void DetachedFromWindow(void) - { - status_t l; - tick_thread_active = false; - wait_for_thread(tick_thread, &l); - - BGLView::DetachedFromWindow(); - } - - virtual void Draw(BRect update) - { - LockGL(); - glClear(GL_COLOR_BUFFER_BIT); - glBegin(GL_QUADS); - glNormal3d(0, 0, 1); - glTexCoord2f(0, 0); - glVertex3d(-1, 1, 0); - glTexCoord2f(1, 0); - glVertex3d(1, 1, 0); - glTexCoord2f(1, 1); - glVertex3d(1, -1, 0); - glTexCoord2f(0, 1); - glVertex3d(-1, -1, 0); - glEnd(); - SwapBuffers(); - UnlockGL(); - } - - static status_t tick_func(void *arg) - { - AboutView3D *obj = (AboutView3D *)arg; - while (obj->tick_thread_active) { - obj->rot_x += 2; - obj->rot_y += 2; - obj->LockGL(); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0, 0, -5); - glRotatef(obj->rot_x, 1, 0, 0); - glRotatef(obj->rot_y, 0, 1, 0); - obj->UnlockGL(); - if (obj->LockLooperWithTimeout(20000) == B_OK) { - obj->Draw(obj->Bounds()); - obj->UnlockLooper(); - } - snooze(16667); - } - return 0; - } - -private: - thread_id tick_thread; - bool tick_thread_active; - - float rot_x, rot_y; - uint8 texture[64*64*3]; -}; - - -// Window class -class AboutWindowT : public BWindow { -public: - AboutWindowT() : BWindow(about_frame, NULL, B_MODAL_WINDOW_LOOK, B_FLOATING_APP_WINDOW_FEEL, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_WILL_ACCEPT_FIRST_CLICK) - { - Lock(); - MoveTo(100, 100); - BRect r = Bounds(); - r.right = 100; - AboutView3D *view_3d = new AboutView3D(r); - AddChild(view_3d); - r = Bounds(); - r.left = 100; - AboutViewT *view = new AboutViewT(r); - AddChild(view); - view->SetHighColor(0, 0, 0); - view->SetViewColor(fill_color); - view->MakeFocus(); - Unlock(); - Show(); - } -}; - - -/* - * Open "About" window - */ - -void OpenAboutWindow(void) -{ - new AboutWindowT; -} diff --git a/SheepShaver/src/BeOS/audio_beos.cpp b/SheepShaver/src/BeOS/audio_beos.cpp deleted file mode 120000 index ce433abb..00000000 --- a/SheepShaver/src/BeOS/audio_beos.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/BeOS/audio_beos.cpp \ No newline at end of file diff --git a/SheepShaver/src/BeOS/clip_beos.cpp b/SheepShaver/src/BeOS/clip_beos.cpp deleted file mode 100644 index 953ed804..00000000 --- a/SheepShaver/src/BeOS/clip_beos.cpp +++ /dev/null @@ -1,374 +0,0 @@ -/* - * clip_beos.cpp - Clipboard handling, BeOS implementation - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -#include "clip.h" -#include "main.h" -#include "cpu_emulation.h" -#include "emul_op.h" - -#define DEBUG 0 -#include "debug.h" - - -// Global variables -static bool we_put_this_data = false; // Flag for PutScrap(): the data was put by GetScrap(), don't bounce it back to the Be side -static BTranslatorRoster *roster; -static float input_cap = 0; -static translator_info input_info; -static float output_cap = 0; -static translator_id output_trans = 0; - - -/* - * Clipboard manager thread (for calling clipboard functions; this is not safe - * under R4 when running on the MacOS stack in kernel space) - */ - -// Message constants -const uint32 MSG_QUIT_CLIP_MANAGER = 'quit'; -const uint32 MSG_PUT_TEXT = 'ptxt'; - -static thread_id cm_thread = -1; -static sem_id cm_done_sem = -1; - -// Argument passing -static void *cm_scrap; -static int32 cm_length; - -static status_t clip_manager(void *arg) -{ - for (;;) { - - // Receive message - thread_id sender; - uint32 code = receive_data(&sender, NULL, 0); - D(bug("Clipboard manager received %08lx\n", code)); - switch (code) { - case MSG_QUIT_CLIP_MANAGER: - return 0; - - case MSG_PUT_TEXT: - if (be_clipboard->Lock()) { - be_clipboard->Clear(); - BMessage *clipper = be_clipboard->Data(); - - // Convert text from Mac charset to UTF-8 - int32 dest_length = cm_length * 3; - int32 state = 0; - char *inbuf = new char[cm_length]; - memcpy(inbuf, cm_scrap, cm_length); // Copy to user space - char *outbuf = new char[dest_length]; - if (convert_to_utf8(B_MAC_ROMAN_CONVERSION, inbuf, &cm_length, outbuf, &dest_length, &state) == B_OK) { - for (int i=0; iAddData("text/plain", B_MIME_TYPE, outbuf, dest_length); - be_clipboard->Commit(); - } else { - D(bug(" text conversion failed\n")); - } - delete[] outbuf; - delete[] inbuf; - be_clipboard->Unlock(); - } - break; - } - - // Acknowledge - release_sem(cm_done_sem); - } -} - - -/* - * Initialize clipboard - */ - -void ClipInit(void) -{ - // check if there is a translator that can handle the pict datatype - roster = BTranslatorRoster::Default(); - int32 num_translators, i,j; - translator_id *translators; - const char *translator_name, *trans_info; - int32 translator_version; - const translation_format *t_formats; - long t_num; - - roster->GetAllTranslators(&translators, &num_translators); - for (i=0;iGetTranslatorInfo(translators[i], &translator_name, - &trans_info, &translator_version); - D(bug("found translator %s: %s (%.2f)\n", translator_name, trans_info, - translator_version/100.)); - // does this translator support the pict datatype ? - roster->GetInputFormats(translators[i], &t_formats,&t_num); - //printf(" supports %d input formats \n",t_num); - for (j=0;jinput_cap) { - input_info.type = t_formats[j].type; - input_info.group = t_formats[j].group; - input_info.quality = t_formats[j].quality; - input_info.capability = t_formats[j].capability; - strcpy(input_info.MIME,t_formats[j].MIME); - strcpy(input_info.name,t_formats[j].name); - input_info.translator=translators[i]; - input_cap = t_formats[j].capability; - } - D(bug("matching input translator found:type:%c%c%c%c group:%c%c%c%c quality:%f capability:%f MIME:%s name:%s\n", - t_formats[j].type>>24,t_formats[j].type>>16,t_formats[j].type>>8,t_formats[j].type, - t_formats[j].group>>24,t_formats[j].group>>16,t_formats[j].group>>8,t_formats[j].group, - t_formats[j].quality, - t_formats[j].capability,t_formats[j].MIME, - t_formats[j].name)); - } - - } - roster->GetOutputFormats(translators[i], &t_formats,&t_num); - //printf("and %d output formats \n",t_num); - for (j=0;joutput_cap) { - output_trans = translators[i]; - output_cap = t_formats[j].capability; - } - D(bug("matching output translator found:type:%c%c%c%c group:%c%c%c%c quality:%f capability:%f MIME:%s name:%s\n", - t_formats[j].type>>24,t_formats[j].type>>16,t_formats[j].type>>8,t_formats[j].type, - t_formats[j].group>>24,t_formats[j].group>>16,t_formats[j].group>>8,t_formats[j].group, - t_formats[j].quality, - t_formats[j].capability,t_formats[j].MIME, - t_formats[j].name)); - } - } - } - delete [] translators; // clean up our droppings - - // Start clipboard manager thread - cm_done_sem = create_sem(0, "Clipboard Manager Done"); - cm_thread = spawn_thread(clip_manager, "Clipboard Manager", B_NORMAL_PRIORITY, NULL); - resume_thread(cm_thread); -} - - -/* - * Deinitialize clipboard - */ - -void ClipExit(void) -{ - // Stop clipboard manager - if (cm_thread > 0) { - status_t l; - send_data(cm_thread, MSG_QUIT_CLIP_MANAGER, NULL, 0); - while (wait_for_thread(cm_thread, &l) == B_INTERRUPTED) ; - } - - // Delete semaphores - delete_sem(cm_done_sem); -} - - -/* - * Mac application wrote to clipboard - */ - -void PutScrap(uint32 type, void *scrap, int32 length) -{ - D(bug("PutScrap type %08lx, data %p, length %ld\n", type, scrap, length)); - if (we_put_this_data) { - we_put_this_data = false; - return; - } - if (length <= 0) - return; - - switch (type) { - case 'TEXT': - D(bug(" clipping TEXT\n")); - cm_scrap = scrap; - cm_length = length; - while (send_data(cm_thread, MSG_PUT_TEXT, NULL, 0) == B_INTERRUPTED) ; - while (acquire_sem(cm_done_sem) == B_INTERRUPTED) ; - break; - - case 'PICT': - D(bug(" clipping PICT\n")); - //!! this has to be converted to use the Clipboard Manager -#if 0 - if (be_clipboard->Lock()) { - be_clipboard->Clear(); - BMessage *clipper = be_clipboard->Data(); - // Waaaah! This crashes! - if (input_cap > 0) { // if there is an converter for PICT datatype convert data to bitmap. - BMemoryIO *in_buffer = new BMemoryIO(scrap, length); - BMallocIO *out_buffer = new BMallocIO(); - status_t result=roster->Translate(in_buffer,&input_info,NULL,out_buffer,B_TRANSLATOR_BITMAP); - clipper->AddData("image/x-be-bitmap", B_MIME_TYPE, out_buffer->Buffer(), out_buffer->BufferLength()); - D(bug("conversion result:%08x buffer_size:%d\n",result,out_buffer->BufferLength())); - delete in_buffer; - delete out_buffer; - } - clipper->AddData("image/pict", B_MIME_TYPE, scrap, length); - be_clipboard->Commit(); - be_clipboard->Unlock(); - } -#endif - break; - } -} - -/* - * Mac application zeroes clipboard - */ - -void ZeroScrap() -{ - -} - -/* - * Mac application reads clipboard - */ - -void GetScrap(void **handle, uint32 type, int32 offset) -{ - M68kRegisters r; - D(bug("GetScrap handle %p, type %08lx, offset %ld\n", handle, type, offset)); - return; //!! GetScrap is currently broken (should use Clipboard Manager) - //!! replace with clipboard notification in BeOS R4.1 - - switch (type) { - case 'TEXT': - D(bug(" clipping TEXT\n")); - if (be_clipboard->Lock()) { - BMessage *clipper = be_clipboard->Data(); - char *clip; - ssize_t length; - - // Check if we already copied this data - if (clipper->HasData("application/x-SheepShaver-cookie", B_MIME_TYPE)) - return; - bigtime_t cookie = system_time(); - clipper->AddData("application/x-SheepShaver-cookie", B_MIME_TYPE, &cookie, sizeof(bigtime_t)); - - // No, is there text in it? - if (clipper->FindData("text/plain", B_MIME_TYPE, &clip, &length) == B_OK) { - D(bug(" text/plain found\n")); - - // Convert text from UTF-8 to Mac charset - int32 src_length = length; - int32 dest_length = length; - int32 state = 0; - char *outbuf = new char[dest_length]; - if (convert_from_utf8(B_MAC_ROMAN_CONVERSION, clip, &src_length, outbuf, &dest_length, &state) == B_OK) { - for (int i=0; iCommit(); - be_clipboard->Unlock(); - } - break; - - case 'PICT': - D(bug(" clipping PICT\n")); - if (be_clipboard->Lock()) { - BMessage *clipper = be_clipboard->Data(); - char *clip; - ssize_t length; - - // Check if we already copied this data - if (clipper->HasData("application/x-SheepShaver-cookie", B_MIME_TYPE)) - return; - bigtime_t cookie = system_time(); - clipper->AddData("application/x-SheepShaver-cookie", B_MIME_TYPE, &cookie, sizeof(bigtime_t)); - - static uint16 proc2[] = { - 0x598f, // subq.l #4,sp - 0xa9fc, // ZeroScrap() - 0x2f3c, 0, 0, // move.l #length,-(sp) - 0x2f3c, 'PI', 'CT', // move.l #'PICT',-(sp) - 0x2f3c, 0, 0, // move.l #buf,-(sp) - 0xa9fe, // PutScrap() - 0x588f, // addq.l #4,sp - M68K_RTS - }; - - // No, is there a pict ? - if (clipper->FindData("image/pict", B_MIME_TYPE, &clip, &length) == B_OK ) { - D(bug(" image/pict found\n")); - - // Add pict to Mac clipboard - *(int32 *)(proc2 + 3) = length; - *(char **)(proc2 + 9) = clip; - we_put_this_data = true; - Execute68k((uint32)proc2, &r); -#if 0 - // No, is there a bitmap ? - } else if (clipper->FindData("image/x-be-bitmap", B_MIME_TYPE, &clip, &length) == B_OK || output_cap > 0) { - D(bug(" image/x-be-bitmap found\nstarting conversion to PICT\n")); - - BMemoryIO *in_buffer = new BMemoryIO(clip, length); - BMallocIO *out_buffer = new BMallocIO(); - status_t result=roster->Translate(output_trans,in_buffer,NULL,out_buffer,'PICT'); - D(bug("result of conversion:%08x buffer_size:%d\n",result,out_buffer->BufferLength())); - - // Add pict to Mac clipboard - *(int32 *)(proc2 + 3) = out_buffer->BufferLength(); - *(char **)(proc2 + 9) = (char *)out_buffer->Buffer(); - we_put_this_data = true; - Execute68k(proc2, &r); - - delete in_buffer; - delete out_buffer; -#endif - } - be_clipboard->Commit(); - be_clipboard->Unlock(); - } - break; - } -} diff --git a/SheepShaver/src/BeOS/ether_beos.cpp b/SheepShaver/src/BeOS/ether_beos.cpp deleted file mode 100644 index 740f9638..00000000 --- a/SheepShaver/src/BeOS/ether_beos.cpp +++ /dev/null @@ -1,400 +0,0 @@ -/* - * ether_beos.cpp - SheepShaver Ethernet Device Driver (DLPI), BeOS specific stuff - * - * SheepShaver (C) 1997-2008 Marc Hellwig and Christian Bauer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" -#include "ether.h" -#include "ether_defs.h" -#include "prefs.h" -#include "xlowmem.h" -#include "main.h" -#include "user_strings.h" -#include "sheep_net.h" - -#define DEBUG 0 -#include "debug.h" - -#define STATISTICS 0 -#define MONITOR 0 - - -// Global variables -static thread_id read_thread; // Packet receiver thread -static bool ether_thread_active = true; // Flag for quitting the receiver thread - -static area_id buffer_area; // Packet buffer area -static net_buffer *net_buffer_ptr; // Pointer to packet buffer -static sem_id read_sem, write_sem; // Semaphores to trigger packet reading/writing -static uint32 rd_pos; // Current read position in packet buffer -static uint32 wr_pos; // Current write position in packet buffer - -static bool net_open = false; // Flag: initialization succeeded, network device open - - -// Prototypes -static status_t AO_receive_thread(void *data); - - -/* - * Initialize ethernet - */ - -void EtherInit(void) -{ - // Do nothing if the user disabled the network - if (PrefsFindBool("nonet")) - return; - - // find net-server team -i_wanna_try_that_again: - bool found_add_on = false; - team_info t_info; - int32 t_cookie = 0; - image_info i_info; - int32 i_cookie = 0; - while (get_next_team_info(&t_cookie, &t_info) == B_NO_ERROR) { - if (strstr(t_info.args,"net_server")!=NULL) { - // check if sheep_net add-on is loaded - while (get_next_image_info(t_info.team,&i_cookie,&i_info) == B_NO_ERROR) { - if (strstr(i_info.name,"sheep_net")!=NULL) { - found_add_on = true; - break; - } - } - } - if (found_add_on) break; - } - if (!found_add_on) { - - // Search for sheep_net in network config file - char str[1024]; - bool sheep_net_found = false; - FILE *fin = fopen("/boot/home/config/settings/network", "r"); - while (!feof(fin)) { - fgets(str, 1024, fin); - if (strstr(str, "PROTOCOLS")) - if (strstr(str, "sheep_net")) - sheep_net_found = true; - } - fclose(fin); - - // It was found, so something else must be wrong - if (sheep_net_found) { - WarningAlert(GetString(STR_NO_NET_ADDON_WARN)); - return; - } - - // Not found, inform the user - if (!ChoiceAlert(GetString(STR_NET_CONFIG_MODIFY_WARN), GetString(STR_OK_BUTTON), GetString(STR_CANCEL_BUTTON))) - return; - - // Change the network config file and restart the network - fin = fopen("/boot/home/config/settings/network", "r"); - FILE *fout = fopen("/boot/home/config/settings/network.2", "w"); - bool global_found = false; - bool modified = false; - while (!feof(fin)) { - str[0] = 0; - fgets(str, 1024, fin); - if (!global_found && strstr(str, "GLOBAL:")) { - global_found = true; - } else if (global_found && !modified && strstr(str, "PROTOCOLS")) { - str[strlen(str)-1] = 0; - strcat(str, " sheep_net\n"); - modified = true; - } else if (global_found && !modified && strlen(str) > 2 && str[strlen(str) - 2] == ':') { - fputs("\tPROTOCOLS = sheep_net\n", fout); - modified = true; - } - fputs(str, fout); - } - if (!modified) - fputs("\tPROTOCOLS = sheep_net\n", fout); - fclose(fout); - fclose(fin); - remove("/boot/home/config/settings/network.orig"); - rename("/boot/home/config/settings/network", "/boot/home/config/settings/network.orig"); - rename("/boot/home/config/settings/network.2", "/boot/home/config/settings/network"); - - app_info ai; - if (be_roster->GetAppInfo("application/x-vnd.Be-NETS", &ai) == B_OK) { - BMessenger msg(NULL, ai.team); - if (msg.IsValid()) { - while (be_roster->IsRunning("application/x-vnd.Be-NETS")) { - msg.SendMessage(B_QUIT_REQUESTED); - snooze(500000); - } - } - } - BPath path; - find_directory(B_BEOS_BOOT_DIRECTORY, &path); - path.Append("Netscript"); - char *argv[3] = {"/bin/sh", (char *)path.Path(), NULL}; - thread_id net_server = load_image(2, argv, environ); - resume_thread(net_server); - status_t l; - wait_for_thread(net_server, &l); - goto i_wanna_try_that_again; - } - - // Set up communications with add-on - area_id handler_buffer; - if ((handler_buffer = find_area("packet buffer")) < B_NO_ERROR) { - WarningAlert(GetString(STR_NET_ADDON_INIT_FAILED)); - return; - } - if ((buffer_area = clone_area("local packet buffer", &net_buffer_ptr, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, handler_buffer)) < B_NO_ERROR) { - D(bug("EtherInit: couldn't clone packet area\n")); - WarningAlert(GetString(STR_NET_ADDON_CLONE_FAILED)); - return; - } - if ((read_sem = create_sem(0, "ether read")) < B_NO_ERROR) { - printf("FATAL: can't create Ethernet semaphore\n"); - return; - } - net_buffer_ptr->read_sem = read_sem; - write_sem = net_buffer_ptr->write_sem; - read_thread = spawn_thread(AO_receive_thread, "ether read", B_URGENT_DISPLAY_PRIORITY, NULL); - resume_thread(read_thread); - for (int i=0; iwrite[i].cmd = IN_USE | (ACTIVATE_SHEEP_NET << 8); - rd_pos = wr_pos = 0; - release_sem(write_sem); - - // Everything OK - net_open = true; -} - - -/* - * Exit ethernet - */ - -void EtherExit(void) -{ - if (net_open) { - - // Close communications with add-on - for (int i=0; iwrite[i].cmd = IN_USE | (DEACTIVATE_SHEEP_NET << 8); - release_sem(write_sem); - - // Quit receiver thread - ether_thread_active = false; - status_t result; - release_sem(read_sem); - while (wait_for_thread(read_thread, &result) == B_INTERRUPTED) ; - - delete_sem(read_sem); - delete_area(buffer_area); - } - -#if STATISTICS - // Show statistics - printf("%ld messages put on write queue\n", num_wput); - printf("%ld error acks\n", num_error_acks); - printf("%ld packets transmitted (%ld raw, %ld normal)\n", num_tx_packets, num_tx_raw_packets, num_tx_normal_packets); - printf("%ld tx packets dropped because buffer full\n", num_tx_buffer_full); - printf("%ld packets received\n", num_rx_packets); - printf("%ld packets passed upstream (%ld Fast Path, %ld normal)\n", num_rx_fastpath + num_unitdata_ind, num_rx_fastpath, num_unitdata_ind); - printf("EtherIRQ called %ld times\n", num_ether_irq); - printf("%ld rx packets dropped due to low memory\n", num_rx_no_mem); - printf("%ld rx packets dropped because no stream found\n", num_rx_dropped); - printf("%ld rx packets dropped because stream not ready\n", num_rx_stream_not_ready); - printf("%ld rx packets dropped because no memory for unitdata_ind\n", num_rx_no_unitdata_mem); -#endif -} - - -/* - * Ask add-on for ethernet hardware address - */ - -void AO_get_ethernet_address(uint32 arg) -{ - uint8 *addr = Mac2HostAddr(arg); - if (net_open) { - OTCopy48BitAddress(net_buffer_ptr->ether_addr, addr); - } else { - addr[0] = 0x12; - addr[1] = 0x34; - addr[2] = 0x56; - addr[3] = 0x78; - addr[4] = 0x9a; - addr[5] = 0xbc; - } - D(bug("AO_get_ethernet_address: got address %02x%02x%02x%02x%02x%02x\n", addr[0], addr[1], addr[2], addr[3], addr[4], addr[5])); -} - - -/* - * Tell add-on to enable multicast address - */ - -void AO_enable_multicast(uint32 addr) -{ - D(bug("AO_enable_multicast\n")); - if (net_open) { - net_packet *p = &net_buffer_ptr->write[wr_pos]; - if (p->cmd & IN_USE) { - D(bug("WARNING: couldn't enable multicast address\n")); - } else { - Mac2host_memcpy(p->data, addr, 6); - p->length = 6; - p->cmd = IN_USE | (ADD_MULTICAST << 8); - wr_pos = (wr_pos + 1) % WRITE_PACKET_COUNT; - release_sem(write_sem); - } - } -} - - -/* - * Tell add-on to disable multicast address - */ - -void AO_disable_multicast(uint32 addr) -{ - D(bug("AO_disable_multicast\n")); - if (net_open) { - net_packet *p = &net_buffer_ptr->write[wr_pos]; - if (p->cmd & IN_USE) { - D(bug("WARNING: couldn't enable multicast address\n")); - } else { - Mac2host_memcpy(p->data, addr, 6); - p->length = 6; - p->cmd = IN_USE | (REMOVE_MULTICAST << 8); - wr_pos = (wr_pos + 1) % WRITE_PACKET_COUNT; - release_sem(write_sem); - } - D(bug("WARNING: couldn't disable multicast address\n")); - } -} - - -/* - * Tell add-on to transmit one packet - */ - -void AO_transmit_packet(uint32 mp_arg) -{ - D(bug("AO_transmit_packet\n")); - if (net_open) { - net_packet *p = &net_buffer_ptr->write[wr_pos]; - if (p->cmd & IN_USE) { - D(bug("WARNING: couldn't transmit packet (buffer full)\n")); - num_tx_buffer_full++; - } else { - D(bug(" write packet pos %d\n", i)); - num_tx_packets++; - - // Copy packet to buffer - uint8 *start; - uint8 *bp = start = p->data; - mblk_t *mp = Mac2HostAddr(mp_arg); - while (mp) { - uint32 size = mp->b_wptr - mp->b_rptr; - memcpy(bp, mp->b_rptr, size); - bp += size; - mp = mp->b_cont; - } - -#if MONITOR - bug("Sending Ethernet packet:\n"); - for (int i=0; i<(uint32)(bp - start); i++) { - bug("%02lx ", start[i]); - } - bug("\n"); -#endif - - // Notify add-on - p->length = (uint32)(bp - start); - p->cmd = IN_USE | (SHEEP_PACKET << 8); - wr_pos = (wr_pos + 1) % WRITE_PACKET_COUNT; - release_sem(write_sem); - } - } -} - - -/* - * Packet reception thread - */ - -static status_t AO_receive_thread(void *data) -{ - while (ether_thread_active) { - if (net_buffer_ptr->read[rd_pos].cmd & IN_USE) { - if (ether_driver_opened) { - D(bug(" packet received, triggering Ethernet interrupt\n")); - SetInterruptFlag(INTFLAG_ETHER); - TriggerInterrupt(); - } - } - acquire_sem_etc(read_sem, 1, B_TIMEOUT, 25000); - } - return 0; -} - - -/* - * Ethernet interrupt - */ - -void EtherIRQ(void) -{ - D(bug("EtherIRQ\n")); - num_ether_irq++; - OTEnterInterrupt(); - - // Send received packets to OpenTransport - net_packet *p = &net_buffer_ptr->read[rd_pos]; - while (p->cmd & IN_USE) { - if ((p->cmd >> 8) == SHEEP_PACKET) { - num_rx_packets++; - D(bug(" read packet pos %d\n", i)); - uint32 size = p->length; - -#if MONITOR - bug("Receiving Ethernet packet:\n"); - for (int i=0; idata[i]); - } - bug("\n"); -#endif - - // Wrap packet in message block - //!! maybe use esballoc() - mblk_t *mp; - if ((mp = allocb(size, 0)) != NULL) { - D(bug(" packet data at %p\n", (void *)mp->b_rptr)); - memcpy(mp->b_rptr, p->data, size); - mp->b_wptr += size; - ether_packet_received(mp); - } else { - D(bug("WARNING: Cannot allocate mblk for received packet\n")); - num_rx_no_mem++; - } - } - p->cmd = 0; // Free packet - rd_pos = (rd_pos + 1) % READ_PACKET_COUNT; - p = &net_buffer_ptr->read[rd_pos]; - } - OTLeaveInterrupt(); -} diff --git a/SheepShaver/src/BeOS/extfs_beos.cpp b/SheepShaver/src/BeOS/extfs_beos.cpp deleted file mode 120000 index e7cec3dc..00000000 --- a/SheepShaver/src/BeOS/extfs_beos.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/BeOS/extfs_beos.cpp \ No newline at end of file diff --git a/SheepShaver/src/BeOS/main_beos.cpp b/SheepShaver/src/BeOS/main_beos.cpp deleted file mode 100644 index 551cd518..00000000 --- a/SheepShaver/src/BeOS/main_beos.cpp +++ /dev/null @@ -1,2015 +0,0 @@ -/* - * main_beos.cpp - Emulation core, BeOS implementation - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NOTES: - * - * SheepShaver uses three run-time environments, reflected by the value of XLM_RUN_MODE. - * The two modes which are also present in the original MacOS, are: - * MODE_68K - 68k emulator is active - * MODE_NATIVE - 68k emulator is inactive - * In the original MacOS, these two modes have different memory mappings and exception - * tables. Under SheepShaver, the only difference is the handling of interrupts (see below). - * SheepShaver extends the 68k emulator with special opcodes (EMUL_OP) to perform faster - * mode switches when patching 68k routines with PowerPC code and adds a third run mode: - * MODE_EMUL_OP - 68k emulator active, but native register usage - * - * Switches between MODE_68K and MODE_NATIVE are only done with the Mixed Mode Manager - * (via nanokernel patches). The switch from MODE_68K to MODE_EMUL_OP occurs when executin - * one of the EMUL_OP 68k opcodes. When the opcode routine is done, it returns to MODE_68K. - * - * The Execute68k() routine allows EMUL_OP routines to execute 68k subroutines. It switches - * from MODE_EMUL_OP back to MODE_68K, so it must not be used by native routines (executing - * in MODE_NATIVE) nor by any other thread than the emul_thread (because the 68k emulator - * is not reentrant). When the 68k subroutine returns, it switches back to MODE_EMUL_OP. - * It is OK for a 68k routine called with Execute68k() to contain an EMUL_OP opcode. - * - * The handling of interrupts depends on the current run mode: - * MODE_68K - The USR1 signal handler sets one bit in the processor's CR. The 68k emulator - * will then execute the 68k interrupt routine when fetching the next instruction. - * MODE_NATIVE - The USR1 signal handler switches back to the original stack (signals run - * on a separate signal stack) and enters the External Interrupt routine in the - * nanokernel. - * MODE_EMUL_OP - The USR1 signal handler directly executes the 68k interrupt routine - * with Execute68k(). Before doing this, it must first check the current 68k interrupt - * level which is stored in XLM_68K_R25. This variable is set to the current level - * when entering EMUL_OP mode. Execute68k() also uses it to restore the level so that - * Execute68k()'d routines will run at the same interrupt level as the EMUL_OP routine - * it was called from. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "sysdeps.h" -#include "main.h" -#include "version.h" -#include "prefs.h" -#include "prefs_editor.h" -#include "cpu_emulation.h" -#include "emul_op.h" -#include "xlowmem.h" -#include "xpram.h" -#include "timer.h" -#include "adb.h" -#include "video.h" -#include "sys.h" -#include "macos_util.h" -#include "rom_patches.h" -#include "user_strings.h" - -#include "sheep_driver.h" - -#define DEBUG 0 -#include "debug.h" - -// Enable Execute68k() safety checks? -#define SAFE_EXEC_68K 0 - -// Save FP regs in Execute68k()? -#define SAVE_FP_EXEC_68K 0 - -// Interrupts in EMUL_OP mode? -#define INTERRUPTS_IN_EMUL_OP_MODE 1 - -// Interrupts in native mode? -#define INTERRUPTS_IN_NATIVE_MODE 1 - - -// Constants -const char APP_SIGNATURE[] = "application/x-vnd.cebix-SheepShaver"; -const char ROM_FILE_NAME[] = "ROM"; -const char ROM_FILE_NAME2[] = "Mac OS ROM"; -const char KERNEL_AREA_NAME[] = "Macintosh Kernel Data"; -const char KERNEL_AREA2_NAME[] = "Macintosh Kernel Data 2"; -const char RAM_AREA_NAME[] = "Macintosh RAM"; -const char ROM_AREA_NAME[] = "Macintosh ROM"; -const char DR_CACHE_AREA_NAME[] = "Macintosh DR Cache"; -const char DR_EMULATOR_AREA_NAME[] = "Macintosh DR Emulator"; -const char SHEEP_AREA_NAME[] = "SheepShaver Virtual Stack"; - -const uintptr ROM_BASE = 0x40800000; // Base address of ROM - -const uint32 SIG_STACK_SIZE = 8192; // Size of signal stack - -const uint32 MSG_START = 'strt'; // Emulator start message - - -// Application object -class SheepShaver : public BApplication { -public: - SheepShaver() : BApplication(APP_SIGNATURE) - { - // Find application directory and cwd to it - app_info the_info; - GetAppInfo(&the_info); - BEntry the_file(&the_info.ref); - BEntry the_dir; - the_file.GetParent(&the_dir); - BPath the_path; - the_dir.GetPath(&the_path); - chdir(the_path.Path()); - - // Initialize other variables - sheep_fd = -1; - emulator_data = NULL; - kernel_area = kernel_area2 = rom_area = ram_area = dr_cache_area = dr_emulator_area = -1; - emul_thread = nvram_thread = tick_thread = -1; - ReadyForSignals = false; - AllowQuitting = true; - NVRAMThreadActive = true; - TickThreadActive = true; - memset(last_xpram, 0, XPRAM_SIZE); - } - virtual void ReadyToRun(void); - virtual void MessageReceived(BMessage *msg); - void StartEmulator(void); - virtual bool QuitRequested(void); - virtual void Quit(void); - - thread_id emul_thread; // Emulator thread - thread_id nvram_thread; // NVRAM watchdog thread - thread_id tick_thread; // 60Hz thread - - KernelData *kernel_data; // Pointer to Kernel Data - EmulatorData *emulator_data; - - bool ReadyForSignals; // Flag: emul_thread ready to receive signals - bool AllowQuitting; // Flag: Alt-Q quitting allowed - bool NVRAMThreadActive; // nvram_thread will exit when this is false - bool TickThreadActive; // tick_thread will exit when this is false - - uint8 last_xpram[XPRAM_SIZE]; // Buffer for monitoring XPRAM changes - -private: - static status_t emul_func(void *arg); - static status_t nvram_func(void *arg); - static status_t tick_func(void *arg); - static void sigusr1_invoc(int sig, void *arg, vregs *r); - void sigusr1_handler(vregs *r); - static void sigsegv_invoc(int sig, void *arg, vregs *r); - static void sigill_invoc(int sig, void *arg, vregs *r); - void jump_to_rom(uint32 entry); - - void init_rom(void); - void load_rom(void); - - int sheep_fd; // FD of sheep driver - - area_id kernel_area; // Kernel Data area ID - area_id kernel_area2; // Alternate Kernel Data area ID - area_id rom_area; // ROM area ID - area_id ram_area; // RAM area ID - area_id dr_cache_area; // DR Cache area ID - area_id dr_emulator_area; // DR Emulator area ID - - struct sigaction sigusr1_action; // Interrupt signal (of emulator thread) - struct sigaction sigsegv_action; // Data access exception signal (of emulator thread) - struct sigaction sigill_action; // Illegal instruction exception signal (of emulator thread) - - // Exceptions - class area_error {}; - class file_open_error {}; - class file_read_error {}; - class rom_size_error {}; -}; - - -// Global variables -SheepShaver *the_app; // Pointer to application object -#if !EMULATED_PPC -void *TOC; // TOC pointer -#endif -uint32 RAMBase; // Base address of Mac RAM -uint32 RAMSize; // Size of Mac RAM -uint32 ROMBase; // Base address of Mac ROM -uint32 KernelDataAddr; // Address of Kernel Data -uint32 BootGlobsAddr; // Address of BootGlobs structure at top of Mac RAM -uint32 DRCacheAddr; // Address of DR Cache -uint32 DREmulatorAddr; // Address of DR Emulator -uint32 PVR; // Theoretical PVR -int64 CPUClockSpeed; // Processor clock speed (Hz) -int64 BusClockSpeed; // Bus clock speed (Hz) -int64 TimebaseSpeed; // Timebase clock speed (Hz) -system_info SysInfo; // System information -uint8 *RAMBaseHost; // Base address of Mac RAM (host address space) -uint8 *ROMBaseHost; // Base address of Mac ROM (host address space) - -static void *sig_stack = NULL; // Stack for signal handlers -static void *extra_stack = NULL; // Stack for SIGSEGV inside interrupt handler -uint32 SheepMem::page_size; // Size of a native page -uintptr SheepMem::zero_page = 0; // Address of ro page filled in with zeros -uintptr SheepMem::base; // Address of SheepShaver data -uintptr SheepMem::proc; // Bottom address of SheepShave procedures -uintptr SheepMem::data; // Top of SheepShaver data (stack like storage) -static area_id SheepMemArea; // SheepShaver data area ID - - -// Prototypes -static void sigsegv_handler(vregs *r); -static void sigill_handler(vregs *r); - - -/* - * Create application object and start it - */ - -int main(int argc, char **argv) -{ - tzset(); - the_app = new SheepShaver(); - the_app->Run(); - delete the_app; - return 0; -} - - -/* - * Run application - */ - -#if !EMULATED_PPC -static asm void *get_toc(void) -{ - mr r3,r2 - blr -} -#endif - -void SheepShaver::ReadyToRun(void) -{ - // Print some info - printf(GetString(STR_ABOUT_TEXT1), VERSION_MAJOR, VERSION_MINOR); - printf(" %s\n", GetString(STR_ABOUT_TEXT2)); - -#if !EMULATED_PPC - // Get TOC pointer - TOC = get_toc(); -#endif - - // Get system info - get_system_info(&SysInfo); - switch (SysInfo.cpu_type) { - case B_CPU_PPC_601: - PVR = 0x00010000; - break; - case B_CPU_PPC_603: - PVR = 0x00030000; - break; - case B_CPU_PPC_603e: - PVR = 0x00060000; - break; - case B_CPU_PPC_604: - PVR = 0x00040000; - break; - case B_CPU_PPC_604e: - PVR = 0x00090000; - break; - case B_CPU_PPC_750: - PVR = 0x00080000; - break; - default: - PVR = 0x00040000; - break; - } - CPUClockSpeed = SysInfo.cpu_clock_speed; - BusClockSpeed = SysInfo.bus_clock_speed; - TimebaseSpeed = BusClockSpeed / 4; - - // Delete old areas - area_id old_kernel_area = find_area(KERNEL_AREA_NAME); - if (old_kernel_area > 0) - delete_area(old_kernel_area); - area_id old_kernel2_area = find_area(KERNEL_AREA2_NAME); - if (old_kernel2_area > 0) - delete_area(old_kernel2_area); - area_id old_ram_area = find_area(RAM_AREA_NAME); - if (old_ram_area > 0) - delete_area(old_ram_area); - area_id old_rom_area = find_area(ROM_AREA_NAME); - if (old_rom_area > 0) - delete_area(old_rom_area); - area_id old_dr_cache_area = find_area(DR_CACHE_AREA_NAME); - if (old_dr_cache_area > 0) - delete_area(old_dr_cache_area); - area_id old_dr_emulator_area = find_area(DR_EMULATOR_AREA_NAME); - if (old_dr_emulator_area > 0) - delete_area(old_dr_emulator_area); - - // Read preferences - int argc = 0; - char **argv = NULL; - PrefsInit(NULL, argc, argv); - - // Init system routines - SysInit(); - - // Test amount of RAM available for areas - if (SysInfo.max_pages * B_PAGE_SIZE < 16 * 1024 * 1024) { - ErrorAlert(GetString(STR_NOT_ENOUGH_MEMORY_ERR)); - PostMessage(B_QUIT_REQUESTED); - return; - } - - // Show preferences editor (or start emulator directly) - if (!PrefsFindBool("nogui")) - PrefsEditor(MSG_START); - else - PostMessage(MSG_START); -} - - -/* - * Message received - */ - -void SheepShaver::MessageReceived(BMessage *msg) -{ - switch (msg->what) { - case MSG_START: - StartEmulator(); - break; - default: - BApplication::MessageReceived(msg); - } -} - - -/* - * Start emulator - */ - -void SheepShaver::StartEmulator(void) -{ - char str[256]; - - // Open sheep driver and remap low memory - sheep_fd = open("/dev/sheep", 0); - if (sheep_fd < 0) { - sprintf(str, GetString(STR_NO_SHEEP_DRIVER_ERR), strerror(sheep_fd), sheep_fd); - ErrorAlert(str); - PostMessage(B_QUIT_REQUESTED); - return; - } - status_t res = ioctl(sheep_fd, SHEEP_UP); - if (res < 0) { - sprintf(str, GetString(STR_SHEEP_UP_ERR), strerror(res), res); - ErrorAlert(str); - PostMessage(B_QUIT_REQUESTED); - return; - } - - // Create areas for Kernel Data - kernel_data = (KernelData *)KERNEL_DATA_BASE; - kernel_area = create_area(KERNEL_AREA_NAME, &kernel_data, B_EXACT_ADDRESS, KERNEL_AREA_SIZE, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); - if (kernel_area < 0) { - sprintf(str, GetString(STR_NO_KERNEL_DATA_ERR), strerror(kernel_area), kernel_area); - ErrorAlert(str); - PostMessage(B_QUIT_REQUESTED); - return; - } - emulator_data = &kernel_data->ed; - KernelDataAddr = (uint32)kernel_data; - D(bug("Kernel Data area %ld at %p, Emulator Data at %p\n", kernel_area, kernel_data, emulator_data)); - - void *kernel_data2 = (void *)KERNEL_DATA2_BASE; - kernel_area2 = clone_area(KERNEL_AREA2_NAME, &kernel_data2, B_EXACT_ADDRESS, B_READ_AREA | B_WRITE_AREA, kernel_area); - if (kernel_area2 < 0) { - sprintf(str, GetString(STR_NO_KERNEL_DATA_ERR), strerror(kernel_area2), kernel_area2); - ErrorAlert(str); - PostMessage(B_QUIT_REQUESTED); - return; - } - D(bug("Kernel Data 2 area %ld at %p\n", kernel_area2, kernel_data2)); - - // Create area for SheepShaver data - if (!SheepMem::Init()) { - sprintf(str, GetString(STR_NO_SHEEP_MEM_AREA_ERR), strerror(SheepMemArea), SheepMemArea); - ErrorAlert(str); - PostMessage(B_QUIT_REQUESTED); - return; - } - - // Create area for Mac RAM - RAMSize = PrefsFindInt32("ramsize") & 0xfff00000; // Round down to 1MB boundary - if (RAMSize < 8*1024*1024) { - WarningAlert(GetString(STR_SMALL_RAM_WARN)); - RAMSize = 8*1024*1024; - } - - RAMBase = 0x10000000; - ram_area = create_area(RAM_AREA_NAME, (void **)&RAMBase, B_BASE_ADDRESS, RAMSize, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); - if (ram_area < 0) { - sprintf(str, GetString(STR_NO_RAM_AREA_ERR), strerror(ram_area), ram_area); - ErrorAlert(str); - PostMessage(B_QUIT_REQUESTED); - return; - } - RAMBaseHost = (uint8 *)RAMBase; - D(bug("RAM area %ld at %p\n", ram_area, RAMBaseHost)); - - // Create area and load Mac ROM - try { - init_rom(); - } catch (area_error) { - ErrorAlert(GetString(STR_NO_ROM_AREA_ERR)); - PostMessage(B_QUIT_REQUESTED); - return; - } catch (file_open_error) { - ErrorAlert(GetString(STR_NO_ROM_FILE_ERR)); - PostMessage(B_QUIT_REQUESTED); - return; - } catch (file_read_error) { - ErrorAlert(GetString(STR_ROM_FILE_READ_ERR)); - PostMessage(B_QUIT_REQUESTED); - return; - } catch (rom_size_error) { - ErrorAlert(GetString(STR_ROM_SIZE_ERR)); - PostMessage(B_QUIT_REQUESTED); - return; - } - - // Create area for DR Cache - DRCacheAddr = DR_CACHE_BASE; - dr_cache_area = create_area(DR_CACHE_AREA_NAME, (void **)&DRCacheAddr, B_EXACT_ADDRESS, DR_CACHE_SIZE, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); - if (dr_cache_area < 0) { - sprintf(str, GetString(STR_NO_KERNEL_DATA_ERR), strerror(dr_cache_area), dr_cache_area); - ErrorAlert(str); - PostMessage(B_QUIT_REQUESTED); - return; - } - D(bug("DR Cache area %ld at %p\n", dr_cache_area, DRCacheAddr)); - - // Create area for DR Emulator - DREmulatorAddr = DR_EMULATOR_BASE; - dr_emulator_area = create_area(DR_EMULATOR_AREA_NAME, (void **)&DREmulatorAddr, B_EXACT_ADDRESS, DR_EMULATOR_SIZE, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); - if (dr_emulator_area < 0) { - sprintf(str, GetString(STR_NO_KERNEL_DATA_ERR), strerror(dr_emulator_area), dr_emulator_area); - ErrorAlert(str); - PostMessage(B_QUIT_REQUESTED); - return; - } - D(bug("DR Emulator area %ld at %p\n", dr_emulator_area, DREmulatorAddr)); - - // Initialize everything - if (!InitAll(NULL)) { - PostMessage(B_QUIT_REQUESTED); - return; - } - D(bug("Initialization complete\n")); - - // Clear caches (as we loaded and patched code) and write protect ROM -#if !EMULATED_PPC - clear_caches(ROMBaseHost, ROM_AREA_SIZE, B_INVALIDATE_ICACHE | B_FLUSH_DCACHE); -#endif - set_area_protection(rom_area, B_READ_AREA); - - // Initialize extra low memory - D(bug("Initializing extra Low Memory...\n")); - WriteMacInt32(XLM_SHEEP_OBJ, (uint32)this); // Pointer to SheepShaver object - D(bug("Extra Low Memory initialized\n")); - - // Disallow quitting with Alt-Q from now on - AllowQuitting = false; - - // Start 60Hz interrupt - tick_thread = spawn_thread(tick_func, "60Hz", B_URGENT_DISPLAY_PRIORITY, this); - resume_thread(tick_thread); - - // Start NVRAM watchdog thread - memcpy(last_xpram, XPRAM, XPRAM_SIZE); - nvram_thread = spawn_thread(nvram_func, "NVRAM Watchdog", B_LOW_PRIORITY, this); - resume_thread(nvram_thread); - - // Start emulator thread - emul_thread = spawn_thread(emul_func, "MacOS", B_NORMAL_PRIORITY, this); - resume_thread(emul_thread); -} - - -/* - * Quit requested - */ - -bool SheepShaver::QuitRequested(void) -{ - if (AllowQuitting) - return BApplication::QuitRequested(); - else - return false; -} - -void SheepShaver::Quit(void) -{ - status_t l; - - // Stop 60Hz interrupt - if (tick_thread > 0) { - TickThreadActive = false; - wait_for_thread(tick_thread, &l); - } - - // Stop NVRAM watchdog - if (nvram_thread > 0) { - status_t l; - NVRAMThreadActive = false; - suspend_thread(nvram_thread); // Wake thread up from snooze() - snooze(1000); - resume_thread(nvram_thread); - while (wait_for_thread(nvram_thread, &l) == B_INTERRUPTED) ; - } - - // Wait for emulator thread to finish - if (emul_thread > 0) - wait_for_thread(emul_thread, &l); - - // Deinitialize everything - ExitAll(); - - // Delete SheepShaver globals - SheepMem::Exit(); - - // Delete DR Emulator area - if (dr_emulator_area >= 0) - delete_area(dr_emulator_area); - - // Delete DR Cache area - if (dr_cache_area >= 0) - delete_area(dr_cache_area); - - // Delete ROM area - if (rom_area >= 0) - delete_area(rom_area); - - // Delete RAM area - if (ram_area >= 0) - delete_area(ram_area); - - // Delete Kernel Data area2 - if (kernel_area2 >= 0) - delete_area(kernel_area2); - if (kernel_area >= 0) - delete_area(kernel_area); - - // Unmap low memory and close sheep driver - if (sheep_fd >= 0) { - ioctl(sheep_fd, SHEEP_DOWN); - close(sheep_fd); - } - - // Exit system routines - SysExit(); - - // Exit preferences - PrefsExit(); - - BApplication::Quit(); -} - - -/* - * Create area for ROM (sets rom_area) and load ROM file - * - * area_error : Cannot create area - * file_open_error: Cannot open ROM file - * file_read_error: Cannot read ROM file - */ - -void SheepShaver::init_rom(void) -{ - // Size of a native page - page_size = B_PAGE_SIZE; - - // Create area for ROM - ROMBase = ROM_BASE; - rom_area = create_area(ROM_AREA_NAME, (void **)&ROMBase, B_EXACT_ADDRESS, ROM_AREA_SIZE, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); - if (rom_area < 0) - throw area_error(); - ROMBaseHost = (uint8 *)ROMBase; - D(bug("ROM area %ld at %p\n", rom_area, rom_addr)); - - // Load ROM - load_rom(); -} - - -/* - * Load ROM file - * - * file_open_error: Cannot open ROM file (nor use built-in ROM) - * file_read_error: Cannot read ROM file - */ - -void SheepShaver::load_rom(void) -{ - // Get rom file path from preferences - const char *rom_path = PrefsFindString("rom"); - - // Try to open ROM file - BFile file(rom_path && *rom_path ? rom_path : ROM_FILE_NAME, B_READ_ONLY); - if (file.InitCheck() != B_NO_ERROR) { - - // Failed, then ask memory_mess driver for ROM - uint8 *rom = new uint8[ROM_SIZE]; // Reading directly into the area doesn't work - ssize_t actual = read(sheep_fd, (void *)rom, ROM_SIZE); - if (actual == ROM_SIZE) { - memcpy(ROMBaseHost, rom, ROM_SIZE); - delete[] rom; - return; - } else - throw file_open_error(); - } - - printf(GetString(STR_READING_ROM_FILE)); - - // Get file size - off_t rom_size = 0; - file.GetSize(&rom_size); - - uint8 *rom = new uint8[ROM_SIZE]; // Reading directly into the area doesn't work - ssize_t actual = file.Read((void *)rom, ROM_SIZE); - - // Decode Mac ROM - if (!DecodeROM(rom, actual)) { - if (rom_size != 4*1024*1024) - throw rom_size_error(); - else - throw file_read_error(); - } - delete[] rom; -} - - -/* - * Emulator thread function - */ - -status_t SheepShaver::emul_func(void *arg) -{ - SheepShaver *obj = (SheepShaver *)arg; - - // Install interrupt signal handler - sigemptyset(&obj->sigusr1_action.sa_mask); - obj->sigusr1_action.sa_handler = (__signal_func_ptr)(obj->sigusr1_invoc); - obj->sigusr1_action.sa_flags = 0; - obj->sigusr1_action.sa_userdata = arg; - sigaction(SIGUSR1, &obj->sigusr1_action, NULL); - - // Install data access signal handler - sigemptyset(&obj->sigsegv_action.sa_mask); - obj->sigsegv_action.sa_handler = (__signal_func_ptr)(obj->sigsegv_invoc); - obj->sigsegv_action.sa_flags = 0; - obj->sigsegv_action.sa_userdata = arg; - sigaction(SIGSEGV, &obj->sigsegv_action, NULL); - -#if !EMULATED_PPC - // Install illegal instruction signal handler - sigemptyset(&obj->sigill_action.sa_mask); - obj->sigill_action.sa_handler = (__signal_func_ptr)(obj->sigill_invoc); - obj->sigill_action.sa_flags = 0; - obj->sigill_action.sa_userdata = arg; - sigaction(SIGILL, &obj->sigill_action, NULL); -#endif - - // Exceptions will send signals - disable_debugger(true); - - // Install signal stack - sig_stack = malloc(SIG_STACK_SIZE); - extra_stack = malloc(SIG_STACK_SIZE); - set_signal_stack(sig_stack, SIG_STACK_SIZE); - - // We're now ready to receive signals - obj->ReadyForSignals = true; - - // Jump to ROM boot routine - D(bug("Jumping to ROM\n")); - obj->jump_to_rom(ROMBase + 0x310000); - D(bug("Returned from ROM\n")); - - // We're no longer ready to receive signals - obj->ReadyForSignals = false; - obj->AllowQuitting = true; - - // Quit program - be_app->PostMessage(B_QUIT_REQUESTED); - return 0; -} - - -/* - * Jump into Mac ROM, start 680x0 emulator - * (also contains other EMUL_RETURN and EMUL_OP routines) - */ - -#if EMULATED_PPC -extern void emul_ppc(uint32 start); -extern void init_emul_ppc(void); -void SheepShaver::jump_to_rom(uint32 entry) -{ - init_emul_ppc(); - emul_ppc(entry); -} -#else -asm void SheepShaver::jump_to_rom(register uint32 entry) -{ - // Create stack frame - mflr r0 - stw r0,8(r1) - mfcr r0 - stw r0,4(r1) - stwu r1,-(56+19*4+18*8)(r1) - - // Save PowerPC registers - stmw r13,56(r1) - stfd f14,56+19*4+0*8(r1) - stfd f15,56+19*4+1*8(r1) - stfd f16,56+19*4+2*8(r1) - stfd f17,56+19*4+3*8(r1) - stfd f18,56+19*4+4*8(r1) - stfd f19,56+19*4+5*8(r1) - stfd f20,56+19*4+6*8(r1) - stfd f21,56+19*4+7*8(r1) - stfd f22,56+19*4+8*8(r1) - stfd f23,56+19*4+9*8(r1) - stfd f24,56+19*4+10*8(r1) - stfd f25,56+19*4+11*8(r1) - stfd f26,56+19*4+12*8(r1) - stfd f27,56+19*4+13*8(r1) - stfd f28,56+19*4+14*8(r1) - stfd f29,56+19*4+15*8(r1) - stfd f30,56+19*4+16*8(r1) - stfd f31,56+19*4+17*8(r1) - - // Move entry address to ctr, get pointer to Emulator Data - mtctr r4 - lwz r4,SheepShaver.emulator_data(r3) - - // Skip over EMUL_RETURN routine and get its address - bl @1 - - - /* - * EMUL_RETURN: Returned from emulator - */ - - // Restore PowerPC registers - lwz r1,XLM_EMUL_RETURN_STACK - lwz r2,XLM_TOC - lmw r13,56(r1) - lfd f14,56+19*4+0*8(r1) - lfd f15,56+19*4+1*8(r1) - lfd f16,56+19*4+2*8(r1) - lfd f17,56+19*4+3*8(r1) - lfd f18,56+19*4+4*8(r1) - lfd f19,56+19*4+5*8(r1) - lfd f20,56+19*4+6*8(r1) - lfd f21,56+19*4+7*8(r1) - lfd f22,56+19*4+8*8(r1) - lfd f23,56+19*4+9*8(r1) - lfd f24,56+19*4+10*8(r1) - lfd f25,56+19*4+11*8(r1) - lfd f26,56+19*4+12*8(r1) - lfd f27,56+19*4+13*8(r1) - lfd f28,56+19*4+14*8(r1) - lfd f29,56+19*4+15*8(r1) - lfd f30,56+19*4+16*8(r1) - lfd f31,56+19*4+17*8(r1) - - // Exiting from 68k emulator - li r0,1 - stw r0,XLM_IRQ_NEST - li r0,MODE_NATIVE - stw r0,XLM_RUN_MODE - - // Return to caller of jump_to_rom() - lwz r0,56+19*4+18*8+8(r1) - mtlr r0 - lwz r0,56+19*4+18*8+4(r1) - mtcrf 0xff,r0 - addi r1,r1,56+19*4+18*8 - blr - - - // Save address of EMUL_RETURN routine for 68k emulator patch -@1 mflr r0 - stw r0,XLM_EMUL_RETURN_PROC - - // Skip over EXEC_RETURN routine and get its address - bl @2 - - - /* - * EXEC_RETURN: Returned from 68k routine executed with Execute68k() - */ - - // Save r25 (contains current 68k interrupt level) - stw r25,XLM_68K_R25 - - // Reentering EMUL_OP mode - li r0,MODE_EMUL_OP - stw r0,XLM_RUN_MODE - - // Save 68k registers - lwz r4,56+19*4+18*8+12(r1) - stw r8,M68kRegisters.d[0](r4) - stw r9,M68kRegisters.d[1](r4) - stw r10,M68kRegisters.d[2](r4) - stw r11,M68kRegisters.d[3](r4) - stw r12,M68kRegisters.d[4](r4) - stw r13,M68kRegisters.d[5](r4) - stw r14,M68kRegisters.d[6](r4) - stw r15,M68kRegisters.d[7](r4) - stw r16,M68kRegisters.a[0](r4) - stw r17,M68kRegisters.a[1](r4) - stw r18,M68kRegisters.a[2](r4) - stw r19,M68kRegisters.a[3](r4) - stw r20,M68kRegisters.a[4](r4) - stw r21,M68kRegisters.a[5](r4) - stw r22,M68kRegisters.a[6](r4) - - // Restore PowerPC registers - lmw r13,56(r1) -#if SAVE_FP_EXEC_68K - lfd f14,56+19*4+0*8(r1) - lfd f15,56+19*4+1*8(r1) - lfd f16,56+19*4+2*8(r1) - lfd f17,56+19*4+3*8(r1) - lfd f18,56+19*4+4*8(r1) - lfd f19,56+19*4+5*8(r1) - lfd f20,56+19*4+6*8(r1) - lfd f21,56+19*4+7*8(r1) - lfd f22,56+19*4+8*8(r1) - lfd f23,56+19*4+9*8(r1) - lfd f24,56+19*4+10*8(r1) - lfd f25,56+19*4+11*8(r1) - lfd f26,56+19*4+12*8(r1) - lfd f27,56+19*4+13*8(r1) - lfd f28,56+19*4+14*8(r1) - lfd f29,56+19*4+15*8(r1) - lfd f30,56+19*4+16*8(r1) - lfd f31,56+19*4+17*8(r1) -#endif - - // Return to caller - lwz r0,56+19*4+18*8+8(r1) - mtlr r0 - addi r1,r1,56+19*4+18*8 - blr - - - // Stave address of EXEC_RETURN routine for 68k emulator patch -@2 mflr r0 - stw r0,XLM_EXEC_RETURN_PROC - - // Skip over EMUL_BREAK/EMUL_OP routine and get its address - bl @3 - - - /* - * EMUL_BREAK/EMUL_OP: Execute native routine, selector in r5 (my own private mode switch) - * - * 68k registers are stored in a M68kRegisters struct on the stack - * which the native routine may read and modify - */ - - // Save r25 (contains current 68k interrupt level) - stw r25,XLM_68K_R25 - - // Entering EMUL_OP mode within 68k emulator - li r0,MODE_EMUL_OP - stw r0,XLM_RUN_MODE - - // Create PowerPC stack frame, reserve space for M68kRegisters - mr r3,r1 - subi r1,r1,56 // Fake "caller" frame - rlwinm r1,r1,0,0,29 // Align stack - - mfcr r0 - rlwinm r0,r0,0,11,8 - stw r0,4(r1) - mfxer r0 - stw r0,16(r1) - stw r2,12(r1) - stwu r1,-(56+16*4+15*8)(r1) - lwz r2,XLM_TOC - - // Save 68k registers - stw r8,56+M68kRegisters.d[0](r1) - stw r9,56+M68kRegisters.d[1](r1) - stw r10,56+M68kRegisters.d[2](r1) - stw r11,56+M68kRegisters.d[3](r1) - stw r12,56+M68kRegisters.d[4](r1) - stw r13,56+M68kRegisters.d[5](r1) - stw r14,56+M68kRegisters.d[6](r1) - stw r15,56+M68kRegisters.d[7](r1) - stw r16,56+M68kRegisters.a[0](r1) - stw r17,56+M68kRegisters.a[1](r1) - stw r18,56+M68kRegisters.a[2](r1) - stw r19,56+M68kRegisters.a[3](r1) - stw r20,56+M68kRegisters.a[4](r1) - stw r21,56+M68kRegisters.a[5](r1) - stw r22,56+M68kRegisters.a[6](r1) - stw r3,56+M68kRegisters.a[7](r1) - stfd f0,56+16*4+0*8(r1) - stfd f1,56+16*4+1*8(r1) - stfd f2,56+16*4+2*8(r1) - stfd f3,56+16*4+3*8(r1) - stfd f4,56+16*4+4*8(r1) - stfd f5,56+16*4+5*8(r1) - stfd f6,56+16*4+6*8(r1) - stfd f7,56+16*4+7*8(r1) - mffs f0 - stfd f8,56+16*4+8*8(r1) - stfd f9,56+16*4+9*8(r1) - stfd f10,56+16*4+10*8(r1) - stfd f11,56+16*4+11*8(r1) - stfd f12,56+16*4+12*8(r1) - stfd f13,56+16*4+13*8(r1) - stfd f0,56+16*4+14*8(r1) - - // Execute native routine - addi r3,r1,56 - mr r4,r24 - bl EmulOp - - // Restore 68k registers - lwz r8,56+M68kRegisters.d[0](r1) - lwz r9,56+M68kRegisters.d[1](r1) - lwz r10,56+M68kRegisters.d[2](r1) - lwz r11,56+M68kRegisters.d[3](r1) - lwz r12,56+M68kRegisters.d[4](r1) - lwz r13,56+M68kRegisters.d[5](r1) - lwz r14,56+M68kRegisters.d[6](r1) - lwz r15,56+M68kRegisters.d[7](r1) - lwz r16,56+M68kRegisters.a[0](r1) - lwz r17,56+M68kRegisters.a[1](r1) - lwz r18,56+M68kRegisters.a[2](r1) - lwz r19,56+M68kRegisters.a[3](r1) - lwz r20,56+M68kRegisters.a[4](r1) - lwz r21,56+M68kRegisters.a[5](r1) - lwz r22,56+M68kRegisters.a[6](r1) - lwz r3,56+M68kRegisters.a[7](r1) - lfd f13,56+16*4+14*8(r1) - lfd f0,56+16*4+0*8(r1) - lfd f1,56+16*4+1*8(r1) - lfd f2,56+16*4+2*8(r1) - lfd f3,56+16*4+3*8(r1) - lfd f4,56+16*4+4*8(r1) - lfd f5,56+16*4+5*8(r1) - lfd f6,56+16*4+6*8(r1) - lfd f7,56+16*4+7*8(r1) - mtfsf 0xff,f13 - lfd f8,56+16*4+8*8(r1) - lfd f9,56+16*4+9*8(r1) - lfd f10,56+16*4+10*8(r1) - lfd f11,56+16*4+11*8(r1) - lfd f12,56+16*4+12*8(r1) - lfd f13,56+16*4+13*8(r1) - - // Delete PowerPC stack frame - lwz r2,56+16*4+15*8+12(r1) - lwz r0,56+16*4+15*8+16(r1) - mtxer r0 - lwz r0,56+16*4+15*8+4(r1) - mtcrf 0xff,r0 - mr r1,r3 - - // Reeintering 68k emulator - li r0,MODE_68K - stw r0,XLM_RUN_MODE - - // Set r0 to 0 for 68k emulator - li r0,0 - - // Execute next 68k opcode - rlwimi r29,r27,3,13,28 - lhau r27,2(r24) - mtlr r29 - blr - - - // Save address of EMUL_BREAK/EMUL_OP routine for 68k emulator patch -@3 mflr r0 - stw r0,XLM_EMUL_OP_PROC - - // Save stack pointer for EMUL_RETURN - stw r1,XLM_EMUL_RETURN_STACK - - // Preset registers for ROM boot routine - lis r3,0x40b0 // Pointer to ROM boot structure - ori r3,r3,0xd000 - - // 68k emulator is now active - li r0,MODE_68K - stw r0,XLM_RUN_MODE - - // Jump to ROM - bctr -} -#endif - - -#if !EMULATED_PPC -/* - * Execute 68k subroutine (must be ended with RTS) - * This must only be called by the emul_thread when in EMUL_OP mode - * r->a[7] is unused, the routine runs on the caller's stack - */ - -#if SAFE_EXEC_68K -void execute_68k(uint32 pc, M68kRegisters *r); - -void Execute68k(uint32 pc, M68kRegisters *r) -{ - if (*(uint32 *)XLM_RUN_MODE != MODE_EMUL_OP) - printf("FATAL: Execute68k() not called from EMUL_OP mode\n"); - if (find_thread(NULL) != the_app->emul_thread) - printf("FATAL: Execute68k() not called from emul_thread\n"); - execute_68k(pc, r); -} - -asm void execute_68k(register uint32 pc, register M68kRegisters *r) -#else -asm void Execute68k(register uint32 pc, register M68kRegisters *r) -#endif -{ - // Create stack frame - mflr r0 - stw r0,8(r1) - stw r4,12(r1) - stwu r1,-(56+19*4+18*8)(r1) - - // Save PowerPC registers - stmw r13,56(r1) -#if SAVE_FP_EXEC_68K - stfd f14,56+19*4+0*8(r1) - stfd f15,56+19*4+1*8(r1) - stfd f16,56+19*4+2*8(r1) - stfd f17,56+19*4+3*8(r1) - stfd f18,56+19*4+4*8(r1) - stfd f19,56+19*4+5*8(r1) - stfd f20,56+19*4+6*8(r1) - stfd f21,56+19*4+7*8(r1) - stfd f22,56+19*4+8*8(r1) - stfd f23,56+19*4+9*8(r1) - stfd f24,56+19*4+10*8(r1) - stfd f25,56+19*4+11*8(r1) - stfd f26,56+19*4+12*8(r1) - stfd f27,56+19*4+13*8(r1) - stfd f28,56+19*4+14*8(r1) - stfd f29,56+19*4+15*8(r1) - stfd f30,56+19*4+16*8(r1) - stfd f31,56+19*4+17*8(r1) -#endif - - // Set up registers for 68k emulator - lwz r31,XLM_KERNEL_DATA // Pointer to Kernel Data - addi r31,r31,0x1000 - li r0,0 - mtcrf 0xff,r0 - creqv 11,11,11 // Supervisor mode - lwz r8,M68kRegisters.d[0](r4) - lwz r9,M68kRegisters.d[1](r4) - lwz r10,M68kRegisters.d[2](r4) - lwz r11,M68kRegisters.d[3](r4) - lwz r12,M68kRegisters.d[4](r4) - lwz r13,M68kRegisters.d[5](r4) - lwz r14,M68kRegisters.d[6](r4) - lwz r15,M68kRegisters.d[7](r4) - lwz r16,M68kRegisters.a[0](r4) - lwz r17,M68kRegisters.a[1](r4) - lwz r18,M68kRegisters.a[2](r4) - lwz r19,M68kRegisters.a[3](r4) - lwz r20,M68kRegisters.a[4](r4) - lwz r21,M68kRegisters.a[5](r4) - lwz r22,M68kRegisters.a[6](r4) - li r23,0 - mr r24,r3 - lwz r25,XLM_68K_R25 // MSB of SR - li r26,0 - li r28,0 // VBR - lwz r29,0x74(r31) // Pointer to opcode table - lwz r30,0x78(r31) // Address of emulator - - // Push return address (points to EXEC_RETURN opcode) on stack - li r0,XLM_EXEC_RETURN_OPCODE - stwu r0,-4(r1) - - // Reentering 68k emulator - li r0,MODE_68K - stw r0,XLM_RUN_MODE - - // Set r0 to 0 for 68k emulator - li r0,0 - - // Execute 68k opcode - lha r27,0(r24) - rlwimi r29,r27,3,13,28 - lhau r27,2(r24) - mtlr r29 - blr -} - - -/* - * Execute 68k A-Trap from EMUL_OP routine - * r->a[7] is unused, the routine runs on the caller's stack - */ - -void Execute68kTrap(uint16 trap, M68kRegisters *r) -{ - uint16 proc[2] = {trap, M68K_RTS}; - Execute68k((uint32)proc, r); -} - - -/* - * Quit emulator (must only be called from main thread) - */ - -asm void QuitEmulator(void) -{ - lwz r0,XLM_EMUL_RETURN_PROC - mtlr r0 - blr -} -#endif - - -/* - * Dump 68k registers - */ - -void Dump68kRegs(M68kRegisters *r) -{ - // Display 68k registers - for (int i=0; i<8; i++) { - printf("d%d: %08lx", i, r->d[i]); - if (i == 3 || i == 7) - printf("\n"); - else - printf(", "); - } - for (int i=0; i<8; i++) { - printf("a%d: %08lx", i, r->a[i]); - if (i == 3 || i == 7) - printf("\n"); - else - printf(", "); - } -} - - -/* - * Make code executable - */ - -void MakeExecutable(int dummy, uint32 start, uint32 length) -{ - if ((start >= ROMBase) && (start < (ROMBase + ROM_SIZE))) - return; - clear_caches((void *)start, length, B_INVALIDATE_ICACHE | B_FLUSH_DCACHE); -} - - -/* - * NVRAM watchdog thread (saves NVRAM every minute) - */ - -status_t SheepShaver::nvram_func(void *arg) -{ - SheepShaver *obj = (SheepShaver *)arg; - - while (obj->NVRAMThreadActive) { - snooze(60*1000000); - if (memcmp(obj->last_xpram, XPRAM, XPRAM_SIZE)) { - memcpy(obj->last_xpram, XPRAM, XPRAM_SIZE); - SaveXPRAM(); - } - } - return 0; -} - - -/* - * 60Hz thread (really 60.15Hz) - */ - -status_t SheepShaver::tick_func(void *arg) -{ - SheepShaver *obj = (SheepShaver *)arg; - int tick_counter = 0; - bigtime_t current = system_time(); - - while (obj->TickThreadActive) { - - // Wait - current += 16625; - snooze_until(current, B_SYSTEM_TIMEBASE); - - // Pseudo Mac 1Hz interrupt, update local time - if (++tick_counter > 60) { - tick_counter = 0; - WriteMacInt32(0x20c, TimerDateTime()); - } - - // 60Hz interrupt - if (ReadMacInt32(XLM_IRQ_NEST) == 0) { - SetInterruptFlag(INTFLAG_VIA); - TriggerInterrupt(); - } - } - return 0; -} - - -/* - * Trigger signal USR1 from another thread - */ - -void TriggerInterrupt(void) -{ - idle_resume(); -#if 0 - WriteMacInt32(0x16a, ReadMacInt32(0x16a) + 1); -#else - if (the_app->emul_thread > 0 && the_app->ReadyForSignals) - send_signal(the_app->emul_thread, SIGUSR1); -#endif -} - - -/* - * Mutexes - */ - -struct B2_mutex { - int dummy; //!! -}; - -B2_mutex *B2_create_mutex(void) -{ - return new B2_mutex; -} - -void B2_lock_mutex(B2_mutex *mutex) -{ -} - -void B2_unlock_mutex(B2_mutex *mutex) -{ -} - -void B2_delete_mutex(B2_mutex *mutex) -{ - delete mutex; -} - - -/* - * Set/clear interrupt flags (must be done atomically!) - */ - -volatile uint32 InterruptFlags = 0; - -void SetInterruptFlag(uint32 flag) -{ - atomic_or((int32 *)&InterruptFlags, flag); -} - -void ClearInterruptFlag(uint32 flag) -{ - atomic_and((int32 *)&InterruptFlags, ~flag); -} - - -/* - * Disable interrupts - */ - -void DisableInterrupt(void) -{ - atomic_add((int32 *)XLM_IRQ_NEST, 1); -} - - -/* - * Enable interrupts - */ - -void EnableInterrupt(void) -{ - atomic_add((int32 *)XLM_IRQ_NEST, -1); -} - - -/* - * USR1 handler - */ - -void SheepShaver::sigusr1_invoc(int sig, void *arg, vregs *r) -{ - ((SheepShaver *)arg)->sigusr1_handler(r); -} - -#if !EMULATED_PPC -static asm void ppc_interrupt(register uint32 entry) -{ - fralloc - - // Get address of return routine - bl @1 - - // Return routine - frfree - blr - -@1 - // Prepare registers for nanokernel interrupt routine - mtctr r1 - lwz r1,XLM_KERNEL_DATA - stw r6,0x018(r1) - mfctr r6 - stw r6,0x004(r1) - lwz r6,0x65c(r1) - stw r7,0x13c(r6) - stw r8,0x144(r6) - stw r9,0x14c(r6) - stw r10,0x154(r6) - stw r11,0x15c(r6) - stw r12,0x164(r6) - stw r13,0x16c(r6) - - mflr r10 - mfcr r13 - lwz r7,0x660(r1) - mflr r12 - rlwimi. r7,r7,8,0,0 - li r11,0 - ori r11,r11,0xf072 // MSR (SRR1) - mtcrf 0x70,r11 - li r8,0 - - // Enter nanokernel - mtlr r3 - blr -} -#endif - -void SheepShaver::sigusr1_handler(vregs *r) -{ - // Do nothing if interrupts are disabled - if ((*(int32 *)XLM_IRQ_NEST) > 0) - return; - - // Interrupt action depends on current run mode - switch (*(uint32 *)XLM_RUN_MODE) { - case MODE_68K: - // 68k emulator active, trigger 68k interrupt level 1 - *(uint16 *)(kernel_data->v[0x67c >> 2]) = 1; - r->cr |= kernel_data->v[0x674 >> 2]; - break; - -#if INTERRUPTS_IN_NATIVE_MODE - case MODE_NATIVE: - // 68k emulator inactive, in nanokernel? - if (r->r1 != KernelDataAddr) { - // No, prepare for 68k interrupt level 1 - *(uint16 *)(kernel_data->v[0x67c >> 2]) = 1; - *(uint32 *)(kernel_data->v[0x658 >> 2] + 0xdc) |= kernel_data->v[0x674 >> 2]; - - // Execute nanokernel interrupt routine (this will activate the 68k emulator) - atomic_add((int32 *)XLM_IRQ_NEST, 1); - if (ROMType == ROMTYPE_NEWWORLD) - ppc_interrupt(ROMBase + 0x312b1c); - else - ppc_interrupt(ROMBase + 0x312a3c); - } - break; -#endif - -#if INTERRUPTS_IN_EMUL_OP_MODE - case MODE_EMUL_OP: - // 68k emulator active, within EMUL_OP routine, execute 68k interrupt routine directly when interrupt level is 0 - if ((*(uint32 *)XLM_68K_R25 & 7) == 0) { - - // Set extra stack for SIGSEGV handler - set_signal_stack(extra_stack, SIG_STACK_SIZE); -#if 1 - // Execute full 68k interrupt routine - M68kRegisters r; - uint32 old_r25 = *(uint32 *)XLM_68K_R25; // Save interrupt level - *(uint32 *)XLM_68K_R25 = 0x21; // Execute with interrupt level 1 - static const uint16 proc[] = { - 0x3f3c, 0x0000, // move.w #$0000,-(sp) (fake format word) - 0x487a, 0x000a, // pea @1(pc) (return address) - 0x40e7, // move sr,-(sp) (saved SR) - 0x2078, 0x0064, // move.l $64,a0 - 0x4ed0, // jmp (a0) - M68K_RTS // @1 - }; - Execute68k((uint32)proc, &r); - *(uint32 *)XLM_68K_R25 = old_r25; // Restore interrupt level -#else - // Only update cursor - if (HasMacStarted()) { - if (InterruptFlags & INTFLAG_VIA) { - ClearInterruptFlag(INTFLAG_VIA); - ADBInterrupt(); - ExecuteNative(NATIVE_VIDEO_VBL); - } - } -#endif - // Reset normal signal stack - set_signal_stack(sig_stack, SIG_STACK_SIZE); - } - break; -#endif - } -} - - -/* - * SIGSEGV handler - */ - -static uint32 segv_r[32]; - -#if !EMULATED_PPC -asm void SheepShaver::sigsegv_invoc(register int sig, register void *arg, register vregs *r) -{ - mflr r0 - stw r0,8(r1) - stwu r1,-56(r1) - - lwz r3,segv_r(r2) - stmw r13,13*4(r3) - - mr r3,r5 - bl sigsegv_handler - - lwz r3,segv_r(r2) - lmw r13,13*4(r3) - - lwz r0,56+8(r1) - mtlr r0 - addi r1,r1,56 - blr -} -#endif - -static void sigsegv_handler(vregs *r) -{ - char str[256]; - - // Fetch volatile registers - segv_r[0] = r->r0; - segv_r[1] = r->r1; - segv_r[2] = r->r2; - segv_r[3] = r->r3; - segv_r[4] = r->r4; - segv_r[5] = r->r5; - segv_r[6] = r->r6; - segv_r[7] = r->r7; - segv_r[8] = r->r8; - segv_r[9] = r->r9; - segv_r[10] = r->r10; - segv_r[11] = r->r11; - segv_r[12] = r->r12; - - // Get opcode and divide into fields - uint32 opcode = *(uint32 *)r->pc; - uint32 primop = opcode >> 26; - uint32 exop = (opcode >> 1) & 0x3ff; - uint32 ra = (opcode >> 16) & 0x1f; - uint32 rb = (opcode >> 11) & 0x1f; - uint32 rd = (opcode >> 21) & 0x1f; - uint32 imm = opcode & 0xffff; - - // Fault in Mac ROM or RAM? - bool mac_fault = (r->pc >= ROMBase) && (r->pc < (ROMBase + ROM_AREA_SIZE)) || (r->pc >= RAMBase) && (r->pc < (RAMBase + RAMSize)); - if (mac_fault) { - - // "VM settings" during MacOS 8 installation - if (r->pc == ROMBase + 0x488160 && segv_r[20] == 0xf8000000) { - r->pc += 4; - segv_r[8] = 0; - goto rti; - - // MacOS 8.5 installation - } else if (r->pc == ROMBase + 0x488140 && segv_r[16] == 0xf8000000) { - r->pc += 4; - segv_r[8] = 0; - goto rti; - - // MacOS 8 serial drivers on startup - } else if (r->pc == ROMBase + 0x48e080 && (segv_r[8] == 0xf3012002 || segv_r[8] == 0xf3012000)) { - r->pc += 4; - segv_r[8] = 0; - goto rti; - - // MacOS 8.1 serial drivers on startup - } else if (r->pc == ROMBase + 0x48c5e0 && (segv_r[20] == 0xf3012002 || segv_r[20] == 0xf3012000)) { - r->pc += 4; - goto rti; - } else if (r->pc == ROMBase + 0x4a10a0 && (segv_r[20] == 0xf3012002 || segv_r[20] == 0xf3012000)) { - r->pc += 4; - goto rti; - } - } - - // Analyze opcode - enum { - TYPE_UNKNOWN, - TYPE_LOAD, - TYPE_STORE - } transfer_type = TYPE_UNKNOWN; - enum { - SIZE_UNKNOWN, - SIZE_BYTE, - SIZE_HALFWORD, - SIZE_WORD - } transfer_size = SIZE_UNKNOWN; - enum { - MODE_UNKNOWN, - MODE_NORM, - MODE_U, - MODE_X, - MODE_UX - } addr_mode = MODE_UNKNOWN; - switch (primop) { - case 31: - switch (exop) { - case 23: // lwzx - transfer_type = TYPE_LOAD; transfer_size = SIZE_WORD; addr_mode = MODE_X; break; - case 55: // lwzux - transfer_type = TYPE_LOAD; transfer_size = SIZE_WORD; addr_mode = MODE_UX; break; - case 87: // lbzx - transfer_type = TYPE_LOAD; transfer_size = SIZE_BYTE; addr_mode = MODE_X; break; - case 119: // lbzux - transfer_type = TYPE_LOAD; transfer_size = SIZE_BYTE; addr_mode = MODE_UX; break; - case 151: // stwx - transfer_type = TYPE_STORE; transfer_size = SIZE_WORD; addr_mode = MODE_X; break; - case 183: // stwux - transfer_type = TYPE_STORE; transfer_size = SIZE_WORD; addr_mode = MODE_UX; break; - case 215: // stbx - transfer_type = TYPE_STORE; transfer_size = SIZE_BYTE; addr_mode = MODE_X; break; - case 247: // stbux - transfer_type = TYPE_STORE; transfer_size = SIZE_BYTE; addr_mode = MODE_UX; break; - case 279: // lhzx - transfer_type = TYPE_LOAD; transfer_size = SIZE_HALFWORD; addr_mode = MODE_X; break; - case 311: // lhzux - transfer_type = TYPE_LOAD; transfer_size = SIZE_HALFWORD; addr_mode = MODE_UX; break; - case 343: // lhax - transfer_type = TYPE_LOAD; transfer_size = SIZE_HALFWORD; addr_mode = MODE_X; break; - case 375: // lhaux - transfer_type = TYPE_LOAD; transfer_size = SIZE_HALFWORD; addr_mode = MODE_UX; break; - case 407: // sthx - transfer_type = TYPE_STORE; transfer_size = SIZE_HALFWORD; addr_mode = MODE_X; break; - case 439: // sthux - transfer_type = TYPE_STORE; transfer_size = SIZE_HALFWORD; addr_mode = MODE_UX; break; - } - break; - - case 32: // lwz - transfer_type = TYPE_LOAD; transfer_size = SIZE_WORD; addr_mode = MODE_NORM; break; - case 33: // lwzu - transfer_type = TYPE_LOAD; transfer_size = SIZE_WORD; addr_mode = MODE_U; break; - case 34: // lbz - transfer_type = TYPE_LOAD; transfer_size = SIZE_BYTE; addr_mode = MODE_NORM; break; - case 35: // lbzu - transfer_type = TYPE_LOAD; transfer_size = SIZE_BYTE; addr_mode = MODE_U; break; - case 36: // stw - transfer_type = TYPE_STORE; transfer_size = SIZE_WORD; addr_mode = MODE_NORM; break; - case 37: // stwu - transfer_type = TYPE_STORE; transfer_size = SIZE_WORD; addr_mode = MODE_U; break; - case 38: // stb - transfer_type = TYPE_STORE; transfer_size = SIZE_BYTE; addr_mode = MODE_NORM; break; - case 39: // stbu - transfer_type = TYPE_STORE; transfer_size = SIZE_BYTE; addr_mode = MODE_U; break; - case 40: // lhz - transfer_type = TYPE_LOAD; transfer_size = SIZE_HALFWORD; addr_mode = MODE_NORM; break; - case 41: // lhzu - transfer_type = TYPE_LOAD; transfer_size = SIZE_HALFWORD; addr_mode = MODE_U; break; - case 42: // lha - transfer_type = TYPE_LOAD; transfer_size = SIZE_HALFWORD; addr_mode = MODE_NORM; break; - case 43: // lhau - transfer_type = TYPE_LOAD; transfer_size = SIZE_HALFWORD; addr_mode = MODE_U; break; - case 44: // sth - transfer_type = TYPE_STORE; transfer_size = SIZE_HALFWORD; addr_mode = MODE_NORM; break; - case 45: // sthu - transfer_type = TYPE_STORE; transfer_size = SIZE_HALFWORD; addr_mode = MODE_U; break; - } - - // Calculate effective address - uint32 addr = 0; - switch (addr_mode) { - case MODE_X: - case MODE_UX: - if (ra == 0) - addr = segv_r[rb]; - else - addr = segv_r[ra] + segv_r[rb]; - break; - case MODE_NORM: - case MODE_U: - if (ra == 0) - addr = (int32)(int16)imm; - else - addr = segv_r[ra] + (int32)(int16)imm; - break; - default: - break; - } - - // Ignore ROM writes - if (transfer_type == TYPE_STORE && addr >= ROMBase && addr < ROMBase + ROM_SIZE) { - D(bug("WARNING: %s write access to ROM at %p, pc %p\n", transfer_size == SIZE_BYTE ? "Byte" : transfer_size == SIZE_HALFWORD ? "Halfword" : "Word", addr, r->pc)); - if (addr_mode == MODE_U || addr_mode == MODE_UX) - segv_r[ra] = addr; - r->pc += 4; - goto rti; - } - - // Fault in Mac ROM or RAM? - if (mac_fault) { - - // Ignore illegal memory accesses? - if (PrefsFindBool("ignoresegv")) { - if (addr_mode == MODE_U || addr_mode == MODE_UX) - segv_r[ra] = addr; - if (transfer_type == TYPE_LOAD) - segv_r[rd] = 0; - r->pc += 4; - goto rti; - } - - // In GUI mode, show error alert - if (!PrefsFindBool("nogui")) { - if (transfer_type == TYPE_LOAD || transfer_type == TYPE_STORE) - sprintf(str, GetString(STR_MEM_ACCESS_ERR), transfer_size == SIZE_BYTE ? "byte" : transfer_size == SIZE_HALFWORD ? "halfword" : "word", transfer_type == TYPE_LOAD ? GetString(STR_MEM_ACCESS_READ) : GetString(STR_MEM_ACCESS_WRITE), addr, r->pc, segv_r[24], segv_r[1]); - else - sprintf(str, GetString(STR_UNKNOWN_SEGV_ERR), r->pc, segv_r[24], segv_r[1], opcode); - ErrorAlert(str); - QuitEmulator(); - return; - } - } - - // For all other errors, jump into debugger - sprintf(str, "SIGSEGV\n" - " pc %08lx lr %08lx ctr %08lx msr %08lx\n" - " xer %08lx cr %08lx fpscr %08lx\n" - " r0 %08lx r1 %08lx r2 %08lx r3 %08lx\n" - " r4 %08lx r5 %08lx r6 %08lx r7 %08lx\n" - " r8 %08lx r9 %08lx r10 %08lx r11 %08lx\n" - " r12 %08lx r13 %08lx r14 %08lx r15 %08lx\n" - " r16 %08lx r17 %08lx r18 %08lx r19 %08lx\n" - " r20 %08lx r21 %08lx r22 %08lx r23 %08lx\n" - " r24 %08lx r25 %08lx r26 %08lx r27 %08lx\n" - " r28 %08lx r29 %08lx r30 %08lx r31 %08lx\n", - r->pc, r->lr, r->ctr, r->msr, - r->xer, r->cr, r->fpscr, - r->r0, r->r1, r->r2, r->r3, - r->r4, r->r5, r->r6, r->r7, - r->r8, r->r9, r->r10, r->r11, - r->r12, segv_r[13], segv_r[14], segv_r[15], - segv_r[16], segv_r[17], segv_r[18], segv_r[19], - segv_r[20], segv_r[21], segv_r[22], segv_r[23], - segv_r[24], segv_r[25], segv_r[26], segv_r[27], - segv_r[28], segv_r[29], segv_r[30], segv_r[31]); - VideoQuitFullScreen(); - disable_debugger(false); - debugger(str); - exit(1); - return; - -rti: - // Restore volatile registers - r->r0 = segv_r[0]; - r->r1 = segv_r[1]; - r->r2 = segv_r[2]; - r->r3 = segv_r[3]; - r->r4 = segv_r[4]; - r->r5 = segv_r[5]; - r->r6 = segv_r[6]; - r->r7 = segv_r[7]; - r->r8 = segv_r[8]; - r->r9 = segv_r[9]; - r->r10 = segv_r[10]; - r->r11 = segv_r[11]; - r->r12 = segv_r[12]; -} - - -/* - * SIGILL handler - */ - -#if !EMULATED_PPC -asm void SheepShaver::sigill_invoc(register int sig, register void *arg, register vregs *r) -{ - mflr r0 - stw r0,8(r1) - stwu r1,-56(r1) - - lwz r3,segv_r(r2) - stmw r13,13*4(r3) - - mr r3,r5 - bl sigill_handler - - lwz r3,segv_r(r2) - lmw r13,13*4(r3) - - lwz r0,56+8(r1) - mtlr r0 - addi r1,r1,56 - blr -} -#endif - -static void sigill_handler(vregs *r) -{ - char str[256]; - - // Fetch volatile registers - segv_r[0] = r->r0; - segv_r[1] = r->r1; - segv_r[2] = r->r2; - segv_r[3] = r->r3; - segv_r[4] = r->r4; - segv_r[5] = r->r5; - segv_r[6] = r->r6; - segv_r[7] = r->r7; - segv_r[8] = r->r8; - segv_r[9] = r->r9; - segv_r[10] = r->r10; - segv_r[11] = r->r11; - segv_r[12] = r->r12; - - // Get opcode and divide into fields - uint32 opcode = *(uint32 *)r->pc; - uint32 primop = opcode >> 26; - uint32 exop = (opcode >> 1) & 0x3ff; - uint32 ra = (opcode >> 16) & 0x1f; - uint32 rb = (opcode >> 11) & 0x1f; - uint32 rd = (opcode >> 21) & 0x1f; - uint32 imm = opcode & 0xffff; - - // Fault in Mac ROM or RAM? - bool mac_fault = (r->pc >= ROMBase) && (r->pc < (ROMBase + ROM_AREA_SIZE)) || (r->pc >= RAMBase) && (r->pc < (RAMBase + RAMSize)); - if (mac_fault) { - - switch (primop) { - case 9: // POWER instructions - case 22: -power_inst: sprintf(str, GetString(STR_POWER_INSTRUCTION_ERR), r->pc, segv_r[1], opcode); - ErrorAlert(str); - QuitEmulator(); - return; - - case 31: - switch (exop) { - case 83: // mfmsr - segv_r[rd] = 0xf072; - r->pc += 4; - goto rti; - - case 210: // mtsr - case 242: // mtsrin - case 306: // tlbie - r->pc += 4; - goto rti; - - case 339: { // mfspr - int spr = ra | (rb << 5); - switch (spr) { - case 0: // MQ - case 22: // DEC - case 952: // MMCR0 - case 953: // PMC1 - case 954: // PMC2 - case 955: // SIA - case 956: // MMCR1 - case 957: // PMC3 - case 958: // PMC4 - case 959: // SDA - r->pc += 4; - goto rti; - case 25: // SDR1 - segv_r[rd] = 0xdead001f; - r->pc += 4; - goto rti; - case 287: // PVR - segv_r[rd] = PVR; - r->pc += 4; - goto rti; - } - break; - } - - case 467: { // mtspr - int spr = ra | (rb << 5); - switch (spr) { - case 0: // MQ - case 22: // DEC - case 275: // SPRG3 - case 528: // IBAT0U - case 529: // IBAT0L - case 530: // IBAT1U - case 531: // IBAT1L - case 532: // IBAT2U - case 533: // IBAT2L - case 534: // IBAT3U - case 535: // IBAT3L - case 536: // DBAT0U - case 537: // DBAT0L - case 538: // DBAT1U - case 539: // DBAT1L - case 540: // DBAT2U - case 541: // DBAT2L - case 542: // DBAT3U - case 543: // DBAT3L - case 952: // MMCR0 - case 953: // PMC1 - case 954: // PMC2 - case 955: // SIA - case 956: // MMCR1 - case 957: // PMC3 - case 958: // PMC4 - case 959: // SDA - r->pc += 4; - goto rti; - } - break; - } - - case 29: case 107: case 152: case 153: // POWER instructions - case 184: case 216: case 217: case 248: - case 264: case 277: case 331: case 360: - case 363: case 488: case 531: case 537: - case 541: case 664: case 665: case 696: - case 728: case 729: case 760: case 920: - case 921: case 952: - goto power_inst; - } - } - - // In GUI mode, show error alert - if (!PrefsFindBool("nogui")) { - sprintf(str, GetString(STR_UNKNOWN_SEGV_ERR), r->pc, segv_r[24], segv_r[1], opcode); - ErrorAlert(str); - QuitEmulator(); - return; - } - } - - // For all other errors, jump into debugger - sprintf(str, "SIGILL\n" - " pc %08lx lr %08lx ctr %08lx msr %08lx\n" - " xer %08lx cr %08lx fpscr %08lx\n" - " r0 %08lx r1 %08lx r2 %08lx r3 %08lx\n" - " r4 %08lx r5 %08lx r6 %08lx r7 %08lx\n" - " r8 %08lx r9 %08lx r10 %08lx r11 %08lx\n" - " r12 %08lx r13 %08lx r14 %08lx r15 %08lx\n" - " r16 %08lx r17 %08lx r18 %08lx r19 %08lx\n" - " r20 %08lx r21 %08lx r22 %08lx r23 %08lx\n" - " r24 %08lx r25 %08lx r26 %08lx r27 %08lx\n" - " r28 %08lx r29 %08lx r30 %08lx r31 %08lx\n", - r->pc, r->lr, r->ctr, r->msr, - r->xer, r->cr, r->fpscr, - r->r0, r->r1, r->r2, r->r3, - r->r4, r->r5, r->r6, r->r7, - r->r8, r->r9, r->r10, r->r11, - r->r12, segv_r[13], segv_r[14], segv_r[15], - segv_r[16], segv_r[17], segv_r[18], segv_r[19], - segv_r[20], segv_r[21], segv_r[22], segv_r[23], - segv_r[24], segv_r[25], segv_r[26], segv_r[27], - segv_r[28], segv_r[29], segv_r[30], segv_r[31]); - VideoQuitFullScreen(); - disable_debugger(false); - debugger(str); - exit(1); - return; - -rti: - // Restore volatile registers - r->r0 = segv_r[0]; - r->r1 = segv_r[1]; - r->r2 = segv_r[2]; - r->r3 = segv_r[3]; - r->r4 = segv_r[4]; - r->r5 = segv_r[5]; - r->r6 = segv_r[6]; - r->r7 = segv_r[7]; - r->r8 = segv_r[8]; - r->r9 = segv_r[9]; - r->r10 = segv_r[10]; - r->r11 = segv_r[11]; - r->r12 = segv_r[12]; -} - - -/* - * Helpers to share 32-bit addressable data with MacOS - */ - -bool SheepMem::Init(void) -{ - // Delete old area - area_id old_sheep_area = find_area(SHEEP_AREA_NAME); - if (old_sheep_area > 0) - delete_area(old_sheep_area); - - // Create area for SheepShaver data - proc = base = 0x60000000; - SheepMemArea = create_area(SHEEP_AREA_NAME, (void **)&base, B_BASE_ADDRESS, size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); - if (SheepMemArea < 0) - return false; - - // Create read-only area with all bits set to 0 - static const uint8 const_zero_page[4096] = {0,}; - zero_page = const_zero_page; - - D(bug("SheepShaver area %ld at %p\n", SheepMemArea, base)); - data = base + size; - return true; -} - -void SheepMem::Exit(void) -{ - if (SheepMemArea >= 0) - delete_area(SheepMemArea); -} - - -/* - * Display error alert - */ - -void ErrorAlert(const char *text) -{ - if (PrefsFindBool("nogui")) { - printf(GetString(STR_SHELL_ERROR_PREFIX), text); - return; - } - char str[256]; - sprintf(str, GetString(STR_GUI_ERROR_PREFIX), text); - VideoQuitFullScreen(); - BAlert *alert = new BAlert(GetString(STR_ERROR_ALERT_TITLE), str, GetString(STR_QUIT_BUTTON), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); - alert->Go(); -} - - -/* - * Display warning alert - */ - -void WarningAlert(const char *text) -{ - if (PrefsFindBool("nogui")) { - printf(GetString(STR_SHELL_WARNING_PREFIX), text); - return; - } - char str[256]; - sprintf(str, GetString(STR_GUI_WARNING_PREFIX), text); - BAlert *alert = new BAlert(GetString(STR_WARNING_ALERT_TITLE), str, GetString(STR_OK_BUTTON), NULL, NULL, B_WIDTH_AS_USUAL, B_INFO_ALERT); - alert->Go(); -} - - -/* - * Display choice alert - */ - -bool ChoiceAlert(const char *text, const char *pos, const char *neg) -{ - char str[256]; - sprintf(str, GetString(STR_GUI_WARNING_PREFIX), text); - BAlert *alert = new BAlert(GetString(STR_WARNING_ALERT_TITLE), str, pos, neg, NULL, B_WIDTH_AS_USUAL, B_INFO_ALERT); - return alert->Go() == 0; -} diff --git a/SheepShaver/src/BeOS/prefs_beos.cpp b/SheepShaver/src/BeOS/prefs_beos.cpp deleted file mode 100644 index cad4a888..00000000 --- a/SheepShaver/src/BeOS/prefs_beos.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * prefs_beos.cpp - Preferences handling, BeOS specific things - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include -#include -#include - -#include "sysdeps.h" -#include "prefs.h" -#include "main.h" - - -// Platform-specific preferences items -prefs_desc platform_prefs_items[] = { - {"bitbang", TYPE_BOOLEAN, false, "draw Mac desktop directly on screen in window mode"}, - {"idlewait", TYPE_BOOLEAN, false, "sleep when idle"}, - {NULL, TYPE_END, false, NULL} // End of list -}; - - -// Preferences file name and path -const char PREFS_FILE_NAME[] = "SheepShaver_prefs"; -static BPath prefs_path; - -// Modification date of prefs file -time_t PrefsFileDate = 0; - - -/* - * Load preferences from settings file - */ - -void LoadPrefs(const char *vmdir) -{ - // Construct prefs path - find_directory(B_USER_SETTINGS_DIRECTORY, &prefs_path, true); - prefs_path.Append(PREFS_FILE_NAME); - - // Read preferences from settings file - FILE *f = fopen(prefs_path.Path(), "r"); - if (f == NULL) // Not found in settings directory, look in app directory - f = fopen(PREFS_FILE_NAME, "r"); - if (f != NULL) { - LoadPrefsFromStream(f); - - struct stat s; - fstat(fileno(f), &s); - PrefsFileDate = s.st_ctime; - fclose(f); - - } else { - - // No prefs file, save defaults - SavePrefs(); - PrefsFileDate = real_time_clock(); - } -} - - -/* - * Save preferences to settings file - */ - -void SavePrefs(void) -{ - FILE *f; - if ((f = fopen(prefs_path.Path(), "w")) != NULL) { - SavePrefsToStream(f); - fclose(f); - } -} - - -/* - * Add defaults of platform-specific prefs items - * You may also override the defaults set in PrefsInit() - */ - -void AddPlatformPrefsDefaults(void) -{ - PrefsReplaceString("extfs", "/boot"); - PrefsAddInt32("windowmodes", - B_8_BIT_640x480 | B_15_BIT_640x480 | B_32_BIT_640x480 | - B_8_BIT_800x600 | B_15_BIT_800x600 | B_32_BIT_800x600 - ); - PrefsAddInt32("screenmodes", - B_8_BIT_640x480 | B_15_BIT_640x480 | B_32_BIT_640x480 | - B_8_BIT_800x600 | B_15_BIT_800x600 | B_32_BIT_800x600 | - B_8_BIT_1024x768 | B_15_BIT_1024x768 - ); - PrefsAddBool("bitbang", false); - PrefsAddBool("idlewait", true); -} diff --git a/SheepShaver/src/BeOS/prefs_editor_beos.cpp b/SheepShaver/src/BeOS/prefs_editor_beos.cpp deleted file mode 100644 index 847700c2..00000000 --- a/SheepShaver/src/BeOS/prefs_editor_beos.cpp +++ /dev/null @@ -1,877 +0,0 @@ -/* - * prefs_editor_beos.cpp - Preferences editor, BeOS implementation - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include -#include -#include -#include - -#include "prefs_editor.h" -#include "prefs.h" -#include "main.h" -#include "cdrom.h" -#include "xpram.h" -#include "about_window.h" -#include "user_strings.h" - - -// Special colors -const rgb_color fill_color = {216, 216, 216, 0}; -const rgb_color slider_fill_color = {102, 152, 255, 0}; - - -// Window messages -const uint32 MSG_OK = 'okok'; // "Start" clicked -const uint32 MSG_CANCEL = 'cncl'; // "Quit" clicked -const uint32 MSG_ZAP_PRAM = 'zprm'; - -const int NUM_PANES = 4; - -const uint32 MSG_VOLUME_SELECTED = 'volu'; // "Volumes" pane -const uint32 MSG_VOLUME_INVOKED = 'voli'; -const uint32 MSG_ADD_VOLUME = 'addv'; -const uint32 MSG_CREATE_VOLUME = 'crev'; -const uint32 MSG_REMOVE_VOLUME = 'remv'; -const uint32 MSG_ADD_VOLUME_PANEL = 'advp'; -const uint32 MSG_CREATE_VOLUME_PANEL = 'crvp'; -const uint32 MSG_DEVICE_NAME = 'devn'; -const uint32 MSG_BOOT_ANY = 'bany'; -const uint32 MSG_BOOT_CDROM = 'bcdr'; -const uint32 MSG_NOCDROM = 'nocd'; - -const uint32 MSG_REF_5HZ = ' 5Hz'; // "Graphics" pane -const uint32 MSG_REF_7_5HZ = ' 7Hz'; -const uint32 MSG_REF_10HZ = '10Hz'; -const uint32 MSG_REF_15HZ = '15Hz'; -const uint32 MSG_REF_30HZ = '30Hz'; -const uint32 MSG_GFXACCEL = 'gfac'; -const uint32 MSG_WINDOW_MODE = 'wmod'; -const uint32 MSG_SCREEN_MODE = 'smod'; -const uint32 MSG_NOSOUND = 'nosn'; - -const uint32 MSG_SER_A = 'sera'; // "Serial"/"Network" pane -const uint32 MSG_SER_B = 'serb'; -const uint32 MSG_NONET = 'noet'; - -const uint32 MSG_RAMSIZE = 'rmsz'; // "Memory" pane -const uint32 MSG_IGNORESEGV = 'isgv'; -const uint32 MSG_IDLEWAIT = 'idlw'; - - -// RAM size slider class -class RAMSlider : public BSlider { -public: - RAMSlider(BRect frame, const char *name, const char *label, BMessage *message, - int32 minValue, int32 maxValue, thumb_style thumbType = B_BLOCK_THUMB, - uint32 resizingMode = B_FOLLOW_LEFT | - B_FOLLOW_TOP, - uint32 flags = B_NAVIGABLE | B_WILL_DRAW | - B_FRAME_EVENTS) : BSlider(frame, name, label, message, minValue, maxValue, thumbType, resizingMode, flags) - { - update_text = (char *)malloc(256); - } - - virtual ~RAMSlider() - { - if (update_text) - free(update_text); - } - - virtual char *UpdateText(void) const - { - if (update_text) { - sprintf(update_text, GetString(STR_RAMSIZE_FMT), Value()); - } - return update_text; - } - -private: - char *update_text; -}; - - -// Volumes list view class -class VolumeListView : public BListView { -public: - VolumeListView(BRect frame, const char *name, list_view_type type = B_SINGLE_SELECTION_LIST, uint32 resizeMask = B_FOLLOW_LEFT | B_FOLLOW_TOP, uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE) - : BListView(frame, name, type, resizeMask, flags) - {} - - // Handle dropped files and volumes - virtual void MessageReceived(BMessage *msg) - { - if (msg->what == B_SIMPLE_DATA) { - BMessage msg2(MSG_ADD_VOLUME_PANEL); - entry_ref ref; - for (int i=0; msg->FindRef("refs", i, &ref) == B_NO_ERROR; i++) - msg2.AddRef("refs", &ref); - Window()->PostMessage(&msg2); - } else - BListView::MessageReceived(msg); - } -}; - - -// Number-entry BTextControl -class NumberControl : public BTextControl { -public: - NumberControl(BRect frame, float divider, const char *name, const char *label, long value, BMessage *message) - : BTextControl(frame, name, label, NULL, message, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE) - { - SetDivider(divider); - for (int c=0; c<256; c++) - if (!isdigit(c) && c != B_BACKSPACE && c != B_LEFT_ARROW && c != B_RIGHT_ARROW) - ((BTextView *)ChildAt(0))->DisallowChar(c); - SetValue(value); - } - - // Set integer value - void SetValue(long value) - { - char str[32]; - sprintf(str, "%ld", value); - SetText(str); - } - - // Get integer value - long Value(void) - { - return atol(Text()); - } -}; - - -// Path-entry BTextControl -class PathControl : public BTextControl { -public: - PathControl(bool dir_ctrl_, BRect frame, const char *name, const char *label, const char *text, BMessage *message) : BTextControl(frame, name, label, text, message), dir_ctrl(dir_ctrl_) - { - for (int c=0; c<' '; c++) - if (c != B_BACKSPACE && c != B_LEFT_ARROW && c != B_RIGHT_ARROW) - ((BTextView *)ChildAt(0))->DisallowChar(c); - } - - virtual void MessageReceived(BMessage *msg) - { - if (msg->what == B_SIMPLE_DATA) { - entry_ref the_ref; - BEntry the_entry; - - // Look for dropped refs - if (msg->FindRef("refs", &the_ref) == B_NO_ERROR) { - if (the_entry.SetTo(&the_ref) == B_NO_ERROR && (dir_ctrl&& the_entry.IsDirectory() || !dir_ctrl && the_entry.IsFile())) { - BPath the_path; - the_entry.GetPath(&the_path); - SetText(the_path.Path()); - } - } else - BTextControl::MessageReceived(msg); - - MakeFocus(); - } else - BTextControl::MessageReceived(msg); - } - -private: - bool dir_ctrl; -}; - - -// Preferences window class -class PrefsWindow : public BWindow { -public: - PrefsWindow(uint32 msg); - virtual ~PrefsWindow(); - virtual void MessageReceived(BMessage *msg); - -private: - BView *create_volumes_pane(void); - BView *create_graphics_pane(void); - BView *create_serial_pane(void); - BView *create_memory_pane(void); - - uint32 ok_message; - bool send_quit_on_close; - - BMessenger this_messenger; - BView *top; - BRect top_frame; - BTabView *pane_tabs; - BView *panes[NUM_PANES]; - int current_pane; - - VolumeListView *volume_list; - BCheckBox *nocdrom_checkbox; - BCheckBox *gfxaccel_checkbox; - BCheckBox *nosound_checkbox; - BCheckBox *nonet_checkbox; - BCheckBox *ignoresegv_checkbox; - BCheckBox *idlewait_checkbox; - RAMSlider *ramsize_slider; - PathControl *extfs_control; - PathControl *rom_control; - - BFilePanel *add_volume_panel; - BFilePanel *create_volume_panel; - - uint32 max_ramsize; // In MB -}; - - -/* - * Show preferences editor - * When the user clicks on "OK", the message given as parameter is sent - * to the application; if he clicks on "Quit", B_QUIT_REQUESTED is sent - */ - -void PrefsEditor(uint32 msg) -{ - new PrefsWindow(msg); -} - - -/* - * Preferences window constructor - */ - -PrefsWindow::PrefsWindow(uint32 msg) : BWindow(BRect(0, 0, 400, 289), GetString(STR_PREFS_TITLE), B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS), this_messenger(this) -{ - int i; - ok_message = msg; - send_quit_on_close = true; - - // Move window to right position - Lock(); - MoveTo(80, 80); - - // Set up menus - BMenuBar *bar = new BMenuBar(Bounds(), "menu"); - BMenu *menu = new BMenu(GetString(STR_PREFS_MENU)); - menu->AddItem(new BMenuItem(GetString(STR_PREFS_ITEM_ABOUT), new BMessage(B_ABOUT_REQUESTED))); - menu->AddItem(new BSeparatorItem); - menu->AddItem(new BMenuItem(GetString(STR_PREFS_ITEM_START), new BMessage(MSG_OK))); - menu->AddItem(new BMenuItem(GetString(STR_PREFS_ITEM_ZAP_PRAM), new BMessage(MSG_ZAP_PRAM))); - menu->AddItem(new BSeparatorItem); - menu->AddItem(new BMenuItem(GetString(STR_PREFS_ITEM_QUIT), new BMessage(MSG_CANCEL), 'Q')); - bar->AddItem(menu); - AddChild(bar); - SetKeyMenuBar(bar); - int mbar_height = bar->Bounds().bottom + 1; - - // Resize window to fit menu bar - ResizeBy(0, mbar_height); - - // Light gray background - BRect b = Bounds(); - top = new BView(BRect(0, mbar_height, b.right, b.bottom), "top", B_FOLLOW_NONE, B_WILL_DRAW); - AddChild(top); - top->SetViewColor(fill_color); - top_frame = top->Bounds(); - - // Create panes - panes[0] = create_volumes_pane(); - panes[1] = create_graphics_pane(); - panes[2] = create_serial_pane(); - panes[3] = create_memory_pane(); - - // Prefs item tab view - pane_tabs = new BTabView(BRect(10, 10, top_frame.right-10, top_frame.bottom-50), "items", B_WIDTH_FROM_LABEL); - for (i=0; iAddTab(panes[i]); - top->AddChild(pane_tabs); - - volume_list->Select(0); - - // Create volume file panels - add_volume_panel = new BFilePanel(B_OPEN_PANEL, &this_messenger, NULL, B_FILE_NODE | B_DIRECTORY_NODE, false, new BMessage(MSG_ADD_VOLUME_PANEL)); - add_volume_panel->SetButtonLabel(B_DEFAULT_BUTTON, GetString(STR_ADD_VOLUME_PANEL_BUTTON)); - add_volume_panel->Window()->SetTitle(GetString(STR_ADD_VOLUME_TITLE)); - create_volume_panel = new BFilePanel(B_SAVE_PANEL, &this_messenger, NULL, B_FILE_NODE | B_DIRECTORY_NODE, false, new BMessage(MSG_CREATE_VOLUME_PANEL)); - create_volume_panel->SetButtonLabel(B_DEFAULT_BUTTON, GetString(STR_CREATE_VOLUME_PANEL_BUTTON)); - create_volume_panel->Window()->SetTitle(GetString(STR_CREATE_VOLUME_TITLE)); - - create_volume_panel->Window()->Lock(); - BView *background = create_volume_panel->Window()->ChildAt(0); - background->FindView("PoseView")->ResizeBy(0, -30); - background->FindView("VScrollBar")->ResizeBy(0, -30); - background->FindView("CountVw")->MoveBy(0, -30); - BView *v = background->FindView("HScrollBar"); - if (v) - v->MoveBy(0, -30); - else { - i = 0; - while ((v = background->ChildAt(i++)) != NULL) { - if (v->Name() == NULL || v->Name()[0] == 0) { - v->MoveBy(0, -30); // unnamed horizontal scroll bar - break; - } - } - } - BView *filename = background->FindView("text view"); - BRect fnr(filename->Frame()); - fnr.OffsetBy(0, -30); - NumberControl *nc = new NumberControl(fnr, 80, "hardfile_size", GetString(STR_HARDFILE_SIZE_CTRL), 40, NULL); - background->AddChild(nc); - create_volume_panel->Window()->Unlock(); - - // "Start" button - BButton *button = new BButton(BRect(20, top_frame.bottom-35, 90, top_frame.bottom-10), "start", GetString(STR_START_BUTTON), new BMessage(MSG_OK)); - top->AddChild(button); - SetDefaultButton(button); - - // "Quit" button - top->AddChild(new BButton(BRect(top_frame.right-90, top_frame.bottom-35, top_frame.right-20, top_frame.bottom-10), "cancel", GetString(STR_QUIT_BUTTON), new BMessage(MSG_CANCEL))); - - Unlock(); - Show(); -} - - -/* - * Preferences window destructor - */ - -PrefsWindow::~PrefsWindow() -{ - delete add_volume_panel; - if (send_quit_on_close) - be_app->PostMessage(B_QUIT_REQUESTED); -} - - -/* - * Create "Volumes" pane - */ - -BView *PrefsWindow::create_volumes_pane(void) -{ - BView *pane = new BView(BRect(0, 0, top_frame.right-20, top_frame.bottom-80), GetString(STR_VOLUMES_PANE_TITLE), B_FOLLOW_NONE, B_WILL_DRAW); - pane->SetViewColor(fill_color); - float right = pane->Bounds().right-10; - - const char *str; - int32 index = 0; - volume_list = new VolumeListView(BRect(15, 10, pane->Bounds().right-30, 108), "volumes"); - while ((str = PrefsFindString("disk", index++)) != NULL) - volume_list->AddItem(new BStringItem(str)); - volume_list->SetSelectionMessage(new BMessage(MSG_VOLUME_SELECTED)); - volume_list->SetInvocationMessage(new BMessage(MSG_VOLUME_INVOKED)); - pane->AddChild(new BScrollView("volumes_border", volume_list, B_FOLLOW_LEFT | B_FOLLOW_TOP, 0, false, true)); - - pane->AddChild(new BButton(BRect(10, 113, pane->Bounds().right/3, 133), "add_volume", GetString(STR_ADD_VOLUME_BUTTON), new BMessage(MSG_ADD_VOLUME))); - pane->AddChild(new BButton(BRect(pane->Bounds().right/3, 113, pane->Bounds().right*2/3, 133), "create_volume", GetString(STR_CREATE_VOLUME_BUTTON), new BMessage(MSG_CREATE_VOLUME))); - pane->AddChild(new BButton(BRect(pane->Bounds().right*2/3, 113, pane->Bounds().right-11, 133), "remove_volume", GetString(STR_REMOVE_VOLUME_BUTTON), new BMessage(MSG_REMOVE_VOLUME))); - - extfs_control = new PathControl(true, BRect(10, 145, right, 160), "extfs", GetString(STR_EXTFS_CTRL), PrefsFindString("extfs"), NULL); - extfs_control->SetDivider(90); - pane->AddChild(extfs_control); - - BMenuField *menu_field; - BPopUpMenu *menu = new BPopUpMenu(""); - menu_field = new BMenuField(BRect(10, 165, right, 180), "bootdriver", GetString(STR_BOOTDRIVER_CTRL), menu); - menu_field->SetDivider(90); - menu->AddItem(new BMenuItem(GetString(STR_BOOT_ANY_LAB), new BMessage(MSG_BOOT_ANY))); - menu->AddItem(new BMenuItem(GetString(STR_BOOT_CDROM_LAB), new BMessage(MSG_BOOT_CDROM))); - pane->AddChild(menu_field); - int16 i16 = PrefsFindInt32("bootdriver"); - BMenuItem *item; - if (i16 == 0) { - if ((item = menu->FindItem(GetString(STR_BOOT_ANY_LAB))) != NULL) - item->SetMarked(true); - } else if (i16 == CDROMRefNum) { - if ((item = menu->FindItem(GetString(STR_BOOT_CDROM_LAB))) != NULL) - item->SetMarked(true); - } - - nocdrom_checkbox = new BCheckBox(BRect(10, 185, right, 200), "nocdrom", GetString(STR_NOCDROM_CTRL), new BMessage(MSG_NOCDROM)); - pane->AddChild(nocdrom_checkbox); - nocdrom_checkbox->SetValue(PrefsFindBool("nocdrom") ? B_CONTROL_ON : B_CONTROL_OFF); - - return pane; -} - - -/* - * Create "Graphics/Sound" pane - */ - -struct video_mode_box { - uint32 mode; - int mode_string_id, bit_string_id; - float left, top; - BCheckBox *box; -}; - -const int NUM_WINDOW_MODES = 6; -const int NUM_SCREEN_MODES = 18; - -static video_mode_box window_mode_boxes[NUM_SCREEN_MODES] = { - {B_8_BIT_640x480, STR_W_640x480_CTRL, STR_8_BIT_CTRL, 140, 48, NULL}, - {B_15_BIT_640x480, STR_W_640x480_CTRL, STR_16_BIT_CTRL, 220, 48, NULL}, - {B_32_BIT_640x480, STR_W_640x480_CTRL, STR_32_BIT_CTRL, 300, 48, NULL}, - {B_8_BIT_800x600, STR_W_800x600_CTRL, STR_8_BIT_CTRL, 140, 65, NULL}, - {B_15_BIT_800x600, STR_W_800x600_CTRL, STR_16_BIT_CTRL, 220, 65, NULL}, - {B_32_BIT_800x600, STR_W_800x600_CTRL, STR_32_BIT_CTRL, 300, 65, NULL}, -}; - -static video_mode_box screen_mode_boxes[NUM_SCREEN_MODES] = { - {B_8_BIT_640x480, STR_640x480_CTRL, STR_8_BIT_CTRL, 140, 82, NULL}, - {B_15_BIT_640x480, STR_640x480_CTRL, STR_16_BIT_CTRL, 220, 82, NULL}, - {B_32_BIT_640x480, STR_640x480_CTRL, STR_32_BIT_CTRL, 300, 82, NULL}, - {B_8_BIT_800x600, STR_800x600_CTRL, STR_8_BIT_CTRL, 140, 99, NULL}, - {B_15_BIT_800x600, STR_800x600_CTRL, STR_16_BIT_CTRL, 220, 99, NULL}, - {B_32_BIT_800x600, STR_800x600_CTRL, STR_32_BIT_CTRL, 300, 99, NULL}, - {B_8_BIT_1024x768, STR_1024x768_CTRL, STR_8_BIT_CTRL, 140, 116, NULL}, - {B_15_BIT_1024x768, STR_1024x768_CTRL, STR_16_BIT_CTRL, 220, 116, NULL}, - {B_32_BIT_1024x768, STR_1024x768_CTRL, STR_32_BIT_CTRL, 300, 116, NULL}, - {B_8_BIT_1152x900, STR_1152x900_CTRL, STR_8_BIT_CTRL, 140, 133, NULL}, - {B_15_BIT_1152x900, STR_1152x900_CTRL, STR_16_BIT_CTRL, 220, 133, NULL}, - {B_32_BIT_1152x900, STR_1152x900_CTRL, STR_32_BIT_CTRL, 300, 133, NULL}, - {B_8_BIT_1280x1024, STR_1280x1024_CTRL, STR_8_BIT_CTRL, 140, 150, NULL}, - {B_15_BIT_1280x1024, STR_1280x1024_CTRL, STR_16_BIT_CTRL, 220, 150, NULL}, - {B_32_BIT_1280x1024, STR_1280x1024_CTRL, STR_32_BIT_CTRL, 300, 150, NULL}, - {B_8_BIT_1600x1200, STR_1600x1200_CTRL, STR_8_BIT_CTRL, 140, 167, NULL}, - {B_15_BIT_1600x1200, STR_1600x1200_CTRL, STR_16_BIT_CTRL, 220, 167, NULL}, - {B_32_BIT_1600x1200, STR_1600x1200_CTRL, STR_32_BIT_CTRL, 300, 167, NULL} -}; - -BView *PrefsWindow::create_graphics_pane(void) -{ - BView *pane = new BView(BRect(0, 0, top_frame.right-20, top_frame.bottom-80), GetString(STR_GRAPHICS_SOUND_PANE_TITLE), B_FOLLOW_NONE, B_WILL_DRAW); - pane->SetViewColor(fill_color); - float right = pane->Bounds().right-10; - - BMenuField *menu_field; - BPopUpMenu *menu = new BPopUpMenu(""); - menu_field = new BMenuField(BRect(10, 5, right, 20), "frameskip", GetString(STR_FRAMESKIP_CTRL), menu); - menu_field->SetDivider(120); - menu->AddItem(new BMenuItem(GetString(STR_REF_5HZ_LAB), new BMessage(MSG_REF_5HZ))); - menu->AddItem(new BMenuItem(GetString(STR_REF_7_5HZ_LAB), new BMessage(MSG_REF_7_5HZ))); - menu->AddItem(new BMenuItem(GetString(STR_REF_10HZ_LAB), new BMessage(MSG_REF_10HZ))); - menu->AddItem(new BMenuItem(GetString(STR_REF_15HZ_LAB), new BMessage(MSG_REF_15HZ))); - menu->AddItem(new BMenuItem(GetString(STR_REF_30HZ_LAB), new BMessage(MSG_REF_30HZ))); - pane->AddChild(menu_field); - int32 i32 = PrefsFindInt32("frameskip"); - BMenuItem *item; - if (i32 == 12) { - if ((item = menu->FindItem(GetString(STR_REF_5HZ_LAB))) != NULL) - item->SetMarked(true); - } else if (i32 == 8) { - if ((item = menu->FindItem(GetString(STR_REF_7_5HZ_LAB))) != NULL) - item->SetMarked(true); - } else if (i32 == 6) { - if ((item = menu->FindItem(GetString(STR_REF_10HZ_LAB))) != NULL) - item->SetMarked(true); - } else if (i32 == 4) { - if ((item = menu->FindItem(GetString(STR_REF_15HZ_LAB))) != NULL) - item->SetMarked(true); - } else if (i32 == 2) { - if ((item = menu->FindItem(GetString(STR_REF_30HZ_LAB))) != NULL) - item->SetMarked(true); - } - - gfxaccel_checkbox = new BCheckBox(BRect(10, 25, right, 40), "gfxaccel", GetString(STR_GFXACCEL_CTRL), new BMessage(MSG_GFXACCEL)); - pane->AddChild(gfxaccel_checkbox); - gfxaccel_checkbox->SetValue(PrefsFindBool("gfxaccel") ? B_CONTROL_ON : B_CONTROL_OFF); - - uint32 window_modes = PrefsFindInt32("windowmodes"); - for (int i=0; ibit_string_id == STR_8_BIT_CTRL) { - BStringView *text = new BStringView(BRect(10, p->top, 120, p->top + 15), "", GetString(p->mode_string_id)); - pane->AddChild(text); - } - p->box = new BCheckBox(BRect(p->left, p->top, p->left + 80, p->top + 15), "", GetString(p->bit_string_id), new BMessage(MSG_WINDOW_MODE)); - pane->AddChild(p->box); - p->box->SetValue(window_modes & p->mode ? B_CONTROL_ON : B_CONTROL_OFF); - } - uint32 screen_modes = PrefsFindInt32("screenmodes"); - for (int i=0; ibit_string_id == STR_8_BIT_CTRL) { - BStringView *text = new BStringView(BRect(10, p->top, 120, p->top + 15), "", GetString(p->mode_string_id)); - pane->AddChild(text); - } - p->box = new BCheckBox(BRect(p->left, p->top, p->left + 80, p->top + 15), "", GetString(p->bit_string_id), new BMessage(MSG_SCREEN_MODE)); - pane->AddChild(p->box); - p->box->SetValue(screen_modes & p->mode ? B_CONTROL_ON : B_CONTROL_OFF); - } - - nosound_checkbox = new BCheckBox(BRect(10, 185, right, 200), "nosound", GetString(STR_NOSOUND_CTRL), new BMessage(MSG_NOSOUND)); - pane->AddChild(nosound_checkbox); - nosound_checkbox->SetValue(PrefsFindBool("nosound") ? B_CONTROL_ON : B_CONTROL_OFF); - - return pane; -} - - -/* - * Create "Serial/Network" pane - */ - -static void add_serial_names(BPopUpMenu *menu, uint32 msg) -{ - BSerialPort *port = new BSerialPort; - char name[B_PATH_NAME_LENGTH]; - for (int i=0; iCountDevices(); i++) { - port->GetDeviceName(i, name); - menu->AddItem(new BMenuItem(name, new BMessage(msg))); - } - if (SysInfo.platform_type == B_BEBOX_PLATFORM) { - BDirectory dir; - BEntry entry; - dir.SetTo("/dev/parallel"); - if (dir.InitCheck() == B_NO_ERROR) { - dir.Rewind(); - while (dir.GetNextEntry(&entry) >= 0) { - if (!entry.IsDirectory()) { - entry.GetName(name); - menu->AddItem(new BMenuItem(name, new BMessage(msg))); - } - } - } - } - delete port; -} - -static void set_serial_label(BPopUpMenu *menu, const char *prefs_name) -{ - const char *str; - BMenuItem *item; - if ((str = PrefsFindString(prefs_name)) != NULL) - if ((item = menu->FindItem(str)) != NULL) - item->SetMarked(true); -} - -BView *PrefsWindow::create_serial_pane(void) -{ - BView *pane = new BView(BRect(0, 0, top_frame.right-20, top_frame.bottom-80), GetString(STR_SERIAL_NETWORK_PANE_TITLE), B_FOLLOW_NONE, B_WILL_DRAW); - pane->SetViewColor(fill_color); - float right = pane->Bounds().right-10; - - BMenuField *menu_field; - BPopUpMenu *menu_a = new BPopUpMenu(""); - add_serial_names(menu_a, MSG_SER_A); - menu_field = new BMenuField(BRect(10, 5, right, 20), "seriala", GetString(STR_SERPORTA_CTRL), menu_a); - menu_field->SetDivider(90); - pane->AddChild(menu_field); - set_serial_label(menu_a, "seriala"); - - BPopUpMenu *menu_b = new BPopUpMenu(""); - add_serial_names(menu_b, MSG_SER_B); - menu_field = new BMenuField(BRect(10, 26, right, 41), "serialb", GetString(STR_SERPORTB_CTRL), menu_b); - menu_field->SetDivider(90); - pane->AddChild(menu_field); - set_serial_label(menu_b, "serialb"); - - nonet_checkbox = new BCheckBox(BRect(10, 47, right, 62), "nonet", GetString(STR_NONET_CTRL), new BMessage(MSG_NONET)); - pane->AddChild(nonet_checkbox); - nonet_checkbox->SetValue(PrefsFindBool("nonet") ? B_CONTROL_ON : B_CONTROL_OFF); - - return pane; -} - - -/* - * Create "Memory/Misc" pane - */ - -BView *PrefsWindow::create_memory_pane(void) -{ - char str[256], str2[256]; - BView *pane = new BView(BRect(0, 0, top_frame.right-20, top_frame.bottom-80), GetString(STR_MEMORY_MISC_PANE_TITLE), B_FOLLOW_NONE, B_WILL_DRAW); - pane->SetViewColor(fill_color); - float right = pane->Bounds().right-10; - - BEntry entry("/boot/var/swap"); - off_t swap_space; - if (entry.GetSize(&swap_space) == B_NO_ERROR) - max_ramsize = swap_space / (1024 * 1024) - 8; - else - max_ramsize = SysInfo.max_pages * B_PAGE_SIZE / (1024 * 1024) - 8; - - int32 value = PrefsFindInt32("ramsize") / (1024 * 1024); - - ramsize_slider = new RAMSlider(BRect(10, 5, right, 55), "ramsize", GetString(STR_RAMSIZE_SLIDER), new BMessage(MSG_RAMSIZE), 8, max_ramsize, B_TRIANGLE_THUMB); - ramsize_slider->SetValue(value); - ramsize_slider->UseFillColor(true, &slider_fill_color); - sprintf(str, GetString(STR_RAMSIZE_FMT), 8); - sprintf(str2, GetString(STR_RAMSIZE_FMT), max_ramsize); - ramsize_slider->SetLimitLabels(str, str2); - pane->AddChild(ramsize_slider); - - ignoresegv_checkbox = new BCheckBox(BRect(10, 60, right, 75), "ignoresegv", GetString(STR_IGNORESEGV_CTRL), new BMessage(MSG_IGNORESEGV)); - pane->AddChild(ignoresegv_checkbox); - ignoresegv_checkbox->SetValue(PrefsFindBool("ignoresegv") ? B_CONTROL_ON : B_CONTROL_OFF); - - idlewait_checkbox = new BCheckBox(BRect(10, 80, right, 95), "idlewait", GetString(STR_IDLEWAIT_CTRL), new BMessage(MSG_IDLEWAIT)); - pane->AddChild(idlewait_checkbox); - idlewait_checkbox->SetValue(PrefsFindBool("idlewait") ? B_CONTROL_ON : B_CONTROL_OFF); - - rom_control = new PathControl(false, BRect(10, 100, right, 115), "rom", GetString(STR_ROM_FILE_CTRL), PrefsFindString("rom"), NULL); - rom_control->SetDivider(117); - pane->AddChild(rom_control); - - return pane; -} - - -/* - * Message from controls/menus received - */ - -void PrefsWindow::MessageReceived(BMessage *msg) -{ - switch (msg->what) { - case MSG_OK: // "Start" button clicked - PrefsReplaceString("extfs", extfs_control->Text()); - const char *str = rom_control->Text(); - if (strlen(str)) - PrefsReplaceString("rom", str); - else - PrefsRemoveItem("rom"); - SavePrefs(); - send_quit_on_close = false; - PostMessage(B_QUIT_REQUESTED); - be_app->PostMessage(ok_message); - break; - - case MSG_CANCEL: // "Quit" button clicked - send_quit_on_close = false; - PostMessage(B_QUIT_REQUESTED); - be_app->PostMessage(B_QUIT_REQUESTED); - break; - - case B_ABOUT_REQUESTED: // "About" menu item selected - OpenAboutWindow(); - break; - - case MSG_ZAP_PRAM: // "Zap PRAM File" menu item selected - ZapPRAM(); - break; - - case MSG_VOLUME_INVOKED: { // Double-clicked on volume name, toggle read-only flag - int selected = volume_list->CurrentSelection(); - if (selected >= 0) { - const char *str = PrefsFindString("disk", selected); - BStringItem *item = (BStringItem *)volume_list->RemoveItem(selected); - delete item; - char newstr[256]; - if (str[0] == '*') - strcpy(newstr, str+1); - else { - strcpy(newstr, "*"); - strcat(newstr, str); - } - PrefsReplaceString("disk", newstr, selected); - volume_list->AddItem(new BStringItem(newstr), selected); - volume_list->Select(selected); - } - break; - } - - case MSG_ADD_VOLUME: - add_volume_panel->Show(); - break; - - case MSG_CREATE_VOLUME: - create_volume_panel->Show(); - break; - - case MSG_ADD_VOLUME_PANEL: { - entry_ref ref; - if (msg->FindRef("refs", &ref) == B_NO_ERROR) { - BEntry entry(&ref, true); - BPath path; - entry.GetPath(&path); - if (entry.IsFile()) { - PrefsAddString("disk", path.Path()); - volume_list->AddItem(new BStringItem(path.Path())); - } else if (entry.IsDirectory()) { - BVolume volume; - if (path.Path()[0] == '/' && strchr(path.Path()+1, '/') == NULL && entry.GetVolume(&volume) == B_NO_ERROR) { - int32 i = 0; - dev_t d; - fs_info info; - while ((d = next_dev(&i)) >= 0) { - fs_stat_dev(d, &info); - if (volume.Device() == info.dev) { - PrefsAddString("disk", info.device_name); - volume_list->AddItem(new BStringItem(info.device_name)); - } - } - } - } - } - break; - } - - case MSG_CREATE_VOLUME_PANEL: { - entry_ref dir; - if (msg->FindRef("directory", &dir) == B_NO_ERROR) { - BEntry entry(&dir, true); - BPath path; - entry.GetPath(&path); - path.Append(msg->FindString("name")); - - create_volume_panel->Window()->Lock(); - BView *background = create_volume_panel->Window()->ChildAt(0); - NumberControl *v = (NumberControl *)background->FindView("hardfile_size"); - int size = v->Value(); - - char cmd[1024]; - sprintf(cmd, "dd if=/dev/zero \"of=%s\" bs=1024k count=%d", path.Path(), size); - int ret = system(cmd); - if (ret == 0) { - PrefsAddString("disk", path.Path()); - volume_list->AddItem(new BStringItem(path.Path())); - } else { - sprintf(cmd, GetString(STR_CREATE_VOLUME_WARN), strerror(ret)); - WarningAlert(cmd); - } - } - break; - } - - case MSG_REMOVE_VOLUME: { - int selected = volume_list->CurrentSelection(); - if (selected >= 0) { - PrefsRemoveItem("disk", selected); - BStringItem *item = (BStringItem *)volume_list->RemoveItem(selected); - delete item; - volume_list->Select(selected); - } - break; - } - - case MSG_BOOT_ANY: - PrefsReplaceInt32("bootdriver", 0); - break; - - case MSG_BOOT_CDROM: - PrefsReplaceInt32("bootdriver", CDROMRefNum); - break; - - case MSG_NOCDROM: - PrefsReplaceBool("nocdrom", nocdrom_checkbox->Value() == B_CONTROL_ON); - break; - - case MSG_GFXACCEL: - PrefsReplaceBool("gfxaccel", gfxaccel_checkbox->Value() == B_CONTROL_ON); - break; - - case MSG_NOSOUND: - PrefsReplaceBool("nosound", nosound_checkbox->Value() == B_CONTROL_ON); - break; - - case MSG_WINDOW_MODE: { - BCheckBox *source = NULL; - msg->FindPointer("source", &source); - if (source == NULL) - break; - for (int i=0; ibox == source) { - if (p->box->Value() == B_CONTROL_ON) - PrefsReplaceInt32("windowmodes", PrefsFindInt32("windowmodes") | p->mode); - else - PrefsReplaceInt32("windowmodes", PrefsFindInt32("windowmodes") & ~(p->mode)); - break; - } - } - break; - } - - case MSG_SCREEN_MODE: { - BCheckBox *source = NULL; - msg->FindPointer("source", &source); - if (source == NULL) - break; - for (int i=0; ibox == source) { - if (p->box->Value() == B_CONTROL_ON) - PrefsReplaceInt32("screenmodes", PrefsFindInt32("screenmodes") | p->mode); - else - PrefsReplaceInt32("screenmodes", PrefsFindInt32("screenmodes") & ~(p->mode)); - break; - } - } - break; - } - - case MSG_REF_5HZ: - PrefsReplaceInt32("frameskip", 12); - break; - - case MSG_REF_7_5HZ: - PrefsReplaceInt32("frameskip", 8); - break; - - case MSG_REF_10HZ: - PrefsReplaceInt32("frameskip", 6); - break; - - case MSG_REF_15HZ: - PrefsReplaceInt32("frameskip", 4); - break; - - case MSG_REF_30HZ: - PrefsReplaceInt32("frameskip", 2); - break; - - case MSG_SER_A: { - BMenuItem *source = NULL; - msg->FindPointer("source", &source); - if (source) - PrefsReplaceString("seriala", source->Label()); - break; - } - - case MSG_SER_B: { - BMenuItem *source = NULL; - msg->FindPointer("source", &source); - if (source) - PrefsReplaceString("serialb", source->Label()); - break; - } - - case MSG_NONET: - PrefsReplaceBool("nonet", nonet_checkbox->Value() == B_CONTROL_ON); - break; - - case MSG_IGNORESEGV: - PrefsReplaceBool("ignoresegv", ignoresegv_checkbox->Value() == B_CONTROL_ON); - break; - - case MSG_IDLEWAIT: - PrefsReplaceBool("idlewait", idlewait_checkbox->Value() == B_CONTROL_ON); - break; - - case MSG_RAMSIZE: - PrefsReplaceInt32("ramsize", ramsize_slider->Value() * 1024 * 1024); - break; - - default: - BWindow::MessageReceived(msg); - } -} diff --git a/SheepShaver/src/BeOS/scsi_beos.cpp b/SheepShaver/src/BeOS/scsi_beos.cpp deleted file mode 120000 index c495dce0..00000000 --- a/SheepShaver/src/BeOS/scsi_beos.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/BeOS/scsi_beos.cpp \ No newline at end of file diff --git a/SheepShaver/src/BeOS/serial_beos.cpp b/SheepShaver/src/BeOS/serial_beos.cpp deleted file mode 120000 index 2231c6d0..00000000 --- a/SheepShaver/src/BeOS/serial_beos.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/BeOS/serial_beos.cpp \ No newline at end of file diff --git a/SheepShaver/src/BeOS/sys_beos.cpp b/SheepShaver/src/BeOS/sys_beos.cpp deleted file mode 120000 index 4e238dac..00000000 --- a/SheepShaver/src/BeOS/sys_beos.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/BeOS/sys_beos.cpp \ No newline at end of file diff --git a/SheepShaver/src/BeOS/sysdeps.h b/SheepShaver/src/BeOS/sysdeps.h deleted file mode 100644 index 6a7861a5..00000000 --- a/SheepShaver/src/BeOS/sysdeps.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * sysdeps.h - System dependent definitions for BeOS - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef SYSDEPS_H -#define SYSDEPS_H - -// Do we have std namespace? -#ifdef __POWERPC__ -#define NO_STD_NAMESPACE -#endif - -#include -#include -#include - -#include "user_strings_beos.h" - -// Are we using a PPC emulator or the real thing? -#ifdef __POWERPC__ -#define EMULATED_PPC 0 -#define WORDS_BIGENDIAN 1 -#define SYSTEM_CLOBBERS_R2 1 -#else -#define EMULATED_PPC 1 -#undef WORDS_BIGENDIAN -#endif - -// High precision timing -#define PRECISE_TIMING 1 -#define PRECISE_TIMING_BEOS 1 - -#define POWERPC_ROM 1 - -// Time data type for Time Manager emulation -typedef bigtime_t tm_time_t; - -// 64 bit file offsets -typedef off_t loff_t; - -// Data types -typedef uint32 uintptr; -typedef int32 intptr; - -// Timing functions -extern void Delay_usec(uint32 usec); - -// Macro for calling MacOS routines -#define CallMacOS(type, proc) (*(type)proc)() -#define CallMacOS1(type, proc, arg1) (*(type)proc)(arg1) -#define CallMacOS2(type, proc, arg1, arg2) (*(type)proc)(arg1, arg2) -#define CallMacOS3(type, proc, arg1, arg2, arg3) (*(type)proc)(arg1, arg2, arg3) -#define CallMacOS4(type, proc, arg1, arg2, arg3, arg4) (*(type)proc)(arg1, arg2, arg3, arg4) -#define CallMacOS5(type, proc, arg1, arg2, arg3, arg4, arg5) (*(type)proc)(arg1, arg2, arg3, arg4, arg5) -#define CallMacOS6(type, proc, arg1, arg2, arg3, arg4, arg5, arg6) (*(type)proc)(arg1, arg2, arg3, arg4, arg5, arg6) -#define CallMacOS7(type, proc, arg1, arg2, arg3, arg4, arg5, arg6, arg7) (*(type)proc)(arg1, arg2, arg3, arg4, arg5, arg6, arg7) - -#endif diff --git a/SheepShaver/src/BeOS/timer_beos.cpp b/SheepShaver/src/BeOS/timer_beos.cpp deleted file mode 120000 index 0d9e8014..00000000 --- a/SheepShaver/src/BeOS/timer_beos.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/BeOS/timer_beos.cpp \ No newline at end of file diff --git a/SheepShaver/src/BeOS/user_strings_beos.cpp b/SheepShaver/src/BeOS/user_strings_beos.cpp deleted file mode 100644 index 0f7b1367..00000000 --- a/SheepShaver/src/BeOS/user_strings_beos.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * user_strings_beos.cpp - Localizable strings, BeOS specific strings - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" -#include "user_strings.h" - - -// Platform-specific string definitions -user_string_def platform_strings[] = { - // Common strings that have a platform-specific variant - {STR_VOLUME_IS_MOUNTED_WARN, "The volume '%s' is mounted under BeOS. Basilisk II will try to unmount it."}, - {STR_EXTFS_CTRL, "BeOS Root"}, - {STR_EXTFS_NAME, "BeOS Directory Tree"}, - {STR_EXTFS_VOLUME_NAME, "BeOS"}, - - // Purely platform-specific strings - {STR_NO_SHEEP_DRIVER_ERR, "Cannot open /dev/sheep: %s (%08x). SheepShaver is not properly installed."}, - {STR_NO_RAM_AREA_ERR, "Not enough memory to create RAM area: %s (%08x)."}, - {STR_NO_ROM_AREA_ERR, "Not enough memory to create ROM area."}, - {STR_NO_SHEEP_MEM_AREA_ERR, "Not enough memory to create SheepShaver area."}, - {STR_SHEEP_UP_ERR, "Cannot allocate Low Memory Globals: %s (%08x)."}, - {STR_NO_NET_ADDON_WARN, "The SheepShaver net server add-on cannot be found. Ethernet will not be available."}, - {STR_NET_CONFIG_MODIFY_WARN, "To enable Ethernet networking for SheepShaver, your network configuration has to be modified and the network restarted. Do you want this to be done now (selecting \"Cancel\" will disable Ethernet under SheepShaver)?."}, - {STR_NET_ADDON_INIT_FAILED, "SheepShaver net server add-on found\nbut there seems to be no network hardware.\nPlease check your network preferences."}, - {STR_NET_ADDON_CLONE_FAILED, "Cloning of the network transfer area failed."}, - {STR_NO_SHEEP_MEM_AREA_ERR, "Cannot create SheepShaver Globals area: %s (%08x)."}, - {STR_NO_DR_CACHE_AREA_ERR, "Cannot create DR Cache area: %s (%08x)."}, - {STR_NO_DR_EMULATOR_AREA_ERR, "Cannot create DR Emulator area: %s (%08x)."}, - - {-1, NULL} // End marker -}; - - -/* - * Fetch pointer to string, given the string number - */ - -const char *GetString(int num) -{ - // First search for platform-specific string - int i = 0; - while (platform_strings[i].num >= 0) { - if (platform_strings[i].num == num) - return platform_strings[i].str; - i++; - } - - // Not found, search for common string - i = 0; - while (common_strings[i].num >= 0) { - if (common_strings[i].num == num) - return common_strings[i].str; - i++; - } - return NULL; -} diff --git a/SheepShaver/src/BeOS/user_strings_beos.h b/SheepShaver/src/BeOS/user_strings_beos.h deleted file mode 100644 index b8248110..00000000 --- a/SheepShaver/src/BeOS/user_strings_beos.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * user_strings_beos.h - BeOS-specific localizable strings - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef USER_STRINGS_BEOS_H -#define USER_STRINGS_BEOS_H - -enum { - STR_NO_SHEEP_DRIVER_ERR = 10000, - STR_NO_ROM_AREA_ERR, - STR_SHEEP_UP_ERR, - STR_NO_NET_ADDON_WARN, - STR_NET_CONFIG_MODIFY_WARN, - STR_NET_ADDON_INIT_FAILED, - STR_NET_ADDON_CLONE_FAILED, - STR_NO_SHEEP_MEM_AREA_ERR, - STR_NO_DR_CACHE_AREA_ERR, - STR_NO_DR_EMULATOR_AREA_ERR -}; - -#endif diff --git a/SheepShaver/src/BeOS/video_beos.cpp b/SheepShaver/src/BeOS/video_beos.cpp deleted file mode 100644 index aa4f2496..00000000 --- a/SheepShaver/src/BeOS/video_beos.cpp +++ /dev/null @@ -1,787 +0,0 @@ -/* - * video_beos.cpp - Video/graphics emulation, BeOS specific things - * - * SheepShaver (C) 1997-2008 Marc Hellwig and Christian Bauer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" - -#include "video.h" -#include "video_defs.h" -#include "main.h" -#include "adb.h" -#include "prefs.h" -#include "user_strings.h" -#include "about_window.h" -#include "version.h" - -#define DEBUG 0 -#include "debug.h" - - -// Global variables -static sem_id video_lock = -1; // Protection during mode changes -static sem_id mac_os_lock = -1; // This is used to stop the MacOS thread when the SheepShaver workspace is switched out - -// Prototypes -static filter_result filter_func(BMessage *msg, BHandler **target, BMessageFilter *filter); - -// From sys_beos.cpp -extern void SysCreateVolumeMenu(BMenu *menu, uint32 msg); -extern void SysMountVolume(const char *name); - - -#include "video_window.h" -#include "video_screen.h" - - -/* - * Display manager thread (for opening and closing windows and screens; - * this is not safe under R4 when running on the MacOS stack in kernel - * space) - */ - -// Message constants -const uint32 MSG_OPEN_WINDOW = 'owin'; -const uint32 MSG_CLOSE_WINDOW = 'cwin'; -const uint32 MSG_OPEN_SCREEN = 'oscr'; -const uint32 MSG_CLOSE_SCREEN = 'cscr'; -const uint32 MSG_QUIT_DISPLAY_MANAGER = 'quit'; - -static thread_id dm_thread = -1; -static sem_id dm_done_sem = -1; - -static status_t display_manager(void *arg) -{ - for (;;) { - - // Receive message - thread_id sender; - uint32 code = receive_data(&sender, NULL, 0); - D(bug("Display manager received %08lx\n", code)); - switch (code) { - case MSG_QUIT_DISPLAY_MANAGER: - return 0; - - case MSG_OPEN_WINDOW: - D(bug("Opening window\n")); - the_window = new MacWindow(BRect(0, 0, VModes[cur_mode].viXsize-1, VModes[cur_mode].viYsize-1)); - D(bug("Opened\n")); - break; - - case MSG_CLOSE_WINDOW: - if (the_window != NULL) { - D(bug("Posting quit to window\n")); - the_window->PostMessage(B_QUIT_REQUESTED); - D(bug("Posted, waiting\n")); - while (the_window) - snooze(200000); - D(bug("Window closed\n")); - } - break; - - case MSG_OPEN_SCREEN: { - D(bug("Opening screen\n")); - long scr_mode = 0; - switch (VModes[cur_mode].viAppleMode) { - case APPLE_8_BIT: - switch (VModes[cur_mode].viAppleID) { - case APPLE_640x480: - scr_mode = B_8_BIT_640x480; - break; - case APPLE_800x600: - scr_mode = B_8_BIT_800x600; - break; - case APPLE_1024x768: - scr_mode = B_8_BIT_1024x768; - break; - case APPLE_1152x900: - scr_mode = B_8_BIT_1152x900; - break; - case APPLE_1280x1024: - scr_mode = B_8_BIT_1280x1024; - break; - case APPLE_1600x1200: - scr_mode = B_8_BIT_1600x1200; - break; - } - break; - case APPLE_16_BIT: - switch (VModes[cur_mode].viAppleID) { - case APPLE_640x480: - scr_mode = B_15_BIT_640x480; - break; - case APPLE_800x600: - scr_mode = B_15_BIT_800x600; - break; - case APPLE_1024x768: - scr_mode = B_15_BIT_1024x768; - break; - case APPLE_1152x900: - scr_mode = B_15_BIT_1152x900; - break; - case APPLE_1280x1024: - scr_mode = B_15_BIT_1280x1024; - break; - case APPLE_1600x1200: - scr_mode = B_15_BIT_1600x1200; - break; - } - break; - case APPLE_32_BIT: - switch (VModes[cur_mode].viAppleID) { - case APPLE_640x480: - scr_mode = B_32_BIT_640x480; - break; - case APPLE_800x600: - scr_mode = B_32_BIT_800x600; - break; - case APPLE_1024x768: - scr_mode = B_32_BIT_1024x768; - break; - case APPLE_1152x900: - scr_mode = B_32_BIT_1152x900; - break; - case APPLE_1280x1024: - scr_mode = B_32_BIT_1280x1024; - break; - case APPLE_1600x1200: - scr_mode = B_32_BIT_1600x1200; - break; - } - break; - } - the_screen = new MacScreen(GetString(STR_WINDOW_TITLE), scr_mode); - D(bug("Opened, error %08lx\n", screen_error)); - if (screen_error != B_NO_ERROR) { - D(bug("Error, posting quit to screen\n")); - the_screen->PostMessage(B_QUIT_REQUESTED); - D(bug("Posted, waiting\n")); - while (the_screen) - snooze(200000); - D(bug("Screen closed\n")); - break; - } - - // Wait for video mem access - D(bug("Showing screen\n")); - the_screen->Show(); - D(bug("Shown, waiting for frame buffer access\n")); - while (!drawing_enable) - snooze(200000); - D(bug("Access granted\n")); - break; - } - - case MSG_CLOSE_SCREEN: - if (the_screen != NULL) { - D(bug("Posting quit to screen\n")); - the_screen->PostMessage(B_QUIT_REQUESTED); - D(bug("Posted, waiting\n")); - while (the_screen) - snooze(200000); - D(bug("Screen closed\n")); - } - break; - } - - // Acknowledge - release_sem(dm_done_sem); - } -} - - -/* - * Open display (window or screen) - */ - -static void open_display(void) -{ - D(bug("entering open_display()\n")); - display_type = VModes[cur_mode].viType; - if (display_type == DIS_SCREEN) { - while (send_data(dm_thread, MSG_OPEN_SCREEN, NULL, 0) == B_INTERRUPTED) ; - while (acquire_sem(dm_done_sem) == B_INTERRUPTED) ; - } else if (display_type == DIS_WINDOW) { - while (send_data(dm_thread, MSG_OPEN_WINDOW, NULL, 0) == B_INTERRUPTED) ; - while (acquire_sem(dm_done_sem) == B_INTERRUPTED) ; - } - D(bug("exiting open_display()\n")); -} - - -/* - * Close display - */ - -static void close_display(void) -{ - D(bug("entering close_display()\n")); - if (display_type == DIS_SCREEN) { - while (send_data(dm_thread, MSG_CLOSE_SCREEN, NULL, 0) == B_INTERRUPTED) ; - while (acquire_sem(dm_done_sem) == B_INTERRUPTED) ; - } else if (display_type == DIS_WINDOW) { - while (send_data(dm_thread, MSG_CLOSE_WINDOW, NULL, 0) == B_INTERRUPTED) ; - while (acquire_sem(dm_done_sem) == B_INTERRUPTED) ; - } - D(bug("exiting close_display()\n")); -} - - -/* - * Initialization - */ - -static void add_mode(VideoInfo *&p, uint32 allow, uint32 test, long apple_mode, long apple_id, int type) -{ - if (allow & test) { - p->viType = type; - switch (apple_id) { - case APPLE_W_640x480: - case APPLE_640x480: - p->viXsize = 640; - p->viYsize = 480; - break; - case APPLE_W_800x600: - case APPLE_800x600: - p->viXsize = 800; - p->viYsize = 600; - break; - case APPLE_1024x768: - p->viXsize = 1024; - p->viYsize = 768; - break; - case APPLE_1152x900: - p->viXsize = 1152; - p->viYsize = 900; - break; - case APPLE_1280x1024: - p->viXsize = 1280; - p->viYsize = 1024; - break; - case APPLE_1600x1200: - p->viXsize = 1600; - p->viYsize = 1200; - break; - } - switch (apple_mode) { - case APPLE_8_BIT: - p->viRowBytes = p->viXsize; - break; - case APPLE_16_BIT: - p->viRowBytes = p->viXsize * 2; - break; - case APPLE_32_BIT: - p->viRowBytes = p->viXsize * 4; - break; - } - p->viAppleMode = apple_mode; - p->viAppleID = apple_id; - p++; - } -} - -bool VideoInit(void) -{ - // Init variables, create semaphores - private_data = NULL; - cur_mode = 0; // Window 640x480 - video_lock = create_sem(1, "Video Lock"); - mac_os_lock = create_sem(0, "MacOS Frame Buffer Lock"); - dm_done_sem = create_sem(0, "Display Manager Done"); - - // Construct video mode table - VideoInfo *p = VModes; - uint32 window_modes = PrefsFindInt32("windowmodes"); - uint32 screen_modes = PrefsFindInt32("screenmodes"); - if (window_modes == 0 && screen_modes == 0) - window_modes |= B_8_BIT_640x480 | B_8_BIT_800x600; // Allow at least 640x480 and 800x600 window modes - add_mode(p, window_modes, B_8_BIT_640x480, APPLE_8_BIT, APPLE_W_640x480, DIS_WINDOW); - add_mode(p, window_modes, B_8_BIT_800x600, APPLE_8_BIT, APPLE_W_800x600, DIS_WINDOW); - add_mode(p, window_modes, B_15_BIT_640x480, APPLE_16_BIT, APPLE_W_640x480, DIS_WINDOW); - add_mode(p, window_modes, B_15_BIT_800x600, APPLE_16_BIT, APPLE_W_800x600, DIS_WINDOW); - add_mode(p, window_modes, B_32_BIT_640x480, APPLE_32_BIT, APPLE_W_640x480, DIS_WINDOW); - add_mode(p, window_modes, B_32_BIT_800x600, APPLE_32_BIT, APPLE_W_800x600, DIS_WINDOW); - add_mode(p, screen_modes, B_8_BIT_640x480, APPLE_8_BIT, APPLE_640x480, DIS_SCREEN); - add_mode(p, screen_modes, B_8_BIT_800x600, APPLE_8_BIT, APPLE_800x600, DIS_SCREEN); - add_mode(p, screen_modes, B_8_BIT_1024x768, APPLE_8_BIT, APPLE_1024x768, DIS_SCREEN); - add_mode(p, screen_modes, B_8_BIT_1152x900, APPLE_8_BIT, APPLE_1152x900, DIS_SCREEN); - add_mode(p, screen_modes, B_8_BIT_1280x1024, APPLE_8_BIT, APPLE_1280x1024, DIS_SCREEN); - add_mode(p, screen_modes, B_8_BIT_1600x1200, APPLE_8_BIT, APPLE_1600x1200, DIS_SCREEN); - add_mode(p, screen_modes, B_15_BIT_640x480, APPLE_16_BIT, APPLE_640x480, DIS_SCREEN); - add_mode(p, screen_modes, B_15_BIT_800x600, APPLE_16_BIT, APPLE_800x600, DIS_SCREEN); - add_mode(p, screen_modes, B_15_BIT_1024x768, APPLE_16_BIT, APPLE_1024x768, DIS_SCREEN); - add_mode(p, screen_modes, B_15_BIT_1152x900, APPLE_16_BIT, APPLE_1152x900, DIS_SCREEN); - add_mode(p, screen_modes, B_15_BIT_1280x1024, APPLE_16_BIT, APPLE_1280x1024, DIS_SCREEN); - add_mode(p, screen_modes, B_15_BIT_1600x1200, APPLE_16_BIT, APPLE_1600x1200, DIS_SCREEN); - add_mode(p, screen_modes, B_32_BIT_640x480, APPLE_32_BIT, APPLE_640x480, DIS_SCREEN); - add_mode(p, screen_modes, B_32_BIT_800x600, APPLE_32_BIT, APPLE_800x600, DIS_SCREEN); - add_mode(p, screen_modes, B_32_BIT_1024x768, APPLE_32_BIT, APPLE_1024x768, DIS_SCREEN); - add_mode(p, screen_modes, B_32_BIT_1152x900, APPLE_32_BIT, APPLE_1152x900, DIS_SCREEN); - add_mode(p, screen_modes, B_32_BIT_1280x1024, APPLE_32_BIT, APPLE_1280x1024, DIS_SCREEN); - add_mode(p, screen_modes, B_32_BIT_1600x1200, APPLE_32_BIT, APPLE_1600x1200, DIS_SCREEN); - p->viType = DIS_INVALID; // End marker - p->viRowBytes = 0; - p->viXsize = p->viYsize = 0; - p->viAppleMode = 0; - p->viAppleID = 0; - - // Start display manager thread - dm_thread = spawn_thread(display_manager, "Display Manager", B_NORMAL_PRIORITY, NULL); - resume_thread(dm_thread); - - // Open window/screen - open_display(); - if (display_type == DIS_SCREEN && the_screen == NULL) { - char str[256]; - sprintf(str, GetString(STR_FULL_SCREEN_ERR), strerror(screen_error), screen_error); - ErrorAlert(str); - return false; - } - return true; -} - - -/* - * Deinitialization - */ - -void VideoExit(void) -{ - if (dm_thread >= 0) { - - // Close display - acquire_sem(video_lock); - close_display(); - if (private_data != NULL) { - delete private_data->gammaTable; - delete private_data; - } - - // Stop display manager - status_t l; - send_data(dm_thread, MSG_QUIT_DISPLAY_MANAGER, NULL, 0); - while (wait_for_thread(dm_thread, &l) == B_INTERRUPTED) ; - } - - // Delete semaphores - delete_sem(video_lock); - delete_sem(mac_os_lock); - delete_sem(dm_done_sem); -} - - -/* - * Close screen in full-screen mode - */ - -void VideoQuitFullScreen(void) -{ - D(bug("VideoQuitFullScreen()\n")); - if (display_type == DIS_SCREEN) { - acquire_sem(video_lock); - close_display(); - release_sem(video_lock); - } -} - - -/* - * Execute video VBL routine - */ - -void VideoVBL(void) -{ - release_sem(mac_os_lock); - if (private_data != NULL && private_data->interruptsEnabled) - VSLDoInterruptService(private_data->vslServiceID); - while (acquire_sem(mac_os_lock) == B_INTERRUPTED) ; -} - - -/* - * Filter function for receiving mouse and keyboard events - */ - -#define MENU_IS_POWER 0 - -// Be -> Mac raw keycode translation table -static const uint8 keycode2mac[0x80] = { - 0xff, 0x35, 0x7a, 0x78, 0x63, 0x76, 0x60, 0x61, // inv Esc F1 F2 F3 F4 F5 F6 - 0x62, 0x64, 0x65, 0x6d, 0x67, 0x6f, 0x69, 0x6b, // F7 F8 F9 F10 F11 F12 F13 F14 - 0x71, 0x0a, 0x12, 0x13, 0x14, 0x15, 0x17, 0x16, // F15 ` 1 2 3 4 5 6 - 0x1a, 0x1c, 0x19, 0x1d, 0x1b, 0x18, 0x33, 0x72, // 7 8 9 0 - = BSP INS - 0x73, 0x74, 0x47, 0x4b, 0x43, 0x4e, 0x30, 0x0c, // HOM PUP NUM / * - TAB Q - 0x0d, 0x0e, 0x0f, 0x11, 0x10, 0x20, 0x22, 0x1f, // W E R T Y U I O - 0x23, 0x21, 0x1e, 0x2a, 0x75, 0x77, 0x79, 0x59, // P [ ] \ DEL END PDN 7 - 0x5b, 0x5c, 0x45, 0x39, 0x00, 0x01, 0x02, 0x03, // 8 9 + CAP A S D F - 0x05, 0x04, 0x26, 0x28, 0x25, 0x29, 0x27, 0x24, // G H J K L ; ' RET - 0x56, 0x57, 0x58, 0x38, 0x06, 0x07, 0x08, 0x09, // 4 5 6 SHL Z X C V - 0x0b, 0x2d, 0x2e, 0x2b, 0x2f, 0x2c, 0x38, 0x3e, // B N M , . / SHR CUP - 0x53, 0x54, 0x55, 0x4c, 0x36, 0x37, 0x31, 0x37, // 1 2 3 ENT CTL ALT SPC ALT - 0x36, 0x3b, 0x3d, 0x3c, 0x52, 0x41, 0x3a, 0x3a, // CTR CLF CDN CRT 0 . CMD CMD -#if MENU_IS_POWER - 0x7f, 0x32, 0x51, 0x7f, 0xff, 0xff, 0xff, 0xff, // MNU EUR = POW inv inv inv inv -#else - 0x32, 0x32, 0x51, 0x7f, 0xff, 0xff, 0xff, 0xff, // MNU EUR = POW inv inv inv inv -#endif - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // inv inv inv inv inv inv inv inv - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff // inv inv inv inv inv inv inv inv -}; - -static const uint8 modifier2mac[0x20] = { -#if MENU_IS_POWER - 0x38, 0x37, 0x36, 0x39, 0x6b, 0x47, 0x3a, 0x7f, // SHF CMD inv CAP F14 NUM OPT MNU -#else - 0x38, 0x37, 0x36, 0x39, 0x6b, 0x47, 0x3a, 0x32, // SHF CMD CTR CAP F14 NUM OPT MNU -#endif - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // inv inv inv inv inv inv inv inv - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // inv inv inv inv inv inv inv inv - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff // inv inv inv inv inv inv inv inv -}; - -static filter_result filter_func(BMessage *msg, BHandler **target, BMessageFilter *filter) -{ -// msg->PrintToStream(); - switch (msg->what) { - case B_KEY_DOWN: - case B_KEY_UP: { - uint32 be_code = msg->FindInt32("key") & 0xff; - uint32 mac_code = keycode2mac[be_code]; - - // Intercept Ctrl-F1 (mount floppy disk shortcut) - uint32 mods = msg->FindInt32("modifiers"); - if (be_code == 0x02 && (mods & B_CONTROL_KEY)) - SysMountVolume("/dev/disk/floppy/raw"); - - if (mac_code == 0xff) - return B_DISPATCH_MESSAGE; - if (msg->what == B_KEY_DOWN) - ADBKeyDown(mac_code); - else - ADBKeyUp(mac_code); - return B_SKIP_MESSAGE; - } - - case B_MODIFIERS_CHANGED: { - uint32 mods = msg->FindInt32("modifiers"); - uint32 old_mods = msg->FindInt32("be:old_modifiers"); - uint32 changed = mods ^ old_mods; - uint32 mask = 1; - for (int i=0; i<32; i++, mask<<=1) - if (changed & mask) { - uint32 mac_code = modifier2mac[i]; - if (mac_code == 0xff) - continue; - if (mods & mask) - ADBKeyDown(mac_code); - else - ADBKeyUp(mac_code); - } - return B_SKIP_MESSAGE; - } - - case B_MOUSE_MOVED: { - BPoint point; - msg->FindPoint("where", &point); - ADBMouseMoved(int(point.x), int(point.y)); - return B_DISPATCH_MESSAGE; // Otherwise BitmapView::MouseMoved() wouldn't be called - } - - case B_MOUSE_DOWN: { - uint32 buttons = msg->FindInt32("buttons"); - if (buttons & B_PRIMARY_MOUSE_BUTTON) - ADBMouseDown(0); - if (buttons & B_SECONDARY_MOUSE_BUTTON) - ADBMouseDown(1); - if (buttons & B_TERTIARY_MOUSE_BUTTON) - ADBMouseDown(2); - return B_SKIP_MESSAGE; - } - - case B_MOUSE_UP: // B_MOUSE_UP means "all buttons released" - ADBMouseUp(0); - ADBMouseUp(1); - ADBMouseUp(2); - return B_SKIP_MESSAGE; - - default: - return B_DISPATCH_MESSAGE; - } -} - - -/* - * Install graphics acceleration - */ - -// Rectangle blitting -static void accl_bitblt(accl_params *p) -{ - D(bug("accl_bitblt\n")); - - // Get blitting parameters - int16 src_X = p->src_rect[1] - p->src_bounds[1]; - int16 src_Y = p->src_rect[0] - p->src_bounds[0]; - int16 dest_X = p->dest_rect[1] - p->dest_bounds[1]; - int16 dest_Y = p->dest_rect[0] - p->dest_bounds[0]; - int16 width = p->dest_rect[3] - p->dest_rect[1] - 1; - int16 height = p->dest_rect[2] - p->dest_rect[0] - 1; - D(bug(" src X %d, src Y %d, dest X %d, dest Y %d\n", src_X, src_Y, dest_X, dest_Y)); - D(bug(" width %d, height %d\n", width, height)); - - // And perform the blit - bitblt_hook(src_X, src_Y, dest_X, dest_Y, width, height); -} - -static bool accl_bitblt_hook(accl_params *p) -{ - D(bug("accl_draw_hook %p\n", p)); - - // Check if we can accelerate this bitblt - if (p->src_base_addr == screen_base && p->dest_base_addr == screen_base && - display_type == DIS_SCREEN && bitblt_hook != NULL && - ((uint32 *)p)[0x18 >> 2] + ((uint32 *)p)[0x128 >> 2] == 0 && - ((uint32 *)p)[0x130 >> 2] == 0 && - p->transfer_mode == 0 && - p->src_row_bytes > 0 && ((uint32 *)p)[0x15c >> 2] > 0) { - - // Yes, set function pointer - p->draw_proc = (uint32)accl_bitblt; - return true; - } - return false; -} - -// Rectangle filling/inversion -static void accl_fillrect8(accl_params *p) -{ - D(bug("accl_fillrect8\n")); - - // Get filling parameters - int16 dest_X = p->dest_rect[1] - p->dest_bounds[1]; - int16 dest_Y = p->dest_rect[0] - p->dest_bounds[0]; - int16 dest_X_max = p->dest_rect[3] - p->dest_bounds[1] - 1; - int16 dest_Y_max = p->dest_rect[2] - p->dest_bounds[0] - 1; - uint8 color = p->pen_mode == 8 ? p->fore_pen : p->back_pen; - D(bug(" dest X %d, dest Y %d\n", dest_X, dest_Y)); - D(bug(" dest X max %d, dest Y max %d\n", dest_X_max, dest_Y_max)); - - // And perform the fill - fillrect8_hook(dest_X, dest_Y, dest_X_max, dest_Y_max, color); -} - -static void accl_fillrect32(accl_params *p) -{ - D(bug("accl_fillrect32\n")); - - // Get filling parameters - int16 dest_X = p->dest_rect[1] - p->dest_bounds[1]; - int16 dest_Y = p->dest_rect[0] - p->dest_bounds[0]; - int16 dest_X_max = p->dest_rect[3] - p->dest_bounds[1] - 1; - int16 dest_Y_max = p->dest_rect[2] - p->dest_bounds[0] - 1; - uint32 color = p->pen_mode == 8 ? p->fore_pen : p->back_pen; - D(bug(" dest X %d, dest Y %d\n", dest_X, dest_Y)); - D(bug(" dest X max %d, dest Y max %d\n", dest_X_max, dest_Y_max)); - - // And perform the fill - fillrect32_hook(dest_X, dest_Y, dest_X_max, dest_Y_max, color); -} - -static void accl_invrect(accl_params *p) -{ - D(bug("accl_invrect\n")); - - // Get inversion parameters - int16 dest_X = p->dest_rect[1] - p->dest_bounds[1]; - int16 dest_Y = p->dest_rect[0] - p->dest_bounds[0]; - int16 dest_X_max = p->dest_rect[3] - p->dest_bounds[1] - 1; - int16 dest_Y_max = p->dest_rect[2] - p->dest_bounds[0] - 1; - D(bug(" dest X %d, dest Y %d\n", dest_X, dest_Y)); - D(bug(" dest X max %d, dest Y max %d\n", dest_X_max, dest_Y_max)); - - //!!?? pen_mode == 14 - - // And perform the inversion - invrect_hook(dest_X, dest_Y, dest_X_max, dest_Y_max); -} - -static bool accl_fillrect_hook(accl_params *p) -{ - D(bug("accl_fillrect_hook %p\n", p)); - - // Check if we can accelerate this fillrect - if (p->dest_base_addr == screen_base && ((uint32 *)p)[0x284 >> 2] != 0 && display_type == DIS_SCREEN) { - if (p->transfer_mode == 8) { - // Fill - if (p->dest_pixel_size == 8 && fillrect8_hook != NULL) { - p->draw_proc = (uint32)accl_fillrect8; - return true; - } else if (p->dest_pixel_size == 32 && fillrect32_hook != NULL) { - p->draw_proc = (uint32)accl_fillrect32; - return true; - } - } else if (p->transfer_mode == 10 && invrect_hook != NULL) { - // Invert - p->draw_proc = (uint32)accl_invrect; - return true; - } - } - return false; -} - -// Dummy for testing -/* -static void do_nothing(accl_params *p) {} -static bool accl_foobar_hook(accl_params *p) -{ - printf("accl_foobar_hook %p\n", p); - printf(" src_base_addr %p, dest_base_addr %p\n", p->src_base_addr, p->dest_base_addr); - printf(" src_row_bytes %d, dest_row_bytes %d\n", p->src_row_bytes, p->dest_row_bytes); - printf(" src_pixel_size %d, dest_pixel_size %d\n", p->src_pixel_size, p->dest_pixel_size); - printf(" src_bounds (%d,%d,%d,%d), dest_bounds (%d,%d,%d,%d)\n", p->src_bounds[0], p->src_bounds[1], p->src_bounds[2], p->src_bounds[3], p->dest_bounds[0], p->dest_bounds[1], p->dest_bounds[2], p->dest_bounds[3]); - printf(" src_rect (%d,%d,%d,%d), dest_rect (%d,%d,%d,%d)\n", p->src_rect[0], p->src_rect[1], p->src_rect[2], p->src_rect[3], p->dest_rect[0], p->dest_rect[1], p->dest_rect[2], p->dest_rect[3]); - printf(" transfer mode %d\n", p->transfer_mode); - printf(" pen mode %d\n", p->pen_mode); - printf(" fore_pen %08x, back_pen %08x\n", p->fore_pen, p->back_pen); - printf(" val1 %08x, val2 %08x\n", ((uint32 *)p)[0x18 >> 2], ((uint32 *)p)[0x128 >> 2]); - printf(" val3 %08x\n", ((uint32 *)p)[0x130 >> 2]); - printf(" val4 %08x\n", ((uint32 *)p)[0x15c >> 2]); - printf(" val5 %08x\n", ((uint32 *)p)[0x160 >> 2]); - printf(" val6 %08x\n", ((uint32 *)p)[0x1b4 >> 2]); - printf(" val7 %08x\n", ((uint32 *)p)[0x284 >> 2]); - p->draw_proc = (uint32)do_nothing; - return true; -} -static struct accl_hook_info foobar_hook_info = {(uint32)accl_foobar_hook, (uint32)accl_sync_hook, 6}; -*/ - -// Wait for graphics operation to finish -static bool accl_sync_hook(void *arg) -{ - D(bug("accl_sync_hook %p\n", arg)); - if (sync_hook != NULL) - sync_hook(); - return true; -} - -static struct accl_hook_info bitblt_hook_info = {(uint32)accl_bitblt_hook, (uint32)accl_sync_hook, ACCL_BITBLT}; -static struct accl_hook_info fillrect_hook_info = {(uint32)accl_fillrect_hook, (uint32)accl_sync_hook, ACCL_FILLRECT}; - -void VideoInstallAccel(void) -{ - // Install acceleration hooks - if (PrefsFindBool("gfxaccel")) { - D(bug("Video: Installing acceleration hooks\n")); - NQDMisc(6, (uintptr)&bitblt_hook_info); - NQDMisc(6, (uintptr)&fillrect_hook_info); - } -} - - -/* - * Change video mode - */ - -int16 video_mode_change(VidLocals *csSave, uint32 ParamPtr) -{ - /* return if no mode change */ - if ((csSave->saveData == ReadMacInt32(ParamPtr + csData)) && - (csSave->saveMode == ReadMacInt16(ParamPtr + csMode))) return noErr; - - /* first find video mode in table */ - for (int i=0; VModes[i].viType != DIS_INVALID; i++) { - if ((ReadMacInt16(ParamPtr + csMode) == VModes[i].viAppleMode) && - (ReadMacInt32(ParamPtr + csData) == VModes[i].viAppleID)) { - csSave->saveMode = ReadMacInt16(ParamPtr + csMode); - csSave->saveData = ReadMacInt32(ParamPtr + csData); - csSave->savePage = ReadMacInt16(ParamPtr + csPage); - - while (acquire_sem(video_lock) == B_INTERRUPTED) ; - DisableInterrupt(); - - /* close old display */ - close_display(); - - /* open new display */ - cur_mode = i; - open_display(); - - /* opening the screen failed? Then bail out */ - if (display_type == DIS_SCREEN && the_screen == NULL) { - release_sem(video_lock); - ErrorAlert(GetString(STR_FULL_SCREEN_ERR)); - QuitEmulator(); - } - - WriteMacInt32(ParamPtr + csBaseAddr, screen_base); - csSave->saveBaseAddr=screen_base; - csSave->saveData=VModes[cur_mode].viAppleID;/* First mode ... */ - csSave->saveMode=VModes[cur_mode].viAppleMode; - - EnableInterrupt(); - release_sem(video_lock); - return noErr; - } - } - return paramErr; -} - - -/* - * Set color palette - */ - -void video_set_palette(void) -{ - if (display_type == DIS_SCREEN && the_screen != NULL) - the_screen->palette_changed = true; - else { // remap colors to BeOS-Palette - BScreen screen; - for (int i=0;i<256;i++) - remap_mac_be[i]=screen.IndexForColor(mac_pal[i].red,mac_pal[i].green,mac_pal[i].blue); - } -} - - -/* - * Can we set the MacOS cursor image into the window? - */ - -bool video_can_change_cursor(void) -{ - return (display_type != DIS_SCREEN); -} - - -/* - * Set cursor image for window - */ - -void video_set_cursor(void) -{ - the_window->cursor_changed = true; // Inform window (don't set cursor directly because this may run at interrupt (i.e. signal handler) time) -} - - -/* - * Record dirty area from NQD - */ - -void video_set_dirty_area(int x, int y, int w, int h) -{ -} diff --git a/SheepShaver/src/BeOS/video_screen.h b/SheepShaver/src/BeOS/video_screen.h deleted file mode 100644 index a3b5f268..00000000 --- a/SheepShaver/src/BeOS/video_screen.h +++ /dev/null @@ -1,262 +0,0 @@ -/* - * video_screen.h - Full screen video modes - * - * SheepShaver (C) 1997-2008 Marc Hellwig and Christian Bauer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -static bool drawing_enable = false; // This flag indicated if the access to the screen is allowed -static int page_num; // Index of the currently displayed buffer - - -// Blitter functions -typedef void (*bitblt_ptr)(int32, int32, int32, int32, int32, int32); -static bitblt_ptr bitblt_hook; -typedef void (*fillrect8_ptr)(int32, int32, int32, int32, uint8); -static fillrect8_ptr fillrect8_hook; -typedef void (*fillrect32_ptr)(int32, int32, int32, int32, uint32); -static fillrect32_ptr fillrect32_hook; -typedef void (*invrect_ptr)(int32, int32, int32, int32); -static invrect_ptr invrect_hook; -typedef void (*sync_ptr)(void); -static sync_ptr sync_hook; - - -class MacScreen : public BWindowScreen { -public: - MacScreen(const char *name, uint32 space); - virtual ~MacScreen(); - virtual void Quit(void); - virtual void ScreenConnected(bool active); - - bool palette_changed; - -private: - static status_t tick_func(void *arg); - - BView *view; // Main view for GetMouse() - - uint8 *frame_backup; // Frame buffer backup when switching from/to different workspace - bool quitting; // Flag for ScreenConnected: We are quitting, don't pause emulator thread - bool first; // Flag for ScreenConnected: This is the first time we become active - - thread_id tick_thread; - bool tick_thread_active; -}; - - -// Pointer to our screen -static MacScreen *the_screen = NULL; - -// Error code from BWindowScreen constructor -static status_t screen_error; - -// to enable debugger mode. -#define SCREEN_DEBUG false - - -/* - * Screen constructor - */ - -MacScreen::MacScreen(const char *name, uint32 space) : BWindowScreen(name, space, &screen_error, SCREEN_DEBUG), tick_thread(-1) -{ - D(bug("Screen constructor\n")); - - // Set all variables - frame_backup = NULL; - palette_changed = false; - quitting = false; - first = true; - drawing_enable = false; - ADBSetRelMouseMode(true); - - // Create view to poll the mouse - view = new BView (BRect(0,0,VModes[cur_mode].viXsize-1,VModes[cur_mode].viYsize-1),NULL,B_FOLLOW_NONE,0); - AddChild(view); - - // Start 60Hz interrupt - tick_thread_active = true; - tick_thread = spawn_thread(tick_func, "Polling sucks...", B_DISPLAY_PRIORITY, this); - RegisterThread(tick_thread); - resume_thread(tick_thread); - - // Add filter for keyboard and mouse events - BMessageFilter *filter = new BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE, filter_func); - AddCommonFilter(filter); - D(bug("Screen constructor done\n")); -} - - -/* - * Screen destructor - */ - -MacScreen::~MacScreen() -{ - D(bug("Screen destructor, quitting tick thread\n")); - - // Stop 60Hz interrupt - if (tick_thread > 0) { - status_t l; - tick_thread_active = false; - while (wait_for_thread(tick_thread, &l) == B_INTERRUPTED) ; - } - D(bug("tick thread quit\n")); - - // Tell the emulator that we're done - the_screen = NULL; - D(bug("Screen destructor done\n")); -} - - -/* - * Screen closed - */ - -void MacScreen::Quit(void) -{ - // Tell ScreenConnected() that we are quitting - quitting = true; - D(bug("MacScreen::Quit(), disconnecting\n")); - Disconnect(); - D(bug("disconnected\n")); - BWindowScreen::Quit(); -} - - -/* - * Screen connected/disconnected - */ - -void MacScreen::ScreenConnected(bool active) -{ - D(bug("ScreenConnected(%d)\n", active)); - graphics_card_info *info = CardInfo(); - D(bug(" card_info %p\n", info)); - - if (active) { - - // Read graphics parameters - D(bug(" active\n")); - screen_base = (uint32)info->frame_buffer; - D(bug(" screen_base %p\n", screen_base)); - VModes[cur_mode].viRowBytes = info->bytes_per_row; - D(bug(" xmod %d\n", info->bytes_per_row)); - - // Get acceleration functions - if (PrefsFindBool("gfxaccel")) { - bitblt_hook = (bitblt_ptr)CardHookAt(7); - D(bug(" bitblt_hook %p\n", bitblt_hook)); - fillrect8_hook = (fillrect8_ptr)CardHookAt(5); - D(bug(" fillrect8_hook %p\n", fillrect8_hook)); - fillrect32_hook = (fillrect32_ptr)CardHookAt(6); - D(bug(" fillrect32_hook %p\n", fillrect32_hook)); - invrect_hook = (invrect_ptr)CardHookAt(11); - D(bug(" invrect_hook %p\n", invrect_hook)); - sync_hook = (sync_ptr)CardHookAt(10); - D(bug(" sync_hook %p\n", sync_hook)); - } else { - bitblt_hook = NULL; - fillrect8_hook = NULL; - fillrect32_hook = NULL; - invrect_hook = NULL; - sync_hook = NULL; - } - - // The first time we got the screen, we need to init the Window - if (first) { - D(bug(" first time\n")); - first = false; - page_num = 0; // current display : page 0 - } else { // we get our screen back - D(bug(" not first time\n")); - // copy from backup bitmap to framebuffer - memcpy((void *)screen_base, frame_backup, VModes[cur_mode].viRowBytes * VModes[cur_mode].viYsize); - // delete backup bitmap - delete[] frame_backup; - frame_backup = NULL; - // restore palette - if (info->bits_per_pixel == 8) - SetColorList(mac_pal); - // restart emul thread - release_sem(mac_os_lock); - } - - // allow the drawing in the frame buffer - D(bug(" enabling frame buffer access\n")); - drawing_enable = true; - video_activated = true; - - } else { - - drawing_enable = false; // stop drawing. - video_activated = false; - if (!quitting) { - // stop emul thread - acquire_sem(mac_os_lock); - // create bitmap and store frame buffer into - frame_backup = new uint8[VModes[cur_mode].viRowBytes * VModes[cur_mode].viYsize]; - memcpy(frame_backup, (void *)screen_base, VModes[cur_mode].viRowBytes * VModes[cur_mode].viYsize); - } - } - D(bug("ScreenConnected() done\n")); -} - - -/* - * 60Hz interrupt routine - */ - -status_t MacScreen::tick_func(void *arg) -{ - MacScreen *obj = (MacScreen *)arg; - while (obj->tick_thread_active) { - - // Wait - snooze(16667); - - // Workspace activated? Then poll the mouse and change the palette if needed - if (video_activated) { - BPoint pt; - uint32 button = 0; - if (obj->LockWithTimeout(200000) == B_OK) { - if (obj->palette_changed) { - obj->palette_changed = false; - obj->SetColorList(mac_pal); - } - obj->view->GetMouse(&pt, &button); - obj->Unlock(); - set_mouse_position(320, 240); - ADBMouseMoved(int(pt.x) - 320, int(pt.y) - 240); - if (button & B_PRIMARY_MOUSE_BUTTON) - ADBMouseDown(0); - if (!(button & B_PRIMARY_MOUSE_BUTTON)) - ADBMouseUp(0); - if (button & B_SECONDARY_MOUSE_BUTTON) - ADBMouseDown(1); - if (!(button & B_SECONDARY_MOUSE_BUTTON)) - ADBMouseUp(1); - if (button & B_TERTIARY_MOUSE_BUTTON) - ADBMouseDown(2); - if (!(button & B_TERTIARY_MOUSE_BUTTON)) - ADBMouseUp(2); - } - } - } - return 0; -} diff --git a/SheepShaver/src/BeOS/video_window.h b/SheepShaver/src/BeOS/video_window.h deleted file mode 100644 index 60c4e1bf..00000000 --- a/SheepShaver/src/BeOS/video_window.h +++ /dev/null @@ -1,523 +0,0 @@ -/* - * video_window.h - Window video modes - * - * SheepShaver (C) 1997-2008 Marc Hellwig and Christian Bauer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - - -// Messages -static const uint32 MSG_REDRAW = 'draw'; -static const uint32 MSG_ABOUT_REQUESTED = B_ABOUT_REQUESTED; -static const uint32 MSG_REF_5HZ = ' 5Hz'; -static const uint32 MSG_REF_7_5HZ = ' 7Hz'; -static const uint32 MSG_REF_10HZ = '10Hz'; -static const uint32 MSG_REF_15HZ = '15Hz'; -static const uint32 MSG_REF_30HZ = '30Hz'; -static const uint32 MSG_REF_60HZ = '60Hz'; -static const uint32 MSG_MOUNT = 'moun'; - -static bool mouse_in_view; // Flag: Mouse pointer within bitmap view - -// From sys_beos.cpp -extern void SysCreateVolumeMenu(BMenu *menu, uint32 msg); -extern void SysMountVolume(const char *name); - - -/* - * A simple view class for blitting a bitmap on the screen - */ - -class BitmapView : public BView { -public: - BitmapView(BRect frame, BBitmap *bitmap) : BView(frame, "bitmap", B_FOLLOW_NONE, B_WILL_DRAW) - { - the_bitmap = bitmap; - } - virtual void Draw(BRect update) - { - if (the_bitmap) - DrawBitmap(the_bitmap, update, update); - } - virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *message); - -private: - BBitmap *the_bitmap; -}; - - -/* - * Window class - */ - -class MacWindow : public BDirectWindow { -public: - MacWindow(BRect frame); - virtual ~MacWindow(); - virtual void MessageReceived(BMessage *msg); - virtual void DirectConnected(direct_buffer_info *info); - virtual void WindowActivated(bool active); - - int32 frame_skip; - bool cursor_changed; // Flag: set new cursor image in tick function - -private: - static status_t tick_func(void *arg); - - BitmapView *main_view; - BBitmap *the_bitmap; - uint8 *the_buffer; - - uint32 old_scroll_lock_state; - - thread_id tick_thread; - bool tick_thread_active; - - bool supports_direct_mode; - bool bit_bang; - sem_id drawing_sem; - - color_space mode; - void *bits; - int32 bytes_per_row; - color_space pixel_format; - bool unclipped; -}; - - -// Pointer to our window -static MacWindow *the_window = NULL; - - -/* - * Window constructor - */ - -MacWindow::MacWindow(BRect frame) : BDirectWindow(frame, GetString(STR_WINDOW_TITLE), B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE) -{ - D(bug("Window constructor\n")); - supports_direct_mode = SupportsWindowMode(); - cursor_changed = false; - bit_bang = supports_direct_mode && PrefsFindBool("bitbang"); - - // Move window to right position - Lock(); - MoveTo(80, 60); - - // Allocate bitmap - { - BScreen scr(this); - mode = B_COLOR_8_BIT; - switch (VModes[cur_mode].viAppleMode) { - case APPLE_8_BIT: - mode = B_COLOR_8_BIT; - bit_bang = false; - break; - case APPLE_16_BIT: - mode = B_RGB_16_BIT; - if (scr.ColorSpace() != B_RGB15_BIG && scr.ColorSpace() != B_RGBA15_BIG) - bit_bang = false; - break; - case APPLE_32_BIT: - mode = B_RGB_32_BIT; - if (scr.ColorSpace() != B_RGB32_BIG && scr.ColorSpace() != B_RGBA32_BIG) - bit_bang = false; - break; - } - } - if (bit_bang) { - the_bitmap = NULL; - the_buffer = NULL; - } else { - the_bitmap = new BBitmap(frame, mode); - the_buffer = new uint8[VModes[cur_mode].viRowBytes * (VModes[cur_mode].viYsize + 2)]; // ("height + 2" for safety) - screen_base = (uint32)the_buffer; - } - - // Create bitmap view - main_view = new BitmapView(frame, the_bitmap); - AddChild(main_view); - main_view->MakeFocus(); - - // Read frame skip prefs - frame_skip = PrefsFindInt32("frameskip"); - - // Set up menus - BRect bounds = Bounds(); - bounds.OffsetBy(0, bounds.IntegerHeight() + 1); - BMenuItem *item; - BMenuBar *bar = new BMenuBar(bounds, "menu"); - BMenu *menu = new BMenu(GetString(STR_WINDOW_MENU)); - menu->AddItem(new BMenuItem(GetString(STR_WINDOW_ITEM_ABOUT), new BMessage(MSG_ABOUT_REQUESTED))); - menu->AddItem(new BSeparatorItem); - BMenu *submenu = new BMenu(GetString(STR_WINDOW_ITEM_REFRESH)); - submenu->AddItem(new BMenuItem(GetString(STR_REF_5HZ_LAB), new BMessage(MSG_REF_5HZ))); - submenu->AddItem(new BMenuItem(GetString(STR_REF_7_5HZ_LAB), new BMessage(MSG_REF_7_5HZ))); - submenu->AddItem(new BMenuItem(GetString(STR_REF_10HZ_LAB), new BMessage(MSG_REF_10HZ))); - submenu->AddItem(new BMenuItem(GetString(STR_REF_15HZ_LAB), new BMessage(MSG_REF_15HZ))); - submenu->AddItem(new BMenuItem(GetString(STR_REF_30HZ_LAB), new BMessage(MSG_REF_30HZ))); - submenu->AddItem(new BMenuItem(GetString(STR_REF_60HZ_LAB), new BMessage(MSG_REF_60HZ))); - submenu->SetRadioMode(true); - if (frame_skip == 12) { - if ((item = submenu->FindItem(GetString(STR_REF_5HZ_LAB))) != NULL) - item->SetMarked(true); - } else if (frame_skip == 8) { - if ((item = submenu->FindItem(GetString(STR_REF_7_5HZ_LAB))) != NULL) - item->SetMarked(true); - } else if (frame_skip == 6) { - if ((item = submenu->FindItem(GetString(STR_REF_10HZ_LAB))) != NULL) - item->SetMarked(true); - } else if (frame_skip == 4) { - if ((item = submenu->FindItem(GetString(STR_REF_15HZ_LAB))) != NULL) - item->SetMarked(true); - } else if (frame_skip == 2) { - if ((item = submenu->FindItem(GetString(STR_REF_30HZ_LAB))) != NULL) - item->SetMarked(true); - } else if (frame_skip == 1) { - if ((item = submenu->FindItem(GetString(STR_REF_60HZ_LAB))) != NULL) - item->SetMarked(true); - } - menu->AddItem(submenu); - submenu = new BMenu(GetString(STR_WINDOW_ITEM_MOUNT)); - SysCreateVolumeMenu(submenu, MSG_MOUNT); - menu->AddItem(submenu); - bar->AddItem(menu); - AddChild(bar); - SetKeyMenuBar(bar); - int mbar_height = bar->Frame().IntegerHeight() + 1; - - // Resize window to fit menu bar - ResizeBy(0, mbar_height); - - // Set mouse mode and scroll lock state - ADBSetRelMouseMode(false); - mouse_in_view = true; - old_scroll_lock_state = modifiers() & B_SCROLL_LOCK; - if (old_scroll_lock_state) - SetTitle(GetString(STR_WINDOW_TITLE_FROZEN)); - else - SetTitle(GetString(STR_WINDOW_TITLE)); - - // Clear Mac cursor image - memset(MacCursor + 4, 0, 64); - - // Keep window aligned to 8-byte frame buffer boundaries for faster blitting - SetWindowAlignment(B_BYTE_ALIGNMENT, 8); - - // Create drawing semaphore (for direct mode) - drawing_sem = create_sem(0, "direct frame buffer access"); - - // Start 60Hz interrupt - tick_thread_active = true; - tick_thread = spawn_thread(tick_func, "Window Redraw", B_DISPLAY_PRIORITY, this); - resume_thread(tick_thread); - - // Add filter for keyboard and mouse events - BMessageFilter *filter = new BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE, filter_func); - main_view->AddFilter(filter); - - // Show window - Unlock(); - Show(); - Sync(); - D(bug("Window constructor done\n")); -} - - -/* - * Window destructor - */ - -MacWindow::~MacWindow() -{ - // Restore cursor - mouse_in_view = false; - be_app->SetCursor(B_HAND_CURSOR); - - // Hide window - D(bug("Window destructor, hiding window\n")); - Hide(); - Sync(); - - // Stop 60Hz interrupt - D(bug("Quitting tick thread\n")); - status_t l; - tick_thread_active = false; - delete_sem(drawing_sem); - while (wait_for_thread(tick_thread, &l) == B_INTERRUPTED) ; - D(bug("tick thread quit\n")); - - // dispose allocated memory - delete the_bitmap; - delete[] the_buffer; - - // Tell emulator that we're done - the_window = NULL; - D(bug("Window destructor done\n")); -} - - -/* - * Window connected/disconnected - */ - -void MacWindow::DirectConnected(direct_buffer_info *info) -{ - D(bug("DirectConnected, state %d\n", info->buffer_state)); - switch (info->buffer_state & B_DIRECT_MODE_MASK) { - case B_DIRECT_STOP: - acquire_sem(drawing_sem); - break; - case B_DIRECT_MODIFY: - acquire_sem(drawing_sem); - case B_DIRECT_START: - bits = (void *)((uint8 *)info->bits + info->window_bounds.top * info->bytes_per_row + info->window_bounds.left * info->bits_per_pixel / 8); - bytes_per_row = info->bytes_per_row; - pixel_format = info->pixel_format; - unclipped = false; - if (info->clip_list_count == 1) - if (memcmp(&info->clip_bounds, &info->window_bounds, sizeof(clipping_rect)) == 0) - unclipped = true; - if (bit_bang) { - screen_base = (uint32)bits; - VModes[cur_mode].viRowBytes = bytes_per_row; - } - release_sem(drawing_sem); - break; - } - D(bug("DirectConnected done\n")); -} - - -/* - * Handles redraw messages - */ - -void MacWindow::MessageReceived(BMessage *msg) -{ - BMessage *msg2; - - switch (msg->what) { - case MSG_REDRAW: { - - // Prevent backlog of messages - MessageQueue()->Lock(); - while ((msg2 = MessageQueue()->FindMessage(MSG_REDRAW, 0)) != NULL) { - MessageQueue()->RemoveMessage(msg2); - delete msg2; - } - MessageQueue()->Unlock(); - - // Convert Mac screen buffer to BeOS palette and blit - uint32 length = VModes[cur_mode].viRowBytes * VModes[cur_mode].viYsize; - if (mode == B_COLOR_8_BIT) { - // Palette conversion - uint8 *source = the_buffer - 1; - uint8 *dest = (uint8 *)the_bitmap->Bits() - 1; - for (int i=0; iBits() - 1; - for (int i=0; iBits() - 1; - for (int i=0; iDrawBitmapAsync(the_bitmap, update_rect, update_rect); - break; - } - - case MSG_ABOUT_REQUESTED: - OpenAboutWindow(); - break; - - case MSG_REF_5HZ: - PrefsReplaceInt32("frameskip", frame_skip = 12); - break; - - case MSG_REF_7_5HZ: - PrefsReplaceInt32("frameskip", frame_skip = 8); - break; - - case MSG_REF_10HZ: - PrefsReplaceInt32("frameskip", frame_skip = 6); - break; - - case MSG_REF_15HZ: - PrefsReplaceInt32("frameskip", frame_skip = 4); - break; - - case MSG_REF_30HZ: - PrefsReplaceInt32("frameskip", frame_skip = 2); - break; - - case MSG_REF_60HZ: - PrefsReplaceInt32("frameskip", frame_skip = 1); - break; - - case MSG_MOUNT: { - BMenuItem *source = NULL; - msg->FindPointer("source", (void **)&source); - if (source) - SysMountVolume(source->Label()); - break; - } - - default: - BDirectWindow::MessageReceived(msg); - } -} - - -/* - * Window activated/deactivated - */ - -void MacWindow::WindowActivated(bool active) -{ - video_activated = active; - if (active) - frame_skip = PrefsFindInt32("frameskip"); - else - frame_skip = 12; // 5Hz in background - BDirectWindow::WindowActivated(active); -} - - -/* - * 60Hz interrupt routine - */ - -status_t MacWindow::tick_func(void *arg) -{ - MacWindow *obj = (MacWindow *)arg; - static int tick_counter = 0; - while (obj->tick_thread_active) { - - // Wait - snooze(16667); - - // Refresh window - if (!obj->bit_bang) - tick_counter++; - if (tick_counter >= obj->frame_skip) { - tick_counter = 0; - - // Window title is determined by Scroll Lock state - uint32 scroll_lock_state = modifiers() & B_SCROLL_LOCK; - if (scroll_lock_state != obj->old_scroll_lock_state) { - if (scroll_lock_state) - obj->SetTitle(GetString(STR_WINDOW_TITLE_FROZEN)); - else - obj->SetTitle(GetString(STR_WINDOW_TITLE)); - obj->old_scroll_lock_state = scroll_lock_state; - } - - // Refresh display unless Scroll Lock is down - if (!scroll_lock_state) { - - // If direct frame buffer access is supported and the content area is completely visible, - // convert the Mac screen buffer directly. Otherwise, send a message to the window to do - // it into a bitmap - if (obj->supports_direct_mode) { - if (acquire_sem_etc(obj->drawing_sem, 1, B_TIMEOUT, 200000) == B_NO_ERROR) { - if (obj->unclipped && obj->mode == B_COLOR_8_BIT && obj->pixel_format == B_CMAP8) { - uint8 *source = obj->the_buffer - 1; - uint8 *dest = (uint8 *)obj->bits; - uint32 bytes_per_row = obj->bytes_per_row; - int xsize = VModes[cur_mode].viXsize; - int ysize = VModes[cur_mode].viYsize; - for (int y=0; yunclipped && obj->mode == B_RGB_16_BIT && (obj->pixel_format == B_RGB15_BIG || obj->pixel_format == B_RGBA15_BIG)) { - uint8 *source = obj->the_buffer; - uint8 *dest = (uint8 *)obj->bits; - uint32 sbpr = VModes[cur_mode].viRowBytes; - uint32 dbpr = obj->bytes_per_row; - int xsize = VModes[cur_mode].viXsize; - int ysize = VModes[cur_mode].viYsize; - for (int y=0; yunclipped && obj->mode == B_RGB_32_BIT && (obj->pixel_format == B_RGB32_BIG || obj->pixel_format == B_RGBA32_BIG)) { - uint8 *source = obj->the_buffer; - uint8 *dest = (uint8 *)obj->bits; - uint32 sbpr = VModes[cur_mode].viRowBytes; - uint32 dbpr = obj->bytes_per_row; - int xsize = VModes[cur_mode].viXsize; - int ysize = VModes[cur_mode].viYsize; - for (int y=0; yPostMessage(MSG_REDRAW); - release_sem(obj->drawing_sem); - } - } else - obj->PostMessage(MSG_REDRAW); - } - } - - // Set new cursor image if desired - if (obj->cursor_changed) { - if (mouse_in_view) - be_app->SetCursor(MacCursor); - obj->cursor_changed = false; - } - } - return 0; -} - - -/* - * Mouse moved - */ - -void BitmapView::MouseMoved(BPoint point, uint32 transit, const BMessage *message) -{ - switch (transit) { - case B_ENTERED_VIEW: - mouse_in_view = true; - be_app->SetCursor(MacCursor); - break; - case B_EXITED_VIEW: - mouse_in_view = false; - be_app->SetCursor(B_HAND_CURSOR); - break; - } -} diff --git a/SheepShaver/src/BeOS/xpram_beos.cpp b/SheepShaver/src/BeOS/xpram_beos.cpp deleted file mode 120000 index e5d7f965..00000000 --- a/SheepShaver/src/BeOS/xpram_beos.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/BeOS/xpram_beos.cpp \ No newline at end of file diff --git a/SheepShaver/src/CrossPlatform/sigsegv.cpp b/SheepShaver/src/CrossPlatform/sigsegv.cpp deleted file mode 120000 index a41f4a06..00000000 --- a/SheepShaver/src/CrossPlatform/sigsegv.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/CrossPlatform/sigsegv.cpp \ No newline at end of file diff --git a/SheepShaver/src/CrossPlatform/sigsegv.h b/SheepShaver/src/CrossPlatform/sigsegv.h deleted file mode 120000 index 213fb61d..00000000 --- a/SheepShaver/src/CrossPlatform/sigsegv.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/CrossPlatform/sigsegv.h \ No newline at end of file diff --git a/SheepShaver/src/CrossPlatform/video_blit.cpp b/SheepShaver/src/CrossPlatform/video_blit.cpp deleted file mode 120000 index 15297235..00000000 --- a/SheepShaver/src/CrossPlatform/video_blit.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/CrossPlatform/video_blit.cpp \ No newline at end of file diff --git a/SheepShaver/src/CrossPlatform/video_blit.h b/SheepShaver/src/CrossPlatform/video_blit.h deleted file mode 120000 index 7fe63598..00000000 --- a/SheepShaver/src/CrossPlatform/video_blit.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/CrossPlatform/video_blit.h \ No newline at end of file diff --git a/SheepShaver/src/CrossPlatform/video_vosf.h b/SheepShaver/src/CrossPlatform/video_vosf.h deleted file mode 120000 index 4c552311..00000000 --- a/SheepShaver/src/CrossPlatform/video_vosf.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/CrossPlatform/video_vosf.h \ No newline at end of file diff --git a/SheepShaver/src/CrossPlatform/vm_alloc.cpp b/SheepShaver/src/CrossPlatform/vm_alloc.cpp deleted file mode 120000 index cc80e1bc..00000000 --- a/SheepShaver/src/CrossPlatform/vm_alloc.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/CrossPlatform/vm_alloc.cpp \ No newline at end of file diff --git a/SheepShaver/src/CrossPlatform/vm_alloc.h b/SheepShaver/src/CrossPlatform/vm_alloc.h deleted file mode 120000 index ef65a561..00000000 --- a/SheepShaver/src/CrossPlatform/vm_alloc.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/CrossPlatform/vm_alloc.h \ No newline at end of file diff --git a/SheepShaver/src/EthernetDriver/.finf/Ethernet.mcp b/SheepShaver/src/EthernetDriver/.finf/Ethernet.mcp deleted file mode 100644 index 07b9b6a81ae87b1e58a60cacb95bb48fc00bd657..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 XcmebE4JdLB_jF}sU}#_j66gQ`Qp5uY diff --git a/SheepShaver/src/EthernetDriver/.finf/ethernet.ndrv b/SheepShaver/src/EthernetDriver/.finf/ethernet.ndrv deleted file mode 100644 index f58fce9b794bfb4a4fe810ef7c7136631e5979df..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 WcmXTU$VsvX0!9WP023ev0ssI_8v>{R diff --git a/SheepShaver/src/EthernetDriver/.rsrc/ethernet.ndrv b/SheepShaver/src/EthernetDriver/.rsrc/ethernet.ndrv deleted file mode 100644 index 63653eda90f5d8e837d4382137fe949f517a6ea2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 398 zcmZQzU}RumV2lA0AZ!H0BMn3#c^DKJ=zy`HydW7}5Xi?=Yr&gZl95`Jms+Bimr_&) lQGy6txx~E(7>a;8WkBJaoK}<$WOFev{QnO!T`p<94gfd$5i0-y diff --git a/SheepShaver/src/EthernetDriver/Ethernet Data/.finf/CWSettingsMacOS.stg b/SheepShaver/src/EthernetDriver/Ethernet Data/.finf/CWSettingsMacOS.stg deleted file mode 100644 index 2c25cdbdb1112cee1ca86ec8cff8942b51e4be7c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 RcmWG>aSU+|_jF~z0RTd#0#*P3 diff --git a/SheepShaver/src/EthernetDriver/Ethernet Data/.finf/PPC Debug MacOS Toolbox b/SheepShaver/src/EthernetDriver/Ethernet Data/.finf/PPC Debug MacOS Toolbox deleted file mode 100644 index 4e4e4935707a596987ec1cc32e3d0d587dbe4f04..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 KcmZQzzz+ZbAOHaX diff --git a/SheepShaver/src/EthernetDriver/Ethernet Data/.finf/PPC Final MacOS Toolbox b/SheepShaver/src/EthernetDriver/Ethernet Data/.finf/PPC Final MacOS Toolbox deleted file mode 100644 index 4e4e4935707a596987ec1cc32e3d0d587dbe4f04..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 KcmZQzzz+ZbAOHaX diff --git a/SheepShaver/src/EthernetDriver/Ethernet Data/CWSettingsMacOS.stg b/SheepShaver/src/EthernetDriver/Ethernet Data/CWSettingsMacOS.stg deleted file mode 100644 index 7848ef0bfd9293284e5d924000b90d76e0b1cf39..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4344 zcmeHK&o9J46n^d2mJlR}#Hlyp;OruiEH+}X*C5i#Xz#nBG-4J_`pDuG8fyVwB%NX8< zv`f$}(q4kjN?WO)F_7}jobo&{=PB1ei}<}>JbxCRb@|&Ywa)AiH6Pv3YpjnrX|!}L zaBec^Oun>Gl=oAV@YIt6s^MI7ol7 zn6oCtN>sIyQ@MgOe8t<2hG3G7UQUmvlJ2V$P#HJ8M>zkw}l eKoc>Iy~O`E4_wyX9ZhsyX1wj<(g%)ui|7Rrv4Twi diff --git a/SheepShaver/src/EthernetDriver/Ethernet Data/PPC Debug MacOS Toolbox/.finf/TargetDataMacOS.tdt b/SheepShaver/src/EthernetDriver/Ethernet Data/PPC Debug MacOS Toolbox/.finf/TargetDataMacOS.tdt deleted file mode 100644 index 2c25cdbdb1112cee1ca86ec8cff8942b51e4be7c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 RcmWG>aSU+|_jF~z0RTd#0#*P3 diff --git a/SheepShaver/src/EthernetDriver/Ethernet Data/PPC Debug MacOS Toolbox/.rsrc/TargetDataMacOS.tdt b/SheepShaver/src/EthernetDriver/Ethernet Data/PPC Debug MacOS Toolbox/.rsrc/TargetDataMacOS.tdt deleted file mode 100644 index 7c9986b9e0bcfb616df3c616ba39e2f18aa1a8a6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 286 ecmZQzU}RtbV<5%AAO|K#6oJG4G7NJ6{{sLh?E-lK diff --git a/SheepShaver/src/EthernetDriver/Ethernet Data/PPC Debug MacOS Toolbox/TargetDataMacOS.tdt b/SheepShaver/src/EthernetDriver/Ethernet Data/PPC Debug MacOS Toolbox/TargetDataMacOS.tdt deleted file mode 100644 index 48fe5d703923e17c899a20b29a62202c67d6bb8b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 46180 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 diff --git a/SheepShaver/src/EthernetDriver/Ethernet Data/PPC Final MacOS Toolbox/.finf/TargetDataMacOS.tdt b/SheepShaver/src/EthernetDriver/Ethernet Data/PPC Final MacOS Toolbox/.finf/TargetDataMacOS.tdt deleted file mode 100644 index 2c25cdbdb1112cee1ca86ec8cff8942b51e4be7c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 RcmWG>aSU+|_jF~z0RTd#0#*P3 diff --git a/SheepShaver/src/EthernetDriver/Ethernet Data/PPC Final MacOS Toolbox/.rsrc/TargetDataMacOS.tdt b/SheepShaver/src/EthernetDriver/Ethernet Data/PPC Final MacOS Toolbox/.rsrc/TargetDataMacOS.tdt deleted file mode 100644 index 7c9986b9e0bcfb616df3c616ba39e2f18aa1a8a6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 286 ecmZQzU}RtbV<5%AAO|K#6oJG4G7NJ6{{sLh?E-lK diff --git a/SheepShaver/src/EthernetDriver/Ethernet Data/PPC Final MacOS Toolbox/TargetDataMacOS.tdt b/SheepShaver/src/EthernetDriver/Ethernet Data/PPC Final MacOS Toolbox/TargetDataMacOS.tdt deleted file mode 100644 index cdb3ae7c538a7cb15e14bbe16d1b473ea3eb2c97..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 46304 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 -#include "xlowmem.h" -#include "ether_defs.h" - - -// Macro for tail-calling native code from assembly functions -#define ASM_TAIL_CALL_NATIVE(NAME) \ - lwz r0,XLM_##NAME(r0) ;\ - lwz r2,XLM_TOC(r0) ;\ - mtctr r0 ;\ - bctr - -// Macro for calling native code from assembly functions -#define ASM_CALL_NATIVE(NAME) \ - mflr r0 ;\ - stw r2,12(r1) ;\ - stw r0,8(r1) ;\ - stwu r1,-64(r1) ;\ - lwz r0,XLM_##NAME(r0) ;\ - lwz r2,XLM_TOC(r0) ;\ - mtlr r0 ;\ - blrl ;\ - lwz r0,64+8(r1) ;\ - lwz r2,64+12(r1) ;\ - mtlr r0 ;\ - addi r1,r1,64 ;\ - blr - - -/* - * Driver Description structure - */ - -struct DriverDescription { - uint32 driverDescSignature; - uint32 driverDescVersion; - char nameInfoStr[32]; - uint32 version; - uint32 driverRuntime; - char driverName[32]; - uint32 driverDescReserved[8]; - uint32 nServices; - uint32 serviceCategory; - uint32 serviceType; - uint32 serviceVersion; -}; - -#pragma export on -DriverDescription TheDriverDescription = { - 'mtej', - 0, - "\pSheepShaver Ethernet", - 0x01008000, // V1.0.0final - 4, // kDriverIsUnderExpertControl - "\penet", - 0, 0, 0, 0, 0, 0, 0, 0, - 1, - 'otan', - 0x000a0b01, // Ethernet, Framing: Ethernet/EthernetIPX/802.2, IsDLPI - 0x01000000, // V1.0.0 -}; -#pragma export off - - -/* - * install_info and related structures - */ - -#ifdef BUILD_ETHER_FULL_DRIVER -#define ETHERDECL extern -#else -#define ETHERDECL static -#endif - -ETHERDECL int ether_open(queue_t *rdq, void *dev, int flag, int sflag, void *creds); -ETHERDECL int ether_close(queue_t *rdq, int flag, void *creds); -ETHERDECL int ether_wput(queue_t *q, msgb *mp); -ETHERDECL int ether_wsrv(queue_t *q); -ETHERDECL int ether_rput(queue_t *q, msgb *mp); -ETHERDECL int ether_rsrv(queue_t *q); - -struct ot_module_info { - uint16 mi_idnum; - char *mi_idname; - int32 mi_minpsz; // Minimum packet size - int32 mi_maxpsz; // Maximum packet size - uint32 mi_hiwat; // Queue hi-water mark - uint32 mi_lowat; // Queue lo-water mark -}; - -static ot_module_info module_information = { - kEnetModuleID, - "SheepShaver Ethernet", - 0, - kEnetTSDU, - 6000, - 5000 -}; - -typedef int (*putp_t)(queue_t *, msgb *); -typedef int (*srvp_t)(queue_t *); -typedef int (*openp_t)(queue_t *, void *, int, int, void *); -typedef int (*closep_t)(queue_t *, int, void *); - -struct qinit { - putp_t qi_putp; - srvp_t qi_srvp; - openp_t qi_qopen; - closep_t qi_qclose; - void *qi_qadmin; - struct ot_module_info *qi_minfo; - void *qi_mstat; -}; - -static qinit read_side = { - NULL, - ether_rsrv, - ether_open, - ether_close, - NULL, - &module_information, - NULL -}; - -static qinit write_side = { - ether_wput, - NULL, - ether_open, - ether_close, - NULL, - &module_information, - NULL -}; - -struct streamtab { - struct qinit *st_rdinit; - struct qinit *st_wrinit; - struct qinit *st_muxrinit; - struct qinit *st_muxwinit; -}; - -static streamtab the_streamtab = { - &read_side, - &write_side, - NULL, - NULL -}; - -struct install_info { - struct streamtab *install_str; - uint32 install_flags; - uint32 install_sqlvl; - char *install_buddy; - void *ref_load; - uint32 ref_count; -}; - -enum { - kOTModIsDriver = 0x00000001, - kOTModUpperIsDLPI = 0x00002000, - SQLVL_MODULE = 3, -}; - -static install_info the_install_info = { - &the_streamtab, - kOTModIsDriver /*| kOTModUpperIsDLPI */, - SQLVL_MODULE, - NULL, - NULL, - 0 -}; - - -// Prototypes for exported functions -extern "C" { -#pragma export on -extern uint32 ValidateHardware(void *theID); -extern install_info* GetOTInstallInfo(); -extern uint8 InitStreamModule(void *theID); -extern void TerminateStreamModule(void); -#pragma export off -} - - -/* - * Validate that our hardware is available (always available) - */ - -uint32 ValidateHardware(void *theID) -{ - return 0; -} - - -/* - * Return pointer to install_info structure - */ - -install_info *GetOTInstallInfo(void) -{ - return &the_install_info; -} - -/* - * Init module - */ - -#ifdef BUILD_ETHER_FULL_DRIVER -asm bool NativeInitStreamModule(register void *theID) -{ - ASM_CALL_NATIVE(ETHER_INIT) -} -#else -asm uint8 InitStreamModule(register void *theID) -{ - ASM_TAIL_CALL_NATIVE(ETHER_INIT) -} -#endif - - -/* - * Terminate module - */ - -#ifdef BUILD_ETHER_FULL_DRIVER -asm void NativeTerminateStreamModule(void) -{ - ASM_CALL_NATIVE(ETHER_TERM) -} -#else -asm void TerminateStreamModule(void) -{ - ASM_TAIL_CALL_NATIVE(ETHER_TERM) -} -#endif - - -/* - * DLPI functions - */ - -#ifndef BUILD_ETHER_FULL_DRIVER -static asm int ether_open(register queue_t *rdq, register void *dev, register int flag, register int sflag, register void *creds) -{ - ASM_TAIL_CALL_NATIVE(ETHER_OPEN) -} - -static asm int ether_close(register queue_t *rdq, register int flag, register void *creds) -{ - ASM_TAIL_CALL_NATIVE(ETHER_CLOSE) -} - -static asm int ether_wput(register queue_t *q, register msgb *mp) -{ - ASM_TAIL_CALL_NATIVE(ETHER_WPUT) -} - -static asm int ether_rsrv(register queue_t *q) -{ - ASM_TAIL_CALL_NATIVE(ETHER_RSRV) -} -#endif - - -/* - * Hooks to add-on low-level functions - */ - -asm void AO_get_ethernet_address(register uint32) -{ - ASM_CALL_NATIVE(ETHER_AO_GET_HWADDR) -} - -asm void AO_enable_multicast(register uint32 addr) -{ - ASM_CALL_NATIVE(ETHER_AO_ADD_MULTI) -} - -asm void AO_disable_multicast(register uint32 addr) -{ - ASM_CALL_NATIVE(ETHER_AO_DEL_MULTI) -} - -asm void AO_transmit_packet(register uint32 mp) -{ - ASM_CALL_NATIVE(ETHER_AO_SEND_PACKET) -} diff --git a/SheepShaver/src/EthernetDriver/Ethernet.mcp b/SheepShaver/src/EthernetDriver/Ethernet.mcp deleted file mode 100644 index 6e14f02ef295d82326ff6262c91b74de8ce5dc08..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 103293 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 #define bug printf #endif /* DEBUG_H */ \ No newline at end of file diff --git a/SheepShaver/src/EthernetDriver/ether.cpp b/SheepShaver/src/EthernetDriver/ether.cpp deleted file mode 100644 index 7382ad4f..00000000 --- a/SheepShaver/src/EthernetDriver/ether.cpp +++ /dev/null @@ -1,1738 +0,0 @@ -/* - * ether.cpp - SheepShaver Ethernet Device Driver (DLPI) - * - * SheepShaver (C) 1997-2005 Marc Hellwig and Christian Bauer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * TODO - * - 802.2 TEST/XID - * - MIB statistics - */ - -#include - -#include "sysdeps.h" -#include "cpu_emulation.h" -#include "ether.h" -#include "ether_defs.h" -#include "macos_util.h" - -#define DEBUG 0 -#include "debug.h" - -// Packet types -enum { - kPktDIX = 0, - kPkt8022SAP = 1, - kPkt8022GroupSAP = 2, - kPkt8022SNAP = 3, - kPktIPX = 4, - kPktUnknown = 5 -}; - - -/* - * Stream private data structure - */ - -static const int kGroupSAPMapSize = 128/32; // Number of 32-bit values we need for 128 bits -static const int kGSshift = 6; -static const int kGSmask = 0x1F; - -struct multicast_node { - nw_multicast_node_p next; - uint8 addr[kEnetPhysicalAddressLength]; -}; - -struct DLPIStream { - void SetGroupSAP(uint8 sap) - { - group_sap[sap >> kGSshift] |= (1L << ((sap >> 1) & kGSmask)); - } - - void ClearGroupSAP(uint8 sap) - { - group_sap[sap >> kGSshift] &= ~(1L << ((sap >> 1) & kGSmask)); - } - - void ClearAllGroupSAPs(void) - { - for (int i=0; i> kGSshift] & (1L << ((sap >> 1) & kGSmask)); - } - - void AddMulticast(uint8 *addr) - { - multicast_node *n = (multicast_node *)Mac2HostAddr(Mac_sysalloc(sizeof(multicast_node))); - memcpy(n->addr, addr, kEnetPhysicalAddressLength); - n->next = multicast_list; - multicast_list = n; - } - - void RemoveMulticast(uint8 *addr) - { - multicast_node *p = multicast_list; - while (p) { - if (memcmp(addr, p->addr, kEnetPhysicalAddressLength) == 0) - goto found; - p = p->next; - } - return; - found: - multicast_node *q = (multicast_node *)&multicast_list; - while (q) { - if (q->next == p) { - q->next = p->next; - Mac_sysfree(Host2MacAddr((uint8 *)p)); - return; - } - q = q->next; - } - } - - uint8 *IsMulticastRegistered(uint8 *addr) - { - multicast_node *n = multicast_list; - while (n) { - if (memcmp(addr, n->addr, kEnetPhysicalAddressLength) == 0) - return n->addr; - n = n->next; - } - return NULL; - } - - nw_uint32 minor_num; // Minor device number of this stream - nw_uint32 dlpi_state; // DLPI state of this stream - nw_uint32 flags; // Flags - nw_uint16 dlsap; // SAP bound to this stream - nw_bool framing_8022; // Using 802.2 framing? This is only used to report the MAC type for DL_INFO_ACK and can be set with an ioctl() call - nw_bool raw_mode; // Using raw mode? Header is treated as data - nw_queue_p rdq; // Read queue for this stream - nw_uint32 group_sap[kGroupSAPMapSize]; // Map of bound group SAPs - uint8 snap[k8022SNAPLength]; // SNAP bound to this stream - nw_multicast_node_p multicast_list; // List of enabled multicast addresses -}; - -// Hack to make DLPIStream list initialization early to NULL (do we really need this?) -struct DLPIStreamInit { - DLPIStreamInit(nw_DLPIStream_p *dlpi_stream_p) { *dlpi_stream_p = NULL; } -}; - -// Stream flags -enum { - kSnapStream = 0x00000001, - kAcceptMulticasts = 0x00000002, - kAcceptAll8022Packets = 0x00000004, - kFastPathMode = 0x00000008 -}; - -// List of opened streams (used internally by OpenTransport) -static nw_DLPIStream_p dlpi_stream_list; -static DLPIStreamInit dlpi_stream_init(&dlpi_stream_list); - -// Are we open? -bool ether_driver_opened = false; - -// Our ethernet hardware address -static uint8 hardware_address[6] = {0, 0, 0, 0, 0, 0}; - -// Statistics -int32 num_wput = 0; -int32 num_error_acks = 0; -int32 num_tx_packets = 0; -int32 num_tx_raw_packets = 0; -int32 num_tx_normal_packets = 0; -int32 num_tx_buffer_full = 0; -int32 num_rx_packets = 0; -int32 num_ether_irq = 0; -int32 num_unitdata_ind = 0; -int32 num_rx_fastpath = 0; -int32 num_rx_no_mem = 0; -int32 num_rx_dropped = 0; -int32 num_rx_stream_not_ready = 0; -int32 num_rx_no_unitdata_mem = 0; - - -// Function pointers of imported functions -typedef mblk_t *(*allocb_ptr)(size_t size, int pri); -static uint32 allocb_tvect = 0; -mblk_t *allocb(size_t arg1, int arg2) -{ - return (mblk_t *)Mac2HostAddr((uint32)CallMacOS2(allocb_ptr, allocb_tvect, arg1, arg2)); -} -typedef void (*freeb_ptr)(mblk_t *); -static uint32 freeb_tvect = 0; -static inline void freeb(mblk_t *arg1) -{ - CallMacOS1(freeb_ptr, freeb_tvect, arg1); -} -typedef int16 (*freemsg_ptr)(mblk_t *); -static uint32 freemsg_tvect = 0; -static inline int16 freemsg(mblk_t *arg1) -{ - return (int16)CallMacOS1(freemsg_ptr, freemsg_tvect, arg1); -} -typedef mblk_t *(*copyb_ptr)(mblk_t *); -static uint32 copyb_tvect = 0; -static inline mblk_t *copyb(mblk_t *arg1) -{ - return (mblk_t *)Mac2HostAddr((uint32)CallMacOS1(copyb_ptr, copyb_tvect, arg1)); -} -typedef mblk_t *(*dupmsg_ptr)(mblk_t *); -static uint32 dupmsg_tvect = 0; -static inline mblk_t *dupmsg(mblk_t *arg1) -{ - return (mblk_t *)Mac2HostAddr((uint32)CallMacOS1(dupmsg_ptr, dupmsg_tvect, arg1)); -} -typedef mblk_t *(*getq_ptr)(queue_t *); -static uint32 getq_tvect = 0; -static inline mblk_t *getq(queue_t *arg1) -{ - return (mblk_t *)Mac2HostAddr((uint32)CallMacOS1(getq_ptr, getq_tvect, arg1)); -} -typedef int (*putq_ptr)(queue_t *, mblk_t *); -static uint32 putq_tvect = 0; -static inline int putq(queue_t *arg1, mblk_t *arg2) -{ - return (int)CallMacOS2(putq_ptr, putq_tvect, arg1, arg2); -} -typedef int (*putnext_ptr)(queue_t *, mblk_t *); -static uint32 putnext_tvect = 0; -static inline int putnext(queue_t *arg1, mblk_t *arg2) -{ - return (int)CallMacOS2(putnext_ptr, putnext_tvect, arg1, arg2); -} -typedef int (*putnextctl1_ptr)(queue_t *, int type, int c); -static uint32 putnextctl1_tvect = 0; -static inline int putnextctl1(queue_t *arg1, int arg2, int arg3) -{ - return (int)CallMacOS3(putnextctl1_ptr, putnextctl1_tvect, arg1, arg2, arg3); -} -typedef int (*canputnext_ptr)(queue_t *); -static uint32 canputnext_tvect = 0; -static inline int canputnext(queue_t *arg1) -{ - return (int)CallMacOS1(canputnext_ptr, canputnext_tvect, arg1); -} -typedef int (*qreply_ptr)(queue_t *, mblk_t *); -static uint32 qreply_tvect = 0; -static inline int qreply(queue_t *arg1, mblk_t *arg2) -{ - return (int)CallMacOS2(qreply_ptr, qreply_tvect, arg1, arg2); -} -typedef void (*flushq_ptr)(queue_t *, int flag); -static uint32 flushq_tvect = 0; -static inline void flushq(queue_t *arg1, int arg2) -{ - CallMacOS2(flushq_ptr, flushq_tvect, arg1, arg2); -} -typedef int (*msgdsize_ptr)(const mblk_t *); -static uint32 msgdsize_tvect = 0; -static inline int msgdsize(const mblk_t *arg1) -{ - return (int)CallMacOS1(msgdsize_ptr, msgdsize_tvect, arg1); -} -typedef void (*otenterint_ptr)(void); -static uint32 otenterint_tvect = 0; -void OTEnterInterrupt(void) -{ - CallMacOS(otenterint_ptr, otenterint_tvect); -} -typedef void (*otleaveint_ptr)(void); -static uint32 otleaveint_tvect = 0; -void OTLeaveInterrupt(void) -{ - CallMacOS(otleaveint_ptr, otleaveint_tvect); -} -typedef int (*mi_open_comm_ptr)(DLPIStream **mi_opp_orig, size_t size, queue_t *q, void *dev, int flag, int sflag, void *credp); -static uint32 mi_open_comm_tvect = 0; -static inline int mi_open_comm(DLPIStream **arg1, size_t arg2, queue_t *arg3, void *arg4, int arg5, int arg6, void *arg7) -{ - return (int)CallMacOS7(mi_open_comm_ptr, mi_open_comm_tvect, arg1, arg2, arg3, arg4, arg5, arg6, arg7); -} -typedef int (*mi_close_comm_ptr)(DLPIStream **mi_opp_orig, queue_t *q); -static uint32 mi_close_comm_tvect = 0; -static inline int mi_close_comm(DLPIStream **arg1, queue_t *arg2) -{ - return (int)CallMacOS2(mi_close_comm_ptr, mi_close_comm_tvect, arg1, arg2); -} -typedef DLPIStream *(*mi_next_ptr_ptr)(DLPIStream *); -static uint32 mi_next_ptr_tvect = 0; -static inline DLPIStream *mi_next_ptr(DLPIStream *arg1) -{ - return (DLPIStream *)Mac2HostAddr((uint32)CallMacOS1(mi_next_ptr_ptr, mi_next_ptr_tvect, arg1)); -} -#ifdef USE_ETHER_FULL_DRIVER -typedef void (*ether_dispatch_packet_ptr)(uint32 p, uint32 size); -static uint32 ether_dispatch_packet_tvect = 0; -#endif - -// Prototypes -static void ether_ioctl(DLPIStream *the_stream, queue_t* q, mblk_t* mp); -static void ether_flush(queue_t* q, mblk_t* mp); -static mblk_t *build_tx_packet_header(DLPIStream *the_stream, mblk_t *mp, bool fast_path); -static void transmit_packet(mblk_t *mp); -static void DLPI_error_ack(DLPIStream *the_stream, queue_t *q, mblk_t *ack_mp, uint32 prim, uint32 err, uint32 uerr); -static void DLPI_ok_ack(DLPIStream *the_stream, queue_t *q, mblk_t *ack_mp, uint32 prim); -static void DLPI_info(DLPIStream *the_stream, queue_t *q, mblk_t *mp); -static void DLPI_phys_addr(DLPIStream *the_stream, queue_t *q, mblk_t *mp); -static void DLPI_bind(DLPIStream *the_stream, queue_t *q, mblk_t *mp); -static void DLPI_unbind(DLPIStream *the_stream, queue_t *q, mblk_t *mp); -static void DLPI_subs_bind(DLPIStream *the_stream, queue_t *q, mblk_t *mp); -static void DLPI_subs_unbind(DLPIStream *the_stream, queue_t *q, mblk_t *mp); -static void DLPI_enable_multi(DLPIStream *the_stream, queue_t *q, mblk_t *mp); -static void DLPI_disable_multi(DLPIStream *the_stream, queue_t *q, mblk_t *mp); -static void DLPI_unit_data(DLPIStream *the_stream, queue_t *q, mblk_t *mp); - - -/* - * Initialize ethernet stream module - */ - -static uint8 InitStreamModuleImpl(void *theID) -{ - D(bug("InitStreamModule\n")); - - // Don't re-open if already open - if (ether_driver_opened) - return true; - ether_driver_opened = false; - - // Import functions from OTKernelLib - allocb_tvect = FindLibSymbol("\013OTKernelLib", "\006allocb"); - D(bug("allocb TVECT at %08lx\n", allocb_tvect)); - if (allocb_tvect == 0) - return false; - freeb_tvect = FindLibSymbol("\013OTKernelLib", "\005freeb"); - D(bug("freeb TVECT at %08lx\n", freeb_tvect)); - if (freeb_tvect == 0) - return false; - freemsg_tvect = FindLibSymbol("\013OTKernelLib", "\007freemsg"); - D(bug("freemsg TVECT at %08lx\n", freemsg_tvect)); - if (freemsg_tvect == 0) - return false; - copyb_tvect = FindLibSymbol("\013OTKernelLib", "\005copyb"); - D(bug("copyb TVECT at %08lx\n", copyb_tvect)); - if (copyb_tvect == 0) - return false; - dupmsg_tvect = FindLibSymbol("\013OTKernelLib", "\006dupmsg"); - D(bug("dupmsg TVECT at %08lx\n", dupmsg_tvect)); - if (dupmsg_tvect == 0) - return false; - getq_tvect = FindLibSymbol("\013OTKernelLib", "\004getq"); - D(bug("getq TVECT at %08lx\n", getq_tvect)); - if (getq_tvect == 0) - return false; - putq_tvect = FindLibSymbol("\013OTKernelLib", "\004putq"); - D(bug("putq TVECT at %08lx\n", putq_tvect)); - if (putq_tvect == 0) - return false; - putnext_tvect = FindLibSymbol("\013OTKernelLib", "\007putnext"); - D(bug("putnext TVECT at %08lx\n", putnext_tvect)); - if (putnext_tvect == 0) - return false; - putnextctl1_tvect = FindLibSymbol("\013OTKernelLib", "\013putnextctl1"); - D(bug("putnextctl1 TVECT at %08lx\n", putnextctl1_tvect)); - if (putnextctl1_tvect == 0) - return false; - canputnext_tvect = FindLibSymbol("\013OTKernelLib", "\012canputnext"); - D(bug("canputnext TVECT at %08lx\n", canputnext_tvect)); - if (canputnext_tvect == 0) - return false; - qreply_tvect = FindLibSymbol("\013OTKernelLib", "\006qreply"); - D(bug("qreply TVECT at %08lx\n", qreply_tvect)); - if (qreply_tvect == 0) - return false; - flushq_tvect = FindLibSymbol("\013OTKernelLib", "\006flushq"); - D(bug("flushq TVECT at %08lx\n", flushq_tvect)); - if (flushq_tvect == 0) - return false; - msgdsize_tvect = FindLibSymbol("\013OTKernelLib", "\010msgdsize"); - D(bug("msgdsize TVECT at %08lx\n", msgdsize_tvect)); - if (msgdsize_tvect == 0) - return false; - otenterint_tvect = FindLibSymbol("\017OTKernelUtilLib", "\020OTEnterInterrupt"); - D(bug("OTEnterInterrupt TVECT at %08lx\n", otenterint_tvect)); - if (otenterint_tvect == 0) - return false; - otleaveint_tvect = FindLibSymbol("\017OTKernelUtilLib", "\020OTLeaveInterrupt"); - D(bug("OTLeaveInterrupt TVECT at %08lx\n", otleaveint_tvect)); - if (otleaveint_tvect == 0) - return false; - mi_open_comm_tvect = FindLibSymbol("\013OTKernelLib", "\014mi_open_comm"); - D(bug("mi_open_comm TVECT at %08lx\n", mi_open_comm_tvect)); - if (mi_open_comm_tvect == 0) - return false; - mi_close_comm_tvect = FindLibSymbol("\013OTKernelLib", "\015mi_close_comm"); - D(bug("mi_close_comm TVECT at %08lx\n", mi_close_comm_tvect)); - if (mi_close_comm_tvect == 0) - return false; - mi_next_ptr_tvect = FindLibSymbol("\013OTKernelLib", "\013mi_next_ptr"); - D(bug("mi_next_ptr TVECT at %08lx\n", mi_next_ptr_tvect)); - if (mi_next_ptr_tvect == 0) - return false; - -#ifndef USE_ETHER_FULL_DRIVER - // Initialize stream list (which might be leftover) - dlpi_stream_list = NULL; - - // Ask add-on for ethernet hardware address - AO_get_ethernet_address(Host2MacAddr(hardware_address)); -#endif - - // Yes, we're open - ether_driver_opened = true; - return true; -} - -uint8 InitStreamModule(void *theID) -{ - // Common initialization code - bool net_open = InitStreamModuleImpl(theID); - - // Call InitStreamModule() in native side -#ifdef BUILD_ETHER_FULL_DRIVER - extern bool NativeInitStreamModule(void *); - if (!NativeInitStreamModule((void *)ether_dispatch_packet)) - net_open = false; -#endif - - // Import functions from the Ethernet driver -#ifdef USE_ETHER_FULL_DRIVER - ether_dispatch_packet_tvect = (uintptr)theID; - D(bug("ether_dispatch_packet TVECT at %08lx\n", ether_dispatch_packet_tvect)); - if (ether_dispatch_packet_tvect == 0) - net_open = false; -#endif - - return net_open; -} - - -/* - * Terminate ethernet stream module - */ - -static void TerminateStreamModuleImpl(void) -{ - D(bug("TerminateStreamModule\n")); - -#ifndef USE_ETHER_FULL_DRIVER - // This happens sometimes. I don't know why. - if (dlpi_stream_list != NULL) - printf("FATAL: TerminateStreamModule() called, but streams still open\n"); -#endif - - // Sorry, we're closed - ether_driver_opened = false; -} - -void TerminateStreamModule(void) -{ - // Common termination code - TerminateStreamModuleImpl(); - - // Call TerminateStreamModule() in native side -#ifdef BUILD_ETHER_FULL_DRIVER - extern void NativeTerminateStreamModule(void); - NativeTerminateStreamModule(); -#endif -} - - -/* - * Open new stream - */ - -int ether_open(queue_t *rdq, void *dev, int flag, int sflag, void *creds) -{ - D(bug("ether_open(%p,%p,%d,%d,%p)\n", rdq, dev, flag, sflag, creds)); - - // Return if driver was closed - if (!ether_driver_opened) { - printf("FATAL: ether_open(): Ethernet driver not opened\n"); - return MAC_ENXIO; - } - - // If we're being reopened, just return - if (rdq->q_ptr != NULL) - return 0; - - // Allocate DLPIStream structure - int err = mi_open_comm((DLPIStream **)&dlpi_stream_list, sizeof(DLPIStream), rdq, dev, flag, sflag, creds); - if (err) - return err; - DLPIStream *the_stream = (DLPIStream *)rdq->q_ptr; - the_stream->rdq = rdq; - the_stream->dlpi_state = DL_UNBOUND; - the_stream->flags = 0; - the_stream->dlsap = 0; - the_stream->framing_8022 = false; - the_stream->raw_mode = false; - the_stream->multicast_list = NULL; - return 0; -} - - -/* - * Close stream - */ - -int ether_close(queue_t *rdq, int flag, void *creds) -{ - D(bug("ether_close(%p,%d,%p)\n", rdq, flag, creds)); - - // Return if driver was closed - if (!ether_driver_opened) { - printf("FATAL: ether_close(): Ethernet driver not opened\n"); - return MAC_ENXIO; - } - - // Get stream - DLPIStream *the_stream = (DLPIStream *)rdq->q_ptr; - - // Don't close if never opened - if (the_stream == NULL) - return 0; - - // Disable all registered multicast addresses - while (the_stream->multicast_list) { - AO_disable_multicast(Host2MacAddr(the_stream->multicast_list->addr)); - the_stream->RemoveMulticast(the_stream->multicast_list->addr); - } - the_stream->multicast_list = NULL; - - // Delete the DLPIStream - return mi_close_comm((DLPIStream **)&dlpi_stream_list, rdq); -} - - -/* - * Put something on the write queue - */ - -int ether_wput(queue_t *q, mblk_t *mp) -{ - D(bug("ether_wput(%p,%p)\n", q, mp)); - - // Return if driver was closed - if (!ether_driver_opened) { - printf("FATAL: ether_wput(): Ethernet driver not opened\n"); - return MAC_ENXIO; - } - - // Get stream - DLPIStream *the_stream = (DLPIStream *)q->q_ptr; - if (the_stream == NULL) - return MAC_ENXIO; - - D(bug(" db_type %d\n", (int)mp->b_datap->db_type)); - switch (mp->b_datap->db_type) { - - case M_DATA: - // Transmit raw packet - D(bug(" raw packet\n")); - num_tx_raw_packets++; - transmit_packet(mp); - break; - - case M_PROTO: - case M_PCPROTO: { - union DL_primitives *dlp = (union DL_primitives *)(void *)mp->b_rptr; - uint32 prim = dlp->dl_primitive; - D(bug(" dl_primitive %d\n", prim)); - switch (prim) { - case DL_UNITDATA_REQ: - // Transmit normal packet - num_tx_normal_packets++; - DLPI_unit_data(the_stream, q, mp); - break; - - case DL_INFO_REQ: - DLPI_info(the_stream, q, mp); - break; - - case DL_PHYS_ADDR_REQ: - DLPI_phys_addr(the_stream, q, mp); - break; - - case DL_BIND_REQ: - DLPI_bind(the_stream, q, mp); - break; - - case DL_UNBIND_REQ: - DLPI_unbind(the_stream, q, mp); - break; - - case DL_SUBS_BIND_REQ: - DLPI_subs_bind(the_stream, q, mp); - break; - - case DL_SUBS_UNBIND_REQ: - DLPI_subs_unbind(the_stream, q, mp); - break; - - case DL_ENABMULTI_REQ: - DLPI_enable_multi(the_stream, q, mp); - break; - - case DL_DISABMULTI_REQ: - DLPI_disable_multi(the_stream, q, mp); - break; - - default: - D(bug("WARNING: ether_wsrv(): Unknown primitive\n")); - DLPI_error_ack(the_stream, q, mp, prim, DL_NOTSUPPORTED, 0); - break; - } - break; - } - - case M_IOCTL: - ether_ioctl(the_stream, q, mp); - break; - - case M_FLUSH: - ether_flush(q, mp); - break; - - default: - D(bug("WARNING: ether_wput(): Unknown message type\n")); - freemsg(mp); - break; - } - num_wput++; - return 0; -} - - -/* - * Dequeue and process messages from the read queue - */ - -int ether_rsrv(queue_t *q) -{ - mblk_t *mp; - while ((mp = getq(q)) != NULL) { - if (canputnext(q)) - putnext(q, mp); - else { - freemsg(mp); - flushq(q, FLUSHDATA); - break; - } - } - return 0; -} - - -/* - * Handle ioctl calls - */ - -static void ether_ioctl(DLPIStream *the_stream, queue_t *q, mblk_t *mp) -{ - struct iocblk *ioc = (struct iocblk *)(void *)mp->b_rptr; - D(bug(" ether_ioctl(%p,%p) cmd %d\n", q, mp, (int)ioc->ioc_cmd)); - - switch (ioc->ioc_cmd) { - - case I_OTSetFramingType: { // Toggles what the general info primitive returns for dl_mac_type in dl_info_ack_t structure - mblk_t *info_mp = mp->b_cont; - if (info_mp == NULL || ((info_mp->b_wptr - info_mp->b_rptr) != sizeof(uint32))) { - ioc->ioc_error = MAC_EINVAL; - goto ioctl_error; - } - uint32 framing_type = ntohl(*(uint32 *)(void *)info_mp->b_rptr); - D(bug(" I_OTSetFramingType type %d\n", framing_type)); - if (framing_type != kOTGetFramingValue) - the_stream->framing_8022 = (framing_type == kOTFraming8022); - mp->b_cont = NULL; - freemsg(info_mp); - if (the_stream->framing_8022) - ioc->ioc_rval = kOTFraming8022; - else - ioc->ioc_rval = kOTFramingEthernet; - goto ioctl_ok; - } - - case DL_IOC_HDR_INFO: { // Special Mentat call, for fast transmits - D(bug(" DL_IOC_HDR_INFO\n")); - mblk_t *info_mp = mp->b_cont; - - // Copy DL_UNITDATA_REQ block - mblk_t *unitdata_mp = copyb(info_mp); - if (unitdata_mp == NULL) { - ioc->ioc_error = MAC_ENOMEM; - goto ioctl_error; - } - unitdata_mp->b_datap->db_type = M_PROTO; - - // Construct header (converts DL_UNITDATA_REQ -> M_DATA) - mblk_t *header_mp = build_tx_packet_header(the_stream, unitdata_mp, true); - - if (header_mp == NULL) { - // Could not allocate a message block large enough - ioc->ioc_error = MAC_ENOMEM; - goto ioctl_error; - } - - // Attach header block at the end - mp->b_cont->b_cont = header_mp; - the_stream->flags |= kFastPathMode; - goto ioctl_ok; - } - - case I_OTSetRawMode: { - mblk_t *info_mp = mp->b_cont; - dl_recv_control_t *dlrc; - if (info_mp == NULL || ((info_mp->b_wptr - info_mp->b_rptr) != sizeof(dlrc->dl_primitive))) { - ioc->ioc_error = MAC_EINVAL; - goto ioctl_error; - } - dlrc = (dl_recv_control_t *)(void *)info_mp->b_rptr; - D(bug(" I_OTSetRawMode primitive %d\n", (int)dlrc->dl_primitive)); - the_stream->raw_mode = true; - goto ioctl_ok; - } - - default: - D(bug("WARNING: Unknown ether_ioctl() call\n")); - ioc->ioc_error = MAC_EINVAL; - goto ioctl_error; - } - -ioctl_ok: - ioc->ioc_count = 0; - for (mblk_t *mp1 = mp; (mp1 = mp1->b_cont) != NULL;) - ioc->ioc_count += mp1->b_wptr - mp1->b_rptr; - ioc->ioc_error = 0; - mp->b_datap->db_type = M_IOCACK; - qreply(q, mp); - return; - -ioctl_error: - mp->b_datap->db_type = M_IOCNAK; - qreply(q, mp); - return; -} - - -/* - * Flush call, send it up to the read side of the stream - */ - -static void ether_flush(queue_t* q, mblk_t* mp) -{ - D(bug(" ether_flush(%p,%p)\n", q, mp)); - - uint8 *rptr = mp->b_rptr; - if (*rptr & FLUSHW) - flushq(q, FLUSHALL); - if (*rptr & FLUSHR) { - flushq(RD(q), FLUSHALL); - *rptr &= ~FLUSHW; - qreply(q, mp); - } else - freemsg(mp); -} - - -/* - * Classify packet into the different types of protocols - */ - -static uint16 classify_packet_type(uint16 primarySAP, uint16 secondarySAP) -{ - if (primarySAP >= kMinDIXSAP) - return kPktDIX; - - if ((primarySAP == kIPXSAP) && (secondarySAP == kIPXSAP)) - return kPktIPX; - - if (primarySAP == kSNAPSAP) - return kPkt8022SNAP; - - if (primarySAP <= k8022GlobalSAP) - return kPkt8022SAP; - - return kPktUnknown; -} - - -/* - * Check if the address is a multicast, broadcast or standard address - */ - -static int32 get_address_type(uint8 *addr) -{ - if (addr[0] & 1) { // Multicast/broadcast flag - if (OTIs48BitBroadcastAddress(addr)) - return keaBroadcast; - else - return keaMulticast; - } else - return keaStandardAddress; -} - - -/* - * Reuse a message block, make room for more data - */ - -static mblk_t *reuse_message_block(mblk_t *mp, uint16 needed_size) -{ - mblk_t *nmp; - - if ((mp->b_datap->db_ref == 1) && ((mp->b_datap->db_lim - mp->b_datap->db_base) >= needed_size)) { - mp->b_datap->db_type = M_DATA; - mp->b_rptr = mp->b_datap->db_base; - mp->b_wptr = mp->b_datap->db_base + needed_size; - } else { - nmp = mp->b_cont; // Grab the M_DATA blocks - mp->b_cont = NULL; // Detach the M_(PC)PROTO - freemsg(mp); // Free the M_(PC)PROTO - mp = nmp; // Point to the M_DATA blocks - - // Try to get space on the first M_DATA block - if (mp && (mp->b_datap->db_ref == 1) && ((mp->b_rptr - mp->b_datap->db_base) >= needed_size)) - mp->b_rptr -= needed_size; - else { - // Try to allocate a new message - if ((nmp = allocb(needed_size, BPRI_HI)) == NULL) { - // Could not get a new message block so lets forget about the message altogether - freemsg(mp); // Free the original M_DATA portion of the message - mp = NULL; // Indicates the reuse failed - } else { - nmp->b_cont = mp; // Attach the new message block as the head - nmp->b_wptr += needed_size; - mp = nmp; - } - } - } - - return mp; -} - - -/* - * Built header for packet to be transmitted (convert DL_UNITDATA_REQ -> M_DATA) - * The passed-in message has the header info in the first message block and the data - * in the following blocks - */ - -static mblk_t *build_tx_packet_header(DLPIStream *the_stream, mblk_t *mp, bool fast_path) -{ - // Only handle unit_data requests - dl_unitdata_req_t *req = (dl_unitdata_req_t *)(void *)mp->b_rptr; - if (req->dl_primitive != DL_UNITDATA_REQ) { - freemsg(mp); - return NULL; - } - - // Extract destination address and its length - uint8 *destAddrOrig = ((uint8 *)req) + req->dl_dest_addr_offset; - uint32 destAddrLen = req->dl_dest_addr_length; - uint8 ctrl = 0x03; - - // Extract DLSAP - uint16 dlsap; - switch (destAddrLen) { - case kEnetPhysicalAddressLength: - dlsap = the_stream->dlsap; - break; - case kEnetAndSAPAddressLength: - dlsap = ntohs(*(uint16 *)(destAddrOrig + kEnetPhysicalAddressLength)); - break; - case kEnetPhysicalAddressLength + k8022DLSAPLength + k8022SNAPLength: // SNAP SAP - dlsap = ntohs(*(uint16 *)(destAddrOrig + kEnetPhysicalAddressLength)); - break; - default: - dlsap = the_stream->dlsap; - break; - } - - // Extract data size (excluding header info) and packet type - uint16 datasize = msgdsize(mp); - uint16 packetType = classify_packet_type(the_stream->dlsap, dlsap); - - // Calculate header size and protocol type/size field - uint16 hdrsize, proto; - switch (packetType) { - case kPktDIX: - hdrsize = kEnetPacketHeaderLength; - proto = dlsap; - break; - case kPkt8022SAP: - hdrsize = kEnetPacketHeaderLength + k8022BasicHeaderLength; - if (fast_path) - proto = 0; - else - proto = datasize + k8022BasicHeaderLength; - break; - case kPkt8022SNAP: - hdrsize = kEnetPacketHeaderLength + k8022SNAPHeaderLength; - if (fast_path) - proto = 0; - else - proto = datasize + k8022SNAPHeaderLength; - break; - case kPktIPX: - hdrsize = kEnetPacketHeaderLength; - if (fast_path) - proto = 0; - else - proto = datasize; - break; - default: - hdrsize = kEnetPacketHeaderLength; - proto = dlsap; - break; - } - - // We need to copy the dest address info in the message before we can reuse it - uint8 destAddrCopy[kMaxBoundAddrLength]; - memcpy(destAddrCopy, destAddrOrig, destAddrLen); - - // Resize header info in message block - if ((mp = reuse_message_block(mp, hdrsize)) == NULL) - return NULL; - struct T8022FullPacketHeader *packetHeader = (struct T8022FullPacketHeader *)(void *)mp->b_rptr; - - // Set protocol type/size field - packetHeader->fEnetPart.fProto = proto; - - // Set destination ethernet address - OTCopy48BitAddress(destAddrCopy, packetHeader->fEnetPart.fDestAddr); - - // Set other header fields - switch (packetType) { - case kPkt8022SAP: - packetHeader->f8022Part.fDSAP = (uint8)dlsap; - packetHeader->f8022Part.fSSAP = (uint8)the_stream->dlsap; - packetHeader->f8022Part.fCtrl = ctrl; - break; - case kPkt8022SNAP: { - uint8 *snapStart; - packetHeader->f8022Part.fDSAP = (uint8)dlsap; - packetHeader->f8022Part.fSSAP = (uint8)the_stream->dlsap; - packetHeader->f8022Part.fCtrl = ctrl; - if (destAddrLen >= kEnetAndSAPAddressLength + k8022SNAPLength) - snapStart = destAddrCopy + kEnetAndSAPAddressLength; - else - snapStart = the_stream->snap; - OTCopy8022SNAP(snapStart, packetHeader->f8022Part.fSNAP); - break; - } - } - - // Return updated message - return mp; -} - - -/* - * Transmit packet - */ - -static void transmit_packet(mblk_t *mp) -{ - EnetPacketHeader *enetHeader = (EnetPacketHeader *)(void *)mp->b_rptr; - - // Fill in length in 802.3 packets - if (enetHeader->fProto == 0) - enetHeader->fProto = msgdsize(mp) - sizeof(EnetPacketHeader); - - // Fill in ethernet source address - OTCopy48BitAddress(hardware_address, enetHeader->fSourceAddr); - - // Tell add-on to transmit packet - AO_transmit_packet(Host2MacAddr((uint8 *)mp)); - freemsg(mp); -} - - -/* - * Handle incoming packet (one stream), construct DL_UNITDATA_IND message - */ - -static void handle_received_packet(DLPIStream *the_stream, mblk_t *mp, uint16 packet_type, int32 dest_addr_type) -{ - // Find address and header length - uint32 addr_len; - uint32 header_len; - switch (packet_type) { - case kPkt8022SAP: - addr_len = kEnetAndSAPAddressLength; - header_len = kEnetPacketHeaderLength + k8022BasicHeaderLength; - break; - case kPkt8022SNAP: - addr_len = kEnetAndSAPAddressLength + k8022SNAPLength; - header_len = kEnetPacketHeaderLength + k8022SNAPHeaderLength; - break; - default: // DIX and IPX - addr_len = kEnetAndSAPAddressLength; - header_len = kEnetPacketHeaderLength; - break; - } - - // In Fast Path mode, don't send DL_UNITDATA_IND messages for unicast packets - if ((the_stream->flags & kFastPathMode) && dest_addr_type == keaStandardAddress) { - if (the_stream->raw_mode == false) - mp->b_rptr += header_len; - num_rx_fastpath++; - putq(the_stream->rdq, mp); - return; - } - - // Allocate the dl_unitdata_ind_t message - mblk_t *nmp; - if ((nmp = allocb(sizeof(dl_unitdata_ind_t) + 2*addr_len, BPRI_HI)) == NULL) { - freemsg(mp); - num_rx_no_unitdata_mem++; - return; - } - - // Set message type - nmp->b_datap->db_type = M_PROTO; - dl_unitdata_ind_t *ind = (dl_unitdata_ind_t*)(void *)nmp->b_rptr; - ind->dl_primitive = DL_UNITDATA_IND; - nmp->b_wptr += (sizeof(dl_unitdata_ind_t) + 2*addr_len); - - // Link M_DATA block - nmp->b_cont = mp; - - // Set address fields - ind->dl_dest_addr_length = addr_len; - ind->dl_dest_addr_offset = sizeof(dl_unitdata_ind_t); - ind->dl_src_addr_length = addr_len; - ind->dl_src_addr_offset = sizeof(dl_unitdata_ind_t) + addr_len; - - // Set address type - ind->dl_group_address = dest_addr_type; - - // Set address fields - T8022FullPacketHeader *packetHeader = (T8022FullPacketHeader *)(void *)mp->b_rptr; - T8022AddressStruct *destAddr = ((T8022AddressStruct*)(nmp->b_rptr + ind->dl_dest_addr_offset)); - T8022AddressStruct *srcAddr = ((T8022AddressStruct*)(nmp->b_rptr + ind->dl_src_addr_offset)); - - OTCopy48BitAddress(packetHeader->fEnetPart.fDestAddr, destAddr->fHWAddr); - OTCopy48BitAddress(packetHeader->fEnetPart.fSourceAddr, srcAddr->fHWAddr); - - destAddr->fSAP = packetHeader->f8022Part.fDSAP; - srcAddr->fSAP = packetHeader->f8022Part.fSSAP; - - if (packet_type == kPkt8022SNAP) { - OTCopy8022SNAP(packetHeader->f8022Part.fSNAP, destAddr->fSNAP); - OTCopy8022SNAP(packetHeader->f8022Part.fSNAP, srcAddr->fSNAP); - } - - // "Hide" the ethernet and protocol header(s) - if (the_stream->raw_mode == false) - mp->b_rptr += header_len; - - // Pass message up the stream - num_unitdata_ind++; - putq(the_stream->rdq, nmp); - return; -} - - -/* - * Packet received, distribute it to the streams that want it - */ - -void ether_packet_received(mblk_t *mp) -{ - // Extract address and types - EnetPacketHeader *pkt = (EnetPacketHeader *)(void *)mp->b_rptr; - T8022FullPacketHeader *fullpkt = (T8022FullPacketHeader *)pkt; - uint16 sourceSAP, destSAP; - destSAP = fullpkt->fEnetPart.fProto; - if (destSAP >= kMinDIXSAP) { - // Classic ethernet - sourceSAP = destSAP; - } else { - destSAP = fullpkt->f8022Part.fDSAP; - sourceSAP = fullpkt->f8022Part.fSSAP; - } - uint16 packetType = classify_packet_type(sourceSAP, destSAP); - int32 destAddressType = get_address_type(pkt->fDestAddr); - - // Look which streams want it - DLPIStream *the_stream, *found_stream = NULL; - uint16 found_packetType = 0; - int32 found_destAddressType = 0; - for (the_stream = dlpi_stream_list; the_stream != NULL; the_stream = mi_next_ptr(the_stream)) { - - // Don't send to unbound streams - if (the_stream->dlpi_state == DL_UNBOUND) - continue; - - // Does this stream want all 802.2 packets? - if ((the_stream->flags & kAcceptAll8022Packets) && (destSAP <= 0xff)) - goto type_found; - - // No, check SAP/SNAP - if (destSAP == the_stream->dlsap) { - if (the_stream->flags & kSnapStream) { - // Check SNAPs if necessary - uint8 sum = fullpkt->f8022Part.fSNAP[0] ^ the_stream->snap[0]; - sum |= fullpkt->f8022Part.fSNAP[1] ^ the_stream->snap[1]; - sum |= fullpkt->f8022Part.fSNAP[2] ^ the_stream->snap[2]; - sum |= fullpkt->f8022Part.fSNAP[3] ^ the_stream->snap[3]; - sum |= fullpkt->f8022Part.fSNAP[4] ^ the_stream->snap[4]; - if (sum == 0) - goto type_found; - } else { - // No SNAP, found a match since saps match - goto type_found; - } - } else { - // Check for an 802.3 Group/Global (odd) - if (((packetType == kPkt8022SAP) || (packetType == kPkt8022SNAP)) && (destSAP & 1) && the_stream->TestGroupSAP(destSAP)) - goto type_found; - } - - // No stream for this SAP/SNAP found - continue; - -type_found: - // If it's a multicast packet, it must be in the stream's multicast list - if ((destAddressType == keaMulticast) && (the_stream->flags & kAcceptMulticasts) && (!the_stream->IsMulticastRegistered(pkt->fDestAddr))) - continue; - - // Send packet to stream - // found_stream keeps a pointer to the previously found stream, so that only the last - // stream gets the original message, the other ones get duplicates - if (found_stream) - handle_received_packet(found_stream, dupmsg(mp), found_packetType, found_destAddressType); - found_stream = the_stream; - found_packetType = packetType; - found_destAddressType = destAddressType; - } - - // Send original message to last found stream - if (found_stream) - handle_received_packet(found_stream, mp, found_packetType, found_destAddressType); - else { - freemsg(mp); // Nobody wants it *snief* - num_rx_dropped++; - } -} - -void ether_dispatch_packet(uint32 p, uint32 size) -{ -#ifdef USE_ETHER_FULL_DRIVER - // Call handler from the Ethernet driver - D(bug("ether_dispatch_packet\n")); - D(bug(" packet data at %p, %d bytes\n", p, size)); - CallMacOS2(ether_dispatch_packet_ptr, ether_dispatch_packet_tvect, p, size); -#else - // Wrap packet in message block - num_rx_packets++; - mblk_t *mp; - if ((mp = allocb(size, 0)) != NULL) { - D(bug(" packet data at %p\n", (void *)mp->b_rptr)); - Mac2Host_memcpy(mp->b_rptr, p, size); - mp->b_wptr += size; - ether_packet_received(mp); - } else { - D(bug("WARNING: Cannot allocate mblk for received packet\n")); - num_rx_no_mem++; - } -#endif -} - - -/* - * Build and send an error acknowledge - */ - -static void DLPI_error_ack(DLPIStream *the_stream, queue_t *q, mblk_t *ack_mp, uint32 prim, uint32 err, uint32 uerr) -{ - D(bug(" DLPI_error_ack(%p,%p) prim %d, err %d, uerr %d\n", the_stream, ack_mp, prim, err, uerr)); - num_error_acks++; - - if (ack_mp != NULL) - freemsg(ack_mp); - if ((ack_mp = allocb(sizeof(dl_error_ack_t), BPRI_HI)) == NULL) - return; - - ack_mp->b_datap->db_type = M_PCPROTO; - dl_error_ack_t *errp = (dl_error_ack_t *)(void *)ack_mp->b_wptr; - errp->dl_primitive = DL_ERROR_ACK; - errp->dl_error_primitive = prim; - errp->dl_errno = err; - errp->dl_unix_errno = uerr; - ack_mp->b_wptr += sizeof(dl_error_ack_t); - qreply(q, ack_mp); -} - - -/* - * Build and send an OK acknowledge - */ - -static void DLPI_ok_ack(DLPIStream *the_stream, queue_t *q, mblk_t *ack_mp, uint32 prim) -{ - if (ack_mp->b_datap->db_ref != 1) { - // Message already in use, create a new one - freemsg(ack_mp); - if ((ack_mp = allocb(sizeof(dl_error_ack_t), BPRI_HI)) == NULL) - return; - } else { - // Message free - if (ack_mp->b_cont != NULL) { - freemsg(ack_mp->b_cont); - ack_mp->b_cont = NULL; - } - } - - ack_mp->b_datap->db_type = M_PCPROTO; - dl_ok_ack_t *ackp = (dl_ok_ack_t *)(void *)ack_mp->b_rptr; - ackp->dl_primitive = DL_OK_ACK; - ackp->dl_correct_primitive = prim; - ack_mp->b_wptr = ack_mp->b_rptr + sizeof(dl_ok_ack_t); - qreply(q, ack_mp); -} - - -/* - * Handle DL_INFO_REQ (report general information) - */ - -static void DLPI_info(DLPIStream *the_stream, queue_t *q, mblk_t *mp) -{ - D(bug(" DLPI_info(%p)\n", the_stream)); - uint32 saplen = 0; - uint32 addrlen = kEnetPhysicalAddressLength; - uint32 bcastlen = kEnetPhysicalAddressLength; - uint32 hdrlen = kEnetPacketHeaderLength; - - // Calculate header length - if (the_stream->dlpi_state != DL_UNBOUND) { - saplen = (the_stream->flags & kSnapStream) ? k8022DLSAPLength+k8022SNAPLength : k8022DLSAPLength; - if (the_stream->dlsap == kSNAPSAP) - hdrlen = kEnetPacketHeaderLength + k8022SNAPHeaderLength; // SNAP address - else if ((the_stream->dlsap <= kMax8022SAP) || (the_stream->dlsap == kIPXSAP)) - hdrlen = kEnetPacketHeaderLength + k8022BasicHeaderLength; // SAP or IPX - else - hdrlen = kEnetPacketHeaderLength; // Basic Ethernet - } - - // Allocate message block for reply - mblk_t *ack_mp; - if ((ack_mp = allocb(sizeof(dl_info_ack_t) + addrlen + saplen + bcastlen, BPRI_LO)) == NULL) { - DLPI_error_ack(the_stream, q, mp, DL_INFO_REQ, DL_SYSERR, MAC_ENOMEM); - return; - } - - // Set up message type - ack_mp->b_datap->db_type = M_PCPROTO; - dl_info_ack_t *ackp = (dl_info_ack_t *)(void *)ack_mp->b_rptr; - ackp->dl_primitive = DL_INFO_ACK; - - // Info/version fields - ackp->dl_service_mode = DL_CLDLS; - ackp->dl_provider_style = DL_STYLE1; - ackp->dl_version = DL_VERSION_2; - ackp->dl_current_state = the_stream->dlpi_state; - ackp->dl_mac_type = the_stream->framing_8022 ? DL_CSMACD : DL_ETHER; - ackp->dl_reserved = 0; - ackp->dl_qos_length = 0; - ackp->dl_qos_offset = (uint32)DL_UNKNOWN; - ackp->dl_qos_range_length = 0; - ackp->dl_qos_range_offset = (uint32)DL_UNKNOWN; - ackp->dl_growth = 0; - ackp->dl_min_sdu = 1; - ackp->dl_max_sdu = kEnetTSDU - hdrlen; - - // Address fields - ackp->dl_sap_length = -saplen; // Negative to indicate sap follows physical address - ackp->dl_addr_length = addrlen + saplen; - ackp->dl_addr_offset = sizeof(dl_info_ack_t); - T8022AddressStruct *boundAddr = ((T8022AddressStruct *)(ack_mp->b_rptr + ackp->dl_addr_offset)); - OTCopy48BitAddress(hardware_address, boundAddr->fHWAddr); - if (saplen) { - boundAddr->fSAP = the_stream->dlsap; - if (the_stream->flags & kSnapStream) - OTCopy8022SNAP(the_stream->snap, boundAddr->fSNAP); - } - ackp->dl_brdcst_addr_length = bcastlen; - ackp->dl_brdcst_addr_offset = sizeof(dl_info_ack_t) + addrlen + saplen; - OTSet48BitBroadcastAddress(ack_mp->b_rptr + ackp->dl_brdcst_addr_offset); - - // Advance write pointer - ack_mp->b_wptr += sizeof(dl_info_ack_t) + addrlen + saplen + bcastlen; - - // Free request - freemsg(mp); - - // Send reply - qreply(q, ack_mp); - return; -} - - -/* - * Handle DL_PHYS_ADDR_REQ (report physical address) - */ - -static void DLPI_phys_addr(DLPIStream *the_stream, queue_t *q, mblk_t *mp) -{ - D(bug(" DLPI_phys_addr(%p,%p)\n", the_stream, mp)); - dl_phys_addr_req_t *req = (dl_phys_addr_req_t *)(void *)mp->b_rptr; - - // Allocate message block for reply - mblk_t *ack_mp; - if ((ack_mp = allocb(sizeof(dl_phys_addr_ack_t) + kEnetPhysicalAddressLength, BPRI_HI)) == NULL) { - DLPI_error_ack(the_stream, q, mp, DL_PHYS_ADDR_REQ, DL_SYSERR, MAC_ENOMEM); - return; - } - - // Set up message type - ack_mp->b_datap->db_type = M_PCPROTO; - dl_phys_addr_ack_t *ackp = (dl_phys_addr_ack_t *)(void *)ack_mp->b_wptr; - ackp->dl_primitive = DL_PHYS_ADDR_ACK; - - // Fill in address - ackp->dl_addr_length = kEnetPhysicalAddressLength; - ackp->dl_addr_offset = sizeof(dl_phys_addr_ack_t); - ack_mp->b_wptr += sizeof(dl_phys_addr_ack_t) + kEnetPhysicalAddressLength; - if (req->dl_addr_type == DL_CURR_PHYS_ADDR || req->dl_addr_type == DL_FACT_PHYS_ADDR) - OTCopy48BitAddress(hardware_address, ack_mp->b_rptr + ackp->dl_addr_offset); - else { - DLPI_error_ack(the_stream, q, mp, DL_PHYS_ADDR_REQ, DL_BADPRIM, 0); - return; - } - - // Free request - freemsg(mp); - - // Send reply - qreply(q, ack_mp); - return; -} - - -/* - * Handle DL_BIND_REQ (bind a stream) - */ - -static void DLPI_bind(DLPIStream *the_stream, queue_t *q, mblk_t *mp) -{ - dl_bind_req_t *req = (dl_bind_req_t *)(void *)mp->b_rptr; - uint32 sap = req->dl_sap; - D(bug(" DLPI_bind(%p,%p) SAP %04x\n", the_stream, mp, sap)); - - // Stream must be unbound - if (the_stream->dlpi_state != DL_UNBOUND) { - DLPI_error_ack(the_stream, q, mp, DL_BIND_REQ, DL_OUTSTATE, 0); - return; - } - - // We only support connectionless data link services - if (req->dl_service_mode != DL_CLDLS || req->dl_max_conind != 0) { - DLPI_error_ack(the_stream, q, mp, DL_BIND_REQ, DL_UNSUPPORTED, 0); - return; - } - - // Don't bind to 802.2 group saps, can't check 802.2 global sap (0xFF) - // because it looks like IPX - if ((sap <= kMax8022SAP) && (sap & 1)) { - DLPI_error_ack(the_stream, q, mp, DL_BIND_REQ, DL_BADADDR, 0); - return; - } - - if (classify_packet_type(sap, sap) == kPktUnknown) { - DLPI_error_ack(the_stream, q, mp, DL_BIND_REQ, DL_BADADDR, 0); - return; - } - - // Allocate message block for reply - mblk_t *ack_mp; - if ((ack_mp = allocb(sizeof(dl_bind_ack_t) + kEnetAndSAPAddressLength, BPRI_HI)) == NULL) { - DLPI_error_ack(the_stream, q, mp, DL_BIND_REQ, DL_SYSERR, MAC_ENOMEM); - return; - } - - // Set up message type - ack_mp->b_datap->db_type = M_PCPROTO; - dl_bind_ack_t *ackp = (dl_bind_ack_t *)(void *)ack_mp->b_rptr; - ackp->dl_primitive = DL_BIND_ACK; - - // Fill in other fields - ackp->dl_sap = sap; - ackp->dl_addr_length = kEnetAndSAPAddressLength; - ackp->dl_addr_offset = sizeof(dl_bind_ack_t); - ackp->dl_max_conind = 0; - ackp->dl_xidtest_flg = 0; - - T8022AddressStruct *addrInfo = (T8022AddressStruct *)(ack_mp->b_rptr + sizeof(dl_bind_ack_t)); - OTCopy48BitAddress(hardware_address, addrInfo->fHWAddr); - addrInfo->fSAP = sap; - - // Must move b_wptr past the address info data - ack_mp->b_wptr = ack_mp->b_rptr + sizeof(dl_bind_ack_t) + kEnetAndSAPAddressLength; - - // Set group SAP if necessary - the_stream->ClearAllGroupSAPs(); - if (sap <= kMax8022SAP) - the_stream->SetGroupSAP(k8022GlobalSAP); - - // The stream is now bound and idle - the_stream->dlpi_state = DL_IDLE; - the_stream->dlsap = sap; - the_stream->flags &= ~kSnapStream; - - // Free request - freemsg(mp); - - // Send reply - qreply(q, ack_mp); - return; -} - - -/* - * Handle DL_UNBIND_REQ (unbind a stream) - */ - -static void DLPI_unbind(DLPIStream *the_stream, queue_t *q, mblk_t *mp) -{ - D(bug(" DLPI_unbind(%p,%p)\n", the_stream, mp)); - - // Stream must be bound and idle - if (the_stream->dlpi_state != DL_IDLE) { - DLPI_error_ack(the_stream, q, mp, DL_UNBIND_REQ, DL_OUTSTATE, 0); - return; - } - - // Stream is now unbound - the_stream->dlpi_state = DL_UNBOUND; - the_stream->dlsap = 0; - - // Flush all pending outbound messages - flushq(q, FLUSHDATA); - - // Flush all inbound messages pending on the stream - flushq(RD(q), FLUSHDATA); - putnextctl1(RD(q), M_FLUSH, FLUSHRW); - - // Send reply - DLPI_ok_ack(the_stream, q, mp, DL_UNBIND_REQ); - return; -} - - -/* - * Handle DL_SUBS_BIND_REQ (register 802.2 SAP group addresses and SNAPs) - */ - -static void DLPI_subs_bind(DLPIStream *the_stream, queue_t *q, mblk_t *mp) -{ - dl_subs_bind_req_t *req = (dl_subs_bind_req_t *)(void *)mp->b_rptr; - uint8 *sap = ((uint8 *)req) + req->dl_subs_sap_offset; - int32 length = req->dl_subs_sap_length; - uint16 theSap = ntohs(*((uint16 *)sap)); - int32 error = 0; - D(bug(" DLPI_subs_bind(%p,%p) SAP %02x%02x%02x%02x%02x\n", the_stream, mp, sap[0], sap[1], sap[2], sap[3], sap[4])); - - // Stream must be idle - if (the_stream->dlpi_state != DL_IDLE) { - DLPI_error_ack(the_stream, q, mp, DL_SUBS_BIND_REQ, DL_OUTSTATE, 0); - return; - } - - // Check if address is valid - switch (req->dl_subs_bind_class) { - case DL_PEER_BIND: // Bind a group address - if (the_stream->dlsap <= kMax8022SAP) { - if ((theSap & 1) && (length == sizeof(theSap))) - the_stream->SetGroupSAP(theSap); - else - if (theSap == 0x0000) // special case to receive all 802.2 packets - the_stream->flags |= kAcceptAll8022Packets; - else - error = DL_BADADDR; - } else - error = DL_UNSUPPORTED; - break; - - case DL_HIERARCHICAL_BIND: // Bind an additional SNAP - if (the_stream->dlsap == kSNAPSAP) { - if (the_stream->flags & kSnapStream) - error = DL_TOOMANY; // only one SNAP binding allowed - else { - OTCopy8022SNAP(sap, the_stream->snap); - the_stream->flags |= kSnapStream; - } - } else - error = DL_BADADDR; - break; - - default: - error = DL_UNSUPPORTED; - break; - } - if (error) { - DLPI_error_ack(the_stream, q, mp, DL_SUBS_BIND_REQ, error, 0); - return; - } - - // Allocate message block for reply - mblk_t *ack_mp; - if ((ack_mp = allocb(sizeof(dl_subs_bind_ack_t) + length, BPRI_HI)) == NULL) { - DLPI_error_ack(the_stream, q, mp, DL_SUBS_BIND_REQ, DL_SYSERR, MAC_ENOMEM); - return; - } - - // Set up message type - ack_mp->b_datap->db_type = M_PCPROTO; - dl_subs_bind_ack_t *ackp = (dl_subs_bind_ack_t *)(void *)ack_mp->b_wptr; - memset(ackp, 0, sizeof(dl_subs_bind_ack_t) + length); - ackp->dl_primitive = DL_SUBS_BIND_ACK; - - // Fill in other fields - ackp->dl_subs_sap_length = length; - ackp->dl_subs_sap_offset = length ? sizeof(dl_subs_bind_ack_t) : 0; - ack_mp->b_wptr += sizeof(dl_subs_bind_ack_t); - if (length) - memcpy(ack_mp->b_wptr, sap, length); - ack_mp->b_wptr += length; - - // Free request - freemsg(mp); - - // Send reply - qreply(q, ack_mp); - return; -} - - -/* - * Handle DL_SUBS_UNBIND_REQ (unregister 802.2 SAP group addresses and snaps) - */ - -static void DLPI_subs_unbind(DLPIStream *the_stream, queue_t *q, mblk_t *mp) -{ - dl_subs_unbind_req_t *req = (dl_subs_unbind_req_t *)(void *)mp->b_rptr; - uint8 *sap = ((uint8 *)req) + req->dl_subs_sap_offset; - int32 length = req->dl_subs_sap_length; - int32 error = 0; - D(bug(" DLPI_subs_unbind(%p,%p) SAP %02x%02x%02x%02x%02x\n", the_stream, mp, sap[0], sap[1], sap[2], sap[3], sap[4])); - - // Stream must be idle - if (the_stream->dlpi_state != DL_IDLE) { - DLPI_error_ack(the_stream, q, mp, DL_SUBS_UNBIND_REQ, DL_OUTSTATE, 0); - return; - } - - // Check if we are unbinding from an address we are bound to - if (length == k8022SAPLength) { - if ((*sap & 1) && (*sap != kIPXSAP)) { - if (the_stream->dlsap <= kMax8022SAP) - the_stream->ClearGroupSAP(*sap); - else - error = DL_UNSUPPORTED; - } else - error = DL_BADADDR; - } else if (length == k8022SNAPLength) { - if (the_stream->dlsap == kSNAPSAP) { - if (the_stream->flags & kSnapStream) { - if (memcmp(the_stream->snap, sap, length) != 0) - error = DL_BADADDR; - } else - error = DL_BADADDR; - } else - error = DL_UNSUPPORTED; - } - if (error) { - DLPI_error_ack(the_stream, q, mp, DL_SUBS_UNBIND_REQ, error, 0); - return; - } - - // Stream is no longer bound to SNAP - the_stream->flags &= ~kSnapStream; - - // Send reply - DLPI_ok_ack(the_stream, q, mp, DL_SUBS_UNBIND_REQ); - return; -} - - -/* - * Handles DL_ENABMULTI_REQ (enable multicast address) - */ - -static void DLPI_enable_multi(DLPIStream *the_stream, queue_t *q, mblk_t *mp) -{ - dl_enabmulti_req_t* req = (dl_enabmulti_req_t*)(void *)mp->b_rptr; - uint8 *reqaddr = (uint8 *)(mp->b_rptr + req->dl_addr_offset); - D(bug(" DLPI_enable_multi(%p,%p) addr %02x%02x%02x%02x%02x%02x\n", the_stream, mp, reqaddr[0], reqaddr[1], reqaddr[2], reqaddr[3], reqaddr[4], reqaddr[5])); - - // Address must be a multicast address - if (get_address_type(reqaddr) != keaMulticast) { - DLPI_error_ack(the_stream, q, mp, DL_ENABMULTI_REQ, DL_BADADDR, 0); - return; - } - - // Address already in multicast list? - if (the_stream->IsMulticastRegistered(reqaddr)) { - DLPI_error_ack(the_stream, q, mp, DL_ENABMULTI_REQ, DL_BADADDR, 0); - return; - } - - // Tell add-on to enable multicast address - AO_enable_multicast(Host2MacAddr((uint8 *)reqaddr)); - - // Add new address to multicast list - uint8 *addr = Mac2HostAddr(Mac_sysalloc(kEnetPhysicalAddressLength)); - OTCopy48BitAddress(reqaddr, addr); - the_stream->AddMulticast(addr); - - // On receive now check multicast packets - the_stream->flags |= kAcceptMulticasts; - - // Send reply - DLPI_ok_ack(the_stream, q, mp, DL_ENABMULTI_REQ); - return; -} - - -/* - * Handles DL_DISABMULTI_REQ (disable multicast address) - */ - -static void DLPI_disable_multi(DLPIStream *the_stream, queue_t *q, mblk_t *mp) -{ - dl_disabmulti_req_t *req = (dl_disabmulti_req_t*)(void *)mp->b_rptr; - uint8 *reqaddr = (uint8 *)(mp->b_rptr + req->dl_addr_offset); - D(bug(" DLPI_disable_multi(%p,%p) addr %02x%02x%02x%02x%02x%02x\n", the_stream, mp, reqaddr[0], reqaddr[1], reqaddr[2], reqaddr[3], reqaddr[4], reqaddr[5])); - - // Address must be a multicast address - if (get_address_type(reqaddr) != keaMulticast) { - DLPI_error_ack(the_stream, q, mp, DL_DISABMULTI_REQ, DL_BADADDR, 0); - return; - } - - // Find address in multicast list - uint8 *addr = the_stream->IsMulticastRegistered(reqaddr); - if (addr == NULL) { - DLPI_error_ack(the_stream, q, mp, DL_DISABMULTI_REQ, DL_BADADDR, 0); - return; - } - - // Found, then remove - the_stream->RemoveMulticast(addr); - Mac_sysfree(Host2MacAddr(addr)); - - // Tell add-on to disable multicast address - AO_disable_multicast(Host2MacAddr((uint8 *)reqaddr)); - - // No longer check multicast packets if no multicast addresses are registered - if (the_stream->multicast_list == NULL) - the_stream->flags &= ~kAcceptMulticasts; - - // Send reply - DLPI_ok_ack(the_stream, q, mp, DL_DISABMULTI_REQ); - return; -} - - -/* - * Handle DL_UNITDATA_REQ (transmit packet) - */ - -static void DLPI_unit_data(DLPIStream *the_stream, queue_t *q, mblk_t *mp) -{ - D(bug(" DLPI_unit_data(%p,%p)\n", the_stream, mp)); - dl_unitdata_req_t *req = (dl_unitdata_req_t *)(void *)mp->b_rptr; - - // Stream must be idle - if (the_stream->dlpi_state != DL_IDLE) { - - // Not idle, send error response - dl_uderror_ind_t *errp; - mblk_t *bp; - - int i = sizeof(dl_uderror_ind_t) + req->dl_dest_addr_length; - if ((bp = allocb(i, BPRI_HI)) == NULL) { - freemsg(mp); - return; - } - bp->b_datap->db_type = M_PROTO; - errp = (dl_uderror_ind_t *)(void *)bp->b_wptr; - errp->dl_primitive = DL_UDERROR_IND; - errp->dl_errno = DL_OUTSTATE; - errp->dl_unix_errno = 0; - errp->dl_dest_addr_length = req->dl_dest_addr_length; - errp->dl_dest_addr_offset = sizeof(dl_uderror_ind_t); - bp->b_wptr += sizeof(dl_uderror_ind_t); - memcpy((uint8 *)bp->b_wptr, ((uint8 *)req) + req->dl_dest_addr_offset, req->dl_dest_addr_length); - bp->b_wptr += req->dl_dest_addr_length; - qreply(q, bp); - - freemsg(mp); - return; - } - - // Build packet header and transmit packet - if ((mp = build_tx_packet_header(the_stream, mp, false)) != NULL) - transmit_packet(mp); -} - - -/* - * Ethernet packet allocator - */ - -#if SIZEOF_VOID_P != 4 || REAL_ADDRESSING == 0 -static uint32 ether_packet = 0; // Ethernet packet (cached allocation) -static uint32 n_ether_packets = 0; // Number of ethernet packets allocated so far (should be at most 1) - -EthernetPacket::EthernetPacket() -{ - ++n_ether_packets; - if (ether_packet && n_ether_packets == 1) - packet = ether_packet; - else { - packet = Mac_sysalloc(1516); - assert(packet != 0); - Mac_memset(packet, 0, 1516); - if (ether_packet == 0) - ether_packet = packet; - } -} - -EthernetPacket::~EthernetPacket() -{ - --n_ether_packets; - if (packet != ether_packet) - Mac_sysfree(packet); - if (n_ether_packets > 0) { - bug("WARNING: Nested allocation of ethernet packets!\n"); - } -} -#endif diff --git a/SheepShaver/src/EthernetDriver/ether.h b/SheepShaver/src/EthernetDriver/ether.h deleted file mode 100644 index 7ea2c881..00000000 --- a/SheepShaver/src/EthernetDriver/ether.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * ether.h - SheepShaver Ethernet Device Driver - * - * SheepShaver (C) 1997-2005 Marc Hellwig and Christian Bauer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef ETHER_H -#define ETHER_H - -struct queue; -struct msgb; -typedef struct queue queue_t; -typedef struct msgb mblk_t; - -// Prototypes for exported functions -extern "C" { -#pragma export on -extern uint32 ValidateHardware(void *theID); -struct install_info; -extern install_info* GetOTInstallInfo(); -extern uint8 InitStreamModule(void *theID); -extern void TerminateStreamModule(void); -#pragma export off -} - -extern bool NativeInitStreamModule(void *); -extern void NativeTerminateStreamModule(void); - -extern int ether_open(queue_t *rdq, void *dev, int flag, int sflag, void *creds); -extern int ether_close(queue_t *rdq, int flag, void *creds); -extern int ether_wput(queue_t *q, mblk_t *mp); -extern int ether_rsrv(queue_t *q); - -// System specific and internal functions/data -extern void EtherInit(void); -extern void EtherExit(void); - -extern void EtherIRQ(void); - -extern void AO_get_ethernet_address(uint32 addr); -extern void AO_enable_multicast(uint32 addr); -extern void AO_disable_multicast(uint32 addr); -extern void AO_transmit_packet(uint32 mp); - -extern mblk_t *allocb(size_t size, int pri); -extern void OTEnterInterrupt(void); -extern void OTLeaveInterrupt(void); - -extern void ether_dispatch_packet(uint32 p, uint32 length); -extern void ether_packet_received(mblk_t *mp); - -extern bool ether_driver_opened; - -// Ethernet packet allocator (optimized for 32-bit platforms in real addressing mode) -class EthernetPacket { -#if SIZEOF_VOID_P == 4 && REAL_ADDRESSING - uint8 packet[1516]; - public: - uint32 addr(void) const { return (uint32)packet; } -#else - uint32 packet; - public: - EthernetPacket(); - ~EthernetPacket(); - uint32 addr(void) const { return packet; } -#endif -}; - -// Copy packet data from message block to linear buffer (must hold at -// least 1514 bytes), returns packet length -static inline int ether_msgb_to_buffer(uint32 mp, uint8 *p) -{ - int len = 0; - while (mp) { - uint32 size = ReadMacInt32(mp + 16) - ReadMacInt32(mp + 12); - Mac2Host_memcpy(p, ReadMacInt32(mp + 12), size); - len += size; - p += size; - mp = ReadMacInt32(mp + 8); - } - return len; -} - -extern int32 num_wput; -extern int32 num_error_acks; -extern int32 num_tx_packets; -extern int32 num_tx_raw_packets; -extern int32 num_tx_normal_packets; -extern int32 num_tx_buffer_full; -extern int32 num_rx_packets; -extern int32 num_ether_irq; -extern int32 num_unitdata_ind; -extern int32 num_rx_fastpath; -extern int32 num_rx_no_mem; -extern int32 num_rx_dropped; -extern int32 num_rx_stream_not_ready; -extern int32 num_rx_no_unitdata_mem; - -#endif diff --git a/SheepShaver/src/EthernetDriver/ether_defs.h b/SheepShaver/src/EthernetDriver/ether_defs.h deleted file mode 100644 index 72bb58ed..00000000 --- a/SheepShaver/src/EthernetDriver/ether_defs.h +++ /dev/null @@ -1,552 +0,0 @@ -/* - * ether_defs.h - Definitions for DLPI Ethernet Driver - * - * SheepShaver (C) 1997-2005 Marc Hellwig and Christian Bauer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef ETHER_DEFS_H -#define ETHER_DEFS_H - - -#if __MWERKS__ && __POWERPC__ -#ifndef PRAGMA_ALIGN_SUPPORTED -#define PRAGMA_ALIGN_SUPPORTED 1 -#endif -#define PACKED__ -#else -#define PACKED__ __attribute__ ((packed)) -#endif - - -/* - * Macros - */ - -// Get pointer to the read queue, assumes 'q' is a write queue ptr -#define RD(q) (&q[-1]) - -// Get pointer to the write queue, assumes 'q' is a read queue ptr -#define WR(q) (&q[1]) - -#define OTCompare48BitAddresses(p1, p2) \ - (*(const uint32*)((const uint8*)(p1)) == *(const uint32*)((const uint8*)(p2)) && \ - *(const uint16*)(((const uint8*)(p1))+4) == *(const uint16*)(((const uint8*)(p2))+4) ) - -#define OTCopy48BitAddress(p1, p2) \ - (*(uint32*)((uint8*)(p2)) = *(const uint32*)((const uint8*)(p1)), \ - *(uint16*)(((uint8*)(p2))+4) = *(const uint16*)(((const uint8*)(p1))+4) ) - -#define OTClear48BitAddress(p1) \ - (*(uint32*)((uint8*)(p1)) = 0, \ - *(uint16*)(((uint8*)(p1))+4) = 0 ) - -#define OTCompare8022SNAP(p1, p2) \ - (*(const uint32*)((const uint8*)(p1)) == *(const uint32*)((const uint8*)(p2)) && \ - *(((const uint8*)(p1))+4) == *(((const uint8*)(p2))+4) ) - -#define OTCopy8022SNAP(p1, p2) \ - (*(uint32*)((uint8*)(p2)) = *(const uint32*)((const uint8*)(p1)), \ - *(((uint8*)(p2))+4) = *(((const uint8*)(p1))+4) ) - -#define OTIs48BitBroadcastAddress(p1) \ - (*(uint32*)((uint8*)(p1)) == 0xffffffff && \ - *(uint16*)(((uint8*)(p1))+4) == 0xffff ) - -#define OTSet48BitBroadcastAddress(p1) \ - (*(uint32*)((uint8*)(p1)) = 0xffffffff, \ - *(uint16*)(((uint8*)(p1))+4) = 0xffff ) - -#define OTIs48BitZeroAddress(p1) \ - (*(uint32*)((uint8*)(p1)) == 0 && \ - *(uint16*)(((uint8*)(p1))+4) == 0 ) - - -/* - * Constants - */ - -enum { - // Address and packet lengths - kEnetPhysicalAddressLength = 6, - k8022SAPLength = 1, - k8022DLSAPLength = 2, - k8022SNAPLength = 5, - kMaxBoundAddrLength = 6 + 2 + 5, // addr/SAP/SNAP - kEnetAndSAPAddressLength = kEnetPhysicalAddressLength + k8022DLSAPLength, - kEnetPacketHeaderLength = (2 * kEnetPhysicalAddressLength) + k8022DLSAPLength, - k8022BasicHeaderLength = 3, // SSAP/DSAP/Control - k8022SNAPHeaderLength = k8022SNAPLength + k8022BasicHeaderLength, - kMinDIXSAP = 1501, - kEnetTSDU = 1514, - - // Special addresses - kSNAPSAP = 0xaa, - kMax8022SAP = 0xfe, - k8022GlobalSAP = 0xff, - kIPXSAP = 0xff, - - // DLPI interface states - DL_UNBOUND = 0, - - // Message types - M_DATA = 0, - M_PROTO = 1, - M_IOCTL = 14, - M_IOCACK = 129, - M_IOCNAK = 130, - M_PCPROTO = 131, // priority message - M_FLUSH = 134, - FLUSHDATA = 0, - FLUSHALL = 1, - FLUSHR = 1, - FLUSHW = 2, - FLUSHRW = 3, - - // DLPI primitives - DL_INFO_REQ = 0, - DL_BIND_REQ = 1, - DL_PEER_BIND = 1, - DL_HIERARCHICAL_BIND = 2, - DL_UNBIND_REQ = 2, - DL_INFO_ACK = 3, - DL_BIND_ACK = 4, - DL_ERROR_ACK = 5, - DL_OK_ACK = 6, - DL_UNITDATA_REQ = 7, - DL_UNITDATA_IND = 8, - DL_UDERROR_IND = 9, - DL_SUBS_UNBIND_REQ = 21, - DL_SUBS_BIND_REQ = 27, - DL_SUBS_BIND_ACK = 28, - DL_ENABMULTI_REQ = 29, - DL_DISABMULTI_REQ = 30, - DL_PHYS_ADDR_REQ = 49, - DL_PHYS_ADDR_ACK = 50, - DL_FACT_PHYS_ADDR = 1, - DL_CURR_PHYS_ADDR = 2, - - // DLPI states - DL_IDLE = 3, - - // DLPI error codes - DL_BADADDR = 1, // improper address format - DL_OUTSTATE = 3, // improper state - DL_SYSERR = 4, // UNIX system error - DL_UNSUPPORTED = 7, // service unsupported - DL_BADPRIM = 9, // primitive unknown - DL_NOTSUPPORTED = 18, // primitive not implemented - DL_TOOMANY = 19, // limit exceeded - - // errnos - MAC_ENXIO = 6, - MAC_ENOMEM = 12, - MAC_EINVAL = 22, - - // Various DLPI constants - DL_CLDLS = 2, // connectionless data link service - DL_STYLE1 = 0x500, - DL_VERSION_2 = 2, - DL_CSMACD = 0, - DL_ETHER = 4, - DL_UNKNOWN = -1, - - // ioctl() codes - I_OTSetFramingType = (('O' << 8) | 2), - kOTGetFramingValue = -1, - kOTFramingEthernet = 1, - kOTFramingEthernetIPX = 2, - kOTFramingEthernet8023 = 4, - kOTFraming8022 = 8, - I_OTSetRawMode = (('O' << 8) | 3), - DL_IOC_HDR_INFO = (('l' << 8) | 10), - - // Buffer allocation priority - BPRI_LO = 1, - BPRI_HI = 3, - - // Misc constants - kEnetModuleID = 7101 -}; - -enum EAddrType { - keaStandardAddress = 0, - keaMulticast, - keaBroadcast, - keaBadAddress -}; - - -/* - * Data member wrappers - */ - -// Forward declarations -struct datab; -struct msgb; -struct queue; -struct multicast_node; -struct DLPIStream; - -// Optimize for 32-bit big endian targets -#if defined(WORDS_BIGENDIAN) && (SIZEOF_VOID_P == 4) - -// Predefined member types -typedef int8 nw_int8; -typedef int16 nw_int16; -typedef int32 nw_int32; -typedef uint8 nw_uint8; -typedef uint16 nw_uint16; -typedef uint32 nw_uint32; -typedef int nw_bool; -typedef uint8 * nw_uint8_p; -typedef void * nw_void_p; -typedef datab * nw_datab_p; -typedef msgb * nw_msgb_p; -typedef queue * nw_queue_p; -typedef multicast_node *nw_multicast_node_p; -typedef DLPIStream * nw_DLPIStream_p; - -#else - -// Big-endian memory accessor -template< int nbytes > -struct nw_memory_helper; - -template<> -struct nw_memory_helper<1> { - static inline uint8 load(void *ptr) { return *((uint8 *)ptr); } - static inline void store(void *ptr, uint8 val) { *((uint8 *)ptr) = val; } -}; - -template<> -struct nw_memory_helper<2> { - static inline uint16 load(void *ptr) { return ntohs(*((uint16 *)ptr)); } - static inline void store(void *ptr, uint16 val) { *((uint16 *)ptr) = htons(val); } -}; - -template<> -struct nw_memory_helper<4> { - static inline uint32 load(void *ptr) { return ntohl(*((uint32 *)ptr)); } - static inline void store(void *ptr, uint32 val) { *((uint32 *)ptr) = htonl(val); } -}; - -// Scalar data member wrapper (specialise for pointer member types?) -template< class type, class public_type > -class nw_scalar_member_helper { - uint8 _pad[sizeof(type)]; -public: - operator public_type () const { - return (public_type)(uintptr)nw_memory_helper::load((void *)this); - } - public_type operator -> () const { - return this->operator public_type (); - } - nw_scalar_member_helper & operator = (public_type val) { - nw_memory_helper::store((void *)this, (type)(uintptr)val); - return *this; - } - nw_scalar_member_helper & operator += (int val) { - *this = *this + val; - return *this; - } - nw_scalar_member_helper & operator -= (int val) { - *this = *this - val; - return *this; - } - nw_scalar_member_helper & operator &= (int val) { - *this = *this & val; - return *this; - } - nw_scalar_member_helper & operator |= (int val) { - *this = *this | val; - return *this; - } -}; - -// Predefined member types -typedef nw_scalar_member_helper nw_int8; -typedef nw_scalar_member_helper nw_int16; -typedef nw_scalar_member_helper nw_int32; -typedef nw_scalar_member_helper nw_uint8; -typedef nw_scalar_member_helper nw_uint16; -typedef nw_scalar_member_helper nw_uint32; -typedef nw_scalar_member_helper nw_bool; -typedef nw_scalar_member_helper nw_uint8_p; -typedef nw_scalar_member_helper nw_void_p; -typedef nw_scalar_member_helper nw_datab_p; -typedef nw_scalar_member_helper nw_msgb_p; -typedef nw_scalar_member_helper nw_queue_p; -typedef nw_scalar_member_helper nw_multicast_node_p; -typedef nw_scalar_member_helper nw_DLPIStream_p; - -#endif - - -/* - * Structures - */ - -// Data block -struct datab { - nw_datab_p db_freep; - nw_uint8_p db_base; - nw_uint8_p db_lim; - nw_uint8 db_ref; - nw_uint8 db_type; - // ... -}; - -// Message block -struct msgb { - nw_msgb_p b_next; - nw_msgb_p b_prev; - nw_msgb_p b_cont; - nw_uint8_p b_rptr; - nw_uint8_p b_wptr; - nw_datab_p b_datap; - // ... -}; - -// Queue (full structure required because of size) -struct queue { - nw_void_p q_qinfo; - nw_msgb_p q_first; - nw_msgb_p q_last; - nw_queue_p q_next; - nw_queue_p q_link; - nw_DLPIStream_p q_ptr; - nw_uint32 q_count; - nw_int32 q_minpsz; - nw_int32 q_maxpsz; - nw_uint32 q_hiwat; - nw_uint32 q_lowat; - nw_void_p q_bandp; - nw_uint16 q_flag; - nw_uint8 q_nband; - uint8 _q_pad1[1]; - nw_void_p q_osx; - nw_queue_p q_ffcp; - nw_queue_p q_bfcp; -}; -typedef struct queue queue_t; - -// M_IOCTL parameters -struct iocblk { - nw_int32 ioc_cmd; - nw_void_p ioc_cr; - nw_uint32 ioc_id; - nw_uint32 ioc_count; - nw_int32 ioc_error; - nw_int32 ioc_rval; - int32 _ioc_filler[4]; -}; - -// Priority specification -struct dl_priority_t { - nw_int32 dl_min, dl_max; -}; - -// DPLI primitives -struct dl_info_req_t { - nw_uint32 dl_primitive; // DL_INFO_REQ -}; - -struct dl_info_ack_t { - nw_uint32 dl_primitive; // DL_INFO_ACK - nw_uint32 dl_max_sdu; - nw_uint32 dl_min_sdu; - nw_uint32 dl_addr_length; - nw_uint32 dl_mac_type; - nw_uint32 dl_reserved; - nw_uint32 dl_current_state; - nw_int32 dl_sap_length; - nw_uint32 dl_service_mode; - nw_uint32 dl_qos_length; - nw_uint32 dl_qos_offset; - nw_uint32 dl_qos_range_length; - nw_uint32 dl_qos_range_offset; - nw_uint32 dl_provider_style; - nw_uint32 dl_addr_offset; - nw_uint32 dl_version; - nw_uint32 dl_brdcst_addr_length; - nw_uint32 dl_brdcst_addr_offset; - nw_uint32 dl_growth; -}; - -struct dl_bind_req_t { - nw_uint32 dl_primitive; // DL_BIND_REQ - nw_uint32 dl_sap; - nw_uint32 dl_max_conind; - nw_uint16 dl_service_mode; - nw_uint16 dl_conn_mgmt; - nw_uint32 dl_xidtest_flg; -}; - -struct dl_bind_ack_t { - nw_uint32 dl_primitive; // DL_BIND_ACK - nw_uint32 dl_sap; - nw_uint32 dl_addr_length; - nw_uint32 dl_addr_offset; - nw_uint32 dl_max_conind; - nw_uint32 dl_xidtest_flg; -}; - -struct dl_error_ack_t { - nw_uint32 dl_primitive; // DL_ERROR_ACK - nw_uint32 dl_error_primitive; - nw_uint32 dl_errno; - nw_uint32 dl_unix_errno; -}; - -struct dl_ok_ack_t { - nw_uint32 dl_primitive; // DL_ERROR_ACK - nw_uint32 dl_correct_primitive; -}; - -struct dl_unitdata_req_t { - nw_uint32 dl_primitive; // DL_UNITDATA_REQ - nw_uint32 dl_dest_addr_length; - nw_uint32 dl_dest_addr_offset; - dl_priority_t dl_priority; -}; - -struct dl_unitdata_ind_t { - nw_uint32 dl_primitive; // DL_UNITDATA_IND - nw_uint32 dl_dest_addr_length; - nw_uint32 dl_dest_addr_offset; - nw_uint32 dl_src_addr_length; - nw_uint32 dl_src_addr_offset; - nw_uint32 dl_group_address; -}; - -struct dl_uderror_ind_t { - nw_uint32 dl_primitive; // DL_UDERROR_IND - nw_uint32 dl_dest_addr_length; - nw_uint32 dl_dest_addr_offset; - nw_uint32 dl_unix_errno; - nw_uint32 dl_errno; -}; - -struct dl_subs_bind_req_t { - nw_uint32 dl_primitive; // DL_SUBS_BIND_REQ - nw_uint32 dl_subs_sap_offset; - nw_uint32 dl_subs_sap_length; - nw_uint32 dl_subs_bind_class; -}; - -struct dl_subs_bind_ack_t { - nw_uint32 dl_primitive; // DL_SUBS_BIND_ACK - nw_uint32 dl_subs_sap_offset; - nw_uint32 dl_subs_sap_length; -}; - -struct dl_subs_unbind_req_t { - nw_uint32 dl_primitive; // DL_SUBS_UNBIND_REQ - nw_uint32 dl_subs_sap_offset; - nw_uint32 dl_subs_sap_length; -}; - -struct dl_enabmulti_req_t { - nw_uint32 dl_primitive; // DL_ENABMULTI_REQ - nw_uint32 dl_addr_length; - nw_uint32 dl_addr_offset; -}; - -struct dl_disabmulti_req_t { - nw_uint32 dl_primitive; // DL_DISABMULTI_REQ - nw_uint32 dl_addr_length; - nw_uint32 dl_addr_offset; -}; - -struct dl_phys_addr_req_t { - nw_uint32 dl_primitive; // DL_PHYS_ADDR_REQ - nw_uint32 dl_addr_type; -}; - -struct dl_phys_addr_ack_t { - nw_uint32 dl_primitive; // DL_PHYS_ADDR_ACK - nw_uint32 dl_addr_length; - nw_uint32 dl_addr_offset; -}; - -// Parameters for I_OTSetRawMode/kOTSetRecvMode ioctl() -struct dl_recv_control_t { - nw_uint32 dl_primitive; - nw_uint32 dl_flags; - nw_uint32 dl_truncation_length; -}; - -union DL_primitives { - nw_uint32 dl_primitive; - dl_info_req_t info_req; - dl_info_ack_t info_ack; - dl_bind_req_t bind_req; - dl_bind_ack_t bind_ack; - dl_error_ack_t error_ack; - dl_ok_ack_t ok_ack; - dl_unitdata_req_t unitdata_req; - dl_unitdata_ind_t unitdata_ind; - dl_uderror_ind_t uderror_ind; - dl_subs_bind_req_t subs_bind_req; - dl_subs_bind_ack_t subs_bind_ack; - dl_subs_unbind_req_t subs_unbind_req; - dl_enabmulti_req_t enabmulti_req; - dl_disabmulti_req_t disabmulti_req; - dl_phys_addr_req_t phys_addr_req; - dl_phys_addr_ack_t phys_addr_ack; -}; - -#ifdef PRAGMA_ALIGN_SUPPORTED -#pragma options align=mac68k -#endif - -// Packet headers -struct EnetPacketHeader { - uint8 fDestAddr[6]; - uint8 fSourceAddr[6]; - nw_uint16 fProto; -} PACKED__; - -struct T8022Header { - uint8 fDSAP; - uint8 fSSAP; - uint8 fCtrl; -} PACKED__; - -struct T8022SNAPHeader { - uint8 fDSAP; - uint8 fSSAP; - uint8 fCtrl; - uint8 fSNAP[k8022SNAPLength]; -} PACKED__; - -struct T8022FullPacketHeader { - EnetPacketHeader fEnetPart; - T8022SNAPHeader f8022Part; -} PACKED__; - -struct T8022AddressStruct { - uint8 fHWAddr[6]; - nw_uint16 fSAP; - uint8 fSNAP[k8022SNAPLength]; -} PACKED__; - -#ifdef PRAGMA_ALIGN_SUPPORTED -#pragma options align=reset -#endif - -#endif diff --git a/SheepShaver/src/EthernetDriver/ethernet.ndrv b/SheepShaver/src/EthernetDriver/ethernet.ndrv deleted file mode 100644 index 02eed8b3dcb9d381caebfc70ef1d7e81740c7458..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11780 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 #include #include #define DEBUG 0 #include "debug.h" /* * Find symbol in shared library (using CFM) * lib and sym must be Pascal strings! */ typedef OpaqueCFragConnectionID * ConnectionID; typedef unsigned char SymClass; static uint32 FindLibSymbol(Str63 lib, Str255 sym) { ConnectionID conn_id = 0; Ptr main_addr = NULL; Str255 err = ""; Ptr sym_addr = NULL; SymClass sym_class = 0; int16 res; res = GetSharedLibrary(lib, FOURCC('p','w','p','c'), 1, &conn_id, &main_addr, err); D(bug(" GetSharedLibrary: ret %d, connection ID %ld, main %p\n", res, conn_id, main_addr)); if (res) return NULL; res = FindSymbol(conn_id, sym, &sym_addr, &sym_class); D(bug(" FindSymbol: ret %d, sym_addr %p, sym_class %ld\n", res, sym_addr, sym_class));//!!?? CloseConnection(&conn_id); if (res) return NULL; else return (uint32)sym_addr; } uint32 FindLibSymbol(char *lib_name, char *sym_name) { Str63 lib; memcpy(&lib[0], lib_name, lib_name[0]+1); Str255 sym; memcpy(&sym[0], sym_name, sym_name[0]+1); return FindLibSymbol(lib, sym); } /* * Memory allocators in MacOS system heap zone */ uint32 Mac_sysalloc(uint32 size) { return (uint32)NewPtrSys(size); } void Mac_sysfree(uint32 addr) { DisposePtr((char *)addr); } /* * Glue for calling MacOS routines */ #define prolog ;\ mflr r0 ;\ stw r0,8(r1) ;\ stw r2,12(r1) ;\ stwu r1,-64(r1) ;\ lwz r0,0(r3) ;\ lwz r2,4(r3) ;\ mtctr r0 #define epilog ;\ bctrl ;\ lwz r0,64+8(r1) ;\ lwz r2,64+12(r1);\ mtlr r0 ;\ addi r1,r1,64 ;\ blr asm uint32 call_macos(register uint32 tvect) { prolog epilog } asm uint32 call_macos1(register uint32 tvect, register uint32 arg1) { prolog mr r3,r4 epilog } asm uint32 call_macos2(register uint32 tvect, register uint32 arg1, register uint32 arg2) { prolog mr r3,r4 mr r4,r5 epilog } asm uint32 call_macos3(register uint32 tvect, register uint32 arg1, register uint32 arg2, register uint32 arg3) { prolog mr r3,r4 mr r4,r5 mr r5,r6 epilog } asm uint32 call_macos4(register uint32 tvect, register uint32 arg1, register uint32 arg2, register uint32 arg3, register uint32 arg4) { prolog mr r3,r4 mr r4,r5 mr r5,r6 mr r6,r7 epilog } asm uint32 call_macos5(register uint32 tvect, register uint32 arg1, register uint32 arg2, register uint32 arg3, register uint32 arg4, register uint32 arg5) { prolog mr r3,r4 mr r4,r5 mr r5,r6 mr r6,r7 mr r7,r8 epilog } asm uint32 call_macos6(register uint32 tvect, register uint32 arg1, register uint32 arg2, register uint32 arg3, register uint32 arg4, register uint32 arg5, register uint32 arg6) { prolog mr r3,r4 mr r4,r5 mr r5,r6 mr r6,r7 mr r7,r8 mr r8,r9 epilog } asm uint32 call_macos7(register uint32 tvect, register uint32 arg1, register uint32 arg2, register uint32 arg3, register uint32 arg4, register uint32 arg5, register uint32 arg6, register uint32 arg7) { prolog mr r3,r4 mr r4,r5 mr r5,r6 mr r6,r7 mr r7,r8 mr r8,r9 mr r9,r10 epilog } /* * Some standard C library implementations */ extern "C" void *memcpy(void *dest, const void *src, size_t n); void *memcpy(void *dest, const void *src, size_t n) { BlockMoveData(src, dest, n); return dest; } extern "C" void *memset(void *s, int c, size_t n); void *memset(void *s, int c, size_t n) { if (c == 0) BlockZero(s, n); else { char *p = (char *)s; n++; while (--n) *p++ = c; } return s; } extern "C" int memcmp(const void *s1, const void *s2, size_t n); int memcmp(const void *s1, const void *s2, size_t n) { const unsigned char *d = (const unsigned char *)s1; const unsigned char *s = (const unsigned char *)s2; n++; while (--n) { int r; if (r = (*d - *s)) return r; ++d; ++s; } return 0; } extern "C" int printf(const char *format, ...); int printf(const char *format, ...) { return 0; } \ No newline at end of file diff --git a/SheepShaver/src/EthernetDriver/macos_util.h b/SheepShaver/src/EthernetDriver/macos_util.h deleted file mode 100644 index 20cc5ec4..00000000 --- a/SheepShaver/src/EthernetDriver/macos_util.h +++ /dev/null @@ -1 +0,0 @@ -#ifndef MACOS_UTIL_H #define MACOS_UTIL_H // Macro for calling MacOS routines #define CallMacOS(type, tvect) call_macos((uintptr)tvect) #define CallMacOS1(type, tvect, arg1) call_macos1((uintptr)tvect, (uintptr)arg1) #define CallMacOS2(type, tvect, arg1, arg2) call_macos2((uintptr)tvect, (uintptr)arg1, (uintptr)arg2) #define CallMacOS3(type, tvect, arg1, arg2, arg3) call_macos3((uintptr)tvect, (uintptr)arg1, (uintptr)arg2, (uintptr)arg3) #define CallMacOS4(type, tvect, arg1, arg2, arg3, arg4) call_macos4((uintptr)tvect, (uintptr)arg1, (uintptr)arg2, (uintptr)arg3, (uintptr)arg4) #define CallMacOS5(type, tvect, arg1, arg2, arg3, arg4, arg5) call_macos5((uintptr)tvect, (uintptr)arg1, (uintptr)arg2, (uintptr)arg3, (uintptr)arg4, (uintptr)arg5) #define CallMacOS6(type, tvect, arg1, arg2, arg3, arg4, arg5, arg6) call_macos6((uintptr)tvect, (uintptr)arg1, (uintptr)arg2, (uintptr)arg3, (uintptr)arg4, (uintptr)arg5, (uintptr)arg6) #define CallMacOS7(type, tvect, arg1, arg2, arg3, arg4, arg5, arg6, arg7) call_macos7((uintptr)tvect, (uintptr)arg1, (uintptr)arg2, (uintptr)arg3, (uintptr)arg4, (uintptr)arg5, (uintptr)arg6, (uintptr)arg7) #ifdef __cplusplus extern "C" { #endif extern uint32 call_macos(uint32 tvect); extern uint32 call_macos1(uint32 tvect, uint32 arg1); extern uint32 call_macos2(uint32 tvect, uint32 arg1, uint32 arg2); extern uint32 call_macos3(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3); extern uint32 call_macos4(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4); extern uint32 call_macos5(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5); extern uint32 call_macos6(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5, uint32 arg6); extern uint32 call_macos7(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5, uint32 arg6, uint32 arg7); #ifdef __cplusplus } #endif // Construct four-character-code from string #define FOURCC(a,b,c,d) (((uint32)(a) << 24) | ((uint32)(b) << 16) | ((uint32)(c) << 8) | (uint32)(d)) extern uint32 FindLibSymbol(char *lib, char *sym); // Find symbol in shared library extern uint32 Mac_sysalloc(uint32 size); // Allocate block in MacOS system heap zone extern void Mac_sysfree(uint32 addr); // Release block occupied by the nonrelocatable block p #endif /* MACOS_UTIL_H */ \ No newline at end of file diff --git a/SheepShaver/src/EthernetDriver/sysdeps.h b/SheepShaver/src/EthernetDriver/sysdeps.h deleted file mode 100644 index ffd90e06..00000000 --- a/SheepShaver/src/EthernetDriver/sysdeps.h +++ /dev/null @@ -1 +0,0 @@ -#ifndef SYSDEPS_H #define SYSDEPS_H #include #define SIZEOF_VOID_P 4 #define WORDS_BIGENDIAN 1 #define REAL_ADDRESSING 1 /* Define to build the Ethernet driver completly in MacOS space */ #define BUILD_ETHER_FULL_DRIVER 1 #define ntohl(x) ((uint32)(x)) #define ntohs(x) ((uint16)(x)) #define assert(expr) typedef int bool; typedef signed char int8; typedef signed short int16; typedef signed int int32; typedef unsigned char uint8; typedef unsigned short uint16; typedef unsigned int uint32; typedef uint32 uintptr; #endif /* SYSDEPS_H */ \ No newline at end of file diff --git a/SheepShaver/src/EthernetDriver/xlowmem.h b/SheepShaver/src/EthernetDriver/xlowmem.h deleted file mode 100644 index a37282b3..00000000 --- a/SheepShaver/src/EthernetDriver/xlowmem.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * xlowmem.h - Definitions for extra Low Memory globals (0x2800..) - * - * SheepShaver (C) 1997-2005 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef XLOWMEM_H -#define XLOWMEM_H - -// Modes for XLM_RUN_MODE -#define MODE_68K 0 // 68k emulator active -#define MODE_NATIVE 1 // Switched to native mode -#define MODE_EMUL_OP 2 // 68k emulator active, within EMUL_OP routine - -#define XLM_SIGNATURE 0x2800 // SheepShaver signature -#define XLM_KERNEL_DATA 0x2804 // Pointer to Kernel Data -#define XLM_TOC 0x2808 // TOC pointer of emulator -#define XLM_SHEEP_OBJ 0x280c // Pointer to SheepShaver object -#define XLM_RUN_MODE 0x2810 // Current run mode, see enum above -#define XLM_68K_R25 0x2814 // Contents of the 68k emulator's r25 (which contains the interrupt level), saved upon entering EMUL_OP mode, used by Execute68k() and the USR1 signal handler -#define XLM_IRQ_NEST 0x2818 // Interrupt disable nesting counter (>0: disabled) -#define XLM_PVR 0x281c // Theoretical PVR -#define XLM_BUS_CLOCK 0x2820 // Bus clock speed in Hz (for DriverServicesLib patch) -#define XLM_EMUL_RETURN_PROC 0x2824 // Pointer to EMUL_RETURN routine -#define XLM_EXEC_RETURN_PROC 0x2828 // Pointer to EXEC_RETURN routine -#define XLM_EMUL_OP_PROC 0x282c // Pointer to EMUL_OP routine -#define XLM_EMUL_RETURN_STACK 0x2830 // Stack pointer for EMUL_RETURN -#define XLM_RES_LIB_TOC 0x2834 // TOC pointer of Resources library -#define XLM_GET_RESOURCE 0x2838 // Pointer to native GetResource() routine -#define XLM_GET_1_RESOURCE 0x283c // Pointer to native Get1Resource() routine -#define XLM_GET_IND_RESOURCE 0x2840 // Pointer to native GetIndResource() routine -#define XLM_GET_1_IND_RESOURCE 0x2844 // Pointer to native Get1IndResource() routine -#define XLM_R_GET_RESOURCE 0x2848 // Pointer to native RGetResource() routine -#define XLM_EXEC_RETURN_OPCODE 0x284c // EXEC_RETURN opcode for Execute68k() -#define XLM_ZERO_PAGE 0x2850 // Pointer to read-only page with all bits set to 0 -#define XLM_R13 0x2854 // Pointer to .sdata section (Linux) - -#define XLM_ETHER_AO_GET_HWADDR 0x28b0 // Pointer to ethernet A0_get_ethernet_address() function -#define XLM_ETHER_AO_ADD_MULTI 0x28b4 // Pointer to ethernet A0_enable_multicast() function -#define XLM_ETHER_AO_DEL_MULTI 0x28b8 // Pointer to ethernet A0_disable_multicast() function -#define XLM_ETHER_AO_SEND_PACKET 0x28bc // Pointer to ethernet A0_transmit_packet() function -#define XLM_ETHER_INIT 0x28c0 // Pointer to ethernet InitStreamModule() function -#define XLM_ETHER_TERM 0x28c4 // Pointer to ethernet TerminateStreamModule() function -#define XLM_ETHER_OPEN 0x28c8 // Pointer to ethernet ether_open() function -#define XLM_ETHER_CLOSE 0x28cc // Pointer to ethernet ether_close() function -#define XLM_ETHER_WPUT 0x28d0 // Pointer to ethernet ether_wput() function -#define XLM_ETHER_RSRV 0x28d4 // Pointer to ethernet ether_rsrv() function -#define XLM_VIDEO_DOIO 0x28d8 // Pointer to video DoDriverIO() function - -#endif diff --git a/SheepShaver/src/EthernetDriverFull.i b/SheepShaver/src/EthernetDriverFull.i deleted file mode 100644 index 80df6395..00000000 --- a/SheepShaver/src/EthernetDriverFull.i +++ /dev/null @@ -1,737 +0,0 @@ - 0x4a, 0x6f, 0x79, 0x21, 0x70, 0x65, 0x66, 0x66, 0x70, 0x77, 0x70, 0x63, 0x00, 0x00, 0x00, 0x01, - 0xd1, 0x9b, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x28, 0xa4, 0x00, 0x00, 0x28, 0xa4, 0x00, 0x00, 0x28, 0xa4, 0x00, 0x00, 0x02, 0x20, - 0x00, 0x04, 0x04, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x08, - 0x00, 0x00, 0x04, 0xd8, 0x00, 0x00, 0x03, 0x34, 0x00, 0x00, 0x2a, 0xd0, 0x02, 0x01, 0x04, 0x00, - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x96, 0x00, 0x00, 0x00, 0x80, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x01, 0x40, - 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x0d, 0x02, 0x00, 0x00, 0x17, 0x02, 0x00, 0x00, 0x21, 0x02, 0x00, 0x00, 0x2f, - 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, - 0x00, 0x00, 0x00, 0x00, 0x4a, 0x05, 0x42, 0x27, 0x80, 0x4b, 0x46, 0x08, 0x09, 0xc1, 0x01, 0x43, - 0x00, 0x41, 0x00, 0x41, 0x00, 0x42, 0x00, 0x41, 0x00, 0x42, 0x00, 0x81, 0x81, 0xc7, 0x40, 0x31, - 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x4c, 0x69, 0x62, 0x00, 0x42, 0x6c, 0x6f, - 0x63, 0x6b, 0x5a, 0x65, 0x72, 0x6f, 0x00, 0x4e, 0x65, 0x77, 0x50, 0x74, 0x72, 0x53, 0x79, 0x73, - 0x00, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4d, 0x6f, 0x76, 0x65, 0x44, 0x61, 0x74, 0x61, 0x00, 0x47, - 0x65, 0x74, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x00, - 0x46, 0x69, 0x6e, 0x64, 0x53, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x00, 0x44, 0x69, 0x73, 0x70, 0x6f, - 0x73, 0x65, 0x50, 0x74, 0x72, 0x00, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x53, - 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x54, 0x68, 0x65, 0x44, 0x72, - 0x69, 0x76, 0x65, 0x72, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, - 0x6e, 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x47, - 0x65, 0x74, 0x4f, 0x54, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x56, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x00, - 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, 0x04, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, - 0x00, 0x15, 0x5e, 0x85, 0x00, 0x14, 0xbd, 0xe0, 0x00, 0x10, 0x8f, 0x84, 0x00, 0x10, 0xae, 0x97, - 0x00, 0x10, 0x4e, 0x3c, 0x02, 0x00, 0x00, 0x56, 0x00, 0x00, 0x01, 0x34, 0x00, 0x01, 0x01, 0x00, - 0x00, 0x6b, 0x00, 0x00, 0x01, 0x4c, 0x00, 0x01, 0x02, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x01, 0x3c, - 0x00, 0x01, 0x02, 0x00, 0x00, 0x8f, 0x00, 0x00, 0x01, 0x04, 0x00, 0x01, 0x02, 0x00, 0x00, 0x9f, - 0x00, 0x00, 0x01, 0x0c, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x38, 0x60, 0x00, 0x00, 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x38, 0x62, 0x02, 0x44, 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x08, 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x41, 0x00, 0x0c, - 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xc0, 0x80, 0x00, 0x28, 0xc0, 0x80, 0x40, 0x28, 0x08, - 0x7c, 0x08, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x21, 0x80, 0x01, 0x00, 0x48, 0x80, 0x41, 0x00, 0x4c, - 0x7c, 0x08, 0x03, 0xa6, 0x38, 0x21, 0x00, 0x40, 0x4e, 0x80, 0x00, 0x20, 0x80, 0x01, 0x00, 0x08, - 0x7c, 0x08, 0x03, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x08, 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x41, 0x00, 0x0c, - 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xc0, 0x80, 0x00, 0x28, 0xc4, 0x80, 0x40, 0x28, 0x08, - 0x7c, 0x08, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x21, 0x80, 0x01, 0x00, 0x48, 0x80, 0x41, 0x00, 0x4c, - 0x7c, 0x08, 0x03, 0xa6, 0x38, 0x21, 0x00, 0x40, 0x4e, 0x80, 0x00, 0x20, 0x80, 0x01, 0x00, 0x08, - 0x7c, 0x08, 0x03, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x08, 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x41, 0x00, 0x0c, - 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xc0, 0x80, 0x00, 0x28, 0xb0, 0x80, 0x40, 0x28, 0x08, - 0x7c, 0x08, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x21, 0x80, 0x01, 0x00, 0x48, 0x80, 0x41, 0x00, 0x4c, - 0x7c, 0x08, 0x03, 0xa6, 0x38, 0x21, 0x00, 0x40, 0x4e, 0x80, 0x00, 0x20, 0x80, 0x01, 0x00, 0x08, - 0x7c, 0x08, 0x03, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x08, 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x41, 0x00, 0x0c, - 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xc0, 0x80, 0x00, 0x28, 0xb4, 0x80, 0x40, 0x28, 0x08, - 0x7c, 0x08, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x21, 0x80, 0x01, 0x00, 0x48, 0x80, 0x41, 0x00, 0x4c, - 0x7c, 0x08, 0x03, 0xa6, 0x38, 0x21, 0x00, 0x40, 0x4e, 0x80, 0x00, 0x20, 0x80, 0x01, 0x00, 0x08, - 0x7c, 0x08, 0x03, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x08, 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x41, 0x00, 0x0c, - 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xc0, 0x80, 0x00, 0x28, 0xb8, 0x80, 0x40, 0x28, 0x08, - 0x7c, 0x08, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x21, 0x80, 0x01, 0x00, 0x48, 0x80, 0x41, 0x00, 0x4c, - 0x7c, 0x08, 0x03, 0xa6, 0x38, 0x21, 0x00, 0x40, 0x4e, 0x80, 0x00, 0x20, 0x80, 0x01, 0x00, 0x08, - 0x7c, 0x08, 0x03, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x08, 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x41, 0x00, 0x0c, - 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xc0, 0x80, 0x00, 0x28, 0xbc, 0x80, 0x40, 0x28, 0x08, - 0x7c, 0x08, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x21, 0x80, 0x01, 0x00, 0x48, 0x80, 0x41, 0x00, 0x4c, - 0x7c, 0x08, 0x03, 0xa6, 0x38, 0x21, 0x00, 0x40, 0x4e, 0x80, 0x00, 0x20, 0x80, 0x01, 0x00, 0x08, - 0x7c, 0x08, 0x03, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7c, 0x08, 0x02, 0xa6, 0x7c, 0x85, 0x23, 0x78, 0x90, 0x01, 0x00, 0x08, 0x7c, 0x60, 0x1b, 0x78, - 0x7c, 0x04, 0x03, 0x78, 0x94, 0x21, 0xff, 0xc0, 0x80, 0x62, 0x00, 0xfc, 0x48, 0x00, 0x23, 0xd5, - 0x80, 0x01, 0x00, 0x48, 0x38, 0x21, 0x00, 0x40, 0x7c, 0x08, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, - 0xbf, 0xa1, 0xff, 0xf4, 0x7c, 0x08, 0x02, 0xa6, 0x3b, 0xe2, 0x05, 0x00, 0x3b, 0xa2, 0x02, 0xde, - 0x3b, 0xc2, 0x02, 0x62, 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xb0, 0x80, 0x1f, 0x00, 0x00, - 0x2c, 0x00, 0x00, 0x00, 0x41, 0x82, 0x00, 0x0c, 0x38, 0x60, 0x00, 0x01, 0x48, 0x00, 0x02, 0x68, - 0x38, 0x00, 0x00, 0x00, 0x38, 0x82, 0x02, 0x6f, 0x7f, 0xc3, 0xf3, 0x78, 0x90, 0x1f, 0x00, 0x00, - 0x48, 0x00, 0x22, 0x61, 0x90, 0x62, 0x00, 0xfc, 0x28, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x0c, - 0x38, 0x60, 0x00, 0x00, 0x48, 0x00, 0x02, 0x40, 0x38, 0x82, 0x02, 0x77, 0x7f, 0xc3, 0xf3, 0x78, - 0x48, 0x00, 0x22, 0x41, 0x90, 0x62, 0x00, 0xf8, 0x28, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x0c, - 0x38, 0x60, 0x00, 0x00, 0x48, 0x00, 0x02, 0x20, 0x38, 0x82, 0x02, 0x7e, 0x7f, 0xc3, 0xf3, 0x78, - 0x48, 0x00, 0x22, 0x21, 0x90, 0x62, 0x00, 0xf4, 0x28, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x0c, - 0x38, 0x60, 0x00, 0x00, 0x48, 0x00, 0x02, 0x00, 0x38, 0x82, 0x02, 0x87, 0x7f, 0xc3, 0xf3, 0x78, - 0x48, 0x00, 0x22, 0x01, 0x90, 0x62, 0x00, 0xf0, 0x28, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x0c, - 0x38, 0x60, 0x00, 0x00, 0x48, 0x00, 0x01, 0xe0, 0x38, 0x82, 0x02, 0x8e, 0x7f, 0xc3, 0xf3, 0x78, - 0x48, 0x00, 0x21, 0xe1, 0x90, 0x62, 0x00, 0xec, 0x28, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x0c, - 0x38, 0x60, 0x00, 0x00, 0x48, 0x00, 0x01, 0xc0, 0x38, 0x82, 0x02, 0x96, 0x7f, 0xc3, 0xf3, 0x78, - 0x48, 0x00, 0x21, 0xc1, 0x90, 0x62, 0x00, 0xe8, 0x28, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x0c, - 0x38, 0x60, 0x00, 0x00, 0x48, 0x00, 0x01, 0xa0, 0x38, 0x82, 0x02, 0x9c, 0x7f, 0xc3, 0xf3, 0x78, - 0x48, 0x00, 0x21, 0xa1, 0x90, 0x62, 0x00, 0xe4, 0x28, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x0c, - 0x38, 0x60, 0x00, 0x00, 0x48, 0x00, 0x01, 0x80, 0x38, 0x82, 0x02, 0xa2, 0x7f, 0xc3, 0xf3, 0x78, - 0x48, 0x00, 0x21, 0x81, 0x90, 0x62, 0x00, 0xe0, 0x28, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x0c, - 0x38, 0x60, 0x00, 0x00, 0x48, 0x00, 0x01, 0x60, 0x38, 0x82, 0x02, 0xab, 0x7f, 0xc3, 0xf3, 0x78, - 0x48, 0x00, 0x21, 0x61, 0x90, 0x62, 0x00, 0xdc, 0x28, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x0c, - 0x38, 0x60, 0x00, 0x00, 0x48, 0x00, 0x01, 0x40, 0x38, 0x82, 0x02, 0xb8, 0x7f, 0xc3, 0xf3, 0x78, - 0x48, 0x00, 0x21, 0x41, 0x90, 0x62, 0x00, 0xd8, 0x28, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x0c, - 0x38, 0x60, 0x00, 0x00, 0x48, 0x00, 0x01, 0x20, 0x38, 0x82, 0x02, 0xc4, 0x7f, 0xc3, 0xf3, 0x78, - 0x48, 0x00, 0x21, 0x21, 0x90, 0x62, 0x00, 0xd4, 0x28, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x0c, - 0x38, 0x60, 0x00, 0x00, 0x48, 0x00, 0x01, 0x00, 0x38, 0x82, 0x02, 0xcc, 0x7f, 0xc3, 0xf3, 0x78, - 0x48, 0x00, 0x21, 0x01, 0x90, 0x62, 0x00, 0xd0, 0x28, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x0c, - 0x38, 0x60, 0x00, 0x00, 0x48, 0x00, 0x00, 0xe0, 0x38, 0x82, 0x02, 0xd4, 0x7f, 0xc3, 0xf3, 0x78, - 0x48, 0x00, 0x20, 0xe1, 0x90, 0x62, 0x00, 0xcc, 0x28, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x0c, - 0x38, 0x60, 0x00, 0x00, 0x48, 0x00, 0x00, 0xc0, 0x38, 0x82, 0x02, 0xef, 0x7f, 0xa3, 0xeb, 0x78, - 0x48, 0x00, 0x20, 0xc1, 0x90, 0x62, 0x00, 0xc8, 0x28, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x0c, - 0x38, 0x60, 0x00, 0x00, 0x48, 0x00, 0x00, 0xa0, 0x38, 0x82, 0x03, 0x01, 0x7f, 0xa3, 0xeb, 0x78, - 0x48, 0x00, 0x20, 0xa1, 0x90, 0x62, 0x00, 0xc4, 0x28, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x0c, - 0x38, 0x60, 0x00, 0x00, 0x48, 0x00, 0x00, 0x80, 0x38, 0x82, 0x03, 0x13, 0x7f, 0xc3, 0xf3, 0x78, - 0x48, 0x00, 0x20, 0x81, 0x90, 0x62, 0x00, 0xc0, 0x28, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x0c, - 0x38, 0x60, 0x00, 0x00, 0x48, 0x00, 0x00, 0x60, 0x38, 0x82, 0x03, 0x21, 0x7f, 0xc3, 0xf3, 0x78, - 0x48, 0x00, 0x20, 0x61, 0x90, 0x62, 0x00, 0xbc, 0x28, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x0c, - 0x38, 0x60, 0x00, 0x00, 0x48, 0x00, 0x00, 0x40, 0x38, 0x82, 0x03, 0x30, 0x7f, 0xc3, 0xf3, 0x78, - 0x48, 0x00, 0x20, 0x41, 0x90, 0x62, 0x00, 0xb8, 0x28, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x0c, - 0x38, 0x60, 0x00, 0x00, 0x48, 0x00, 0x00, 0x20, 0x38, 0x00, 0x00, 0x00, 0x38, 0x62, 0x02, 0x5c, - 0x90, 0x02, 0x01, 0x00, 0x4b, 0xff, 0xfc, 0x0d, 0x38, 0x00, 0x00, 0x01, 0x38, 0x60, 0x00, 0x01, - 0x90, 0x1f, 0x00, 0x00, 0x80, 0x01, 0x00, 0x58, 0x38, 0x21, 0x00, 0x50, 0xbb, 0xa1, 0xff, 0xf4, - 0x7c, 0x08, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7c, 0x08, 0x02, 0xa6, 0x93, 0xe1, 0xff, 0xfc, 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xc0, - 0x4b, 0xff, 0xfd, 0x41, 0x54, 0x7f, 0x06, 0x3e, 0x80, 0x62, 0x00, 0x40, 0x4b, 0xff, 0xfb, 0x25, - 0x2c, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x08, 0x3b, 0xe0, 0x00, 0x00, 0x57, 0xe3, 0x06, 0x3e, - 0x80, 0x01, 0x00, 0x48, 0x38, 0x21, 0x00, 0x40, 0x7c, 0x08, 0x03, 0xa6, 0x83, 0xe1, 0xff, 0xfc, - 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xc0, 0x80, 0x02, 0x01, 0x00, - 0x28, 0x00, 0x00, 0x00, 0x41, 0x82, 0x00, 0x0c, 0x38, 0x62, 0x03, 0x3d, 0x48, 0x00, 0x22, 0xa5, - 0x38, 0x62, 0x05, 0x00, 0x38, 0x00, 0x00, 0x00, 0x90, 0x03, 0x00, 0x00, 0x80, 0x01, 0x00, 0x48, - 0x38, 0x21, 0x00, 0x40, 0x7c, 0x08, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, - 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xc0, 0x4b, 0xff, 0xff, 0xb5, - 0x4b, 0xff, 0xfa, 0xf1, 0x80, 0x01, 0x00, 0x48, 0x38, 0x21, 0x00, 0x40, 0x7c, 0x08, 0x03, 0xa6, - 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x93, 0xe1, 0xff, 0xfc, 0x7c, 0x08, 0x02, 0xa6, 0x7c, 0x7f, 0x1b, 0x78, 0x7c, 0xc9, 0x33, 0x78, - 0x39, 0x02, 0x05, 0x00, 0x7c, 0xea, 0x3b, 0x78, 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xc0, - 0x80, 0x08, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x40, 0x82, 0x00, 0x14, 0x38, 0x62, 0x03, 0x7c, - 0x48, 0x00, 0x22, 0x21, 0x38, 0x60, 0x00, 0x06, 0x48, 0x00, 0x00, 0x68, 0x80, 0x1f, 0x00, 0x14, - 0x28, 0x00, 0x00, 0x00, 0x41, 0x82, 0x00, 0x0c, 0x38, 0x60, 0x00, 0x00, 0x48, 0x00, 0x00, 0x54, - 0x80, 0x62, 0x00, 0xc0, 0x7c, 0x87, 0x23, 0x78, 0x7c, 0xa8, 0x2b, 0x78, 0x7f, 0xe6, 0xfb, 0x78, - 0x38, 0x82, 0x01, 0x00, 0x38, 0xa0, 0x00, 0x38, 0x48, 0x00, 0x20, 0x89, 0x2c, 0x03, 0x00, 0x00, - 0x41, 0x82, 0x00, 0x08, 0x48, 0x00, 0x00, 0x2c, 0x80, 0x9f, 0x00, 0x14, 0x38, 0x00, 0x00, 0x00, - 0x38, 0x60, 0x00, 0x00, 0x93, 0xe4, 0x00, 0x18, 0x90, 0x04, 0x00, 0x04, 0x90, 0x04, 0x00, 0x08, - 0xb0, 0x04, 0x00, 0x0c, 0x90, 0x04, 0x00, 0x10, 0x90, 0x04, 0x00, 0x14, 0x90, 0x04, 0x00, 0x34, - 0x80, 0x01, 0x00, 0x48, 0x38, 0x21, 0x00, 0x40, 0x83, 0xe1, 0xff, 0xfc, 0x7c, 0x08, 0x03, 0xa6, - 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xbf, 0x81, 0xff, 0xf0, 0x7c, 0x08, 0x02, 0xa6, 0x7c, 0x7c, 0x1b, 0x78, 0x38, 0x82, 0x05, 0x00, - 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xb0, 0x80, 0x04, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, - 0x40, 0x82, 0x00, 0x14, 0x38, 0x62, 0x03, 0xad, 0x48, 0x00, 0x21, 0x69, 0x38, 0x60, 0x00, 0x06, - 0x48, 0x00, 0x00, 0xb8, 0x83, 0xbc, 0x00, 0x14, 0x28, 0x1d, 0x00, 0x00, 0x40, 0x82, 0x00, 0x88, - 0x38, 0x60, 0x00, 0x00, 0x48, 0x00, 0x00, 0xa4, 0x48, 0x00, 0x00, 0x7c, 0x38, 0x63, 0x00, 0x04, - 0x4b, 0xff, 0xfa, 0xb1, 0x83, 0xdd, 0x00, 0x34, 0x3b, 0xfe, 0x00, 0x04, 0x48, 0x00, 0x00, 0x20, - 0x7f, 0xe3, 0xfb, 0x78, 0x38, 0x9e, 0x00, 0x04, 0x38, 0xa0, 0x00, 0x06, 0x48, 0x00, 0x20, 0xd5, - 0x2c, 0x03, 0x00, 0x00, 0x41, 0x82, 0x00, 0x14, 0x83, 0xde, 0x00, 0x00, 0x28, 0x1e, 0x00, 0x00, - 0x40, 0x82, 0xff, 0xe0, 0x48, 0x00, 0x00, 0x40, 0x38, 0x9d, 0x00, 0x34, 0x48, 0x00, 0x00, 0x30, - 0x60, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x7c, 0x00, 0xf0, 0x40, 0x40, 0x82, 0x00, 0x1c, - 0x80, 0x1e, 0x00, 0x00, 0x7f, 0xc3, 0xf3, 0x78, 0x90, 0x04, 0x00, 0x00, 0x48, 0x00, 0x1e, 0x65, - 0x48, 0x00, 0x00, 0x14, 0x60, 0x00, 0x00, 0x00, 0x7c, 0x04, 0x03, 0x78, 0x28, 0x04, 0x00, 0x00, - 0x40, 0x82, 0xff, 0xd4, 0x80, 0x7d, 0x00, 0x34, 0x28, 0x03, 0x00, 0x00, 0x40, 0x82, 0xff, 0x80, - 0x38, 0x00, 0x00, 0x00, 0x7f, 0x85, 0xe3, 0x78, 0x90, 0x1d, 0x00, 0x34, 0x38, 0x82, 0x01, 0x00, - 0x80, 0x62, 0x00, 0xbc, 0x48, 0x00, 0x1e, 0xad, 0x80, 0x01, 0x00, 0x58, 0x38, 0x21, 0x00, 0x50, - 0xbb, 0x81, 0xff, 0xf0, 0x7c, 0x08, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, - 0x7c, 0x08, 0x02, 0xa6, 0x38, 0xc2, 0x05, 0x00, 0x7c, 0x69, 0x1b, 0x78, 0x7c, 0x85, 0x23, 0x78, - 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xc0, 0x80, 0x06, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, - 0x40, 0x82, 0x00, 0x14, 0x38, 0x62, 0x03, 0xdf, 0x48, 0x00, 0x20, 0x69, 0x38, 0x60, 0x00, 0x06, - 0x48, 0x00, 0x01, 0x8c, 0x81, 0x09, 0x00, 0x14, 0x28, 0x08, 0x00, 0x00, 0x40, 0x82, 0x00, 0x0c, - 0x38, 0x60, 0x00, 0x06, 0x48, 0x00, 0x01, 0x78, 0x80, 0xc5, 0x00, 0x14, 0x88, 0x06, 0x00, 0x0d, - 0x2c, 0x00, 0x00, 0x0e, 0x41, 0x82, 0x01, 0x30, 0x40, 0x80, 0x00, 0x1c, 0x2c, 0x00, 0x00, 0x01, - 0x41, 0x82, 0x00, 0x48, 0x40, 0x80, 0x01, 0x38, 0x2c, 0x00, 0x00, 0x00, 0x40, 0x80, 0x00, 0x20, - 0x48, 0x00, 0x01, 0x2c, 0x2c, 0x00, 0x00, 0x86, 0x41, 0x82, 0x01, 0x1c, 0x40, 0x80, 0x01, 0x20, - 0x2c, 0x00, 0x00, 0x83, 0x41, 0x82, 0x00, 0x24, 0x48, 0x00, 0x01, 0x14, 0x38, 0xc2, 0x04, 0xf4, - 0x7c, 0xa3, 0x2b, 0x78, 0x80, 0x86, 0x00, 0x00, 0x38, 0x04, 0x00, 0x01, 0x90, 0x06, 0x00, 0x00, - 0x48, 0x00, 0x08, 0x31, 0x48, 0x00, 0x01, 0x04, 0x80, 0x65, 0x00, 0x0c, 0x80, 0xc3, 0x00, 0x00, - 0x28, 0x06, 0x00, 0x31, 0x41, 0x81, 0x00, 0xb8, 0x38, 0x62, 0x04, 0x10, 0x54, 0xc0, 0x10, 0x3a, - 0x7c, 0x63, 0x00, 0x2e, 0x7c, 0x69, 0x03, 0xa6, 0x4e, 0x80, 0x04, 0x20, 0x38, 0xe2, 0x04, 0xf0, - 0x7d, 0x03, 0x43, 0x78, 0x7d, 0x24, 0x4b, 0x78, 0x80, 0xc7, 0x00, 0x00, 0x38, 0x06, 0x00, 0x01, - 0x90, 0x07, 0x00, 0x00, 0x48, 0x00, 0x1a, 0xad, 0x48, 0x00, 0x00, 0xc0, 0x7d, 0x03, 0x43, 0x78, - 0x7d, 0x24, 0x4b, 0x78, 0x48, 0x00, 0x0e, 0x8d, 0x48, 0x00, 0x00, 0xb0, 0x7d, 0x03, 0x43, 0x78, - 0x7d, 0x24, 0x4b, 0x78, 0x48, 0x00, 0x10, 0x8d, 0x48, 0x00, 0x00, 0xa0, 0x7d, 0x03, 0x43, 0x78, - 0x7d, 0x24, 0x4b, 0x78, 0x48, 0x00, 0x11, 0x9d, 0x48, 0x00, 0x00, 0x90, 0x7d, 0x03, 0x43, 0x78, - 0x7d, 0x24, 0x4b, 0x78, 0x48, 0x00, 0x13, 0x7d, 0x48, 0x00, 0x00, 0x80, 0x7d, 0x03, 0x43, 0x78, - 0x7d, 0x24, 0x4b, 0x78, 0x48, 0x00, 0x14, 0x1d, 0x48, 0x00, 0x00, 0x70, 0x7d, 0x03, 0x43, 0x78, - 0x7d, 0x24, 0x4b, 0x78, 0x48, 0x00, 0x16, 0x2d, 0x48, 0x00, 0x00, 0x60, 0x7d, 0x03, 0x43, 0x78, - 0x7d, 0x24, 0x4b, 0x78, 0x48, 0x00, 0x17, 0x7d, 0x48, 0x00, 0x00, 0x50, 0x7d, 0x03, 0x43, 0x78, - 0x7d, 0x24, 0x4b, 0x78, 0x48, 0x00, 0x18, 0xad, 0x48, 0x00, 0x00, 0x40, 0x7d, 0x03, 0x43, 0x78, - 0x7d, 0x24, 0x4b, 0x78, 0x38, 0xe0, 0x00, 0x12, 0x39, 0x00, 0x00, 0x00, 0x48, 0x00, 0x0c, 0x95, - 0x48, 0x00, 0x00, 0x28, 0x7d, 0x03, 0x43, 0x78, 0x7d, 0x24, 0x4b, 0x78, 0x48, 0x00, 0x00, 0xd5, - 0x48, 0x00, 0x00, 0x18, 0x48, 0x00, 0x02, 0xcd, 0x48, 0x00, 0x00, 0x10, 0x80, 0x62, 0x00, 0xf4, - 0x7c, 0xa4, 0x2b, 0x78, 0x48, 0x00, 0x1c, 0x9d, 0x38, 0xa2, 0x04, 0xfc, 0x38, 0x60, 0x00, 0x00, - 0x80, 0x85, 0x00, 0x00, 0x38, 0x04, 0x00, 0x01, 0x90, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x48, - 0x38, 0x21, 0x00, 0x40, 0x7c, 0x08, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, - 0xbf, 0xc1, 0xff, 0xf8, 0x7c, 0x08, 0x02, 0xa6, 0x7c, 0x7e, 0x1b, 0x78, 0x90, 0x01, 0x00, 0x08, - 0x94, 0x21, 0xff, 0xc0, 0x48, 0x00, 0x00, 0x4c, 0x80, 0x62, 0x00, 0xd8, 0x7f, 0xc4, 0xf3, 0x78, - 0x48, 0x00, 0x1c, 0x51, 0x28, 0x03, 0x00, 0x00, 0x41, 0x82, 0x00, 0x18, 0x80, 0x62, 0x00, 0xe0, - 0x7f, 0xc4, 0xf3, 0x78, 0x7f, 0xe5, 0xfb, 0x78, 0x48, 0x00, 0x1c, 0x89, 0x48, 0x00, 0x00, 0x24, - 0x80, 0x62, 0x00, 0xf4, 0x7f, 0xe4, 0xfb, 0x78, 0x48, 0x00, 0x1c, 0x29, 0x80, 0x62, 0x00, 0xd0, - 0x7f, 0xc4, 0xf3, 0x78, 0x38, 0xa0, 0x00, 0x00, 0x48, 0x00, 0x1c, 0x69, 0x48, 0x00, 0x00, 0x18, - 0x80, 0x62, 0x00, 0xe8, 0x7f, 0xc4, 0xf3, 0x78, 0x48, 0x00, 0x1c, 0x09, 0x7c, 0x7f, 0x1b, 0x79, - 0x40, 0x82, 0xff, 0xa8, 0x38, 0x60, 0x00, 0x00, 0x80, 0x01, 0x00, 0x48, 0x38, 0x21, 0x00, 0x40, - 0x7c, 0x08, 0x03, 0xa6, 0xbb, 0xc1, 0xff, 0xf8, 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, - 0xbf, 0x81, 0xff, 0xf0, 0x7c, 0x08, 0x02, 0xa6, 0x7c, 0xbe, 0x2b, 0x78, 0x7c, 0x7c, 0x1b, 0x78, - 0x7c, 0x9d, 0x23, 0x78, 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xb0, 0x83, 0xe5, 0x00, 0x0c, - 0x80, 0x1f, 0x00, 0x00, 0x2c, 0x00, 0x4f, 0x03, 0x41, 0x82, 0x01, 0x04, 0x40, 0x80, 0x00, 0x10, - 0x2c, 0x00, 0x4f, 0x02, 0x40, 0x80, 0x00, 0x14, 0x48, 0x00, 0x01, 0x2c, 0x2c, 0x00, 0x6c, 0x0a, - 0x41, 0x82, 0x00, 0x88, 0x48, 0x00, 0x01, 0x20, 0x80, 0x9e, 0x00, 0x08, 0x28, 0x04, 0x00, 0x00, - 0x41, 0x82, 0x00, 0x18, 0x80, 0x64, 0x00, 0x0c, 0x80, 0x04, 0x00, 0x10, 0x7c, 0x03, 0x00, 0x50, - 0x28, 0x00, 0x00, 0x04, 0x41, 0x82, 0x00, 0x10, 0x38, 0x00, 0x00, 0x16, 0x90, 0x1f, 0x00, 0x10, - 0x48, 0x00, 0x01, 0x5c, 0x80, 0x63, 0x00, 0x00, 0x3c, 0x03, 0x00, 0x01, 0x28, 0x00, 0xff, 0xff, - 0x41, 0x82, 0x00, 0x14, 0x20, 0x03, 0x00, 0x08, 0x7c, 0x00, 0x00, 0x34, 0x54, 0x00, 0xd9, 0x7e, - 0x90, 0x1c, 0x00, 0x10, 0x38, 0x00, 0x00, 0x00, 0x90, 0x1e, 0x00, 0x08, 0x80, 0x62, 0x00, 0xf4, - 0x48, 0x00, 0x1b, 0x41, 0x80, 0x1c, 0x00, 0x10, 0x2c, 0x00, 0x00, 0x00, 0x41, 0x82, 0x00, 0x10, - 0x38, 0x00, 0x00, 0x08, 0x90, 0x1f, 0x00, 0x14, 0x48, 0x00, 0x00, 0xb8, 0x38, 0x00, 0x00, 0x01, - 0x90, 0x1f, 0x00, 0x14, 0x48, 0x00, 0x00, 0xac, 0x80, 0x62, 0x00, 0xf0, 0x80, 0x9e, 0x00, 0x08, - 0x48, 0x00, 0x1b, 0x11, 0x7c, 0x64, 0x1b, 0x79, 0x40, 0x82, 0x00, 0x10, 0x38, 0x00, 0x00, 0x0c, - 0x90, 0x1f, 0x00, 0x10, 0x48, 0x00, 0x00, 0xe8, 0x80, 0xc4, 0x00, 0x14, 0x38, 0x00, 0x00, 0x01, - 0x7f, 0x83, 0xe3, 0x78, 0x38, 0xa0, 0x00, 0x01, 0x98, 0x06, 0x00, 0x0d, 0x48, 0x00, 0x03, 0x65, - 0x28, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x10, 0x38, 0x00, 0x00, 0x0c, 0x90, 0x1f, 0x00, 0x10, - 0x48, 0x00, 0x00, 0xbc, 0x80, 0x9e, 0x00, 0x08, 0x90, 0x64, 0x00, 0x08, 0x80, 0x1c, 0x00, 0x08, - 0x60, 0x00, 0x00, 0x08, 0x90, 0x1c, 0x00, 0x08, 0x48, 0x00, 0x00, 0x48, 0x80, 0x9e, 0x00, 0x08, - 0x28, 0x04, 0x00, 0x00, 0x41, 0x82, 0x00, 0x18, 0x80, 0x64, 0x00, 0x0c, 0x80, 0x04, 0x00, 0x10, - 0x7c, 0x03, 0x00, 0x50, 0x28, 0x00, 0x00, 0x04, 0x41, 0x82, 0x00, 0x10, 0x38, 0x00, 0x00, 0x16, - 0x90, 0x1f, 0x00, 0x10, 0x48, 0x00, 0x00, 0x78, 0x38, 0x00, 0x00, 0x01, 0x90, 0x1c, 0x00, 0x14, - 0x48, 0x00, 0x00, 0x10, 0x38, 0x00, 0x00, 0x16, 0x90, 0x1f, 0x00, 0x10, 0x48, 0x00, 0x00, 0x60, - 0x38, 0x00, 0x00, 0x00, 0x7f, 0xc5, 0xf3, 0x78, 0x90, 0x1f, 0x00, 0x0c, 0x48, 0x00, 0x00, 0x1c, - 0x80, 0x65, 0x00, 0x0c, 0x80, 0x05, 0x00, 0x10, 0x80, 0x9f, 0x00, 0x0c, 0x7c, 0x03, 0x00, 0x50, - 0x7c, 0x04, 0x02, 0x14, 0x90, 0x1f, 0x00, 0x0c, 0x80, 0xa5, 0x00, 0x08, 0x28, 0x05, 0x00, 0x00, - 0x40, 0x82, 0xff, 0xe0, 0x38, 0x60, 0x00, 0x00, 0x38, 0x00, 0x00, 0x81, 0x90, 0x7f, 0x00, 0x10, - 0x7f, 0xa4, 0xeb, 0x78, 0x7f, 0xc5, 0xf3, 0x78, 0x80, 0x7e, 0x00, 0x14, 0x98, 0x03, 0x00, 0x0d, - 0x80, 0x62, 0x00, 0xd4, 0x48, 0x00, 0x1a, 0x6d, 0x48, 0x00, 0x00, 0x20, 0x80, 0x7e, 0x00, 0x14, - 0x38, 0x00, 0x00, 0x82, 0x7f, 0xa4, 0xeb, 0x78, 0x7f, 0xc5, 0xf3, 0x78, 0x98, 0x03, 0x00, 0x0d, - 0x80, 0x62, 0x00, 0xd4, 0x48, 0x00, 0x1a, 0x4d, 0x80, 0x01, 0x00, 0x58, 0x38, 0x21, 0x00, 0x50, - 0xbb, 0x81, 0xff, 0xf0, 0x7c, 0x08, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, - 0xbf, 0xa1, 0xff, 0xf4, 0x7c, 0x08, 0x02, 0xa6, 0x7c, 0x9e, 0x23, 0x78, 0x7c, 0x7d, 0x1b, 0x78, - 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xb0, 0x83, 0xe4, 0x00, 0x0c, 0x88, 0x1f, 0x00, 0x00, - 0x54, 0x00, 0x07, 0xbd, 0x41, 0x82, 0x00, 0x14, 0x80, 0x62, 0x00, 0xd0, 0x7f, 0xa4, 0xeb, 0x78, - 0x38, 0xa0, 0x00, 0x01, 0x48, 0x00, 0x19, 0xfd, 0x88, 0x1f, 0x00, 0x00, 0x54, 0x00, 0x07, 0xff, - 0x41, 0x82, 0x00, 0x34, 0x80, 0x62, 0x00, 0xd0, 0x38, 0x9d, 0xff, 0xc0, 0x38, 0xa0, 0x00, 0x01, - 0x48, 0x00, 0x19, 0xe1, 0x88, 0x1f, 0x00, 0x00, 0x7f, 0xa4, 0xeb, 0x78, 0x7f, 0xc5, 0xf3, 0x78, - 0x54, 0x00, 0x07, 0xfa, 0x98, 0x1f, 0x00, 0x00, 0x80, 0x62, 0x00, 0xd4, 0x48, 0x00, 0x19, 0xc5, - 0x48, 0x00, 0x00, 0x10, 0x80, 0x62, 0x00, 0xf4, 0x7f, 0xc4, 0xf3, 0x78, 0x48, 0x00, 0x19, 0x65, - 0x80, 0x01, 0x00, 0x58, 0x38, 0x21, 0x00, 0x50, 0xbb, 0xa1, 0xff, 0xf4, 0x7c, 0x08, 0x03, 0xa6, - 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x54, 0x63, 0x04, 0x3e, 0x2c, 0x03, 0x05, 0xdd, 0x41, 0x80, 0x00, 0x0c, 0x38, 0x60, 0x00, 0x00, - 0x4e, 0x80, 0x00, 0x20, 0x2c, 0x03, 0x00, 0xff, 0x40, 0x82, 0x00, 0x18, 0x54, 0x80, 0x04, 0x3e, - 0x2c, 0x00, 0x00, 0xff, 0x40, 0x82, 0x00, 0x0c, 0x38, 0x60, 0x00, 0x04, 0x4e, 0x80, 0x00, 0x20, - 0x2c, 0x03, 0x00, 0xaa, 0x40, 0x82, 0x00, 0x0c, 0x38, 0x60, 0x00, 0x03, 0x4e, 0x80, 0x00, 0x20, - 0x2c, 0x03, 0x00, 0xff, 0x38, 0x60, 0x00, 0x05, 0x4d, 0x81, 0x00, 0x20, 0x38, 0x60, 0x00, 0x01, - 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x88, 0x03, 0x00, 0x00, 0x54, 0x00, 0x07, 0xff, 0x41, 0x82, 0x00, 0x30, 0x80, 0x83, 0x00, 0x00, - 0x3c, 0x04, 0x00, 0x01, 0x28, 0x00, 0xff, 0xff, 0x40, 0x82, 0x00, 0x18, 0xa0, 0x03, 0x00, 0x04, - 0x28, 0x00, 0xff, 0xff, 0x40, 0x82, 0x00, 0x0c, 0x38, 0x60, 0x00, 0x02, 0x4e, 0x80, 0x00, 0x20, - 0x38, 0x60, 0x00, 0x01, 0x4e, 0x80, 0x00, 0x20, 0x38, 0x60, 0x00, 0x00, 0x4e, 0x80, 0x00, 0x20, - 0xbf, 0xa1, 0xff, 0xf4, 0x7c, 0x08, 0x02, 0xa6, 0x7c, 0x7f, 0x1b, 0x78, 0x7c, 0x9d, 0x23, 0x78, - 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xb0, 0x80, 0xa3, 0x00, 0x14, 0x88, 0x05, 0x00, 0x0c, - 0x28, 0x00, 0x00, 0x01, 0x40, 0x82, 0x00, 0x44, 0x80, 0x65, 0x00, 0x04, 0x57, 0xa4, 0x04, 0x3e, - 0x80, 0x05, 0x00, 0x08, 0x7c, 0x03, 0x00, 0x50, 0x7c, 0x00, 0x20, 0x00, 0x41, 0x80, 0x00, 0x2c, - 0x38, 0x00, 0x00, 0x00, 0x98, 0x05, 0x00, 0x0d, 0x80, 0x7f, 0x00, 0x14, 0x80, 0x03, 0x00, 0x04, - 0x90, 0x1f, 0x00, 0x0c, 0x80, 0x7f, 0x00, 0x14, 0x80, 0x03, 0x00, 0x04, 0x7c, 0x00, 0x22, 0x14, - 0x90, 0x1f, 0x00, 0x10, 0x48, 0x00, 0x00, 0x9c, 0x83, 0xdf, 0x00, 0x08, 0x38, 0x00, 0x00, 0x00, - 0x7f, 0xe4, 0xfb, 0x78, 0x90, 0x1f, 0x00, 0x08, 0x80, 0x62, 0x00, 0xf4, 0x48, 0x00, 0x18, 0x25, - 0x28, 0x1e, 0x00, 0x00, 0x7f, 0xdf, 0xf3, 0x78, 0x41, 0x82, 0x00, 0x38, 0x80, 0x7e, 0x00, 0x14, - 0x88, 0x03, 0x00, 0x0c, 0x28, 0x00, 0x00, 0x01, 0x40, 0x82, 0x00, 0x28, 0x80, 0x63, 0x00, 0x04, - 0x57, 0xa0, 0x04, 0x3e, 0x80, 0x9e, 0x00, 0x0c, 0x7c, 0x63, 0x20, 0x50, 0x7c, 0x03, 0x00, 0x00, - 0x41, 0x80, 0x00, 0x10, 0x7c, 0x00, 0x20, 0x50, 0x90, 0x1e, 0x00, 0x0c, 0x48, 0x00, 0x00, 0x44, - 0x57, 0xbe, 0x04, 0x3e, 0x38, 0x80, 0x00, 0x03, 0x7f, 0xc3, 0xf3, 0x78, 0x4b, 0xff, 0xf4, 0x35, - 0x28, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x18, 0x80, 0x62, 0x00, 0xf4, 0x7f, 0xe4, 0xfb, 0x78, - 0x48, 0x00, 0x17, 0xc1, 0x3b, 0xe0, 0x00, 0x00, 0x48, 0x00, 0x00, 0x18, 0x93, 0xe3, 0x00, 0x08, - 0x7c, 0x7f, 0x1b, 0x78, 0x80, 0x03, 0x00, 0x10, 0x7c, 0x00, 0xf2, 0x14, 0x90, 0x03, 0x00, 0x10, - 0x7f, 0xe3, 0xfb, 0x78, 0x80, 0x01, 0x00, 0x58, 0x38, 0x21, 0x00, 0x50, 0x7c, 0x08, 0x03, 0xa6, - 0xbb, 0xa1, 0xff, 0xf4, 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xbf, 0x01, 0xff, 0xe0, 0x7c, 0x08, 0x02, 0xa6, 0x7c, 0x7e, 0x1b, 0x78, 0x7c, 0x9f, 0x23, 0x78, - 0x7c, 0xb8, 0x2b, 0x78, 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0x90, 0x80, 0x64, 0x00, 0x0c, - 0x80, 0x03, 0x00, 0x00, 0x28, 0x00, 0x00, 0x07, 0x41, 0x82, 0x00, 0x14, 0x80, 0x62, 0x00, 0xf4, - 0x48, 0x00, 0x17, 0x51, 0x38, 0x60, 0x00, 0x00, 0x48, 0x00, 0x01, 0xc4, 0x83, 0x63, 0x00, 0x04, - 0x80, 0x03, 0x00, 0x08, 0x2c, 0x1b, 0x00, 0x08, 0x7f, 0x83, 0x02, 0x14, 0x41, 0x82, 0x00, 0x28, - 0x40, 0x80, 0x00, 0x10, 0x2c, 0x1b, 0x00, 0x06, 0x41, 0x82, 0x00, 0x14, 0x48, 0x00, 0x00, 0x28, - 0x2c, 0x1b, 0x00, 0x0d, 0x41, 0x82, 0x00, 0x18, 0x48, 0x00, 0x00, 0x1c, 0xa3, 0x5e, 0x00, 0x0c, - 0x48, 0x00, 0x00, 0x18, 0xa3, 0x5c, 0x00, 0x06, 0x48, 0x00, 0x00, 0x10, 0xa3, 0x5c, 0x00, 0x06, - 0x48, 0x00, 0x00, 0x08, 0xa3, 0x5e, 0x00, 0x0c, 0x80, 0x62, 0x00, 0xcc, 0x7f, 0xe4, 0xfb, 0x78, - 0x48, 0x00, 0x16, 0xf1, 0x54, 0x79, 0x04, 0x3e, 0xa0, 0x7e, 0x00, 0x0c, 0x7f, 0x44, 0xd3, 0x78, - 0x4b, 0xff, 0xfd, 0xa1, 0x54, 0x7d, 0x04, 0x3e, 0x2c, 0x1d, 0x00, 0x02, 0x41, 0x82, 0x00, 0x8c, - 0x40, 0x80, 0x00, 0x14, 0x2c, 0x1d, 0x00, 0x00, 0x41, 0x82, 0x00, 0x1c, 0x40, 0x80, 0x00, 0x24, - 0x48, 0x00, 0x00, 0x78, 0x2c, 0x1d, 0x00, 0x04, 0x41, 0x82, 0x00, 0x58, 0x40, 0x80, 0x00, 0x6c, - 0x48, 0x00, 0x00, 0x30, 0x7f, 0x59, 0xd3, 0x78, 0x3b, 0x00, 0x00, 0x0e, 0x48, 0x00, 0x00, 0x64, - 0x2c, 0x18, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x11, 0x41, 0x82, 0x00, 0x0c, 0x3b, 0x20, 0x00, 0x00, - 0x48, 0x00, 0x00, 0x50, 0x38, 0x19, 0x00, 0x03, 0x54, 0x19, 0x04, 0x3e, 0x48, 0x00, 0x00, 0x44, - 0x2c, 0x18, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x16, 0x41, 0x82, 0x00, 0x0c, 0x3b, 0x20, 0x00, 0x00, - 0x48, 0x00, 0x00, 0x30, 0x38, 0x19, 0x00, 0x08, 0x54, 0x19, 0x04, 0x3e, 0x48, 0x00, 0x00, 0x24, - 0x2c, 0x18, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x0e, 0x41, 0x82, 0x00, 0x18, 0x3b, 0x20, 0x00, 0x00, - 0x48, 0x00, 0x00, 0x10, 0x48, 0x00, 0x00, 0x0c, 0x3b, 0x00, 0x00, 0x0e, 0x7f, 0x59, 0xd3, 0x78, - 0x7f, 0x84, 0xe3, 0x78, 0x7f, 0x65, 0xdb, 0x78, 0x38, 0x61, 0x00, 0x38, 0x48, 0x00, 0x17, 0x85, - 0x7f, 0xe3, 0xfb, 0x78, 0x7f, 0x04, 0xc3, 0x78, 0x4b, 0xff, 0xfd, 0x89, 0x7c, 0x7f, 0x1b, 0x79, - 0x40, 0x82, 0x00, 0x0c, 0x38, 0x60, 0x00, 0x00, 0x48, 0x00, 0x00, 0x94, 0x80, 0x9f, 0x00, 0x0c, - 0x2c, 0x1d, 0x00, 0x02, 0xb3, 0x24, 0x00, 0x0c, 0x80, 0x01, 0x00, 0x38, 0x90, 0x04, 0x00, 0x00, - 0xa0, 0x01, 0x00, 0x3c, 0xb0, 0x04, 0x00, 0x04, 0x41, 0x82, 0x00, 0x70, 0x40, 0x80, 0x00, 0x10, - 0x2c, 0x1d, 0x00, 0x01, 0x40, 0x80, 0x00, 0x14, 0x48, 0x00, 0x00, 0x60, 0x2c, 0x1d, 0x00, 0x04, - 0x40, 0x80, 0x00, 0x58, 0x48, 0x00, 0x00, 0x1c, 0x9b, 0x44, 0x00, 0x0e, 0x38, 0x00, 0x00, 0x03, - 0xa0, 0x7e, 0x00, 0x0c, 0x98, 0x64, 0x00, 0x0f, 0x98, 0x04, 0x00, 0x10, 0x48, 0x00, 0x00, 0x3c, - 0x9b, 0x44, 0x00, 0x0e, 0x38, 0x00, 0x00, 0x03, 0x28, 0x1b, 0x00, 0x0d, 0xa0, 0x7e, 0x00, 0x0c, - 0x98, 0x64, 0x00, 0x0f, 0x98, 0x04, 0x00, 0x10, 0x41, 0x80, 0x00, 0x0c, 0x38, 0x61, 0x00, 0x40, - 0x48, 0x00, 0x00, 0x08, 0x38, 0x7e, 0x00, 0x2c, 0x80, 0x03, 0x00, 0x00, 0x90, 0x04, 0x00, 0x11, - 0x88, 0x03, 0x00, 0x04, 0x98, 0x04, 0x00, 0x15, 0x7f, 0xe3, 0xfb, 0x78, 0x80, 0x01, 0x00, 0x78, - 0x38, 0x21, 0x00, 0x70, 0xbb, 0x01, 0xff, 0xe0, 0x7c, 0x08, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, - 0xbf, 0xa1, 0xff, 0xf4, 0x7c, 0x08, 0x02, 0xa6, 0x7c, 0x7d, 0x1b, 0x78, 0x3b, 0xe2, 0x02, 0x5c, - 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xb0, 0x83, 0xc3, 0x00, 0x0c, 0xa0, 0x1e, 0x00, 0x0c, - 0x28, 0x00, 0x00, 0x00, 0x40, 0x82, 0x00, 0x18, 0x80, 0x62, 0x00, 0xcc, 0x7f, 0xa4, 0xeb, 0x78, - 0x48, 0x00, 0x15, 0x41, 0x38, 0x03, 0xff, 0xf2, 0xb0, 0x1e, 0x00, 0x0c, 0x80, 0x1f, 0x00, 0x00, - 0x7f, 0xa3, 0xeb, 0x78, 0x90, 0x1e, 0x00, 0x06, 0xa0, 0x1f, 0x00, 0x04, 0xb0, 0x1e, 0x00, 0x0a, - 0x4b, 0xff, 0xf1, 0x31, 0x80, 0x62, 0x00, 0xf4, 0x7f, 0xa4, 0xeb, 0x78, 0x48, 0x00, 0x15, 0x15, - 0x80, 0x01, 0x00, 0x58, 0x38, 0x21, 0x00, 0x50, 0xbb, 0xa1, 0xff, 0xf4, 0x7c, 0x08, 0x03, 0xa6, - 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xbf, 0x21, 0xff, 0xe4, 0x7c, 0x08, 0x02, 0xa6, 0x54, 0xb9, 0x04, 0x3e, 0x7c, 0x7b, 0x1b, 0x78, - 0x2c, 0x19, 0x00, 0x02, 0x7c, 0x9c, 0x23, 0x78, 0x7c, 0xdd, 0x33, 0x78, 0x90, 0x01, 0x00, 0x08, - 0x94, 0x21, 0xff, 0xa0, 0x41, 0x82, 0x00, 0x38, 0x40, 0x80, 0x00, 0x10, 0x2c, 0x19, 0x00, 0x01, - 0x40, 0x80, 0x00, 0x14, 0x48, 0x00, 0x00, 0x28, 0x2c, 0x19, 0x00, 0x04, 0x40, 0x80, 0x00, 0x20, - 0x48, 0x00, 0x00, 0x10, 0x3b, 0xe0, 0x00, 0x08, 0x3b, 0xc0, 0x00, 0x11, 0x48, 0x00, 0x00, 0x18, - 0x3b, 0xe0, 0x00, 0x0d, 0x3b, 0xc0, 0x00, 0x16, 0x48, 0x00, 0x00, 0x0c, 0x3b, 0xe0, 0x00, 0x08, - 0x3b, 0xc0, 0x00, 0x0e, 0x80, 0x1b, 0x00, 0x08, 0x54, 0x00, 0x07, 0x39, 0x41, 0x82, 0x00, 0x48, - 0x2c, 0x1d, 0x00, 0x00, 0x40, 0x82, 0x00, 0x40, 0x80, 0x1b, 0x00, 0x14, 0x2c, 0x00, 0x00, 0x00, - 0x40, 0x82, 0x00, 0x10, 0x80, 0x1c, 0x00, 0x0c, 0x7c, 0x00, 0xf2, 0x14, 0x90, 0x1c, 0x00, 0x0c, - 0x38, 0xc2, 0x04, 0xe4, 0x7f, 0x85, 0xe3, 0x78, 0x80, 0x62, 0x00, 0xe4, 0x80, 0x86, 0x00, 0x00, - 0x38, 0x04, 0x00, 0x01, 0x90, 0x06, 0x00, 0x00, 0x80, 0x9b, 0x00, 0x18, 0x48, 0x00, 0x14, 0x95, - 0x48, 0x00, 0x01, 0x2c, 0x57, 0xe3, 0x08, 0x3c, 0x38, 0x80, 0x00, 0x03, 0x3b, 0x43, 0x00, 0x18, - 0x7f, 0x43, 0xd3, 0x78, 0x4b, 0xff, 0xf0, 0x8d, 0x28, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x24, - 0x80, 0x62, 0x00, 0xf4, 0x7f, 0x84, 0xe3, 0x78, 0x48, 0x00, 0x14, 0x19, 0x38, 0x82, 0x04, 0xd8, - 0x80, 0x64, 0x00, 0x00, 0x38, 0x03, 0x00, 0x01, 0x90, 0x04, 0x00, 0x00, 0x48, 0x00, 0x00, 0xf0, - 0x80, 0xc3, 0x00, 0x14, 0x38, 0xe0, 0x00, 0x01, 0x38, 0xa0, 0x00, 0x08, 0x38, 0x80, 0x00, 0x18, - 0x38, 0x1f, 0x00, 0x18, 0x98, 0xe6, 0x00, 0x0d, 0x2c, 0x19, 0x00, 0x03, 0x80, 0xe3, 0x00, 0x0c, - 0x90, 0xa7, 0x00, 0x00, 0x80, 0xa3, 0x00, 0x10, 0x7c, 0xa5, 0xd2, 0x14, 0x90, 0xa3, 0x00, 0x10, - 0x93, 0x83, 0x00, 0x08, 0x93, 0xe7, 0x00, 0x04, 0x90, 0x87, 0x00, 0x08, 0x93, 0xe7, 0x00, 0x0c, - 0x90, 0x07, 0x00, 0x10, 0x93, 0xa7, 0x00, 0x14, 0x81, 0x1c, 0x00, 0x0c, 0x80, 0xc3, 0x00, 0x0c, - 0x80, 0xa7, 0x00, 0x08, 0x80, 0x87, 0x00, 0x10, 0x80, 0x08, 0x00, 0x00, 0x7c, 0xa6, 0x2a, 0x14, - 0x7c, 0x86, 0x22, 0x14, 0x90, 0x05, 0x00, 0x00, 0xa0, 0x08, 0x00, 0x04, 0xb0, 0x05, 0x00, 0x04, - 0x80, 0x08, 0x00, 0x06, 0x90, 0x04, 0x00, 0x00, 0xa0, 0x08, 0x00, 0x0a, 0xb0, 0x04, 0x00, 0x04, - 0x88, 0x08, 0x00, 0x0e, 0xb0, 0x05, 0x00, 0x06, 0x88, 0x08, 0x00, 0x0f, 0xb0, 0x04, 0x00, 0x06, - 0x40, 0x82, 0x00, 0x24, 0x80, 0x08, 0x00, 0x11, 0x90, 0x05, 0x00, 0x08, 0x88, 0x08, 0x00, 0x15, - 0x98, 0x05, 0x00, 0x0c, 0x80, 0x08, 0x00, 0x11, 0x90, 0x04, 0x00, 0x08, 0x88, 0x08, 0x00, 0x15, - 0x98, 0x04, 0x00, 0x0c, 0x80, 0x1b, 0x00, 0x14, 0x2c, 0x00, 0x00, 0x00, 0x40, 0x82, 0x00, 0x10, - 0x80, 0x1c, 0x00, 0x0c, 0x7c, 0x00, 0xf2, 0x14, 0x90, 0x1c, 0x00, 0x0c, 0x38, 0xc2, 0x04, 0xe8, - 0x7c, 0x65, 0x1b, 0x78, 0x80, 0x62, 0x00, 0xe4, 0x80, 0x86, 0x00, 0x00, 0x38, 0x04, 0x00, 0x01, - 0x90, 0x06, 0x00, 0x00, 0x80, 0x9b, 0x00, 0x18, 0x48, 0x00, 0x13, 0x69, 0x80, 0x01, 0x00, 0x68, - 0x38, 0x21, 0x00, 0x60, 0xbb, 0x21, 0xff, 0xe4, 0x7c, 0x08, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, - 0xbe, 0x21, 0xff, 0xc4, 0x7c, 0x08, 0x02, 0xa6, 0x7c, 0x7f, 0x1b, 0x78, 0x90, 0x01, 0x00, 0x08, - 0x94, 0x21, 0xff, 0x80, 0x83, 0xc3, 0x00, 0x0c, 0xa3, 0xbe, 0x00, 0x0c, 0x2c, 0x1d, 0x05, 0xdd, - 0x41, 0x80, 0x00, 0x0c, 0x7f, 0xa3, 0xeb, 0x78, 0x48, 0x00, 0x00, 0x0c, 0x8b, 0xbe, 0x00, 0x0e, - 0x88, 0x7e, 0x00, 0x0f, 0x7f, 0xa4, 0xeb, 0x78, 0x4b, 0xff, 0xf9, 0x89, 0x7c, 0x60, 0x1b, 0x78, - 0x7f, 0xc3, 0xf3, 0x78, 0x7c, 0x1c, 0x03, 0x78, 0x4b, 0xff, 0xf9, 0xd9, 0x83, 0x42, 0x01, 0x00, - 0x38, 0x80, 0x00, 0x01, 0x57, 0xa0, 0xfe, 0xfe, 0x7c, 0x7b, 0x1b, 0x78, 0x7f, 0xf2, 0xfb, 0x78, - 0x57, 0x96, 0x04, 0x3e, 0x57, 0xb5, 0x07, 0xfe, 0x7c, 0x94, 0x00, 0x30, 0x57, 0xb3, 0xe7, 0x3a, - 0x3b, 0x20, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x3a, 0xe0, 0x00, 0x00, 0x48, 0x00, 0x01, 0x6c, - 0x80, 0x1a, 0x00, 0x04, 0x28, 0x00, 0x00, 0x00, 0x41, 0x82, 0x01, 0x50, 0x80, 0x1a, 0x00, 0x08, - 0x54, 0x03, 0x07, 0x7b, 0x41, 0x82, 0x00, 0x10, 0x57, 0xa3, 0x04, 0x3e, 0x28, 0x03, 0x00, 0xff, - 0x40, 0x81, 0x00, 0xac, 0xa0, 0x7a, 0x00, 0x0c, 0x57, 0xa4, 0x04, 0x3e, 0x7c, 0x04, 0x18, 0x40, - 0x40, 0x82, 0x00, 0x74, 0x54, 0x03, 0x07, 0xff, 0x41, 0x82, 0x00, 0x94, 0x88, 0xde, 0x00, 0x11, - 0x88, 0x9a, 0x00, 0x2c, 0x88, 0xbe, 0x00, 0x12, 0x7c, 0xc4, 0x22, 0x78, 0x88, 0x7a, 0x00, 0x2d, - 0x54, 0x87, 0x06, 0x3e, 0x88, 0x9e, 0x00, 0x13, 0x7c, 0xa5, 0x1a, 0x78, 0x88, 0x7a, 0x00, 0x2e, - 0x7c, 0xe7, 0x2b, 0x78, 0x88, 0xde, 0x00, 0x14, 0x88, 0xba, 0x00, 0x2f, 0x7c, 0x83, 0x1a, 0x78, - 0x54, 0xe7, 0x06, 0x3e, 0x88, 0x9e, 0x00, 0x15, 0x7c, 0xe7, 0x1b, 0x78, 0x88, 0x7a, 0x00, 0x30, - 0x7c, 0xc5, 0x2a, 0x78, 0x54, 0xe7, 0x06, 0x3e, 0x7c, 0xe5, 0x2b, 0x78, 0x7c, 0x83, 0x1a, 0x78, - 0x54, 0xa7, 0x06, 0x3e, 0x7c, 0xe3, 0x1b, 0x78, 0x54, 0x67, 0x06, 0x3f, 0x41, 0x82, 0x00, 0x30, - 0x48, 0x00, 0x00, 0xb8, 0x2c, 0x16, 0x00, 0x01, 0x41, 0x82, 0x00, 0x0c, 0x2c, 0x16, 0x00, 0x03, - 0x40, 0x82, 0x00, 0xa8, 0x2c, 0x15, 0x00, 0x00, 0x41, 0x82, 0x00, 0xa0, 0x38, 0x7a, 0x00, 0x1c, - 0x7c, 0x73, 0x18, 0x2e, 0x7c, 0x63, 0xa0, 0x39, 0x41, 0x82, 0x00, 0x90, 0x2c, 0x1b, 0x00, 0x01, - 0x40, 0x82, 0x00, 0x54, 0x54, 0x00, 0x07, 0xbd, 0x41, 0x82, 0x00, 0x4c, 0x82, 0x3a, 0x00, 0x34, - 0x48, 0x00, 0x00, 0x30, 0x60, 0x00, 0x00, 0x00, 0x7f, 0xc3, 0xf3, 0x78, 0x38, 0x91, 0x00, 0x04, - 0x38, 0xa0, 0x00, 0x06, 0x48, 0x00, 0x13, 0x8d, 0x2c, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x10, - 0x38, 0x11, 0x00, 0x04, 0x48, 0x00, 0x00, 0x18, 0x60, 0x00, 0x00, 0x00, 0x82, 0x31, 0x00, 0x00, - 0x28, 0x11, 0x00, 0x00, 0x40, 0x82, 0xff, 0xd4, 0x38, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, - 0x41, 0x82, 0x00, 0x38, 0x28, 0x19, 0x00, 0x00, 0x41, 0x82, 0x00, 0x24, 0x80, 0x62, 0x00, 0xec, - 0x7e, 0x44, 0x93, 0x78, 0x48, 0x00, 0x11, 0x4d, 0x7c, 0x64, 0x1b, 0x78, 0x7f, 0x23, 0xcb, 0x78, - 0x7f, 0x05, 0xc3, 0x78, 0x7e, 0xe6, 0xbb, 0x78, 0x4b, 0xff, 0xfc, 0x49, 0x7f, 0x59, 0xd3, 0x78, - 0x7f, 0x98, 0xe3, 0x78, 0x7f, 0x77, 0xdb, 0x78, 0x80, 0x62, 0x00, 0xb8, 0x7f, 0x44, 0xd3, 0x78, - 0x48, 0x00, 0x11, 0x21, 0x7c, 0x7a, 0x1b, 0x78, 0x28, 0x1a, 0x00, 0x00, 0x40, 0x82, 0xfe, 0x94, - 0x28, 0x19, 0x00, 0x00, 0x41, 0x82, 0x00, 0x1c, 0x7f, 0x23, 0xcb, 0x78, 0x7f, 0xe4, 0xfb, 0x78, - 0x7f, 0x05, 0xc3, 0x78, 0x7e, 0xe6, 0xbb, 0x78, 0x4b, 0xff, 0xfc, 0x09, 0x48, 0x00, 0x00, 0x20, - 0x80, 0x62, 0x00, 0xf4, 0x7f, 0xe4, 0xfb, 0x78, 0x48, 0x00, 0x10, 0xe9, 0x38, 0x82, 0x04, 0xdc, - 0x80, 0x64, 0x00, 0x00, 0x38, 0x03, 0x00, 0x01, 0x90, 0x04, 0x00, 0x00, 0x80, 0x01, 0x00, 0x88, - 0x38, 0x21, 0x00, 0x80, 0xba, 0x21, 0xff, 0xc4, 0x7c, 0x08, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, - 0xbf, 0xa1, 0xff, 0xf4, 0x7c, 0x08, 0x02, 0xa6, 0x7c, 0x9f, 0x23, 0x78, 0x7c, 0x7d, 0x1b, 0x78, - 0x38, 0xc2, 0x04, 0xec, 0x38, 0x80, 0x00, 0x00, 0x7f, 0xe3, 0xfb, 0x78, 0x90, 0x01, 0x00, 0x08, - 0x94, 0x21, 0xff, 0xb0, 0x80, 0xa6, 0x00, 0x00, 0x38, 0x05, 0x00, 0x01, 0x90, 0x06, 0x00, 0x00, - 0x4b, 0xff, 0xec, 0xf1, 0x7c, 0x7e, 0x1b, 0x79, 0x41, 0x82, 0x00, 0x2c, 0x80, 0x7e, 0x00, 0x0c, - 0x7f, 0xa4, 0xeb, 0x78, 0x7f, 0xe5, 0xfb, 0x78, 0x48, 0x00, 0x11, 0xc9, 0x80, 0x1e, 0x00, 0x10, - 0x7f, 0xc3, 0xf3, 0x78, 0x7c, 0x00, 0xfa, 0x14, 0x90, 0x1e, 0x00, 0x10, 0x4b, 0xff, 0xfd, 0x65, - 0x48, 0x00, 0x00, 0x14, 0x38, 0x82, 0x04, 0xe0, 0x80, 0x64, 0x00, 0x00, 0x38, 0x03, 0x00, 0x01, - 0x90, 0x04, 0x00, 0x00, 0x80, 0x01, 0x00, 0x58, 0x38, 0x21, 0x00, 0x50, 0xbb, 0xa1, 0xff, 0xf4, - 0x7c, 0x08, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xbf, 0x81, 0xff, 0xf0, 0x7c, 0x08, 0x02, 0xa6, 0x28, 0x05, 0x00, 0x00, 0x7c, 0x9c, 0x23, 0x78, - 0x39, 0x22, 0x04, 0xf8, 0x7c, 0xdd, 0x33, 0x78, 0x7c, 0xfe, 0x3b, 0x78, 0x7d, 0x1f, 0x43, 0x78, - 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xb0, 0x80, 0x69, 0x00, 0x00, 0x38, 0x03, 0x00, 0x01, - 0x90, 0x09, 0x00, 0x00, 0x41, 0x82, 0x00, 0x10, 0x80, 0x62, 0x00, 0xf4, 0x7c, 0xa4, 0x2b, 0x78, - 0x48, 0x00, 0x0f, 0xf1, 0x38, 0x60, 0x00, 0x10, 0x38, 0x80, 0x00, 0x03, 0x4b, 0xff, 0xec, 0x45, - 0x7c, 0x65, 0x1b, 0x79, 0x41, 0x82, 0x00, 0x40, 0x80, 0x65, 0x00, 0x14, 0x38, 0xc0, 0x00, 0x83, - 0x38, 0x00, 0x00, 0x05, 0x7f, 0x84, 0xe3, 0x78, 0x98, 0xc3, 0x00, 0x0d, 0x80, 0x65, 0x00, 0x10, - 0x90, 0x03, 0x00, 0x00, 0x93, 0xa3, 0x00, 0x04, 0x93, 0xc3, 0x00, 0x08, 0x93, 0xe3, 0x00, 0x0c, - 0x80, 0x65, 0x00, 0x10, 0x38, 0x03, 0x00, 0x10, 0x90, 0x05, 0x00, 0x10, 0x80, 0x62, 0x00, 0xd4, - 0x48, 0x00, 0x0f, 0xf1, 0x80, 0x01, 0x00, 0x58, 0x38, 0x21, 0x00, 0x50, 0xbb, 0x81, 0xff, 0xf0, - 0x7c, 0x08, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xbf, 0xa1, 0xff, 0xf4, 0x7c, 0x08, 0x02, 0xa6, 0x7c, 0xbe, 0x2b, 0x78, 0x7c, 0x9d, 0x23, 0x78, - 0x7c, 0xdf, 0x33, 0x78, 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xb0, 0x80, 0x65, 0x00, 0x14, - 0x88, 0x03, 0x00, 0x0c, 0x28, 0x00, 0x00, 0x01, 0x41, 0x82, 0x00, 0x28, 0x80, 0x62, 0x00, 0xf4, - 0x7f, 0xc4, 0xf3, 0x78, 0x48, 0x00, 0x0f, 0x4d, 0x38, 0x60, 0x00, 0x10, 0x38, 0x80, 0x00, 0x03, - 0x4b, 0xff, 0xeb, 0xa1, 0x7c, 0x7e, 0x1b, 0x79, 0x40, 0x82, 0x00, 0x24, 0x48, 0x00, 0x00, 0x58, - 0x80, 0x9e, 0x00, 0x08, 0x28, 0x04, 0x00, 0x00, 0x41, 0x82, 0x00, 0x14, 0x80, 0x62, 0x00, 0xf4, - 0x48, 0x00, 0x0f, 0x21, 0x38, 0x00, 0x00, 0x00, 0x90, 0x1e, 0x00, 0x08, 0x80, 0x7e, 0x00, 0x14, - 0x38, 0xc0, 0x00, 0x83, 0x38, 0x00, 0x00, 0x06, 0x7f, 0xa4, 0xeb, 0x78, 0x7f, 0xc5, 0xf3, 0x78, - 0x98, 0xc3, 0x00, 0x0d, 0x80, 0x7e, 0x00, 0x0c, 0x90, 0x03, 0x00, 0x00, 0x93, 0xe3, 0x00, 0x04, - 0x80, 0x7e, 0x00, 0x0c, 0x38, 0x03, 0x00, 0x08, 0x90, 0x1e, 0x00, 0x10, 0x80, 0x62, 0x00, 0xd4, - 0x48, 0x00, 0x0f, 0x31, 0x80, 0x01, 0x00, 0x58, 0x38, 0x21, 0x00, 0x50, 0xbb, 0xa1, 0xff, 0xf4, - 0x7c, 0x08, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xbf, 0x01, 0xff, 0xe0, 0x7c, 0x08, 0x02, 0xa6, 0x7c, 0x78, 0x1b, 0x78, 0x7c, 0x99, 0x23, 0x78, - 0x3b, 0xe2, 0x02, 0x5c, 0x7c, 0xba, 0x2b, 0x78, 0x3b, 0xa0, 0x00, 0x00, 0x3b, 0x80, 0x00, 0x0e, - 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xa0, 0x80, 0x03, 0x00, 0x04, 0x28, 0x00, 0x00, 0x00, - 0x41, 0x82, 0x00, 0x4c, 0x80, 0x18, 0x00, 0x08, 0x38, 0x60, 0x00, 0x02, 0x54, 0x00, 0x07, 0xff, - 0x41, 0x82, 0x00, 0x08, 0x38, 0x60, 0x00, 0x07, 0xa0, 0x18, 0x00, 0x0c, 0x7c, 0x7d, 0x1b, 0x78, - 0x2c, 0x00, 0x00, 0xaa, 0x40, 0x82, 0x00, 0x0c, 0x3b, 0x80, 0x00, 0x16, 0x48, 0x00, 0x00, 0x20, - 0x2c, 0x00, 0x00, 0xfe, 0x40, 0x81, 0x00, 0x0c, 0x2c, 0x00, 0x00, 0xff, 0x40, 0x82, 0x00, 0x0c, - 0x3b, 0x80, 0x00, 0x11, 0x48, 0x00, 0x00, 0x08, 0x3b, 0x80, 0x00, 0x0e, 0x3b, 0xdd, 0x00, 0x58, - 0x38, 0x80, 0x00, 0x01, 0x7f, 0xc3, 0xf3, 0x78, 0x4b, 0xff, 0xea, 0x99, 0x7c, 0x7b, 0x1b, 0x79, - 0x40, 0x82, 0x00, 0x24, 0x7f, 0x03, 0xc3, 0x78, 0x7f, 0x24, 0xcb, 0x78, 0x7f, 0x45, 0xd3, 0x78, - 0x38, 0xc0, 0x00, 0x00, 0x38, 0xe0, 0x00, 0x04, 0x39, 0x00, 0x00, 0x0c, 0x4b, 0xff, 0xfd, 0xe5, - 0x48, 0x00, 0x01, 0x44, 0x80, 0x7b, 0x00, 0x14, 0x38, 0x80, 0x00, 0x83, 0x38, 0xc0, 0x00, 0x03, - 0x38, 0xa0, 0x00, 0x02, 0x38, 0x00, 0x05, 0x00, 0x98, 0x83, 0x00, 0x0d, 0x38, 0x80, 0x00, 0x04, - 0x80, 0x7b, 0x00, 0x0c, 0x90, 0xc3, 0x00, 0x00, 0x90, 0xa3, 0x00, 0x20, 0x90, 0x03, 0x00, 0x34, - 0x90, 0xa3, 0x00, 0x3c, 0x80, 0x18, 0x00, 0x04, 0x90, 0x03, 0x00, 0x18, 0x80, 0x18, 0x00, 0x10, - 0x2c, 0x00, 0x00, 0x00, 0x41, 0x82, 0x00, 0x08, 0x38, 0x80, 0x00, 0x00, 0x7c, 0x80, 0x07, 0x34, - 0x39, 0x20, 0x00, 0x00, 0x90, 0x03, 0x00, 0x10, 0x39, 0x00, 0xff, 0xff, 0x38, 0xe0, 0x00, 0x01, - 0x20, 0xdc, 0x05, 0xea, 0x7c, 0xbd, 0x00, 0xd0, 0x38, 0x9d, 0x00, 0x06, 0x38, 0x00, 0x00, 0x4c, - 0x91, 0x23, 0x00, 0x14, 0x28, 0x1d, 0x00, 0x00, 0x91, 0x23, 0x00, 0x24, 0x91, 0x03, 0x00, 0x28, - 0x91, 0x23, 0x00, 0x2c, 0x91, 0x03, 0x00, 0x30, 0x91, 0x23, 0x00, 0x48, 0x90, 0xe3, 0x00, 0x08, - 0x90, 0xc3, 0x00, 0x04, 0x90, 0xa3, 0x00, 0x1c, 0x90, 0x83, 0x00, 0x0c, 0x90, 0x03, 0x00, 0x38, - 0x80, 0xbb, 0x00, 0x0c, 0x80, 0x83, 0x00, 0x38, 0x80, 0x1f, 0x00, 0x00, 0x7c, 0x85, 0x22, 0x14, - 0x90, 0x04, 0x00, 0x00, 0xa0, 0x1f, 0x00, 0x04, 0xb0, 0x04, 0x00, 0x04, 0x41, 0x82, 0x00, 0x28, - 0xa0, 0x18, 0x00, 0x0c, 0xb0, 0x04, 0x00, 0x06, 0x80, 0x18, 0x00, 0x08, 0x54, 0x00, 0x07, 0xff, - 0x41, 0x82, 0x00, 0x14, 0x80, 0x18, 0x00, 0x2c, 0x90, 0x04, 0x00, 0x08, 0x88, 0x18, 0x00, 0x30, - 0x98, 0x04, 0x00, 0x0c, 0x38, 0x00, 0x00, 0x06, 0x3c, 0x80, 0x00, 0x01, 0x90, 0x03, 0x00, 0x40, - 0x38, 0x1d, 0x00, 0x52, 0x38, 0xe0, 0xff, 0xff, 0x38, 0xc4, 0xff, 0xff, 0x7f, 0x44, 0xd3, 0x78, - 0x90, 0x03, 0x00, 0x44, 0x80, 0xbb, 0x00, 0x0c, 0x80, 0x03, 0x00, 0x44, 0x7c, 0xe5, 0x01, 0x2e, - 0x80, 0x63, 0x00, 0x44, 0x80, 0xbb, 0x00, 0x0c, 0x38, 0x03, 0x00, 0x04, 0x7c, 0xc5, 0x03, 0x2e, - 0x80, 0x1b, 0x00, 0x10, 0x7c, 0x00, 0xf2, 0x14, 0x90, 0x1b, 0x00, 0x10, 0x80, 0x62, 0x00, 0xf4, - 0x48, 0x00, 0x0c, 0xe1, 0x80, 0x62, 0x00, 0xd4, 0x7f, 0x24, 0xcb, 0x78, 0x7f, 0x65, 0xdb, 0x78, - 0x48, 0x00, 0x0d, 0x21, 0x80, 0x01, 0x00, 0x68, 0x38, 0x21, 0x00, 0x60, 0xbb, 0x01, 0xff, 0xe0, - 0x7c, 0x08, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xbf, 0x41, 0xff, 0xe8, 0x7c, 0x08, 0x02, 0xa6, 0x7c, 0x7a, 0x1b, 0x78, 0x7c, 0x9d, 0x23, 0x78, - 0x3b, 0x82, 0x02, 0x5c, 0x7c, 0xbe, 0x2b, 0x78, 0x38, 0x60, 0x00, 0x12, 0x38, 0x80, 0x00, 0x03, - 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xb0, 0x83, 0x65, 0x00, 0x0c, 0x4b, 0xff, 0xe8, 0xe5, - 0x7c, 0x7f, 0x1b, 0x79, 0x40, 0x82, 0x00, 0x24, 0x7f, 0x43, 0xd3, 0x78, 0x7f, 0xa4, 0xeb, 0x78, - 0x7f, 0xc5, 0xf3, 0x78, 0x38, 0xc0, 0x00, 0x31, 0x38, 0xe0, 0x00, 0x04, 0x39, 0x00, 0x00, 0x0c, - 0x4b, 0xff, 0xfc, 0x31, 0x48, 0x00, 0x00, 0xb0, 0x80, 0xbf, 0x00, 0x14, 0x38, 0xc0, 0x00, 0x83, - 0x38, 0x80, 0x00, 0x32, 0x38, 0x60, 0x00, 0x06, 0x38, 0x00, 0x00, 0x0c, 0x98, 0xc5, 0x00, 0x0d, - 0x80, 0xbf, 0x00, 0x10, 0x90, 0x85, 0x00, 0x00, 0x90, 0x65, 0x00, 0x04, 0x90, 0x05, 0x00, 0x08, - 0x80, 0x7f, 0x00, 0x10, 0x38, 0x03, 0x00, 0x12, 0x90, 0x1f, 0x00, 0x10, 0x80, 0x1b, 0x00, 0x04, - 0x28, 0x00, 0x00, 0x02, 0x41, 0x82, 0x00, 0x0c, 0x28, 0x00, 0x00, 0x01, 0x40, 0x82, 0x00, 0x2c, - 0x80, 0x9c, 0x00, 0x00, 0x80, 0x7f, 0x00, 0x0c, 0x80, 0x05, 0x00, 0x08, 0x7c, 0x83, 0x01, 0x2e, - 0x80, 0x65, 0x00, 0x08, 0xa0, 0xbc, 0x00, 0x04, 0x80, 0x9f, 0x00, 0x0c, 0x38, 0x03, 0x00, 0x04, - 0x7c, 0xa4, 0x03, 0x2e, 0x48, 0x00, 0x00, 0x24, 0x7f, 0x43, 0xd3, 0x78, 0x7f, 0xa4, 0xeb, 0x78, - 0x7f, 0xc5, 0xf3, 0x78, 0x38, 0xc0, 0x00, 0x31, 0x38, 0xe0, 0x00, 0x09, 0x39, 0x00, 0x00, 0x00, - 0x4b, 0xff, 0xfb, 0xa1, 0x48, 0x00, 0x00, 0x20, 0x80, 0x62, 0x00, 0xf4, 0x7f, 0xc4, 0xf3, 0x78, - 0x48, 0x00, 0x0b, 0xc1, 0x80, 0x62, 0x00, 0xd4, 0x7f, 0xa4, 0xeb, 0x78, 0x7f, 0xe5, 0xfb, 0x78, - 0x48, 0x00, 0x0c, 0x01, 0x80, 0x01, 0x00, 0x58, 0x38, 0x21, 0x00, 0x50, 0xbb, 0x41, 0xff, 0xe8, - 0x7c, 0x08, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xbf, 0x41, 0xff, 0xe8, 0x7c, 0x08, 0x02, 0xa6, 0x7c, 0x7a, 0x1b, 0x78, 0x7c, 0xbc, 0x2b, 0x78, - 0x3b, 0xe2, 0x02, 0x5c, 0x7c, 0x9b, 0x23, 0x78, 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xb0, - 0x80, 0x03, 0x00, 0x04, 0x80, 0xc5, 0x00, 0x0c, 0x28, 0x00, 0x00, 0x00, 0x83, 0xc6, 0x00, 0x04, - 0x41, 0x82, 0x00, 0x18, 0x38, 0xc0, 0x00, 0x01, 0x38, 0xe0, 0x00, 0x03, 0x39, 0x00, 0x00, 0x00, - 0x4b, 0xff, 0xfb, 0x21, 0x48, 0x00, 0x01, 0x8c, 0xa0, 0x06, 0x00, 0x0c, 0x2c, 0x00, 0x00, 0x02, - 0x40, 0x82, 0x00, 0x10, 0x80, 0x06, 0x00, 0x08, 0x28, 0x00, 0x00, 0x00, 0x41, 0x82, 0x00, 0x24, - 0x7f, 0x43, 0xd3, 0x78, 0x7f, 0x64, 0xdb, 0x78, 0x7f, 0x85, 0xe3, 0x78, 0x38, 0xc0, 0x00, 0x01, - 0x38, 0xe0, 0x00, 0x07, 0x39, 0x00, 0x00, 0x00, 0x4b, 0xff, 0xfa, 0xe9, 0x48, 0x00, 0x01, 0x54, - 0x28, 0x1e, 0x00, 0xfe, 0x41, 0x81, 0x00, 0x20, 0x57, 0xc0, 0x07, 0xff, 0x41, 0x82, 0x00, 0x18, - 0x38, 0xc0, 0x00, 0x01, 0x38, 0xe0, 0x00, 0x01, 0x39, 0x00, 0x00, 0x00, 0x4b, 0xff, 0xfa, 0xc5, - 0x48, 0x00, 0x01, 0x30, 0x57, 0xc3, 0x04, 0x3e, 0x7c, 0x64, 0x1b, 0x78, 0x4b, 0xff, 0xf1, 0xa5, - 0x54, 0x60, 0x04, 0x3e, 0x2c, 0x00, 0x00, 0x05, 0x40, 0x82, 0x00, 0x24, 0x7f, 0x43, 0xd3, 0x78, - 0x7f, 0x64, 0xdb, 0x78, 0x7f, 0x85, 0xe3, 0x78, 0x38, 0xc0, 0x00, 0x01, 0x38, 0xe0, 0x00, 0x01, - 0x39, 0x00, 0x00, 0x00, 0x4b, 0xff, 0xfa, 0x8d, 0x48, 0x00, 0x00, 0xf8, 0x38, 0x60, 0x00, 0x20, - 0x38, 0x80, 0x00, 0x03, 0x4b, 0xff, 0xe7, 0x0d, 0x7c, 0x7d, 0x1b, 0x79, 0x40, 0x82, 0x00, 0x24, - 0x7f, 0x43, 0xd3, 0x78, 0x7f, 0x64, 0xdb, 0x78, 0x7f, 0x85, 0xe3, 0x78, 0x38, 0xc0, 0x00, 0x01, - 0x38, 0xe0, 0x00, 0x04, 0x39, 0x00, 0x00, 0x0c, 0x4b, 0xff, 0xfa, 0x59, 0x48, 0x00, 0x00, 0xc4, - 0x80, 0x7d, 0x00, 0x14, 0x38, 0x80, 0x00, 0x83, 0x38, 0x00, 0x00, 0x04, 0x38, 0xe0, 0x00, 0x04, - 0x38, 0xc0, 0x00, 0x08, 0x7c, 0x09, 0x03, 0xa6, 0x98, 0x83, 0x00, 0x0d, 0x38, 0xa0, 0x00, 0x00, - 0x38, 0x80, 0x00, 0x18, 0x7c, 0xa3, 0x2b, 0x78, 0x81, 0x1d, 0x00, 0x0c, 0x90, 0xe8, 0x00, 0x00, - 0x93, 0xc8, 0x00, 0x04, 0x90, 0xc8, 0x00, 0x08, 0x90, 0x88, 0x00, 0x0c, 0x90, 0xa8, 0x00, 0x10, - 0x90, 0xa8, 0x00, 0x14, 0x80, 0x9d, 0x00, 0x0c, 0x80, 0x1f, 0x00, 0x00, 0x90, 0x04, 0x00, 0x18, - 0xa0, 0x1f, 0x00, 0x04, 0xb0, 0x04, 0x00, 0x1c, 0xb3, 0xc4, 0x00, 0x1e, 0x80, 0x9d, 0x00, 0x0c, - 0x38, 0x04, 0x00, 0x20, 0x90, 0x1d, 0x00, 0x10, 0x38, 0x03, 0x00, 0x1c, 0x38, 0x63, 0x00, 0x04, - 0x7c, 0xba, 0x01, 0x2e, 0x42, 0x00, 0xff, 0xf4, 0x28, 0x1e, 0x00, 0xfe, 0x41, 0x81, 0x00, 0x10, - 0x80, 0x1a, 0x00, 0x28, 0x64, 0x00, 0x80, 0x00, 0x90, 0x1a, 0x00, 0x28, 0x38, 0x00, 0x00, 0x03, - 0x7f, 0x84, 0xe3, 0x78, 0x90, 0x1a, 0x00, 0x04, 0xb3, 0xda, 0x00, 0x0c, 0x80, 0x1a, 0x00, 0x08, - 0x54, 0x00, 0x00, 0x3c, 0x90, 0x1a, 0x00, 0x08, 0x80, 0x62, 0x00, 0xf4, 0x48, 0x00, 0x09, 0xd5, - 0x80, 0x62, 0x00, 0xd4, 0x7f, 0x64, 0xdb, 0x78, 0x7f, 0xa5, 0xeb, 0x78, 0x48, 0x00, 0x0a, 0x15, - 0x80, 0x01, 0x00, 0x58, 0x38, 0x21, 0x00, 0x50, 0xbb, 0x41, 0xff, 0xe8, 0x7c, 0x08, 0x03, 0xa6, - 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xbf, 0x81, 0xff, 0xf0, 0x7c, 0x08, 0x02, 0xa6, 0x7c, 0x7c, 0x1b, 0x78, 0x7c, 0x9d, 0x23, 0x78, - 0x7c, 0xbe, 0x2b, 0x78, 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xb0, 0x80, 0x03, 0x00, 0x04, - 0x28, 0x00, 0x00, 0x03, 0x41, 0x82, 0x00, 0x18, 0x38, 0xc0, 0x00, 0x02, 0x38, 0xe0, 0x00, 0x03, - 0x39, 0x00, 0x00, 0x00, 0x4b, 0xff, 0xf9, 0x3d, 0x48, 0x00, 0x00, 0x58, 0x38, 0x00, 0x00, 0x00, - 0x38, 0xa0, 0x00, 0x00, 0x90, 0x1c, 0x00, 0x04, 0xb0, 0x1c, 0x00, 0x0c, 0x80, 0x62, 0x00, 0xd0, - 0x48, 0x00, 0x09, 0xa1, 0x3b, 0xfd, 0xff, 0xc0, 0x80, 0x62, 0x00, 0xd0, 0x38, 0xa0, 0x00, 0x00, - 0x7f, 0xe4, 0xfb, 0x78, 0x48, 0x00, 0x09, 0x8d, 0x80, 0x62, 0x00, 0xdc, 0x7f, 0xe4, 0xfb, 0x78, - 0x38, 0xa0, 0x00, 0x86, 0x38, 0xc0, 0x00, 0x03, 0x48, 0x00, 0x09, 0xc9, 0x7f, 0x83, 0xe3, 0x78, - 0x7f, 0xa4, 0xeb, 0x78, 0x7f, 0xc5, 0xf3, 0x78, 0x38, 0xc0, 0x00, 0x02, 0x4b, 0xff, 0xf9, 0x95, - 0x80, 0x01, 0x00, 0x58, 0x38, 0x21, 0x00, 0x50, 0xbb, 0x81, 0xff, 0xf0, 0x7c, 0x08, 0x03, 0xa6, - 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xbf, 0x21, 0xff, 0xe4, 0x7c, 0x08, 0x02, 0xa6, 0x7c, 0xbd, 0x2b, 0x78, 0x7c, 0x7b, 0x1b, 0x78, - 0x7c, 0x9c, 0x23, 0x78, 0x38, 0xe0, 0x00, 0x00, 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xa0, - 0x81, 0x05, 0x00, 0x0c, 0x80, 0x03, 0x00, 0x04, 0x80, 0xc8, 0x00, 0x04, 0x28, 0x00, 0x00, 0x03, - 0x83, 0xc8, 0x00, 0x08, 0x7f, 0xe8, 0x32, 0x14, 0xa0, 0xdf, 0x00, 0x00, 0x41, 0x82, 0x00, 0x18, - 0x38, 0xc0, 0x00, 0x1b, 0x38, 0xe0, 0x00, 0x03, 0x39, 0x00, 0x00, 0x00, 0x4b, 0xff, 0xf8, 0x75, - 0x48, 0x00, 0x01, 0xbc, 0x80, 0x08, 0x00, 0x0c, 0x2c, 0x00, 0x00, 0x02, 0x41, 0x82, 0x00, 0x7c, - 0x40, 0x80, 0x00, 0xc0, 0x2c, 0x00, 0x00, 0x01, 0x40, 0x80, 0x00, 0x08, 0x48, 0x00, 0x00, 0xb4, - 0xa0, 0x1b, 0x00, 0x0c, 0x2c, 0x00, 0x00, 0xfe, 0x41, 0x81, 0x00, 0x58, 0x54, 0xc0, 0x07, 0xff, - 0x41, 0x82, 0x00, 0x30, 0x28, 0x1e, 0x00, 0x02, 0x40, 0x82, 0x00, 0x28, 0x54, 0xc4, 0xe7, 0x3a, - 0x38, 0x60, 0x00, 0x01, 0x7c, 0xbb, 0x22, 0x14, 0x54, 0xc0, 0xfe, 0xfe, 0x80, 0x85, 0x00, 0x1c, - 0x7c, 0x60, 0x00, 0x30, 0x7c, 0x80, 0x03, 0x78, 0x90, 0x05, 0x00, 0x1c, 0x48, 0x00, 0x00, 0x78, - 0x54, 0xc0, 0x04, 0x3f, 0x40, 0x82, 0x00, 0x14, 0x80, 0x1b, 0x00, 0x08, 0x60, 0x00, 0x00, 0x04, - 0x90, 0x1b, 0x00, 0x08, 0x48, 0x00, 0x00, 0x60, 0x38, 0xe0, 0x00, 0x01, 0x48, 0x00, 0x00, 0x58, - 0x38, 0xe0, 0x00, 0x07, 0x48, 0x00, 0x00, 0x50, 0xa0, 0x1b, 0x00, 0x0c, 0x2c, 0x00, 0x00, 0xaa, - 0x40, 0x82, 0x00, 0x38, 0x80, 0x1b, 0x00, 0x08, 0x54, 0x00, 0x07, 0xff, 0x41, 0x82, 0x00, 0x0c, - 0x38, 0xe0, 0x00, 0x13, 0x48, 0x00, 0x00, 0x30, 0x80, 0x1f, 0x00, 0x00, 0x90, 0x1b, 0x00, 0x2c, - 0x88, 0x1f, 0x00, 0x04, 0x98, 0x1b, 0x00, 0x30, 0x80, 0x1b, 0x00, 0x08, 0x60, 0x00, 0x00, 0x01, - 0x90, 0x1b, 0x00, 0x08, 0x48, 0x00, 0x00, 0x10, 0x38, 0xe0, 0x00, 0x01, 0x48, 0x00, 0x00, 0x08, - 0x38, 0xe0, 0x00, 0x07, 0x2c, 0x07, 0x00, 0x00, 0x41, 0x82, 0x00, 0x20, 0x7f, 0x63, 0xdb, 0x78, - 0x7f, 0x84, 0xe3, 0x78, 0x7f, 0xa5, 0xeb, 0x78, 0x38, 0xc0, 0x00, 0x1b, 0x39, 0x00, 0x00, 0x00, - 0x4b, 0xff, 0xf7, 0x81, 0x48, 0x00, 0x00, 0xc8, 0x3b, 0x5e, 0x00, 0x0c, 0x38, 0x80, 0x00, 0x03, - 0x7f, 0x43, 0xd3, 0x78, 0x4b, 0xff, 0xe3, 0xfd, 0x7c, 0x79, 0x1b, 0x79, 0x40, 0x82, 0x00, 0x24, - 0x7f, 0x63, 0xdb, 0x78, 0x7f, 0x84, 0xe3, 0x78, 0x7f, 0xa5, 0xeb, 0x78, 0x38, 0xc0, 0x00, 0x1b, - 0x38, 0xe0, 0x00, 0x04, 0x39, 0x00, 0x00, 0x0c, 0x4b, 0xff, 0xf7, 0x49, 0x48, 0x00, 0x00, 0x90, - 0x80, 0x79, 0x00, 0x14, 0x38, 0x00, 0x00, 0x83, 0x7f, 0x45, 0xd3, 0x78, 0x38, 0x80, 0x00, 0x00, - 0x98, 0x03, 0x00, 0x0d, 0x83, 0x59, 0x00, 0x10, 0x7f, 0x43, 0xd3, 0x78, 0x48, 0x00, 0x08, 0xe5, - 0x38, 0x60, 0x00, 0x1c, 0x20, 0x1e, 0x00, 0x00, 0x90, 0x7a, 0x00, 0x00, 0x7c, 0x60, 0x01, 0x10, - 0x38, 0x00, 0x00, 0x0c, 0x7c, 0x00, 0x18, 0x38, 0x2c, 0x1e, 0x00, 0x00, 0x93, 0xda, 0x00, 0x08, - 0x90, 0x1a, 0x00, 0x04, 0x80, 0x79, 0x00, 0x10, 0x38, 0x03, 0x00, 0x0c, 0x90, 0x19, 0x00, 0x10, - 0x41, 0x82, 0x00, 0x14, 0x80, 0x79, 0x00, 0x10, 0x7f, 0xe4, 0xfb, 0x78, 0x7f, 0xc5, 0xf3, 0x78, - 0x48, 0x00, 0x08, 0x61, 0x80, 0x19, 0x00, 0x10, 0x7f, 0xa4, 0xeb, 0x78, 0x7c, 0x00, 0xf2, 0x14, - 0x90, 0x19, 0x00, 0x10, 0x80, 0x62, 0x00, 0xf4, 0x48, 0x00, 0x06, 0xf9, 0x80, 0x62, 0x00, 0xd4, - 0x7f, 0x84, 0xe3, 0x78, 0x7f, 0x25, 0xcb, 0x78, 0x48, 0x00, 0x07, 0x39, 0x80, 0x01, 0x00, 0x68, - 0x38, 0x21, 0x00, 0x60, 0xbb, 0x21, 0xff, 0xe4, 0x7c, 0x08, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, - 0xbf, 0x81, 0xff, 0xf0, 0x7c, 0x08, 0x02, 0xa6, 0x7c, 0x7c, 0x1b, 0x78, 0x7c, 0xbe, 0x2b, 0x78, - 0x7c, 0x9d, 0x23, 0x78, 0x3b, 0xe0, 0x00, 0x00, 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xb0, - 0x80, 0xe5, 0x00, 0x0c, 0x80, 0x03, 0x00, 0x04, 0x80, 0xc7, 0x00, 0x04, 0x28, 0x00, 0x00, 0x03, - 0x81, 0x07, 0x00, 0x08, 0x7c, 0xc7, 0x32, 0x14, 0x41, 0x82, 0x00, 0x18, 0x38, 0xc0, 0x00, 0x15, - 0x38, 0xe0, 0x00, 0x03, 0x39, 0x00, 0x00, 0x00, 0x4b, 0xff, 0xf6, 0x59, 0x48, 0x00, 0x00, 0xf4, - 0x2c, 0x08, 0x00, 0x01, 0x40, 0x82, 0x00, 0x58, 0x88, 0x86, 0x00, 0x00, 0x54, 0x80, 0x07, 0xff, - 0x41, 0x82, 0x00, 0x44, 0x28, 0x04, 0x00, 0xff, 0x41, 0x82, 0x00, 0x3c, 0xa0, 0x1c, 0x00, 0x0c, - 0x2c, 0x00, 0x00, 0xfe, 0x41, 0x81, 0x00, 0x28, 0x54, 0x83, 0xe7, 0x3a, 0x54, 0x80, 0xfe, 0xfe, - 0x7c, 0x9c, 0x1a, 0x14, 0x38, 0x60, 0x00, 0x01, 0x7c, 0x60, 0x00, 0x30, 0x80, 0x64, 0x00, 0x1c, - 0x7c, 0x60, 0x00, 0x78, 0x90, 0x04, 0x00, 0x1c, 0x48, 0x00, 0x00, 0x60, 0x3b, 0xe0, 0x00, 0x07, - 0x48, 0x00, 0x00, 0x58, 0x3b, 0xe0, 0x00, 0x01, 0x48, 0x00, 0x00, 0x50, 0x2c, 0x08, 0x00, 0x05, - 0x40, 0x82, 0x00, 0x48, 0xa0, 0x1c, 0x00, 0x0c, 0x2c, 0x00, 0x00, 0xaa, 0x40, 0x82, 0x00, 0x38, - 0x80, 0x1c, 0x00, 0x08, 0x54, 0x00, 0x07, 0xff, 0x41, 0x82, 0x00, 0x24, 0x7c, 0xc4, 0x33, 0x78, - 0x7d, 0x05, 0x43, 0x78, 0x38, 0x7c, 0x00, 0x2c, 0x48, 0x00, 0x07, 0xf9, 0x2c, 0x03, 0x00, 0x00, - 0x41, 0x82, 0x00, 0x18, 0x3b, 0xe0, 0x00, 0x01, 0x48, 0x00, 0x00, 0x10, 0x3b, 0xe0, 0x00, 0x01, - 0x48, 0x00, 0x00, 0x08, 0x3b, 0xe0, 0x00, 0x07, 0x2c, 0x1f, 0x00, 0x00, 0x41, 0x82, 0x00, 0x24, - 0x7f, 0x83, 0xe3, 0x78, 0x7f, 0xa4, 0xeb, 0x78, 0x7f, 0xc5, 0xf3, 0x78, 0x7f, 0xe7, 0xfb, 0x78, - 0x38, 0xc0, 0x00, 0x15, 0x39, 0x00, 0x00, 0x00, 0x4b, 0xff, 0xf5, 0x89, 0x48, 0x00, 0x00, 0x24, - 0x80, 0x1c, 0x00, 0x08, 0x7f, 0x83, 0xe3, 0x78, 0x7f, 0xa4, 0xeb, 0x78, 0x7f, 0xc5, 0xf3, 0x78, - 0x38, 0xc0, 0x00, 0x15, 0x54, 0x00, 0x00, 0x3c, 0x90, 0x1c, 0x00, 0x08, 0x4b, 0xff, 0xf6, 0x15, - 0x80, 0x01, 0x00, 0x58, 0x38, 0x21, 0x00, 0x50, 0xbb, 0x81, 0xff, 0xf0, 0x7c, 0x08, 0x03, 0xa6, - 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xbf, 0x41, 0xff, 0xe8, 0x7c, 0x08, 0x02, 0xa6, 0x7c, 0x7a, 0x1b, 0x78, 0x7c, 0xbc, 0x2b, 0x78, - 0x7c, 0x9b, 0x23, 0x78, 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xb0, 0x80, 0x65, 0x00, 0x0c, - 0x80, 0x03, 0x00, 0x08, 0x7f, 0xa3, 0x02, 0x14, 0x7f, 0xa3, 0xeb, 0x78, 0x4b, 0xff, 0xec, 0x65, - 0x2c, 0x03, 0x00, 0x01, 0x41, 0x82, 0x00, 0x24, 0x7f, 0x43, 0xd3, 0x78, 0x7f, 0x64, 0xdb, 0x78, - 0x7f, 0x85, 0xe3, 0x78, 0x38, 0xc0, 0x00, 0x1d, 0x38, 0xe0, 0x00, 0x01, 0x39, 0x00, 0x00, 0x00, - 0x4b, 0xff, 0xf4, 0xf1, 0x48, 0x00, 0x00, 0xd4, 0x83, 0xfa, 0x00, 0x34, 0x48, 0x00, 0x00, 0x2c, - 0x7f, 0xa3, 0xeb, 0x78, 0x38, 0x9f, 0x00, 0x04, 0x38, 0xa0, 0x00, 0x06, 0x48, 0x00, 0x07, 0x05, - 0x2c, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x10, 0x38, 0x1f, 0x00, 0x04, 0x48, 0x00, 0x00, 0x18, - 0x60, 0x00, 0x00, 0x00, 0x83, 0xff, 0x00, 0x00, 0x28, 0x1f, 0x00, 0x00, 0x40, 0x82, 0xff, 0xd4, - 0x38, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x41, 0x82, 0x00, 0x24, 0x7f, 0x43, 0xd3, 0x78, - 0x7f, 0x64, 0xdb, 0x78, 0x7f, 0x85, 0xe3, 0x78, 0x38, 0xc0, 0x00, 0x1d, 0x38, 0xe0, 0x00, 0x01, - 0x39, 0x00, 0x00, 0x00, 0x4b, 0xff, 0xf4, 0x8d, 0x48, 0x00, 0x00, 0x70, 0x7f, 0xa3, 0xeb, 0x78, - 0x4b, 0xff, 0xe0, 0x21, 0x38, 0x60, 0x00, 0x06, 0x48, 0x00, 0x04, 0x49, 0x80, 0x1d, 0x00, 0x00, - 0x7c, 0x7e, 0x1b, 0x78, 0x38, 0x60, 0x00, 0x0c, 0x90, 0x1e, 0x00, 0x00, 0xa0, 0x1d, 0x00, 0x04, - 0xb0, 0x1e, 0x00, 0x04, 0x48, 0x00, 0x04, 0x2d, 0x7c, 0x7f, 0x1b, 0x78, 0x7f, 0xc4, 0xf3, 0x78, - 0x38, 0x7f, 0x00, 0x04, 0x38, 0xa0, 0x00, 0x06, 0x48, 0x00, 0x05, 0xc9, 0x80, 0x1a, 0x00, 0x34, - 0x7f, 0x43, 0xd3, 0x78, 0x7f, 0x64, 0xdb, 0x78, 0x7f, 0x85, 0xe3, 0x78, 0x38, 0xc0, 0x00, 0x1d, - 0x90, 0x1f, 0x00, 0x00, 0x93, 0xfa, 0x00, 0x34, 0x80, 0x1a, 0x00, 0x08, 0x60, 0x00, 0x00, 0x02, - 0x90, 0x1a, 0x00, 0x08, 0x4b, 0xff, 0xf4, 0xcd, 0x80, 0x01, 0x00, 0x58, 0x38, 0x21, 0x00, 0x50, - 0xbb, 0x41, 0xff, 0xe8, 0x7c, 0x08, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, - 0xbf, 0x41, 0xff, 0xe8, 0x7c, 0x08, 0x02, 0xa6, 0x7c, 0x7a, 0x1b, 0x78, 0x7c, 0xbc, 0x2b, 0x78, - 0x7c, 0x9b, 0x23, 0x78, 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xb0, 0x80, 0x65, 0x00, 0x0c, - 0x80, 0x03, 0x00, 0x08, 0x7f, 0xa3, 0x02, 0x14, 0x7f, 0xa3, 0xeb, 0x78, 0x4b, 0xff, 0xeb, 0x25, - 0x2c, 0x03, 0x00, 0x01, 0x41, 0x82, 0x00, 0x24, 0x7f, 0x43, 0xd3, 0x78, 0x7f, 0x64, 0xdb, 0x78, - 0x7f, 0x85, 0xe3, 0x78, 0x38, 0xc0, 0x00, 0x1e, 0x38, 0xe0, 0x00, 0x01, 0x39, 0x00, 0x00, 0x00, - 0x4b, 0xff, 0xf3, 0xb1, 0x48, 0x00, 0x01, 0x10, 0x83, 0xfa, 0x00, 0x34, 0x48, 0x00, 0x00, 0x2c, - 0x7f, 0xa3, 0xeb, 0x78, 0x38, 0x9f, 0x00, 0x04, 0x38, 0xa0, 0x00, 0x06, 0x48, 0x00, 0x05, 0xc5, - 0x2c, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x10, 0x3b, 0xff, 0x00, 0x04, 0x48, 0x00, 0x00, 0x18, - 0x60, 0x00, 0x00, 0x00, 0x83, 0xff, 0x00, 0x00, 0x28, 0x1f, 0x00, 0x00, 0x40, 0x82, 0xff, 0xd4, - 0x3b, 0xe0, 0x00, 0x00, 0x28, 0x1f, 0x00, 0x00, 0x40, 0x82, 0x00, 0x24, 0x7f, 0x43, 0xd3, 0x78, - 0x7f, 0x64, 0xdb, 0x78, 0x7f, 0x85, 0xe3, 0x78, 0x38, 0xc0, 0x00, 0x1e, 0x38, 0xe0, 0x00, 0x01, - 0x39, 0x00, 0x00, 0x00, 0x4b, 0xff, 0xf3, 0x4d, 0x48, 0x00, 0x00, 0xac, 0x83, 0xda, 0x00, 0x34, - 0x48, 0x00, 0x00, 0x20, 0x7f, 0xe3, 0xfb, 0x78, 0x38, 0x9e, 0x00, 0x04, 0x38, 0xa0, 0x00, 0x06, - 0x48, 0x00, 0x05, 0x61, 0x2c, 0x03, 0x00, 0x00, 0x41, 0x82, 0x00, 0x14, 0x83, 0xde, 0x00, 0x00, - 0x28, 0x1e, 0x00, 0x00, 0x40, 0x82, 0xff, 0xe0, 0x48, 0x00, 0x00, 0x40, 0x38, 0x9a, 0x00, 0x34, - 0x48, 0x00, 0x00, 0x30, 0x60, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x7c, 0x00, 0xf0, 0x40, - 0x40, 0x82, 0x00, 0x1c, 0x80, 0x1e, 0x00, 0x00, 0x7f, 0xc3, 0xf3, 0x78, 0x90, 0x04, 0x00, 0x00, - 0x48, 0x00, 0x02, 0xf1, 0x48, 0x00, 0x00, 0x14, 0x60, 0x00, 0x00, 0x00, 0x7c, 0x04, 0x03, 0x78, - 0x28, 0x04, 0x00, 0x00, 0x40, 0x82, 0xff, 0xd4, 0x7f, 0xe3, 0xfb, 0x78, 0x48, 0x00, 0x02, 0xd5, - 0x7f, 0xa3, 0xeb, 0x78, 0x4b, 0xff, 0xde, 0xbd, 0x80, 0x1a, 0x00, 0x34, 0x28, 0x00, 0x00, 0x00, - 0x40, 0x82, 0x00, 0x10, 0x80, 0x1a, 0x00, 0x08, 0x54, 0x00, 0x07, 0xfa, 0x90, 0x1a, 0x00, 0x08, - 0x7f, 0x43, 0xd3, 0x78, 0x7f, 0x64, 0xdb, 0x78, 0x7f, 0x85, 0xe3, 0x78, 0x38, 0xc0, 0x00, 0x1e, - 0x4b, 0xff, 0xf3, 0x51, 0x80, 0x01, 0x00, 0x58, 0x38, 0x21, 0x00, 0x50, 0xbb, 0x41, 0xff, 0xe8, - 0x7c, 0x08, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xbf, 0x81, 0xff, 0xf0, 0x7c, 0x08, 0x02, 0xa6, 0x7c, 0xbf, 0x2b, 0x78, 0x7c, 0x9e, 0x23, 0x78, - 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xb0, 0x80, 0x03, 0x00, 0x04, 0x83, 0xa5, 0x00, 0x0c, - 0x28, 0x00, 0x00, 0x03, 0x41, 0x82, 0x00, 0xb4, 0x80, 0x7d, 0x00, 0x04, 0x38, 0x80, 0x00, 0x03, - 0x38, 0x63, 0x00, 0x14, 0x4b, 0xff, 0xde, 0xdd, 0x7c, 0x7c, 0x1b, 0x79, 0x40, 0x82, 0x00, 0x14, - 0x80, 0x62, 0x00, 0xf4, 0x7f, 0xe4, 0xfb, 0x78, 0x48, 0x00, 0x02, 0x69, 0x48, 0x00, 0x00, 0xa4, - 0x80, 0xdc, 0x00, 0x14, 0x38, 0x00, 0x00, 0x01, 0x38, 0xa0, 0x00, 0x09, 0x38, 0x80, 0x00, 0x03, - 0x38, 0x60, 0x00, 0x00, 0x98, 0x06, 0x00, 0x0d, 0x38, 0x00, 0x00, 0x14, 0x80, 0xdc, 0x00, 0x10, - 0x90, 0xa6, 0x00, 0x00, 0x90, 0x86, 0x00, 0x10, 0x90, 0x66, 0x00, 0x0c, 0x80, 0x7d, 0x00, 0x04, - 0x90, 0x66, 0x00, 0x04, 0x90, 0x06, 0x00, 0x08, 0x80, 0x7c, 0x00, 0x10, 0x38, 0x03, 0x00, 0x14, - 0x90, 0x1c, 0x00, 0x10, 0x80, 0x1d, 0x00, 0x08, 0x80, 0x7c, 0x00, 0x10, 0x80, 0xbd, 0x00, 0x04, - 0x7c, 0x9d, 0x02, 0x14, 0x48, 0x00, 0x03, 0x5d, 0x80, 0x7c, 0x00, 0x10, 0x7f, 0xc4, 0xf3, 0x78, - 0x7f, 0x85, 0xe3, 0x78, 0x80, 0x1d, 0x00, 0x04, 0x7c, 0x03, 0x02, 0x14, 0x90, 0x1c, 0x00, 0x10, - 0x80, 0x62, 0x00, 0xd4, 0x48, 0x00, 0x02, 0x3d, 0x80, 0x62, 0x00, 0xf4, 0x7f, 0xe4, 0xfb, 0x78, - 0x48, 0x00, 0x01, 0xe1, 0x48, 0x00, 0x00, 0x1c, 0x7f, 0xe4, 0xfb, 0x78, 0x38, 0xa0, 0x00, 0x00, - 0x4b, 0xff, 0xea, 0x51, 0x28, 0x03, 0x00, 0x00, 0x41, 0x82, 0x00, 0x08, 0x4b, 0xff, 0xec, 0x55, - 0x80, 0x01, 0x00, 0x58, 0x38, 0x21, 0x00, 0x50, 0xbb, 0x81, 0xff, 0xf0, 0x7c, 0x08, 0x03, 0xa6, - 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x93, 0xe1, 0xff, 0xfc, 0x7c, 0x08, 0x02, 0xa6, 0x38, 0xa0, 0x00, 0x00, 0x7c, 0x9f, 0x23, 0x78, - 0x38, 0xc2, 0x05, 0x04, 0x90, 0x01, 0x00, 0x08, 0x38, 0x00, 0x00, 0x20, 0x38, 0x86, 0xff, 0xf8, - 0x7c, 0x09, 0x03, 0xa6, 0x94, 0x21, 0xfe, 0xb0, 0x90, 0xa1, 0x00, 0x44, 0x90, 0xa1, 0x00, 0x40, - 0x38, 0xa1, 0x00, 0x40, 0x60, 0x00, 0x00, 0x00, 0x84, 0x04, 0x00, 0x08, 0x94, 0x05, 0x00, 0x08, - 0x80, 0x04, 0x00, 0x04, 0x90, 0x05, 0x00, 0x04, 0x42, 0x00, 0xff, 0xf0, 0x38, 0x00, 0x00, 0x00, - 0x3c, 0x80, 0x70, 0x77, 0x90, 0x01, 0x00, 0x3c, 0x38, 0xc1, 0x00, 0x44, 0x38, 0xe1, 0x00, 0x40, - 0x98, 0x01, 0x00, 0x38, 0x38, 0x84, 0x70, 0x63, 0x39, 0x01, 0x00, 0x48, 0x38, 0xa0, 0x00, 0x01, - 0x48, 0x00, 0x04, 0x05, 0x80, 0x41, 0x00, 0x14, 0x7c, 0x60, 0x07, 0x35, 0x41, 0x82, 0x00, 0x0c, - 0x38, 0x60, 0x00, 0x00, 0x48, 0x00, 0x00, 0x30, 0x80, 0x61, 0x00, 0x44, 0x7f, 0xe4, 0xfb, 0x78, - 0x38, 0xa1, 0x00, 0x3c, 0x38, 0xc1, 0x00, 0x38, 0x48, 0x00, 0x03, 0xf5, 0x80, 0x41, 0x00, 0x14, - 0x7c, 0x60, 0x07, 0x35, 0x41, 0x82, 0x00, 0x0c, 0x38, 0x60, 0x00, 0x00, 0x48, 0x00, 0x00, 0x08, - 0x80, 0x61, 0x00, 0x3c, 0x80, 0x01, 0x01, 0x58, 0x38, 0x21, 0x01, 0x50, 0x83, 0xe1, 0xff, 0xfc, - 0x7c, 0x08, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x93, 0xe1, 0xff, 0xfc, 0x7c, 0x08, 0x02, 0xa6, 0x7c, 0x9f, 0x23, 0x78, 0x7c, 0x64, 0x1b, 0x78, - 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xfe, 0x80, 0x88, 0x03, 0x00, 0x00, 0x38, 0x61, 0x00, 0x38, - 0x7c, 0x05, 0x07, 0x74, 0x38, 0xa5, 0x00, 0x01, 0x48, 0x00, 0x01, 0xf9, 0x88, 0x1f, 0x00, 0x00, - 0x7f, 0xe4, 0xfb, 0x78, 0x38, 0x61, 0x00, 0x78, 0x7c, 0x05, 0x07, 0x74, 0x38, 0xa5, 0x00, 0x01, - 0x48, 0x00, 0x01, 0xe1, 0x38, 0x61, 0x00, 0x38, 0x38, 0x81, 0x00, 0x78, 0x4b, 0xff, 0xfe, 0xe5, - 0x80, 0x01, 0x01, 0x88, 0x38, 0x21, 0x01, 0x80, 0x83, 0xe1, 0xff, 0xfc, 0x7c, 0x08, 0x03, 0xa6, - 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xc0, 0x48, 0x00, 0x03, 0x11, - 0x80, 0x41, 0x00, 0x14, 0x80, 0x01, 0x00, 0x48, 0x38, 0x21, 0x00, 0x40, 0x7c, 0x08, 0x03, 0xa6, - 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xc0, 0x48, 0x00, 0x02, 0x99, - 0x80, 0x41, 0x00, 0x14, 0x80, 0x01, 0x00, 0x48, 0x38, 0x21, 0x00, 0x40, 0x7c, 0x08, 0x03, 0xa6, - 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x08, 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x08, - 0x90, 0x41, 0x00, 0x0c, 0x94, 0x21, 0xff, 0xc0, 0x80, 0x03, 0x00, 0x00, 0x80, 0x43, 0x00, 0x04, - 0x7c, 0x09, 0x03, 0xa6, 0x7c, 0x83, 0x23, 0x78, 0x4e, 0x80, 0x04, 0x21, 0x80, 0x01, 0x00, 0x48, - 0x80, 0x41, 0x00, 0x4c, 0x7c, 0x08, 0x03, 0xa6, 0x38, 0x21, 0x00, 0x40, 0x4e, 0x80, 0x00, 0x20, - 0x80, 0x01, 0x00, 0x08, 0x7c, 0x08, 0x03, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x08, 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x08, - 0x90, 0x41, 0x00, 0x0c, 0x94, 0x21, 0xff, 0xc0, 0x80, 0x03, 0x00, 0x00, 0x80, 0x43, 0x00, 0x04, - 0x7c, 0x09, 0x03, 0xa6, 0x7c, 0x83, 0x23, 0x78, 0x7c, 0xa4, 0x2b, 0x78, 0x4e, 0x80, 0x04, 0x21, - 0x80, 0x01, 0x00, 0x48, 0x80, 0x41, 0x00, 0x4c, 0x7c, 0x08, 0x03, 0xa6, 0x38, 0x21, 0x00, 0x40, - 0x4e, 0x80, 0x00, 0x20, 0x80, 0x01, 0x00, 0x08, 0x7c, 0x08, 0x03, 0xa6, 0x00, 0x00, 0x00, 0x00, - 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x08, 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x08, - 0x90, 0x41, 0x00, 0x0c, 0x94, 0x21, 0xff, 0xc0, 0x80, 0x03, 0x00, 0x00, 0x80, 0x43, 0x00, 0x04, - 0x7c, 0x09, 0x03, 0xa6, 0x7c, 0x83, 0x23, 0x78, 0x7c, 0xa4, 0x2b, 0x78, 0x7c, 0xc5, 0x33, 0x78, - 0x4e, 0x80, 0x04, 0x21, 0x80, 0x01, 0x00, 0x48, 0x80, 0x41, 0x00, 0x4c, 0x7c, 0x08, 0x03, 0xa6, - 0x38, 0x21, 0x00, 0x40, 0x4e, 0x80, 0x00, 0x20, 0x80, 0x01, 0x00, 0x08, 0x7c, 0x08, 0x03, 0xa6, - 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x08, 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x08, - 0x90, 0x41, 0x00, 0x0c, 0x94, 0x21, 0xff, 0xc0, 0x80, 0x03, 0x00, 0x00, 0x80, 0x43, 0x00, 0x04, - 0x7c, 0x09, 0x03, 0xa6, 0x7c, 0x83, 0x23, 0x78, 0x7c, 0xa4, 0x2b, 0x78, 0x7c, 0xc5, 0x33, 0x78, - 0x7c, 0xe6, 0x3b, 0x78, 0x7d, 0x07, 0x43, 0x78, 0x7d, 0x28, 0x4b, 0x78, 0x7d, 0x49, 0x53, 0x78, - 0x4e, 0x80, 0x04, 0x21, 0x80, 0x01, 0x00, 0x48, 0x80, 0x41, 0x00, 0x4c, 0x7c, 0x08, 0x03, 0xa6, - 0x38, 0x21, 0x00, 0x40, 0x4e, 0x80, 0x00, 0x20, 0x80, 0x01, 0x00, 0x08, 0x7c, 0x08, 0x03, 0xa6, - 0x7c, 0x08, 0x02, 0xa6, 0x93, 0xe1, 0xff, 0xfc, 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xc0, - 0x7c, 0x7f, 0x1b, 0x78, 0x7c, 0x83, 0x23, 0x78, 0x7f, 0xe4, 0xfb, 0x78, 0x48, 0x00, 0x01, 0x21, - 0x80, 0x41, 0x00, 0x14, 0x7f, 0xe3, 0xfb, 0x78, 0x80, 0x01, 0x00, 0x48, 0x38, 0x21, 0x00, 0x40, - 0x83, 0xe1, 0xff, 0xfc, 0x7c, 0x08, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, - 0x7c, 0x08, 0x02, 0xa6, 0x93, 0xe1, 0xff, 0xfc, 0x90, 0x01, 0x00, 0x08, 0x94, 0x21, 0xff, 0xc0, - 0x7c, 0x7f, 0x1b, 0x78, 0x2c, 0x04, 0x00, 0x00, 0x40, 0x82, 0x00, 0x14, 0x7c, 0xa4, 0x2b, 0x78, - 0x48, 0x00, 0x00, 0xf5, 0x80, 0x41, 0x00, 0x14, 0x48, 0x00, 0x00, 0x24, 0x38, 0xa5, 0x00, 0x01, - 0x7c, 0x80, 0x07, 0x74, 0x48, 0x00, 0x00, 0x0c, 0x98, 0x03, 0x00, 0x00, 0x38, 0x63, 0x00, 0x01, - 0x38, 0xa5, 0xff, 0xff, 0x28, 0x05, 0x00, 0x00, 0x40, 0x82, 0xff, 0xf0, 0x7f, 0xe3, 0xfb, 0x78, - 0x80, 0x01, 0x00, 0x48, 0x38, 0x21, 0x00, 0x40, 0x83, 0xe1, 0xff, 0xfc, 0x7c, 0x08, 0x03, 0xa6, - 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x38, 0xc5, 0x00, 0x01, 0x48, 0x00, 0x00, 0x2c, 0x88, 0xa4, 0x00, 0x00, 0x88, 0x03, 0x00, 0x00, - 0x7c, 0x05, 0x00, 0x50, 0x2c, 0x00, 0x00, 0x00, 0x41, 0x82, 0x00, 0x10, 0x7c, 0x03, 0x03, 0x78, - 0x4e, 0x80, 0x00, 0x20, 0x60, 0x00, 0x00, 0x00, 0x38, 0x63, 0x00, 0x01, 0x38, 0x84, 0x00, 0x01, - 0x38, 0xc6, 0xff, 0xff, 0x28, 0x06, 0x00, 0x00, 0x40, 0x82, 0xff, 0xd0, 0x38, 0x60, 0x00, 0x00, - 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x90, 0x81, 0x00, 0x1c, 0x90, 0xa1, 0x00, 0x20, 0x90, 0xc1, 0x00, 0x24, 0x90, 0xe1, 0x00, 0x28, - 0x91, 0x01, 0x00, 0x2c, 0x91, 0x21, 0x00, 0x30, 0x91, 0x41, 0x00, 0x34, 0x38, 0x60, 0x00, 0x00, - 0x4e, 0x80, 0x00, 0x20, 0x81, 0x82, 0x00, 0x14, 0x90, 0x41, 0x00, 0x14, 0x80, 0x0c, 0x00, 0x00, - 0x80, 0x4c, 0x00, 0x04, 0x7c, 0x09, 0x03, 0xa6, 0x4e, 0x80, 0x04, 0x20, 0x81, 0x82, 0x00, 0x08, - 0x90, 0x41, 0x00, 0x14, 0x80, 0x0c, 0x00, 0x00, 0x80, 0x4c, 0x00, 0x04, 0x7c, 0x09, 0x03, 0xa6, - 0x4e, 0x80, 0x04, 0x20, 0x81, 0x82, 0x00, 0x00, 0x90, 0x41, 0x00, 0x14, 0x80, 0x0c, 0x00, 0x00, - 0x80, 0x4c, 0x00, 0x04, 0x7c, 0x09, 0x03, 0xa6, 0x4e, 0x80, 0x04, 0x20, 0x81, 0x82, 0x00, 0x04, - 0x90, 0x41, 0x00, 0x14, 0x80, 0x0c, 0x00, 0x00, 0x80, 0x4c, 0x00, 0x04, 0x7c, 0x09, 0x03, 0xa6, - 0x4e, 0x80, 0x04, 0x20, 0x81, 0x82, 0x00, 0x0c, 0x90, 0x41, 0x00, 0x14, 0x80, 0x0c, 0x00, 0x00, - 0x80, 0x4c, 0x00, 0x04, 0x7c, 0x09, 0x03, 0xa6, 0x4e, 0x80, 0x04, 0x20, 0x81, 0x82, 0x00, 0x10, - 0x90, 0x41, 0x00, 0x14, 0x80, 0x0c, 0x00, 0x00, 0x80, 0x4c, 0x00, 0x04, 0x7c, 0x09, 0x03, 0xa6, - 0x4e, 0x80, 0x04, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x1a, 0x22, 0x04, 0xf8, 0x82, 0x02, 0x27, 0x04, 0xe0, 0x04, 0xec, 0x04, 0xdc, 0x04, 0xe8, 0x04, - 0xd8, 0x04, 0xe4, 0x04, 0xfc, 0x04, 0xf0, 0x04, 0xf4, 0x01, 0x44, 0x05, 0x00, 0x02, 0x44, 0x04, - 0x10, 0x03, 0xdf, 0x03, 0xad, 0x03, 0x7c, 0x03, 0x3d, 0x02, 0x5c, 0x03, 0x30, 0x03, 0x21, 0x03, - 0x13, 0x03, 0x01, 0x02, 0xef, 0x02, 0xde, 0x02, 0xd4, 0x02, 0xcc, 0x02, 0xc4, 0x02, 0xb8, 0x02, - 0xab, 0x02, 0xa2, 0x02, 0x9c, 0x02, 0x96, 0x02, 0x8e, 0x02, 0x87, 0x02, 0x7e, 0x02, 0x77, 0x02, - 0x6f, 0x02, 0x62, 0x05, 0x04, 0x00, 0x4d, 0x21, 0x10, 0x0e, 0x22, 0x09, 0x30, 0x86, 0x02, 0x05, - 0x07, 0x60, 0x06, 0x60, 0x05, 0xa0, 0x05, 0x70, 0x04, 0xe0, 0x22, 0x14, 0xe0, 0x04, 0x24, 0x6d, - 0x74, 0x65, 0x6a, 0x04, 0x35, 0x14, 0x53, 0x68, 0x65, 0x65, 0x70, 0x53, 0x68, 0x61, 0x76, 0x65, - 0x72, 0x20, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x0b, 0x21, 0x01, 0x01, 0x21, 0x80, - 0x04, 0x26, 0x04, 0x04, 0x65, 0x6e, 0x65, 0x74, 0x00, 0x3e, 0x25, 0x01, 0x6f, 0x74, 0x61, 0x6e, - 0x01, 0x24, 0x0a, 0x0b, 0x01, 0x01, 0x03, 0x34, 0x53, 0x68, 0x65, 0x65, 0x70, 0x53, 0x68, 0x61, - 0x76, 0x65, 0x72, 0x20, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x04, 0x22, 0x1b, 0xbd, - 0x04, 0x22, 0x01, 0xcc, 0x06, 0x22, 0x05, 0xea, 0x02, 0x22, 0x17, 0x70, 0x02, 0x22, 0x13, 0x88, - 0x06, 0x22, 0x01, 0x14, 0x02, 0x22, 0x01, 0x2c, 0x02, 0x22, 0x01, 0x24, 0x86, 0x02, 0x02, 0x01, - 0xe4, 0x01, 0x1c, 0x22, 0x01, 0x2c, 0x02, 0x22, 0x01, 0x24, 0x86, 0x02, 0x01, 0x01, 0xe4, 0x22, - 0x01, 0xfc, 0x02, 0x22, 0x02, 0x18, 0x0a, 0x22, 0x02, 0x34, 0x03, 0x21, 0x01, 0x03, 0x21, 0x03, - 0x12, 0x2c, 0x0b, 0x4f, 0x54, 0x4b, 0x65, 0x72, 0x6e, 0x65, 0x6c, 0x4c, 0x69, 0x62, 0x01, 0x27, - 0x06, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x62, 0x01, 0x26, 0x05, 0x66, 0x72, 0x65, 0x65, 0x62, 0x01, - 0x28, 0x07, 0x66, 0x72, 0x65, 0x65, 0x6d, 0x73, 0x67, 0x01, 0x26, 0x05, 0x63, 0x6f, 0x70, 0x79, - 0x62, 0x01, 0x27, 0x06, 0x64, 0x75, 0x70, 0x6d, 0x73, 0x67, 0x01, 0x25, 0x04, 0x67, 0x65, 0x74, - 0x71, 0x01, 0x25, 0x04, 0x70, 0x75, 0x74, 0x71, 0x01, 0x28, 0x07, 0x70, 0x75, 0x74, 0x6e, 0x65, - 0x78, 0x74, 0x01, 0x2c, 0x0b, 0x70, 0x75, 0x74, 0x6e, 0x65, 0x78, 0x74, 0x63, 0x74, 0x6c, 0x31, - 0x01, 0x2b, 0x0a, 0x63, 0x61, 0x6e, 0x70, 0x75, 0x74, 0x6e, 0x65, 0x78, 0x74, 0x01, 0x27, 0x06, - 0x71, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x01, 0x27, 0x06, 0x66, 0x6c, 0x75, 0x73, 0x68, 0x71, 0x01, - 0x29, 0x08, 0x6d, 0x73, 0x67, 0x64, 0x73, 0x69, 0x7a, 0x65, 0x01, 0x30, 0x0f, 0x4f, 0x54, 0x4b, - 0x65, 0x72, 0x6e, 0x65, 0x6c, 0x55, 0x74, 0x69, 0x6c, 0x4c, 0x69, 0x62, 0x01, 0x31, 0x10, 0x4f, - 0x54, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x72, 0x75, 0x70, 0x74, 0x01, - 0x31, 0x10, 0x4f, 0x54, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x72, 0x75, - 0x70, 0x74, 0x01, 0x2d, 0x0c, 0x6d, 0x69, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x5f, 0x63, 0x6f, 0x6d, - 0x6d, 0x01, 0x2e, 0x0d, 0x6d, 0x69, 0x5f, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6d, - 0x6d, 0x01, 0x2c, 0x0b, 0x6d, 0x69, 0x5f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x74, 0x72, 0x01, - 0x20, 0x3e, 0x46, 0x41, 0x54, 0x41, 0x4c, 0x3a, 0x20, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, - 0x74, 0x65, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x28, 0x29, - 0x20, 0x63, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x2c, 0x20, 0x62, 0x75, 0x74, 0x20, 0x73, 0x74, 0x72, - 0x65, 0x61, 0x6d, 0x73, 0x20, 0x73, 0x74, 0x69, 0x6c, 0x6c, 0x20, 0x6f, 0x70, 0x65, 0x6e, 0x0a, - 0x01, 0x20, 0x30, 0x46, 0x41, 0x54, 0x41, 0x4c, 0x3a, 0x20, 0x65, 0x74, 0x68, 0x65, 0x72, 0x5f, - 0x6f, 0x70, 0x65, 0x6e, 0x28, 0x29, 0x3a, 0x20, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, - 0x20, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x6f, 0x70, 0x65, 0x6e, - 0x65, 0x64, 0x0a, 0x01, 0x20, 0x31, 0x46, 0x41, 0x54, 0x41, 0x4c, 0x3a, 0x20, 0x65, 0x74, 0x68, - 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x28, 0x29, 0x3a, 0x20, 0x45, 0x74, 0x68, 0x65, - 0x72, 0x6e, 0x65, 0x74, 0x20, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x20, - 0x6f, 0x70, 0x65, 0x6e, 0x65, 0x64, 0x0a, 0x01, 0x20, 0x30, 0x46, 0x41, 0x54, 0x41, 0x4c, 0x3a, - 0x20, 0x65, 0x74, 0x68, 0x65, 0x72, 0x5f, 0x77, 0x70, 0x75, 0x74, 0x28, 0x29, 0x3a, 0x20, 0x45, - 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x20, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x20, 0x6e, - 0x6f, 0x74, 0x20, 0x6f, 0x70, 0x65, 0x6e, 0x65, 0x64, 0x0a, 0x03, 0x22, 0x08, 0x4c, 0x82, 0x02, - 0x30, 0x08, 0x6c, 0x08, 0x7c, 0x08, 0xcc, 0x08, 0xcc, 0x08, 0xcc, 0x08, 0xcc, 0x08, 0x2c, 0x08, - 0xcc, 0x08, 0xcc, 0x08, 0xcc, 0x08, 0xcc, 0x08, 0xcc, 0x08, 0xcc, 0x08, 0xcc, 0x08, 0xcc, 0x08, - 0xcc, 0x08, 0xcc, 0x08, 0xcc, 0x08, 0xcc, 0x08, 0xcc, 0x08, 0x9c, 0x08, 0xcc, 0x08, 0xcc, 0x08, - 0xcc, 0x08, 0xcc, 0x08, 0xcc, 0x08, 0x8c, 0x08, 0xcc, 0x08, 0xac, 0x08, 0xbc, 0x08, 0xcc, 0x08, - 0xcc, 0x08, 0xcc, 0x08, 0xcc, 0x08, 0xcc, 0x08, 0xcc, 0x08, 0xcc, 0x08, 0xcc, 0x08, 0xcc, 0x08, - 0xcc, 0x08, 0xcc, 0x08, 0xcc, 0x08, 0xcc, 0x08, 0xcc, 0x08, 0xcc, 0x08, 0xcc, 0x08, 0xcc, 0x08, - 0xcc, 0x22, 0x08, 0x5c, diff --git a/SheepShaver/src/EthernetDriverStub.i b/SheepShaver/src/EthernetDriverStub.i deleted file mode 100644 index fa381407..00000000 --- a/SheepShaver/src/EthernetDriverStub.i +++ /dev/null @@ -1,43 +0,0 @@ - 0x4a, 0x6f, 0x79, 0x21, 0x70, 0x65, 0x66, 0x66, 0x70, 0x77, 0x70, 0x63, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x01, 0x90, - 0x00, 0x04, 0x04, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x58, - 0x00, 0x00, 0x01, 0x54, 0x00, 0x00, 0x00, 0xaa, 0x00, 0x00, 0x02, 0x00, 0x02, 0x01, 0x04, 0x00, - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x0a, 0x00, 0x00, 0x00, 0x80, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0xb4, - 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, - 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x46, 0x07, 0x09, 0xc1, 0x01, 0x43, 0x00, 0x41, 0x00, 0x41, - 0x00, 0x42, 0x00, 0x41, 0x00, 0x42, 0x00, 0x81, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, - 0x65, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x54, 0x68, 0x65, - 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x49, 0x6e, 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x6f, 0x64, 0x75, 0x6c, - 0x65, 0x47, 0x65, 0x74, 0x4f, 0x54, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x49, 0x6e, 0x66, - 0x6f, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, - 0x65, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, 0x04, 0x00, 0x03, - 0x00, 0x04, 0x00, 0x04, 0x00, 0x15, 0x5e, 0x85, 0x00, 0x14, 0xbd, 0xe0, 0x00, 0x10, 0x8f, 0x84, - 0x00, 0x10, 0xae, 0x97, 0x00, 0x10, 0x4e, 0x3c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, - 0x00, 0x01, 0x01, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x44, 0x00, 0x01, 0x02, 0x00, 0x00, 0x29, - 0x00, 0x00, 0x00, 0x0c, 0x00, 0x01, 0x02, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x14, 0x00, 0x01, - 0x02, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x38, 0x60, 0x00, 0x00, 0x4e, 0x80, 0x00, 0x20, 0x38, 0x62, 0x01, 0x3c, 0x4e, 0x80, 0x00, 0x20, - 0x80, 0x40, 0x28, 0x08, 0x80, 0x00, 0x28, 0xc0, 0x7c, 0x09, 0x03, 0xa6, 0x4e, 0x80, 0x04, 0x20, - 0x80, 0x40, 0x28, 0x08, 0x80, 0x00, 0x28, 0xc4, 0x7c, 0x09, 0x03, 0xa6, 0x4e, 0x80, 0x04, 0x20, - 0x80, 0x40, 0x28, 0x08, 0x80, 0x00, 0x28, 0xc8, 0x7c, 0x09, 0x03, 0xa6, 0x4e, 0x80, 0x04, 0x20, - 0x80, 0x40, 0x28, 0x08, 0x80, 0x00, 0x28, 0xcc, 0x7c, 0x09, 0x03, 0xa6, 0x4e, 0x80, 0x04, 0x20, - 0x80, 0x40, 0x28, 0x08, 0x80, 0x00, 0x28, 0xd0, 0x7c, 0x09, 0x03, 0xa6, 0x4e, 0x80, 0x04, 0x20, - 0x80, 0x40, 0x28, 0x08, 0x80, 0x00, 0x28, 0xd4, 0x7c, 0x09, 0x03, 0xa6, 0x4e, 0x80, 0x04, 0x20, - 0x02, 0x22, 0x01, 0x3c, 0x03, 0x21, 0x20, 0x86, 0x02, 0x02, 0x00, 0x10, 0x00, 0x08, 0x09, 0x21, - 0x50, 0x86, 0x02, 0x02, 0x00, 0x60, 0x00, 0x30, 0x01, 0x21, 0x40, 0x04, 0x24, 0x6d, 0x74, 0x65, - 0x6a, 0x04, 0x35, 0x14, 0x53, 0x68, 0x65, 0x65, 0x70, 0x53, 0x68, 0x61, 0x76, 0x65, 0x72, 0x20, - 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x0b, 0x21, 0x01, 0x01, 0x21, 0x80, 0x04, 0x26, - 0x04, 0x04, 0x65, 0x6e, 0x65, 0x74, 0x00, 0x3e, 0x25, 0x01, 0x6f, 0x74, 0x61, 0x6e, 0x01, 0x24, - 0x0a, 0x0b, 0x01, 0x01, 0x03, 0x34, 0x53, 0x68, 0x65, 0x65, 0x70, 0x53, 0x68, 0x61, 0x76, 0x65, - 0x72, 0x20, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x04, 0x22, 0x1b, 0xbd, 0x05, 0x21, - 0xc4, 0x06, 0x22, 0x05, 0xea, 0x02, 0x22, 0x17, 0x70, 0x02, 0x22, 0x13, 0x88, 0x07, 0x21, 0x2c, - 0x03, 0x21, 0x34, 0x03, 0x21, 0x3c, 0x86, 0x02, 0x02, 0x00, 0xdc, 0x00, 0x24, 0x01, 0x21, 0x34, - 0x03, 0x21, 0x3c, 0x86, 0x02, 0x01, 0x00, 0xdc, 0x01, 0x21, 0xf4, 0x02, 0x22, 0x01, 0x10, 0x0a, - 0x22, 0x01, 0x2c, 0x03, 0x21, 0x01, 0x03, 0x21, 0x03, 0x0c, diff --git a/SheepShaver/src/MacOSX/.gitignore b/SheepShaver/src/MacOSX/.gitignore deleted file mode 100644 index 687d4ec0..00000000 --- a/SheepShaver/src/MacOSX/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -# Xcode build files -build/* -SheepShaver.xcodeproj/*.mode1v3 -SheepShaver.xcodeproj/*.pbxuser - -# autoconf build generated Info.plist file -Info.plist diff --git a/SheepShaver/src/MacOSX/AudioBackEnd.cpp b/SheepShaver/src/MacOSX/AudioBackEnd.cpp deleted file mode 120000 index d0d8a5ca..00000000 --- a/SheepShaver/src/MacOSX/AudioBackEnd.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/MacOSX/AudioBackEnd.cpp \ No newline at end of file diff --git a/SheepShaver/src/MacOSX/AudioBackEnd.h b/SheepShaver/src/MacOSX/AudioBackEnd.h deleted file mode 120000 index e4f493db..00000000 --- a/SheepShaver/src/MacOSX/AudioBackEnd.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/MacOSX/AudioBackEnd.h \ No newline at end of file diff --git a/SheepShaver/src/MacOSX/AudioDevice.cpp b/SheepShaver/src/MacOSX/AudioDevice.cpp deleted file mode 120000 index b56f3a4c..00000000 --- a/SheepShaver/src/MacOSX/AudioDevice.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/MacOSX/AudioDevice.cpp \ No newline at end of file diff --git a/SheepShaver/src/MacOSX/AudioDevice.h b/SheepShaver/src/MacOSX/AudioDevice.h deleted file mode 120000 index 7892391b..00000000 --- a/SheepShaver/src/MacOSX/AudioDevice.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/MacOSX/AudioDevice.h \ No newline at end of file diff --git a/SheepShaver/src/MacOSX/Info.plist.in b/SheepShaver/src/MacOSX/Info.plist.in deleted file mode 100644 index 1324ba8b..00000000 --- a/SheepShaver/src/MacOSX/Info.plist.in +++ /dev/null @@ -1,56 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - SheepShaver - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - APPL - CFBundleSignature - ???? - CFBundleVersion - @PACKAGE_VERSION@ - CFBundleShortVersionString - @PACKAGE_VERSION@ - CFBundleIconFile - SheepShaver.icns - CSResourcesFileMapped - - CFBundleDocumentTypes - - - CFBundleTypeExtensions - - sheepvm - - CFBundleTypeIconFile - SheepShaver.icns - CFBundleTypeName - SheepShaver VM - CFBundleTypeRole - Editor - LSTypeIsPackage - - - - LSArchitecturePriority - - i386 - x86_64 - ppc - - LSMinimumSystemVersionByArchitecture - - i386 - 10.4.0 - x86_64 - 10.6.0 - ppc - 10.4.0 - - - diff --git a/SheepShaver/src/MacOSX/Launcher/AppController.h b/SheepShaver/src/MacOSX/Launcher/AppController.h deleted file mode 100644 index bbe989fb..00000000 --- a/SheepShaver/src/MacOSX/Launcher/AppController.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * AppController.h - Cocoa SheepShaver launcher for Mac OS X - * - * Copyright (C) 2009 Alexei Svitkine - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#import - -@interface AppController : NSObject { -} - -- (void) awakeFromNib; - -- (IBAction) openVirtualMachinesList: (id) sender; - -@end diff --git a/SheepShaver/src/MacOSX/Launcher/AppController.mm b/SheepShaver/src/MacOSX/Launcher/AppController.mm deleted file mode 100644 index 46e862ce..00000000 --- a/SheepShaver/src/MacOSX/Launcher/AppController.mm +++ /dev/null @@ -1,44 +0,0 @@ -/* - * AppController.mm - Cocoa SheepShaver launcher for Mac OS X - * - * Copyright (C) 2009 Alexei Svitkine - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#import "AppController.h" -#import "VMListController.h" - -@implementation AppController - -- (void) awakeFromNib -{ - [self openVirtualMachinesList:self]; - [NSApp setDelegate:self]; -} - -- (IBAction) openVirtualMachinesList: (id) sender -{ - [[VMListController sharedInstance] showWindow:sender]; -} - -- (BOOL) applicationShouldHandleReopen: (NSApplication *) app hasVisibleWindows: (BOOL) hasVisible -{ - if (!hasVisible) - [self openVirtualMachinesList:self]; - return YES; -} - -@end diff --git a/SheepShaver/src/MacOSX/Launcher/DiskType.h b/SheepShaver/src/MacOSX/Launcher/DiskType.h deleted file mode 100755 index 8f74d8a0..00000000 --- a/SheepShaver/src/MacOSX/Launcher/DiskType.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// DiskType.h -// SheepShaver -// -// Created by maximilian on 01.02.14. -// Copyright 2014 __MyCompanyName__. All rights reserved. -// - -#import - - -@interface DiskType : NSObject { - NSString* _path; - BOOL _isCDROM; -} - --(NSString*)path; --(BOOL)isCDROM; - --(void)setPath:(NSString*)thePath; --(void)setIsCDROM:(BOOL)cdrom; - -@end diff --git a/SheepShaver/src/MacOSX/Launcher/DiskType.m b/SheepShaver/src/MacOSX/Launcher/DiskType.m deleted file mode 100755 index ec21d458..00000000 --- a/SheepShaver/src/MacOSX/Launcher/DiskType.m +++ /dev/null @@ -1,35 +0,0 @@ -// -// DiskType.m -// SheepShaver -// -// Created by maximilian on 01.02.14. -// Copyright 2014 __MyCompanyName__. All rights reserved. -// - -#import "DiskType.h" - - -@implementation DiskType --(NSString*)path -{ - return _path; -} --(BOOL)isCDROM -{ - return _isCDROM; -} - --(void)setPath:(NSString*)thePath -{ - _path = [thePath copy]; -} --(void)setIsCDROM:(BOOL)cdrom -{ - _isCDROM=cdrom; -} - --(NSString*)description { - return [NSString stringWithFormat:@"DiskType, path:%@ isCDROM:%@", _path, _isCDROM]; -} - -@end diff --git a/SheepShaver/src/MacOSX/Launcher/English.lproj/InfoPlist.strings b/SheepShaver/src/MacOSX/Launcher/English.lproj/InfoPlist.strings deleted file mode 100755 index f1842244c9c07de454abd8747d5422b605935efe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 276 zcmW-cF%E)25Ji9ODK?Z8dH`dg7HXmv5<4115CQ@LQStEVW3tK2?BAL9XMf+Bd^zn^ zD^{dZxjssCMSGH4btttevLmO&9k-Nvs>b>|Jx~j}2kY`R(}Z(Wpsjk{;Z{2F9>I-t zVJguYLc>H0|EA0s3pgGxnW-Z;w^^qZxwn0sDdT - - - - IBClasses - - - CLASS - FirstResponder - LANGUAGE - ObjC - SUPERCLASS - NSObject - - - ACTIONS - - openVirtualMachinesList - id - - CLASS - AppController - LANGUAGE - ObjC - SUPERCLASS - NSObject - - - IBVersion - 1 - - diff --git a/SheepShaver/src/MacOSX/Launcher/English.lproj/MainMenu.nib/info.nib b/SheepShaver/src/MacOSX/Launcher/English.lproj/MainMenu.nib/info.nib deleted file mode 100755 index d1a1a5e6..00000000 --- a/SheepShaver/src/MacOSX/Launcher/English.lproj/MainMenu.nib/info.nib +++ /dev/null @@ -1,18 +0,0 @@ - - - - - IBFramework Version - 677 - IBLastKnownRelativeProjectPath - ../SheepShaverLauncher.xcodeproj - IBOldestOS - 4 - IBOpenObjects - - IBSystem Version - 9J61 - targetFramework - IBCocoaFramework - - diff --git a/SheepShaver/src/MacOSX/Launcher/English.lproj/MainMenu.nib/keyedobjects.nib b/SheepShaver/src/MacOSX/Launcher/English.lproj/MainMenu.nib/keyedobjects.nib deleted file mode 100755 index 0e197efef29fe489df10acfa8a1ddcc725f4d37a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12048 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 diff --git a/SheepShaver/src/MacOSX/Launcher/English.lproj/VMListWindow.nib/designable.nib b/SheepShaver/src/MacOSX/Launcher/English.lproj/VMListWindow.nib/designable.nib deleted file mode 100755 index c71e47ba..00000000 --- a/SheepShaver/src/MacOSX/Launcher/English.lproj/VMListWindow.nib/designable.nib +++ /dev/null @@ -1,713 +0,0 @@ - - - - 1050 - 9J61 - 677 - 949.46 - 353.00 - - YES - - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - - - YES - - YES - - - YES - - - - YES - - VMListController - - - FirstResponder - - - NSApplication - - - 15 - 2 - {{196, 309}, {412, 201}} - 536870912 - SheepShaver Virtual Machines - NSWindow - - {3.40282e+38, 3.40282e+38} - {412, 201} - - - 256 - - YES - - - 274 - - YES - - - 2304 - - YES - - - 256 - {374, 94} - - YES - - - 256 - {{375, 0}, {16, 17}} - - - YES - - 3.710000e+02 - 4.000000e+01 - 1.000000e+03 - - 75628032 - 0 - - - LucidaGrande - 1.100000e+01 - 3100 - - - 3 - MC4zMzMzMzI5OQA - - - 6 - System - headerTextColor - - 3 - MAA - - - - - 337772096 - 2048 - - LucidaGrande - 1.300000e+01 - 1044 - - - - 6 - System - controlBackgroundColor - - 3 - MC42NjY2NjY2OQA - - - - 6 - System - controlTextColor - - - - - - - 3.000000e+00 - 2.000000e+00 - - 3 - MQA - - - 6 - System - gridColor - - 3 - MC41AA - - - 1.700000e+01 - 316669952 - 2 - 4 - 15 - 0 - YES - - - {{1, 1}, {355, 94}} - - - - - 4 - - - - 256 - {{356, 1}, {15, 94}} - - - _doScroller: - 3.947369e-01 - - - - 256 - {{-100, -100}, {374, 15}} - - YES - 1 - - _doScroller: - 9.904762e-01 - - - {{20, 60}, {372, 96}} - - - 146 - - - - QSAAAEEgAABBmAAAQZgAAA - - - - 293 - {{302, 12}, {96, 32}} - - YES - - 604110336 - 134217728 - Launch - - - -2038284033 - 129 - - - 200 - 25 - - - - - 293 - {{206, 12}, {96, 32}} - - YES - - 604110336 - 134217728 - Settings... - - - -2038284033 - 129 - - - 200 - 25 - - - - - 293 - {{14, 12}, {96, 32}} - - YES - - 67239424 - 134217728 - New... - - - -2038284033 - 129 - - - 200 - 25 - - - - - 268 - {{17, 164}, {147, 17}} - - YES - - 68288064 - 272630784 - Virtual Machine List: - - - - 6 - System - controlColor - - - - - - - - 293 - {{110, 12}, {96, 32}} - - YES - - 67239424 - 134217728 - Import... - - - -2038284033 - 129 - - - 200 - 25 - - - - {412, 201} - - - {{0, 0}, {1680, 1028}} - {412, 223} - {3.40282e+38, 3.40282e+38} - - - - - YES - - - delegate - - - - 46 - - - - newVirtualMachine: - - - - 48 - - - - importVirtualMachine: - - - - 49 - - - - editVirtualMachineSettings: - - - - 50 - - - - vmList - - - - 51 - - - - window - - - - 52 - - - - launchVirtualMachine: - - - - 53 - - - - importButton - - - - 54 - - - - launchButton - - - - 55 - - - - newButton - - - - 56 - - - - settingsButton - - - - 57 - - - - - YES - - 0 - - YES - - - - - - -2 - - - RmlsZSdzIE93bmVyA - - - -1 - - - First Responder - - - -3 - - - Application - - - 1 - - - YES - - - - - - 2 - - - YES - - - - - - - - - - - 13 - - - YES - - - - - - - - 14 - - - YES - - - - - - 15 - - - - - 16 - - - - - 17 - - - YES - - - - - - 21 - - - YES - - - - - - 22 - - - - - 23 - - - YES - - - - - - 24 - - - - - 25 - - - YES - - - - - - 26 - - - - - 18 - - - - - 31 - - - YES - - - - - - 32 - - - - - 43 - - - YES - - - - - - 44 - - - - - - - YES - - YES - -1.IBPluginDependency - -2.IBPluginDependency - -3.IBPluginDependency - 1.IBEditorWindowLastContentRect - 1.IBWindowTemplateEditedContentRect - 1.NSWindowTemplate.visibleAtLaunch - 1.WindowOrigin - 1.editorWindowContentRectSynchronizationRect - 1.windowTemplate.hasMinSize - 1.windowTemplate.minSize - 13.IBPluginDependency - 13.ImportedFromIB2 - 14.IBPluginDependency - 14.ImportedFromIB2 - 15.IBPluginDependency - 15.IBShouldRemoveOnLegacySave - 16.IBPluginDependency - 16.IBShouldRemoveOnLegacySave - 17.IBPluginDependency - 17.ImportedFromIB2 - 18.IBPluginDependency - 18.IBShouldRemoveOnLegacySave - 2.IBPluginDependency - 21.IBPluginDependency - 22.IBPluginDependency - 23.IBPluginDependency - 24.IBPluginDependency - 25.IBPluginDependency - 26.IBPluginDependency - 31.IBPluginDependency - 32.IBPluginDependency - 43.IBPluginDependency - 44.IBPluginDependency - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{308, 569}, {412, 201}} - {{308, 569}, {412, 201}} - - {196, 240} - {{357, 418}, {480, 270}} - - {412, 201} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - YES - - YES - - - YES - - - - - YES - - YES - - - YES - - - - 57 - - - - YES - - VMListController - NSWindowController - - YES - - YES - deleteVirtualMachine: - editVirtualMachineSettings: - importVirtualMachine: - launchVirtualMachine: - newVirtualMachine: - - - YES - id - id - id - id - id - - - - YES - - YES - importButton - launchButton - newButton - settingsButton - vmList - - - YES - NSButton - NSButton - NSButton - NSButton - NSTableView - - - - IBProjectSource - VMListController.h - - - - - 0 - ../SheepShaverLauncher.xcodeproj - 3 - - diff --git a/SheepShaver/src/MacOSX/Launcher/English.lproj/VMListWindow.nib/keyedobjects.nib b/SheepShaver/src/MacOSX/Launcher/English.lproj/VMListWindow.nib/keyedobjects.nib deleted file mode 100755 index 23a3b0ba362478e433d32016b175d4ea49491895..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8475 zcmbVR2Y6J)+WuzF_Il3lo|BvdNMfkcQfQ$_LJ2h?kPtd?NtR?~lMTC@1PH+q+f}fk z*ib}@1yn%nV)@l;;iA_oU_-H8MMXsAVxh?Y%{jY}SpMgK?(&eGGiTL71V@8*zP%Ivf)|YolL>p#y3C5~w!`L;WOLYFlp{hjO2jt52 z{{k!6=8hlP*XXPcCW4Gqir$j4iJ>K->cZrtZQ?F)f(vqB01Sj-FdRn0Jg9_=APDoJ z3g0!r61Wa-hK+C^yaKPnKVT313--h3a1_3WU*K0bMJO>7H}McJ@sV_rNxG3`VD`E&>!K?~>@T0|$(NpwC9(FL@YE~jhggY+T#Fx^JC(;f5? zx|2RiAES@cC+L&(Df%>hhVG)z(&y;&^ac77eT9A{I7p4)6kLK^@CaT(6eO4>_yoTY z5M)6S(u8zD6*QrP&{60loF{Y^GRT!erf|NH1+#@NLRX=O&`an$txJ7lB=WK712=fU z3nED113v^n1_ja}9aPYu19XH=a2|Aq49JA@Aq%=dSLg=ap$GJY3!oSDhCa|2`ayO@ zN!iqBG*Qu|DiVyx=a!UBHsS#t9@jlTiuZ@&6~Rbj2z%6$vcjsWP&^) zD0_x2Ww)@WS&&`A%xn$2l`-}t17=~%*;C?BcH7(Nfn3Og{-~d>6UWa?Oh8B##gi}* z5pyCIjYLARw_y+rhI|+@!!UFxKFes-X1BJ|b5Jut4(J%&zU@VM-@h|}%Mwc>q2geC zAs=suLF04C`dZA*Dw&hbVRl~z05Au0F&mpFQqjxiGN=^OTUv7R2lmd$%g%4@ozc=i zC%1P-Zgx&;?*SCLm?%>=| zue`x1>D)u>taAe2g=+Le2o^vM(qb)y;bK?_5vapfR9BHl-PBOLAzEJ@ilHOR8s|5m z9(<`L-HfTM;kLqdSz|*e#z!y@o6Wou0X7qxvy5O^1TmIJT0&cF|{Hpj%hhu0t{nf1zZM~!xeBPTm^qae5J4wR>3MYKE!By@F540OC*Ro?&bRyHH%sq{*UKh(6N)--h4# zUm`wK$jt^bAM>Tux`AbHL^La51@;bR!w%?%ZGknqac@CIZbeltLCtT6J76u`33tId zRAN2$tivd&GK`6>(a|an0$U@;j*3R2F|^PiHc&J%zhnm%z_oi~S0J_WW|n;qtYd+X z#Q?5(Kbr3W*aBPOL3jurhHbiQx8wRd;1NWy6CQ=f5a<)|Bs>LA!!xi8o<%&*q0^to zr!c&TskRDU#&r98rPvwq#DX<77~W;k##oge)J4%)Nwj`av?>@ul;s9;J^Fbj)Wo8V z_0>A^O3{aO7KtF&l`m-sm4zahLgzk?_W2>Z0gKq^u!Wg)2=DS0`$9 z3P&l8b@hdfiD)bo4=?2?cxGXO{BhQ}P`IX+C+L{^AaZOqdV6dvoC1P-1O9Y2F_Ff~ z`7mPzq~eZ$p{cGW%9lEV6q*Zl#79&W)9^{UotWlV0n8Tc0&ZYI-R9eih&j!GoW`yHc$B+%>JA~t*r(jzX5M< zf;Zux@D>c6TiMotSQoh+IlxqsrUGLx4~%_Gdly6E9e5YsgZJSBH~=5QM{p26hEL#A zScl#i7Ybr(k3#!n`slXDG#`z7D&B=nB(PL3a-ZJB<#g-m+0u`7$SP>g*7aoFvkFEV z8fO(;UtshF-i3c7hAr>~dTFQ4hs-+*;v8LT7g#Lh3>hl~6GKf*Ei4;+V|;Ab=rXC?gNB@anqfxZgs zoK?`x0LjjiTpj03YOD%Z2gk;O$Z>|jPr%6ya1w^%R9?gPqU6)?8=N6Ph#tV0mpocS z++?-kM2KaI!o=*pdHj=`pAWhiA`sICVuGPKN=LjOJotE;Scny6*@=TViHjS6=Q+p7 zi3lwpiPrEZmdUz`7S@GjRg^7>Cqi||$hEq+&f1_YGKpo5%ucTCCxOi*KxCqjG#IKU zr|z+H&eqwT%P9(nBGudls92%CE8-8RIsZzz?n|O_*Ab0$fc2yktRtOCMv^v>dwC%E z0-3)Ru)fGnJy<}p0qfnyAtVcaB3-%VFF0#?Q=q*)dZ0ae5*KRSi(SC7up(C(8V!ixScBqZI+=krAWUXqdk*GGc`#NJN?^l?30$+3vvhp|i;u{L zvV7#YAxz8~@&2fJ41H=4*Z|I3I)Npz%&Dx7ri$(m!+;l&;ARp`DTB~b@3Ckmp)Esj zShU)~TR>_MAeJZ{Vk8M;xJWqL>PU|6IGLd%QCnL2? zJh1)?Q*K04HX5enn&H3ks8!MIvQQ#{`-ynpzJ323&K9z@9h`}5QW6dp>Kq=mW~CBwB>^c2Xb=J#*k8}Q z{=AKQhxg8v-6VUzOgfNP$g2pVnd~MRK9i&~_Ea_n0hIW}0u!<}hVJjq6&d`HIHWzd za1KGi*K!v08R9i?Djuz+x=Hn%H8jsgzJk1!}^3lf~4EDLgt9$5;;X z3k}RMW2276Xi{)~D8j1oj$j(ALbbxW%1PfQkBkN-QwMc!q)zJM+Q_(F3eQg#82sW_ zCD9m?i_vR5o`d1Rb6jUCu^K$XQMO=aeW=;Ua@`0tK;?~8HY5jh8Iv3F7|!n;elLkD zl%Sf9xPXNbNkpfb-yv?hbOM*oz@-at>4kHQ;l}E1N3FwA-EdR@N7Yp{)$wpX_nt4? zNPFwc7BM{ab_i966YUpGvBi*c(>yq>kmjOT%B*bBjA}gH)S&Orjo^Zt=wMy&1jacV zZPQ+EJ9&!{=7lJ48cJ-OV|eS2$~5Ar(KxCIM>WrjCu!`D;|g)y1RQ6@aZ4(i^(!Ym z=x8x5VXfOlKNKPjG~rh64*fV@3j62`@+`VDj;DhaWGm*)2e1+al(3O#yK(wK-OV)C z!b;KEBI}OlR|3|58NmbL%|Etbhql#>236OdIw!g z@1%Fpb@Xn!p58+@(2aBx-AwPL_tE?519S`B$}VLq*k$Z;b_KhVUB&*!u4dP;m24He zmR-lLXE(4L*=lwZyLnDgI1=g}&zRhd2jfbyt3f9jJ^ruDo}QIrR#^f~T$RE1vl%^- zp_RG~GFTf&1&rXx;B`5phf%(HX%|ecGp$Vt3wj!Uux4%o>4PVo6M2X7#?Fo)fvXFO@V2HC*{o|ss@KOYgH)*M@C|*poGtW8Pa}1GK=O=#fR@mU=rVc@y#=#5Vi`B3(p9}4MHd*eq+;7=pdDilRdd2V)@MKwW`)EYaeSrYmPO~I>0)}I>b86dZD$zI?_7YT5O$cooX$&-e-N? zy4QNhddg3Wp~@XcFFFyUtrI(53^6OPqELnFR<6z7uxIW*Vu2h-)-Mwf6V@ZeUJT3 z`&;(+?Fa1twjZ${b+{bqjx0wX#}G%6W1^$jG1)Q2QRbNDsBqLc>K%=a2|8l?#`ahUd}$we$E`{VCMwqbmvUx z9B0Vc;Jn;jBpjt`}Udy54aebRBjbaeePLyRB}!+v#?@ z)7)L$-Q2z0{oNznD}dh$-Bq9-}{;O zu=gkL8O+S{#V%quv4_|bbG45+Mr;xni%Z32;&QwsSRq~~ZWDKiJH^MuC&VYkr^Q|3 zUdbfcC8y+;ypkmOC0Xhy4VOkph0-W#j5JOfFHMw+r3KPe(kkgX=>}=FbhC7ev{t%H zdQ93a?UCM;-jd#yK9;_cj!9>H8NTyj(eeL_+ciJ!bU4DD`4{@@{89fRf84*)f3ttBf2aRN|6c!o|GWP8{RjMC_`mZX54ZxI0-XbyfviB+ z!0wZM}AX&OMY8EAb%u(EFY17l20lo#iI06 za+Ew}fHFwQSB5IXl@UszGD;bvj8(=f6P03RvNA;}Q>H2Nl#7&=%C*Y%%8klR${OWX z<#uJQa+h+qa*wi6*{s~BJfLh<9#Xa`JCvQuF6BApYvr(VL^-Pbpd3?^i}B_ z(s!l5o_-+xX!b2_i>W%6h>YeIG>c{G*>gVbg>LK-O^{{$G zJ*xho9#fC2KdZm0C)LyH8I5RyX4b5lU2|$~&8tb8Uz4>oP1QPRowUwcrk163)w*jv zwO(2ut)G^o - - - 1050 - 10K549 - 851 - 1038.36 - 461.00 - - com.apple.InterfaceBuilder.CocoaPlugin - 851 - - - YES - - - - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - - - PluginDependencyRecalculationVersion - - - - YES - - VMSettingsController - - - FirstResponder - - - NSApplication - - - - 256 - - YES - - - 256 - {{145, 20}, {43, 22}} - - YES - - -1804468671 - 71304192 - 40 - - LucidaGrande - 13 - 1044 - - - YES - - 6 - System - textBackgroundColor - - 3 - MQA - - - - 6 - System - textColor - - 3 - MAA - - - - - - - 256 - {{193, 17}, {19, 27}} - - 1 - YES - - 917024 - 0 - - 1 - 40 - 1 - 10000 - 1 - YES - YES - - - - - 256 - {{17, 22}, {114, 17}} - - YES - - 67239424 - 272629760 - Volume Size (MB) - - - - 6 - System - controlColor - - 3 - MC42NjY2NjY2NjY3AA - - - - 6 - System - controlTextColor - - - - - - {229, 62} - - NSView - NSResponder - - - 13 - 2 - {{217, 242}, {580, 460}} - 1886912512 - Virtual Machine Settings - - NSWindow - - - View - - {1.79769e+308, 1.79769e+308} - {580, 460} - - - 256 - - YES - - - 274 - {{13, 59}, {554, 395}} - - - YES - - 1 - - - 256 - - YES - - - 258 - {{95, 50}, {327, 22}} - - YES - - -1804468671 - 272630784 - - - - YES - - - - - - - 258 - {{95, 78}, {327, 22}} - - YES - - -1804468671 - 272630784 - - - - YES - - - - - - - 256 - {{14, 52}, {77, 17}} - - YES - - 67239424 - 71303168 - Unix Root: - - - - - - - - - 256 - {{20, 80}, {71, 17}} - - YES - - 67239424 - 71303168 - ROM File: - - - - - - - - - 274 - - YES - - - 256 - - YES - - - 292 - {{10, 5}, {82, 32}} - - YES - - 67239424 - 134217728 - Add... - - - -2038284033 - 1 - - - - - - 200 - 25 - - - - - 293 - {{211, 5}, {94, 32}} - - YES - - 67239424 - 134217728 - Create... - - - -2038284033 - 1 - - - - - - 200 - 25 - - - - - 289 - {{417, 5}, {90, 32}} - - YES - - 67239424 - 134217728 - Remove - - - -2038284033 - 1 - - - - - - 200 - 25 - - - - - 274 - - YES - - - 2304 - - YES - - - 256 - {468, 136} - - YES - - - 256 - {468, 17} - - - - - - 256 - {{469, 0}, {16, 17}} - - - - YES - - pathCol - 371 - 40 - 1000 - - 75628096 - 2048 - File - - LucidaGrande - 11 - 3100 - - - 3 - MC4zMzMzMzI5OQA - - - 6 - System - headerTextColor - - - - - 337772096 - 2048 - - - - 6 - System - controlBackgroundColor - - - - - - - - isCDROMcol - 64 - 10 - 3.4028234663852886e+38 - - 75628096 - 2048 - CDROM - - - 6 - System - headerColor - - - - - - 67239424 - 0 - - - - 1215058431 - 2 - - NSImage - NSSwitch - - - NSSwitch - - - - 200 - 25 - - 3 - YES - YES - - - - 3 - 2 - - - 6 - System - gridColor - - 3 - MC41AA - - - 17 - 312475648 - - - 2 - 4 - 15 - 0 - YES - 0 - - - {{1, 17}, {468, 136}} - - - - - 4 - - - - 256 - {{469, 17}, {15, 136}} - - - _doScroller: - 0.99350649350649356 - - - - -2147483392 - {{-100, -100}, {374, 15}} - - 1 - - _doScroller: - 0.99047620000000003 - - - - 2304 - - YES - - - {{1, 0}, {468, 17}} - - - - - 4 - - - - {{16, 42}, {485, 154}} - - - 18 - - - - - - QSAAAEEgAABBmAAAQZgAAA - - - {{2, 2}, {518, 209}} - - - - {{6, 123}, {522, 226}} - - {0, 0} - - 67239424 - 0 - Volumes - - - - 3 - MCAwLjgwMDAwMDAxAA - - - - 3 - 0 - 2 - NO - - - - 256 - {{14, 22}, {77, 17}} - - YES - - 67239424 - 71303168 - Boot From: - - - - - - - - - 256 - {{95, 18}, {94, 26}} - - YES - - 343014976 - 272630784 - Any - - - YES - - - 5 - YES - - YES - Any - CD-ROM - - - - - 274 - {13, 42} - - - YES - - YES - - - 10 - 10 - 1000 - - 75628032 - 0 - - - - - LucidaGrande - 12 - 16 - - - 3 - MC4zMzMzMzI5OQA - - - - - 338820672 - 1024 - CD-ROM - - - YES - - - - 3 - YES - - - - 3 - 2 - - - 19 - tableViewAction: - -765427712 - - - - 1 - 15 - 0 - YES - 0 - - - - - - 256 - {{390, 22}, {129, 18}} - - YES - - 67239424 - 0 - Disable CD-ROM - - - 1211912703 - 2 - - - - - 200 - 25 - - - - - 256 - {{355, 17}, {22, 28}} - - YES - - -2146566624 - 0 - - 19 - 4 - 1024 - 1 - YES - - - - - 256 - {{309, 20}, {41, 22}} - - YES - - -1804468671 - 71304192 - 64 - - - YES - - - - - - - 256 - {{200, 20}, {104, 19}} - - YES - - 67239424 - 71303168 - RAM Size (MB): - - - - - - - - - 289 - {{425, 72}, {98, 32}} - - YES - - 67239424 - 134217728 - Browse... - - - -2038284033 - 1 - - - - - - 200 - 25 - - - - - 289 - {{425, 44}, {98, 32}} - - YES - - 67239424 - 134217728 - Browse... - - - -2038284033 - 1 - - - - - - 200 - 25 - - - - {{10, 33}, {534, 349}} - - - Setup - - - - - 2 - - - 256 - - YES - - - 266 - - YES - - - 256 - - YES - - - 270 - {{125, 20}, {218, 18}} - - YES - - -2080244224 - 0 - Enable QuickDraw Acceleration - - - 1211912703 - 2 - - - - - 200 - 25 - - - - - 266 - {{206, 132}, {143, 26}} - - YES - - -2076049856 - 2048 - - - 109199615 - 1 - - LucidaGrande - 13 - 16 - - - - - - 400 - 75 - - - Window - - 1048576 - 2147483647 - 1 - - NSImage - NSMenuCheckmark - - - NSImage - NSMenuMixedState - - _popUpItemAction: - 1 - - - YES - - - OtherViews - - - YES - - - - Fullscreen - - 1048576 - 2147483647 - - - _popUpItemAction: - 2 - - - - - 3 - YES - YES - 1 - - - - - 266 - {{206, 104}, {143, 26}} - - YES - - -2076049856 - 2048 - - - 109199615 - 1 - - - - - - 400 - 75 - - - 30 Hz - - 1048576 - 2147483647 - 1 - - - _popUpItemAction: - - - YES - - - OtherViews - - - YES - - - 5 Hz - - 1048576 - 2147483647 - - - _popUpItemAction: - - - - - 7.5 Hz - - 1048576 - 2147483647 - - - _popUpItemAction: - - - - - 10 Hz - - 1048576 - 2147483647 - - - _popUpItemAction: - - - - - 15 Hz - - 1048576 - 2147483647 - - - _popUpItemAction: - - - - - - 60 Hz - - 1048576 - 2147483647 - - - _popUpItemAction: - - - - - Dynamic - - 1048576 - 2147483647 - - - _popUpItemAction: - - - - - 4 - 3 - YES - YES - 1 - - - - - 268 - {{118, 80}, {86, 17}} - - YES - - 67239424 - 71303168 - Width: - - - - - - - - - 268 - {{118, 52}, {86, 17}} - - YES - - 67239424 - 71303168 - Height: - - - - - - - - - 266 - {{209, 76}, {140, 26}} - - YES - - 343014976 - 272630784 - 800 - - - YES - - - 5 - YES - - YES - 512 - 640 - 800 - 1024 - Maximum - - - - - 274 - {13, 105} - - - YES - - YES - - - 10 - 10 - 1000 - - 75628032 - 0 - - - - - - 3 - MC4zMzMzMzI5OQA - - - - - 1412562496 - 1024 - 800 - - - YES - - - - 3 - YES - - - - 3 - 2 - - - 19 - tableViewAction: - -765427712 - - - - 1 - 15 - 0 - YES - 0 - - - - - - 266 - {{209, 48}, {140, 26}} - - YES - - 343014976 - 272630784 - 600 - - - YES - - - 5 - YES - - YES - 384 - 480 - 600 - 768 - Maximum - - - - - 274 - {13, 105} - - - YES - - YES - - - 10 - 10 - 1000 - - 75628032 - 0 - - - - - - 3 - MC4zMzMzMzI5OQA - - - - - 1412562496 - 1024 - 600 - - - YES - - - - 3 - YES - - - - 3 - 2 - - - 19 - tableViewAction: - -765427712 - - - - 1 - 15 - 0 - YES - 0 - - - - - - 268 - {{118, 136}, {86, 19}} - - YES - - 67239424 - 71303168 - Video Type: - - - - - - - - - 268 - {{112, 108}, {92, 19}} - - YES - - 67239424 - 71303168 - Refresh Rate: - - - - - - - - {{2, 2}, {518, 177}} - - - - {{6, 155}, {522, 194}} - - {0, 0} - - 67239424 - 0 - Video Settings - - - - 3 - MCAwLjgwMDAwMDAxAA - - - - 3 - 0 - 2 - NO - - - - 266 - - YES - - - 256 - - YES - - - 264 - {{15, 96}, {172, 18}} - - YES - - 67239424 - 0 - Disable Audio Output - - - 1211912703 - 2 - - - - - 200 - 25 - - - - - 266 - {{118, 59}, {379, 22}} - - YES - - -1804468671 - 272630784 - /dev/dsp - - - YES - - - - - - - 266 - {{118, 29}, {379, 22}} - - YES - - -1804468671 - 272630784 - /dev/mixer - - - YES - - - - - - - 264 - {{14, 61}, {99, 17}} - - YES - - 67239424 - 71303168 - Output Device: - - - - - - - - - 264 - {{14, 31}, {99, 17}} - - YES - - 67239424 - 71303168 - Mixer Device: - - - - - - - - {{2, 2}, {518, 134}} - - - - {{6, 0}, {522, 151}} - - {0, 0} - - 67239424 - 0 - Audio Settings - - - - 3 - MCAwLjgwMDAwMDAxAA - - - - 3 - 0 - 2 - NO - - - {{10, 33}, {534, 349}} - - Audio / Video - - - - - Item 4 - - - 256 - - YES - - - 266 - - YES - - - 256 - - YES - - - 256 - {{13, 75}, {130, 17}} - - YES - - 70385217 - 71304192 - Modem Port Device: - - - - - - - - - 256 - {{18, 43}, {125, 17}} - - YES - - 70385217 - 71304192 - Printer Port Device: - - - - - - - - - 256 - {{18, 13}, {126, 17}} - - YES - - 70385217 - 71304192 - Ethernet Interface: - - - - - - - - - 266 - {{146, 73}, {351, 22}} - - YES - - -1804468671 - 4195328 - - - - YES - - - - - - - 266 - {{146, 41}, {351, 22}} - - YES - - -1804468671 - 4195328 - - - - YES - - - - - - - 266 - {{146, 10}, {351, 22}} - - YES - - -1804468671 - 4195328 - slirp - - - YES - - - - - - {{2, 2}, {518, 106}} - - - - {{6, 4}, {522, 123}} - - {0, 0} - - 67239424 - 0 - Serial/Network - - - - 3 - MCAwLjgwMDAwMDAxAA - - - - 3 - 0 - 2 - NO - - - - 266 - - YES - - - 256 - - YES - - - 256 - {{15, 51}, {150, 18}} - - YES - - -2080244224 - 0 - Enable JIT Compiler - - - 1211912703 - 2 - - - - - 200 - 25 - - - - - 256 - {{15, 11}, {333, 18}} - - YES - - 67239424 - 0 - Enable built-in 68k DR Emulator (EXPERIMENTAL) - - - 1211912703 - 2 - - - - - 200 - 25 - - - - - 256 - {{15, 31}, {236, 18}} - - YES - - 67239424 - 0 - Allow Emulated CPU to Idle - - - 1211912703 - 2 - - - - 200 - 25 - - - - - 265 - {{269, 51}, {220, 18}} - - YES - - 67239424 - 0 - Ignore Illegal Instructions - - - 1211912703 - 2 - - - - - 200 - 25 - - - - - 265 - {{269, 31}, {220, 18}} - - YES - - 67239424 - 0 - Ignore Illegal Memory Accesses - - - 1211912703 - 2 - - - - - 200 - 25 - - - - {{2, 2}, {518, 77}} - - - - {{6, 255}, {522, 94}} - - {0, 0} - - 67239424 - 0 - CPU Options - - - - 3 - MCAwLjgwMDAwMDAxAA - - - - 3 - 0 - 2 - NO - - - - 266 - - YES - - - 256 - - YES - - - 256 - {{22, 70}, {142, 18}} - - YES - - 67239424 - 0 - Use Raw Keycodes: - - - 1211912703 - 2 - - - - - 200 - 25 - - - - - 266 - {{170, 69}, {239, 22}} - - YES - - -1804468671 - 272630784 - - - - YES - - - - - - - 256 - {{14, 43}, {151, 17}} - - YES - - 67239424 - 71303168 - Mouse Wheel Function: - - - - - - - - - 256 - {{66, 15}, {99, 17}} - - YES - - 67239424 - 71303168 - Lines to Scroll: - - - - - - - - - 256 - {{170, 13}, {29, 22}} - - YES - - -1804468671 - 272630784 - 3 - - - YES - - - - - - - 256 - {{167, 37}, {163, 26}} - - YES - - -2076049856 - 2048 - - - 109199615 - 1 - - - - - - 400 - 75 - - - Page Up/Down - - 1048576 - 2147483647 - 1 - - - _popUpItemAction: - - - YES - - - OtherViews - - - YES - - - - Cursor Up/Down - - 1048576 - 2147483647 - - - _popUpItemAction: - - - - - 3 - YES - YES - 1 - - - - - 256 - {{204, 10}, {19, 27}} - - YES - - 917024 - 0 - - 59 - 1 - YES - YES - - - - - 289 - {{411, 63}, {96, 32}} - - YES - - 67239424 - 134217728 - Browse... - - - -2038284033 - 129 - - - 200 - 25 - - - - {{2, 2}, {518, 103}} - - - - {{6, 131}, {522, 120}} - - {0, 0} - - 67239424 - 0 - Mouse/Keyboard - - - - 3 - MCAwLjgwMDAwMDAxAA - - - - 3 - 0 - 2 - NO - - - {{10, 33}, {534, 349}} - - Miscellaneous - - - - - - - 0 - YES - YES - - YES - - - - - - 289 - {{374, 20}, {96, 32}} - - YES - - 67239424 - 134217728 - Cancel - - - -2038284033 - 129 - - - 200 - 25 - - - - - 289 - {{470, 20}, {96, 32}} - - YES - - 67239424 - 134217728 - Save - - - -2038284033 - 129 - - - 200 - 25 - - - - {580, 460} - - - {{0, 0}, {1440, 878}} - {580, 482} - {1.79769e+308, 1.79769e+308} - - - - 268 - - YES - - - 268 - {{18, 18}, {85, 18}} - - YES - - 67239424 - 0 - Is CDROM - - - 1211912703 - 2 - - - - - 200 - 25 - - - - {121, 54} - - NSView - - - - - YES - - - takeIntValueFrom: - - - - 282 - - - - initialFirstResponder - - - - 283 - - - - takeIntValueFrom: - - - - 291 - - - - takeIntValueFrom: - - - - 310 - - - - takeIntValueFrom: - - - - 311 - - - - takeIntValueFrom: - - - - 313 - - - - takeIntValueFrom: - - - - 314 - - - - window - - - - 318 - - - - bootFrom - - - - 319 - - - - disableCdrom - - - - 320 - - - - disableSound - - - - 321 - - - - dontUseCPUWhenIdle - - - - 322 - - - - enable68kDREmulator - - - - 323 - - - - enableJIT - - - - 324 - - - - unixRoot - - - - 325 - - - - romFile - - - - 326 - - - - browseForROMFileClicked: - - - - 327 - - - - addDisk: - - - - 328 - - - - createDisk: - - - - 329 - - - - removeDisk: - - - - 330 - - - - useRawKeyCodesClicked: - - - - 331 - - - - rawKeyCodes - - - - 332 - - - - useRawKeyCodes - - - - 333 - - - - modemPort - - - - 334 - - - - mouseWheel - - - - 335 - - - - printerPort - - - - 336 - - - - ramSize - - - - 337 - - - - ramSizeStepper - - - - 338 - - - - mixDevice - - - - 339 - - - - outDevice - - - - 340 - - - - qdAccel - - - - 341 - - - - height - - - - 342 - - - - width - - - - 343 - - - - videoType - - - - 344 - - - - refreshRate - - - - 345 - - - - scrollLines - - - - 346 - - - - scrollLinesStepper - - - - 347 - - - - ignoreIllegalMemoryAccesses - - - - 348 - - - - ethernetInterface - - - - 349 - - - - diskSaveSizeField - - - - 351 - - - - diskSaveSize - - - - 353 - - - - delegate - - - - 355 - - - - disks - - - - 368 - - - - browseForUnixRootClicked: - - - - 369 - - - - ignoreIllegalInstructions - - - - 372 - - - - saveChanges: - - - - 373 - - - - cancelEdit: - - - - 374 - - - - browseForKeyCodesFileClicked: - - - - 378 - - - - browseRawKeyCodesButton - - - - 379 - - - - isCDROM - - - - 383 - - - - isCDROMcheckbox - - - - 384 - - - - - YES - - 0 - - YES - - - - - - -2 - - - File's Owner - - - -1 - - - First Responder - - - -3 - - - Application - - - 141 - - - YES - - - - - - DiskSize - - - 142 - - - YES - - - - PrefsWindow - - - 143 - - - YES - - - - - - - - 144 - - - YES - - - - - - - - 145 - - - YES - - - - - - 147 - - - YES - - - - - - 148 - - - YES - - - - - - - 157 - - - YES - - - - - - - - - - - - - - 230 - - - YES - - - - - - - - - - - - - - - - - - 231 - - - YES - - - - - - 232 - - - YES - - - - - - 233 - - - YES - - - - - - 234 - - - YES - - - - - - 235 - - - YES - - - - - - 236 - - - YES - - - - - - 237 - - - YES - - - - - - 238 - - - YES - - - - - - 239 - - - YES - - - - - - 240 - - - YES - - - - - - - - - 241 - - - YES - - - - - - 242 - - - YES - - - - - - 243 - - - - - 244 - - - - - 245 - - - YES - - - - - - 246 - - - YES - - - - - - 247 - - - YES - - - - - - 248 - - - YES - - - - - - - - - 249 - - - - - 250 - - - - - 251 - - - YES - - - - - - - 252 - - - YES - - - - - - 253 - - - - - 254 - - - - - 255 - - - - - 256 - - - - - 257 - - - - - 258 - - - - - 259 - - - - - 260 - - - - - 261 - - - - - 262 - - - - - 263 - - - - - 264 - - - - - 265 - - - - - 266 - - - YES - - - - - - 267 - - - YES - - - - - - 268 - - - YES - - - - - - 269 - - - - - 270 - - - - - 271 - - - - - 358 - - - YES - - - - - - 359 - - - YES - - - - - - - - 360 - - - YES - - - - - - 361 - - - - - 362 - - - YES - - - - - - 363 - - - - - 364 - - - YES - - - - - - 365 - - - - - 195 - - - YES - - - - - - - - - - 192 - - - YES - - - - - - 370 - - - YES - - - - - - 190 - - - YES - - - - - - 193 - - - YES - - - - - - 191 - - - YES - - - - - - 228 - - - - - 226 - - - - - 229 - - - - - 371 - - - - - 227 - - - - - 194 - - - YES - - - - - - - - - - - 214 - - - YES - - - - - - 225 - - - - - 215 - - - YES - - - - - - 224 - - - - - 216 - - - YES - - - - - - 223 - - - - - 217 - - - YES - - - - - - 222 - - - - - 218 - - - YES - - - - - - 221 - - - - - 219 - - - YES - - - - - - 220 - - - - - 203 - - - YES - - - - - - - - - - - - - 196 - - - YES - - - - - - 197 - - - YES - - - - - - 198 - - - YES - - - - - - 199 - - - YES - - - - - - 200 - - - YES - - - - - - 201 - - - YES - - - - - - 202 - - - YES - - - - - - 204 - - - - - 205 - - - YES - - - - - - 206 - - - YES - - - - - - - 207 - - - - - 208 - - - - - 209 - - - - - 210 - - - - - 211 - - - - - 212 - - - - - 213 - - - - - 150 - - - YES - - - - - - - - - - 158 - - - YES - - - - - - 161 - - - YES - - - - - - 164 - - - YES - - - - - - 159 - - - YES - - - - - - 160 - - - YES - - - - - - 169 - - - - - 170 - - - - - 165 - - - - - 168 - - - - - 171 - - - - - 153 - - - YES - - - - - - 182 - - - - - 151 - - - YES - - - - - - 184 - - - YES - - - - - - 185 - - - YES - - - - - - - 187 - - - - - 186 - - - - - 156 - - - YES - - - - - - 172 - - - YES - - - - - - 173 - - - YES - - - - - - - - - - - - 179 - - - - - 178 - - - - - 177 - - - - - 176 - - - - - 175 - - - - - 174 - - - - - 152 - - - YES - - - - - - 183 - - - - - 162 - - - YES - - - - - - 167 - - - - - 154 - - - YES - - - - - - 181 - - - - - 149 - - - YES - - - - - - 188 - - - - - 155 - - - YES - - - - - - 180 - - - - - 163 - - - YES - - - - - - 166 - - - - - 375 - - - - - 376 - - - YES - - - - - - 377 - - - - - 380 - - - YES - - - - IsCDROM - - - 381 - - - YES - - - - - - 382 - - - - - 388 - - - YES - - - - - - 390 - - - - - 391 - - - - - - - YES - - YES - -3.IBPluginDependency - 141.IBEditorWindowLastContentRect - 141.IBPluginDependency - 141.ImportedFromIB2 - 142.IBEditorWindowLastContentRect - 142.IBPluginDependency - 142.IBWindowTemplateEditedContentRect - 142.ImportedFromIB2 - 142.NSWindowTemplate.visibleAtLaunch - 142.windowTemplate.hasMinSize - 142.windowTemplate.minSize - 143.IBPluginDependency - 143.ImportedFromIB2 - 144.IBPluginDependency - 144.ImportedFromIB2 - 145.IBPluginDependency - 145.ImportedFromIB2 - 147.IBPluginDependency - 147.ImportedFromIB2 - 148.IBPluginDependency - 148.ImportedFromIB2 - 149.IBPluginDependency - 149.ImportedFromIB2 - 150.IBPluginDependency - 150.ImportedFromIB2 - 151.IBPluginDependency - 151.ImportedFromIB2 - 152.IBPluginDependency - 152.ImportedFromIB2 - 153.IBPluginDependency - 153.ImportedFromIB2 - 154.IBPluginDependency - 154.ImportedFromIB2 - 155.IBPluginDependency - 155.ImportedFromIB2 - 156.IBPluginDependency - 156.ImportedFromIB2 - 157.IBPluginDependency - 157.ImportedFromIB2 - 158.IBPluginDependency - 158.ImportedFromIB2 - 159.IBPluginDependency - 159.ImportedFromIB2 - 160.IBPluginDependency - 160.ImportedFromIB2 - 161.IBPluginDependency - 161.ImportedFromIB2 - 162.IBPluginDependency - 162.ImportedFromIB2 - 163.IBPluginDependency - 163.ImportedFromIB2 - 164.IBPluginDependency - 164.ImportedFromIB2 - 165.IBPluginDependency - 166.IBPluginDependency - 167.IBPluginDependency - 168.IBPluginDependency - 169.IBPluginDependency - 170.IBPluginDependency - 171.IBPluginDependency - 172.IBPluginDependency - 173.IBEditorWindowLastContentRect - 173.IBPluginDependency - 173.ImportedFromIB2 - 174.IBPluginDependency - 174.ImportedFromIB2 - 175.IBPluginDependency - 175.ImportedFromIB2 - 176.IBPluginDependency - 176.ImportedFromIB2 - 177.IBPluginDependency - 177.ImportedFromIB2 - 178.IBPluginDependency - 178.ImportedFromIB2 - 179.IBPluginDependency - 179.ImportedFromIB2 - 180.IBPluginDependency - 181.IBPluginDependency - 182.IBPluginDependency - 183.IBPluginDependency - 184.IBPluginDependency - 185.IBEditorWindowLastContentRect - 185.IBPluginDependency - 185.ImportedFromIB2 - 186.IBPluginDependency - 186.ImportedFromIB2 - 187.IBPluginDependency - 187.ImportedFromIB2 - 188.IBPluginDependency - 190.IBPluginDependency - 190.ImportedFromIB2 - 191.IBPluginDependency - 191.ImportedFromIB2 - 192.IBPluginDependency - 192.ImportedFromIB2 - 193.IBPluginDependency - 193.ImportedFromIB2 - 194.IBPluginDependency - 194.ImportedFromIB2 - 195.IBPluginDependency - 195.ImportedFromIB2 - 196.IBPluginDependency - 196.ImportedFromIB2 - 197.IBPluginDependency - 197.ImportedFromIB2 - 198.IBPluginDependency - 198.ImportedFromIB2 - 199.IBPluginDependency - 199.ImportedFromIB2 - 200.IBPluginDependency - 200.ImportedFromIB2 - 201.IBPluginDependency - 201.ImportedFromIB2 - 202.IBPluginDependency - 202.ImportedFromIB2 - 203.IBPluginDependency - 203.ImportedFromIB2 - 204.IBPluginDependency - 205.IBPluginDependency - 206.IBPluginDependency - 206.ImportedFromIB2 - 207.IBPluginDependency - 207.ImportedFromIB2 - 208.IBPluginDependency - 208.ImportedFromIB2 - 209.IBPluginDependency - 210.IBPluginDependency - 211.IBPluginDependency - 212.IBPluginDependency - 213.IBPluginDependency - 214.IBPluginDependency - 214.ImportedFromIB2 - 215.IBPluginDependency - 215.ImportedFromIB2 - 216.IBPluginDependency - 216.ImportedFromIB2 - 217.IBPluginDependency - 217.ImportedFromIB2 - 218.IBPluginDependency - 218.ImportedFromIB2 - 219.IBPluginDependency - 219.ImportedFromIB2 - 220.IBPluginDependency - 221.IBPluginDependency - 222.IBPluginDependency - 223.IBPluginDependency - 224.IBPluginDependency - 225.IBPluginDependency - 226.IBPluginDependency - 227.IBPluginDependency - 228.IBPluginDependency - 229.IBPluginDependency - 230.IBPluginDependency - 230.ImportedFromIB2 - 231.IBPluginDependency - 231.ImportedFromIB2 - 232.IBPluginDependency - 232.ImportedFromIB2 - 233.IBPluginDependency - 233.ImportedFromIB2 - 234.IBPluginDependency - 234.ImportedFromIB2 - 235.IBPluginDependency - 235.ImportedFromIB2 - 236.IBPluginDependency - 236.ImportedFromIB2 - 237.IBPluginDependency - 237.ImportedFromIB2 - 238.IBPluginDependency - 238.ImportedFromIB2 - 239.IBPluginDependency - 239.ImportedFromIB2 - 240.IBPluginDependency - 240.ImportedFromIB2 - 241.IBPluginDependency - 241.ImportedFromIB2 - 242.IBPluginDependency - 242.ImportedFromIB2 - 243.IBPluginDependency - 244.IBPluginDependency - 245.IBPluginDependency - 245.ImportedFromIB2 - 246.IBPluginDependency - 246.ImportedFromIB2 - 247.IBPluginDependency - 247.ImportedFromIB2 - 248.IBPluginDependency - 248.ImportedFromIB2 - 249.IBPluginDependency - 249.IBShouldRemoveOnLegacySave - 250.IBPluginDependency - 250.IBShouldRemoveOnLegacySave - 251.IBPluginDependency - 251.ImportedFromIB2 - 252.IBPluginDependency - 252.ImportedFromIB2 - 253.IBPluginDependency - 253.IBShouldRemoveOnLegacySave - 254.IBPluginDependency - 255.IBPluginDependency - 256.IBPluginDependency - 257.IBPluginDependency - 258.IBPluginDependency - 259.IBPluginDependency - 260.IBPluginDependency - 261.IBPluginDependency - 262.IBPluginDependency - 263.IBPluginDependency - 264.IBPluginDependency - 265.IBPluginDependency - 266.IBPluginDependency - 266.ImportedFromIB2 - 267.IBPluginDependency - 267.ImportedFromIB2 - 268.IBPluginDependency - 268.ImportedFromIB2 - 269.IBPluginDependency - 270.IBPluginDependency - 271.IBPluginDependency - 358.IBPluginDependency - 359.IBPluginDependency - 360.IBPluginDependency - 361.IBPluginDependency - 362.IBPluginDependency - 363.IBPluginDependency - 364.IBPluginDependency - 364.ImportedFromIB2 - 365.IBPluginDependency - 370.IBPluginDependency - 370.ImportedFromIB2 - 371.IBPluginDependency - 375.IBPluginDependency - 375.ImportedFromIB2 - 376.IBPluginDependency - 377.IBPluginDependency - 380.IBEditorWindowLastContentRect - 380.IBPluginDependency - 381.IBPluginDependency - 382.IBPluginDependency - 388.IBPluginDependency - 390.IBPluginDependency - 391.IBPluginDependency - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - {{899, 941}, {229, 62}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{739, 322}, {580, 460}} - com.apple.InterfaceBuilder.CocoaPlugin - {{739, 322}, {580, 460}} - - - - {580, 460} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{601, 517}, {143, 143}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{196, 720}, {138, 43}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{705, 948}, {121, 54}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 391 - - - - YES - - VMSettingsController - NSWindowController - - YES - - YES - addDisk: - browseForKeyCodesFileClicked: - browseForROMFileClicked: - browseForUnixRootClicked: - cancelEdit: - createDisk: - removeDisk: - saveChanges: - useRawKeyCodesClicked: - - - YES - id - id - id - id - id - id - id - id - id - - - - YES - - YES - addDisk: - browseForKeyCodesFileClicked: - browseForROMFileClicked: - browseForUnixRootClicked: - cancelEdit: - createDisk: - removeDisk: - saveChanges: - useRawKeyCodesClicked: - - - YES - - addDisk: - id - - - browseForKeyCodesFileClicked: - id - - - browseForROMFileClicked: - id - - - browseForUnixRootClicked: - id - - - cancelEdit: - id - - - createDisk: - id - - - removeDisk: - id - - - saveChanges: - id - - - useRawKeyCodesClicked: - id - - - - - YES - - YES - bootFrom - browseRawKeyCodesButton - disableCdrom - disableSound - diskSaveSize - diskSaveSizeField - disks - dontUseCPUWhenIdle - enable68kDREmulator - enableJIT - ethernetInterface - height - ignoreIllegalInstructions - ignoreIllegalMemoryAccesses - isCDROM - isCDROMcheckbox - mixDevice - modemPort - mouseWheel - outDevice - printerPort - qdAccel - ramSize - ramSizeStepper - rawKeyCodes - refreshRate - romFile - scrollLines - scrollLinesStepper - unixRoot - useRawKeyCodes - videoType - width - - - YES - NSComboBox - NSButton - NSButton - NSButton - NSView - NSTextField - NSTableView - NSButton - NSButton - NSButton - NSTextField - NSComboBox - NSButton - NSButton - NSView - NSButton - NSTextField - NSTextField - NSPopUpButton - NSTextField - NSTextField - NSButton - NSTextField - NSStepper - NSTextField - NSPopUpButton - NSTextField - NSTextField - NSStepper - NSTextField - NSButton - NSPopUpButton - NSComboBox - - - - YES - - YES - bootFrom - browseRawKeyCodesButton - disableCdrom - disableSound - diskSaveSize - diskSaveSizeField - disks - dontUseCPUWhenIdle - enable68kDREmulator - enableJIT - ethernetInterface - height - ignoreIllegalInstructions - ignoreIllegalMemoryAccesses - isCDROM - isCDROMcheckbox - mixDevice - modemPort - mouseWheel - outDevice - printerPort - qdAccel - ramSize - ramSizeStepper - rawKeyCodes - refreshRate - romFile - scrollLines - scrollLinesStepper - unixRoot - useRawKeyCodes - videoType - width - - - YES - - bootFrom - NSComboBox - - - browseRawKeyCodesButton - NSButton - - - disableCdrom - NSButton - - - disableSound - NSButton - - - diskSaveSize - NSView - - - diskSaveSizeField - NSTextField - - - disks - NSTableView - - - dontUseCPUWhenIdle - NSButton - - - enable68kDREmulator - NSButton - - - enableJIT - NSButton - - - ethernetInterface - NSTextField - - - height - NSComboBox - - - ignoreIllegalInstructions - NSButton - - - ignoreIllegalMemoryAccesses - NSButton - - - isCDROM - NSView - - - isCDROMcheckbox - NSButton - - - mixDevice - NSTextField - - - modemPort - NSTextField - - - mouseWheel - NSPopUpButton - - - outDevice - NSTextField - - - printerPort - NSTextField - - - qdAccel - NSButton - - - ramSize - NSTextField - - - ramSizeStepper - NSStepper - - - rawKeyCodes - NSTextField - - - refreshRate - NSPopUpButton - - - romFile - NSTextField - - - scrollLines - NSTextField - - - scrollLinesStepper - NSStepper - - - unixRoot - NSTextField - - - useRawKeyCodes - NSButton - - - videoType - NSPopUpButton - - - width - NSComboBox - - - - - IBProjectSource - Launcher/VMSettingsController.h - - - - - 0 - IBCocoaFramework - - com.apple.InterfaceBuilder.CocoaPlugin.macosx - - - - com.apple.InterfaceBuilder.CocoaPlugin.macosx - - - - com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 - - - YES - ../../SheepShaver.xcodeproj - 3 - - YES - - YES - NSMenuCheckmark - NSMenuMixedState - NSSwitch - - - YES - {9, 8} - {7, 2} - {15, 15} - - - - diff --git a/SheepShaver/src/MacOSX/Launcher/English.lproj/VMSettingsWindow.nib/keyedobjects.nib b/SheepShaver/src/MacOSX/Launcher/English.lproj/VMSettingsWindow.nib/keyedobjects.nib deleted file mode 100755 index b27171c4a97d2a2cd2d63e32abc20b9d5d0c5c32..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 43067 zcmbq+2YeL8_xP0E+j6u^?4N zrHUwu9Z_sx0R#aR>X=$G# zj0mDgLNaohEzFj~noRapR2G$$4r@|2?iOD`Rpsy|`4t5dir{i?ld7`vaD?Zq*kIC6 zk%Clo6-q}Lr~~SVu0>tZ6f_IniynkK525GLHnbDHirzr)qYu!B=o9ogI)o0Rqv$v~ zfqp;=_QHqZNOTc5!&l*S+zxlb*Ww;H8|UC$JQR<_V{id3#N+V8TeLg;XCm? z_LR*K8WOkxpE=8(DMZnB1K zCC`&r$Zqm3`G9;%ek4DUljIL_fn206s?ad%rI9p>CefDkN}562(hjsE;6kCj=nb?V z9Y}}KvGgWdOiO4ft)w&Pt#lrpPZ!Wd^g;R%T}#)|C+V~FdHOPag}y^~(|75I^mF

X^=En%8`aiH%a+Y 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 - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIconFile - SheepShaver.icns - CFBundleIdentifier - net.sourceforge.SheepShaverLauncher - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - SheepShaver - CFBundlePackageType - APPL - CFBundleSignature - ???? - CFBundleVersion - 2.3 - NSMainNibFile - MainMenu - NSPrincipalClass - NSApplication - - diff --git a/SheepShaver/src/MacOSX/Launcher/LauncherPrefix.h b/SheepShaver/src/MacOSX/Launcher/LauncherPrefix.h deleted file mode 100644 index 992c034d..00000000 --- a/SheepShaver/src/MacOSX/Launcher/LauncherPrefix.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * LauncherPrefix.h - * - * Copyright (C) 2010 Alexei Svitkine - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef LAUNCHERPREFIX_H -#define LAUNCHERPREFIX_H - -#define CONFIG_H -#define STDC_HEADERS -#define SIZEOF_DOUBLE 8 -#define SIZEOF_FLOAT 4 -#define SIZEOF_INT 4 -#define SIZEOF_LONG_LONG 8 -#define SIZEOF_SHORT 2 - -#ifdef __LP64__ -#define SIZEOF_VOID_P 8 -#define SIZEOF_LONG 8 -#else -#define SIZEOF_VOID_P 4 -#define SIZEOF_LONG 4 -#endif - -#define loff_t off_t - -#endif /* LAUNCHERPREFIX_H */ diff --git a/SheepShaver/src/MacOSX/Launcher/SheepShaverLauncher.xcodeproj/project.pbxproj b/SheepShaver/src/MacOSX/Launcher/SheepShaverLauncher.xcodeproj/project.pbxproj deleted file mode 100644 index fe382f61..00000000 --- a/SheepShaver/src/MacOSX/Launcher/SheepShaverLauncher.xcodeproj/project.pbxproj +++ /dev/null @@ -1,399 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 084186B10B3A0515004B1F63 /* VMSettingsController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 084186B00B3A0515004B1F63 /* VMSettingsController.mm */; }; - 088EBBB61B41AEBB0066D352 /* DiskType.m in Sources */ = {isa = PBXBuildFile; fileRef = 088EBBB51B41AEBB0066D352 /* DiskType.m */; }; - 08AAB16D102614D5007E1230 /* SheepShaver.icns in Resources */ = {isa = PBXBuildFile; fileRef = 08AAB16C102614D5007E1230 /* SheepShaver.icns */; }; - 08AAB1B310261691007E1230 /* SheepShaver in Copy SheepShaver */ = {isa = PBXBuildFile; fileRef = 08AAB1B11026168B007E1230 /* SheepShaver */; }; - 08B5FAFD102497FA0047FD1B /* VMSettingsWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = 08B5FAFB102497FA0047FD1B /* VMSettingsWindow.nib */; }; - 08B5FB01102498B00047FD1B /* VMListWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = 08B5FAFF102498B00047FD1B /* VMListWindow.nib */; }; - 08B5FB221024FE320047FD1B /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 08B5FB211024FE320047FD1B /* AppController.mm */; }; - 08DC90BD0B67074C00799A45 /* prefs_items.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08DC90BC0B67074C00799A45 /* prefs_items.cpp */; }; - 08DC90BF0B67075D00799A45 /* prefs_unix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08DC90BE0B67075D00799A45 /* prefs_unix.cpp */; }; - 08DC90C10B67077300799A45 /* prefs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08DC90C00B67077300799A45 /* prefs.cpp */; }; - 08F4D174102601C500C6436D /* VMListController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 08F4D173102601C500C6436D /* VMListController.mm */; }; - 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; }; - 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; - 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; - 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 08AAB19E1026164C007E1230 /* Copy SheepShaver */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 6; - files = ( - 08AAB1B310261691007E1230 /* SheepShaver in Copy SheepShaver */, - ); - name = "Copy SheepShaver"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 084186AF0B3A0515004B1F63 /* VMSettingsController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = VMSettingsController.h; sourceTree = ""; }; - 084186B00B3A0515004B1F63 /* VMSettingsController.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = VMSettingsController.mm; sourceTree = ""; }; - 085339D612C9874400345D35 /* LauncherPrefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LauncherPrefix.h; sourceTree = SOURCE_ROOT; }; - 088EBB6F1B41ABDA0066D352 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = config.h; path = ../config/config.h; sourceTree = SOURCE_ROOT; }; - 088EBB701B41ABE40066D352 /* config-macosx-ppc_32.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "config-macosx-ppc_32.h"; path = "../config/config-macosx-ppc_32.h"; sourceTree = SOURCE_ROOT; }; - 088EBB711B41ABE40066D352 /* config-macosx-x86_32.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "config-macosx-x86_32.h"; path = "../config/config-macosx-x86_32.h"; sourceTree = SOURCE_ROOT; }; - 088EBB721B41ABE40066D352 /* config-macosx-x86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "config-macosx-x86_64.h"; path = "../config/config-macosx-x86_64.h"; sourceTree = SOURCE_ROOT; }; - 088EBBB41B41AEBB0066D352 /* DiskType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiskType.h; sourceTree = SOURCE_ROOT; }; - 088EBBB51B41AEBB0066D352 /* DiskType.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DiskType.m; sourceTree = SOURCE_ROOT; }; - 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; - 08AAB16C102614D5007E1230 /* SheepShaver.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = SheepShaver.icns; path = ../SheepShaver.icns; sourceTree = SOURCE_ROOT; }; - 08AAB1B11026168B007E1230 /* SheepShaver */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; name = SheepShaver; path = ../../Unix/SheepShaver; sourceTree = SOURCE_ROOT; }; - 08B5FAFC102497FA0047FD1B /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/VMSettingsWindow.nib; sourceTree = ""; }; - 08B5FB00102498B00047FD1B /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/VMListWindow.nib; sourceTree = ""; }; - 08B5FB201024FE320047FD1B /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = ""; }; - 08B5FB211024FE320047FD1B /* AppController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppController.mm; sourceTree = ""; }; - 08DC90BC0B67074C00799A45 /* prefs_items.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = prefs_items.cpp; path = ../../prefs_items.cpp; sourceTree = SOURCE_ROOT; }; - 08DC90BE0B67075D00799A45 /* prefs_unix.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = prefs_unix.cpp; path = ../../Unix/prefs_unix.cpp; sourceTree = SOURCE_ROOT; }; - 08DC90C00B67077300799A45 /* prefs.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = prefs.cpp; path = ../../prefs.cpp; sourceTree = SOURCE_ROOT; }; - 08DC90C20B67078300799A45 /* prefs.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = prefs.h; path = ../../include/prefs.h; sourceTree = SOURCE_ROOT; }; - 08DC90C40B67079800799A45 /* sys.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sys.h; path = ../../include/sys.h; sourceTree = SOURCE_ROOT; }; - 08DC90C50B6707AC00799A45 /* user_strings_unix.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = user_strings_unix.h; path = ../../Unix/user_strings_unix.h; sourceTree = SOURCE_ROOT; }; - 08DC90C70B6707BE00799A45 /* sysdeps.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sysdeps.h; path = ../../Unix/sysdeps.h; sourceTree = SOURCE_ROOT; }; - 08F4D172102601C500C6436D /* VMListController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMListController.h; sourceTree = ""; }; - 08F4D173102601C500C6436D /* VMListController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = VMListController.mm; sourceTree = ""; }; - 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; - 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; - 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 29B97319FDCFA39411CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = ""; }; - 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; - 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; - 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; - 8D1107320486CEB800E47090 /* SheepShaverLauncher.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SheepShaverLauncher.app; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 8D11072E0486CEB800E47090 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 080E96DDFE201D6D7F000001 /* Classes */ = { - isa = PBXGroup; - children = ( - ); - name = Classes; - sourceTree = ""; - }; - 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { - isa = PBXGroup; - children = ( - 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, - ); - name = "Linked Frameworks"; - sourceTree = ""; - }; - 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { - isa = PBXGroup; - children = ( - 29B97324FDCFA39411CA2CEA /* AppKit.framework */, - 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */, - 29B97325FDCFA39411CA2CEA /* Foundation.framework */, - ); - name = "Other Frameworks"; - sourceTree = ""; - }; - 19C28FACFE9D520D11CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 8D1107320486CEB800E47090 /* SheepShaverLauncher.app */, - ); - name = Products; - sourceTree = ""; - }; - 29B97314FDCFA39411CA2CEA /* SheepShaverLauncher */ = { - isa = PBXGroup; - children = ( - 085339D612C9874400345D35 /* LauncherPrefix.h */, - 08DC90C20B67078300799A45 /* prefs.h */, - 08DC90C40B67079800799A45 /* sys.h */, - 08DC90C50B6707AC00799A45 /* user_strings_unix.h */, - 088EBB6F1B41ABDA0066D352 /* config.h */, - 088EBB701B41ABE40066D352 /* config-macosx-ppc_32.h */, - 088EBB711B41ABE40066D352 /* config-macosx-x86_32.h */, - 088EBB721B41ABE40066D352 /* config-macosx-x86_64.h */, - 08DC90C70B6707BE00799A45 /* sysdeps.h */, - 08DC90BC0B67074C00799A45 /* prefs_items.cpp */, - 08DC90BE0B67075D00799A45 /* prefs_unix.cpp */, - 08DC90C00B67077300799A45 /* prefs.cpp */, - 080E96DDFE201D6D7F000001 /* Classes */, - 29B97315FDCFA39411CA2CEA /* Other Sources */, - 29B97317FDCFA39411CA2CEA /* Resources */, - 29B97323FDCFA39411CA2CEA /* Frameworks */, - 19C28FACFE9D520D11CA2CBB /* Products */, - 08B5FB201024FE320047FD1B /* AppController.h */, - 08B5FB211024FE320047FD1B /* AppController.mm */, - 088EBBB41B41AEBB0066D352 /* DiskType.h */, - 088EBBB51B41AEBB0066D352 /* DiskType.m */, - 084186AF0B3A0515004B1F63 /* VMSettingsController.h */, - 084186B00B3A0515004B1F63 /* VMSettingsController.mm */, - 08F4D172102601C500C6436D /* VMListController.h */, - 08F4D173102601C500C6436D /* VMListController.mm */, - ); - name = SheepShaverLauncher; - sourceTree = ""; - }; - 29B97315FDCFA39411CA2CEA /* Other Sources */ = { - isa = PBXGroup; - children = ( - 29B97316FDCFA39411CA2CEA /* main.m */, - ); - name = "Other Sources"; - sourceTree = ""; - }; - 29B97317FDCFA39411CA2CEA /* Resources */ = { - isa = PBXGroup; - children = ( - 08AAB1B11026168B007E1230 /* SheepShaver */, - 08AAB16C102614D5007E1230 /* SheepShaver.icns */, - 8D1107310486CEB800E47090 /* Info.plist */, - 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, - 29B97318FDCFA39411CA2CEA /* MainMenu.nib */, - 08B5FAFB102497FA0047FD1B /* VMSettingsWindow.nib */, - 08B5FAFF102498B00047FD1B /* VMListWindow.nib */, - ); - name = Resources; - sourceTree = ""; - }; - 29B97323FDCFA39411CA2CEA /* Frameworks */ = { - isa = PBXGroup; - children = ( - 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, - 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, - ); - name = Frameworks; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 8D1107260486CEB800E47090 /* SheepShaver Launcher */ = { - isa = PBXNativeTarget; - buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "SheepShaver Launcher" */; - buildPhases = ( - 8D1107290486CEB800E47090 /* Resources */, - 8D11072C0486CEB800E47090 /* Sources */, - 8D11072E0486CEB800E47090 /* Frameworks */, - 08AAB19E1026164C007E1230 /* Copy SheepShaver */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "SheepShaver Launcher"; - productInstallPath = "$(HOME)/Applications"; - productName = SheepShaverLauncher; - productReference = 8D1107320486CEB800E47090 /* SheepShaverLauncher.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 29B97313FDCFA39411CA2CEA /* Project object */ = { - isa = PBXProject; - buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "SheepShaverLauncher" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - ); - mainGroup = 29B97314FDCFA39411CA2CEA /* SheepShaverLauncher */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 8D1107260486CEB800E47090 /* SheepShaver Launcher */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 8D1107290486CEB800E47090 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */, - 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, - 08B5FAFD102497FA0047FD1B /* VMSettingsWindow.nib in Resources */, - 08B5FB01102498B00047FD1B /* VMListWindow.nib in Resources */, - 08AAB16D102614D5007E1230 /* SheepShaver.icns in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 8D11072C0486CEB800E47090 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D11072D0486CEB800E47090 /* main.m in Sources */, - 084186B10B3A0515004B1F63 /* VMSettingsController.mm in Sources */, - 08DC90BD0B67074C00799A45 /* prefs_items.cpp in Sources */, - 08DC90BF0B67075D00799A45 /* prefs_unix.cpp in Sources */, - 08DC90C10B67077300799A45 /* prefs.cpp in Sources */, - 08B5FB221024FE320047FD1B /* AppController.mm in Sources */, - 08F4D174102601C500C6436D /* VMListController.mm in Sources */, - 088EBBB61B41AEBB0066D352 /* DiskType.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 089C165DFE840E0CC02AAC07 /* English */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; - 08B5FAFB102497FA0047FD1B /* VMSettingsWindow.nib */ = { - isa = PBXVariantGroup; - children = ( - 08B5FAFC102497FA0047FD1B /* English */, - ); - name = VMSettingsWindow.nib; - sourceTree = ""; - }; - 08B5FAFF102498B00047FD1B /* VMListWindow.nib */ = { - isa = PBXVariantGroup; - children = ( - 08B5FB00102498B00047FD1B /* English */, - ); - name = VMListWindow.nib; - sourceTree = ""; - }; - 29B97318FDCFA39411CA2CEA /* MainMenu.nib */ = { - isa = PBXVariantGroup; - children = ( - 29B97319FDCFA39411CA2CEA /* English */, - ); - name = MainMenu.nib; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - C01FCF4B08A954540054247B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - PREFS_EDITOR, - STANDALONE_PREFS, - ); - GCC_VERSION = 4.0; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(HOME)/Applications"; - OTHER_CFLAGS = "$(inherited)"; - PRODUCT_NAME = SheepShaverLauncher; - WRAPPER_EXTENSION = app; - ZERO_LINK = YES; - }; - name = Debug; - }; - C01FCF4C08A954540054247B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = ( - ppc, - i386, - x86_64, - ); - COPY_PHASE_STRIP = NO; - GCC_GENERATE_DEBUGGING_SYMBOLS = YES; - GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp; - GCC_MODEL_TUNING = G5; - GCC_PREPROCESSOR_DEFINITIONS = ( - PREFS_EDITOR, - STANDALONE_PREFS, - ); - GCC_VERSION = 4.0; - "GCC_VERSION[arch=x86_64]" = 4.2; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(HOME)/Applications"; - "MACOSX_DEPLOYMENT_TARGET[arch=x86_64]" = 10.5; - OTHER_CFLAGS = "$(inherited)"; - PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; - PRODUCT_NAME = SheepShaverLauncher; - "SDKROOT[arch=x86_64]" = macosx10.6; - WRAPPER_EXTENSION = app; - }; - name = Release; - }; - C01FCF4F08A954540054247B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - PREBINDING = NO; - SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; - }; - name = Debug; - }; - C01FCF5008A954540054247B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - GCC_PREFIX_HEADER = LauncherPrefix.h; - GCC_VERSION = 4.0; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - PREBINDING = NO; - SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "SheepShaver Launcher" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C01FCF4B08A954540054247B /* Debug */, - C01FCF4C08A954540054247B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - C01FCF4E08A954540054247B /* Build configuration list for PBXProject "SheepShaverLauncher" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C01FCF4F08A954540054247B /* Debug */, - C01FCF5008A954540054247B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; -} diff --git a/SheepShaver/src/MacOSX/Launcher/VMListController.h b/SheepShaver/src/MacOSX/Launcher/VMListController.h deleted file mode 100644 index 70b453d9..00000000 --- a/SheepShaver/src/MacOSX/Launcher/VMListController.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * VMListController.h - SheepShaver VM manager in Cocoa on Mac OS X - * - * Copyright (C) 2009 Alexei Svitkine - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#import - -@interface VMListController : NSWindowController -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 - -#endif -{ - IBOutlet NSTableView *vmList; - IBOutlet NSButton *newButton; - IBOutlet NSButton *importButton; - IBOutlet NSButton *settingsButton; - IBOutlet NSButton *launchButton; - NSMutableDictionary *tasks; - NSMutableArray *vmArray; - NSString *vmBeingDragged; -} - -+ (id) sharedInstance; - -- (id) init; -- (void) awakeFromNib; - -- (IBAction) newVirtualMachine: (id) sender; -- (IBAction) importVirtualMachine: (id) sender; -- (IBAction) editVirtualMachineSettings: (id) sender; -- (IBAction) launchVirtualMachine: (id) sender; -- (IBAction) deleteVirtualMachine: (id) sender; - -@end diff --git a/SheepShaver/src/MacOSX/Launcher/VMListController.mm b/SheepShaver/src/MacOSX/Launcher/VMListController.mm deleted file mode 100644 index d5b48ab3..00000000 --- a/SheepShaver/src/MacOSX/Launcher/VMListController.mm +++ /dev/null @@ -1,390 +0,0 @@ -/* - * VMListController.mm - SheepShaver VM manager in Cocoa on Mac OS X - * - * Copyright (C) 2009 Alexei Svitkine - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#import "VMListController.h" -#import "VMSettingsController.h" - -// NSInteger was added in 10.5 SDK. -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050 - #if __LP64__ || NS_BUILD_32_LIKE_64 - typedef long NSInteger; - #else - typedef int NSInteger; - #endif -#endif - -/* - -TODO: - -Drag VM from Finder to import -When choosing things like rom file and keycode files - have a checkbox to copy -selected file into the bundle. -Copy path! - - */ - -@interface NSObject (TableViewContextMenu) -- (NSMenu *) tableView: (NSTableView *) tableView menuForEvent: (NSEvent *) event; -@end - -@implementation NSTableView (ContextMenu) -- (NSMenu *) menuForEvent: (NSEvent *) event -{ - if ([[self delegate] respondsToSelector:@selector(tableView:menuForEvent:)]) - return [[self delegate] tableView:self menuForEvent:event]; - return nil; -} -@end - -#define VM_DRAG_TYPE @"sheepvm" - -@implementation VMListController - -+ (id) sharedInstance -{ - static VMListController *_sharedInstance = nil; - if (!_sharedInstance) { - _sharedInstance = [[VMListController allocWithZone:[self zone]] init]; - } - return _sharedInstance; -} - -- (id) init -{ - self = [super initWithWindowNibName:@"VMListWindow"]; - - NSArray *vms = [[NSUserDefaults standardUserDefaults] stringArrayForKey:@"vm_list"]; - vmArray = [[NSMutableArray alloc] initWithCapacity:[vms count]]; - [vmArray addObjectsFromArray:vms]; - - tasks = [[NSMutableDictionary alloc] init]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(onTaskTerminated:) - name:NSTaskDidTerminateNotification - object:nil]; - - return self; -} - -- (void) awakeFromNib -{ - [[[vmList tableColumns] objectAtIndex:0] setEditable:YES]; - [vmList setDataSource: self]; - [vmList setDelegate: self]; - [vmList reloadData]; - [vmList registerForDraggedTypes:[NSArray arrayWithObjects:VM_DRAG_TYPE, nil]]; -} - -- (void) _showNotFoundAlert -{ - NSAlert *alert = [[[NSAlert alloc] init] autorelease]; - [alert setMessageText:@"The virtual machine cannot be found."]; - [alert setAlertStyle:NSWarningAlertStyle]; - [alert beginSheetModalForWindow:[self window] - modalDelegate:self - didEndSelector:nil - contextInfo:nil]; -} - -- (void) reloadDataAndSave -{ - [vmList reloadData]; - [[NSUserDefaults standardUserDefaults] setObject:vmArray forKey:@"vm_list"]; -} - -- (void) keyDown: (NSEvent *) event -{ - if ([event type] == NSKeyDown && [[event characters] length] > 0) { - unichar key = [[event characters] characterAtIndex:0]; - if (key == NSDeleteFunctionKey || key == NSDeleteCharacter) { - [self deleteVirtualMachine:self]; - } - } -} - -- (NSInteger) numberOfRowsInTableView: (NSTableView *) table -{ - return [vmArray count]; -} - -- (id) tableView: (NSTableView *) table objectValueForTableColumn: (NSTableColumn *) c row: (NSInteger) r -{ - return [[[vmArray objectAtIndex: r] lastPathComponent] stringByDeletingPathExtension]; -} - -- (void) tableView: (NSTableView *) table setObjectValue: (id) value forTableColumn: (NSTableColumn *) c row: (NSInteger) r -{ - NSString *currentPath = [vmArray objectAtIndex: r]; - NSString *newPath = [[NSString stringWithFormat:@"%@/%@.sheepvm", - [currentPath stringByDeletingLastPathComponent], value] retain]; - if (![currentPath isEqual:newPath]) { - if ([[NSFileManager defaultManager] fileExistsAtPath:currentPath]) { - NSFileManager *manager = [NSFileManager defaultManager]; - if ([manager movePath: currentPath toPath: newPath handler:nil]) { - [vmArray replaceObjectAtIndex: r withObject: newPath]; - [currentPath release]; - } - } else { - [self _showNotFoundAlert]; - } - } -} - -- (void) tableViewSelectionDidChange: (NSNotification *) notification -{ - if ([vmList selectedRow] >= 0) { - [settingsButton setEnabled:YES]; - [launchButton setEnabled:YES]; - } else { - [settingsButton setEnabled:NO]; - [launchButton setEnabled:NO]; - } -} - -- (BOOL) tableView: (NSTableView *) table writeRowsWithIndexes: (NSIndexSet *) rows toPasteboard: (NSPasteboard *) pboard -{ - vmBeingDragged = [vmArray objectAtIndex:[rows firstIndex]]; - [pboard declareTypes:[NSArray arrayWithObject:VM_DRAG_TYPE] owner:self]; - [pboard setString:VM_DRAG_TYPE forType:VM_DRAG_TYPE]; - return YES; -} - -- (NSDragOperation) tableView: (NSTableView *) table validateDrop: (id ) info proposedRow: (NSInteger) row proposedDropOperation: (NSTableViewDropOperation) op -{ - if (op == NSTableViewDropAbove && row != -1) { - return NSDragOperationPrivate; - } else { - return NSDragOperationNone; - } -} - -- (BOOL) tableView: (NSTableView *) table acceptDrop: (id ) info row: (NSInteger) row dropOperation: (NSTableViewDropOperation) op -{ - if ([[[info draggingPasteboard] availableTypeFromArray:[NSArray arrayWithObject:VM_DRAG_TYPE]] isEqualToString:VM_DRAG_TYPE]) { - [vmList deselectAll:nil]; - int index = [vmArray indexOfObject:vmBeingDragged]; - if (index != row) { - [vmArray insertObject:vmBeingDragged atIndex:row]; - if (row <= index) { - index += 1; - } else { - row -= 1; - } - [vmArray removeObjectAtIndex: index]; - } - [self reloadDataAndSave]; - [vmList selectRow:row byExtendingSelection:NO]; - return YES; - } - - return NO; -} - -- (NSMenu *) tableView: (NSTableView *) table menuForEvent: (NSEvent *) event -{ - NSMenu *menu = nil; - int row = [table rowAtPoint:[table convertPoint:[event locationInWindow] fromView:nil]]; - if (row >= 0) { - [table selectRow:row byExtendingSelection:NO]; - menu = [[[NSMenu alloc] initWithTitle: @"Contextual Menu"] autorelease]; - [menu addItemWithTitle: @"Launch Virtual Machine" - action: @selector(launchVirtualMachine:) keyEquivalent: @""]; - [menu addItemWithTitle: @"Edit VM Settings..." - action: @selector(editVirtualMachineSettings:) keyEquivalent: @""]; - [menu addItemWithTitle: @"Reveal VM in Finder" - action: @selector(revealVirtualMachineInFinder:) keyEquivalent: @""]; - [menu addItemWithTitle: @"Remove VM from List" - action: @selector(deleteVirtualMachine:) keyEquivalent: @""]; - } - return menu; -} - -- (NSString *) tableView: (NSTableView *) table toolTipForCell: (NSCell *) cell rect: (NSRectPointer) rect - tableColumn: (NSTableColumn *) c row: (NSInteger) r mouseLocation: (NSPoint) loc -{ - return [vmArray objectAtIndex: r]; -} - -- (IBAction) newVirtualMachine: (id) sender -{ - [vmList abortEditing]; - NSSavePanel *save = [NSSavePanel savePanel]; - [save setMessage: @"New SheepShaver Virtual Machine:"]; - [save setRequiredFileType: @"sheepvm"]; - [save setCanSelectHiddenExtension: YES]; - [save setExtensionHidden: NO]; - [save beginSheetForDirectory: nil - file: @"New.sheepvm" - modalForWindow: [self window] - modalDelegate: self - didEndSelector: @selector(_newVirtualMachineDone: returnCode: contextInfo:) - contextInfo: nil]; -} - -- (IBAction) _newVirtualMachineDone: (NSSavePanel *) save returnCode: (int) returnCode contextInfo: (void *) contextInfo -{ - if (returnCode == NSOKButton) { - NSFileManager *manager = [NSFileManager defaultManager]; - [manager createDirectoryAtPath:[save filename] attributes:nil]; - [manager createFileAtPath:[[save filename] stringByAppendingPathComponent:@"prefs"] contents:nil attributes:nil]; - [vmArray addObject:[save filename]]; - [vmList reloadData]; - [vmList selectRow:([vmArray count] - 1) byExtendingSelection:NO]; - [[VMSettingsController sharedInstance] editSettingsForNewVM:[save filename] sender:self]; - if ([[VMSettingsController sharedInstance] cancelWasClicked]) { - [manager removeFileAtPath:[save filename] handler:nil]; - [vmArray removeObjectAtIndex:([vmArray count] - 1)]; - } - [self reloadDataAndSave]; - } -} - -- (IBAction) importVirtualMachine: (id) sender -{ - [vmList abortEditing]; - NSOpenPanel *open = [NSOpenPanel openPanel]; - [open setMessage:@"Import SheepShaver Virtual Machine:"]; - [open setResolvesAliases:YES]; - // Curiously, bundles are treated as "files" not "directories" by NSOpenPanel. - [open setCanChooseDirectories:NO]; - [open setCanChooseFiles:YES]; - [open setAllowsMultipleSelection:NO]; - [open beginSheetForDirectory: nil - file: nil - types: [NSArray arrayWithObject:@"sheepvm"] - modalForWindow: [self window] - modalDelegate: self - didEndSelector: @selector(_importVirtualMachineDone: returnCode: contextInfo:) - contextInfo: nil]; -} - -- (void) _importVirtualMachineDone: (NSOpenPanel *) open returnCode: (int) returnCode contextInfo: (void *) contextInfo -{ - if (returnCode == NSOKButton) { - [vmArray addObject:[open filename]]; - [self reloadDataAndSave]; - } -} - -- (IBAction) editVirtualMachineSettings: (id) sender -{ - [vmList abortEditing]; - int selectedRow = [vmList selectedRow]; - if (selectedRow >= 0) { - NSString *path = [vmArray objectAtIndex:selectedRow]; - if ([tasks objectForKey:path]) { - NSAlert *alert = [[[NSAlert alloc] init] autorelease]; - [alert setMessageText:@"Cannot edit virtual machine settings while it's running."]; - [alert setAlertStyle:NSWarningAlertStyle]; - [alert beginSheetModalForWindow:[self window] - modalDelegate:self - didEndSelector:nil - contextInfo:nil]; - } else if ([[NSFileManager defaultManager] fileExistsAtPath:path]) { - [[VMSettingsController sharedInstance] editSettingsFor:path sender:sender]; - } else { - [self _showNotFoundAlert]; - } - } -} - -- (IBAction) launchVirtualMachine: (id) sender -{ - [vmList abortEditing]; - int selectedRow = [vmList selectedRow]; - if (selectedRow >= 0) { - NSString *path = [vmArray objectAtIndex:selectedRow]; - if ([tasks objectForKey:path]) { - NSAlert *alert = [[[NSAlert alloc] init] autorelease]; - [alert setMessageText:@"The selected virtual machine is already running."]; - [alert setAlertStyle:NSWarningAlertStyle]; - [alert beginSheetModalForWindow:[self window] - modalDelegate:self - didEndSelector:nil - contextInfo:nil]; - } else if ([[NSFileManager defaultManager] fileExistsAtPath:path]) { - NSTask *sheep = [[NSTask alloc] init]; - [sheep setLaunchPath:[[NSBundle mainBundle] pathForAuxiliaryExecutable:@"SheepShaver"]]; - [sheep setArguments:[NSArray arrayWithObject:path]]; - [sheep launch]; - [tasks setObject:sheep forKey:path]; - } else { - [self _showNotFoundAlert]; - } - } -} - -- (void) onTaskTerminated: (NSNotification *) notification -{ - NSArray *paths = [tasks allKeys]; - NSEnumerator *enumerator = [paths objectEnumerator]; - NSString *path; - while ((path = [enumerator nextObject])) { - NSTask *task = [tasks objectForKey:path]; - if (![task isRunning]) { - [tasks removeObjectForKey:path]; - [task release]; - } - } -} - -- (IBAction) deleteVirtualMachine: (id) sender -{ - [vmList abortEditing]; - int selectedRow = [vmList selectedRow]; - if (selectedRow >= 0) { - NSAlert *alert = [[[NSAlert alloc] init] autorelease]; - [alert setMessageText:@"Do you wish to remove the selected virtual machine from the list?"]; - [alert addButtonWithTitle:@"Remove"]; - [alert addButtonWithTitle:@"Cancel"]; - [alert setAlertStyle:NSWarningAlertStyle]; - [alert beginSheetModalForWindow:[self window] - modalDelegate:self - didEndSelector:@selector(_deleteVirtualMachineDone: returnCode: contextInfo:) - contextInfo:nil]; - } -} - -- (void) _deleteVirtualMachineDone: (NSAlert *) alert returnCode: (int) returnCode contextInfo: (void *) contextInfo -{ - if (returnCode == NSAlertFirstButtonReturn) { - [vmArray removeObjectAtIndex:[vmList selectedRow]]; - [vmList deselectAll:self]; - [self reloadDataAndSave]; - } -} - -- (IBAction) revealVirtualMachineInFinder: (id) sender -{ - [vmList abortEditing]; - int selectedRow = [vmList selectedRow]; - if (selectedRow >= 0) { - NSString *path = [vmArray objectAtIndex:selectedRow]; - if ([[NSFileManager defaultManager] fileExistsAtPath:path]) { - [[NSWorkspace sharedWorkspace] selectFile: path inFileViewerRootedAtPath: @""]; - } else { - [self _showNotFoundAlert]; - } - } -} - -@end diff --git a/SheepShaver/src/MacOSX/Launcher/VMSettingsController.h b/SheepShaver/src/MacOSX/Launcher/VMSettingsController.h deleted file mode 100755 index d8b4ed5a..00000000 --- a/SheepShaver/src/MacOSX/Launcher/VMSettingsController.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * VMSettingsController.h - Preferences editing in Cocoa on Mac OS X - * - * Copyright (C) 2006-2009 Alexei Svitkine - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#import - -@interface VMSettingsController : NSWindowController -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 - -#endif -{ - BOOL cancelWasClicked; - - IBOutlet NSView *diskSaveSize; - IBOutlet NSTextField *diskSaveSizeField; - NSMutableArray *diskArray; - IBOutlet NSView *isCDROM; - IBOutlet NSButton *isCDROMcheckbox; - // Setup - IBOutlet NSTableView *disks; - IBOutlet NSComboBox *bootFrom; - IBOutlet NSButton *disableCdrom; - IBOutlet NSTextField *ramSize; - IBOutlet NSStepper *ramSizeStepper; - IBOutlet NSTextField *romFile; - IBOutlet NSTextField *unixRoot; - // Audio/Video - IBOutlet NSPopUpButton *videoType; - IBOutlet NSPopUpButton *refreshRate; - IBOutlet NSComboBox *width; - IBOutlet NSComboBox *height; - IBOutlet NSButton *qdAccel; - IBOutlet NSButton *disableSound; - IBOutlet NSTextField *outDevice; - IBOutlet NSTextField *mixDevice; - // Keyboard/Mouse - IBOutlet NSButton *useRawKeyCodes; - IBOutlet NSTextField *rawKeyCodes; - IBOutlet NSButton *browseRawKeyCodesButton; - IBOutlet NSPopUpButton *mouseWheel; - IBOutlet NSTextField *scrollLines; - IBOutlet NSStepper *scrollLinesStepper; - // CPU/Misc - IBOutlet NSButton *ignoreIllegalMemoryAccesses; - IBOutlet NSButton *ignoreIllegalInstructions; - IBOutlet NSButton *dontUseCPUWhenIdle; - IBOutlet NSButton *enableJIT; - IBOutlet NSButton *enable68kDREmulator; - IBOutlet NSTextField *modemPort; - IBOutlet NSTextField *printerPort; - IBOutlet NSTextField *ethernetInterface; -} - -+ (id) sharedInstance; -- (id) init; -- (void) setupGUI; -- (void) editSettingsFor: (NSString *) vmdir sender: (id) sender; -- (void) editSettingsForNewVM: (NSString *) vmdir sender: (id) sender; -- (IBAction) addDisk: (id) sender; -- (IBAction) removeDisk: (id) sender; -- (IBAction) createDisk: (id) sender; -- (IBAction) useRawKeyCodesClicked: (id) sender; -- (IBAction) browseForROMFileClicked: (id) sender; -- (IBAction) browseForUnixRootClicked: (id) sender; -- (IBAction) browseForKeyCodesFileClicked: (id) sender; -- (void) cancelEdit: (id) sender; -- (void) saveChanges: (id) sender; -- (BOOL) cancelWasClicked; -- (void) dealloc; - -@end diff --git a/SheepShaver/src/MacOSX/Launcher/VMSettingsController.mm b/SheepShaver/src/MacOSX/Launcher/VMSettingsController.mm deleted file mode 100755 index 9a5ddf9c..00000000 --- a/SheepShaver/src/MacOSX/Launcher/VMSettingsController.mm +++ /dev/null @@ -1,480 +0,0 @@ -/* - * VMSettingsController.mm - Preferences editing in Cocoa on Mac OS X - * - * Copyright (C) 2006-2010 Alexei Svitkine - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#import "sysdeps.h" -#import "prefs.h" - -// The _UINT64 define is needed to guard against a typedef mismatch with Snow Leopard headers. -#define _UINT64 - -#import "VMSettingsController.h" - -#import "DiskType.h" - -#include - -// NSInteger was added in 10.5 SDK. -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050 - #if __LP64__ || NS_BUILD_32_LIKE_64 - typedef long NSInteger; - #else - typedef int NSInteger; - #endif -#endif - -const int CDROMRefNum = -62; // RefNum of driver - -#ifdef STANDALONE_PREFS -void prefs_init() -{ -} - -void prefs_exit() -{ -} -#endif - -@implementation VMSettingsController - -+ (id) sharedInstance -{ - static VMSettingsController *_sharedInstance = nil; - if (!_sharedInstance) { - _sharedInstance = [[VMSettingsController allocWithZone:[self zone]] init]; - } - return _sharedInstance; -} - -- (id) init -{ - self = [super initWithWindowNibName:@"VMSettingsWindow"]; - - cancelWasClicked = NO; - - return self; -} - -- (NSInteger) numberOfRowsInTableView: (NSTableView *) table -{ - return [diskArray count]; -} - -- (id) tableView: (NSTableView *) table objectValueForTableColumn: (NSTableColumn *) col row: (NSInteger) row -{ - DiskType *d = (DiskType*)[diskArray objectAtIndex:row]; - - if ([[col identifier] isEqualTo:@"isCDROMcol"]) { - return [NSString stringWithFormat:@"%d", [d isCDROM]]; - } - - return [d path]; -} - -- (void) tableView: (NSTableView *) table setObjectValue: (id) object forTableColumn: (NSTableColumn *) tableColumn row: (NSInteger) row -{ - if ([[tableColumn identifier] isEqual:@"isCDROMcol"]) { - DiskType *d = (DiskType*)[diskArray objectAtIndex:row]; - [d setIsCDROM:![d isCDROM]]; - } -} - -static NSString *getStringFromPrefs(const char *key) -{ - const char *value = PrefsFindString(key); - if (value == NULL) - return @""; - return [NSString stringWithUTF8String: value]; -} - -- (void) setupGUI -{ - diskArray = [[NSMutableArray alloc] init]; - - const char *dsk; - int index = 0; - while ((dsk = PrefsFindString("disk", index++)) != NULL) { - DiskType *disk = [[DiskType alloc] init]; - [disk setPath:[NSString stringWithUTF8String: dsk ]]; - [disk setIsCDROM:NO]; - - [diskArray addObject:disk]; - } - - /* Fetch all CDROMs */ - index = 0; - while ((dsk = PrefsFindString("cdrom", index++)) != NULL) { - DiskType *disk = [[DiskType alloc] init]; - [disk setPath:[NSString stringWithUTF8String: dsk ]]; - [disk setIsCDROM:YES]; - - [diskArray addObject:disk]; - } - - [disks setDataSource: self]; - [disks reloadData]; - - int bootdriver = PrefsFindInt32("bootdriver"), active = 0; - switch (bootdriver) { - case 0: active = 0; break; - case CDROMRefNum: active = 1; break; - } - [bootFrom selectItemAtIndex: active ]; - - [romFile setStringValue: getStringFromPrefs("rom") ]; - [unixRoot setStringValue: getStringFromPrefs("extfs") ]; - [disableCdrom setIntValue: PrefsFindBool("nocdrom") ]; - [ramSize setIntValue: PrefsFindInt32("ramsize") / (1024*1024) ]; - [ramSizeStepper setIntValue: PrefsFindInt32("ramsize") / (1024*1024) ]; - - int display_type = 0; - int dis_width = 640; - int dis_height = 480; - - const char *str = PrefsFindString("screen"); - if (str != NULL) { - if (sscanf(str, "win/%d/%d", &dis_width, &dis_height) == 2) - display_type = 0; - else if (sscanf(str, "dga/%d/%d", &dis_width, &dis_height) == 2) - display_type = 1; - } - - [videoType selectItemAtIndex: display_type ]; - [width setIntValue: dis_width ]; - [height setIntValue: dis_height ]; - - int frameskip = PrefsFindInt32("frameskip"); - int item = -1; - switch (frameskip) { - case 12: item = 0; break; - case 8: item = 1; break; - case 6: item = 2; break; - case 4: item = 3; break; - case 2: item = 4; break; - case 1: item = 5; break; - case 0: item = 6; break; - } - if (item >= 0) - [refreshRate selectItemAtIndex: item ]; - - [qdAccel setIntValue: PrefsFindBool("gfxaccel") ]; - - [disableSound setIntValue: PrefsFindBool("nosound") ]; - [outDevice setStringValue: getStringFromPrefs("dsp") ]; - [mixDevice setStringValue: getStringFromPrefs("mixer") ]; - - [useRawKeyCodes setIntValue: PrefsFindBool("keycodes") ]; - [rawKeyCodes setStringValue: getStringFromPrefs("keycodefile") ]; - [rawKeyCodes setEnabled:[useRawKeyCodes intValue]]; - [browseRawKeyCodesButton setEnabled:[useRawKeyCodes intValue]]; - - int wheelmode = PrefsFindInt32("mousewheelmode"), wheel = 0; - switch (wheelmode) { - case 0: wheel = 0; break; - case 1: wheel = 1; break; - } - [mouseWheel selectItemAtIndex: wheel ]; - - [scrollLines setIntValue: PrefsFindInt32("mousewheellines") ]; - [scrollLinesStepper setIntValue: PrefsFindInt32("mousewheellines") ]; - - [ignoreIllegalMemoryAccesses setIntValue: PrefsFindBool("ignoresegv") ]; - [ignoreIllegalInstructions setIntValue: PrefsFindBool("ignoreillegal") ]; - [dontUseCPUWhenIdle setIntValue: PrefsFindBool("idlewait") ]; - [enableJIT setIntValue: PrefsFindBool("jit") ]; - [enable68kDREmulator setIntValue: PrefsFindBool("jit68k") ]; - - [modemPort setStringValue: getStringFromPrefs("seriala") ]; - [printerPort setStringValue: getStringFromPrefs("serialb") ]; - [ethernetInterface setStringValue: getStringFromPrefs("ether") ]; -} - -- (void) editSettingsFor: (NSString *) vmdir sender: (id) sender -{ - chdir([vmdir fileSystemRepresentation]); - AddPrefsDefaults(); - AddPlatformPrefsDefaults(); - LoadPrefs([vmdir fileSystemRepresentation]); - NSWindow *window = [self window]; - [self setupGUI]; - [NSApp runModalForWindow:window]; -} - -- (void) editSettingsForNewVM: (NSString *) vmdir sender: (id) sender -{ - chdir([vmdir fileSystemRepresentation]); - AddPrefsDefaults(); - AddPlatformPrefsDefaults(); - LoadPrefs([vmdir fileSystemRepresentation]); - PrefsReplaceString("screen", "win/800/600"); - PrefsReplaceString("extfs", ""); - PrefsReplaceString("ether", "slirp"); - PrefsReplaceInt32("ramsize", 64 << 20); - PrefsReplaceInt32("frameskip", 2); - PrefsReplaceBool("jit", true); - NSWindow *window = [self window]; - [self setupGUI]; - [NSApp runModalForWindow:window]; -} - -static NSString *makeRelativeIfNecessary(NSString *path) -{ - char cwd[1024], filename[1024]; - int cwdlen; - strlcpy(filename, [path fileSystemRepresentation], sizeof(filename)); - getcwd(cwd, sizeof(cwd)); - cwdlen = strlen(cwd); - if (!strncmp(cwd, filename, cwdlen)) { - if (cwdlen >= 0 && cwd[cwdlen-1] != '/') - cwdlen++; - return [NSString stringWithUTF8String: filename + cwdlen]; - } - return path; -} - -- (IBAction) addDisk: (id) sender -{ - NSOpenPanel *open = [NSOpenPanel openPanel]; - [open setCanChooseDirectories:YES]; - [open setAccessoryView:isCDROM]; - [open setAllowsMultipleSelection:NO]; - [open setTreatsFilePackagesAsDirectories:YES]; - [open beginSheetForDirectory: [[NSFileManager defaultManager] currentDirectoryPath] - file: @"Unknown" - modalForWindow: [self window] - modalDelegate: self - didEndSelector: @selector(_addDiskEnd: returnCode: contextInfo:) - contextInfo: nil]; -} - -- (void) _addDiskEnd: (NSOpenPanel *) open returnCode: (int) theReturnCode contextInfo: (void *) theContextInfo -{ - if (theReturnCode == NSOKButton) { - DiskType *d = [[DiskType alloc] init]; - [d setPath:makeRelativeIfNecessary([open filename])]; - - [d setIsCDROM:([isCDROMcheckbox state] == NSOnState)]; - - [diskArray addObject: d]; - [disks reloadData]; - } -} - -- (IBAction) removeDisk: (id) sender -{ - int selectedRow = [disks selectedRow]; - if (selectedRow >= 0) { - [diskArray removeObjectAtIndex: selectedRow]; - [disks reloadData]; - } -} - -- (IBAction) createDisk: (id) sender -{ - NSSavePanel *save = [NSSavePanel savePanel]; - [save setAccessoryView: diskSaveSize]; - [save setTreatsFilePackagesAsDirectories:YES]; - [save beginSheetForDirectory: [[NSFileManager defaultManager] currentDirectoryPath] - file: @"New.dsk" - modalForWindow: [self window] - modalDelegate: self - didEndSelector: @selector(_createDiskEnd: returnCode: contextInfo:) - contextInfo: nil]; -} - -- (void) _createDiskEnd: (NSSavePanel *) save returnCode: (int) theReturnCode contextInfo: (void *) theContextInfo -{ - if (theReturnCode == NSOKButton) { - int size = [diskSaveSizeField intValue]; - if (size >= 0 && size <= 10000) { - char cmd[1024]; - snprintf(cmd, sizeof(cmd), "dd if=/dev/zero \"of=%s\" bs=1024k count=%d", [[save filename] UTF8String], [diskSaveSizeField intValue]); - int ret = system(cmd); - if (ret == 0) { - DiskType *d = [[DiskType alloc] init]; - [d setPath:makeRelativeIfNecessary([save filename])]; - [d setIsCDROM:NO]; - - [diskArray addObject: d]; - [disks reloadData]; - } - } - } - [(NSData *)theContextInfo release]; -} - -- (IBAction) useRawKeyCodesClicked: (id) sender -{ - [rawKeyCodes setEnabled:[useRawKeyCodes intValue]]; - [browseRawKeyCodesButton setEnabled:[useRawKeyCodes intValue]]; -} - -- (IBAction) browseForROMFileClicked: (id) sender -{ - NSOpenPanel *open = [NSOpenPanel openPanel]; - [open setCanChooseDirectories:NO]; - [open setAllowsMultipleSelection:NO]; - [open setTreatsFilePackagesAsDirectories:YES]; - [open beginSheetForDirectory: @"" - file: [romFile stringValue] - modalForWindow: [self window] - modalDelegate: self - didEndSelector: @selector(_browseForROMFileEnd: returnCode: contextInfo:) - contextInfo: nil]; -} - -- (void) _browseForROMFileEnd: (NSOpenPanel *) open returnCode: (int) theReturnCode contextInfo: (void *) theContextInfo -{ - if (theReturnCode == NSOKButton) { - [romFile setStringValue: makeRelativeIfNecessary([open filename])]; - } -} - -- (IBAction) browseForUnixRootClicked: (id) sender -{ - NSOpenPanel *open = [NSOpenPanel openPanel]; - [open setCanChooseDirectories:YES]; - [open setCanChooseFiles:NO]; - [open setAllowsMultipleSelection:NO]; - [open beginSheetForDirectory: @"" - file: [unixRoot stringValue] - modalForWindow: [self window] - modalDelegate: self - didEndSelector: @selector(_browseForUnixRootEnd: returnCode: contextInfo:) - contextInfo: nil]; -} - -- (void) _browseForUnixRootEnd: (NSOpenPanel *) open returnCode: (int) theReturnCode contextInfo: (void *) theContextInfo -{ - if (theReturnCode == NSOKButton) { - [unixRoot setStringValue: makeRelativeIfNecessary([open filename])]; - } -} - -- (IBAction) browseForKeyCodesFileClicked: (id) sender -{ - NSOpenPanel *open = [NSOpenPanel openPanel]; - [open setCanChooseDirectories:NO]; - [open setAllowsMultipleSelection:NO]; - [open setTreatsFilePackagesAsDirectories:YES]; - [open beginSheetForDirectory: @"" - file: [unixRoot stringValue] - modalForWindow: [self window] - modalDelegate: self - didEndSelector: @selector(_browseForKeyCodesFileEnd: returnCode: contextInfo:) - contextInfo: nil]; -} - -- (void) _browseForKeyCodesFileEnd: (NSOpenPanel *) open returnCode: (int) theReturnCode contextInfo: (void *) theContextInfo -{ - if (theReturnCode == NSOKButton) { - [rawKeyCodes setStringValue: makeRelativeIfNecessary([open filename])]; - } -} - -- (void) cancelEdit: (id) sender -{ -#ifdef STANDALONE_PREFS - PrefsExit(); -#endif - [[self window] close]; - [NSApp stopModal]; - cancelWasClicked = YES; -} - -- (void) saveChanges: (id) sender -{ - // Remove all disks - while (PrefsFindString("disk")) - PrefsRemoveItem("disk"); - // Remove all cdroms - while (PrefsFindString("cdrom")) - PrefsRemoveItem("cdrom"); - - - // Write all disks - for (int i = 0; i < [diskArray count]; i++) { - DiskType *d = [diskArray objectAtIndex:i]; - PrefsAddString([d isCDROM] ? "cdrom" : "disk", [[d path] UTF8String]); - } - - PrefsReplaceInt32("bootdriver", ([bootFrom indexOfSelectedItem] == 1 ? CDROMRefNum : 0)); - PrefsReplaceString("rom", [[romFile stringValue] UTF8String]); - PrefsReplaceString("extfs", [[unixRoot stringValue] UTF8String]); - PrefsReplaceBool("nocdrom", [disableCdrom intValue]); - PrefsReplaceInt32("ramsize", [ramSize intValue] << 20); - - char pref[256]; - snprintf(pref, sizeof(pref), "%s/%d/%d", [videoType indexOfSelectedItem] == 0 ? "win" : "dga", [width intValue], [height intValue]); - PrefsReplaceString("screen", pref); - - int rate = 8; - switch ([refreshRate indexOfSelectedItem]) { - case 0: rate = 12; break; - case 1: rate = 8; break; - case 2: rate = 6; break; - case 3: rate = 4; break; - case 4: rate = 2; break; - case 5: rate = 1; break; - case 6: rate = 0; break; - } - PrefsReplaceInt32("frameskip", rate); - PrefsReplaceBool("gfxaccel", [qdAccel intValue]); - - PrefsReplaceBool("nosound", [disableSound intValue]); - PrefsReplaceString("dsp", [[outDevice stringValue] UTF8String]); - PrefsReplaceString("mixer", [[mixDevice stringValue] UTF8String]); - - PrefsReplaceBool("keycodes", [useRawKeyCodes intValue]); - PrefsReplaceString("keycodefile", [[rawKeyCodes stringValue] UTF8String]); - - PrefsReplaceInt32("mousewheelmode", [mouseWheel indexOfSelectedItem]); - PrefsReplaceInt32("mousewheellines", [scrollLines intValue]); - - PrefsReplaceBool("ignoresegv", [ignoreIllegalMemoryAccesses intValue]); - PrefsReplaceBool("ignoreillegal", [ignoreIllegalInstructions intValue]); - PrefsReplaceBool("idlewait", [dontUseCPUWhenIdle intValue]); - PrefsReplaceBool("jit", [enableJIT intValue]); - PrefsReplaceBool("jit68k", [enable68kDREmulator intValue]); - - PrefsReplaceString("seriala", [[modemPort stringValue] UTF8String]); - PrefsReplaceString("serialb", [[printerPort stringValue] UTF8String]); - PrefsReplaceString("ether", [[ethernetInterface stringValue] UTF8String]); - SavePrefs(); -#ifdef STANDALONE_PREFS - PrefsExit(); -#endif - - [[self window] close]; - [NSApp stopModal]; - cancelWasClicked = NO; -} - -- (BOOL) cancelWasClicked -{ - return cancelWasClicked; -} - -- (void) dealloc -{ - [super dealloc]; -} - -@end - diff --git a/SheepShaver/src/MacOSX/Launcher/main.m b/SheepShaver/src/MacOSX/Launcher/main.m deleted file mode 100644 index 88f92937..00000000 --- a/SheepShaver/src/MacOSX/Launcher/main.m +++ /dev/null @@ -1,26 +0,0 @@ -/* - * main.m - Cocoa SheepShaver launcher for Mac OS X - * - * Copyright (C) 2006-2009 Alexei Svitkine - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#import - -int main(int argc, char *argv[]) -{ - return NSApplicationMain(argc, (const char **) argv); -} diff --git a/SheepShaver/src/MacOSX/MacOSX_sound_if.cpp b/SheepShaver/src/MacOSX/MacOSX_sound_if.cpp deleted file mode 120000 index da209f87..00000000 --- a/SheepShaver/src/MacOSX/MacOSX_sound_if.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/MacOSX/MacOSX_sound_if.cpp \ No newline at end of file diff --git a/SheepShaver/src/MacOSX/MacOSX_sound_if.h b/SheepShaver/src/MacOSX/MacOSX_sound_if.h deleted file mode 120000 index 63bcdb27..00000000 --- a/SheepShaver/src/MacOSX/MacOSX_sound_if.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/MacOSX/MacOSX_sound_if.h \ No newline at end of file diff --git a/SheepShaver/src/MacOSX/PrefsEditor/English.lproj/InfoPlist.strings b/SheepShaver/src/MacOSX/PrefsEditor/English.lproj/InfoPlist.strings deleted file mode 100644 index 4e36ad6e3d71e03ba045089894ea15f9a30b450a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 216 zcmZvWO%A~T5JunHDVi?3P_eKP3$Y;)3q3*6(v-Go5!}cn@zS+SGC$vZ^D^I0Ohmw% znms9J3SML!)b7@nPNk-@2G-oXa?0(8G`+v$s#@xP_O6JSfw3WB$&HKLimm%pZpzN9 qjD>{8i&p-TQ_q;m3IA^1ZpMs^iQT*>Jfsv(iJunUm*z?>WXcagJtnyT diff --git a/SheepShaver/src/MacOSX/PrefsEditor/English.lproj/MainMenu.nib/classes.nib b/SheepShaver/src/MacOSX/PrefsEditor/English.lproj/MainMenu.nib/classes.nib deleted file mode 100644 index ddaaa18e..00000000 --- a/SheepShaver/src/MacOSX/PrefsEditor/English.lproj/MainMenu.nib/classes.nib +++ /dev/null @@ -1,50 +0,0 @@ -{ - IBClasses = ( - {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, - { - ACTIONS = { - addDisk = id; - browseForROMFileClicked = id; - createDisk = id; - removeDisk = id; - useRawKeyCodesClicked = id; - }; - CLASS = PrefsEditor; - LANGUAGE = ObjC; - OUTLETS = { - bootFrom = NSComboBox; - disableCdrom = NSButton; - disableSound = NSButton; - diskSaveSize = NSView; - diskSaveSizeField = NSTextField; - disks = NSTableView; - dontUseCPUWhenIdle = NSButton; - enable68kDREmulator = NSButton; - enableJIT = NSButton; - ethernetInterface = NSTextField; - height = NSComboBox; - ignoreIllegalMemoryAccesses = NSButton; - mixDevice = NSTextField; - modemPort = NSTextField; - mouseWheel = NSPopUpButton; - outDevice = NSTextField; - printerPort = NSTextField; - qdAccel = NSButton; - ramSize = NSTextField; - ramSizeStepper = NSStepper; - rawKeyCodes = NSTextField; - refreshRate = NSPopUpButton; - romFile = NSTextField; - scrollLines = NSTextField; - scrollLinesStepper = NSStepper; - unixRoot = NSTextField; - useRawKeyCodes = NSButton; - videoType = NSPopUpButton; - width = NSComboBox; - window = NSWindow; - }; - SUPERCLASS = NSObject; - } - ); - IBVersion = 1; -} \ No newline at end of file diff --git a/SheepShaver/src/MacOSX/PrefsEditor/English.lproj/MainMenu.nib/info.nib b/SheepShaver/src/MacOSX/PrefsEditor/English.lproj/MainMenu.nib/info.nib deleted file mode 100644 index b92e8621..00000000 --- a/SheepShaver/src/MacOSX/PrefsEditor/English.lproj/MainMenu.nib/info.nib +++ /dev/null @@ -1,23 +0,0 @@ - - - - - IBDocumentLocation - 135 142 356 240 0 0 1680 1028 - IBEditorPositions - - 29 - 132 352 305 44 0 0 1680 1028 - 342 - 715 652 249 104 0 0 1680 1028 - - IBFramework Version - 446.1 - IBOpenObjects - - 29 - - IBSystem Version - 8R2218 - - diff --git a/SheepShaver/src/MacOSX/PrefsEditor/English.lproj/MainMenu.nib/keyedobjects.nib b/SheepShaver/src/MacOSX/PrefsEditor/English.lproj/MainMenu.nib/keyedobjects.nib deleted file mode 100644 index 20efaaf1d540bbe1b9e3a1f47807916e3497353e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 39269 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

l$OnI5A#K6HCS57!s?A^@yRdp0RvvW^7Ju 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 - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIconFile - - CFBundleIdentifier - net.sourceforge.SheepShaverPrefs - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - APPL - CFBundleSignature - ???? - CFBundleVersion - 1.0.1 - NSMainNibFile - MainMenu - NSPrincipalClass - NSApplication - - diff --git a/SheepShaver/src/MacOSX/PrefsEditor/PrefsEditor.h b/SheepShaver/src/MacOSX/PrefsEditor/PrefsEditor.h deleted file mode 100644 index a69834bd..00000000 --- a/SheepShaver/src/MacOSX/PrefsEditor/PrefsEditor.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * PrefsEditor.h - Preferences editing in Cocoa on Mac OS X - * - * Copyright (C) 2006-2007 Alexei Svitkine - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#import - -@interface PrefsEditor : NSObject -{ - IBOutlet NSWindow *window; - IBOutlet NSView *diskSaveSize; - IBOutlet NSTextField *diskSaveSizeField; - NSMutableArray *diskArray; - - // Setup - IBOutlet NSTableView *disks; - IBOutlet NSComboBox *bootFrom; - IBOutlet NSButton *disableCdrom; - IBOutlet NSTextField *ramSize; - IBOutlet NSStepper *ramSizeStepper; - IBOutlet NSTextField *romFile; - IBOutlet NSTextField *unixRoot; - // Audio/Video - IBOutlet NSPopUpButton *videoType; - IBOutlet NSPopUpButton *refreshRate; - IBOutlet NSComboBox *width; - IBOutlet NSComboBox *height; - IBOutlet NSButton *qdAccel; - IBOutlet NSButton *disableSound; - IBOutlet NSTextField *outDevice; - IBOutlet NSTextField *mixDevice; - // Keyboard/Mouse - IBOutlet NSButton *useRawKeyCodes; - IBOutlet NSTextField *rawKeyCodes; - IBOutlet NSPopUpButton *mouseWheel; - IBOutlet NSTextField *scrollLines; - IBOutlet NSStepper *scrollLinesStepper; - // CPU/Misc - IBOutlet NSButton *ignoreIllegalMemoryAccesses; - IBOutlet NSButton *dontUseCPUWhenIdle; - IBOutlet NSButton *enableJIT; - IBOutlet NSButton *enable68kDREmulator; - IBOutlet NSTextField *modemPort; - IBOutlet NSTextField *printerPort; - IBOutlet NSTextField *ethernetInterface; -} -- (id) init; -- (IBAction) addDisk:(id)sender; -- (IBAction) removeDisk:(id)sender; -- (IBAction) createDisk:(id)sender; -- (IBAction) useRawKeyCodesClicked:(id)sender; -- (IBAction) browseForROMFileClicked:(id)sender; -- (void) windowWillClose: (NSNotification *) aNotification; -- (void) dealloc; -@end diff --git a/SheepShaver/src/MacOSX/PrefsEditor/PrefsEditor.mm b/SheepShaver/src/MacOSX/PrefsEditor/PrefsEditor.mm deleted file mode 100644 index 29b48305..00000000 --- a/SheepShaver/src/MacOSX/PrefsEditor/PrefsEditor.mm +++ /dev/null @@ -1,347 +0,0 @@ -/* - * PrefsEditor.m - Preferences editing in Cocoa on Mac OS X - * - * Copyright (C) 2006-2007 Alexei Svitkine - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#import "PrefsEditor.h" - -#import "sysdeps.h" -#import "prefs.h" - -const int CDROMRefNum = -62; // RefNum of driver - -#ifdef STANDALONE_PREFS -void prefs_init() -{ -} - -void prefs_exit() -{ -} -#endif - -@implementation PrefsEditor - -- (id) init -{ - self = [super init]; - -#ifdef STANDALONE_PREFS - AddPrefsDefaults(); - AddPlatformPrefsDefaults(); - - // Load preferences from settings file - LoadPrefs(NULL); - chdir([[[NSBundle mainBundle] bundlePath] UTF8String]); - chdir(".."); -#endif - - return self; -} - -- (int)numberOfRowsInTableView:(NSTableView *)aTable -{ - return [diskArray count]; -} - -- (id)tableView:(NSTableView *)aTable objectValueForTableColumn:(NSTableColumn *)aCol row:(int)aRow -{ - return [diskArray objectAtIndex: aRow]; -} - -NSString *getStringFromPrefs(const char *key) -{ - const char *value = PrefsFindString(key); - if (value == NULL) - return @""; - return [NSString stringWithCString: value]; -} - -- (void) awakeFromNib -{ - diskArray = [[NSMutableArray alloc] init]; - - const char *dsk; - int index = 0; - while ((dsk = PrefsFindString("disk", index++)) != NULL) - [diskArray addObject: [NSString stringWithCString: dsk ]]; - - [disks setDataSource: self]; - [disks reloadData]; - - int bootdriver = PrefsFindInt32("bootdriver"), active = 0; - switch (bootdriver) { - case 0: active = 0; break; - case CDROMRefNum: active = 1; break; - } - [bootFrom selectItemAtIndex: active ]; - - [romFile setStringValue: getStringFromPrefs("rom") ]; - [unixRoot setStringValue: getStringFromPrefs("extfs") ]; - [disableCdrom setIntValue: PrefsFindBool("nocdrom") ]; - [ramSize setIntValue: PrefsFindInt32("ramsize") / (1024*1024) ]; - [ramSizeStepper setIntValue: PrefsFindInt32("ramsize") / (1024*1024) ]; - - int display_type = 0; - int dis_width = 640; - int dis_height = 480; - - const char *str = PrefsFindString("screen"); - if (str != NULL) { - if (sscanf(str, "win/%d/%d", &dis_width, &dis_height) == 2) - display_type = 0; - else if (sscanf(str, "dga/%d/%d", &dis_width, &dis_height) == 2) - display_type = 1; - } - - [videoType selectItemAtIndex: display_type ]; - [width setIntValue: dis_width ]; - [height setIntValue: dis_height ]; - - int frameskip = PrefsFindInt32("frameskip"); - int item = -1; - switch (frameskip) { - case 12: item = 0; break; - case 8: item = 1; break; - case 6: item = 2; break; - case 4: item = 3; break; - case 2: item = 4; break; - case 1: item = 5; break; - case 0: item = 6; break; - } - if (item >= 0) - [refreshRate selectItemAtIndex: item ]; - - [qdAccel setIntValue: PrefsFindBool("gfxaccel") ]; - - [disableSound setIntValue: PrefsFindBool("nosound") ]; - [outDevice setStringValue: getStringFromPrefs("dsp") ]; - [mixDevice setStringValue: getStringFromPrefs("mixer") ]; - - [useRawKeyCodes setIntValue: PrefsFindBool("keycodes") ]; - [rawKeyCodes setStringValue: getStringFromPrefs("keycodefile") ]; - [rawKeyCodes setEnabled:[useRawKeyCodes intValue]]; - - int wheelmode = PrefsFindInt32("mousewheelmode"), wheel = 0; - switch (wheelmode) { - case 0: wheel = 0; break; - case 1: wheel = 1; break; - } - [mouseWheel selectItemAtIndex: wheel ]; - - [scrollLines setIntValue: PrefsFindInt32("mousewheellines") ]; - [scrollLinesStepper setIntValue: PrefsFindInt32("mousewheellines") ]; - - [ignoreIllegalMemoryAccesses setIntValue: PrefsFindBool("ignoresegv") ]; - [dontUseCPUWhenIdle setIntValue: PrefsFindBool("idlewait") ]; - [enableJIT setIntValue: PrefsFindBool("jit") ]; - [enable68kDREmulator setIntValue: PrefsFindBool("jit68k") ]; - - [modemPort setStringValue: getStringFromPrefs("seriala") ]; - [printerPort setStringValue: getStringFromPrefs("serialb") ]; - [ethernetInterface setStringValue: getStringFromPrefs("ether") ]; -} - -- (IBAction) addDisk:(id)sender -{ - NSOpenPanel *open = [NSOpenPanel openPanel]; - [open setCanChooseDirectories:NO]; - [open setAllowsMultipleSelection:NO]; - [open beginSheetForDirectory: @"" - file: @"Unknown" - modalForWindow: window - modalDelegate: self - didEndSelector: @selector(_addDiskEnd: returnCode: contextInfo:) - contextInfo: nil]; -} - -- (void) _addDiskEnd: (NSOpenPanel *) open returnCode: (int) theReturnCode contextInfo: (void *) theContextInfo -{ - if (theReturnCode == NSOKButton) { - char cwd[1024], filename[1024]; - int cwdlen; - strlcpy(filename, [[open filename] UTF8String], sizeof(filename)); - getcwd(cwd, sizeof(cwd)); - cwdlen = strlen(cwd); - if (!strncmp(cwd, filename, cwdlen)) { - if (cwdlen >= 0 && cwd[cwdlen-1] != '/') - cwdlen++; - [diskArray addObject: [NSString stringWithCString: filename + cwdlen ]]; - } else { - [diskArray addObject: [open filename]]; - } - [disks reloadData]; - } - [(NSData *)theContextInfo release]; -} - -- (IBAction) removeDisk:(id)sender -{ - int selectedRow = [disks selectedRow]; - if (selectedRow >= 0) { - [diskArray removeObjectAtIndex: selectedRow]; - [disks reloadData]; - } -} - -- (IBAction) createDisk:(id)sender -{ - NSSavePanel *save = [NSSavePanel savePanel]; - [save setAccessoryView: diskSaveSize]; - [save beginSheetForDirectory: @"" - file: @"New.dsk" - modalForWindow: window - modalDelegate: self - didEndSelector: @selector(_createDiskEnd: returnCode: contextInfo:) - contextInfo: nil]; -} - -- (void) _createDiskEnd: (NSSavePanel *) save returnCode: (int) theReturnCode contextInfo: (void *) theContextInfo -{ - if (theReturnCode == NSOKButton) { - int size = [diskSaveSizeField intValue]; - if (size >= 0 && size <= 10000) { - char cmd[1024]; - snprintf(cmd, sizeof(cmd), "dd if=/dev/zero \"of=%s\" bs=1024k count=%d", [[save filename] UTF8String], [diskSaveSizeField intValue]); - int ret = system(cmd); - if (ret == 0) { - char cwd[1024], filename[1024]; - int cwdlen; - strlcpy(filename, [[save filename] UTF8String], sizeof(filename)); - getcwd(cwd, sizeof(cwd)); - cwdlen = strlen(cwd); - if (!strncmp(cwd, filename, cwdlen)) { - if (cwdlen >= 0 && cwd[cwdlen-1] != '/') - cwdlen++; - [diskArray addObject: [NSString stringWithCString: filename + cwdlen ]]; - } else { - [diskArray addObject: [save filename]]; - } - [disks reloadData]; - } - } - } - [(NSData *)theContextInfo release]; -} - -- (IBAction) useRawKeyCodesClicked:(id)sender -{ - [rawKeyCodes setEnabled:[useRawKeyCodes intValue]]; -} - -- (IBAction) browseForROMFileClicked:(id)sender -{ - NSOpenPanel *open = [NSOpenPanel openPanel]; - NSString *dir = @""; - NSString *file = [romFile stringValue]; - [open setCanChooseDirectories:NO]; - [open setAllowsMultipleSelection:NO]; - [open beginSheetForDirectory: dir - file: file - modalForWindow: window - modalDelegate: self - didEndSelector: @selector(_browseForROMFileEnd: returnCode: contextInfo:) - contextInfo: nil]; -} - -- (void) _browseForROMFileEnd: (NSOpenPanel *) open returnCode: (int) theReturnCode contextInfo: (void *) theContextInfo -{ - if (theReturnCode == NSOKButton) { - char cwd[1024], filename[1024]; - int cwdlen; - strlcpy(filename, [[open filename] UTF8String], sizeof(filename)); - getcwd(cwd, sizeof(cwd)); - cwdlen = strlen(cwd); - if (!strncmp(cwd, filename, cwdlen)) { - if (cwdlen >= 0 && cwd[cwdlen-1] != '/') - cwdlen++; - [romFile setStringValue: [NSString stringWithCString: filename + cwdlen ]]; - } else { - [romFile setStringValue: [open filename]]; - } - } - [(NSData *)theContextInfo release]; -} - -- (void) windowWillClose: (NSNotification *) aNotification; -{ - while (PrefsFindString("disk")) - PrefsRemoveItem("disk"); - - for (int i = 0; i < [diskArray count]; i++) { - PrefsAddString("disk", [[diskArray objectAtIndex:i] UTF8String]); - } - PrefsReplaceInt32("bootdriver", ([bootFrom indexOfSelectedItem] == 1 ? CDROMRefNum : 0)); - PrefsReplaceString("rom", [[romFile stringValue] UTF8String]); - PrefsReplaceString("extfs", [[unixRoot stringValue] UTF8String]); - PrefsReplaceBool("nocdrom", [disableCdrom intValue]); - PrefsReplaceInt32("ramsize", [ramSize intValue] << 20); - - char pref[256]; - snprintf(pref, sizeof(pref), "%s/%d/%d", [videoType indexOfSelectedItem] == 0 ? "win" : "dga", [width intValue], [height intValue]); - PrefsReplaceString("screen", pref); - - int rate = 8; - switch ([refreshRate indexOfSelectedItem]) { - case 0: rate = 12; break; - case 1: rate = 8; break; - case 2: rate = 6; break; - case 3: rate = 4; break; - case 4: rate = 2; break; - case 5: rate = 1; break; - case 6: rate = 0; break; - } - PrefsReplaceInt32("frameskip", rate); - PrefsReplaceBool("gfxaccel", [qdAccel intValue]); - - PrefsReplaceBool("nosound", [disableSound intValue]); - PrefsReplaceString("dsp", [[outDevice stringValue] UTF8String]); - PrefsReplaceString("mixer", [[mixDevice stringValue] UTF8String]); - - PrefsReplaceBool("keycodes", [useRawKeyCodes intValue]); - PrefsReplaceString("keycodefile", [[rawKeyCodes stringValue] UTF8String]); - - PrefsReplaceInt32("mousewheelmode", [mouseWheel indexOfSelectedItem]); - PrefsReplaceInt32("mousewheellines", [scrollLines intValue]); - - PrefsReplaceBool("ignoresegv", [ignoreIllegalMemoryAccesses intValue]); - PrefsReplaceBool("idlewait", [dontUseCPUWhenIdle intValue]); - PrefsReplaceBool("jit", [enableJIT intValue]); - PrefsReplaceBool("jit68k", [enable68kDREmulator intValue]); - - PrefsReplaceString("seriala", [[modemPort stringValue] UTF8String]); - PrefsReplaceString("serialb", [[printerPort stringValue] UTF8String]); - PrefsReplaceString("ether", [[ethernetInterface stringValue] UTF8String]); - - SavePrefs(); - -#ifdef STANDALONE_PREFS - PrefsExit(); - exit(0); -#else - [NSApp stopModal]; -#endif -} - -- (void) dealloc -{ - [super dealloc]; -} - -@end - diff --git a/SheepShaver/src/MacOSX/PrefsEditor/SheepShaverPrefs.xcodeproj/project.pbxproj b/SheepShaver/src/MacOSX/PrefsEditor/SheepShaverPrefs.xcodeproj/project.pbxproj deleted file mode 100644 index 92ed7a0e..00000000 --- a/SheepShaver/src/MacOSX/PrefsEditor/SheepShaverPrefs.xcodeproj/project.pbxproj +++ /dev/null @@ -1,309 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 42; - objects = { - -/* Begin PBXBuildFile section */ - 084186B10B3A0515004B1F63 /* PrefsEditor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 084186B00B3A0515004B1F63 /* PrefsEditor.mm */; }; - 08DC90BD0B67074C00799A45 /* prefs_items.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08DC90BC0B67074C00799A45 /* prefs_items.cpp */; }; - 08DC90BF0B67075D00799A45 /* prefs_unix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08DC90BE0B67075D00799A45 /* prefs_unix.cpp */; }; - 08DC90C10B67077300799A45 /* prefs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08DC90C00B67077300799A45 /* prefs.cpp */; }; - 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; }; - 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; - 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; - 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 084186AF0B3A0515004B1F63 /* PrefsEditor.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PrefsEditor.h; sourceTree = ""; }; - 084186B00B3A0515004B1F63 /* PrefsEditor.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = PrefsEditor.mm; sourceTree = ""; }; - 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; - 08DC90BC0B67074C00799A45 /* prefs_items.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = prefs_items.cpp; path = ../../prefs_items.cpp; sourceTree = SOURCE_ROOT; }; - 08DC90BE0B67075D00799A45 /* prefs_unix.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = prefs_unix.cpp; path = ../../Unix/prefs_unix.cpp; sourceTree = SOURCE_ROOT; }; - 08DC90C00B67077300799A45 /* prefs.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = prefs.cpp; path = ../../prefs.cpp; sourceTree = SOURCE_ROOT; }; - 08DC90C20B67078300799A45 /* prefs.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = prefs.h; path = ../../include/prefs.h; sourceTree = SOURCE_ROOT; }; - 08DC90C40B67079800799A45 /* sys.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sys.h; path = ../../include/sys.h; sourceTree = SOURCE_ROOT; }; - 08DC90C50B6707AC00799A45 /* user_strings_unix.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = user_strings_unix.h; path = ../../Unix/user_strings_unix.h; sourceTree = SOURCE_ROOT; }; - 08DC90C60B6707B400799A45 /* config.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = config.h; path = ../../Unix/config.h; sourceTree = SOURCE_ROOT; }; - 08DC90C70B6707BE00799A45 /* sysdeps.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sysdeps.h; path = ../../Unix/sysdeps.h; sourceTree = SOURCE_ROOT; }; - 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; - 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; - 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 29B97319FDCFA39411CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = ""; }; - 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; - 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; - 32CA4F630368D1EE00C91783 /* SheepShaverPrefs_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SheepShaverPrefs_Prefix.pch; sourceTree = ""; }; - 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; - 8D1107320486CEB800E47090 /* SheepShaverPrefs.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SheepShaverPrefs.app; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 8D11072E0486CEB800E47090 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 080E96DDFE201D6D7F000001 /* Classes */ = { - isa = PBXGroup; - children = ( - ); - name = Classes; - sourceTree = ""; - }; - 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { - isa = PBXGroup; - children = ( - 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, - ); - name = "Linked Frameworks"; - sourceTree = ""; - }; - 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { - isa = PBXGroup; - children = ( - 29B97324FDCFA39411CA2CEA /* AppKit.framework */, - 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */, - 29B97325FDCFA39411CA2CEA /* Foundation.framework */, - ); - name = "Other Frameworks"; - sourceTree = ""; - }; - 19C28FACFE9D520D11CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 8D1107320486CEB800E47090 /* SheepShaverPrefs.app */, - ); - name = Products; - sourceTree = ""; - }; - 29B97314FDCFA39411CA2CEA /* SheepShaverPrefs */ = { - isa = PBXGroup; - children = ( - 08DC90C20B67078300799A45 /* prefs.h */, - 08DC90C40B67079800799A45 /* sys.h */, - 08DC90C50B6707AC00799A45 /* user_strings_unix.h */, - 08DC90C60B6707B400799A45 /* config.h */, - 08DC90C70B6707BE00799A45 /* sysdeps.h */, - 08DC90BC0B67074C00799A45 /* prefs_items.cpp */, - 08DC90BE0B67075D00799A45 /* prefs_unix.cpp */, - 08DC90C00B67077300799A45 /* prefs.cpp */, - 080E96DDFE201D6D7F000001 /* Classes */, - 29B97315FDCFA39411CA2CEA /* Other Sources */, - 29B97317FDCFA39411CA2CEA /* Resources */, - 29B97323FDCFA39411CA2CEA /* Frameworks */, - 19C28FACFE9D520D11CA2CBB /* Products */, - 084186AF0B3A0515004B1F63 /* PrefsEditor.h */, - 084186B00B3A0515004B1F63 /* PrefsEditor.mm */, - ); - name = SheepShaverPrefs; - sourceTree = ""; - }; - 29B97315FDCFA39411CA2CEA /* Other Sources */ = { - isa = PBXGroup; - children = ( - 32CA4F630368D1EE00C91783 /* SheepShaverPrefs_Prefix.pch */, - 29B97316FDCFA39411CA2CEA /* main.m */, - ); - name = "Other Sources"; - sourceTree = ""; - }; - 29B97317FDCFA39411CA2CEA /* Resources */ = { - isa = PBXGroup; - children = ( - 8D1107310486CEB800E47090 /* Info.plist */, - 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, - 29B97318FDCFA39411CA2CEA /* MainMenu.nib */, - ); - name = Resources; - sourceTree = ""; - }; - 29B97323FDCFA39411CA2CEA /* Frameworks */ = { - isa = PBXGroup; - children = ( - 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, - 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, - ); - name = Frameworks; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 8D1107260486CEB800E47090 /* SheepShaverPrefs */ = { - isa = PBXNativeTarget; - buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "SheepShaverPrefs" */; - buildPhases = ( - 8D1107290486CEB800E47090 /* Resources */, - 8D11072C0486CEB800E47090 /* Sources */, - 8D11072E0486CEB800E47090 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = SheepShaverPrefs; - productInstallPath = "$(HOME)/Applications"; - productName = SheepShaverPrefs; - productReference = 8D1107320486CEB800E47090 /* SheepShaverPrefs.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 29B97313FDCFA39411CA2CEA /* Project object */ = { - isa = PBXProject; - buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "SheepShaverPrefs" */; - hasScannedForEncodings = 1; - mainGroup = 29B97314FDCFA39411CA2CEA /* SheepShaverPrefs */; - projectDirPath = ""; - targets = ( - 8D1107260486CEB800E47090 /* SheepShaverPrefs */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 8D1107290486CEB800E47090 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */, - 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 8D11072C0486CEB800E47090 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D11072D0486CEB800E47090 /* main.m in Sources */, - 084186B10B3A0515004B1F63 /* PrefsEditor.mm in Sources */, - 08DC90BD0B67074C00799A45 /* prefs_items.cpp in Sources */, - 08DC90BF0B67075D00799A45 /* prefs_unix.cpp in Sources */, - 08DC90C10B67077300799A45 /* prefs.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 089C165DFE840E0CC02AAC07 /* English */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; - 29B97318FDCFA39411CA2CEA /* MainMenu.nib */ = { - isa = PBXVariantGroup; - children = ( - 29B97319FDCFA39411CA2CEA /* English */, - ); - name = MainMenu.nib; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - C01FCF4B08A954540054247B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - PREFS_EDITOR, - STANDALONE_PREFS, - ); - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(HOME)/Applications"; - OTHER_CFLAGS = "$(inherited)"; - PRODUCT_NAME = SheepShaverPrefs; - WRAPPER_EXTENSION = app; - ZERO_LINK = YES; - }; - name = Debug; - }; - C01FCF4C08A954540054247B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - ppc, - i386, - ); - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp; - GCC_MODEL_TUNING = G5; - GCC_PREPROCESSOR_DEFINITIONS = ( - PREFS_EDITOR, - STANDALONE_PREFS, - ); - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(HOME)/Applications"; - OTHER_CFLAGS = "$(inherited)"; - PRODUCT_NAME = SheepShaverPrefs; - WRAPPER_EXTENSION = app; - }; - name = Release; - }; - C01FCF4F08A954540054247B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - PREBINDING = NO; - SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; - }; - name = Debug; - }; - C01FCF5008A954540054247B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - PREBINDING = NO; - SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "SheepShaverPrefs" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C01FCF4B08A954540054247B /* Debug */, - C01FCF4C08A954540054247B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - C01FCF4E08A954540054247B /* Build configuration list for PBXProject "SheepShaverPrefs" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C01FCF4F08A954540054247B /* Debug */, - C01FCF5008A954540054247B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; -} diff --git a/SheepShaver/src/MacOSX/PrefsEditor/main.m b/SheepShaver/src/MacOSX/PrefsEditor/main.m deleted file mode 100644 index 07ccbdbe..00000000 --- a/SheepShaver/src/MacOSX/PrefsEditor/main.m +++ /dev/null @@ -1,26 +0,0 @@ -/* - * main.m - Preferences editing in Cocoa on Mac OS X - * - * Copyright (C) 2006-2007 Alexei Svitkine - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#import - -int main(int argc, char *argv[]) -{ - return NSApplicationMain(argc, (const char **) argv); -} diff --git a/SheepShaver/src/MacOSX/PrefsEditor/standalone_nib/English.lproj/InfoPlist.strings b/SheepShaver/src/MacOSX/PrefsEditor/standalone_nib/English.lproj/InfoPlist.strings deleted file mode 100644 index 74d3187406a26213f9d2bcbfa9662776e5535127..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 90 zcmW-XK?;B%6a{DPDO|hIa|B%?G9i+TjKB_GJ>2~HZiT(X<$)+ - - - - IBClasses - - - ACTIONS - - addDisk - id - browseForROMFileClicked - id - createDisk - id - removeDisk - id - useRawKeyCodesClicked - id - - CLASS - PrefsEditor - LANGUAGE - ObjC - OUTLETS - - bootFrom - NSComboBox - disableCdrom - NSButton - disableSound - NSButton - diskSaveSize - NSView - diskSaveSizeField - NSTextField - disks - NSTableView - dontUseCPUWhenIdle - NSButton - enable68kDREmulator - NSButton - enableJIT - NSButton - ethernetInterface - NSTextField - height - NSComboBox - ignoreIllegalMemoryAccesses - NSButton - mixDevice - NSTextField - modemPort - NSTextField - mouseWheel - NSPopUpButton - outDevice - NSTextField - printerPort - NSTextField - qdAccel - NSButton - ramSize - NSTextField - ramSizeStepper - NSStepper - rawKeyCodes - NSTextField - refreshRate - NSPopUpButton - romFile - NSTextField - scrollLines - NSTextField - scrollLinesStepper - NSStepper - unixRoot - NSTextField - useRawKeyCodes - NSButton - videoType - NSPopUpButton - width - NSComboBox - window - NSWindow - - SUPERCLASS - NSObject - - - CLASS - FirstResponder - LANGUAGE - ObjC - SUPERCLASS - NSObject - - - IBVersion - 1 - - diff --git a/SheepShaver/src/MacOSX/PrefsEditor/standalone_nib/English.lproj/MainMenu.nib/info.nib b/SheepShaver/src/MacOSX/PrefsEditor/standalone_nib/English.lproj/MainMenu.nib/info.nib deleted file mode 100644 index 33a60200..00000000 --- a/SheepShaver/src/MacOSX/PrefsEditor/standalone_nib/English.lproj/MainMenu.nib/info.nib +++ /dev/null @@ -1,16 +0,0 @@ - - - - - IBFramework Version - 629 - IBOldestOS - 5 - IBOpenObjects - - IBSystem Version - 9D34 - targetFramework - IBCocoaFramework - - diff --git a/SheepShaver/src/MacOSX/PrefsEditor/standalone_nib/English.lproj/MainMenu.nib/keyedobjects.nib b/SheepShaver/src/MacOSX/PrefsEditor/standalone_nib/English.lproj/MainMenu.nib/keyedobjects.nib deleted file mode 100644 index 3d6ff6f1c3cf3b57922e9a3ad9cc143eaee9824c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 31674 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%0Am2&g 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 z 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 juYo>mVQ{-6J+a( \"${SRCROOT}/../Unix/basic-dyngen-ops.hpp\"\necho \"\t#include \\\"basic-dyngen-ops-x86_64.hpp\\\"\" >> \"${SRCROOT}/../Unix/basic-dyngen-ops.hpp\"\necho \"#elif defined(__i386__)\" >> \"${SRCROOT}/../Unix/basic-dyngen-ops.hpp\"\necho \"\t#include \\\"basic-dyngen-ops-x86_32.hpp\\\"\" >> \"${SRCROOT}/../Unix/basic-dyngen-ops.hpp\"\necho \"#else\" >> \"${SRCROOT}/../Unix/basic-dyngen-ops.hpp\"\necho \"\t#error Unknown platform\" >> \"${SRCROOT}/../Unix/basic-dyngen-ops.hpp\"\necho \"#endif\" >> \"${SRCROOT}/../Unix/basic-dyngen-ops.hpp\"\n"; - }; - 0873A66914AB8A40004F12B7 /* Run dyngen */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "$(BUILT_PRODUCTS_DIR)/dyngen", - "$(OBJECT_FILE_DIR)-$(CURRENT_VARIANT)/i386/ppc-dyngen-ops.o", - "$(OBJECT_FILE_DIR)-$(CURRENT_VARIANT)/x86_64/ppc-dyngen-ops.o", - ); - name = "Run dyngen"; - outputPaths = ( - "$(SRCROOT)/../Unix/ppc-dyngen-ops-x86_32.hpp", - "$(SRCROOT)/../Unix/ppc-dyngen-ops-x86_64.hpp", - "$(SRCROOT)/../Unix/ppc-dyngen-ops.hpp", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "arch -x86_64 \"${BUILT_PRODUCTS_DIR}/dyngen\" -o \"${SRCROOT}/../Unix/ppc-dyngen-ops-x86_64.hpp\" \"${OBJECT_FILE_DIR}-${CURRENT_VARIANT}/x86_64/ppc-dyngen-ops.o\"\narch -i386 \"${BUILT_PRODUCTS_DIR}/dyngen\" -o \"${SRCROOT}/../Unix/ppc-dyngen-ops-x86_32.hpp\" \"${OBJECT_FILE_DIR}-${CURRENT_VARIANT}/i386/ppc-dyngen-ops.o\"\n\necho \"#if defined(__x86_64__)\" > \"${SRCROOT}/../Unix/ppc-dyngen-ops.hpp\"\necho \"\t#include \\\"ppc-dyngen-ops-x86_64.hpp\\\"\" >> \"${SRCROOT}/../Unix/ppc-dyngen-ops.hpp\"\necho \"#elif defined(__i386__)\" >> \"${SRCROOT}/../Unix/ppc-dyngen-ops.hpp\"\necho \"\t#include \\\"ppc-dyngen-ops-x86_32.hpp\\\"\" >> \"${SRCROOT}/../Unix/ppc-dyngen-ops.hpp\"\necho \"#else\" >> \"${SRCROOT}/../Unix/ppc-dyngen-ops.hpp\"\necho \"\t#error Unknown platform\" >> \"${SRCROOT}/../Unix/ppc-dyngen-ops.hpp\"\necho \"#endif\" >> \"${SRCROOT}/../Unix/ppc-dyngen-ops.hpp\"\n"; - }; - 0873A67214AB8AE9004F12B7 /* Run genexec */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "$(SRCROOT)/../kpx_cpu/src/cpu/ppc/ppc-decode.cpp", - "$(SRCROOT)/../kpx_cpu/src/cpu/ppc/genexec.pl", - ); - name = "Run genexec"; - outputPaths = ( - "$(SRCROOT)/../Unix/ppc-execute-impl.cpp", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "gcc -E \"-I${SRCROOT}/config\" \"-I${SRCROOT}/../include\" \"-I${SRCROOT}/../kpx_cpu/include\" \"-I${SRCROOT}/../kpx_cpu/src\" \"-I${SRCROOT}/../Unix\" -DUSE_JIT -DGENEXEC \"${SRCROOT}/../kpx_cpu/src/cpu/ppc/ppc-decode.cpp\" | perl \"${SRCROOT}/../kpx_cpu/src/cpu/ppc/genexec.pl\" > \"${SRCROOT}/../Unix/ppc-execute-impl.cpp\"\n"; - }; - 08CD3F3214B665E1009CA2A2 /* Preprocess Info.plist */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Preprocess Info.plist"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "sed -i '' 's/@PACKAGE_VERSION@/2.4/g' \"${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}\""; - }; - 08CD43CF14B7BD01009CA2A2 /* Change SDL load path */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Change SDL load path"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "install_name_tool -change @rpath/SDL.framework/Versions/A/SDL @executable_path/../Frameworks/SDL.framework/Versions/A/SDL \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}\"\n"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 082AC24F14AA59B600071F5E /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 082AC26214AA59F000071F5E /* lowmem.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0846E49714B124DE00574779 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0846E4B114B1264700574779 /* ieeefp.cpp in Sources */, - 0846E4B314B1264F00574779 /* mathlib.cpp in Sources */, - 0846E4B514B1265500574779 /* utils-cpuinfo.cpp in Sources */, - 0846E4B614B1265A00574779 /* ppc-translate.cpp in Sources */, - 0846E4B814B1266000574779 /* ppc-jit.cpp in Sources */, - 0846E4B914B1266600574779 /* ppc-execute.cpp in Sources */, - 0846E4BC14B1267200574779 /* ppc-dyngen.cpp in Sources */, - 0846E4BE14B1267A00574779 /* ppc-decode.cpp in Sources */, - 0846E4C014B1267F00574779 /* ppc-cpu.cpp in Sources */, - 0846E4C114B1268B00574779 /* jit-cache.cpp in Sources */, - 0846E4C214B1269600574779 /* basic-dyngen.cpp in Sources */, - 0846E51314B128ED00574779 /* sheepshaver_glue.cpp in Sources */, - 08163340158C125800C449F9 /* ppc-dis.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0846E52514B129EE00574779 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0846E52B14B12A0800574779 /* ppc_asm.S in Sources */, - 0846E55314B12B0D00574779 /* paranoia.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0856CCBE14A99E1C000B1711 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0856CFC114A99EF0000B1711 /* adb.cpp in Sources */, - 0856CFC214A99EF0000B1711 /* audio.cpp in Sources */, - 0856CFE214A99EF0000B1711 /* cdrom.cpp in Sources */, - 0856CFE614A99EF0000B1711 /* disk.cpp in Sources */, - 0856CFEC14A99EF0000B1711 /* scsi_dummy.cpp in Sources */, - 0856CFEE14A99EF0000B1711 /* emul_op.cpp in Sources */, - 0856CFF014A99EF0000B1711 /* ether.cpp in Sources */, - 0856CFF314A99EF0000B1711 /* extfs.cpp in Sources */, - 0856CFF414A99EF0000B1711 /* gfxaccel.cpp in Sources */, - 0856D00914A99EF0000B1711 /* macos_util.cpp in Sources */, - 0856D02514A99EF0000B1711 /* extfs_macosx.cpp in Sources */, - 0856D05014A99EF1000B1711 /* prefs_macosx.mm in Sources */, - 0856D05A14A99EF1000B1711 /* sys_darwin.cpp in Sources */, - 0856D05B14A99EF1000B1711 /* main.cpp in Sources */, - 0856D05C14A99EF1000B1711 /* name_registry.cpp in Sources */, - 0856D05D14A99EF1000B1711 /* prefs_items.cpp in Sources */, - 0856D05E14A99EF1000B1711 /* prefs.cpp in Sources */, - 0856D05F14A99EF1000B1711 /* rom_patches.cpp in Sources */, - 0856D06014A99EF1000B1711 /* rsrc_patches.cpp in Sources */, - 0856D06114A99EF1000B1711 /* scsi.cpp in Sources */, - 0856D06214A99EF1000B1711 /* audio_sdl.cpp in Sources */, - 0856D06414A99EF1000B1711 /* SDLMain.m in Sources */, - 0856D06514A99EF1000B1711 /* video_sdl.cpp in Sources */, - 0856D06614A99EF1000B1711 /* serial.cpp in Sources */, - 0856D06714A99EF1000B1711 /* bootp.c in Sources */, - 0856D06814A99EF1000B1711 /* cksum.c in Sources */, - 0856D06A14A99EF1000B1711 /* debug.c in Sources */, - 0856D06B14A99EF1000B1711 /* if.c in Sources */, - 0856D06C14A99EF1000B1711 /* ip_icmp.c in Sources */, - 0856D06D14A99EF1000B1711 /* ip_input.c in Sources */, - 0856D06E14A99EF1000B1711 /* ip_output.c in Sources */, - 0856D06F14A99EF1000B1711 /* mbuf.c in Sources */, - 0856D07014A99EF1000B1711 /* misc.c in Sources */, - 0856D07114A99EF1000B1711 /* sbuf.c in Sources */, - 0856D07214A99EF1000B1711 /* slirp.c in Sources */, - 0856D07314A99EF1000B1711 /* socket.c in Sources */, - 0856D07414A99EF1000B1711 /* tcp_input.c in Sources */, - 0856D07514A99EF1000B1711 /* tcp_output.c in Sources */, - 0856D07614A99EF1000B1711 /* tcp_subr.c in Sources */, - 0856D07714A99EF1000B1711 /* tcp_timer.c in Sources */, - 0856D07814A99EF1000B1711 /* tftp.c in Sources */, - 0856D07914A99EF1000B1711 /* udp.c in Sources */, - 0856D07B14A99EF1000B1711 /* sony.cpp in Sources */, - 0856D07C14A99EF1000B1711 /* thunks.cpp in Sources */, - 0856D07D14A99EF1000B1711 /* timer.cpp in Sources */, - 0856D07E14A99EF1000B1711 /* about_window_unix.cpp in Sources */, - 0856D08714A99EF1000B1711 /* bincue_unix.cpp in Sources */, - 0856D09814A99EF1000B1711 /* ether_unix.cpp in Sources */, - 0856D0AA14A99EF1000B1711 /* main_unix.cpp in Sources */, - 0856D10614A99EF1000B1711 /* prefs_unix.cpp in Sources */, - 0856D10714A99EF1000B1711 /* rpc_unix.cpp in Sources */, - 0856D10814A99EF1000B1711 /* serial_unix.cpp in Sources */, - 0856D10C14A99EF1000B1711 /* sshpty.c in Sources */, - 0856D10D14A99EF1000B1711 /* strlcpy.c in Sources */, - 0856D10E14A99EF1000B1711 /* sys_unix.cpp in Sources */, - 0856D10F14A99EF1000B1711 /* timer_unix.cpp in Sources */, - 0856D11114A99EF1000B1711 /* user_strings_unix.cpp in Sources */, - 0856D11614A99EF1000B1711 /* xpram_unix.cpp in Sources */, - 0856D11714A99EF1000B1711 /* user_strings.cpp in Sources */, - 0856D11814A99EF1000B1711 /* video.cpp in Sources */, - 0856D13F14A99EF1000B1711 /* xpram.cpp in Sources */, - 0856D33914A9A704000B1711 /* VMSettingsController.mm in Sources */, - 082AC22D14AA52E900071F5E /* prefs_editor_dummy.cpp in Sources */, - 0873A80214AC515D004F12B7 /* utils_macosx.mm in Sources */, - 083E370C16EFE85000CCCA59 /* disk_sparsebundle.cpp in Sources */, - 083E372216EFE87200CCCA59 /* tinyxml2.cpp in Sources */, - A7B1921418C35D4700791D8D /* DiskType.m in Sources */, - 087B91BE1B780FFC00825F7F /* sigsegv.cpp in Sources */, - 087B91BF1B780FFC00825F7F /* video_blit.cpp in Sources */, - 087B91C01B780FFC00825F7F /* vm_alloc.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0873A52F14AAF05A004F12B7 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0873A54214AAF18E004F12B7 /* cxxdemangle.cpp in Sources */, - 0873A54314AAF18E004F12B7 /* dyngen.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0873A5C214AB8038004F12B7 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0873A5D614AB80CA004F12B7 /* basic-dyngen-ops.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0873A5C914AB806D004F12B7 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0873A5D814AB80E3004F12B7 /* ppc-dyngen-ops.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0885A51E1593E3B6005C4F7B /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 08C99DA11593E79F00898E41 /* clip_macosx.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0885A52D1593E47F005C4F7B /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 08D93A16159FE174003B04EC /* clip_macosx64.mm in Sources */, - 0879BD5E15A88F7600DC277D /* pict.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 082AC26814AA5A4800071F5E /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 082AC25114AA59B600071F5E /* lowmem */; - targetProxy = 082AC26714AA5A4800071F5E /* PBXContainerItemProxy */; - }; - 0846E4A714B1253500574779 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 0846E49914B124DE00574779 /* kpx_cpu */; - targetProxy = 0846E4A614B1253500574779 /* PBXContainerItemProxy */; - }; - 0846E4C614B126B600574779 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 0873A5CB14AB806D004F12B7 /* ppc-dyngen-ops */; - targetProxy = 0846E4C514B126B600574779 /* PBXContainerItemProxy */; - }; - 0846E4C814B126B800574779 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 0873A67314AB8AE9004F12B7 /* ppc-execute-impl */; - targetProxy = 0846E4C714B126B800574779 /* PBXContainerItemProxy */; - }; - 0846E52E14B12A2E00574779 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 0846E52714B129EE00574779 /* ppc_asm */; - targetProxy = 0846E52D14B12A2E00574779 /* PBXContainerItemProxy */; - }; - 0873A60314AB83CC004F12B7 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 0873A5C414AB8038004F12B7 /* basic-dyngen-ops */; - targetProxy = 0873A60214AB83CC004F12B7 /* PBXContainerItemProxy */; - }; - 0873A62714AB869A004F12B7 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 0873A53114AAF05A004F12B7 /* dyngen */; - targetProxy = 0873A62614AB869A004F12B7 /* PBXContainerItemProxy */; - }; - 0885A53A1593E4BC005C4F7B /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 0885A5201593E3B6005C4F7B /* clip */; - targetProxy = 0885A5391593E4BC005C4F7B /* PBXContainerItemProxy */; - }; - 0885A53C1593E4BC005C4F7B /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 0885A52B1593E47F005C4F7B /* clip64 */; - targetProxy = 0885A53B1593E4BC005C4F7B /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 0856D30714A9A704000B1711 /* VMSettingsWindow.nib */ = { - isa = PBXVariantGroup; - children = ( - 0856D30814A9A704000B1711 /* English */, - ); - name = VMSettingsWindow.nib; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 082AC25414AA59B700071F5E /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = ( - i386, - x86_64, - ); - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_ENABLE_PASCAL_STRINGS = NO; - GCC_ENABLE_SYMBOL_SEPARATION = NO; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = NO; - GCC_PREFIX_HEADER = ""; - GCC_VERSION = 4.0; - INSTALL_PATH = /usr/local/bin; - OTHER_LDFLAGS = ""; - PREBINDING = NO; - PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; - PRODUCT_NAME = lowmem; - SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; - }; - name = Debug; - }; - 082AC25514AA59B700071F5E /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = ( - i386, - x86_64, - ); - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_ENABLE_PASCAL_STRINGS = NO; - GCC_ENABLE_SYMBOL_SEPARATION = NO; - GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = NO; - GCC_PREFIX_HEADER = ""; - GCC_VERSION = 4.0; - INSTALL_PATH = /usr/local/bin; - OTHER_LDFLAGS = ""; - PREBINDING = NO; - PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; - PRODUCT_NAME = lowmem; - SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; - ZERO_LINK = NO; - }; - name = Release; - }; - 0846E49B14B124DF00574779 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = ( - i386, - x86_64, - ); - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = ""; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DATADIR=", - HAVE_CONFIG_H, - USE_JIT, - "_GNU_SOURCE=1", - _THREAD_SAFE, - _REENTRANT, - ); - GCC_VERSION = 4.0; - HEADER_SEARCH_PATHS = ( - /Library/Frameworks/SDL.framework/Versions/A/Headers/, - ./config/, - ../Unix, - ../MacOSX/Launcher, - ../slirp, - ../kpx_cpu/src, - ../kpx_cpu/include, - ../include, - ); - INSTALL_PATH = /usr/local/lib; - PREBINDING = NO; - PRODUCT_NAME = kpx_cpu; - SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; - "SDKROOT[arch=x86_64]" = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk"; - }; - name = Debug; - }; - 0846E49C14B124DF00574779 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = ( - i386, - x86_64, - ); - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_AUTO_VECTORIZATION = YES; - GCC_DYNAMIC_NO_PIC = YES; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_ENABLE_SSE3_EXTENSIONS = YES; - GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS = YES; - GCC_MODEL_TUNING = ""; - GCC_OPTIMIZATION_LEVEL = 3; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DATADIR=", - HAVE_CONFIG_H, - USE_JIT, - "_GNU_SOURCE=1", - _THREAD_SAFE, - _REENTRANT, - ); - GCC_VERSION = 4.0; - "GCC_VERSION[arch=x86_64]" = 4.2; - HEADER_SEARCH_PATHS = ( - /Library/Frameworks/SDL.framework/Versions/A/Headers/, - ./config/, - ../Unix, - ../MacOSX/Launcher, - ../slirp, - ../kpx_cpu/src, - ../kpx_cpu/include, - ../include, - ); - INSTALL_PATH = /usr/local/lib; - "MACOSX_DEPLOYMENT_TARGET[arch=x86_64]" = 10.6; - PREBINDING = NO; - PRODUCT_NAME = kpx_cpu; - SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; - "SDKROOT[arch=x86_64]" = "$(DEVELOPER_SDK_DIR)/MacOSX10.6.sdk"; - ZERO_LINK = NO; - }; - name = Release; - }; - 0846E52914B129EF00574779 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = ppc; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = __ASSEMBLY__; - GCC_VERSION = 4.0; - HEADER_SEARCH_PATHS = ( - ../Unix, - ../include, - ); - INSTALL_PATH = /usr/local/lib; - PREBINDING = NO; - PRODUCT_NAME = ppc_asm; - SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; - }; - name = Debug; - }; - 0846E52A14B129EF00574779 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = ppc; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; - GCC_PREPROCESSOR_DEFINITIONS = __ASSEMBLY__; - GCC_VERSION = 4.0; - HEADER_SEARCH_PATHS = ( - ../Unix, - ../include, - ); - INSTALL_PATH = /usr/local/lib; - PREBINDING = NO; - PRODUCT_NAME = ppc_asm; - SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; - ZERO_LINK = NO; - }; - name = Release; - }; - 0856CCAF14A99DE0000B1711 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - }; - name = Debug; - }; - 0856CCB014A99DE0000B1711 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = YES; - }; - name = Release; - }; - 0856CCC514A99E1C000B1711 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = ( - ppc, - i386, - x86_64, - ); - COPY_PHASE_STRIP = NO; - FRAMEWORK_SEARCH_PATHS = /Library/Frameworks; - GCC_CW_ASM_SYNTAX = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_ENABLE_PASCAL_STRINGS = NO; - GCC_ENABLE_SYMBOL_SEPARATION = NO; - GCC_ENABLE_TRIGRAPHS = NO; - GCC_INLINES_ARE_PRIVATE_EXTERN = NO; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = NO; - GCC_PREFIX_HEADER = ""; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DATADIR=", - HAVE_CONFIG_H, - USE_JIT, - "_GNU_SOURCE=1", - _THREAD_SAFE, - _REENTRANT, - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_VERSION = 4.0; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - /Library/Frameworks/SDL.framework/Versions/A/Headers/, - ./config/, - ../Unix, - ../MacOSX/Launcher, - ../slirp, - ../kpx_cpu/src, - ../kpx_cpu/include, - ../include, - ); - INFOPLIST_FILE = Info.plist.in; - INFOPLIST_PREFIX_HEADER = ""; - INFOPLIST_PREPROCESS = NO; - INSTALL_PATH = "$(HOME)/Applications"; - MACOSX_DEPLOYMENT_TARGET = 10.4; - "MACOSX_DEPLOYMENT_TARGET[arch=x86_64]" = 10.5; - OTHER_CFLAGS = ""; - OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)"; - OTHER_LDFLAGS = ( - "-pagezero_size", - 0x3000, - "-Wl,-seg1addr,0x78048000", - "-lkpx_cpu", - "-lclip", - ); - "OTHER_LDFLAGS[arch=ppc]" = ( - "-pagezero_size", - 0x3000, - "-Wl,-seg1addr,0x78048000", - "-lppc_asm", - "-lclip", - ); - "OTHER_LDFLAGS[arch=x86_64]" = ( - "-pagezero_size", - 0x3000, - "-Wl,-seg1addr,0x78048000", - "-lkpx_cpu", - "-lclip64", - ); - PREBINDING = NO; - PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; - PRODUCT_NAME = SheepShaver; - SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; - "SDKROOT[arch=x86_64]" = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk"; - WARNING_LDFLAGS = ""; - }; - name = Debug; - }; - 0856CCC614A99E1C000B1711 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = ( - ppc, - i386, - x86_64, - ); - COPY_PHASE_STRIP = NO; - DEAD_CODE_STRIPPING = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - FRAMEWORK_SEARCH_PATHS = /Library/Frameworks; - GCC_AUTO_VECTORIZATION = YES; - GCC_CW_ASM_SYNTAX = NO; - GCC_DYNAMIC_NO_PIC = YES; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_ENABLE_PASCAL_STRINGS = NO; - GCC_ENABLE_SSE3_EXTENSIONS = YES; - GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS = YES; - GCC_ENABLE_SYMBOL_SEPARATION = NO; - GCC_ENABLE_TRIGRAPHS = NO; - GCC_INLINES_ARE_PRIVATE_EXTERN = NO; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 3; - GCC_PRECOMPILE_PREFIX_HEADER = NO; - GCC_PREFIX_HEADER = ""; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DATADIR=", - HAVE_CONFIG_H, - USE_JIT, - "_GNU_SOURCE=1", - _THREAD_SAFE, - _REENTRANT, - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_VERSION = 4.0; - "GCC_VERSION[arch=x86_64]" = 4.2; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - /Library/Frameworks/SDL.framework/Versions/A/Headers/, - ./config/, - ../Unix, - ../MacOSX/Launcher, - ../slirp, - ../kpx_cpu/src, - ../kpx_cpu/include, - ../include, - ); - INFOPLIST_EXPAND_BUILD_SETTINGS = NO; - INFOPLIST_FILE = Info.plist.in; - INFOPLIST_PREFIX_HEADER = ""; - INFOPLIST_PREPROCESS = NO; - INSTALL_PATH = "$(HOME)/Applications"; - MACOSX_DEPLOYMENT_TARGET = 10.4; - "MACOSX_DEPLOYMENT_TARGET[arch=x86_64]" = 10.5; - OTHER_CFLAGS = ""; - OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)"; - OTHER_LDFLAGS = ( - "-pagezero_size", - 0x3000, - "-Wl,-seg1addr,0x78048000", - "-lkpx_cpu", - "-lclip", - ); - "OTHER_LDFLAGS[arch=ppc]" = ( - "-pagezero_size", - 0x3000, - "-Wl,-seg1addr,0x78048000", - "-lppc_asm", - "-lclip", - ); - "OTHER_LDFLAGS[arch=x86_64]" = ( - "-pagezero_size", - 0x3000, - "-Wl,-seg1addr,0x78048000", - "-lkpx_cpu", - "-lclip64", - ); - PREBINDING = NO; - PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; - PRODUCT_NAME = SheepShaver; - SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; - "SDKROOT[arch=x86_64]" = "$(DEVELOPER_SDK_DIR)/MacOSX10.6.sdk"; - ZERO_LINK = NO; - }; - name = Release; - }; - 0873A53414AAF05A004F12B7 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = ( - i386, - x86_64, - ); - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_ENABLE_SYMBOL_SEPARATION = NO; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = NO; - GCC_PREFIX_HEADER = ""; - GCC_VERSION = 4.0; - INSTALL_PATH = /usr/local/bin; - OTHER_CFLAGS = "-mdynamic-no-pic"; - OTHER_LDFLAGS = ""; - PREBINDING = NO; - PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; - PRODUCT_NAME = dyngen; - SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; - }; - name = Debug; - }; - 0873A53514AAF05A004F12B7 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = ( - i386, - x86_64, - ); - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_ENABLE_SYMBOL_SEPARATION = NO; - GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = NO; - GCC_PREFIX_HEADER = ""; - GCC_VERSION = 4.0; - INSTALL_PATH = /usr/local/bin; - OTHER_LDFLAGS = ""; - PREBINDING = NO; - PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; - PRODUCT_NAME = dyngen; - SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; - ZERO_LINK = NO; - }; - name = Release; - }; - 0873A5C614AB8038004F12B7 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = ( - i386, - x86_64, - ); - COPY_PHASE_STRIP = NO; - GCC_CW_ASM_SYNTAX = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_ENABLE_PASCAL_STRINGS = NO; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 2; - GCC_PRECOMPILE_PREFIX_HEADER = ""; - GCC_PREFIX_HEADER = ""; - GCC_PREPROCESSOR_DEFINITIONS = ( - USE_JIT, - HAVE_CONFIG_H, - _REENTRANT, - _THREAD_SAFE, - "_GNU_SOURCE=1", - ); - GCC_VERSION = 4.0; - HEADER_SEARCH_PATHS = ( - ../kpx_cpu/src, - ../kpx_cpu/include, - ); - INSTALL_PATH = /usr/local/lib; - OTHER_CFLAGS = ( - "-mdynamic-no-pic", - "-fomit-frame-pointer", - "-fno-align-functions", - "-finline-functions", - "-finline-limit=10000", - "-fno-exceptions", - "-g0", - "-fno-reorder-blocks", - "-fno-optimize-sibling-calls", - ); - OTHER_LDFLAGS = ( - "-framework", - Foundation, - "-framework", - AppKit, - ); - PREBINDING = NO; - PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; - PRODUCT_NAME = "basic-dyngen-ops"; - SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; - }; - name = Debug; - }; - 0873A5C714AB8038004F12B7 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = ( - i386, - x86_64, - ); - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = NO; - GCC_PREFIX_HEADER = ""; - GCC_VERSION = 4.0; - "GCC_VERSION[arch=x86_64]" = 4.2; - HEADER_SEARCH_PATHS = ( - ../kpx_cpu/src, - ../kpx_cpu/include, - ); - INSTALL_PATH = /usr/local/lib; - OTHER_CFLAGS = ( - "-mdynamic-no-pic", - "-fomit-frame-pointer", - "-fno-align-functions", - "-finline-functions", - "-finline-limit=10000", - "-fno-exceptions", - "-g0", - "-fno-reorder-blocks", - "-fno-optimize-sibling-calls", - ); - OTHER_LDFLAGS = ( - "-framework", - Foundation, - "-framework", - AppKit, - ); - PREBINDING = NO; - PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; - PRODUCT_NAME = "basic-dyngen-ops"; - SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; - "SDKROOT[arch=x86_64]" = "$(DEVELOPER_SDK_DIR)/MacOSX10.6.sdk"; - ZERO_LINK = NO; - }; - name = Release; - }; - 0873A5CD14AB806E004F12B7 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = ( - i386, - x86_64, - ); - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 2; - GCC_PRECOMPILE_PREFIX_HEADER = ""; - GCC_PREFIX_HEADER = ""; - GCC_VERSION = 4.0; - HEADER_SEARCH_PATHS = ( - ../kpx_cpu/src, - ../kpx_cpu/include, - ); - INSTALL_PATH = /usr/local/lib; - OTHER_CFLAGS = ( - "-mdynamic-no-pic", - "-fomit-frame-pointer", - "-fno-align-functions", - "-finline-functions", - "-finline-limit=10000", - "-fno-exceptions", - "-g0", - "-fno-reorder-blocks", - "-fno-optimize-sibling-calls", - ); - OTHER_LDFLAGS = ( - "-framework", - Foundation, - "-framework", - AppKit, - ); - PREBINDING = NO; - PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; - PRODUCT_NAME = "ppc-dyngen-ops"; - SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; - }; - name = Debug; - }; - 0873A5CE14AB806E004F12B7 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = ( - i386, - x86_64, - ); - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = ""; - GCC_VERSION = 4.0; - "GCC_VERSION[arch=x86_64]" = 4.2; - HEADER_SEARCH_PATHS = ( - ../kpx_cpu/src, - ../kpx_cpu/include, - ); - INSTALL_PATH = /usr/local/lib; - OTHER_CFLAGS = ( - "-mdynamic-no-pic", - "-fomit-frame-pointer", - "-fno-align-functions", - "-finline-functions", - "-finline-limit=10000", - "-fno-exceptions", - "-g0", - "-fno-reorder-blocks", - "-fno-optimize-sibling-calls", - ); - OTHER_LDFLAGS = ( - "-framework", - Foundation, - "-framework", - AppKit, - ); - PREBINDING = NO; - PRODUCT_NAME = "ppc-dyngen-ops"; - SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; - "SDKROOT[arch=x86_64]" = "$(DEVELOPER_SDK_DIR)/MacOSX10.6.sdk"; - ZERO_LINK = NO; - }; - name = Release; - }; - 0873A67414AB8AE9004F12B7 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - PRODUCT_NAME = "ppc-execute-impl"; - }; - name = Debug; - }; - 0873A67514AB8AE9004F12B7 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - PRODUCT_NAME = "ppc-execute-impl"; - ZERO_LINK = NO; - }; - name = Release; - }; - 0885A5221593E3B6005C4F7B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = ( - ppc, - i386, - ); - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_VERSION = 4.0; - HEADER_SEARCH_PATHS = ( - /Library/Frameworks/SDL.framework/Versions/A/Headers/, - ./config/, - ../Unix, - ../MacOSX/Launcher, - ../slirp, - ../kpx_cpu/src, - ../kpx_cpu/include, - ../include, - ); - INSTALL_PATH = /usr/local/lib; - PREBINDING = NO; - PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; - PRODUCT_NAME = clip; - SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; - }; - name = Debug; - }; - 0885A5231593E3B6005C4F7B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = ( - ppc, - i386, - ); - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; - GCC_VERSION = 4.0; - HEADER_SEARCH_PATHS = ( - /Library/Frameworks/SDL.framework/Versions/A/Headers/, - ./config/, - ../Unix, - ../MacOSX/Launcher, - ../slirp, - ../kpx_cpu/src, - ../kpx_cpu/include, - ../include, - ); - INSTALL_PATH = /usr/local/lib; - PREBINDING = NO; - PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; - PRODUCT_NAME = clip; - SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; - ZERO_LINK = NO; - }; - name = Release; - }; - 0885A5321593E47F005C4F7B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1)"; - ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1 = x86_64; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_VERSION = 4.0; - HEADER_SEARCH_PATHS = ( - /Library/Frameworks/SDL.framework/Versions/A/Headers/, - ./config/, - ../Unix, - ../MacOSX/Launcher, - ../slirp, - ../kpx_cpu/src, - ../kpx_cpu/include, - ../include, - ); - INSTALL_PATH = /usr/local/lib; - PREBINDING = NO; - PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; - PRODUCT_NAME = clip64; - SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk"; - }; - name = Debug; - }; - 0885A5331593E47F005C4F7B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1)"; - ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1 = x86_64; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; - GCC_VERSION = 4.0; - HEADER_SEARCH_PATHS = ( - /Library/Frameworks/SDL.framework/Versions/A/Headers/, - ./config/, - ../Unix, - ../MacOSX/Launcher, - ../slirp, - ../kpx_cpu/src, - ../kpx_cpu/include, - ../include, - ); - INSTALL_PATH = /usr/local/lib; - PREBINDING = NO; - PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; - PRODUCT_NAME = clip64; - SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.6.sdk"; - ZERO_LINK = NO; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 082AC25714AA59DB00071F5E /* Build configuration list for PBXNativeTarget "lowmem" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 082AC25414AA59B700071F5E /* Debug */, - 082AC25514AA59B700071F5E /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 0846E4A114B1251400574779 /* Build configuration list for PBXNativeTarget "kpx_cpu" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0846E49B14B124DF00574779 /* Debug */, - 0846E49C14B124DF00574779 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 0846E52C14B12A2600574779 /* Build configuration list for PBXNativeTarget "ppc_asm" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0846E52914B129EF00574779 /* Debug */, - 0846E52A14B129EF00574779 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 0856CCB114A99DE0000B1711 /* Build configuration list for PBXProject "SheepShaver" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0856CCAF14A99DE0000B1711 /* Debug */, - 0856CCB014A99DE0000B1711 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 0856CCC714A99E1D000B1711 /* Build configuration list for PBXNativeTarget "SheepShaver" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0856CCC514A99E1C000B1711 /* Debug */, - 0856CCC614A99E1C000B1711 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 0873A53E14AAF076004F12B7 /* Build configuration list for PBXNativeTarget "dyngen" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0873A53414AAF05A004F12B7 /* Debug */, - 0873A53514AAF05A004F12B7 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 0873A5D314AB8099004F12B7 /* Build configuration list for PBXNativeTarget "basic-dyngen-ops" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0873A5C614AB8038004F12B7 /* Debug */, - 0873A5C714AB8038004F12B7 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 0873A5D414AB8099004F12B7 /* Build configuration list for PBXNativeTarget "ppc-dyngen-ops" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0873A5CD14AB806E004F12B7 /* Debug */, - 0873A5CE14AB806E004F12B7 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 0873A67B14AB8AEC004F12B7 /* Build configuration list for PBXAggregateTarget "ppc-execute-impl" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0873A67414AB8AE9004F12B7 /* Debug */, - 0873A67514AB8AE9004F12B7 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 0885A5241593E450005C4F7B /* Build configuration list for PBXNativeTarget "clip" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0885A5221593E3B6005C4F7B /* Debug */, - 0885A5231593E3B6005C4F7B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 0885A5311593E47F005C4F7B /* Build configuration list for PBXNativeTarget "clip64" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0885A5321593E47F005C4F7B /* Debug */, - 0885A5331593E47F005C4F7B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 0856CCAE14A99DE0000B1711 /* Project object */; -} diff --git a/SheepShaver/src/MacOSX/XcodeBuildHowTo.txt b/SheepShaver/src/MacOSX/XcodeBuildHowTo.txt deleted file mode 100644 index 2a8899ba..00000000 --- a/SheepShaver/src/MacOSX/XcodeBuildHowTo.txt +++ /dev/null @@ -1,26 +0,0 @@ -The Xcode SheepShaver project makes it easier to build SheepShaver as a -Universal Binary (with 3 architectures: i386, x86_64 and ppc). - -This is an optional build system that does not affect the existing -autogen/configure based build system, which is still fully supported. -The Xcode project will build SheepShaver with configuration -"--enable-sdl-audio --enable-sdl-video --disable-vosf". - -The Xcode project lives in has been tested to work on Snow Leopard -64-bit with Xcode 3.2.6 and the 10.4 SDK installed. It may not work -under newer versions of Xcode or Mac OS X. - -To use it, you need the following: - -1. A complete 'macemu' git checkout of SheepShaver and BasiliskII. -2. SDL installed as a framework in /Library/Frameworks/SDL.framework. -3. You do not need to run autogen.sh / configure to use the Xcode -project. If you've done so already, you should remove or temporarily -move/rename src/Unix/config.h, as the presence of that file currently -conflicts with the Xcode build and will cause errors in Xcode. - -With the above all set, you should be able to launch the Xcode project -and build SheepShaver, resulting in a UB build containing SDL as a -private framework in the bundle. The result will be located in either -SheepShaver/src/MacOSX/build/Debug or SheepShaver/src/MacOSX/build/Release -directories, depending if you do a Debug or Release build. diff --git a/SheepShaver/src/MacOSX/audio_macosx.cpp b/SheepShaver/src/MacOSX/audio_macosx.cpp deleted file mode 120000 index 418b23c5..00000000 --- a/SheepShaver/src/MacOSX/audio_macosx.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/MacOSX/audio_macosx.cpp \ No newline at end of file diff --git a/SheepShaver/src/MacOSX/autorelease.h b/SheepShaver/src/MacOSX/autorelease.h deleted file mode 120000 index 154cdead..00000000 --- a/SheepShaver/src/MacOSX/autorelease.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/MacOSX/autorelease.h \ No newline at end of file diff --git a/SheepShaver/src/MacOSX/clip_macosx.cpp b/SheepShaver/src/MacOSX/clip_macosx.cpp deleted file mode 120000 index 7f731e4d..00000000 --- a/SheepShaver/src/MacOSX/clip_macosx.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/MacOSX/clip_macosx.cpp \ No newline at end of file diff --git a/SheepShaver/src/MacOSX/clip_macosx64.mm b/SheepShaver/src/MacOSX/clip_macosx64.mm deleted file mode 120000 index 18640812..00000000 --- a/SheepShaver/src/MacOSX/clip_macosx64.mm +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/MacOSX/clip_macosx64.mm \ No newline at end of file diff --git a/SheepShaver/src/MacOSX/config/config-macosx-ppc_32.h b/SheepShaver/src/MacOSX/config/config-macosx-ppc_32.h deleted file mode 100644 index 93c2dde3..00000000 --- a/SheepShaver/src/MacOSX/config/config-macosx-ppc_32.h +++ /dev/null @@ -1,513 +0,0 @@ -/* config.h. Generated by configure. */ -/* config.h.in. Generated from configure.ac by autoheader. */ - -#ifndef CONFIG_H -#define CONFIG_H - - -/* Define if using a PowerPC CPU emulator. */ -/* #undef EMULATED_PPC */ - -/* Define to enable dyngen engine */ -/* #undef ENABLE_DYNGEN */ - -/* Define is using ESD. */ -/* #undef ENABLE_ESD */ - -/* Define if using Linux fbdev extension. */ -/* #undef ENABLE_FBDEV_DGA */ - -/* Define if using GTK. */ -/* #undef ENABLE_GTK */ - -/* Define if using "mon". */ -/* #undef ENABLE_MON */ - -/* Define if your system supports TUN/TAP devices. */ -/* #undef ENABLE_TUNTAP */ - -/* Define if using video enabled on SEGV signals. */ -/* #undef ENABLE_VOSF */ - -/* Define if using XFree86 DGA extension. */ -/* #undef ENABLE_XF86_DGA */ - -/* Define if using XFree86 DGA extension. */ -/* #undef ENABLE_XF86_VIDMODE */ - -/* Define to 1 if you have the header file. */ -#define HAVE_ARPA_INET_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_AVAILABILITYMACROS_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_BYTESWAP_H */ - -/* Define to 1 if you have the `ceil' function. */ -#define HAVE_CEIL 1 - -/* Define to 1 if you have the `ceilf' function. */ -#define HAVE_CEILF 1 - -/* Define to 1 if you have the `cfmakeraw' function. */ -#define HAVE_CFMAKERAW 1 - -/* Define to 1 if you have the `clock_gettime' function. */ -/* #undef HAVE_CLOCK_GETTIME */ - -/* Define to 1 if you have the `clock_nanosleep' function. */ -/* #undef HAVE_CLOCK_NANOSLEEP */ - -/* Define if you have /dev/ptmx. */ -/* #undef HAVE_DEV_PTMX */ - -/* Define if you have /dev/ptc. */ -/* #undef HAVE_DEV_PTS_AND_PTC */ - -/* Define to 1 if you have the header file. */ -#define HAVE_DIRENT_H 1 - -/* Define to 1 if you have the `exp2' function. */ -#define HAVE_EXP2 1 - -/* Define to 1 if you have the `exp2f' function. */ -#define HAVE_EXP2F 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FENV_H 1 - -/* Define to 1 if you have the `floor' function. */ -#define HAVE_FLOOR 1 - -/* Define to 1 if you have the `floorf' function. */ -#define HAVE_FLOORF 1 - -/* Define if framework AppKit is available. */ -#define HAVE_FRAMEWORK_APPKIT 1 - -/* Define if framework AudioToolbox is available. */ -#define HAVE_FRAMEWORK_AUDIOTOOLBOX 1 - -/* Define if framework AudioUnit is available. */ -#define HAVE_FRAMEWORK_AUDIOUNIT 1 - -/* Define if framework Carbon is available. */ -#define HAVE_FRAMEWORK_CARBON 1 - -/* Define if framework CoreAudio is available. */ -#define HAVE_FRAMEWORK_COREAUDIO 1 - -/* Define if framework CoreFoundation is available. */ -#define HAVE_FRAMEWORK_COREFOUNDATION 1 - -/* Define if framework IOKit is available. */ -#define HAVE_FRAMEWORK_IOKIT 1 - -/* Define if framework SDL is available. */ -/* #undef HAVE_FRAMEWORK_SDL */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_HISTORY_H */ - -/* Define to 1 if you have the `inet_aton' function. */ -#define HAVE_INET_ATON 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_INTTYPES_H */ - -/* Define to 1 if you have the header - file. */ -#define HAVE_IOKIT_STORAGE_IOBLOCKSTORAGEDEVICE_H 1 - -/* Define to 1 if you have the `curses' library (-lcurses). */ -/* #undef HAVE_LIBCURSES */ - -/* Define to 1 if you have the `c_r' library (-lc_r). */ -/* #undef HAVE_LIBC_R */ - -/* Define to 1 if you have the `Hcurses' library (-lHcurses). */ -/* #undef HAVE_LIBHCURSES */ - -/* Define to 1 if you have the `m' library (-lm). */ -#define HAVE_LIBM 1 - -/* Define to 1 if you have the `ncurses' library (-lncurses). */ -/* #undef HAVE_LIBNCURSES */ - -/* Define to 1 if you have the `posix4' library (-lposix4). */ -/* #undef HAVE_LIBPOSIX4 */ - -/* Define to 1 if you have the `pthread' library (-lpthread). */ -#define HAVE_LIBPTHREAD 1 - -/* Define to 1 if you have the `PTL' library (-lPTL). */ -/* #undef HAVE_LIBPTL */ - -/* Define to 1 if you have the `readline' library (-lreadline). */ -/* #undef HAVE_LIBREADLINE */ - -/* Define to 1 if you have the `termcap' library (-ltermcap). */ -/* #undef HAVE_LIBTERMCAP */ - -/* Define to 1 if you have the `terminfo' library (-lterminfo). */ -/* #undef HAVE_LIBTERMINFO */ - -/* Define to 1 if you have the `termlib' library (-ltermlib). */ -/* #undef HAVE_LIBTERMLIB */ - -/* Define to 1 if you have the `vhd' library (-lvhd). */ -/* #undef HAVE_LIBVHD */ - -/* Define if there is a linker script to relocate the executable above - 0x70000000. */ -#define HAVE_LINKER_SCRIPT 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LINUX_IF_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LINUX_IF_TUN_H */ - -/* Define to 1 if you have the `log2' function. */ -#define HAVE_LOG2 1 - -/* Define to 1 if you have the `log2f' function. */ -#define HAVE_LOG2F 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LOGIN_H */ - -/* Define if your system supports Mach exceptions. */ -#define HAVE_MACH_EXCEPTIONS 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MACH_MACH_INIT_H 1 - -/* Define to 1 if you have the `mach_task_self' function. */ -#define HAVE_MACH_TASK_SELF 1 - -/* Define if your system has a working vm_allocate()-based memory allocator. - */ -#define HAVE_MACH_VM 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MACH_VM_MAP_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_MALLOC_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_MEMORY_H */ - -/* Define to 1 if you have the `mmap' function. */ -#define HAVE_MMAP 1 - -/* Define if defines MAP_ANON and mmap()'ing with MAP_ANON works. - */ -/* #undef HAVE_MMAP_ANON */ - -/* Define if defines MAP_ANONYMOUS and mmap()'ing with - MAP_ANONYMOUS works. */ -/* #undef HAVE_MMAP_ANONYMOUS */ - -/* Define if your system has a working mmap()-based memory allocator. */ -/* #undef HAVE_MMAP_VM */ - -/* Define to 1 if you have the `mprotect' function. */ -#define HAVE_MPROTECT 1 - -/* Define to 1 if you have the `munmap' function. */ -#define HAVE_MUNMAP 1 - -/* Define to 1 if you have the `nanosleep' function. */ -#define HAVE_NANOSLEEP 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_NET_IF_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NET_IF_TUN_H */ - -/* Define if you are on NEWS-OS (additions from openssh-3.2.2p1, for - sshpty.c). */ -/* #undef HAVE_NEWS4 */ - -/* Define to 1 if you have the `poll' function. */ -#define HAVE_POLL 1 - -/* Define if pthreads are available. */ -#define HAVE_PTHREADS 1 - -/* Define to 1 if you have the `pthread_cancel' function. */ -#define HAVE_PTHREAD_CANCEL 1 - -/* Define to 1 if you have the `pthread_cond_init' function. */ -#define HAVE_PTHREAD_COND_INIT 1 - -/* Define to 1 if you have the `pthread_mutexattr_setprotocol' function. */ -#define HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL 1 - -/* Define to 1 if you have the `pthread_mutexattr_setpshared' function. */ -#define HAVE_PTHREAD_MUTEXATTR_SETPSHARED 1 - -/* Define to 1 if you have the `pthread_mutexattr_settype' function. */ -#define HAVE_PTHREAD_MUTEXATTR_SETTYPE 1 - -/* Define to 1 if you have the `pthread_testcancel' function. */ -#define HAVE_PTHREAD_TESTCANCEL 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_PTY_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_READLINE_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_READLINE_HISTORY_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_READLINE_READLINE_H */ - -/* Define to 1 if you have the `round' function. */ -#define HAVE_ROUND 1 - -/* Define to 1 if you have the `roundf' function. */ -#define HAVE_ROUNDF 1 - -/* Define to 1 if you have the `sem_init' function. */ -#define HAVE_SEM_INIT 1 - -/* Define to 1 if you have the `sigaction' function. */ -#define HAVE_SIGACTION 1 - -/* Define if we know a hack to replace siginfo_t->si_addr member. */ -/* #undef HAVE_SIGCONTEXT_SUBTERFUGE */ - -/* Define if your system support extended signals. */ -/* #undef HAVE_SIGINFO_T */ - -/* Define to 1 if you have the `signal' function. */ -#define HAVE_SIGNAL 1 - -/* Define if sa_restorer is available in struct sigaction. */ -/* #undef HAVE_SIGNAL_SA_RESTORER */ - -/* Define if we can ignore the fault (instruction skipping in SIGSEGV - handler). */ -#define HAVE_SIGSEGV_SKIP_INSTRUCTION 1 - -/* Define if slirp library is supported */ -#define HAVE_SLIRP 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_STDLIB_H */ - -/* Define to 1 if you have the `strdup' function. */ -#define HAVE_STRDUP 1 - -/* Define to 1 if you have the `strerror' function. */ -#define HAVE_STRERROR 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_STRING_H */ - -/* Define to 1 if you have the `strlcpy' function. */ -#define HAVE_STRLCPY 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_BITYPES_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_BSDTTY_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_FILIO_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_IOCTL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_MMAN_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_POLL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_SELECT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_SOCKET_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_TYPES_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_WAIT_H 1 - -/* Define to 1 if you have the `task_self' function. */ -/* #undef HAVE_TASK_SELF */ - -/* Define to 1 if you have the `trunc' function. */ -#define HAVE_TRUNC 1 - -/* Define to 1 if you have the `truncf' function. */ -#define HAVE_TRUNCF 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UTIL_H 1 - -/* Define to 1 if you have the `vhangup' function. */ -/* #undef HAVE_VHANGUP */ - -/* Define to 1 if you have the `vm_allocate' function. */ -#define HAVE_VM_ALLOCATE 1 - -/* Define to 1 if you have the `vm_deallocate' function. */ -#define HAVE_VM_DEALLOCATE 1 - -/* Define to 1 if you have the `vm_protect' function. */ -#define HAVE_VM_PROTECT 1 - -/* Define if your system supports Windows exceptions. */ -/* #undef HAVE_WIN32_EXCEPTIONS */ - -/* Define to 1 if you have the `_getpty' function. */ -/* #undef HAVE__GETPTY */ - -/* Define to the floating point format of the host machine. */ -#define HOST_FLOAT_FORMAT IEEE_FLOAT_FORMAT - -/* Define to 1 if the host machine stores floating point numbers in memory - with the word containing the sign bit at the lowest address, or to 0 if it - does it the other way around. This macro should not be defined if the - ordering is the same as for multi-word integers. */ -/* #undef HOST_FLOAT_WORDS_BIG_ENDIAN */ - -/* Define constant offset for Mac address translation */ -/* #undef NATMEM_OFFSET */ - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "Christian.Bauer@uni-mainz.de" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "SheepShaver" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "SheepShaver 2.4" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "SheepShaver" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "2.4" - -/* Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this - system. */ -#define PAGEZERO_HACK 1 - -/* Define as the return type of signal handlers (`int' or `void'). */ -#define RETSIGTYPE void - -/* Define if your system requires sigactions to be reinstalled. */ -/* #undef SIGACTION_NEED_REINSTALL */ - -/* Define if your system requires signals to be reinstalled. */ -/* #undef SIGNAL_NEED_REINSTALL */ - -/* The size of a `double', as computed by sizeof. */ -#define SIZEOF_DOUBLE 8 - -/* The size of a `float', as computed by sizeof. */ -#define SIZEOF_FLOAT 4 - -/* The size of a `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of a `long', as computed by sizeof. */ -#define SIZEOF_LONG 4 - -/* The size of a `long long', as computed by sizeof. */ -#define SIZEOF_LONG_LONG 8 - -/* The size of a `short', as computed by sizeof. */ -#define SIZEOF_SHORT 2 - -/* The size of a `void *', as computed by sizeof. */ -#define SIZEOF_VOID_P 4 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define to 1 if you can safely include both and . */ -#define TIME_WITH_SYS_TIME 1 - -/* Define to 1 if your declares `struct tm'. */ -/* #undef TM_IN_SYS_TIME */ - -/* Define if BSD-style non-blocking I/O is to be used */ -/* #undef USE_FIONBIO */ - -/* Define to enble SDL support. */ -#define USE_SDL 1 - -/* Define to enable SDL audio support */ -#define USE_SDL_AUDIO 1 - -/* Define to enable SDL video graphics support. */ -#define USE_SDL_VIDEO 1 - -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -#define WORDS_BIGENDIAN 1 - -/* Define to 1 if the X Window System is missing or not being used. */ -/* #undef X_DISPLAY_MISSING */ - -/* Number of bits in a file offset, on hosts where this is settable. */ -/* #undef _FILE_OFFSET_BITS */ - -/* Define for large files, on AIX-style hosts. */ -/* #undef _LARGE_FILES */ - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -/* #undef inline */ -#endif - -/* Define to `off_t' if does not define. */ -#define loff_t off_t - -/* Define to `long' if does not define. */ -/* #undef off_t */ - -/* Define to `unsigned' if does not define. */ -/* #undef size_t */ - -/* Define to 'int' if doesn't define. */ -/* #undef socklen_t */ - -#endif /* CONFIG_H */ - diff --git a/SheepShaver/src/MacOSX/config/config-macosx-x86_32.h b/SheepShaver/src/MacOSX/config/config-macosx-x86_32.h deleted file mode 100644 index 030f42a7..00000000 --- a/SheepShaver/src/MacOSX/config/config-macosx-x86_32.h +++ /dev/null @@ -1,527 +0,0 @@ -/* config.h. Generated from config.h.in by configure. */ -/* config.h.in. Generated from configure.ac by autoheader. */ - -#ifndef CONFIG_H -#define CONFIG_H - - -/* Define if building universal (internal helper macro) */ -/* #undef AC_APPLE_UNIVERSAL_BUILD */ - -/* Define if using a PowerPC CPU emulator. */ -#define EMULATED_PPC 1 - -/* Define to enable dyngen engine */ -#define ENABLE_DYNGEN 1 - -/* Define is using ESD. */ -/* #undef ENABLE_ESD */ - -/* Define if using Linux fbdev extension. */ -/* #undef ENABLE_FBDEV_DGA */ - -/* Define if using GTK. */ -/* #undef ENABLE_GTK */ - -/* Define if using "mon". */ -/* #undef ENABLE_MON */ - -/* Define if your system supports TUN/TAP devices. */ -/* #undef ENABLE_TUNTAP */ - -/* Define if using video enabled on SEGV signals. */ -/* #undef ENABLE_VOSF */ - -/* Define if using XFree86 DGA extension. */ -/* #undef ENABLE_XF86_DGA */ - -/* Define if using XFree86 DGA extension. */ -/* #undef ENABLE_XF86_VIDMODE */ - -/* Define to 1 if you have the header file. */ -#define HAVE_ARPA_INET_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_AVAILABILITYMACROS_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_BYTESWAP_H */ - -/* Define to 1 if you have the `ceil' function. */ -#define HAVE_CEIL 1 - -/* Define to 1 if you have the `ceilf' function. */ -#define HAVE_CEILF 1 - -/* Define to 1 if you have the `cfmakeraw' function. */ -#define HAVE_CFMAKERAW 1 - -/* Define to 1 if you have the `clock_gettime' function. */ -/* #undef HAVE_CLOCK_GETTIME */ - -/* Define to 1 if you have the `clock_nanosleep' function. */ -/* #undef HAVE_CLOCK_NANOSLEEP */ - -/* Define if you have /dev/ptmx. */ -/* #undef HAVE_DEV_PTMX */ - -/* Define if you have /dev/ptc. */ -/* #undef HAVE_DEV_PTS_AND_PTC */ - -/* Define to 1 if you have the header file. */ -#define HAVE_DIRENT_H 1 - -/* Define to 1 if you have the `exp2' function. */ -#define HAVE_EXP2 1 - -/* Define to 1 if you have the `exp2f' function. */ -#define HAVE_EXP2F 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FENV_H 1 - -/* Define to 1 if you have the `floor' function. */ -#define HAVE_FLOOR 1 - -/* Define to 1 if you have the `floorf' function. */ -#define HAVE_FLOORF 1 - -/* Define if framework AppKit is available. */ -#define HAVE_FRAMEWORK_APPKIT 1 - -/* Define if framework AudioToolbox is available. */ -#define HAVE_FRAMEWORK_AUDIOTOOLBOX 1 - -/* Define if framework AudioUnit is available. */ -#define HAVE_FRAMEWORK_AUDIOUNIT 1 - -/* Define if framework Carbon is available. */ -#define HAVE_FRAMEWORK_CARBON 1 - -/* Define if framework CoreAudio is available. */ -#define HAVE_FRAMEWORK_COREAUDIO 1 - -/* Define if framework CoreFoundation is available. */ -#define HAVE_FRAMEWORK_COREFOUNDATION 1 - -/* Define if framework IOKit is available. */ -#define HAVE_FRAMEWORK_IOKIT 1 - -/* Define if framework SDL is available. */ -/* #undef HAVE_FRAMEWORK_SDL */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_HISTORY_H */ - -/* Define to 1 if you have the `inet_aton' function. */ -#define HAVE_INET_ATON 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_INTTYPES_H */ - -/* Define to 1 if you have the header - file. */ -#define HAVE_IOKIT_STORAGE_IOBLOCKSTORAGEDEVICE_H 1 - -/* Define to 1 if you have the `curses' library (-lcurses). */ -/* #undef HAVE_LIBCURSES */ - -/* Define to 1 if you have the `c_r' library (-lc_r). */ -/* #undef HAVE_LIBC_R */ - -/* Define to 1 if you have the `Hcurses' library (-lHcurses). */ -/* #undef HAVE_LIBHCURSES */ - -/* Define to 1 if you have the `m' library (-lm). */ -#define HAVE_LIBM 1 - -/* Define to 1 if you have the `ncurses' library (-lncurses). */ -/* #undef HAVE_LIBNCURSES */ - -/* Define to 1 if you have the `posix4' library (-lposix4). */ -/* #undef HAVE_LIBPOSIX4 */ - -/* Define to 1 if you have the `pthread' library (-lpthread). */ -#define HAVE_LIBPTHREAD 1 - -/* Define to 1 if you have the `PTL' library (-lPTL). */ -/* #undef HAVE_LIBPTL */ - -/* Define to 1 if you have the `readline' library (-lreadline). */ -/* #undef HAVE_LIBREADLINE */ - -/* Define to 1 if you have the `termcap' library (-ltermcap). */ -/* #undef HAVE_LIBTERMCAP */ - -/* Define to 1 if you have the `terminfo' library (-lterminfo). */ -/* #undef HAVE_LIBTERMINFO */ - -/* Define to 1 if you have the `termlib' library (-ltermlib). */ -/* #undef HAVE_LIBTERMLIB */ - -/* Define to 1 if you have the `vhd' library (-lvhd). */ -/* #undef HAVE_LIBVHD */ - -/* Define if there is a linker script to relocate the executable above - 0x70000000. */ -#define HAVE_LINKER_SCRIPT 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LINUX_IF_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LINUX_IF_TUN_H */ - -/* Define to 1 if you have the `log2' function. */ -#define HAVE_LOG2 1 - -/* Define to 1 if you have the `log2f' function. */ -#define HAVE_LOG2F 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LOGIN_H */ - -/* Define if your system supports Mach exceptions. */ -#define HAVE_MACH_EXCEPTIONS 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MACH_MACH_INIT_H 1 - -/* Define to 1 if you have the `mach_task_self' function. */ -#define HAVE_MACH_TASK_SELF 1 - -/* Define if your system has a working vm_allocate()-based memory allocator. - */ -#define HAVE_MACH_VM 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MACH_VM_MAP_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_MALLOC_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_MEMORY_H */ - -/* Define to 1 if you have the `mmap' function. */ -#define HAVE_MMAP 1 - -/* Define if defines MAP_ANON and mmap()'ing with MAP_ANON works. - */ -/* #undef HAVE_MMAP_ANON */ - -/* Define if defines MAP_ANONYMOUS and mmap()'ing with - MAP_ANONYMOUS works. */ -/* #undef HAVE_MMAP_ANONYMOUS */ - -/* Define if your system has a working mmap()-based memory allocator. */ -/* #undef HAVE_MMAP_VM */ - -/* Define to 1 if you have the `mprotect' function. */ -#define HAVE_MPROTECT 1 - -/* Define to 1 if you have the `munmap' function. */ -#define HAVE_MUNMAP 1 - -/* Define to 1 if you have the `nanosleep' function. */ -#define HAVE_NANOSLEEP 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_NET_IF_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NET_IF_TUN_H */ - -/* Define if you are on NEWS-OS (additions from openssh-3.2.2p1, for - sshpty.c). */ -/* #undef HAVE_NEWS4 */ - -/* Define to 1 if you have the `poll' function. */ -#define HAVE_POLL 1 - -/* Define if pthreads are available. */ -#define HAVE_PTHREADS 1 - -/* Define to 1 if you have the `pthread_cancel' function. */ -#define HAVE_PTHREAD_CANCEL 1 - -/* Define to 1 if you have the `pthread_cond_init' function. */ -#define HAVE_PTHREAD_COND_INIT 1 - -/* Define to 1 if you have the `pthread_mutexattr_setprotocol' function. */ -#define HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL 1 - -/* Define to 1 if you have the `pthread_mutexattr_setpshared' function. */ -#define HAVE_PTHREAD_MUTEXATTR_SETPSHARED 1 - -/* Define to 1 if you have the `pthread_mutexattr_settype' function. */ -#define HAVE_PTHREAD_MUTEXATTR_SETTYPE 1 - -/* Define to 1 if you have the `pthread_testcancel' function. */ -#define HAVE_PTHREAD_TESTCANCEL 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_PTY_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_READLINE_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_READLINE_HISTORY_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_READLINE_READLINE_H */ - -/* Define to 1 if you have the `round' function. */ -#define HAVE_ROUND 1 - -/* Define to 1 if you have the `roundf' function. */ -#define HAVE_ROUNDF 1 - -/* Define to 1 if you have the `sem_init' function. */ -#define HAVE_SEM_INIT 1 - -/* Define to 1 if you have the `sigaction' function. */ -#define HAVE_SIGACTION 1 - -/* Define if we know a hack to replace siginfo_t->si_addr member. */ -/* #undef HAVE_SIGCONTEXT_SUBTERFUGE */ - -/* Define if your system support extended signals. */ -/* #undef HAVE_SIGINFO_T */ - -/* Define to 1 if you have the `signal' function. */ -#define HAVE_SIGNAL 1 - -/* Define if sa_restorer is available in struct sigaction. */ -/* #undef HAVE_SIGNAL_SA_RESTORER */ - -/* Define if we can ignore the fault (instruction skipping in SIGSEGV - handler). */ -#define HAVE_SIGSEGV_SKIP_INSTRUCTION 1 - -/* Define if slirp library is supported */ -#define HAVE_SLIRP 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_STDLIB_H */ - -/* Define to 1 if you have the `strdup' function. */ -#define HAVE_STRDUP 1 - -/* Define to 1 if you have the `strerror' function. */ -#define HAVE_STRERROR 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_STRING_H */ - -/* Define to 1 if you have the `strlcpy' function. */ -#define HAVE_STRLCPY 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_BITYPES_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_BSDTTY_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_FILIO_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_IOCTL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_MMAN_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_POLL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_SELECT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_SOCKET_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_TYPES_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_WAIT_H 1 - -/* Define to 1 if you have the `task_self' function. */ -/* #undef HAVE_TASK_SELF */ - -/* Define to 1 if you have the `trunc' function. */ -#define HAVE_TRUNC 1 - -/* Define to 1 if you have the `truncf' function. */ -#define HAVE_TRUNCF 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UTIL_H 1 - -/* Define to 1 if you have the `vhangup' function. */ -/* #undef HAVE_VHANGUP */ - -/* Define to 1 if you have the `vm_allocate' function. */ -#define HAVE_VM_ALLOCATE 1 - -/* Define to 1 if you have the `vm_deallocate' function. */ -#define HAVE_VM_DEALLOCATE 1 - -/* Define to 1 if you have the `vm_protect' function. */ -#define HAVE_VM_PROTECT 1 - -/* Define if your system supports Windows exceptions. */ -/* #undef HAVE_WIN32_EXCEPTIONS */ - -/* Define to 1 if you have the `_getpty' function. */ -/* #undef HAVE__GETPTY */ - -/* Define to the floating point format of the host machine. */ -#define HOST_FLOAT_FORMAT IEEE_FLOAT_FORMAT - -/* Define to 1 if the host machine stores floating point numbers in memory - with the word containing the sign bit at the lowest address, or to 0 if it - does it the other way around. This macro should not be defined if the - ordering is the same as for multi-word integers. */ -/* #undef HOST_FLOAT_WORDS_BIG_ENDIAN */ - -/* Define constant offset for Mac address translation */ -/* #undef NATMEM_OFFSET */ - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "Christian.Bauer@uni-mainz.de" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "SheepShaver" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "SheepShaver 2.4" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "SheepShaver" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "2.4" - -/* Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this - system. */ -#define PAGEZERO_HACK 1 - -/* Define as the return type of signal handlers (`int' or `void'). */ -#define RETSIGTYPE void - -/* Define if your system requires sigactions to be reinstalled. */ -/* #undef SIGACTION_NEED_REINSTALL */ - -/* Define if your system requires signals to be reinstalled. */ -/* #undef SIGNAL_NEED_REINSTALL */ - -/* The size of `double', as computed by sizeof. */ -#define SIZEOF_DOUBLE 8 - -/* The size of `float', as computed by sizeof. */ -#define SIZEOF_FLOAT 4 - -/* The size of `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of `long', as computed by sizeof. */ -#define SIZEOF_LONG 4 - -/* The size of `long long', as computed by sizeof. */ -#define SIZEOF_LONG_LONG 8 - -/* The size of `short', as computed by sizeof. */ -#define SIZEOF_SHORT 2 - -/* The size of `void *', as computed by sizeof. */ -#define SIZEOF_VOID_P 4 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define to 1 if you can safely include both and . */ -#define TIME_WITH_SYS_TIME 1 - -/* Define to 1 if your declares `struct tm'. */ -/* #undef TM_IN_SYS_TIME */ - -/* Define if BSD-style non-blocking I/O is to be used */ -/* #undef USE_FIONBIO */ - -/* Define to enble SDL support. */ -#define USE_SDL 1 - -/* Define to enable SDL audio support */ -#define USE_SDL_AUDIO 1 - -/* Define to enable SDL video graphics support. */ -#define USE_SDL_VIDEO 1 - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -/* # undef WORDS_BIGENDIAN */ -# endif -#endif - -/* Define to 1 if the X Window System is missing or not being used. */ -/* #undef X_DISPLAY_MISSING */ - -/* Number of bits in a file offset, on hosts where this is settable. */ -/* #undef _FILE_OFFSET_BITS */ - -/* Define for large files, on AIX-style hosts. */ -/* #undef _LARGE_FILES */ - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -/* #undef inline */ -#endif - -/* Define to `off_t' if does not define. */ -#define loff_t off_t - -/* Define to `long int' if does not define. */ -/* #undef off_t */ - -/* Define to `unsigned int' if does not define. */ -/* #undef size_t */ - -/* Define to 'int' if doesn't define. */ -/* #undef socklen_t */ - -#endif /* CONFIG_H */ - diff --git a/SheepShaver/src/MacOSX/config/config-macosx-x86_64.h b/SheepShaver/src/MacOSX/config/config-macosx-x86_64.h deleted file mode 100644 index 760e6450..00000000 --- a/SheepShaver/src/MacOSX/config/config-macosx-x86_64.h +++ /dev/null @@ -1,527 +0,0 @@ -/* config.h. Generated from config.h.in by configure. */ -/* config.h.in. Generated from configure.ac by autoheader. */ - -#ifndef CONFIG_H -#define CONFIG_H - - -/* Define if building universal (internal helper macro) */ -/* #undef AC_APPLE_UNIVERSAL_BUILD */ - -/* Define if using a PowerPC CPU emulator. */ -#define EMULATED_PPC 1 - -/* Define to enable dyngen engine */ -#define ENABLE_DYNGEN 1 - -/* Define is using ESD. */ -/* #undef ENABLE_ESD */ - -/* Define if using Linux fbdev extension. */ -/* #undef ENABLE_FBDEV_DGA */ - -/* Define if using GTK. */ -/* #undef ENABLE_GTK */ - -/* Define if using "mon". */ -/* #undef ENABLE_MON */ - -/* Define if your system supports TUN/TAP devices. */ -/* #undef ENABLE_TUNTAP */ - -/* Define if using video enabled on SEGV signals. */ -/* #undef ENABLE_VOSF */ - -/* Define if using XFree86 DGA extension. */ -/* #undef ENABLE_XF86_DGA */ - -/* Define if using XFree86 DGA extension. */ -/* #undef ENABLE_XF86_VIDMODE */ - -/* Define to 1 if you have the header file. */ -#define HAVE_ARPA_INET_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_AVAILABILITYMACROS_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_BYTESWAP_H */ - -/* Define to 1 if you have the `ceil' function. */ -#define HAVE_CEIL 1 - -/* Define to 1 if you have the `ceilf' function. */ -#define HAVE_CEILF 1 - -/* Define to 1 if you have the `cfmakeraw' function. */ -#define HAVE_CFMAKERAW 1 - -/* Define to 1 if you have the `clock_gettime' function. */ -/* #undef HAVE_CLOCK_GETTIME */ - -/* Define to 1 if you have the `clock_nanosleep' function. */ -/* #undef HAVE_CLOCK_NANOSLEEP */ - -/* Define if you have /dev/ptmx. */ -/* #undef HAVE_DEV_PTMX */ - -/* Define if you have /dev/ptc. */ -/* #undef HAVE_DEV_PTS_AND_PTC */ - -/* Define to 1 if you have the header file. */ -#define HAVE_DIRENT_H 1 - -/* Define to 1 if you have the `exp2' function. */ -#define HAVE_EXP2 1 - -/* Define to 1 if you have the `exp2f' function. */ -#define HAVE_EXP2F 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FENV_H 1 - -/* Define to 1 if you have the `floor' function. */ -#define HAVE_FLOOR 1 - -/* Define to 1 if you have the `floorf' function. */ -#define HAVE_FLOORF 1 - -/* Define if framework AppKit is available. */ -#define HAVE_FRAMEWORK_APPKIT 1 - -/* Define if framework AudioToolbox is available. */ -#define HAVE_FRAMEWORK_AUDIOTOOLBOX 1 - -/* Define if framework AudioUnit is available. */ -#define HAVE_FRAMEWORK_AUDIOUNIT 1 - -/* Define if framework Carbon is available. */ -#define HAVE_FRAMEWORK_CARBON 1 - -/* Define if framework CoreAudio is available. */ -#define HAVE_FRAMEWORK_COREAUDIO 1 - -/* Define if framework CoreFoundation is available. */ -#define HAVE_FRAMEWORK_COREFOUNDATION 1 - -/* Define if framework IOKit is available. */ -#define HAVE_FRAMEWORK_IOKIT 1 - -/* Define if framework SDL is available. */ -/* #undef HAVE_FRAMEWORK_SDL */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_HISTORY_H */ - -/* Define to 1 if you have the `inet_aton' function. */ -#define HAVE_INET_ATON 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_INTTYPES_H */ - -/* Define to 1 if you have the header - file. */ -#define HAVE_IOKIT_STORAGE_IOBLOCKSTORAGEDEVICE_H 1 - -/* Define to 1 if you have the `curses' library (-lcurses). */ -/* #undef HAVE_LIBCURSES */ - -/* Define to 1 if you have the `c_r' library (-lc_r). */ -/* #undef HAVE_LIBC_R */ - -/* Define to 1 if you have the `Hcurses' library (-lHcurses). */ -/* #undef HAVE_LIBHCURSES */ - -/* Define to 1 if you have the `m' library (-lm). */ -#define HAVE_LIBM 1 - -/* Define to 1 if you have the `ncurses' library (-lncurses). */ -/* #undef HAVE_LIBNCURSES */ - -/* Define to 1 if you have the `posix4' library (-lposix4). */ -/* #undef HAVE_LIBPOSIX4 */ - -/* Define to 1 if you have the `pthread' library (-lpthread). */ -#define HAVE_LIBPTHREAD 1 - -/* Define to 1 if you have the `PTL' library (-lPTL). */ -/* #undef HAVE_LIBPTL */ - -/* Define to 1 if you have the `readline' library (-lreadline). */ -/* #undef HAVE_LIBREADLINE */ - -/* Define to 1 if you have the `termcap' library (-ltermcap). */ -/* #undef HAVE_LIBTERMCAP */ - -/* Define to 1 if you have the `terminfo' library (-lterminfo). */ -/* #undef HAVE_LIBTERMINFO */ - -/* Define to 1 if you have the `termlib' library (-ltermlib). */ -/* #undef HAVE_LIBTERMLIB */ - -/* Define to 1 if you have the `vhd' library (-lvhd). */ -/* #undef HAVE_LIBVHD */ - -/* Define if there is a linker script to relocate the executable above - 0x70000000. */ -#define HAVE_LINKER_SCRIPT 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LINUX_IF_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LINUX_IF_TUN_H */ - -/* Define to 1 if you have the `log2' function. */ -#define HAVE_LOG2 1 - -/* Define to 1 if you have the `log2f' function. */ -#define HAVE_LOG2F 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LOGIN_H */ - -/* Define if your system supports Mach exceptions. */ -#define HAVE_MACH_EXCEPTIONS 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MACH_MACH_INIT_H 1 - -/* Define to 1 if you have the `mach_task_self' function. */ -#define HAVE_MACH_TASK_SELF 1 - -/* Define if your system has a working vm_allocate()-based memory allocator. - */ -#define HAVE_MACH_VM 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MACH_VM_MAP_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_MALLOC_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_MEMORY_H */ - -/* Define to 1 if you have the `mmap' function. */ -#define HAVE_MMAP 1 - -/* Define if defines MAP_ANON and mmap()'ing with MAP_ANON works. - */ -/* #undef HAVE_MMAP_ANON */ - -/* Define if defines MAP_ANONYMOUS and mmap()'ing with - MAP_ANONYMOUS works. */ -/* #undef HAVE_MMAP_ANONYMOUS */ - -/* Define if your system has a working mmap()-based memory allocator. */ -/* #undef HAVE_MMAP_VM */ - -/* Define to 1 if you have the `mprotect' function. */ -#define HAVE_MPROTECT 1 - -/* Define to 1 if you have the `munmap' function. */ -#define HAVE_MUNMAP 1 - -/* Define to 1 if you have the `nanosleep' function. */ -#define HAVE_NANOSLEEP 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_NET_IF_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NET_IF_TUN_H */ - -/* Define if you are on NEWS-OS (additions from openssh-3.2.2p1, for - sshpty.c). */ -/* #undef HAVE_NEWS4 */ - -/* Define to 1 if you have the `poll' function. */ -#define HAVE_POLL 1 - -/* Define if pthreads are available. */ -#define HAVE_PTHREADS 1 - -/* Define to 1 if you have the `pthread_cancel' function. */ -#define HAVE_PTHREAD_CANCEL 1 - -/* Define to 1 if you have the `pthread_cond_init' function. */ -#define HAVE_PTHREAD_COND_INIT 1 - -/* Define to 1 if you have the `pthread_mutexattr_setprotocol' function. */ -#define HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL 1 - -/* Define to 1 if you have the `pthread_mutexattr_setpshared' function. */ -#define HAVE_PTHREAD_MUTEXATTR_SETPSHARED 1 - -/* Define to 1 if you have the `pthread_mutexattr_settype' function. */ -#define HAVE_PTHREAD_MUTEXATTR_SETTYPE 1 - -/* Define to 1 if you have the `pthread_testcancel' function. */ -#define HAVE_PTHREAD_TESTCANCEL 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_PTY_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_READLINE_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_READLINE_HISTORY_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_READLINE_READLINE_H */ - -/* Define to 1 if you have the `round' function. */ -#define HAVE_ROUND 1 - -/* Define to 1 if you have the `roundf' function. */ -#define HAVE_ROUNDF 1 - -/* Define to 1 if you have the `sem_init' function. */ -#define HAVE_SEM_INIT 1 - -/* Define to 1 if you have the `sigaction' function. */ -#define HAVE_SIGACTION 1 - -/* Define if we know a hack to replace siginfo_t->si_addr member. */ -/* #undef HAVE_SIGCONTEXT_SUBTERFUGE */ - -/* Define if your system support extended signals. */ -/* #undef HAVE_SIGINFO_T */ - -/* Define to 1 if you have the `signal' function. */ -#define HAVE_SIGNAL 1 - -/* Define if sa_restorer is available in struct sigaction. */ -/* #undef HAVE_SIGNAL_SA_RESTORER */ - -/* Define if we can ignore the fault (instruction skipping in SIGSEGV - handler). */ -#define HAVE_SIGSEGV_SKIP_INSTRUCTION 1 - -/* Define if slirp library is supported */ -#define HAVE_SLIRP 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_STDLIB_H */ - -/* Define to 1 if you have the `strdup' function. */ -#define HAVE_STRDUP 1 - -/* Define to 1 if you have the `strerror' function. */ -#define HAVE_STRERROR 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_STRING_H */ - -/* Define to 1 if you have the `strlcpy' function. */ -#define HAVE_STRLCPY 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_BITYPES_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_BSDTTY_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_FILIO_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_IOCTL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_MMAN_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_POLL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_SELECT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_SOCKET_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_TYPES_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_WAIT_H 1 - -/* Define to 1 if you have the `task_self' function. */ -/* #undef HAVE_TASK_SELF */ - -/* Define to 1 if you have the `trunc' function. */ -#define HAVE_TRUNC 1 - -/* Define to 1 if you have the `truncf' function. */ -#define HAVE_TRUNCF 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UTIL_H 1 - -/* Define to 1 if you have the `vhangup' function. */ -/* #undef HAVE_VHANGUP */ - -/* Define to 1 if you have the `vm_allocate' function. */ -#define HAVE_VM_ALLOCATE 1 - -/* Define to 1 if you have the `vm_deallocate' function. */ -#define HAVE_VM_DEALLOCATE 1 - -/* Define to 1 if you have the `vm_protect' function. */ -#define HAVE_VM_PROTECT 1 - -/* Define if your system supports Windows exceptions. */ -/* #undef HAVE_WIN32_EXCEPTIONS */ - -/* Define to 1 if you have the `_getpty' function. */ -/* #undef HAVE__GETPTY */ - -/* Define to the floating point format of the host machine. */ -#define HOST_FLOAT_FORMAT IEEE_FLOAT_FORMAT - -/* Define to 1 if the host machine stores floating point numbers in memory - with the word containing the sign bit at the lowest address, or to 0 if it - does it the other way around. This macro should not be defined if the - ordering is the same as for multi-word integers. */ -/* #undef HOST_FLOAT_WORDS_BIG_ENDIAN */ - -/* Define constant offset for Mac address translation */ -/* #undef NATMEM_OFFSET */ - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "Christian.Bauer@uni-mainz.de" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "SheepShaver" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "SheepShaver 2.4" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "SheepShaver" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "2.4" - -/* Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this - system. */ -#define PAGEZERO_HACK 1 - -/* Define as the return type of signal handlers (`int' or `void'). */ -#define RETSIGTYPE void - -/* Define if your system requires sigactions to be reinstalled. */ -/* #undef SIGACTION_NEED_REINSTALL */ - -/* Define if your system requires signals to be reinstalled. */ -/* #undef SIGNAL_NEED_REINSTALL */ - -/* The size of `double', as computed by sizeof. */ -#define SIZEOF_DOUBLE 8 - -/* The size of `float', as computed by sizeof. */ -#define SIZEOF_FLOAT 4 - -/* The size of `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of `long', as computed by sizeof. */ -#define SIZEOF_LONG 8 - -/* The size of `long long', as computed by sizeof. */ -#define SIZEOF_LONG_LONG 8 - -/* The size of `short', as computed by sizeof. */ -#define SIZEOF_SHORT 2 - -/* The size of `void *', as computed by sizeof. */ -#define SIZEOF_VOID_P 8 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define to 1 if you can safely include both and . */ -#define TIME_WITH_SYS_TIME 1 - -/* Define to 1 if your declares `struct tm'. */ -/* #undef TM_IN_SYS_TIME */ - -/* Define if BSD-style non-blocking I/O is to be used */ -/* #undef USE_FIONBIO */ - -/* Define to enble SDL support. */ -#define USE_SDL 1 - -/* Define to enable SDL audio support */ -#define USE_SDL_AUDIO 1 - -/* Define to enable SDL video graphics support. */ -#define USE_SDL_VIDEO 1 - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -/* # undef WORDS_BIGENDIAN */ -# endif -#endif - -/* Define to 1 if the X Window System is missing or not being used. */ -/* #undef X_DISPLAY_MISSING */ - -/* Number of bits in a file offset, on hosts where this is settable. */ -/* #undef _FILE_OFFSET_BITS */ - -/* Define for large files, on AIX-style hosts. */ -/* #undef _LARGE_FILES */ - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -/* #undef inline */ -#endif - -/* Define to `off_t' if does not define. */ -#define loff_t off_t - -/* Define to `long int' if does not define. */ -/* #undef off_t */ - -/* Define to `unsigned int' if does not define. */ -/* #undef size_t */ - -/* Define to 'int' if doesn't define. */ -/* #undef socklen_t */ - -#endif /* CONFIG_H */ - diff --git a/SheepShaver/src/MacOSX/config/config.h b/SheepShaver/src/MacOSX/config/config.h deleted file mode 100644 index bb5a0781..00000000 --- a/SheepShaver/src/MacOSX/config/config.h +++ /dev/null @@ -1,9 +0,0 @@ -#if defined(__x86_64__) - #include "config-macosx-x86_64.h" -#elif defined(__i386__) - #include "config-macosx-x86_32.h" -#elif defined(__ppc__) - #include "config-macosx-ppc_32.h" -#else - #error Unknown platform -#endif \ No newline at end of file diff --git a/SheepShaver/src/MacOSX/extfs_macosx.cpp b/SheepShaver/src/MacOSX/extfs_macosx.cpp deleted file mode 120000 index 1afcd4b1..00000000 --- a/SheepShaver/src/MacOSX/extfs_macosx.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/MacOSX/extfs_macosx.cpp \ No newline at end of file diff --git a/SheepShaver/src/MacOSX/macos_util_macosx.h b/SheepShaver/src/MacOSX/macos_util_macosx.h deleted file mode 120000 index cef14874..00000000 --- a/SheepShaver/src/MacOSX/macos_util_macosx.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/MacOSX/macos_util_macosx.h \ No newline at end of file diff --git a/SheepShaver/src/MacOSX/prefs_macosx.mm b/SheepShaver/src/MacOSX/prefs_macosx.mm deleted file mode 100644 index e8b77924..00000000 --- a/SheepShaver/src/MacOSX/prefs_macosx.mm +++ /dev/null @@ -1,131 +0,0 @@ -/* - * $Id$ - * - * prefs_macosx.mm - Enables access to SheepShaver preferences while - * SheepShaver is running (on Mac OS X). - * - * Copyright (C) 2007 Alexei Svitkine - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#include "sysdeps.h" - -// The _UINT64 define is needed to guard against a typedef mismatch with Snow Leopard headers. -#define _UINT64 - -#include -#include "VMSettingsController.h" - - -@interface SheepShaverMain : NSObject -{ - NSArray *nibObjects; - NSWindow *prefsWindow; -} -@end - -@implementation SheepShaverMain - - -- (NSArray*) loadPrefsNibFile -{ - NSNib *nib = [[NSNib alloc] initWithNibNamed:@"VMSettingsWindow" bundle:nil]; - NSArray *objects = nil; - - if (![nib instantiateNibWithOwner:[VMSettingsController sharedInstance] topLevelObjects:&objects]) { - NSLog(@"Could not load Prefs NIB file!\n"); - return nil; - } - - NSLog(@"%d objects loaded\n", [objects count]); - - // Release the raw nib data. - [nib release]; - - // Release the top-level objects so that they are just owned by the array. - [objects makeObjectsPerformSelector:@selector(release)]; - - prefsWindow = nil; - for (int i = 0; i < [objects count]; i++) { - NSObject *object = [objects objectAtIndex:i]; - NSLog(@"Got %@", object); - - if ([object isKindOfClass:[NSWindow class]]) { - prefsWindow = (NSWindow *) object; - break; - } - } - - if (prefsWindow == nil) { - NSLog(@"Could not find NSWindow in Prefs NIB file!\n"); - return nil; - } - - return objects; -} - - -- (void) openPreferences:(id)sender -{ - NSAutoreleasePool *pool; - - if (nibObjects == nil) { - nibObjects = [self loadPrefsNibFile]; - if (nibObjects == nil) - return; - [nibObjects retain]; - } - - pool = [[NSAutoreleasePool alloc] init]; - [[VMSettingsController sharedInstance] setupGUI]; - [NSApp runModalForWindow:prefsWindow]; - [pool release]; -} - -@end - -/* - * Initialization - */ - -void prefs_init(void) -{ - NSAutoreleasePool *pool; - NSMenu *appMenu; - NSMenuItem *menuItem; - - pool = [[NSAutoreleasePool alloc] init]; - - appMenu = [[[NSApp mainMenu] itemAtIndex:0] submenu]; - menuItem = [[NSMenuItem alloc] initWithTitle:@"Preferences..." action:@selector(openPreferences:) keyEquivalent:@","]; - [appMenu insertItem:menuItem atIndex:2]; - [appMenu insertItem:[NSMenuItem separatorItem] atIndex:3]; - [menuItem release]; - - [NSApp setDelegate:[[SheepShaverMain alloc] init]]; - - [pool release]; -} - - -/* - * Deinitialization - */ - -void prefs_exit(void) -{ -} diff --git a/SheepShaver/src/MacOSX/sys_darwin.cpp b/SheepShaver/src/MacOSX/sys_darwin.cpp deleted file mode 120000 index 28b80318..00000000 --- a/SheepShaver/src/MacOSX/sys_darwin.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/MacOSX/sys_darwin.cpp \ No newline at end of file diff --git a/SheepShaver/src/MacOSX/utils_macosx.h b/SheepShaver/src/MacOSX/utils_macosx.h deleted file mode 120000 index c8777733..00000000 --- a/SheepShaver/src/MacOSX/utils_macosx.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/MacOSX/utils_macosx.h \ No newline at end of file diff --git a/SheepShaver/src/MacOSX/utils_macosx.mm b/SheepShaver/src/MacOSX/utils_macosx.mm deleted file mode 120000 index 19064958..00000000 --- a/SheepShaver/src/MacOSX/utils_macosx.mm +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/MacOSX/utils_macosx.mm \ No newline at end of file diff --git a/SheepShaver/src/SDL b/SheepShaver/src/SDL deleted file mode 120000 index 48cb61eb..00000000 --- a/SheepShaver/src/SDL +++ /dev/null @@ -1 +0,0 @@ -../../BasiliskII/src/SDL \ No newline at end of file diff --git a/SheepShaver/src/Unix/.gitignore b/SheepShaver/src/Unix/.gitignore deleted file mode 100644 index 0461f22e..00000000 --- a/SheepShaver/src/Unix/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -# Object files -obj/* -SheepShaver - -# Autotools generated files -Makefile -aclocal.m4 -autom4te.cache/* -config.h -config.h.in -config.log -config.status -configure - -# Generated files for CPU emulation -basic-dyngen-ops.hpp -ppc-dyngen-ops.hpp -ppc-execute-impl.cpp -dyngen - -# Generated files from the Xcode build -basic-dyngen-ops-x86_32.hpp -basic-dyngen-ops-x86_64.hpp -ppc-dyngen-ops-x86_32.hpp -ppc-dyngen-ops-x86_64.hpp diff --git a/SheepShaver/src/Unix/Darwin/.gitignore b/SheepShaver/src/Unix/Darwin/.gitignore deleted file mode 100644 index 0535c467..00000000 --- a/SheepShaver/src/Unix/Darwin/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Darwin built utils -lowmem -pagezero diff --git a/SheepShaver/src/Unix/Darwin/lowmem.c b/SheepShaver/src/Unix/Darwin/lowmem.c deleted file mode 120000 index 7e0a359c..00000000 --- a/SheepShaver/src/Unix/Darwin/lowmem.c +++ /dev/null @@ -1 +0,0 @@ -../../../../BasiliskII/src/Unix/Darwin/lowmem.c \ No newline at end of file diff --git a/SheepShaver/src/Unix/Darwin/mkstandalone b/SheepShaver/src/Unix/Darwin/mkstandalone deleted file mode 120000 index acfe13f6..00000000 --- a/SheepShaver/src/Unix/Darwin/mkstandalone +++ /dev/null @@ -1 +0,0 @@ -../../../../BasiliskII/src/Unix/Darwin/mkstandalone \ No newline at end of file diff --git a/SheepShaver/src/Unix/Darwin/pagezero.c b/SheepShaver/src/Unix/Darwin/pagezero.c deleted file mode 120000 index ae53c815..00000000 --- a/SheepShaver/src/Unix/Darwin/pagezero.c +++ /dev/null @@ -1 +0,0 @@ -../../../../BasiliskII/src/Unix/Darwin/pagezero.c \ No newline at end of file diff --git a/SheepShaver/src/Unix/Darwin/testlmem.sh b/SheepShaver/src/Unix/Darwin/testlmem.sh deleted file mode 120000 index 1137ef89..00000000 --- a/SheepShaver/src/Unix/Darwin/testlmem.sh +++ /dev/null @@ -1 +0,0 @@ -../../../../BasiliskII/src/Unix/Darwin/testlmem.sh \ No newline at end of file diff --git a/SheepShaver/src/Unix/Irix/audio_irix.cpp b/SheepShaver/src/Unix/Irix/audio_irix.cpp deleted file mode 120000 index 2e7ef88f..00000000 --- a/SheepShaver/src/Unix/Irix/audio_irix.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../../BasiliskII/src/Unix/Irix/audio_irix.cpp \ No newline at end of file diff --git a/SheepShaver/src/Unix/Linux/NetDriver b/SheepShaver/src/Unix/Linux/NetDriver deleted file mode 120000 index 6e756eb3..00000000 --- a/SheepShaver/src/Unix/Linux/NetDriver +++ /dev/null @@ -1 +0,0 @@ -../../../../BasiliskII/src/Unix/Linux/NetDriver \ No newline at end of file diff --git a/SheepShaver/src/Unix/Linux/scsi_linux.cpp b/SheepShaver/src/Unix/Linux/scsi_linux.cpp deleted file mode 120000 index 9ebba5fd..00000000 --- a/SheepShaver/src/Unix/Linux/scsi_linux.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../../BasiliskII/src/Unix/Linux/scsi_linux.cpp \ No newline at end of file diff --git a/SheepShaver/src/Unix/Linux/sheepthreads.c b/SheepShaver/src/Unix/Linux/sheepthreads.c deleted file mode 100644 index a286d067..00000000 --- a/SheepShaver/src/Unix/Linux/sheepthreads.c +++ /dev/null @@ -1,445 +0,0 @@ -/* - * sheepthreads.c - Minimal pthreads implementation (libpthreads doesn't - * like nonstandard stacks) - * - * SheepShaver (C) 1997-2005 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NOTES: - * - pthread_cancel() kills the thread immediately - * - Semaphores are VERY restricted: the only supported use is to have one - * thread sem_wait() on the semaphore while other threads sem_post() it - * (i.e. to use the semaphore as a signal) - */ - -#include -#include -#include -#include -#include -#include -#include - - -/* Thread stack size */ -#define STACK_SIZE 65536 - -/* From asm_linux.S */ -extern int atomic_add(int *var, int add); -extern int atomic_and(int *var, int and); -extern int atomic_or(int *var, int or); -extern int test_and_set(int *var, int val); - -/* Linux kernel calls */ -extern int __clone(int (*fn)(void *), void *, int, void *); - -/* libc no longer provides struct _pthread_fastlock in pthread.h */ -struct fastlock { - int status; - int spinlock; -}; - -typedef struct { - struct fastlock sem_lock; - int sem_value; - int sem_waiting; -} sem_t; - -#define SEM_VALUE_MAX 64 - -/* Wait for "clone" children only (Linux 2.4+ specific) */ -#ifndef __WCLONE -#define __WCLONE 0 -#endif - - -/* - * Return pthread ID of self - */ - -pthread_t pthread_self(void) -{ - return getpid(); -} - - -/* - * Test whether two pthread IDs are equal - */ - -int pthread_equal(pthread_t t1, pthread_t t2) -{ - return t1 == t2; -} - - -/* - * Send signal to thread - */ - -int pthread_kill(pthread_t thread, int sig) -{ - if (kill(thread, sig) == -1) - return errno; - else - return 0; -} - - -/* - * Create pthread - */ - -struct new_thread { - void *(*fn)(void *); - void *arg; -}; - -static int start_thread(void *arg) -{ - struct new_thread *nt = (struct new_thread *)arg; - nt->fn(nt->arg); - return 0; -} - -int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg) -{ - struct new_thread *nt; - void *stack; - int pid; - - nt = (struct new_thread *)malloc(sizeof(struct new_thread)); - nt->fn = start_routine; - nt->arg = arg; - stack = malloc(STACK_SIZE); - - pid = __clone(start_thread, (char *)stack + STACK_SIZE - 16, CLONE_VM | CLONE_FS | CLONE_FILES, nt); - if (pid == -1) { - free(stack); - free(nt); - return errno; - } else { - *thread = pid; - return 0; - } -} - - -/* - * Join pthread - */ - -int pthread_join(pthread_t thread, void **ret) -{ - do { - if (waitpid(thread, NULL, __WCLONE) >= 0); - break; - } while (errno == EINTR); - if (ret) - *ret = NULL; - return 0; -} - - -/* - * Cancel thread - */ - -int pthread_cancel(pthread_t thread) -{ - kill(thread, SIGINT); - return 0; -} - - -/* - * Test for cancellation - */ - -void pthread_testcancel(void) -{ -} - - -/* - * Spinlocks - */ - -/* For multiprocessor systems, we want to ensure all memory accesses - are completed before we reset a lock. On other systems, we still - need to make sure that the compiler has flushed everything to memory. */ -#define MEMORY_BARRIER() __asm__ __volatile__ ("sync" : : : "memory") - -static void fastlock_init(struct fastlock *lock) -{ - lock->status = 0; - lock->spinlock = 0; -} - -static int fastlock_try_acquire(struct fastlock *lock) -{ - int res = EBUSY; - if (test_and_set(&lock->spinlock, 1) == 0) { - if (lock->status == 0) { - lock->status = 1; - MEMORY_BARRIER(); - res = 0; - } - lock->spinlock = 0; - } - return res; -} - -static void fastlock_acquire(struct fastlock *lock) -{ - MEMORY_BARRIER(); - while (test_and_set(&lock->spinlock, 1)) - usleep(0); -} - -static void fastlock_release(struct fastlock *lock) -{ - MEMORY_BARRIER(); - lock->spinlock = 0; - __asm__ __volatile__ ("" : "=m" (lock->spinlock) : "m" (lock->spinlock)); -} - - -/* - * Initialize mutex - */ - -int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *mutex_attr) -{ - fastlock_init((struct fastlock *)mutex); - return 0; -} - - -/* - * Destroy mutex - */ - -int pthread_mutex_destroy(pthread_mutex_t *mutex) -{ - return (((struct fastlock *)mutex)->status != 0) ? EBUSY : 0; -} - - -/* - * Lock mutex - */ - -int pthread_mutex_lock(pthread_mutex_t *mutex) -{ - fastlock_acquire((struct fastlock *)mutex); - return 0; -} - - -/* - * Try to lock mutex - */ - -int pthread_mutex_trylock(pthread_mutex_t *mutex) -{ - return fastlock_try_acquire((struct fastlock *)mutex); -} - - -/* - * Unlock mutex - */ - -int pthread_mutex_unlock(pthread_mutex_t *mutex) -{ - fastlock_release((struct fastlock *)mutex); - return 0; -} - - -/* - * Create mutex attribute - */ - -int pthread_mutexattr_init(pthread_mutexattr_t *attr) -{ - return 0; -} - - -/* - * Destroy mutex attribute - */ - -int pthread_mutexattr_destroy(pthread_mutexattr_t *attr) -{ - return 0; -} - - -/* - * Init semaphore - */ - -int sem_init(sem_t *sem, int pshared, unsigned int value) -{ - if (sem == NULL || value > SEM_VALUE_MAX) { - errno = EINVAL; - return -1; - } - if (pshared) { - errno = ENOSYS; - return -1; - } - fastlock_init(&sem->sem_lock); - sem->sem_value = value; - sem->sem_waiting = 0; - return 0; -} - - -/* - * Delete remaphore - */ - -int sem_destroy(sem_t *sem) -{ - if (sem == NULL) { - errno = EINVAL; - return -1; - } - if (sem->sem_waiting) { - errno = EBUSY; - return -1; - } - sem->sem_value = 0; - sem->sem_waiting = 0; - return 0; -} - - -/* - * Wait on semaphore - */ - -int sem_wait(sem_t *sem) -{ - if (sem == NULL) { - errno = EINVAL; - return -1; - } - fastlock_acquire(&sem->sem_lock); - if (sem->sem_value > 0) { - sem->sem_value--; - fastlock_release(&sem->sem_lock); - return 0; - } - sem->sem_waiting++; - while (sem->sem_value == 0) { - fastlock_release(&sem->sem_lock); - usleep(0); - fastlock_acquire(&sem->sem_lock); - } - sem->sem_value--; - fastlock_release(&sem->sem_lock); - return 0; -} - - -/* - * Post semaphore - */ - -int sem_post(sem_t *sem) -{ - if (sem == NULL) { - errno = EINVAL; - return -1; - } - fastlock_acquire(&sem->sem_lock); - if (sem->sem_waiting) - sem->sem_waiting--; - else { - if (sem->sem_value >= SEM_VALUE_MAX) { - errno = ERANGE; - fastlock_release(&sem->sem_lock); - return -1; - } - } - sem->sem_value++; - fastlock_release(&sem->sem_lock); - return 0; -} - - -/* - * Simple producer/consumer test program - */ - -#ifdef TEST -#include - -static sem_t p_sem, c_sem; -static int data = 0; - -static void *producer_func(void *arg) -{ - int i, n = (int)arg; - for (i = 0; i < n; i++) { - sem_wait(&p_sem); - data++; - sem_post(&c_sem); - } - return NULL; -} - -static void *consumer_func(void *arg) -{ - int i, n = (int)arg; - for (i = 0; i < n; i++) { - sem_wait(&c_sem); - printf("data: %d\n", data); - sem_post(&p_sem); - } - sleep(1); // for testing pthread_join() - return NULL; -} - -int main(void) -{ - pthread_t producer_thread, consumer_thread; - static const int N = 5; - - if (sem_init(&c_sem, 0, 0) < 0) - return 1; - if (sem_init(&p_sem, 0, 1) < 0) - return 2; - if (pthread_create(&producer_thread, NULL, producer_func, (void *)N) != 0) - return 3; - if (pthread_create(&consumer_thread, NULL, consumer_func, (void *)N) != 0) - return 4; - pthread_join(producer_thread, NULL); - pthread_join(consumer_thread, NULL); - sem_destroy(&p_sem); - sem_destroy(&c_sem); - if (data != N) - return 5; - return 0; -} -#endif \ No newline at end of file diff --git a/SheepShaver/src/Unix/Makefile.in b/SheepShaver/src/Unix/Makefile.in deleted file mode 100644 index b2c3b892..00000000 --- a/SheepShaver/src/Unix/Makefile.in +++ /dev/null @@ -1,260 +0,0 @@ -# Unix makefile for SheepShaver - -## System specific configuration -@SET_MAKE@ -SHELL = /bin/sh - -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -datadir = @datadir@ -mandir = @mandir@ -man1dir = $(mandir)/man1 - -DESTDIR = - -CC = @CC@ -CXX = @CXX@ -CFLAGS = @CFLAGS@ -CXXFLAGS = @CXXFLAGS@ -CPPFLAGS = @CPPFLAGS@ -I../include -I. -I../CrossPlatform -I../slirp -DEFS = @DEFS@ -D_REENTRANT -DDATADIR=\"$(datadir)/$(APP)\" -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -SYSSRCS = @SYSSRCS@ -CPUSRCS = @CPUSRCS@ -MONSRCS = @MONSRCS@ -PERL = @PERL@ -USE_DYNGEN = @USE_DYNGEN@ -DYNGENSRCS = @DYNGENSRCS@ -DYNGEN_CC = @DYNGEN_CC@ -DYNGEN_CFLAGS = @DYNGEN_CFLAGS@ -DYNGEN_CXXFLAGS = @DYNGEN_CXXFLAGS@ -DYNGEN_OP_FLAGS = @DYNGEN_OP_FLAGS@ -BLESS = @BLESS@ -EXEEXT = @EXEEXT@ -KEYCODES = @KEYCODES@ -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ - -SLIRP_CFLAGS = @SLIRP_CFLAGS@ -SLIRP_SRCS = @SLIRP_SRCS@ -SLIRP_OBJS = $(SLIRP_SRCS:../slirp/%.c=obj/%.o) - -STANDALONE_GUI = @STANDALONE_GUI@ -GUI_CFLAGS = @GUI_CFLAGS@ -GUI_LIBS = @GUI_LIBS@ -GUI_SRCS = ../prefs.cpp prefs_unix.cpp prefs_editor_gtk.cpp ../prefs_items.cpp \ - ../user_strings.cpp user_strings_unix.cpp xpram_unix.cpp sys_unix.cpp rpc_unix.cpp \ - ../dummy/prefs_dummy.cpp - -XPLAT_SRCS = ../CrossPlatform/vm_alloc.cpp ../CrossPlatform/sigsegv.cpp ../CrossPlatform/video_blit.cpp - -# Append disassembler to dyngen, if available -ifneq (:no,$(MONSRCS):$(USE_DYNGEN)) -DYNGENSRCS += $(filter %i386-dis.c,$(MONSRCS)) -endif - -## Files -SRCS = ../main.cpp main_unix.cpp ../prefs.cpp ../prefs_items.cpp prefs_unix.cpp sys_unix.cpp \ - ../rom_patches.cpp ../rsrc_patches.cpp ../emul_op.cpp ../name_registry.cpp \ - ../macos_util.cpp ../timer.cpp timer_unix.cpp ../xpram.cpp xpram_unix.cpp \ - ../adb.cpp ../sony.cpp ../disk.cpp ../cdrom.cpp ../scsi.cpp \ - ../gfxaccel.cpp ../video.cpp ../audio.cpp ../ether.cpp ../thunks.cpp \ - ../serial.cpp ../extfs.cpp disk_sparsebundle.cpp tinyxml2.cpp \ - about_window_unix.cpp ../user_strings.cpp user_strings_unix.cpp rpc_unix.cpp \ - sshpty.c strlcpy.c $(XPLAT_SRCS) $(SYSSRCS) $(CPUSRCS) $(MONSRCS) $(SLIRP_SRCS) -APP = SheepShaver -APP_EXE = $(APP)$(EXEEXT) -APP_APP = $(APP).app - -PROGS = $(APP_EXE) -ifeq ($(STANDALONE_GUI),yes) -GUI_APP = SheepShaverGUI -GUI_APP_EXE = $(GUI_APP)$(EXEEXT) -GUI_APP_APP = $(GUI_APP).app -PROGS += $(GUI_APP_EXE) -else -CXXFLAGS += $(GUI_CFLAGS) -LIBS += $(GUI_LIBS) -endif - -## Rules -.PHONY: modules install uninstall clean distclean depend dep -.SUFFIXES: -.SUFFIXES: .c .cpp .S .o .h - -all: $(PROGS) - -OBJ_DIR = obj -$(OBJ_DIR):: - @[ -d $(OBJ_DIR) ] || mkdir $(OBJ_DIR) > /dev/null 2>&1 - -define SRCS_LIST_TO_OBJS - $(addprefix $(OBJ_DIR)/, $(addsuffix .o, $(foreach file, $(SRCS), \ - $(basename $(notdir $(file)))))) -endef -OBJS = $(SRCS_LIST_TO_OBJS) - -define GUI_SRCS_LIST_TO_OBJS - $(addprefix $(OBJ_DIR)/, $(addsuffix .guio, $(foreach file, $(GUI_SRCS), \ - $(basename $(notdir $(file)))))) -endef -GUI_OBJS = $(GUI_SRCS_LIST_TO_OBJS) - -define DYNGENSRCS_LIST_TO_OBJS - $(addprefix $(OBJ_DIR)/, $(addsuffix .dgo, $(foreach file, $(DYNGENSRCS), \ - $(basename $(notdir $(file)))))) -endef -DYNGENOBJS = $(DYNGENSRCS_LIST_TO_OBJS) - -SRC_PATHS += $(sort $(foreach file, $(SRCS), $(dir $(file)))) -VPATH := -VPATH += $(addprefix :, $(subst ,:, $(filter-out $($(subst, :, ,$(VPATH))), $(SRC_PATHS)))) - -$(APP_EXE): $(OBJ_DIR) $(OBJS) - $(CXX) -o $@ $(LDFLAGS) $(OBJS) $(LIBS) - $(BLESS) $(APP_EXE) - -$(GUI_APP_EXE): $(OBJ_DIR) $(GUI_OBJS) - $(CXX) -o $@ $(LDFLAGS) $(GUI_OBJS) $(GUI_LIBS) - -$(APP)_app: $(APP) ../MacOSX/Info.plist ../MacOSX/$(APP).icns - rm -rf $(APP_APP)/Contents - mkdir -p $(APP_APP)/Contents - ./cpr.sh ../MacOSX/Info.plist $(APP_APP)/Contents/ - echo -n 'APPL????' > $(APP_APP)/Contents/PkgInfo - mkdir -p $(APP_APP)/Contents/MacOS - ./cpr.sh $(APP) $(APP_APP)/Contents/MacOS/ - strip -x $(APP_APP)/Contents/MacOS/$(APP) - mkdir -p $(APP_APP)/Contents/Resources - mkdir -p $(APP_APP)/Contents/Resources/English.lproj - ./cpr.sh ../MacOSX/Launcher/English.lproj/VMSettingsWindow.nib $(APP_APP)/Contents/Resources/English.lproj - ./cpr.sh ../MacOSX/SheepShaver.icns $(APP_APP)/Contents/Resources/ - -$(GUI_APP)_app: $(GUI_APP) ../MacOSX/Info.plist ../MacOSX/$(APP).icns - rm -rf $(GUI_APP_APP)/Contents - mkdir -p $(GUI_APP_APP)/Contents - sed -e "s/$(APP)/$(GUI_APP)/" < ../MacOSX/Info.plist > $(GUI_APP_APP)/Contents/Info.plist - echo -n 'APPL????' > $(GUI_APP_APP)/Contents/PkgInfo - mkdir -p $(GUI_APP_APP)/Contents/MacOS - ./cpr.sh $(GUI_APP) $(GUI_APP_APP)/Contents/MacOS/ - strip -x $(GUI_APP_APP)/Contents/MacOS/$(GUI_APP) - mkdir -p $(GUI_APP_APP)/Contents/Resources - ./cpr.sh ../MacOSX/$(APP).icns $(GUI_APP_APP)/Contents/Resources/$(GUI_APP).icns - -modules: - cd Linux/NetDriver; make - -install: $(PROGS) installdirs - $(INSTALL_PROGRAM) $(APP_EXE) $(DESTDIR)$(bindir)/$(APP_EXE) - if test -f "$(GUI_APP_EXE)"; then \ - $(INSTALL_PROGRAM) $(GUI_APP_EXE) $(DESTDIR)$(bindir)/$(GUI_APP_EXE); \ - fi - -$(INSTALL_DATA) $(APP).1 $(DESTDIR)$(man1dir)/$(APP).1 - $(INSTALL_DATA) $(KEYCODES) $(DESTDIR)$(datadir)/$(APP)/keycodes - $(INSTALL_DATA) tunconfig $(DESTDIR)$(datadir)/$(APP)/tunconfig - chmod 755 $(DESTDIR)$(datadir)/$(APP)/tunconfig - -installdirs: - $(SHELL) mkinstalldirs $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir) $(DESTDIR)$(datadir)/$(APP) - -uninstall: - rm -f $(DESTDIR)$(bindir)/$(APP_EXE) - rm -f $(DESTDIR)$(bindir)/$(GUI_APP_EXE) - rm -f $(DESTDIR)$(man1dir)/$(APP).1 - rm -f $(DESTDIR)$(datadir)/$(APP)/keycodes - rm -f $(DESTDIR)$(datadir)/$(APP)/tunconfig - rmdir $(DESTDIR)$(datadir)/$(APP) - -clean: - rm -f $(PROGS) $(OBJ_DIR)/* core* *.core *~ *.bak ppc-execute-impl.cpp - rm -f dyngen basic-dyngen-ops.hpp ppc-dyngen-ops.hpp ppc_asm.out.s - rm -rf $(APP_APP) $(GUI_APP_APP) - -distclean: clean - rm -rf $(OBJ_DIR) - rm -f Makefile - rm -f config.cache config.log config.status config.h - rm -f ../MacOSX/Info.plist - -depend dep: - makedepend $(CPPFLAGS) -Y. $(SRCS) 2>/dev/null - -$(OBJ_DIR)/SDLMain.o : SDLMain.m - $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) -c $< -o $@ -$(OBJ_DIR)/%.o : ../slirp/%.c - $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) $(SLIRP_CFLAGS) -c $< -o $@ -$(OBJ_DIR)/%.o : %.c - $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) -c $< -o $@ -$(OBJ_DIR)/DiskType.o : DiskType.m - $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) -c $< -o $@ -$(OBJ_DIR)/%.o : %.cpp - $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/%.o : %.mm - $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/%.o : %.S - $(CPP) $(CPPFLAGS) -D__ASSEMBLY__ $< -o $*.out.s - $(AS) $(ASFLAGS) -o $@ $*.out.s - rm $*.out.s -$(OBJ_DIR)/%.guio : %.cpp - $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) $(GUI_CFLAGS) -DSTANDALONE_GUI -c $< -o $@ - -# Kheperix CPU emulator -kpxsrcdir = ../kpx_cpu/src -GENEXECPL = $(kpxsrcdir)/cpu/ppc/genexec.pl -DYNGEN = dyngen$(EXEEXT) - -ifeq ($(USE_DYNGEN),yes) -DYNGENDEPS = basic-dyngen-ops.hpp ppc-dyngen-ops.hpp - -# Only GCC is supported for generating synthetic opcodes -$(DYNGEN): $(DYNGENOBJS) - $(DYNGEN_CC) -o $@ $(LDFLAGS) $(DYNGENOBJS) - -$(OBJ_DIR)/%.dgo : %.c - $(DYNGEN_CC) -xc $(CPPFLAGS) $(DEFS) $(DYNGEN_CFLAGS) -c $< -o $@ -$(OBJ_DIR)/%.dgo : %.cpp - $(DYNGEN_CC) $(CPPFLAGS) $(DEFS) $(DYNGEN_CXXFLAGS) -c $< -o $@ - -$(OBJ_DIR)/basic-dyngen.o: basic-dyngen-ops.hpp -$(OBJ_DIR)/basic-dyngen-ops.o: $(kpxsrcdir)/cpu/jit/basic-dyngen-ops.cpp - $(DYNGEN_CC) $(CPPFLAGS) $(DEFS) $(DYNGEN_CXXFLAGS) $(DYNGEN_OP_FLAGS) -c $< -o $@ -basic-dyngen-ops.hpp: $(OBJ_DIR)/basic-dyngen-ops.o $(DYNGEN) - ./$(DYNGEN) -o $@ $< - -$(OBJ_DIR)/ppc-dyngen.o: ppc-dyngen-ops.hpp -$(OBJ_DIR)/ppc-dyngen-ops.o: $(kpxsrcdir)/cpu/ppc/ppc-dyngen-ops.cpp basic-dyngen-ops.hpp - $(DYNGEN_CC) $(CPPFLAGS) $(DEFS) $(DYNGEN_CXXFLAGS) $(DYNGEN_OP_FLAGS) -c $< -o $@ -ppc-dyngen-ops.hpp: $(OBJ_DIR)/ppc-dyngen-ops.o $(DYNGEN) - ./$(DYNGEN) -o $@ $< - -$(OBJ_DIR)/sheepshaver_glue.o $(OBJ_DIR)/ppc-cpu.o $(OBJ_DIR)/ppc-decode.o $(OBJ_DIR)/ppc-translate.o $(OBJ_DIR)/ppc-jit.o: basic-dyngen-ops.hpp ppc-dyngen-ops.hpp -endif - -$(OBJ_DIR)/ppc-execute.o: ppc-execute-impl.cpp -ppc-execute-impl.cpp: $(kpxsrcdir)/cpu/ppc/ppc-decode.cpp $(GENEXECPL) $(DYNGENDEPS) - $(CPP) $(CPPFLAGS) -DGENEXEC $< | $(PERL) $(GENEXECPL) > $@ - -# PowerPC CPU tester -TESTSRCS_ = mathlib/ieeefp.cpp mathlib/mathlib.cpp cpu/ppc/ppc-cpu.cpp cpu/ppc/ppc-decode.cpp cpu/ppc/ppc-execute.cpp cpu/ppc/ppc-translate.cpp test/test-powerpc.cpp $(MONSRCS) vm_alloc.cpp utils/utils-cpuinfo.cpp -ifeq ($(USE_DYNGEN),yes) -TESTSRCS_ += cpu/jit/jit-cache.cpp cpu/jit/basic-dyngen.cpp cpu/ppc/ppc-dyngen.cpp cpu/ppc/ppc-jit.cpp -endif -TESTSRCS = $(TESTSRCS_:%.cpp=$(kpxsrcdir)/%.cpp) - -define TESTSRCS_LIST_TO_OBJS - $(addprefix $(OBJ_DIR)/, $(addsuffix .o, $(foreach file, $(TESTSRCS), \ - $(basename $(notdir $(file)))))) -endef -TESTOBJS = $(TESTSRCS_LIST_TO_OBJS) - -$(OBJ_DIR)/test-powerpc.o: $(kpxsrcdir)/test/test-powerpc.cpp - $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -DEMU_KHEPERIX -c $< -o $@ - -test-powerpc$(EXEEXT): $(TESTOBJS) - $(CXX) -o $@ $(LDFLAGS) $(TESTOBJS) $(LIBS) - -#------------------------------------------------------------------------- -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/SheepShaver/src/Unix/NetBSD/sheepthreads.c b/SheepShaver/src/Unix/NetBSD/sheepthreads.c deleted file mode 100644 index 404a692f..00000000 --- a/SheepShaver/src/Unix/NetBSD/sheepthreads.c +++ /dev/null @@ -1,462 +0,0 @@ -/* - * sheepthreads.c - Minimal pthreads implementation (libpthread doesn't - * like sigaltstack) - * - * SheepShaver (C) 1997-2005 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NOTES: - * - pthread_cancel() kills the thread immediately - * - Semaphores are VERY restricted: the only supported use is to have one - * thread sem_wait() on the semaphore while other threads sem_post() it - * (i.e. to use the semaphore as a signal) - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -/* Thread descriptor */ -struct __pthread_st { - unsigned int tid; -}; - -/* Thread stack size */ -#define STACK_SIZE 65536 - -/* From asm_linux.S */ -extern int atomic_add(int *var, int add); -extern int atomic_and(int *var, int and); -extern int atomic_or(int *var, int or); -extern int test_and_set(int *var, int val); - -/* Linux kernel calls */ -extern int __clone(int (*fn)(void *), void *, int, void *); - -/* struct sem_t */ -struct _sem_st { -#define SEM_MAGIC 0x09fa4012 - unsigned int sem_magic; - struct { - int status; - int spinlock; - } sem_lock; - int sem_value; - pid_t sem_waiting; -}; - -/* Wait for "clone" children only (Linux 2.4+ specific) */ -#ifndef __WCLONE -#define __WCLONE 0 -#endif - - -/* - * Return pthread ID of self - */ - -pthread_t pthread_self(void) -{ - static struct __pthread_st self_st; - static pthread_t self = NULL; - if (self == NULL) { - self = &self_st; - self->tid = getpid(); - } - return self; -} - - -/* - * Test whether two pthread IDs are equal - */ - -int pthread_equal(pthread_t t1, pthread_t t2) -{ - return t1 == t2; -} - - -/* - * Send signal to thread - */ - -int pthread_kill(pthread_t thread, int sig) -{ - if (kill(thread->tid, sig) == -1) - return errno; - else - return 0; -} - - -/* - * Create pthread - */ - -struct new_thread { - void *(*fn)(void *); - void *arg; -}; - -static int start_thread(void *arg) -{ - struct new_thread *nt = (struct new_thread *)arg; - nt->fn(nt->arg); - return 0; -} - -int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg) -{ - struct new_thread *nt; - void *stack; - int pid; - - nt = (struct new_thread *)malloc(sizeof(struct new_thread)); - nt->fn = start_routine; - nt->arg = arg; - stack = malloc(STACK_SIZE); - - pid = __clone(start_thread, (char *)stack + STACK_SIZE - 16, CLONE_VM | CLONE_FS | CLONE_FILES, nt); - if (pid == -1) { - free(stack); - free(nt); - return errno; - } else { - *thread = malloc(sizeof(**thread)); - if (*thread == NULL) - return -1; - (*thread)->tid = pid; - return 0; - } -} - - -/* - * Join pthread - */ - -int pthread_join(pthread_t thread, void **ret) -{ - do { - if (waitpid(thread->tid, NULL, __WCLONE) >= 0); - break; - } while (errno == EINTR); - if (ret) - *ret = NULL; - return 0; -} - - -/* - * Cancel thread - */ - -int pthread_cancel(pthread_t thread) -{ - kill(thread->tid, SIGINT); - thread->tid = (unsigned int)-1; - free(thread); - return 0; -} - - -/* - * Test for cancellation - */ - -void pthread_testcancel(void) -{ -} - - -/* - * Spinlocks - */ - -static int try_acquire_spinlock(int *lock) -{ - return test_and_set(lock, 1) == 0; -} - -static void acquire_spinlock(volatile int *lock) -{ - do { - while (*lock) ; - } while (test_and_set((int *)lock, 1) != 0); -} - -static void release_spinlock(int *lock) -{ - *lock = 0; -} - - -/* - * Initialize mutex - */ - -int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *mutex_attr) -{ - mutex->ptm_magic = _PT_MUTEX_MAGIC; - mutex->ptm_lock = 0; - mutex->ptm_owner = NULL; - return 0; -} - - -/* - * Destroy mutex - */ - -int pthread_mutex_destroy(pthread_mutex_t *mutex) -{ - if (mutex->ptm_magic != _PT_MUTEX_MAGIC) - return EINVAL; - if (mutex->ptm_lock != 0) - return EBUSY; - - mutex->ptm_magic = _PT_MUTEX_DEAD; - return 0; -} - - -/* - * Lock mutex - */ - -int pthread_mutex_lock(pthread_mutex_t *mutex) -{ - if (mutex->ptm_magic != _PT_MUTEX_MAGIC) - return EINVAL; - - acquire_spinlock(&mutex->ptm_lock); - return 0; -} - - -/* - * Try to lock mutex - */ - -int pthread_mutex_trylock(pthread_mutex_t *mutex) -{ - if (mutex->ptm_magic != _PT_MUTEX_MAGIC) - return EINVAL; - - if (!try_acquire_spinlock(&mutex->ptm_lock)) - return EBUSY; - return 0; -} - - -/* - * Unlock mutex - */ - -int pthread_mutex_unlock(pthread_mutex_t *mutex) -{ - if (mutex->ptm_magic != _PT_MUTEX_MAGIC) - return EINVAL; - - release_spinlock(&mutex->ptm_lock); - return 0; -} - - -/* - * Create mutex attribute - */ - -int pthread_mutexattr_init(pthread_mutexattr_t *attr) -{ - attr->ptma_magic = _PT_MUTEXATTR_MAGIC; - return 0; -} - - -/* - * Destroy mutex attribute - */ - -int pthread_mutexattr_destroy(pthread_mutexattr_t *attr) -{ - if (attr->ptma_magic != _PT_MUTEXATTR_MAGIC) - return EINVAL; - return 0; -} - - -/* - * Init semaphore - */ - -int sem_init(sem_t *psem, int pshared, unsigned int value) -{ - sem_t sem = malloc(sizeof(*sem)); - if (sem == NULL) { - errno = ENOSPC; - return 0; - } - *psem = sem; - sem->sem_magic = SEM_MAGIC; - sem->sem_lock.status = 0; - sem->sem_lock.spinlock = 0; - sem->sem_value = value; - sem->sem_waiting = 0; - return 0; -} - - -/* - * Delete remaphore - */ - -int sem_destroy(sem_t *sem) -{ - if (sem == NULL || *sem == NULL || (*sem)->sem_magic != SEM_MAGIC) { - errno = EINVAL; - return -1; - } - - free(*sem); - return 0; -} - - -/* - * Wait on semaphore - */ - -void null_handler(int sig) -{ -} - -int sem_wait(sem_t *psem) -{ - sem_t sem; - if (psem == NULL || (sem = *psem) == NULL || sem->sem_magic != SEM_MAGIC) { - errno = EINVAL; - return -1; - } - acquire_spinlock(&sem->sem_lock.spinlock); - if (sem->sem_value > 0) - atomic_add(&sem->sem_value, -1); - else { - sigset_t mask; - if (!sem->sem_lock.status) { - struct sigaction sa; - sem->sem_lock.status = SIGUSR2; - sa.sa_handler = null_handler; - sa.sa_flags = SA_RESTART; - sigemptyset(&sa.sa_mask); - sigaction(sem->sem_lock.status, &sa, NULL); - } - sem->sem_waiting = getpid(); - sigemptyset(&mask); - sigsuspend(&mask); - sem->sem_waiting = 0; - } - release_spinlock(&sem->sem_lock.spinlock); - return 0; -} - - -/* - * Post semaphore - */ - -int sem_post(sem_t *psem) -{ - sem_t sem; - if (psem == NULL || (sem = *psem) == NULL || sem->sem_magic != SEM_MAGIC) { - errno = EINVAL; - return -1; - } - acquire_spinlock(&sem->sem_lock.spinlock); - if (sem->sem_waiting == 0) - atomic_add(&sem->sem_value, 1); - else - kill(sem->sem_waiting, sem->sem_lock.status); - release_spinlock(&sem->sem_lock.spinlock); - return 0; -} - - -/* - * Simple producer/consumer test program - */ - -#ifdef TEST -#include - -static sem_t p_sem, c_sem; -static int data = 0; - -static void *producer_func(void *arg) -{ - int i, n = (int)arg; - for (i = 0; i < n; i++) { - sem_wait(&p_sem); - data++; - sem_post(&c_sem); - } - return NULL; -} - -static void *consumer_func(void *arg) -{ - int i, n = (int)arg; - for (i = 0; i < n; i++) { - sem_wait(&c_sem); - printf("data: %d\n", data); - sem_post(&p_sem); - } - sleep(1); // for testing pthread_join() - return NULL; -} - -int main(void) -{ - pthread_t producer_thread, consumer_thread; - static const int N = 5; - - if (sem_init(&c_sem, 0, 0) < 0) - return 1; - if (sem_init(&p_sem, 0, 1) < 0) - return 2; - if (pthread_create(&producer_thread, NULL, producer_func, (void *)N) != 0) - return 3; - if (pthread_create(&consumer_thread, NULL, consumer_func, (void *)N) != 0) - return 4; - pthread_join(producer_thread, NULL); - pthread_join(consumer_thread, NULL); - sem_destroy(&p_sem); - sem_destroy(&c_sem); - if (data != N) - return 5; - return 0; -} -#endif diff --git a/SheepShaver/src/Unix/SheepShaver.1 b/SheepShaver/src/Unix/SheepShaver.1 deleted file mode 100644 index 12358963..00000000 --- a/SheepShaver/src/Unix/SheepShaver.1 +++ /dev/null @@ -1,29 +0,0 @@ -.TH SheepShaver 1 "April, 2000" -.SH NAME -SheepShaver \- Macintosh emulator -.SH SYNOPSIS -.B SheepShaver -[\-display -.IR display-name ] -.SH DESCRIPTION -.B SheepShaver -is a Macintosh emulator for PowerPC-based Linux systems. -For more information, see the included documentation. -.SH OPTIONS -.TP -.BI "\-display " display-name -specifies the display to use; see -.BR X (1) -.SH FILES -.TP -.I ~/.sheepshaver_prefs -User-specific configuration file. -.TP -.I ~/.sheeshaver_nvram -Contents of Mac non-volatile RAM. -.SH SEE ALSO -http://www.sheepshaver.com/ (Official SheepShaver homepage) -.SH AUTHORS -Christian Bauer -.br -Marc Hellwig diff --git a/SheepShaver/src/Unix/about_window_unix.cpp b/SheepShaver/src/Unix/about_window_unix.cpp deleted file mode 100644 index 3d4127fd..00000000 --- a/SheepShaver/src/Unix/about_window_unix.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - * about_window_unix.cpp - "About" window, Unix implementation - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "about_window.h" - - -/* - * Open "About" window - */ - -void OpenAboutWindow(void) -{ -} diff --git a/SheepShaver/src/Unix/audio_oss_esd.cpp b/SheepShaver/src/Unix/audio_oss_esd.cpp deleted file mode 120000 index acf070c1..00000000 --- a/SheepShaver/src/Unix/audio_oss_esd.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/audio_oss_esd.cpp \ No newline at end of file diff --git a/SheepShaver/src/Unix/autogen.sh b/SheepShaver/src/Unix/autogen.sh deleted file mode 100755 index f6b732ad..00000000 --- a/SheepShaver/src/Unix/autogen.sh +++ /dev/null @@ -1,61 +0,0 @@ -#! /bin/sh -# Run this to generate all the initial makefiles, etc. -# This was lifted from the Gimp, and adapted slightly by -# Christian Bauer. - -DIE=0 - -PROG="SheepShaver" - -# Check how echo works in this /bin/sh -case `echo -n` in --n) _echo_n= _echo_c='\c';; -*) _echo_n=-n _echo_c=;; -esac - -(autoconf --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have autoconf installed to compile $PROG." - echo "Download the appropriate package for your distribution," - echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" - DIE=1 -} - -(aclocal --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: Missing aclocal. The version of automake" - echo "installed doesn't appear recent enough." - echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 -} - -if test "$DIE" -eq 1; then - exit 1 -fi - -if test -z "$ACLOCAL_FLAGS"; then - ACLOCAL_FLAGS="-I `aclocal --print-ac-dir` -I m4" -fi - -aclocalinclude="$ACLOCAL_FLAGS"; \ -(echo $_echo_n " + Running aclocal: $_echo_c"; \ - aclocal $aclocalinclude; \ - echo "done.") && \ -(echo $_echo_n " + Running autoheader: $_echo_c"; \ - autoheader; \ - echo "done.") && \ -(echo $_echo_n " + Running autoconf: $_echo_c"; \ - autoconf; \ - echo "done.") - -rm -f config.cache - -if [ x"$NO_CONFIGURE" = "x" ]; then - echo " + Running 'configure $@':" - if [ -z "$*" ]; then - echo " ** If you wish to pass arguments to ./configure, please" - echo " ** specify them on the command line." - fi - ./configure "$@" -fi diff --git a/SheepShaver/src/Unix/bincue_unix.cpp b/SheepShaver/src/Unix/bincue_unix.cpp deleted file mode 120000 index f9ed574d..00000000 --- a/SheepShaver/src/Unix/bincue_unix.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/bincue_unix.cpp \ No newline at end of file diff --git a/SheepShaver/src/Unix/bincue_unix.h b/SheepShaver/src/Unix/bincue_unix.h deleted file mode 120000 index 9c7e8c5c..00000000 --- a/SheepShaver/src/Unix/bincue_unix.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/bincue_unix.h \ No newline at end of file diff --git a/SheepShaver/src/Unix/clip_unix.cpp b/SheepShaver/src/Unix/clip_unix.cpp deleted file mode 120000 index bd5316ec..00000000 --- a/SheepShaver/src/Unix/clip_unix.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/clip_unix.cpp \ No newline at end of file diff --git a/SheepShaver/src/Unix/config.guess b/SheepShaver/src/Unix/config.guess deleted file mode 120000 index d7e5917c..00000000 --- a/SheepShaver/src/Unix/config.guess +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/config.guess \ No newline at end of file diff --git a/SheepShaver/src/Unix/config.sub b/SheepShaver/src/Unix/config.sub deleted file mode 120000 index 5458c713..00000000 --- a/SheepShaver/src/Unix/config.sub +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/config.sub \ No newline at end of file diff --git a/SheepShaver/src/Unix/configure.ac b/SheepShaver/src/Unix/configure.ac deleted file mode 100644 index 11e4c10a..00000000 --- a/SheepShaver/src/Unix/configure.ac +++ /dev/null @@ -1,1687 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -dnl Written in 2002 by Christian Bauer - -AC_INIT([SheepShaver], 2.4, [Christian.Bauer@uni-mainz.de], SheepShaver) -AC_CONFIG_SRCDIR(main_unix.cpp) -AC_PREREQ(2.52) -AC_CONFIG_HEADER(config.h) -AH_TOP( -#ifndef CONFIG_H -#define CONFIG_H -) -AH_BOTTOM( -#endif /* CONFIG_H */ -) - -dnl Canonical system information. -AC_CANONICAL_HOST -AC_CANONICAL_TARGET - -dnl Some systems do not put corefiles in the currect directory, avoid saving -dnl cores for the configure tests since some are intended to dump core. -ulimit -c 0 - -dnl Invite Cygwin users to build within the Windows/ directory -case $target_os in -*cygwin* | *mingw32*) - AC_MSG_ERROR([You can only build the Windows version from its directory, Cygwin/X11 is not supported.]) - ;; -esac - -dnl Options. -AC_ARG_ENABLE(jit, [ --enable-jit enable JIT compiler [default=yes]], [WANT_JIT=$enableval], [WANT_JIT=yes]) -AC_ARG_ENABLE(ppc-emulator, [ --enable-ppc-emulator use the selected PowerPC emulator [default=auto]], [WANT_EMULATED_PPC=$enableval], [WANT_EMULATED_PPC=auto]) -AC_ARG_ENABLE(fbdev-dga, [ --enable-fbdev-dga use direct frame buffer access via /dev/fb0 [default=yes]], [WANT_FBDEV_DGA=$enableval], [WANT_FBDEV_DGA=yes]) -AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes]) -AC_ARG_ENABLE(xf86-vidmode, [ --enable-xf86-vidmode use the XFree86 VidMode extension [default=yes]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=yes]) -AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes]) -AC_ARG_ENABLE(standalone-gui,[ --enable-standalone-gui enable a standalone GUI prefs editor [default=no]], [WANT_STANDALONE_GUI=$enableval], [WANT_STANDALONE_GUI=no]) -AC_ARG_WITH(esd, [ --with-esd support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes]) -AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], - [case "$withval" in - gtk1) WANT_GTK="gtk";; - gtk|gtk2) WANT_GTK="$withval";; - yes) WANT_GTK="gtk2 gtk";; - *) WANT_GTK="no";; - esac], - [WANT_GTK="gtk2 gtk"]) -AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes]) -AC_ARG_WITH(dgcc, [ --with-dgcc=COMPILER use C++ COMPILER to compile synthetic opcodes], [DYNGEN_CC=$withval]) - -AC_ARG_WITH(bincue, - AS_HELP_STRING([--with-bincue], [Allow cdrom image files in bin/cue mode])) - -AC_ARG_WITH(libvhd, - AS_HELP_STRING([--with-libvhd], [Enable VHD disk images])) - - -dnl Addressing mode -AC_ARG_ENABLE(addressing, - [ --enable-addressing=AM set the addressing mode to use [default=real]], - [case "$enableval" in - real) WANT_ADDRESSING_MODE="real";; - direct) WANT_ADDRESSING_MODE="direct";; - direct,0x*) WANT_ADDRESSING_MODE="direct"; NATMEM_OFFSET=`echo "$enableval" | sed -n '/direct,\(0[[xX]][[0-9A-Fa-f]]*\([[UuLl]]\{1,2\}\)\?\)$/s//\1/p'`;; - esac], - [WANT_ADDRESSING_MODE="real"] -) - -dnl SDL options. -AC_ARG_ENABLE(sdl-static, [ --enable-sdl-static use SDL static libraries for linking [default=no]], [WANT_SDL_STATIC=$enableval], [WANT_SDL_STATIC=no]) -AC_ARG_ENABLE(sdl-video, [ --enable-sdl-video use SDL for video graphics [default=no]], [WANT_SDL_VIDEO=$enableval], [WANT_SDL_VIDEO=no]) -AC_ARG_ENABLE(sdl-audio, [ --enable-sdl-audio use SDL for audio [default=no]], [WANT_SDL_AUDIO=$enableval], [WANT_SDL_AUDIO=no]) -AC_ARG_ENABLE(sdl-framework, [ --enable-sdl-framework use SDL framework [default=no]], [WANT_SDL_FRAMEWORK=$enableval], [WANT_SDL_FRAMEWORK=no]) -AC_ARG_ENABLE(sdl-framework-prefix, [ --enable-sdl-framework-prefix=PFX default=/Library/Frameworks], [SDL_FRAMEWORK="$enableval"], [SDL_FRAMEWORK=/Library/Frameworks]) - -dnl Checks for programs. -AC_PROG_CC -AC_PROG_CPP -AC_PROG_CXX -AC_PROG_MAKE_SET -AC_PROG_INSTALL -AC_PROG_EGREP -AC_PATH_PROGS(FILE, [file false]) -AC_PATH_PROG(PERL, [perl]) - -dnl Check for PowerPC target CPU. -HAVE_PPC=no -AC_MSG_CHECKING(for PowerPC target CPU) -AC_EGREP_CPP(yes, -[ -#ifdef __powerpc__ - yes -#endif -#ifdef __ppc__ - yes -#endif -], [AC_MSG_RESULT(yes); HAVE_PPC=yes], AC_MSG_RESULT(no)) - -dnl We use native CPU if possible. -EMULATED_PPC=yes -case $WANT_EMULATED_PPC in - auto) [[ "x$HAVE_PPC" = "xyes" ]] && EMULATED_PPC=no;; - no) EMULATED_PPC=no;; -esac -if [[ "x$EMULATED_PPC" = "xyes" ]]; then - AC_DEFINE(EMULATED_PPC, 1, [Define if using a PowerPC CPU emulator.]) -fi - -dnl We use mon if possible. -MONSRCS= -case "x$WANT_MON" in -x/* | x.*) - mon_srcdir=$WANT_MON - WANT_MON=yes - ;; -xyes) - mon_srcdir=../../../mon/src - ;; -esac -if [[ "x$WANT_MON" = "xyes" ]]; then - AC_MSG_CHECKING(for mon) - if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then - AC_MSG_RESULT(yes) - AC_DEFINE(ENABLE_MON, 1, [Define if using "mon".]) - MONSRCS="$mon_srcdir/mon.cpp $mon_srcdir/mon_6502.cpp $mon_srcdir/mon_z80.cpp $mon_srcdir/mon_cmd.cpp $mon_srcdir/mon_lowmem.cpp $mon_srcdir/mon_disass.cpp $mon_srcdir/mon_ppc.cpp $mon_srcdir/disass/floatformat.c $mon_srcdir/disass/i386-dis.c $mon_srcdir/disass/m68k-dis.c $mon_srcdir/disass/m68k-opc.c $mon_srcdir/disass/mips-dis.c $mon_srcdir/disass/mips-opc.c $mon_srcdir/disass/mips16-opc.c" - CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass" - AC_CHECK_LIB(ncurses, tgetent, , - [AC_CHECK_LIB(termcap, tgetent, , - [AC_CHECK_LIB(termlib, tgetent, , - [AC_CHECK_LIB(terminfo, tgetent, , - [AC_CHECK_LIB(Hcurses, tgetent, , - [AC_CHECK_LIB(curses, tgetent)])])])])]) - AC_CHECK_LIB(readline, readline) - AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h) - else - AC_MSG_RESULT(no) - AC_MSG_WARN([Could not find mon, ignoring --with-mon.]) - WANT_MON=no - fi -fi -AC_SUBST(MONSRCS) - -dnl Checks for libraries. -AC_CHECK_LIB(posix4, sem_init) -AC_CHECK_LIB(m, cos) - -dnl AC_CHECK_SDLFRAMEWORK($1=NAME, $2=INCLUDES) -dnl AC_TRY_LINK uses main() but SDL needs main to take args, -dnl therefore main is undefined with #undef. -dnl Framework can be in an custom location. -AC_DEFUN([AC_CHECK_SDLFRAMEWORK], [ - AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1]) - AC_CACHE_CHECK([whether compiler supports framework $1], - ac_Framework, [ - saved_LIBS="$LIBS" - LIBS="$LIBS -framework $1" - if [[ "x$SDL_FRAMEWORK" != "x/Library/Frameworks" ]]; then - if [[ "x$SDL_FRAMEWORK" != "x/System/Library/Frameworks" ]]; then - LIBS="$saved_LIBS -F$SDL_FRAMEWORK -framework $1" - fi - fi - saved_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I$SDL_FRAMEWORK/SDL.framework/Headers" - AC_TRY_LINK( - [$2 -#undef main], [], - [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); -LIBS="$saved_LIBS"; CPPFLAGS="$saved_CPPFLAGS"] - ) - ]) - AS_IF([test AS_VAR_GET(ac_Framework) = yes], - [AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])] - ) - AS_VAR_POPDEF([ac_Framework]) -]) - -dnl Do we need SDL? -WANT_SDL=no -if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then - WANT_SDL=yes - WANT_XF86_DGA=no - WANT_XF86_VIDMODE=no - WANT_FBDEV_DGA=no - SDL_SUPPORT="$SDL_SUPPORT video" -fi -if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then - WANT_SDL=yes - SDL_SUPPORT="$SDL_SUPPORT audio" -fi -if [[ "x$WANT_SDL" = "xyes" ]]; then - if [[ "x$WANT_SDL_FRAMEWORK" = "xyes" ]]; then - AC_CHECK_SDLFRAMEWORK(SDL, [#include ]) - else - ac_cv_framework_SDL=no - fi - if [[ "x$ac_cv_framework_SDL" = "xno" ]]; then - AC_PATH_PROG(sdl_config, "sdl-config") - if [[ -n "$sdl_config" ]]; then - sdl_cflags=`$sdl_config --cflags` - if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then - sdl_libs=`$sdl_config --static-libs` - else - sdl_libs=`$sdl_config --libs` - fi - CFLAGS="$CFLAGS $sdl_cflags" - CXXFLAGS="$CXXFLAGS $sdl_cflags" - LIBS="$LIBS $sdl_libs" - else - WANT_SDL=no - WANT_SDL_VIDEO=no - WANT_SDL_AUDIO=no - fi - fi - SDL_SUPPORT=`echo "$SDL_SUPPORT" | sed -e "s/^ //"` -else - SDL_SUPPORT="none" -fi - -dnl We need X11, if not using SDL. -if [[ "x$WANT_SDL_VIDEO" != "xyes" ]]; then - AC_PATH_XTRA - if [[ "x$no_x" = "xyes" ]]; then - AC_MSG_ERROR([You need X11 to run SheepShaver.]) - fi - CFLAGS="$CFLAGS $X_CFLAGS" - CXXFLAGS="$CXXFLAGS $X_CFLAGS" - LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS" -fi - - - -dnl We need pthreads on non-PowerPC systems. Try libpthread first, then libc_r (FreeBSD), then PTL. -HAVE_PTHREADS=yes -case $EMULATED_PPC:$target_os in -no:linux*|no:netbsd*) - dnl We do have our own pthread_cancel() implementation - AC_DEFINE(HAVE_PTHREAD_CANCEL, 1, [Define if you have the pthread_cancel function.]) - ;; -*:*) - AC_CHECK_LIB(pthread, pthread_create, , [ - AC_CHECK_LIB(c_r, pthread_create, , [ - AC_CHECK_LIB(PTL, pthread_create, , [ - dnl XXX remove when no pthreads case is merged - AC_MSG_ERROR([You need pthreads to run SheepShaver.]) - HAVE_PTHREADS=no - ]) - ]) - ]) - AC_CHECK_FUNCS(pthread_cancel) - AC_CHECK_FUNCS(pthread_cond_init pthread_testcancel) - AC_CHECK_FUNCS(pthread_mutexattr_setprotocol) - AC_CHECK_FUNCS(pthread_mutexattr_settype) - AC_CHECK_FUNCS(pthread_mutexattr_setpshared) - dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes. - SEMSRC= - AC_CHECK_FUNCS(sem_init, , [ - if test "x$HAVE_PTHREADS" = "xyes"; then - SEMSRC=posix_sem.cpp - fi - ]) - ;; -esac -if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then - AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.]) -fi - -dnl We use FBDev DGA if possible. -if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then - AC_CHECK_HEADER(linux/fb.h, [ - AC_DEFINE(ENABLE_FBDEV_DGA, 1, [Define if using Linux fbdev extension.]) - ], [ - AC_MSG_WARN([Could not find Linux FBDev extension, ignoring --enable-fbdev-dga.]) - WANT_FBDEV_DGA=no - ]) -fi - -dnl We use XFree86 DGA if possible. -if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then - AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, [ - AC_DEFINE(ENABLE_XF86_DGA, 1, [Define if using XFree86 DGA extension.]) - LIBS="$LIBS -lXxf86dga" - ], [ - AC_MSG_WARN([Could not find XFree86 DGA extension, ignoring --enable-xf86-dga.]) - WANT_XF86_DGA=no - ]) -fi - -dnl We use XFree86 VidMode if possible. -if [[ "x$WANT_XF86_VIDMODE" = "xyes" ]]; then - AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, [ - AC_DEFINE(ENABLE_XF86_VIDMODE, 1, [Define if using XFree86 DGA extension.]) - LIBS="$LIBS -lXxf86vm" - ], [ - AC_MSG_WARN([Could not find XFree86 VidMode extension, ignoring --enable-xf86-vidmode.]) - WANT_XF86_VIDMODE=no - ]) -fi - -dnl We use GTK+ if possible. -UISRCS=../dummy/prefs_editor_dummy.cpp -case "x$WANT_GTK" in -xgtk2*) - WANT_GTK=no - AM_PATH_GTK_2_0(1.3.15, [ - GUI_CFLAGS="$GTK_CFLAGS" - GUI_LIBS="$GTK_LIBS" - WANT_GTK=gtk2 - ], [ - case "x${WANT_GTK}x" in - *gtkx) - AC_MSG_WARN([Could not find GTK+ 2.0, trying with GTK+ 1.2.]) - WANT_GTK=gtk - ;; - *) - AC_MSG_WARN([Could not find GTK+, disabling user interface.]) - WANT_GTK=no - ;; - esac - ]) - ;; -esac -if [[ "x$WANT_GTK" = "xgtk" ]]; then - WANT_GTK=no - AM_PATH_GTK(1.2.0, [ - GUI_CFLAGS="$GTK_CFLAGS" - GUI_LIBS="$GTK_LIBS" - WANT_GTK=gtk - ], [ - AC_MSG_WARN([Could not find GTK+, disabling user interface.]) - ]) -fi -if [[ "x$WANT_GTK" != "xno" -a "x$WANT_STANDALONE_GUI" = "xno" ]]; then - AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.]) - UISRCS=prefs_editor_gtk.cpp -fi -AC_SUBST(GUI_CFLAGS) -AC_SUBST(GUI_LIBS) - -dnl Build external GUI if requested. -if [[ "$WANT_STANDALONE_GUI" != "yes" ]]; then - WANT_STANDALONE_GUI=no -fi -if [[ "$WANT_GTK" = "no" ]]; then - WANT_STANDALONE_GUI=no -fi -AC_SUBST(STANDALONE_GUI, [$WANT_STANDALONE_GUI]) - -dnl We use ESD if possible. -if [[ "x$WANT_ESD" = "xyes" ]]; then - WANT_ESD=no - AM_PATH_ESD(0.2.8, [ - AC_DEFINE(ENABLE_ESD, 1, [Define is using ESD.]) - CFLAGS="$CFLAGS $ESD_CFLAGS" - CXXFLAGS="$CXXFLAGS $ESD_CFLAGS" - LIBS="$LIBS $ESD_LIBS" - WANT_ESD=yes - ], [ - AC_MSG_WARN([Could not find ESD, disabling ESD support.]) - ]) -fi - -dnl We use 64-bit file size support if possible. -AC_SYS_LARGEFILE - -dnl Checks for header files. -AC_HEADER_STDC -AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS(malloc.h stdint.h) -AC_CHECK_HEADERS(mach/vm_map.h mach/mach_init.h sys/mman.h) -AC_CHECK_HEADERS(unistd.h fcntl.h byteswap.h dirent.h) -AC_CHECK_HEADERS(sys/socket.h sys/ioctl.h sys/filio.h sys/bitypes.h sys/wait.h) -AC_CHECK_HEADERS(sys/time.h sys/poll.h sys/select.h arpa/inet.h) -AC_CHECK_HEADERS(netinet/in.h linux/if.h linux/if_tun.h net/if.h net/if_tun.h, [], [], [ -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -]) -AC_CHECK_HEADERS(AvailabilityMacros.h) -AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDevice.h) -AC_CHECK_HEADERS(fenv.h) -AC_CHECK_HEADERS(sys/stropts.h stropts.h) - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_C_BIGENDIAN -AC_C_CONST -AC_C_INLINE -AC_CHECK_SIZEOF(short, 2) -AC_CHECK_SIZEOF(int, 4) -AC_CHECK_SIZEOF(long, 4) -AC_CHECK_SIZEOF(long long, 8) -AC_CHECK_SIZEOF(float, 4) -AC_CHECK_SIZEOF(double, 8) -AC_CHECK_SIZEOF(void *, 4) -AC_TYPE_OFF_T -AC_CHECK_TYPE(loff_t, off_t) -AC_TYPE_SIZE_T -AC_TYPE_SIGNAL -AC_HEADER_TIME -AC_STRUCT_TM - -dnl Check whether sys/socket.h defines type socklen_t. -dnl (extracted from ac-archive/Miscellaneous) -AC_CACHE_CHECK([for socklen_t], - ac_cv_type_socklen_t, [ - AC_TRY_COMPILE([ - #include - #include - ], [socklen_t len = 42; return 0;], - ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no, - dnl When cross-compiling, do not assume anything. - ac_cv_type_socklen_t="guessing no" - ) -]) -if [[ "x$ac_cv_type_socklen_t" != "xyes" ]]; then - AC_DEFINE(socklen_t, int, [Define to 'int' if doesn't define.]) -fi - -dnl Check whether struct sigaction has sa_restorer member. -AC_CACHE_CHECK([whether struct sigaction has sa_restorer], - ac_cv_signal_sa_restorer, [ - AC_TRY_COMPILE([ - #include - ], [struct sigaction sa; sa.sa_restorer = 0;], - ac_cv_signal_sa_restorer=yes, ac_cv_signal_sa_restorer=no, - dnl When cross-compiling, do not assume anything. - ac_cv_signal_sa_restorer=no - ) -]) -if [[ "x$ac_cv_signal_sa_restorer" = "xyes" ]]; then - AC_DEFINE(HAVE_SIGNAL_SA_RESTORER, 1, [Define if sa_restorer is available in struct sigaction.]) -fi - -dnl Checks for library functions. -AC_CHECK_FUNCS(strdup strerror strlcpy cfmakeraw) -AC_CHECK_FUNCS(nanosleep) -AC_CHECK_FUNCS(sigaction signal) -AC_CHECK_FUNCS(mmap mprotect munmap) -AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect) -AC_CHECK_FUNCS(exp2f log2f exp2 log2) -AC_CHECK_FUNCS(floorf roundf ceilf truncf floor round ceil trunc) -AC_CHECK_FUNCS(poll inet_aton) - -dnl Darwin seems to define mach_task_self() instead of task_self(). -AC_CHECK_FUNCS(mach_task_self task_self) - -dnl We need clock_gettime() for better performance but it may drag -dnl libpthread in, which we don't want for native ppc mode -case $EMULATED_PPC:$target_os in -no:linux*) - ;; -*:*) - AC_SEARCH_LIBS(clock_gettime, [rt posix4]) - AC_CHECK_FUNCS(clock_gettime clock_nanosleep) - ;; -esac - -dnl Check for headers and functions related to pty support (sshpty.c) -dnl From openssh-3.2.2p1 configure.ac -AC_CHECK_HEADERS(strings.h login.h sys/bsdtty.h sys/stat.h util.h pty.h) -AC_CHECK_FUNCS(_getpty vhangup strlcpy) - -case "$host" in -*-*-hpux10.26) - disable_ptmx_check=yes - ;; -*-*-linux*) - no_dev_ptmx=1 - ;; -mips-sony-bsd|mips-sony-newsos4) - AC_DEFINE(HAVE_NEWS4, 1, [Define if you are on NEWS-OS (additions from openssh-3.2.2p1, for sshpty.c).]) - ;; -*-*-sco3.2v4*) - no_dev_ptmx=1 - ;; -*-*-sco3.2v5*) - no_dev_ptmx=1 - ;; -*-*-cygwin*) - no_dev_ptmx=1 - ;; -*-*-darwin*) - no_dev_ptmx=1 - ;; -*-*-freebsd*) - no_dev_ptmx=1 - ;; -esac - -if test -z "$no_dev_ptmx" ; then - if test "x$disable_ptmx_check" != "xyes" ; then - AC_CHECK_FILE([/dev/ptmx], - [ - AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1, [Define if you have /dev/ptmx.]) - have_dev_ptmx=1 - ] - ) - fi -fi -AC_CHECK_FILE([/dev/ptc], - [ - AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1, [Define if you have /dev/ptc.]) - have_dev_ptc=1 - ] -) -dnl (end of code from openssh-3.2.2p1 configure.ac) - -dnl Check for systems where POSIX-style non-blocking I/O (O_NONBLOCK) -dnl doesn't work or is unimplemented. On these systems (mostly older -dnl ones), use the old BSD-style FIONBIO approach instead. [tcl.m4] -AC_CACHE_CHECK([FIONBIO vs. O_NONBLOCK for non-blocking I/O], - ac_cv_nonblocking_io, [ - case "$host" in - *-*-osf*) - ac_cv_nonblocking_io=FIONBIO - ;; - *-*-sunos4*) - ac_cv_nonblocking_io=FIONBIO - ;; - *-*-ultrix*) - ac_cv_nonblocking_io=FIONBIO - ;; - *) - ac_cv_nonblocking_io=O_NONBLOCK - ;; - esac -]) -if [[ "$ac_cv_nonblocking_io" = "FIONBIO" ]]; then - AC_DEFINE(USE_FIONBIO, 1, [Define if BSD-style non-blocking I/O is to be used]) -fi - -dnl Check whether compiler supports byte bit-fields -AC_CACHE_CHECK([whether compiler supports byte bit-fields], - ac_cv_have_byte_bitfields, [ - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_RUN([ - struct A { - unsigned char b1:4; - unsigned char b2:4; - unsigned char c; - unsigned short s; - unsigned char a[4]; - }; - - int main(void) { - A a; - return ! (sizeof(A) == 8 && &a.c == ((unsigned char *)&a + 1)); - }], - [ac_cv_have_byte_bitfields=yes], - [ac_cv_have_byte_bitfields=no], - dnl When cross-compiling, assume only GCC supports this - [if [[ "$GCC" = "yes" ]]; then - ac_cv_have_byte_bitfields="guessing yes" - else - ac_cv_have_byte_bitfields="guessing no" - fi] - ) - AC_LANG_RESTORE -]) - -dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES) -AC_DEFUN([AC_CHECK_FRAMEWORK], [ - AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl - AC_CACHE_CHECK([whether compiler supports framework $1], - ac_Framework, [ - saved_LIBS="$LIBS" - LIBS="$LIBS -framework $1" - AC_TRY_LINK( - [$2], [], - [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"] - ) - ]) - AS_IF([test AS_VAR_GET(ac_Framework) = yes], - [AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])] - ) - AS_VAR_POPDEF([ac_Framework])dnl -]) - -dnl Check for some MacOS X frameworks -AC_CHECK_FRAMEWORK(Carbon, [#include ]) -AC_CHECK_FRAMEWORK(IOKit, [#include ]) -AC_CHECK_FRAMEWORK(CoreFoundation, [#include ]) -AC_CHECK_FRAMEWORK(CoreAudio, [#include ]) -AC_CHECK_FRAMEWORK(AudioUnit, [#include ]) -AC_CHECK_FRAMEWORK(AudioToolbox, [#include ]) -AC_CHECK_FRAMEWORK(AppKit, []) - -dnl Select system-dependant sources. -SERIALSRC=serial_unix.cpp -ETHERSRC=../dummy/ether_dummy.cpp -SCSISRC=../dummy/scsi_dummy.cpp -AUDIOSRC=../dummy/audio_dummy.cpp -PREFSSRC=../dummy/prefs_dummy.cpp -EXTFSSRC=extfs_unix.cpp -EXTRASYSSRCS= -case "$target_os" in -linux*) - ETHERSRC=ether_unix.cpp - AUDIOSRC=audio_oss_esd.cpp - SCSISRC=Linux/scsi_linux.cpp - if [[ "x$EMULATED_PPC" = "xno" ]]; then - EXTRASYSSRCS="paranoia.cpp Linux/sheepthreads.c ppc_asm.S" - fi - ;; -freebsd*) - ETHERSRC=ether_unix.cpp - ;; -netbsd*) - ETHERSRC=ether_unix.cpp - if [[ "x$EMULATED_PPC" = "xno" ]]; then - EXTRASYSSRCS="paranoia.cpp NetBSD/sheepthreads.c ppc_asm.S" - fi - ;; -darwin*) - ETHERSRC=ether_unix.cpp - if [[ "x$EMULATED_PPC" = "xno" ]]; then - EXTRASYSSRCS="paranoia.cpp ppc_asm.S" - fi - if [[ "x$ac_cv_framework_IOKit" = "xyes" -a "x$ac_cv_framework_CoreFoundation" = "xyes" ]]; then - EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/sys_darwin.cpp" - fi - if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then - EXTFSSRC=../MacOSX/extfs_macosx.cpp - if [[ "x$ac_cv_framework_AppKit" = "xyes" -a "x$WANT_GTK" = "xno" ]]; then - PREFSSRC="../MacOSX/prefs_macosx.mm ../MacOSX/Launcher/VMSettingsController.mm ../MacOSX/Launcher/DiskType.m" - CPPFLAGS="$CPPFLAGS -I../MacOSX/Launcher" - fi - fi - if [[ "x$WANT_ESD" = "xno" -a "x$ac_cv_framework_CoreAudio" = "xyes" -a "x$WANT_SDL_AUDIO" = "xno" ]]; then - AUDIOSRC="../MacOSX/audio_macosx.cpp ../MacOSX/AudioBackEnd.cpp ../MacOSX/AudioDevice.cpp ../MacOSX/MacOSX_sound_if.cpp" - OSX_CORE_AUDIO="-DOSX_CORE_AUDIO" - fi - ;; -irix*) - AUDIOSRC=Irix/audio_irix.cpp - LIBS="$LIBS -laudio" - WANT_ESD=no - - dnl Check if our compiler supports -IPA (MIPSPro) - HAVE_IPA=no - ocflags="$CFLAGS" - CFLAGS=`echo " $CFLAGS -IPA" | sed -e "s/ -g //g"` - AC_MSG_CHECKING(if "-IPA" works) - dnl Do a test compile of an empty function - AC_TRY_COMPILE([#if defined __GNUC__ - # error GCC does not support IPA yet - #endif],, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no)) - CFLAGS="$ocflags" - ;; -esac - -dnl BINCUE -AS_IF([test "x$with_bincue" = "xyes" ], [have_bincue=yes], [have_bincue=no]) -AS_IF([test "x$have_bincue" = "xyes" ], [ - if [[ "xOSX_CORE_AUDIO" = "xno" -a "x$WANT_SDL_AUDIO"="xno" ]]; then - AC_MSG_ERROR([You need SDL or OSX Core Audio to use BINCUE support.]) - else - CPPFLAGS="$CPPFLAGS -DBINCUE $OSX_CORE_AUDIO" - fi -]) - -dnl LIBVHD -AS_IF([test "x$with_libvhd" = "xyes" ], [have_libvhd=yes], [have_libvhd=no]) -AS_IF([test "x$have_libvhd" = "xyes" ], [ - CPPFLAGS="$CPPFLAGS -DHAVE_LIBVHD" - LIBS="$LIBS -lvhd" - case $target_os in - linux*) - LIBS="$LIBS -luuid" - esac - AC_CHECK_LIB(vhd, vhd_open) - AC_CHECK_LIB(vhd, vhd_io_read) - AC_CHECK_LIB(vhd, vhd_io_write) - AC_CHECK_LIB(vhd, vhd_close) -]) - - - - -dnl Is the slirp library supported? -case "$ac_cv_have_byte_bitfields" in -yes|"guessing yes") - CAN_SLIRP=yes - ETHERSRC=ether_unix.cpp - ;; -esac -if [[ -n "$CAN_SLIRP" ]]; then - AC_DEFINE(HAVE_SLIRP, 1, [Define if slirp library is supported]) - SLIRP_SRCS="\ - ../slirp/bootp.c ../slirp/ip_output.c ../slirp/tcp_input.c \ - ../slirp/cksum.c ../slirp/mbuf.c ../slirp/tcp_output.c \ - ../slirp/debug.c ../slirp/misc.c ../slirp/tcp_subr.c \ - ../slirp/if.c ../slirp/sbuf.c ../slirp/tcp_timer.c \ - ../slirp/ip_icmp.c ../slirp/slirp.c ../slirp/tftp.c \ - ../slirp/ip_input.c ../slirp/socket.c ../slirp/udp.c" -fi -AC_SUBST(SLIRP_SRCS) - -dnl SDL overrides -if [[ "x$WANT_SDL" = "xyes" ]]; then - AC_DEFINE(USE_SDL, 1, [Define to enble SDL support.]) - if [[ "x$WANT_SDL_FRAMEWORK" = "xyes" ]]; then - EXTRASYSSRCS="$EXTRASYSSRCS ../SDL/SDLMain.m" - fi -fi -if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then - AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support.]) - VIDEOSRCS="../SDL/video_sdl.cpp" - KEYCODES="../SDL/keycodes" - if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then - AC_MSG_CHECKING([whether __LP64__ is defined]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if !defined(__LP64__) - # error __LP64__ not defined - #endif - ]])], - [AC_MSG_RESULT(yes); LP64_DEFINED=yes], - [AC_MSG_RESULT(no)]) - if [[ "x$LP64_DEFINED" = "xyes" ]]; then - EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/clip_macosx64.mm ../pict.c" - else - EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/clip_macosx.cpp" - fi - EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/utils_macosx.mm" - CPPFLAGS="$CPPFLAGS -I../MacOSX" - else - EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp" - fi -else - VIDEOSRCS="video_x.cpp" - KEYCODES="keycodes" - EXTRASYSSRCS="$EXTRASYSSRCS clip_unix.cpp" -fi -if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then - AC_DEFINE(USE_SDL_AUDIO, 1, [Define to enable SDL audio support]) - AUDIOSRC="../SDL/audio_sdl.cpp" -fi - -dnl BINCUE overrides - -if [[ "x$have_bincue" = "xyes" ]]; then - EXTRASYSSRCS="$EXTRASYSSRCS bincue_unix.cpp" -fi - -dnl libvhd overrides - -if [[ "x$have_libvhd" = "xyes" ]]; then - EXTRASYSSRCS="$EXTRASYSSRCS vhd_unix.cpp" -fi - - -SYSSRCS="$VIDEOSRCS $EXTFSSRC $PREFSSRC $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $EXTRASYSSRCS" - -dnl Define a macro that translates a yesno-variable into a C macro definition -dnl to be put into the config.h file -dnl $1 -- the macro to define -dnl $2 -- the value to translate -dnl $3 -- template name -AC_DEFUN([AC_TRANSLATE_DEFINE], [ - if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then - AC_DEFINE($1, 1, $3) - fi -]) - -dnl Check that the host supports TUN/TAP devices -AC_CACHE_CHECK([whether TUN/TAP is supported], - ac_cv_tun_tap_support, [ - AC_TRY_COMPILE([ - #if defined(HAVE_NETINET_IN_H) - #include - #endif - #if defined(HAVE_LINUX_IF_H) && defined(HAVE_LINUX_IF_TUN_H) - #include - #include - #endif - #if defined(HAVE_NET_IF_H) && defined(HAVE_NET_IF_TUN_H) - #include - #include - #endif - ], [ - struct ifreq ifr; - memset(&ifr, 0, sizeof(ifr)); - ifr.ifr_flags = IFF_TAP | IFF_NO_PI; - ], - ac_cv_tun_tap_support=yes, ac_cv_tun_tap_support=no - ) -]) -AC_TRANSLATE_DEFINE(ENABLE_TUNTAP, "$ac_cv_tun_tap_support", - [Define if your system supports TUN/TAP devices.]) - -dnl Various checks if the system supports vm_allocate() and the like functions. -have_mach_vm=no -if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \ - "x$ac_cv_func_vm_protect" = "xyes" ]]; then - have_mach_vm=yes -fi -AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm", - [Define if your system has a working vm_allocate()-based memory allocator.]) - -dnl Check that vm_allocate(), vm_protect() work -if [[ "x$have_mach_vm" = "xyes" ]]; then - -AC_CACHE_CHECK([whether vm_protect works], - ac_cv_vm_protect_works, [ - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - ac_cv_vm_protect_works=yes - dnl First the tests that should segfault - for test_def in NONE_READ NONE_WRITE READ_WRITE; do - AC_TRY_RUN([ - #define CONFIGURE_TEST_VM_MAP - #define TEST_VM_PROT_$test_def - #include "../CrossPlatform/vm_alloc.cpp" - ], ac_cv_vm_protect_works=no, rm -f core, - dnl When cross-compiling, do not assume anything - ac_cv_vm_protect_works="guessing no" - ) - done - AC_TRY_RUN([ - #define CONFIGURE_TEST_VM_MAP - #define TEST_VM_PROT_RDWR_WRITE - #include "../CrossPlatform/vm_alloc.cpp" - ], , ac_cv_vm_protect_works=no, - dnl When cross-compiling, do not assume anything - ac_cv_vm_protect_works="guessing no" - ) - AC_LANG_RESTORE - ] -) - -dnl Remove support for vm_allocate() if vm_protect() does not work -if [[ "x$have_mach_vm" = "xyes" ]]; then - case $ac_cv_vm_protect_works in - *yes) have_mach_vm=yes;; - *no) have_mach_vm=no;; - esac -fi -AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm", - [Define if your system has a working vm_allocate()-based memory allocator.]) - -fi dnl HAVE_MACH_VM - -dnl Various checks if the system supports mmap() and the like functions. -dnl ... and Mach memory allocators are not supported -have_mmap_vm=no -if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \ - "x$ac_cv_func_mprotect" = "xyes" ]]; then - if [[ "x$have_mach_vm" = "xno" ]]; then - have_mmap_vm=yes - fi -fi -AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm", - [Define if your system has a working mmap()-based memory allocator.]) - -dnl Check that mmap() and associated functions work. -if [[ "x$have_mmap_vm" = "xyes" ]]; then - -dnl Check if we have a working anonymous mmap() -AC_CACHE_CHECK([whether mmap supports MAP_ANON], - ac_cv_mmap_anon, [ - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_RUN([ - #define HAVE_MMAP_ANON - #define CONFIGURE_TEST_VM_MAP - #define TEST_VM_MMAP_ANON - #include "../CrossPlatform/vm_alloc.cpp" - ], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no, - dnl When cross-compiling, do not assume anything. - ac_cv_mmap_anon="guessing no" - ) - AC_LANG_RESTORE - ] -) -AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon", - [Define if defines MAP_ANON and mmap()'ing with MAP_ANON works.]) - -AC_CACHE_CHECK([whether mmap supports MAP_ANONYMOUS], - ac_cv_mmap_anonymous, [ - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_RUN([ - #define HAVE_MMAP_ANONYMOUS - #define CONFIGURE_TEST_VM_MAP - #define TEST_VM_MMAP_ANON - #include "../CrossPlatform/vm_alloc.cpp" - ], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no, - dnl When cross-compiling, do not assume anything. - ac_cv_mmap_anonymous="guessing no" - ) - AC_LANG_RESTORE - ] -) -AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous", - [Define if defines MAP_ANONYMOUS and mmap()'ing with MAP_ANONYMOUS works.]) - -AC_CACHE_CHECK([whether mprotect works], - ac_cv_mprotect_works, [ - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - ac_cv_mprotect_works=yes - dnl First the tests that should segfault - for test_def in NONE_READ NONE_WRITE READ_WRITE; do - AC_TRY_RUN([ - #define CONFIGURE_TEST_VM_MAP - #define TEST_VM_PROT_$test_def - #include "../CrossPlatform/vm_alloc.cpp" - ], ac_cv_mprotect_works=no, rm -f core, - dnl When cross-compiling, do not assume anything - ac_cv_mprotect_works="guessing no" - ) - done - AC_TRY_RUN([ - #define CONFIGURE_TEST_VM_MAP - #define TEST_VM_PROT_RDWR_WRITE - #include "../CrossPlatform/vm_alloc.cpp" - ], , ac_cv_mprotect_works=no, - dnl When cross-compiling, do not assume anything - ac_cv_mprotect_works="guessing no" - ) - AC_LANG_RESTORE - ] -) - -dnl Remove support for mmap() if mprotect() does not work -if [[ "x$have_mmap_vm" = "xyes" ]]; then - case $ac_cv_mprotect_works in - *yes) have_mmap_vm=yes;; - *no) have_mmap_vm=no;; - esac -fi -AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm, - [Define if your system has a working mmap()-based memory allocator.]) - -fi dnl HAVE_MMAP_VM - -dnl Check if we can disable position-independent code -AC_CACHE_CHECK([how to disable position-independent code], - ac_cv_no_pie, [ - ac_cv_no_pie='-Wl,-no_pie' - saved_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $ac_cv_no_pie" - AC_TRY_LINK(,,,[ac_cv_no_pie="cannot"]) - if [[ "$ac_cv_no_pie" = "cannot" ]]; then - LDFLAGS="$saved_LDFLAGS" - fi -]) - -dnl Check if we can modify the __PAGEZERO segment for use as Low Memory -AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x3000], - ac_cv_pagezero_hack, [ - ac_cv_pagezero_hack=no - if AC_TRY_COMMAND([Darwin/testlmem.sh 0x3000]); then - ac_cv_pagezero_hack=yes - dnl might as well skip the test for mmap-able low memory - ac_cv_can_map_lm=no - fi -]) -AC_TRANSLATE_DEFINE(PAGEZERO_HACK, "$ac_cv_pagezero_hack", - [Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this system.]) - -dnl Check if we can mmap 0x3000 bytes from 0x0000 -AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x3000], - ac_cv_can_map_lm, [ - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_RUN([ - #include "../CrossPlatform/vm_alloc.cpp" - int main(void) { /* returns 0 if we could map the lowmem globals */ - volatile char * lm = 0; - if (vm_init() < 0) exit(1); - if (vm_acquire_fixed(0, 0x2000) < 0) exit(1); - lm[0] = 'z'; - if (vm_release((char *)lm, 0x2000) < 0) exit(1); - vm_exit(); exit(0); - } - ], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no, - dnl When cross-compiling, do not assume anything. - ac_cv_can_map_lm="guessing no" - ) - AC_LANG_RESTORE - ] -) - -dnl Check signal handlers need to be reinstalled -AC_CACHE_CHECK([whether signal handlers need to be reinstalled], - ac_cv_signal_need_reinstall, [ - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_RUN([ - #include - #ifdef HAVE_UNISTD_H - #include - #endif - #include - static int handled_signal = 0; - RETSIGTYPE sigusr1_handler(int) { handled_signal++; } - int main(void) { /* returns 0 if signals need not to be reinstalled */ - signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); - exit(handled_signal == 2); - } - ], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no, - dnl When cross-compiling, do not assume anything. - ac_cv_signal_need_reinstall="guessing yes" - ) - AC_LANG_RESTORE - ] -) -AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall", - [Define if your system requires signals to be reinstalled.]) - -dnl Check if sigaction handlers need to be reinstalled -AC_CACHE_CHECK([whether sigaction handlers need to be reinstalled], - ac_cv_sigaction_need_reinstall, [ - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_RUN([ - #include - #ifdef HAVE_UNISTD_H - #include - #endif - #include - static int handled_signal = 0; - RETSIGTYPE sigusr1_handler(int) { handled_signal++; } - typedef RETSIGTYPE (*signal_handler)(int); - static signal_handler mysignal(int sig, signal_handler handler) { - struct sigaction old_sa; - struct sigaction new_sa; - new_sa.sa_handler = handler; - return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler); - } - int main(void) { /* returns 0 if signals need not to be reinstalled */ - mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); - exit(handled_signal == 2); - } - ], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no, - dnl When cross-compiling, do not assume anything. - ac_cv_sigaction_need_reinstall="guessing yes" - ) - AC_LANG_RESTORE - ] -) -AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall", - [Define if your system requires sigactions to be reinstalled.]) - -dnl Check if Mach exceptions supported. -AC_CACHE_CHECK([whether your system supports Mach exceptions], - ac_cv_have_mach_exceptions, [ - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_RUN([ - #define HAVE_MACH_EXCEPTIONS 1 - #define CONFIGURE_TEST_SIGSEGV_RECOVERY - #include "../CrossPlatform/vm_alloc.cpp" - #include "../CrossPlatform/sigsegv.cpp" - ], - ac_cv_have_mach_exceptions=yes, - ac_cv_have_mach_exceptions=no, - dnl When cross-compiling, do not assume anything. - ac_cv_have_mach_exceptions=no - ) - AC_LANG_RESTORE - ] -) -if [[ "$ac_cv_have_mach_exceptions" = "yes" ]]; then - sigsegv_recovery=mach -fi -AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions", - [Define if your system supports Mach exceptions.]) - -dnl Check if Windows exceptions are supported. -AC_CACHE_CHECK([whether your system supports Windows exceptions], - ac_cv_have_win32_exceptions, [ - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_RUN([ - #define HAVE_WIN32_EXCEPTIONS 1 - #define CONFIGURE_TEST_SIGSEGV_RECOVERY - #include "../CrossPlatform/vm_alloc.cpp" - #include "../CrossPlatform/sigsegv.cpp" - ], [ - sigsegv_recovery=win32 - ac_cv_have_win32_exceptions=yes - ], - ac_cv_have_win32_exceptions=no, - dnl When cross-compiling, do not assume anything. - ac_cv_have_win32_exceptions=no - ) - AC_LANG_RESTORE - ] -) -AC_TRANSLATE_DEFINE(HAVE_WIN32_EXCEPTIONS, "$ac_cv_have_win32_exceptions", - [Define if your system supports Windows exceptions.]) - -dnl Otherwise, check if extended signals are supported. -if [[ -z "$sigsegv_recovery" ]]; then - AC_CACHE_CHECK([whether your system supports extended signal handlers], - ac_cv_have_extended_signals, [ - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_RUN([ - #define HAVE_SIGINFO_T 1 - #define CONFIGURE_TEST_SIGSEGV_RECOVERY - #include "../CrossPlatform/vm_alloc.cpp" - #include "../CrossPlatform/sigsegv.cpp" - ], - ac_cv_have_extended_signals=yes, - ac_cv_have_extended_signals=no, - dnl When cross-compiling, do not assume anything. - ac_cv_have_extended_signals=no - ) - AC_LANG_RESTORE - ] - ) - if [[ "$ac_cv_have_extended_signals" = "yes" ]]; then - sigsegv_recovery=siginfo - fi - AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals", - [Define if your system support extended signals.]) -fi - -dnl Otherwise, check for subterfuges. -if [[ -z "$sigsegv_recovery" ]]; then - AC_CACHE_CHECK([whether we then have a subterfuge for your system], - ac_cv_have_sigcontext_hack, [ - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_RUN([ - #define HAVE_SIGCONTEXT_SUBTERFUGE 1 - #define CONFIGURE_TEST_SIGSEGV_RECOVERY - #include "../CrossPlatform/vm_alloc.cpp" - #include "../CrossPlatform/sigsegv.cpp" - ], - ac_cv_have_sigcontext_hack=yes, - ac_cv_have_sigcontext_hack=no, - dnl When cross-compiling, do not assume anything. - ac_cv_have_sigcontext_hack=no - ) - AC_LANG_RESTORE - ]) - if [[ "$ac_cv_have_sigcontext_hack" = "yes" ]]; then - sigsegv_recovery=sigcontext - fi - AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack", - [Define if we know a hack to replace siginfo_t->si_addr member.]) -fi - -dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler) -AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler], - ac_cv_have_skip_instruction, [ - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_RUN([ - #define HAVE_SIGSEGV_SKIP_INSTRUCTION 1 - #define CONFIGURE_TEST_SIGSEGV_RECOVERY - #include "../CrossPlatform/vm_alloc.cpp" - #include "../CrossPlatform/sigsegv.cpp" - ], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no, - dnl When cross-compiling, do not assume anything. - ac_cv_have_skip_instruction=no - ) - AC_LANG_RESTORE - ] -) -AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction", - [Define if we can ignore the fault (instruction skipping in SIGSEGV handler).]) - -dnl Can we do Video on SEGV Signals ? -CAN_VOSF=no -if [[ -n "$sigsegv_recovery" ]]; then - CAN_VOSF=yes -fi - -dnl Enable VOSF screen updates with this feature is requested and feasible -if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then - AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.]) -else - WANT_VOSF=no -fi - -dnl Check addressing mode to use -AC_MSG_CHECKING([for addressing mode to use]) -if [[ "$EMULATED_PPC" != "yes" ]]; then - if [[ "$WANT_ADDRESSING_MODE" != "real" ]]; then - AC_MSG_WARN([Running in native PowerPC mode, force use of Real Addressing.]) - WANT_ADDRESSING_MODE="real" - fi -fi -if [[ "$WANT_ADDRESSING_MODE" = "direct" ]]; then - if [[ -n "$NATMEM_OFFSET" ]]; then - NATMEM_OFFSET_DEF="-DNATMEM_OFFSET=$NATMEM_OFFSET" - fi - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - cat confdefs.h > conftest.$ac_ext - cat >> conftest.$ac_ext << EOF -#include -#include -#include "../CrossPlatform/vm_alloc.cpp" - -int main(void) -{ - if (vm_init() < 0) - return 1; - - static const struct { - unsigned long base; - unsigned int size; - } ranges[[]] = { - { 0x00000000, 0x0003000 }, - { 0x10000000, 0x2000000 }, - { 0x40800000, 0x0400000 }, - { 0x68070000, 0x0010000 }, - { 0x69000000, 0x0080000 }, - { 0x68ffe000, 0x0002000 }, - { 0x5fffe000, 0x0002000 }, - { 0x60000000, 0x0040000 }, - }; - const int n_ranges = sizeof(ranges)/ sizeof(ranges[[0]]); - -#ifdef NATMEM_OFFSET - unsigned long ofs = NATMEM_OFFSET; -#else - for (unsigned long ofs = 0x10000000; ofs <= 0x90000000; ofs += 0x10000000) -#endif - for (int i = 0; i < n_ranges; i++) { - char *m = (char *)(ranges[[i]].base + ofs); - if (vm_acquire_fixed(m, ranges[[i]].size) != 0) - break; - memset(m, 0, ranges[[i]].size); - vm_release(m, ranges[[i]].size); - if (i == n_ranges - 1) { - if (sizeof(void *) == 8 && ofs > 0xffffffff) - printf("0x%lxul\n", ofs); - else - printf("0x%08x\n", ofs); - return 0; - } - } - - vm_exit(); - return 1; -} -EOF - doit='$CXX conftest.$ac_ext -o conftest.$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS $LIBS $NATMEM_OFFSET_DEF >& AS_MESSAGE_LOG_FD' - if AC_TRY_EVAL(doit); then - NATMEM_OFFSET=`./conftest.$ac_exeext` - else - NATMEM_OFFSET= - fi - rm -f conftest* - AC_LANG_RESTORE - - if [[ -z "$NATMEM_OFFSET" ]]; then - AC_MSG_ERROR([could not determine a sensible NATMEM_OFFSET value]) - else - WANT_ADDRESSING_MODE="direct,$NATMEM_OFFSET" - AC_DEFINE_UNQUOTED(NATMEM_OFFSET, $NATMEM_OFFSET, - [Define constant offset for Mac address translation]) - fi -fi -AC_MSG_RESULT($WANT_ADDRESSING_MODE) - -dnl Utility macro used by next two tests. -dnl AC_EXAMINE_OBJECT(C source code, -dnl commands examining object file, -dnl [commands to run if compile failed]): -dnl -dnl Compile the source code to an object file; then convert it into a -dnl printable representation. All unprintable characters and -dnl asterisks (*) are replaced by dots (.). All white space is -dnl deleted. Newlines (ASCII 0x10) in the input are preserved in the -dnl output, but runs of newlines are compressed to a single newline. -dnl Finally, line breaks are forcibly inserted so that no line is -dnl longer than 80 columns and the file ends with a newline. The -dnl result of all this processing is in the file conftest.dmp, which -dnl may be examined by the commands in the second argument. -dnl -AC_DEFUN([gcc_AC_EXAMINE_OBJECT], -[AC_LANG_SAVE -AC_LANG_C -dnl Next bit cribbed from AC_TRY_COMPILE. -cat > conftest.$ac_ext < conftest.dmp - $2 -ifelse($3, , , else - $3 -)dnl -fi -rm -rf conftest* -AC_LANG_RESTORE]) - -dnl Floating point format probe. -dnl The basic concept is the same as the above: grep the object -dnl file for an interesting string. We have to watch out for -dnl rounding changing the values in the object, however; this is -dnl handled by ignoring the least significant byte of the float. -dnl -dnl Does not know about VAX G-float or C4x idiosyncratic format. -dnl It does know about PDP-10 idiosyncratic format, but this is -dnl not presently supported by GCC. S/390 "binary floating point" -dnl is in fact IEEE (but maybe we should have that in EBCDIC as well -dnl as ASCII?) -dnl -AC_DEFUN([gcc_AC_C_FLOAT_FORMAT], -[AC_CACHE_CHECK(floating point format, ac_cv_c_float_format, -[gcc_AC_EXAMINE_OBJECT( -[/* This will not work unless sizeof(double) == 8. */ -extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1]; - -/* This structure must have no internal padding. */ -struct possibility { - char prefix[8]; - double candidate; - char postfix[8]; -}; - -#define C(cand) { "\nformat:", cand, ":tamrof\n" } -struct possibility table [] = -{ - C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */ - C( 3.53802595280598432000e+18), /* D__float - VAX */ - C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */ - C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */ - C(-5.22995989424860458374e+10) /* IBMHEXFP - s/390 format, EBCDIC */ -};], - [if grep 'format:.@IEEEF.:tamrof' conftest.dmp >/dev/null 2>&1; then - ac_cv_c_float_format='IEEE (big-endian)' - elif grep 'format:.I@@PFE.:tamrof' conftest.dmp >/dev/null 2>&1; then - ac_cv_c_float_format='IEEE (big-endian)' - elif grep 'format:.FEEEI@.:tamrof' conftest.dmp >/dev/null 2>&1; then - ac_cv_c_float_format='IEEE (little-endian)' - elif grep 'format:.EFP@@I.:tamrof' conftest.dmp >/dev/null 2>&1; then - ac_cv_c_float_format='IEEE (little-endian)' - elif grep 'format:.__floa.:tamrof' conftest.dmp >/dev/null 2>&1; then - ac_cv_c_float_format='VAX D-float' - elif grep 'format:..PDP-1.:tamrof' conftest.dmp >/dev/null 2>&1; then - ac_cv_c_float_format='PDP-10' - elif grep 'format:.BMHEXF.:tamrof' conftest.dmp >/dev/null 2>&1; then - ac_cv_c_float_format='IBM 370 hex' - else - AC_MSG_ERROR(Unknown floating point format) - fi], - [AC_MSG_ERROR(compile failed)]) -]) -# IEEE is the default format. If the float endianness isn't the same -# as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN -# (which is a tristate: yes, no, default). This is only an issue with -# IEEE; the other formats are only supported by a few machines each, -# all with the same endianness. -format=IEEE_FLOAT_FORMAT -fbigend= -case $ac_cv_c_float_format in - 'IEEE (big-endian)' ) - if test $ac_cv_c_bigendian = no; then - fbigend=1 - fi - ;; - 'IEEE (little-endian)' ) - if test $ac_cv_c_bigendian = yes; then - fbigend=0 - fi - ;; - 'VAX D-float' ) - format=VAX_FLOAT_FORMAT - ;; - 'PDP-10' ) - format=PDP10_FLOAT_FORMAT - ;; - 'IBM 370 hex' ) - format=IBM_FLOAT_FORMAT - ;; -esac -AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT, $format, - [Define to the floating point format of the host machine.]) -if test -n "$fbigend"; then - AC_DEFINE_UNQUOTED(HOST_FLOAT_WORDS_BIG_ENDIAN, $fbigend, - [Define to 1 if the host machine stores floating point numbers in - memory with the word containing the sign bit at the lowest address, - or to 0 if it does it the other way around. - - This macro should not be defined if the ordering is the same as for - multi-word integers.]) -fi -]) - -dnl Check for host float format -gcc_AC_C_FLOAT_FORMAT - -dnl Platform specific binary postprocessor -AC_PATH_PROG(BLESS, "true") -if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then - BLESS=Darwin/lowmem - LDFLAGS="$LDFLAGS -pagezero_size 0x3000" -fi - -dnl Check for GCC 2.7 or higher. -HAVE_GCC27=no -AC_MSG_CHECKING(for GCC 2.7 or higher) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5) - # error gcc < 2.7 - typedef syntax error; - #endif - ]])], - [AC_MSG_RESULT(yes); HAVE_GCC27=yes], - [AC_MSG_RESULT(no)]) - -dnl Check for GCC 3.0 or higher. -HAVE_GCC30=no -AC_MSG_CHECKING(for GCC 3.0 or higher) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 3) - # error gcc < 3 - typedef syntax error; - #endif - ]])], - [AC_MSG_RESULT(yes); HAVE_GCC30=yes], - [AC_MSG_RESULT(no)]) - -dnl Check for ICC. -AC_MSG_CHECKING(for ICC) -HAVE_ICC=no -if $CXX -V -v 2>&1 | grep -q "Intel(R) C++ Compiler"; then - HAVE_ICC=yes -fi -AC_MSG_RESULT($HAVE_ICC) - -dnl Determine the generated object format -AC_CACHE_CHECK([the format of compiler generated objects], - ac_cv_object_format, [ - echo 'int i;' > conftest.$ac_ext - ac_cv_object_format=no - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *"ELF"*) - ac_cv_object_format=elf - ;; - *"Mach-O"*) - ac_cv_object_format=mach - ;; - *) - ac_cv_object_format=unknown - ;; - esac - fi - rm -rf conftest* -]) - -dnl Add -fno-strict-aliasing for slirp sources -if [[ "x$HAVE_GCC30" = "xyes" ]]; then - SAVED_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fno-strict-aliasing" - AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing], - ac_cv_gcc_no_strict_aliasing, [ - AC_TRY_COMPILE([],[],[ac_cv_gcc_no_strict_aliasing=yes],[ac_cv_gcc_no_strict_aliasing=no]) - ]) - if [[ "x$ac_cv_gcc_no_strict_aliasing" = "xyes" ]]; then - AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing") - fi - CFLAGS="$SAVED_CFLAGS" -fi - -dnl Add -mdynamic-no-pic for MacOS X (XXX icc10 will support MacOS X) -if [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then - SAVED_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -mdynamic-no-pic" - AC_CACHE_CHECK([whether the compiler supports -mdynamic-no-pic], - ac_cv_gcc_mdynamic_no_pic, [ - AC_TRY_COMPILE([],[],[ac_cv_gcc_mdynamic_no_pic=yes],[ac_cv_gcc_mdynamic_no_pic=no]) - ]) - if [[ "x$ac_cv_gcc_mdynamic_no_pic" = "xyes" ]]; then - CXXFLAGS="$CXXFLAGS -mdynamic-no-pic" - else - CFLAGS="$SAVED_CFLAGS" - fi -fi - -dnl CPU emulator sources -if [[ "x$EMULATED_PPC" = "xyes" ]]; then - CPUSRCS="\ - ../kpx_cpu/src/mathlib/ieeefp.cpp \ - ../kpx_cpu/src/mathlib/mathlib.cpp \ - ../kpx_cpu/src/cpu/ppc/ppc-cpu.cpp \ - ../kpx_cpu/src/cpu/ppc/ppc-decode.cpp \ - ../kpx_cpu/src/cpu/ppc/ppc-execute.cpp \ - ../kpx_cpu/src/cpu/ppc/ppc-translate.cpp \ - ../kpx_cpu/src/utils/utils-cpuinfo.cpp" - CPPFLAGS="$CPPFLAGS -I../kpx_cpu/include -I../kpx_cpu/src" - - dnl Enable JIT compiler, if possible - if [[ "x$WANT_JIT" = "xyes" ]]; then - AC_CACHE_CHECK([whether dyngen can be used], - ac_cv_use_dyngen, [ - case $host_cpu:$ac_cv_object_format in - powerpc:elf) - ac_cv_use_dyngen=yes - ;; - x86_64:elf) - ac_cv_use_dyngen=yes - ;; - i?86:elf) - ac_cv_use_dyngen=yes - ;; - mips:elf) - ac_cv_use_dyngen=yes - ;; - powerpc:mach) - ac_cv_use_dyngen=yes - ;; - x86_64:mach) - ac_cv_use_dyngen=yes - ;; - i?86:mach) - ac_cv_use_dyngen=yes - ;; - *:*) - ac_cv_use_dyngen=no - ;; - esac - dnl Check for a suitable synthetic opcodes compiler (icc is faking itself as gcc 3.2.2) - if [[ -z "$DYNGEN_CC" ]]; then - if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then - DYNGEN_CC=$CXX - else - for p in /usr/bin /usr/local/bin /usr/freeware/bin; do - gxx="$p/g++" - if [[ -x "$gxx" ]]; then - DYNGEN_CC="$gxx" - fi - done - fi - fi - if [[ -z "$DYNGEN_CC" ]]; then - ac_cv_use_dyngen=no - fi - ]) - if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then - case $host_cpu in - i?86) - DYNGEN_OP_FLAGS="-fomit-frame-pointer" - ;; - mips) - DYNGEN_OP_FLAGS="-fno-delayed-branch -mno-abicalls" - ;; - powerpc) - if [[ "x$ac_cv_object_format" = "xmach" ]]; then - DYNGEN_OP_FLAGS="-mdynamic-no-pic" - fi - ;; - esac - have_dyngen_gcc3=no - case "x`$DYNGEN_CC -dumpversion`" in - x[12].*) ;; - x*) have_dyngen_gcc3=yes ;; - esac - if [[ "x$have_dyngen_gcc3" = "xyes" ]]; then - DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-align-functions" - else - DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -malign-functions=0" - fi - DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-functions -finline-limit=10000 -fno-exceptions -g0" - if [[ "x$have_dyngen_gcc3" = "xyes" ]]; then - DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-reorder-blocks -fno-optimize-sibling-calls" - fi - if [[ "x$DYNGEN_CC" != "x$CXX" ]]; then - DYNGEN_CFLAGS="-O2 $CFLAGS" - DYNGEN_CXXFLAGS="-O2 $CXXFLAGS" - else - DYNGEN_CFLAGS="\$(CFLAGS)" - DYNGEN_CXXFLAGS="\$(CXXFLAGS)" - fi - else - WANT_JIT=no - fi - AC_TRANSLATE_DEFINE(ENABLE_DYNGEN, $ac_cv_use_dyngen, [Define to enable dyngen engine]) - if [[ "x$WANT_JIT" = "xyes" ]]; then - DYNGENSRCS="\ - ../kpx_cpu/src/cpu/jit/dyngen.c \ - ../kpx_cpu/src/cpu/jit/cxxdemangle.cpp" - CPUSRCS="\ - ../kpx_cpu/src/cpu/jit/jit-cache.cpp \ - ../kpx_cpu/src/cpu/jit/basic-dyngen.cpp \ - ../kpx_cpu/src/cpu/ppc/ppc-dyngen.cpp \ - ../kpx_cpu/src/cpu/ppc/ppc-jit.cpp $CPUSRCS" - fi - fi - CPUSRCS="$CPUSRCS ../kpx_cpu/sheepshaver_glue.cpp ../kpx_cpu/ppc-dis.c" -else - WANT_JIT=no -fi -if [[ "x$WANT_JIT" = "xyes" ]]; then - CPPFLAGS="$CPPFLAGS -DUSE_JIT" -fi - -dnl Higher level optimizations with MIPSPro compilers are possible -if [[ "x$HAVE_IPA" = "xyes" ]]; then - CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA" - CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA" - CXXFLAGS="-LANG:std $CXXFLAGS" - LDFLAGS="$LDFLAGS -O3 -OPT:Olimit=0 -IPA" -fi - -dnl Check for linker script support -case $target_os:$target_cpu in -linux*:i?86) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";; -linux*:x86_64) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-x86_64.ld";; -linux*:powerpc) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-ppc.ld";; -netbsd*:i?86) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";; -freebsd*:i?86) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/freebsd-i386.ld";; -darwin*:*) LINKER_SCRIPT_FLAGS="-Wl,-seg1addr,0x78048000";; -esac -if [[ -n "$LINKER_SCRIPT_FLAGS" ]]; then - AC_CACHE_CHECK([whether linker script is usable], - ac_cv_linker_script_works, [ - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - saved_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $LINKER_SCRIPT_FLAGS" - AC_TRY_RUN( - [int main() {if ((char *)&main < (char *)0x70000000) return 1;}], - [ac_cv_linker_script_works=yes], - [ac_cv_linker_script_works=no], - dnl When cross-compiling, assume it works - [ac_cv_linker_script_works="guessing yes"] - ) - AC_LANG_RESTORE - if [[ "$ac_cv_linker_script_works" = "no" ]]; then - LDFLAGS="$saved_LDFLAGS" - LINKER_SCRIPT_FLAGS="" - fi - ]) -fi -AC_TRANSLATE_DEFINE(HAVE_LINKER_SCRIPT, "$ac_cv_linker_script_works", - [Define if there is a linker script to relocate the executable above 0x70000000.]) - -dnl Generate Makefile. -AC_SUBST(PERL) -AC_SUBST(USE_DYNGEN, [$ac_cv_use_dyngen]) -AC_SUBST(DYNGENSRCS) -AC_SUBST(DYNGEN_CC) -AC_SUBST(DYNGEN_CFLAGS) -AC_SUBST(DYNGEN_CXXFLAGS) -AC_SUBST(DYNGEN_OP_FLAGS) -AC_SUBST(SYSSRCS) -AC_SUBST(CPUSRCS) -AC_SUBST(BLESS) -AC_SUBST(KEYCODES) -AC_OUTPUT([ -Makefile -../MacOSX/Info.plist -]) - -dnl Print summary. -echo -echo SheepShaver configuration summary: -echo -echo SDL support ...................... : $SDL_SUPPORT -echo BINCUE support ................... : $have_bincue -echo LIBVHD support ................... : $have_libvhd -echo FBDev DGA support ................ : $WANT_FBDEV_DGA -echo XFree86 DGA support .............. : $WANT_XF86_DGA -echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE -echo Using PowerPC emulator ........... : $EMULATED_PPC -echo Enable JIT compiler .............. : $WANT_JIT -echo Enable video on SEGV signals ..... : $WANT_VOSF -echo ESD sound support ................ : $WANT_ESD -echo GTK user interface ............... : $WANT_GTK -echo mon debugger support ............. : $WANT_MON -echo Addressing mode .................. : $WANT_ADDRESSING_MODE -echo Bad memory access recovery type .. : $sigsegv_recovery -echo -echo "Configuration done. Now type \"make\"." diff --git a/SheepShaver/src/Unix/cpr.sh b/SheepShaver/src/Unix/cpr.sh deleted file mode 120000 index 29f13000..00000000 --- a/SheepShaver/src/Unix/cpr.sh +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/cpr.sh \ No newline at end of file diff --git a/SheepShaver/src/Unix/disk_sparsebundle.cpp b/SheepShaver/src/Unix/disk_sparsebundle.cpp deleted file mode 120000 index 7e368ca7..00000000 --- a/SheepShaver/src/Unix/disk_sparsebundle.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/disk_sparsebundle.cpp \ No newline at end of file diff --git a/SheepShaver/src/Unix/disk_unix.h b/SheepShaver/src/Unix/disk_unix.h deleted file mode 120000 index 87d10dfd..00000000 --- a/SheepShaver/src/Unix/disk_unix.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/disk_unix.h \ No newline at end of file diff --git a/SheepShaver/src/Unix/ether_unix.cpp b/SheepShaver/src/Unix/ether_unix.cpp deleted file mode 120000 index b2a75d72..00000000 --- a/SheepShaver/src/Unix/ether_unix.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/ether_unix.cpp \ No newline at end of file diff --git a/SheepShaver/src/Unix/extfs_unix.cpp b/SheepShaver/src/Unix/extfs_unix.cpp deleted file mode 120000 index 6a67ad61..00000000 --- a/SheepShaver/src/Unix/extfs_unix.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/extfs_unix.cpp \ No newline at end of file diff --git a/SheepShaver/src/Unix/install-sh b/SheepShaver/src/Unix/install-sh deleted file mode 100755 index 89fc9b09..00000000 --- a/SheepShaver/src/Unix/install-sh +++ /dev/null @@ -1,238 +0,0 @@ -#! /bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. -# - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -tranformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/SheepShaver/src/Unix/keycodes b/SheepShaver/src/Unix/keycodes deleted file mode 120000 index da89edcf..00000000 --- a/SheepShaver/src/Unix/keycodes +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/keycodes \ No newline at end of file diff --git a/SheepShaver/src/Unix/ldscripts b/SheepShaver/src/Unix/ldscripts deleted file mode 120000 index 39626083..00000000 --- a/SheepShaver/src/Unix/ldscripts +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/ldscripts \ No newline at end of file diff --git a/SheepShaver/src/Unix/m4 b/SheepShaver/src/Unix/m4 deleted file mode 120000 index a20fe840..00000000 --- a/SheepShaver/src/Unix/m4 +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/m4 \ No newline at end of file diff --git a/SheepShaver/src/Unix/main_unix.cpp b/SheepShaver/src/Unix/main_unix.cpp deleted file mode 100644 index 3d0ee43e..00000000 --- a/SheepShaver/src/Unix/main_unix.cpp +++ /dev/null @@ -1,2292 +0,0 @@ -/* - * main_unix.cpp - Emulation core, Unix implementation - * - * SheepShaver (C) Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NOTES: - * - * See main_beos.cpp for a description of the three operating modes. - * - * In addition to that, we have to handle the fact that the MacOS ABI - * is slightly different from the SysV ABI used by Linux: - * - Stack frames are different (e.g. LR is stored in 8(r1) under - * MacOS, but in 4(r1) under Linux) - * - There is a pointer to Thread Local Storage (TLS) under Linux with - * recent enough glibc. This is r2 in 32-bit mode and r13 in - * 64-bit mode (PowerOpen/AIX ABI) - * - r13 is used as a small data pointer under Linux (but appearently - * it is not used this way? To be sure, we specify -msdata=none - * in the Makefile) - * - There are no TVECTs under Linux; function pointers point - * directly to the function code - * The Execute*() functions have to account for this. Additionally, we - * cannot simply call MacOS functions by getting their TVECT and jumping - * to it. Such calls are done via the call_macos*() functions in - * asm_linux.S that create a MacOS stack frame, load the TOC pointer - * and put the arguments into the right registers. - * - * As on the BeOS, we have to specify an alternate signal stack because - * interrupts (and, under Linux, Low Memory accesses) may occur when r1 - * is pointing to the Kernel Data or to Low Memory. There is one - * problem, however, due to the alternate signal stack being global to - * all signal handlers. Consider the following scenario: - * - The main thread is executing some native PPC MacOS code in - * MODE_NATIVE, running on the MacOS stack (somewhere in the Mac RAM). - * - A SIGUSR2 interrupt occurs. The kernel switches to the signal - * stack and starts executing the SIGUSR2 signal handler. - * - The signal handler sees the MODE_NATIVE and calls ppc_interrupt() - * to handle a native interrupt. - * - ppc_interrupt() sets r1 to point to the Kernel Data and jumps to - * the nanokernel. - * - The nanokernel accesses a Low Memory global (most likely one of - * the XLMs), a SIGSEGV occurs. - * - The kernel sees that r1 does not point to the signal stack and - * switches to the signal stack again, thus overwriting the data that - * the SIGUSR2 handler put there. - * The same problem arises when calling ExecutePPC() inside the MODE_EMUL_OP - * interrupt handler. - * - * The solution is to set the signal stack to a second, "extra" stack - * inside the SIGUSR2 handler before entering the Nanokernel or calling - * ExecutePPC (or any function that might cause a mode switch). The signal - * stack is restored before exiting the SIGUSR2 handler. - * - * Note that POSIX standard says you can't modify the alternate - * signal stack while the process is executing on it. There is a - * hackaround though: we install a trampoline SIGUSR2 handler that - * sets up an alternate stack itself and calls the real handler. - * Then, when we call sigaltstack() there, we no longer get an EPERM, - * i.e. it now works. - * - * TODO: - * check if SIGSEGV handler works for all registers (including FP!) - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "sysdeps.h" -#include "main.h" -#include "version.h" -#include "prefs.h" -#include "prefs_editor.h" -#include "cpu_emulation.h" -#include "emul_op.h" -#include "xlowmem.h" -#include "xpram.h" -#include "timer.h" -#include "adb.h" -#include "video.h" -#include "sys.h" -#include "macos_util.h" -#include "rom_patches.h" -#include "user_strings.h" -#include "vm_alloc.h" -#include "sigsegv.h" -#include "sigregs.h" -#include "rpc.h" - -#define DEBUG 0 -#include "debug.h" - - -#ifdef HAVE_DIRENT_H -#include -#endif - -#ifdef USE_SDL -#include -#endif - -#ifndef USE_SDL_VIDEO -#include -#endif - -#ifdef ENABLE_GTK -#include -#endif - -#ifdef ENABLE_XF86_DGA -#include -#include -#include -#endif - -#ifdef ENABLE_MON -#include "mon.h" -#endif - - -// Enable emulation of unaligned lmw/stmw? -#define EMULATE_UNALIGNED_LOADSTORE_MULTIPLE 1 - -// Enable Execute68k() safety checks? -#define SAFE_EXEC_68K 0 - -// Interrupts in EMUL_OP mode? -#define INTERRUPTS_IN_EMUL_OP_MODE 1 - -// Interrupts in native mode? -#define INTERRUPTS_IN_NATIVE_MODE 1 - - -// Constants -const char ROM_FILE_NAME[] = "ROM"; -const char ROM_FILE_NAME2[] = "Mac OS ROM"; - -#if !REAL_ADDRESSING -// FIXME: needs to be >= 0x04000000 -const uintptr RAM_BASE = 0x10000000; // Base address of RAM -#endif -const uintptr ROM_BASE = 0x40800000; // Base address of ROM -#if REAL_ADDRESSING -const uint32 ROM_ALIGNMENT = 0x100000; // ROM must be aligned to a 1MB boundary -#endif -const uint32 SIG_STACK_SIZE = 0x10000; // Size of signal stack - - -// Global variables (exported) -#if !EMULATED_PPC -void *TOC = NULL; // Pointer to Thread Local Storage (r2) -void *R13 = NULL; // Pointer to .sdata section (r13 under Linux) -#endif -uint32 RAMBase; // Base address of Mac RAM -uint32 RAMSize; // Size of Mac RAM -uint32 ROMBase; // Base address of Mac ROM -uint32 KernelDataAddr; // Address of Kernel Data -uint32 BootGlobsAddr; // Address of BootGlobs structure at top of Mac RAM -uint32 DRCacheAddr; // Address of DR Cache -uint32 PVR; // Theoretical PVR -int64 CPUClockSpeed; // Processor clock speed (Hz) -int64 BusClockSpeed; // Bus clock speed (Hz) -int64 TimebaseSpeed; // Timebase clock speed (Hz) -uint8 *RAMBaseHost; // Base address of Mac RAM (host address space) -uint8 *ROMBaseHost; // Base address of Mac ROM (host address space) - - -// Global variables -#ifndef USE_SDL_VIDEO -char *x_display_name = NULL; // X11 display name -Display *x_display = NULL; // X11 display handle -#ifdef X11_LOCK_TYPE -X11_LOCK_TYPE x_display_lock = X11_LOCK_INIT; // X11 display lock -#endif -#endif - -static int zero_fd = 0; // FD of /dev/zero -static bool lm_area_mapped = false; // Flag: Low Memory area mmap()ped -static bool rom_area_mapped = false; // Flag: Mac ROM mmap()ped -static bool ram_area_mapped = false; // Flag: Mac RAM mmap()ped -static bool dr_cache_area_mapped = false; // Flag: Mac DR Cache mmap()ped -static bool dr_emulator_area_mapped = false;// Flag: Mac DR Emulator mmap()ped -static KernelData *kernel_data; // Pointer to Kernel Data -static EmulatorData *emulator_data; - -static uint8 last_xpram[XPRAM_SIZE]; // Buffer for monitoring XPRAM changes - -static bool nvram_thread_active = false; // Flag: NVRAM watchdog installed -static volatile bool nvram_thread_cancel; // Flag: Cancel NVRAM thread -static pthread_t nvram_thread; // NVRAM watchdog -static bool tick_thread_active = false; // Flag: MacOS thread installed -static volatile bool tick_thread_cancel; // Flag: Cancel 60Hz thread -static pthread_t tick_thread; // 60Hz thread -static pthread_t emul_thread; // MacOS thread - -static bool ready_for_signals = false; // Handler installed, signals can be sent - -#if EMULATED_PPC -static uintptr sig_stack = 0; // Stack for PowerPC interrupt routine -#else -static struct sigaction sigusr2_action; // Interrupt signal (of emulator thread) -static struct sigaction sigsegv_action; // Data access exception signal (of emulator thread) -static struct sigaction sigill_action; // Illegal instruction signal (of emulator thread) -static stack_t sig_stack; // Stack for signal handlers -static stack_t extra_stack; // Stack for SIGSEGV inside interrupt handler -static bool emul_thread_fatal = false; // Flag: MacOS thread crashed, tick thread shall dump debug output -static sigregs sigsegv_regs; // Register dump when crashed -static const char *crash_reason = NULL; // Reason of the crash (SIGSEGV, SIGBUS, SIGILL) -#endif - -static rpc_connection_t *gui_connection = NULL; // RPC connection to the GUI -static const char *gui_connection_path = NULL; // GUI connection identifier - -uint32 SheepMem::page_size; // Size of a native page -uintptr SheepMem::zero_page = 0; // Address of ro page filled in with zeros -uintptr SheepMem::base = 0x60000000; // Address of SheepShaver data -uintptr SheepMem::proc; // Bottom address of SheepShave procedures -uintptr SheepMem::data; // Top of SheepShaver data (stack like storage) - - -// Prototypes -static bool kernel_data_init(void); -static bool shm_map_address(int kernel_area, uint32 addr); -static void Quit(void); -static void *emul_func(void *arg); -static void *nvram_func(void *arg); -static void *tick_func(void *arg); -#if EMULATED_PPC -extern void emul_ppc(uint32 start); -extern void init_emul_ppc(void); -extern void exit_emul_ppc(void); -sigsegv_return_t sigsegv_handler(sigsegv_info_t *sip); -#else -extern "C" void sigusr2_handler_init(int sig, siginfo_t *sip, void *scp); -extern "C" void sigusr2_handler(int sig, siginfo_t *sip, void *scp); -static void sigsegv_handler(int sig, siginfo_t *sip, void *scp); -static void sigill_handler(int sig, siginfo_t *sip, void *scp); -#endif - - -// From asm_linux.S -#if !EMULATED_PPC -extern "C" void *get_sp(void); -extern "C" void *get_r2(void); -extern "C" void set_r2(void *); -extern "C" void *get_r13(void); -extern "C" void set_r13(void *); -extern "C" void flush_icache_range(uint32 start, uint32 end); -extern "C" void jump_to_rom(uint32 entry, uint32 context); -extern "C" void quit_emulator(void); -extern "C" void execute_68k(uint32 pc, M68kRegisters *r); -extern "C" void ppc_interrupt(uint32 entry, uint32 kernel_data); -extern "C" int atomic_add(int *var, int v); -extern "C" int atomic_and(int *var, int v); -extern "C" int atomic_or(int *var, int v); -extern void paranoia_check(void); -#endif - - -#if EMULATED_PPC -/* - * Return signal stack base - */ - -uintptr SignalStackBase(void) -{ - return sig_stack + SIG_STACK_SIZE; -} - - -/* - * Atomic operations - */ - -#if HAVE_SPINLOCKS -static spinlock_t atomic_ops_lock = SPIN_LOCK_UNLOCKED; -#else -#define spin_lock(LOCK) -#define spin_unlock(LOCK) -#endif - -int atomic_add(int *var, int v) -{ - spin_lock(&atomic_ops_lock); - int ret = *var; - *var += v; - spin_unlock(&atomic_ops_lock); - return ret; -} - -int atomic_and(int *var, int v) -{ - spin_lock(&atomic_ops_lock); - int ret = *var; - *var &= v; - spin_unlock(&atomic_ops_lock); - return ret; -} - -int atomic_or(int *var, int v) -{ - spin_lock(&atomic_ops_lock); - int ret = *var; - *var |= v; - spin_unlock(&atomic_ops_lock); - return ret; -} -#endif - - -/* - * Memory management helpers - */ - -static inline uint8 *vm_mac_acquire(uint32 size) -{ - return (uint8 *)vm_acquire(size); -} - -static inline int vm_mac_acquire_fixed(uint32 addr, uint32 size) -{ - return vm_acquire_fixed(Mac2HostAddr(addr), size); -} - -static inline int vm_mac_release(uint32 addr, uint32 size) -{ - return vm_release(Mac2HostAddr(addr), size); -} - - -/* - * Main program - */ - -static void usage(const char *prg_name) -{ - printf("Usage: %s [OPTION...]\n", prg_name); - printf("\nUnix options:\n"); - printf(" --display STRING\n X display to use\n"); - PrefsPrintUsage(); - exit(0); -} - -static bool valid_vmdir(const char *path) -{ - const int suffix_len = sizeof(".sheepvm") - 1; - int len = strlen(path); - if (len && path[len - 1] == '/') // to support both ".sheepvm" and ".sheepvm/" - len--; - if (len > suffix_len && !strncmp(path + len - suffix_len, ".sheepvm", suffix_len)) { - struct stat d; - if (!stat(path, &d) && S_ISDIR(d.st_mode)) { - return true; - } - } - return false; -} - -static void get_system_info(void) -{ -#if !EMULATED_PPC - FILE *proc_file; -#endif - - PVR = 0x00040000; // Default: 604 - CPUClockSpeed = 100000000; // Default: 100MHz - BusClockSpeed = 100000000; // Default: 100MHz - TimebaseSpeed = 25000000; // Default: 25MHz - -#if EMULATED_PPC - PVR = 0x000c0000; // Default: 7400 (with AltiVec) -#elif defined(__APPLE__) && defined(__MACH__) - proc_file = popen("ioreg -c IOPlatformDevice", "r"); - if (proc_file) { - char line[256]; - bool powerpc_node = false; - while (fgets(line, sizeof(line) - 1, proc_file)) { - // Read line - int len = strlen(line); - if (len == 0) - continue; - line[len - 1] = 0; - - // Parse line - if (strstr(line, "o PowerPC,")) - powerpc_node = true; - else if (powerpc_node) { - uint32 value; - char head[256]; - if (sscanf(line, "%[ |]\"cpu-version\" = <%x>", head, &value) == 2) - PVR = value; - else if (sscanf(line, "%[ |]\"clock-frequency\" = <%x>", head, &value) == 2) - CPUClockSpeed = value; - else if (sscanf(line, "%[ |]\"bus-frequency\" = <%x>", head, &value) == 2) - BusClockSpeed = value; - else if (sscanf(line, "%[ |]\"timebase-frequency\" = <%x>", head, &value) == 2) - TimebaseSpeed = value; - else if (strchr(line, '}')) - powerpc_node = false; - } - } - fclose(proc_file); - } else { - char str[256]; - sprintf(str, GetString(STR_PROC_CPUINFO_WARN), strerror(errno)); - WarningAlert(str); - } -#else - proc_file = fopen("/proc/cpuinfo", "r"); - if (proc_file) { - // CPU specs from Linux kernel - // TODO: make it more generic with features (e.g. AltiVec) and - // cache information and friends for NameRegistry - static const struct { - uint32 pvr_mask; - uint32 pvr_value; - const char *cpu_name; - } - cpu_specs[] = { - { 0xffff0000, 0x00010000, "601" }, - { 0xffff0000, 0x00030000, "603" }, - { 0xffff0000, 0x00060000, "603e" }, - { 0xffff0000, 0x00070000, "603ev" }, - { 0xffff0000, 0x00040000, "604" }, - { 0xfffff000, 0x00090000, "604e" }, - { 0xffff0000, 0x00090000, "604r" }, - { 0xffff0000, 0x000a0000, "604ev" }, - { 0xffffffff, 0x00084202, "740/750" }, - { 0xfffff000, 0x00083000, "745/755" }, - { 0xfffffff0, 0x00080100, "750CX" }, - { 0xfffffff0, 0x00082200, "750CX" }, - { 0xfffffff0, 0x00082210, "750CXe" }, - { 0xffffff00, 0x70000100, "750FX" }, - { 0xffffffff, 0x70000200, "750FX" }, - { 0xffff0000, 0x70000000, "750FX" }, - { 0xffff0000, 0x70020000, "750GX" }, - { 0xffff0000, 0x00080000, "740/750" }, - { 0xffffffff, 0x000c1101, "7400 (1.1)" }, - { 0xffff0000, 0x000c0000, "7400" }, - { 0xffff0000, 0x800c0000, "7410" }, - { 0xffffffff, 0x80000200, "7450" }, - { 0xffffffff, 0x80000201, "7450" }, - { 0xffff0000, 0x80000000, "7450" }, - { 0xffffff00, 0x80010100, "7455" }, - { 0xffffffff, 0x80010200, "7455" }, - { 0xffff0000, 0x80010000, "7455" }, - { 0xffff0000, 0x80020000, "7457" }, - { 0xffff0000, 0x80030000, "7447A" }, - { 0xffff0000, 0x80040000, "7448" }, - { 0x7fff0000, 0x00810000, "82xx" }, - { 0x7fff0000, 0x00820000, "8280" }, - { 0xffff0000, 0x00400000, "Power3 (630)" }, - { 0xffff0000, 0x00410000, "Power3 (630+)" }, - { 0xffff0000, 0x00360000, "I-star" }, - { 0xffff0000, 0x00370000, "S-star" }, - { 0xffff0000, 0x00350000, "Power4" }, - { 0xffff0000, 0x00390000, "PPC970" }, - { 0xffff0000, 0x003c0000, "PPC970FX" }, - { 0xffff0000, 0x00440000, "PPC970MP" }, - { 0xffff0000, 0x003a0000, "POWER5 (gr)" }, - { 0xffff0000, 0x003b0000, "POWER5+ (gs)" }, - { 0xffff0000, 0x003e0000, "POWER6" }, - { 0xffff0000, 0x00700000, "Cell Broadband Engine" }, - { 0x7fff0000, 0x00900000, "PA6T" }, - { 0, 0, 0 } - }; - - char line[256]; - while(fgets(line, 255, proc_file)) { - // Read line - int len = strlen(line); - if (len == 0) - continue; - line[len-1] = 0; - - // Parse line - int i; - float f; - char value[256]; - if (sscanf(line, "cpu : %[^,]", value) == 1) { - // Search by name - const char *cpu_name = NULL; - for (int i = 0; cpu_specs[i].pvr_mask != 0; i++) { - if (strcmp(cpu_specs[i].cpu_name, value) == 0) { - cpu_name = cpu_specs[i].cpu_name; - PVR = cpu_specs[i].pvr_value; - break; - } - } - if (cpu_name == NULL) - printf("WARNING: Unknown CPU type '%s', assuming 604\n", value); - else - printf("Found a PowerPC %s processor\n", cpu_name); - } - if (sscanf(line, "clock : %fMHz", &f) == 1) - CPUClockSpeed = BusClockSpeed = ((int64)f) * 1000000; - else if (sscanf(line, "clock : %dMHz", &i) == 1) - CPUClockSpeed = BusClockSpeed = i * 1000000; - } - fclose(proc_file); - } else { - char str[256]; - sprintf(str, GetString(STR_PROC_CPUINFO_WARN), strerror(errno)); - WarningAlert(str); - } - - // Get actual bus frequency - proc_file = fopen("/proc/device-tree/clock-frequency", "r"); - if (proc_file) { - union { uint8 b[4]; uint32 l; } value; - if (fread(value.b, sizeof(value), 1, proc_file) == 1) - BusClockSpeed = value.l; - fclose(proc_file); - } - - // Get actual timebase frequency - TimebaseSpeed = BusClockSpeed / 4; - DIR *cpus_dir; - if ((cpus_dir = opendir("/proc/device-tree/cpus")) != NULL) { - struct dirent *cpu_entry; - while ((cpu_entry = readdir(cpus_dir)) != NULL) { - if (strstr(cpu_entry->d_name, "PowerPC,") == cpu_entry->d_name) { - char timebase_freq_node[256]; - sprintf(timebase_freq_node, "/proc/device-tree/cpus/%s/timebase-frequency", cpu_entry->d_name); - proc_file = fopen(timebase_freq_node, "r"); - if (proc_file) { - union { uint8 b[4]; uint32 l; } value; - if (fread(value.b, sizeof(value), 1, proc_file) == 1) - TimebaseSpeed = value.l; - fclose(proc_file); - } - } - } - closedir(cpus_dir); - } -#endif - - // Remap any newer G4/G5 processor to plain G4 for compatibility - switch (PVR >> 16) { - case 0x8000: // 7450 - case 0x8001: // 7455 - case 0x8002: // 7457 - case 0x8003: // 7447A - case 0x8004: // 7448 - case 0x0039: // 970 - case 0x003c: // 970FX - case 0x0044: // 970MP - PVR = 0x000c0000; // 7400 - break; - } - D(bug("PVR: %08x (assumed)\n", PVR)); -} - -static bool load_mac_rom(void) -{ - uint32 rom_size, actual; - uint8 *rom_tmp; - const char *rom_path = PrefsFindString("rom"); - int rom_fd = open(rom_path && *rom_path ? rom_path : ROM_FILE_NAME, O_RDONLY); - if (rom_fd < 0) { - rom_fd = open(ROM_FILE_NAME2, O_RDONLY); - if (rom_fd < 0) { - ErrorAlert(GetString(STR_NO_ROM_FILE_ERR)); - return false; - } - } - printf("%s", GetString(STR_READING_ROM_FILE)); - rom_size = lseek(rom_fd, 0, SEEK_END); - lseek(rom_fd, 0, SEEK_SET); - rom_tmp = new uint8[ROM_SIZE]; - actual = read(rom_fd, (void *)rom_tmp, ROM_SIZE); - close(rom_fd); - - // Decode Mac ROM - if (!DecodeROM(rom_tmp, actual)) { - if (rom_size != 4*1024*1024) { - ErrorAlert(GetString(STR_ROM_SIZE_ERR)); - return false; - } else { - ErrorAlert(GetString(STR_ROM_FILE_READ_ERR)); - return false; - } - } - delete[] rom_tmp; - return true; -} - -static bool install_signal_handlers(void) -{ - char str[256]; -#if !EMULATED_PPC - // Create and install stacks for signal handlers - sig_stack.ss_sp = malloc(SIG_STACK_SIZE); - D(bug("Signal stack at %p\n", sig_stack.ss_sp)); - if (sig_stack.ss_sp == NULL) { - ErrorAlert(GetString(STR_NOT_ENOUGH_MEMORY_ERR)); - return false; - } - sig_stack.ss_flags = 0; - sig_stack.ss_size = SIG_STACK_SIZE; - if (sigaltstack(&sig_stack, NULL) < 0) { - sprintf(str, GetString(STR_SIGALTSTACK_ERR), strerror(errno)); - ErrorAlert(str); - return false; - } - extra_stack.ss_sp = malloc(SIG_STACK_SIZE); - D(bug("Extra stack at %p\n", extra_stack.ss_sp)); - if (extra_stack.ss_sp == NULL) { - ErrorAlert(GetString(STR_NOT_ENOUGH_MEMORY_ERR)); - return false; - } - extra_stack.ss_flags = 0; - extra_stack.ss_size = SIG_STACK_SIZE; - - // Install SIGSEGV and SIGBUS handlers - sigemptyset(&sigsegv_action.sa_mask); // Block interrupts during SEGV handling - sigaddset(&sigsegv_action.sa_mask, SIGUSR2); - sigsegv_action.sa_sigaction = sigsegv_handler; - sigsegv_action.sa_flags = SA_ONSTACK | SA_SIGINFO; -#ifdef HAVE_SIGNAL_SA_RESTORER - sigsegv_action.sa_restorer = NULL; -#endif - if (sigaction(SIGSEGV, &sigsegv_action, NULL) < 0) { - sprintf(str, GetString(STR_SIG_INSTALL_ERR), "SIGSEGV", strerror(errno)); - ErrorAlert(str); - return false; - } - if (sigaction(SIGBUS, &sigsegv_action, NULL) < 0) { - sprintf(str, GetString(STR_SIG_INSTALL_ERR), "SIGBUS", strerror(errno)); - ErrorAlert(str); - return false; - } -#else - // Install SIGSEGV handler for CPU emulator - if (!sigsegv_install_handler(sigsegv_handler)) { - sprintf(str, GetString(STR_SIG_INSTALL_ERR), "SIGSEGV", strerror(errno)); - ErrorAlert(str); - return false; - } -#endif - return true; -} - -#ifdef USE_SDL -static bool init_sdl() -{ - int sdl_flags = 0; -#ifdef USE_SDL_VIDEO - sdl_flags |= SDL_INIT_VIDEO; -#endif -#ifdef USE_SDL_AUDIO - sdl_flags |= SDL_INIT_AUDIO; -#endif - assert(sdl_flags != 0); - -#ifdef USE_SDL_VIDEO - // Don't let SDL block the screensaver - setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", true); - - // Make SDL pass through command-clicks and option-clicks unaltered - setenv("SDL_HAS3BUTTONMOUSE", "1", true); -#endif - - if (SDL_Init(sdl_flags) == -1) { - char str[256]; - sprintf(str, "Could not initialize SDL: %s.\n", SDL_GetError()); - ErrorAlert(str); - return false; - } - atexit(SDL_Quit); - - // Don't let SDL catch SIGINT and SIGTERM signals - signal(SIGINT, SIG_DFL); - signal(SIGTERM, SIG_DFL); - return true; -} -#endif - -int main(int argc, char **argv) -{ - char str[256]; - bool memory_mapped_from_zero, ram_rom_areas_contiguous; - const char *vmdir = NULL; - - // Initialize variables - RAMBase = 0; - tzset(); - - // Print some info - printf(GetString(STR_ABOUT_TEXT1), VERSION_MAJOR, VERSION_MINOR); - printf(" %s\n", GetString(STR_ABOUT_TEXT2)); - -#if !EMULATED_PPC -#ifdef SYSTEM_CLOBBERS_R2 - // Get TOC pointer - TOC = get_r2(); -#endif -#ifdef SYSTEM_CLOBBERS_R13 - // Get r13 register - R13 = get_r13(); -#endif -#endif - - // Parse command line arguments - for (int i=1; i i) { - k -= i; - for (int j=i+k; jed; - KernelDataAddr = KERNEL_DATA_BASE; - D(bug("Kernel Data at %p (%08x)\n", kernel_data, KERNEL_DATA_BASE)); - D(bug("Emulator Data at %p (%08x)\n", emulator_data, KERNEL_DATA_BASE + offsetof(KernelData, ed))); - - // Create area for DR Cache - if (vm_mac_acquire_fixed(DR_EMULATOR_BASE, DR_EMULATOR_SIZE) < 0) { - sprintf(str, GetString(STR_DR_EMULATOR_MMAP_ERR), strerror(errno)); - ErrorAlert(str); - goto quit; - } - dr_emulator_area_mapped = true; - if (vm_mac_acquire_fixed(DR_CACHE_BASE, DR_CACHE_SIZE) < 0) { - sprintf(str, GetString(STR_DR_CACHE_MMAP_ERR), strerror(errno)); - ErrorAlert(str); - goto quit; - } - dr_cache_area_mapped = true; -#if !EMULATED_PPC - if (vm_protect((char *)DR_CACHE_BASE, DR_CACHE_SIZE, VM_PAGE_READ | VM_PAGE_WRITE | VM_PAGE_EXECUTE) < 0) { - sprintf(str, GetString(STR_DR_CACHE_MMAP_ERR), strerror(errno)); - ErrorAlert(str); - goto quit; - } -#endif - DRCacheAddr = DR_CACHE_BASE; - D(bug("DR Cache at %p\n", DRCacheAddr)); - - // Create area for SheepShaver data - if (!SheepMem::Init()) { - sprintf(str, GetString(STR_SHEEP_MEM_MMAP_ERR), strerror(errno)); - ErrorAlert(str); - goto quit; - } - - // Create area for Mac RAM - RAMSize = PrefsFindInt32("ramsize"); - if (RAMSize < 8*1024*1024) { - WarningAlert(GetString(STR_SMALL_RAM_WARN)); - RAMSize = 8*1024*1024; - } - memory_mapped_from_zero = false; - ram_rom_areas_contiguous = false; -#if REAL_ADDRESSING && HAVE_LINKER_SCRIPT - if (vm_mac_acquire_fixed(0, RAMSize) == 0) { - D(bug("Could allocate RAM from 0x0000\n")); - RAMBase = 0; - RAMBaseHost = Mac2HostAddr(RAMBase); - memory_mapped_from_zero = true; - } -#endif - if (!memory_mapped_from_zero) { -#ifndef PAGEZERO_HACK - // Create Low Memory area (0x0000..0x3000) - if (vm_mac_acquire_fixed(0, 0x3000) < 0) { - sprintf(str, GetString(STR_LOW_MEM_MMAP_ERR), strerror(errno)); - ErrorAlert(str); - goto quit; - } - lm_area_mapped = true; -#endif -#if REAL_ADDRESSING - // Allocate RAM at any address. Since ROM must be higher than RAM, allocate the RAM - // and ROM areas contiguously, plus a little extra to allow for ROM address alignment. - RAMBaseHost = vm_mac_acquire(RAMSize + ROM_AREA_SIZE + ROM_ALIGNMENT); - if (RAMBaseHost == VM_MAP_FAILED) { - sprintf(str, GetString(STR_RAM_ROM_MMAP_ERR), strerror(errno)); - ErrorAlert(str); - goto quit; - } - RAMBase = Host2MacAddr(RAMBaseHost); - ROMBase = (RAMBase + RAMSize + ROM_ALIGNMENT -1) & -ROM_ALIGNMENT; - ROMBaseHost = Mac2HostAddr(ROMBase); - ram_rom_areas_contiguous = true; -#else - if (vm_mac_acquire_fixed(RAM_BASE, RAMSize) < 0) { - sprintf(str, GetString(STR_RAM_MMAP_ERR), strerror(errno)); - ErrorAlert(str); - goto quit; - } - RAMBase = RAM_BASE; - RAMBaseHost = Mac2HostAddr(RAMBase); -#endif - } -#if !EMULATED_PPC - if (vm_protect(RAMBaseHost, RAMSize, VM_PAGE_READ | VM_PAGE_WRITE | VM_PAGE_EXECUTE) < 0) { - sprintf(str, GetString(STR_RAM_MMAP_ERR), strerror(errno)); - ErrorAlert(str); - goto quit; - } -#endif - ram_area_mapped = true; - D(bug("RAM area at %p (%08x)\n", RAMBaseHost, RAMBase)); - - if (RAMBase > KernelDataAddr) { - ErrorAlert(GetString(STR_RAM_AREA_TOO_HIGH_ERR)); - goto quit; - } - - // Create area for Mac ROM - if (!ram_rom_areas_contiguous) { - if (vm_mac_acquire_fixed(ROM_BASE, ROM_AREA_SIZE) < 0) { - sprintf(str, GetString(STR_ROM_MMAP_ERR), strerror(errno)); - ErrorAlert(str); - goto quit; - } - ROMBase = ROM_BASE; - ROMBaseHost = Mac2HostAddr(ROMBase); - } -#if !EMULATED_PPC - if (vm_protect(ROMBaseHost, ROM_AREA_SIZE, VM_PAGE_READ | VM_PAGE_WRITE | VM_PAGE_EXECUTE) < 0) { - sprintf(str, GetString(STR_ROM_MMAP_ERR), strerror(errno)); - ErrorAlert(str); - goto quit; - } -#endif - rom_area_mapped = true; - D(bug("ROM area at %p (%08x)\n", ROMBaseHost, ROMBase)); - - if (RAMBase > ROMBase) { - ErrorAlert(GetString(STR_RAM_HIGHER_THAN_ROM_ERR)); - goto quit; - } - - // Load Mac ROM - if (!load_mac_rom()) - goto quit; - - // Initialize everything - if (!InitAll(vmdir)) - goto quit; - D(bug("Initialization complete\n")); - - // Clear caches (as we loaded and patched code) and write protect ROM -#if !EMULATED_PPC - flush_icache_range(ROMBase, ROMBase + ROM_AREA_SIZE); -#endif - vm_protect(ROMBaseHost, ROM_AREA_SIZE, VM_PAGE_READ | VM_PAGE_EXECUTE); - - // Start 60Hz thread - tick_thread_cancel = false; - tick_thread_active = (pthread_create(&tick_thread, NULL, tick_func, NULL) == 0); - D(bug("Tick thread installed (%ld)\n", tick_thread)); - - // Start NVRAM watchdog thread - memcpy(last_xpram, XPRAM, XPRAM_SIZE); - nvram_thread_cancel = false; - nvram_thread_active = (pthread_create(&nvram_thread, NULL, nvram_func, NULL) == 0); - D(bug("NVRAM thread installed (%ld)\n", nvram_thread)); - -#if !EMULATED_PPC - // Install SIGILL handler - sigemptyset(&sigill_action.sa_mask); // Block interrupts during ILL handling - sigaddset(&sigill_action.sa_mask, SIGUSR2); - sigill_action.sa_sigaction = sigill_handler; - sigill_action.sa_flags = SA_ONSTACK | SA_SIGINFO; -#ifdef HAVE_SIGNAL_SA_RESTORER - sigill_action.sa_restorer = NULL; -#endif - if (sigaction(SIGILL, &sigill_action, NULL) < 0) { - sprintf(str, GetString(STR_SIG_INSTALL_ERR), "SIGILL", strerror(errno)); - ErrorAlert(str); - goto quit; - } -#endif - -#if !EMULATED_PPC - // Install interrupt signal handler - sigemptyset(&sigusr2_action.sa_mask); - sigusr2_action.sa_sigaction = sigusr2_handler_init; - sigusr2_action.sa_flags = SA_ONSTACK | SA_RESTART | SA_SIGINFO; -#ifdef HAVE_SIGNAL_SA_RESTORER - sigusr2_action.sa_restorer = NULL; -#endif - if (sigaction(SIGUSR2, &sigusr2_action, NULL) < 0) { - sprintf(str, GetString(STR_SIG_INSTALL_ERR), "SIGUSR2", strerror(errno)); - ErrorAlert(str); - goto quit; - } -#endif - - // Get my thread ID and execute MacOS thread function - emul_thread = pthread_self(); - D(bug("MacOS thread is %ld\n", emul_thread)); - emul_func(NULL); - -quit: - Quit(); - return 0; -} - - -/* - * Cleanup and quit - */ - -static void Quit(void) -{ -#if EMULATED_PPC - // Exit PowerPC emulation - exit_emul_ppc(); -#endif - - // Stop 60Hz thread - if (tick_thread_active) { - tick_thread_cancel = true; - pthread_cancel(tick_thread); - pthread_join(tick_thread, NULL); - } - - // Stop NVRAM watchdog thread - if (nvram_thread_active) { - nvram_thread_cancel = true; - pthread_cancel(nvram_thread); - pthread_join(nvram_thread, NULL); - } - -#if !EMULATED_PPC - // Uninstall SIGSEGV and SIGBUS handlers - sigemptyset(&sigsegv_action.sa_mask); - sigsegv_action.sa_handler = SIG_DFL; - sigsegv_action.sa_flags = 0; - sigaction(SIGSEGV, &sigsegv_action, NULL); - sigaction(SIGBUS, &sigsegv_action, NULL); - - // Uninstall SIGILL handler - sigemptyset(&sigill_action.sa_mask); - sigill_action.sa_handler = SIG_DFL; - sigill_action.sa_flags = 0; - sigaction(SIGILL, &sigill_action, NULL); - - // Delete stacks for signal handlers - if (sig_stack.ss_sp) - free(sig_stack.ss_sp); - if (extra_stack.ss_sp) - free(extra_stack.ss_sp); -#endif - - // Deinitialize everything - ExitAll(); - - // Delete SheepShaver globals - SheepMem::Exit(); - - // Delete RAM area - if (ram_area_mapped) - vm_mac_release(RAMBase, RAMSize); - - // Delete ROM area - if (rom_area_mapped) - vm_mac_release(ROMBase, ROM_AREA_SIZE); - - // Delete DR cache areas - if (dr_emulator_area_mapped) - vm_mac_release(DR_EMULATOR_BASE, DR_EMULATOR_SIZE); - if (dr_cache_area_mapped) - vm_mac_release(DR_CACHE_BASE, DR_CACHE_SIZE); - - // Delete Low Memory area - if (lm_area_mapped) - vm_mac_release(0, 0x3000); - - // Close /dev/zero - if (zero_fd > 0) - close(zero_fd); - - // Exit system routines - SysExit(); - - // Exit preferences - PrefsExit(); - -#ifdef ENABLE_MON - // Exit mon - mon_exit(); -#endif - - // Close X11 server connection -#ifndef USE_SDL_VIDEO - if (x_display) - XCloseDisplay(x_display); -#endif - - // Notify GUI we are about to leave - if (gui_connection) { - if (rpc_method_invoke(gui_connection, RPC_METHOD_EXIT, RPC_TYPE_INVALID) == RPC_ERROR_NO_ERROR) - rpc_method_wait_for_reply(gui_connection, RPC_TYPE_INVALID); - } - - exit(0); -} - - -/* - * Initialize Kernel Data segments - */ - -static bool kernel_data_init(void) -{ - int error_string = STR_KD_SHMGET_ERR; - uint32 kernel_area_size = (KERNEL_AREA_SIZE + SHMLBA - 1) & -SHMLBA; - int kernel_area = shmget(IPC_PRIVATE, kernel_area_size, 0600); - if (kernel_area != -1) { - bool mapped = - shm_map_address(kernel_area, KERNEL_DATA_BASE & -SHMLBA) && - shm_map_address(kernel_area, KERNEL_DATA2_BASE & -SHMLBA); - - // Mark the shared memory segment for removal. This is safe to do - // because the deletion is not performed while the memory is still - // mapped and so will only be done once the process exits. - shmctl(kernel_area, IPC_RMID, NULL); - if (mapped) - return true; - - error_string = STR_KD_SHMAT_ERR; - } - - char str[256]; - sprintf(str, GetString(error_string), strerror(errno)); - ErrorAlert(str); - return false; -} - - -/* - * Maps the memory identified by kernel_area at the specified addr - */ - -static bool shm_map_address(int kernel_area, uint32 addr) -{ - void *kernel_addr = Mac2HostAddr(addr); - return shmat(kernel_area, kernel_addr, 0) == kernel_addr; -} - - -/* - * Jump into Mac ROM, start 680x0 emulator - */ - -#if EMULATED_PPC -void jump_to_rom(uint32 entry) -{ - init_emul_ppc(); - emul_ppc(entry); -} -#endif - - -/* - * Emulator thread function - */ - -static void *emul_func(void *arg) -{ - // We're now ready to receive signals - ready_for_signals = true; - - // Decrease priority, so more time-critical things like audio will work better - nice(1); - - // Jump to ROM boot routine - D(bug("Jumping to ROM\n")); -#if EMULATED_PPC - jump_to_rom(ROMBase + 0x310000); -#else - jump_to_rom(ROMBase + 0x310000, (uint32)emulator_data); -#endif - D(bug("Returned from ROM\n")); - - // We're no longer ready to receive signals - ready_for_signals = false; - return NULL; -} - - -#if !EMULATED_PPC -/* - * Execute 68k subroutine (must be ended with RTS) - * This must only be called by the emul_thread when in EMUL_OP mode - * r->a[7] is unused, the routine runs on the caller's stack - */ - -void Execute68k(uint32 pc, M68kRegisters *r) -{ -#if SAFE_EXEC_68K - if (ReadMacInt32(XLM_RUN_MODE) != MODE_EMUL_OP) - printf("FATAL: Execute68k() not called from EMUL_OP mode\n"); - if (!pthread_equal(pthread_self(), emul_thread)) - printf("FATAL: Execute68k() not called from emul_thread\n"); -#endif - execute_68k(pc, r); -} - - -/* - * Execute 68k A-Trap from EMUL_OP routine - * r->a[7] is unused, the routine runs on the caller's stack - */ - -void Execute68kTrap(uint16 trap, M68kRegisters *r) -{ - uint16 proc[2] = {trap, M68K_RTS}; - Execute68k((uint32)proc, r); -} -#endif - - -/* - * Quit emulator (cause return from jump_to_rom) - */ - -void QuitEmulator(void) -{ -#if EMULATED_PPC - Quit(); -#else - quit_emulator(); -#endif -} - - -/* - * Dump 68k registers - */ - -void Dump68kRegs(M68kRegisters *r) -{ - // Display 68k registers - for (int i=0; i<8; i++) { - printf("d%d: %08x", i, r->d[i]); - if (i == 3 || i == 7) - printf("\n"); - else - printf(", "); - } - for (int i=0; i<8; i++) { - printf("a%d: %08x", i, r->a[i]); - if (i == 3 || i == 7) - printf("\n"); - else - printf(", "); - } -} - - -/* - * Make code executable - */ - -void MakeExecutable(int dummy, uint32 start, uint32 length) -{ - if ((start >= ROMBase) && (start < (ROMBase + ROM_SIZE))) - return; -#if EMULATED_PPC - FlushCodeCache(start, start + length); -#else - flush_icache_range(start, start + length); -#endif -} - - -/* - * NVRAM watchdog thread (saves NVRAM every minute) - */ - -static void nvram_watchdog(void) -{ - if (memcmp(last_xpram, XPRAM, XPRAM_SIZE)) { - memcpy(last_xpram, XPRAM, XPRAM_SIZE); - SaveXPRAM(); - } -} - -static void *nvram_func(void *arg) -{ - while (!nvram_thread_cancel) { - for (int i=0; i<60 && !nvram_thread_cancel; i++) - Delay_usec(999999); // Only wait 1 second so we quit promptly when nvram_thread_cancel becomes true - nvram_watchdog(); - } - return NULL; -} - - -/* - * 60Hz thread (really 60.15Hz) - */ - -static void *tick_func(void *arg) -{ - int tick_counter = 0; - uint64 start = GetTicks_usec(); - int64 ticks = 0; - uint64 next = GetTicks_usec(); - - while (!tick_thread_cancel) { - - // Wait - next += 16625; - int64 delay = next - GetTicks_usec(); - if (delay > 0) - Delay_usec(delay); - else if (delay < -16625) - next = GetTicks_usec(); - ticks++; - -#if !EMULATED_PPC - // Did we crash? - if (emul_thread_fatal) { - - // Yes, dump registers - sigregs *r = &sigsegv_regs; - char str[256]; - if (crash_reason == NULL) - crash_reason = "SIGSEGV"; - sprintf(str, "%s\n" - " pc %08lx lr %08lx ctr %08lx msr %08lx\n" - " xer %08lx cr %08lx \n" - " r0 %08lx r1 %08lx r2 %08lx r3 %08lx\n" - " r4 %08lx r5 %08lx r6 %08lx r7 %08lx\n" - " r8 %08lx r9 %08lx r10 %08lx r11 %08lx\n" - " r12 %08lx r13 %08lx r14 %08lx r15 %08lx\n" - " r16 %08lx r17 %08lx r18 %08lx r19 %08lx\n" - " r20 %08lx r21 %08lx r22 %08lx r23 %08lx\n" - " r24 %08lx r25 %08lx r26 %08lx r27 %08lx\n" - " r28 %08lx r29 %08lx r30 %08lx r31 %08lx\n", - crash_reason, - r->nip, r->link, r->ctr, r->msr, - r->xer, r->ccr, - r->gpr[0], r->gpr[1], r->gpr[2], r->gpr[3], - r->gpr[4], r->gpr[5], r->gpr[6], r->gpr[7], - r->gpr[8], r->gpr[9], r->gpr[10], r->gpr[11], - r->gpr[12], r->gpr[13], r->gpr[14], r->gpr[15], - r->gpr[16], r->gpr[17], r->gpr[18], r->gpr[19], - r->gpr[20], r->gpr[21], r->gpr[22], r->gpr[23], - r->gpr[24], r->gpr[25], r->gpr[26], r->gpr[27], - r->gpr[28], r->gpr[29], r->gpr[30], r->gpr[31]); - printf(str); - VideoQuitFullScreen(); - -#ifdef ENABLE_MON - // Start up mon in real-mode - printf("Welcome to the sheep factory.\n"); - char *arg[4] = {"mon", "-m", "-r", NULL}; - mon(3, arg); -#endif - return NULL; - } -#endif - - // Pseudo Mac 1Hz interrupt, update local time - if (++tick_counter > 60) { - tick_counter = 0; - WriteMacInt32(0x20c, TimerDateTime()); - } - - // Trigger 60Hz interrupt - if (ReadMacInt32(XLM_IRQ_NEST) == 0) { - SetInterruptFlag(INTFLAG_VIA); - TriggerInterrupt(); - } - } - - uint64 end = GetTicks_usec(); - D(bug("%lld ticks in %lld usec = %f ticks/sec\n", ticks, end - start, ticks * 1000000.0 / (end - start))); - return NULL; -} - - -/* - * Pthread configuration - */ - -void Set_pthread_attr(pthread_attr_t *attr, int priority) -{ -#ifdef HAVE_PTHREADS - pthread_attr_init(attr); -#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) - // Some of these only work for superuser - if (geteuid() == 0) { - pthread_attr_setinheritsched(attr, PTHREAD_EXPLICIT_SCHED); - pthread_attr_setschedpolicy(attr, SCHED_FIFO); - struct sched_param fifo_param; - fifo_param.sched_priority = ((sched_get_priority_min(SCHED_FIFO) + - sched_get_priority_max(SCHED_FIFO)) / 2 + - priority); - pthread_attr_setschedparam(attr, &fifo_param); - } - if (pthread_attr_setscope(attr, PTHREAD_SCOPE_SYSTEM) != 0) { -#ifdef PTHREAD_SCOPE_BOUND_NP - // If system scope is not available (eg. we're not running - // with CAP_SCHED_MGT capability on an SGI box), try bound - // scope. It exposes pthread scheduling to the kernel, - // without setting realtime priority. - pthread_attr_setscope(attr, PTHREAD_SCOPE_BOUND_NP); -#endif - } -#endif -#endif -} - - -/* - * Mutexes - */ - -#ifdef HAVE_PTHREADS - -struct B2_mutex { - B2_mutex() { - pthread_mutexattr_t attr; - pthread_mutexattr_init(&attr); - // Initialize the mutex for priority inheritance -- - // required for accurate timing. -#if defined(HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL) && !defined(__CYGWIN__) - pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT); -#endif -#if defined(HAVE_PTHREAD_MUTEXATTR_SETTYPE) && defined(PTHREAD_MUTEX_NORMAL) - pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL); -#endif -#ifdef HAVE_PTHREAD_MUTEXATTR_SETPSHARED - pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_PRIVATE); -#endif - pthread_mutex_init(&m, &attr); - pthread_mutexattr_destroy(&attr); - } - ~B2_mutex() { - pthread_mutex_trylock(&m); // Make sure it's locked before - pthread_mutex_unlock(&m); // unlocking it. - pthread_mutex_destroy(&m); - } - pthread_mutex_t m; -}; - -B2_mutex *B2_create_mutex(void) -{ - return new B2_mutex; -} - -void B2_lock_mutex(B2_mutex *mutex) -{ - pthread_mutex_lock(&mutex->m); -} - -void B2_unlock_mutex(B2_mutex *mutex) -{ - pthread_mutex_unlock(&mutex->m); -} - -void B2_delete_mutex(B2_mutex *mutex) -{ - delete mutex; -} - -#else - -struct B2_mutex { - int dummy; -}; - -B2_mutex *B2_create_mutex(void) -{ - return new B2_mutex; -} - -void B2_lock_mutex(B2_mutex *mutex) -{ -} - -void B2_unlock_mutex(B2_mutex *mutex) -{ -} - -void B2_delete_mutex(B2_mutex *mutex) -{ - delete mutex; -} - -#endif - - -/* - * Trigger signal USR2 from another thread - */ - -#if !EMULATED_PPC -void TriggerInterrupt(void) -{ - if (ready_for_signals) { - idle_resume(); - pthread_kill(emul_thread, SIGUSR2); - } -} -#endif - - -/* - * Interrupt flags (must be handled atomically!) - */ - -volatile uint32 InterruptFlags = 0; - -void SetInterruptFlag(uint32 flag) -{ - atomic_or((int *)&InterruptFlags, flag); -} - -void ClearInterruptFlag(uint32 flag) -{ - atomic_and((int *)&InterruptFlags, ~flag); -} - - -/* - * Disable interrupts - */ - -void DisableInterrupt(void) -{ -#if EMULATED_PPC - WriteMacInt32(XLM_IRQ_NEST, int32(ReadMacInt32(XLM_IRQ_NEST)) + 1); -#else - atomic_add((int *)XLM_IRQ_NEST, 1); -#endif -} - - -/* - * Enable interrupts - */ - -void EnableInterrupt(void) -{ -#if EMULATED_PPC - WriteMacInt32(XLM_IRQ_NEST, int32(ReadMacInt32(XLM_IRQ_NEST)) - 1); -#else - atomic_add((int *)XLM_IRQ_NEST, -1); -#endif -} - - -/* - * USR2 handler - */ - -#if !EMULATED_PPC -void sigusr2_handler(int sig, siginfo_t *sip, void *scp) -{ - machine_regs *r = MACHINE_REGISTERS(scp); - -#ifdef SYSTEM_CLOBBERS_R2 - // Restore pointer to Thread Local Storage - set_r2(TOC); -#endif -#ifdef SYSTEM_CLOBBERS_R13 - // Restore pointer to .sdata section - set_r13(R13); -#endif - -#ifdef USE_SDL_VIDEO - // We must fill in the events queue in the same thread that did call SDL_SetVideoMode() - SDL_PumpEvents(); -#endif - - // Do nothing if interrupts are disabled - if (*(int32 *)XLM_IRQ_NEST > 0) - return; - - // Disable MacOS stack sniffer - WriteMacInt32(0x110, 0); - - // Interrupt action depends on current run mode - switch (ReadMacInt32(XLM_RUN_MODE)) { - case MODE_68K: - // 68k emulator active, trigger 68k interrupt level 1 - WriteMacInt16(ntohl(kernel_data->v[0x67c >> 2]), 1); - r->cr() |= ntohl(kernel_data->v[0x674 >> 2]); - break; - -#if INTERRUPTS_IN_NATIVE_MODE - case MODE_NATIVE: - // 68k emulator inactive, in nanokernel? - if (r->gpr(1) != KernelDataAddr) { - - // Set extra stack for SIGSEGV handler - sigaltstack(&extra_stack, NULL); - - // Prepare for 68k interrupt level 1 - WriteMacInt16(ntohl(kernel_data->v[0x67c >> 2]), 1); - WriteMacInt32(ntohl(kernel_data->v[0x658 >> 2]) + 0xdc, ReadMacInt32(ntohl(kernel_data->v[0x658 >> 2]) + 0xdc) | ntohl(kernel_data->v[0x674 >> 2])); - - // Execute nanokernel interrupt routine (this will activate the 68k emulator) - DisableInterrupt(); - if (ROMType == ROMTYPE_NEWWORLD) - ppc_interrupt(ROMBase + 0x312b1c, KernelDataAddr); - else - ppc_interrupt(ROMBase + 0x312a3c, KernelDataAddr); - - // Reset normal stack - sigaltstack(&sig_stack, NULL); - } - break; -#endif - -#if INTERRUPTS_IN_EMUL_OP_MODE - case MODE_EMUL_OP: - // 68k emulator active, within EMUL_OP routine, execute 68k interrupt routine directly when interrupt level is 0 - if ((ReadMacInt32(XLM_68K_R25) & 7) == 0) { - - // Set extra stack for SIGSEGV handler - sigaltstack(&extra_stack, NULL); -#if 1 - // Execute full 68k interrupt routine - M68kRegisters r; - uint32 old_r25 = ReadMacInt32(XLM_68K_R25); // Save interrupt level - WriteMacInt32(XLM_68K_R25, 0x21); // Execute with interrupt level 1 - static const uint16 proc[] = { - 0x3f3c, 0x0000, // move.w #$0000,-(sp) (fake format word) - 0x487a, 0x000a, // pea @1(pc) (return address) - 0x40e7, // move sr,-(sp) (saved SR) - 0x2078, 0x0064, // move.l $64,a0 - 0x4ed0, // jmp (a0) - M68K_RTS // @1 - }; - Execute68k((uint32)proc, &r); - WriteMacInt32(XLM_68K_R25, old_r25); // Restore interrupt level -#else - // Only update cursor - if (HasMacStarted()) { - if (InterruptFlags & INTFLAG_VIA) { - ClearInterruptFlag(INTFLAG_VIA); - ADBInterrupt(); - ExecuteNative(NATIVE_VIDEO_VBL); - } - } -#endif - // Reset normal stack - sigaltstack(&sig_stack, NULL); - } - break; -#endif - } -} -#endif - - -/* - * SIGSEGV handler - */ - -#if !EMULATED_PPC -static void sigsegv_handler(int sig, siginfo_t *sip, void *scp) -{ - machine_regs *r = MACHINE_REGISTERS(scp); - - // Get effective address - uint32 addr = r->dar(); - -#ifdef SYSTEM_CLOBBERS_R2 - // Restore pointer to Thread Local Storage - set_r2(TOC); -#endif -#ifdef SYSTEM_CLOBBERS_R13 - // Restore pointer to .sdata section - set_r13(R13); -#endif - -#if ENABLE_VOSF - // Handle screen fault -#if SIGSEGV_CHECK_VERSION(1,0,0) - sigsegv_info_t si; - si.addr = (sigsegv_address_t)addr; - si.pc = (sigsegv_address_t)r->pc(); -#endif - extern bool Screen_fault_handler(sigsegv_info_t *sip); - if (Screen_fault_handler(&si)) - return; -#endif - - // Fault in Mac ROM or RAM or DR Cache? - bool mac_fault = (r->pc() >= ROMBase) && (r->pc() < (ROMBase + ROM_AREA_SIZE)) || (r->pc() >= RAMBase) && (r->pc() < (RAMBase + RAMSize)) || (r->pc() >= DR_CACHE_BASE && r->pc() < (DR_CACHE_BASE + DR_CACHE_SIZE)); - if (mac_fault) { - - // "VM settings" during MacOS 8 installation - if (r->pc() == ROMBase + 0x488160 && r->gpr(20) == 0xf8000000) { - r->pc() += 4; - r->gpr(8) = 0; - return; - - // MacOS 8.5 installation - } else if (r->pc() == ROMBase + 0x488140 && r->gpr(16) == 0xf8000000) { - r->pc() += 4; - r->gpr(8) = 0; - return; - - // MacOS 8 serial drivers on startup - } else if (r->pc() == ROMBase + 0x48e080 && (r->gpr(8) == 0xf3012002 || r->gpr(8) == 0xf3012000)) { - r->pc() += 4; - r->gpr(8) = 0; - return; - - // MacOS 8.1 serial drivers on startup - } else if (r->pc() == ROMBase + 0x48c5e0 && (r->gpr(20) == 0xf3012002 || r->gpr(20) == 0xf3012000)) { - r->pc() += 4; - return; - } else if (r->pc() == ROMBase + 0x4a10a0 && (r->gpr(20) == 0xf3012002 || r->gpr(20) == 0xf3012000)) { - r->pc() += 4; - return; - - // MacOS 8.6 serial drivers on startup (with DR Cache and OldWorld ROM) - } else if ((r->pc() - DR_CACHE_BASE) < DR_CACHE_SIZE && (r->gpr(16) == 0xf3012002 || r->gpr(16) == 0xf3012000)) { - r->pc() += 4; - return; - } else if ((r->pc() - DR_CACHE_BASE) < DR_CACHE_SIZE && (r->gpr(20) == 0xf3012002 || r->gpr(20) == 0xf3012000)) { - r->pc() += 4; - return; - } - - // Get opcode and divide into fields - uint32 opcode = *((uint32 *)r->pc()); - uint32 primop = opcode >> 26; - uint32 exop = (opcode >> 1) & 0x3ff; - uint32 ra = (opcode >> 16) & 0x1f; - uint32 rb = (opcode >> 11) & 0x1f; - uint32 rd = (opcode >> 21) & 0x1f; - int32 imm = (int16)(opcode & 0xffff); - - // Analyze opcode - enum { - TYPE_UNKNOWN, - TYPE_LOAD, - TYPE_STORE - } transfer_type = TYPE_UNKNOWN; - enum { - SIZE_UNKNOWN, - SIZE_BYTE, - SIZE_HALFWORD, - SIZE_WORD - } transfer_size = SIZE_UNKNOWN; - enum { - MODE_UNKNOWN, - MODE_NORM, - MODE_U, - MODE_X, - MODE_UX - } addr_mode = MODE_UNKNOWN; - switch (primop) { - case 31: - switch (exop) { - case 23: // lwzx - transfer_type = TYPE_LOAD; transfer_size = SIZE_WORD; addr_mode = MODE_X; break; - case 55: // lwzux - transfer_type = TYPE_LOAD; transfer_size = SIZE_WORD; addr_mode = MODE_UX; break; - case 87: // lbzx - transfer_type = TYPE_LOAD; transfer_size = SIZE_BYTE; addr_mode = MODE_X; break; - case 119: // lbzux - transfer_type = TYPE_LOAD; transfer_size = SIZE_BYTE; addr_mode = MODE_UX; break; - case 151: // stwx - transfer_type = TYPE_STORE; transfer_size = SIZE_WORD; addr_mode = MODE_X; break; - case 183: // stwux - transfer_type = TYPE_STORE; transfer_size = SIZE_WORD; addr_mode = MODE_UX; break; - case 215: // stbx - transfer_type = TYPE_STORE; transfer_size = SIZE_BYTE; addr_mode = MODE_X; break; - case 247: // stbux - transfer_type = TYPE_STORE; transfer_size = SIZE_BYTE; addr_mode = MODE_UX; break; - case 279: // lhzx - transfer_type = TYPE_LOAD; transfer_size = SIZE_HALFWORD; addr_mode = MODE_X; break; - case 311: // lhzux - transfer_type = TYPE_LOAD; transfer_size = SIZE_HALFWORD; addr_mode = MODE_UX; break; - case 343: // lhax - transfer_type = TYPE_LOAD; transfer_size = SIZE_HALFWORD; addr_mode = MODE_X; break; - case 375: // lhaux - transfer_type = TYPE_LOAD; transfer_size = SIZE_HALFWORD; addr_mode = MODE_UX; break; - case 407: // sthx - transfer_type = TYPE_STORE; transfer_size = SIZE_HALFWORD; addr_mode = MODE_X; break; - case 439: // sthux - transfer_type = TYPE_STORE; transfer_size = SIZE_HALFWORD; addr_mode = MODE_UX; break; - } - break; - - case 32: // lwz - transfer_type = TYPE_LOAD; transfer_size = SIZE_WORD; addr_mode = MODE_NORM; break; - case 33: // lwzu - transfer_type = TYPE_LOAD; transfer_size = SIZE_WORD; addr_mode = MODE_U; break; - case 34: // lbz - transfer_type = TYPE_LOAD; transfer_size = SIZE_BYTE; addr_mode = MODE_NORM; break; - case 35: // lbzu - transfer_type = TYPE_LOAD; transfer_size = SIZE_BYTE; addr_mode = MODE_U; break; - case 36: // stw - transfer_type = TYPE_STORE; transfer_size = SIZE_WORD; addr_mode = MODE_NORM; break; - case 37: // stwu - transfer_type = TYPE_STORE; transfer_size = SIZE_WORD; addr_mode = MODE_U; break; - case 38: // stb - transfer_type = TYPE_STORE; transfer_size = SIZE_BYTE; addr_mode = MODE_NORM; break; - case 39: // stbu - transfer_type = TYPE_STORE; transfer_size = SIZE_BYTE; addr_mode = MODE_U; break; - case 40: // lhz - transfer_type = TYPE_LOAD; transfer_size = SIZE_HALFWORD; addr_mode = MODE_NORM; break; - case 41: // lhzu - transfer_type = TYPE_LOAD; transfer_size = SIZE_HALFWORD; addr_mode = MODE_U; break; - case 42: // lha - transfer_type = TYPE_LOAD; transfer_size = SIZE_HALFWORD; addr_mode = MODE_NORM; break; - case 43: // lhau - transfer_type = TYPE_LOAD; transfer_size = SIZE_HALFWORD; addr_mode = MODE_U; break; - case 44: // sth - transfer_type = TYPE_STORE; transfer_size = SIZE_HALFWORD; addr_mode = MODE_NORM; break; - case 45: // sthu - transfer_type = TYPE_STORE; transfer_size = SIZE_HALFWORD; addr_mode = MODE_U; break; -#if EMULATE_UNALIGNED_LOADSTORE_MULTIPLE - case 46: // lmw - if ((addr % 4) != 0) { - uint32 ea = addr; - D(bug("WARNING: unaligned lmw to EA=%08x from IP=%08x\n", ea, r->pc())); - for (int i = rd; i <= 31; i++) { - r->gpr(i) = ReadMacInt32(ea); - ea += 4; - } - r->pc() += 4; - goto rti; - } - break; - case 47: // stmw - if ((addr % 4) != 0) { - uint32 ea = addr; - D(bug("WARNING: unaligned stmw to EA=%08x from IP=%08x\n", ea, r->pc())); - for (int i = rd; i <= 31; i++) { - WriteMacInt32(ea, r->gpr(i)); - ea += 4; - } - r->pc() += 4; - goto rti; - } - break; -#endif - } - - // Ignore ROM writes (including to the zero page, which is read-only) - if (transfer_type == TYPE_STORE && - ((addr >= ROMBase && addr < ROMBase + ROM_SIZE) || - (addr >= SheepMem::ZeroPage() && addr < SheepMem::ZeroPage() + SheepMem::PageSize()))) { -// D(bug("WARNING: %s write access to ROM at %08lx, pc %08lx\n", transfer_size == SIZE_BYTE ? "Byte" : transfer_size == SIZE_HALFWORD ? "Halfword" : "Word", addr, r->pc())); - if (addr_mode == MODE_U || addr_mode == MODE_UX) - r->gpr(ra) = addr; - r->pc() += 4; - goto rti; - } - - // Ignore illegal memory accesses? - if (PrefsFindBool("ignoresegv")) { - if (addr_mode == MODE_U || addr_mode == MODE_UX) - r->gpr(ra) = addr; - if (transfer_type == TYPE_LOAD) - r->gpr(rd) = 0; - r->pc() += 4; - goto rti; - } - - // In GUI mode, show error alert - if (!PrefsFindBool("nogui")) { - char str[256]; - if (transfer_type == TYPE_LOAD || transfer_type == TYPE_STORE) - sprintf(str, GetString(STR_MEM_ACCESS_ERR), transfer_size == SIZE_BYTE ? "byte" : transfer_size == SIZE_HALFWORD ? "halfword" : "word", transfer_type == TYPE_LOAD ? GetString(STR_MEM_ACCESS_READ) : GetString(STR_MEM_ACCESS_WRITE), addr, r->pc(), r->gpr(24), r->gpr(1)); - else - sprintf(str, GetString(STR_UNKNOWN_SEGV_ERR), r->pc(), r->gpr(24), r->gpr(1), opcode); - ErrorAlert(str); - QuitEmulator(); - return; - } - } - - // For all other errors, jump into debugger (sort of...) - crash_reason = (sig == SIGBUS) ? "SIGBUS" : "SIGSEGV"; - if (!ready_for_signals) { - printf("%s\n"); - printf(" sigcontext %p, machine_regs %p\n", scp, r); - printf( - " pc %08lx lr %08lx ctr %08lx msr %08lx\n" - " xer %08lx cr %08lx \n" - " r0 %08lx r1 %08lx r2 %08lx r3 %08lx\n" - " r4 %08lx r5 %08lx r6 %08lx r7 %08lx\n" - " r8 %08lx r9 %08lx r10 %08lx r11 %08lx\n" - " r12 %08lx r13 %08lx r14 %08lx r15 %08lx\n" - " r16 %08lx r17 %08lx r18 %08lx r19 %08lx\n" - " r20 %08lx r21 %08lx r22 %08lx r23 %08lx\n" - " r24 %08lx r25 %08lx r26 %08lx r27 %08lx\n" - " r28 %08lx r29 %08lx r30 %08lx r31 %08lx\n", - crash_reason, - r->pc(), r->lr(), r->ctr(), r->msr(), - r->xer(), r->cr(), - r->gpr(0), r->gpr(1), r->gpr(2), r->gpr(3), - r->gpr(4), r->gpr(5), r->gpr(6), r->gpr(7), - r->gpr(8), r->gpr(9), r->gpr(10), r->gpr(11), - r->gpr(12), r->gpr(13), r->gpr(14), r->gpr(15), - r->gpr(16), r->gpr(17), r->gpr(18), r->gpr(19), - r->gpr(20), r->gpr(21), r->gpr(22), r->gpr(23), - r->gpr(24), r->gpr(25), r->gpr(26), r->gpr(27), - r->gpr(28), r->gpr(29), r->gpr(30), r->gpr(31)); - exit(1); - QuitEmulator(); - return; - } else { - // We crashed. Save registers, tell tick thread and loop forever - build_sigregs(&sigsegv_regs, r); - emul_thread_fatal = true; - for (;;) ; - } -rti:; -} - - -/* - * SIGILL handler - */ - -static void sigill_handler(int sig, siginfo_t *sip, void *scp) -{ - machine_regs *r = MACHINE_REGISTERS(scp); - char str[256]; - -#ifdef SYSTEM_CLOBBERS_R2 - // Restore pointer to Thread Local Storage - set_r2(TOC); -#endif -#ifdef SYSTEM_CLOBBERS_R13 - // Restore pointer to .sdata section - set_r13(R13); -#endif - - // Fault in Mac ROM or RAM? - bool mac_fault = (r->pc() >= ROMBase) && (r->pc() < (ROMBase + ROM_AREA_SIZE)) || (r->pc() >= RAMBase) && (r->pc() < (RAMBase + RAMSize)); - if (mac_fault) { - - // Get opcode and divide into fields - uint32 opcode = *((uint32 *)r->pc()); - uint32 primop = opcode >> 26; - uint32 exop = (opcode >> 1) & 0x3ff; - uint32 ra = (opcode >> 16) & 0x1f; - uint32 rb = (opcode >> 11) & 0x1f; - uint32 rd = (opcode >> 21) & 0x1f; - int32 imm = (int16)(opcode & 0xffff); - - switch (primop) { - case 9: // POWER instructions - case 22: -power_inst: sprintf(str, GetString(STR_POWER_INSTRUCTION_ERR), r->pc(), r->gpr(1), opcode); - ErrorAlert(str); - QuitEmulator(); - return; - - case 31: - switch (exop) { - case 83: // mfmsr - r->gpr(rd) = 0xf072; - r->pc() += 4; - goto rti; - - case 210: // mtsr - case 242: // mtsrin - case 306: // tlbie - r->pc() += 4; - goto rti; - - case 339: { // mfspr - int spr = ra | (rb << 5); - switch (spr) { - case 0: // MQ - case 22: // DEC - case 952: // MMCR0 - case 953: // PMC1 - case 954: // PMC2 - case 955: // SIA - case 956: // MMCR1 - case 957: // PMC3 - case 958: // PMC4 - case 959: // SDA - r->pc() += 4; - goto rti; - case 25: // SDR1 - r->gpr(rd) = 0xdead001f; - r->pc() += 4; - goto rti; - case 287: // PVR - r->gpr(rd) = PVR; - r->pc() += 4; - goto rti; - } - break; - } - - case 467: { // mtspr - int spr = ra | (rb << 5); - switch (spr) { - case 0: // MQ - case 22: // DEC - case 275: // SPRG3 - case 528: // IBAT0U - case 529: // IBAT0L - case 530: // IBAT1U - case 531: // IBAT1L - case 532: // IBAT2U - case 533: // IBAT2L - case 534: // IBAT3U - case 535: // IBAT3L - case 536: // DBAT0U - case 537: // DBAT0L - case 538: // DBAT1U - case 539: // DBAT1L - case 540: // DBAT2U - case 541: // DBAT2L - case 542: // DBAT3U - case 543: // DBAT3L - case 952: // MMCR0 - case 953: // PMC1 - case 954: // PMC2 - case 955: // SIA - case 956: // MMCR1 - case 957: // PMC3 - case 958: // PMC4 - case 959: // SDA - r->pc() += 4; - goto rti; - } - break; - } - - case 29: case 107: case 152: case 153: // POWER instructions - case 184: case 216: case 217: case 248: - case 264: case 277: case 331: case 360: - case 363: case 488: case 531: case 537: - case 541: case 664: case 665: case 696: - case 728: case 729: case 760: case 920: - case 921: case 952: - goto power_inst; - } - } - - // In GUI mode, show error alert - if (!PrefsFindBool("nogui")) { - sprintf(str, GetString(STR_UNKNOWN_SEGV_ERR), r->pc(), r->gpr(24), r->gpr(1), opcode); - ErrorAlert(str); - QuitEmulator(); - return; - } - } - - // For all other errors, jump into debugger (sort of...) - crash_reason = "SIGILL"; - if (!ready_for_signals) { - printf("%s\n"); - printf(" sigcontext %p, machine_regs %p\n", scp, r); - printf( - " pc %08lx lr %08lx ctr %08lx msr %08lx\n" - " xer %08lx cr %08lx \n" - " r0 %08lx r1 %08lx r2 %08lx r3 %08lx\n" - " r4 %08lx r5 %08lx r6 %08lx r7 %08lx\n" - " r8 %08lx r9 %08lx r10 %08lx r11 %08lx\n" - " r12 %08lx r13 %08lx r14 %08lx r15 %08lx\n" - " r16 %08lx r17 %08lx r18 %08lx r19 %08lx\n" - " r20 %08lx r21 %08lx r22 %08lx r23 %08lx\n" - " r24 %08lx r25 %08lx r26 %08lx r27 %08lx\n" - " r28 %08lx r29 %08lx r30 %08lx r31 %08lx\n", - crash_reason, - r->pc(), r->lr(), r->ctr(), r->msr(), - r->xer(), r->cr(), - r->gpr(0), r->gpr(1), r->gpr(2), r->gpr(3), - r->gpr(4), r->gpr(5), r->gpr(6), r->gpr(7), - r->gpr(8), r->gpr(9), r->gpr(10), r->gpr(11), - r->gpr(12), r->gpr(13), r->gpr(14), r->gpr(15), - r->gpr(16), r->gpr(17), r->gpr(18), r->gpr(19), - r->gpr(20), r->gpr(21), r->gpr(22), r->gpr(23), - r->gpr(24), r->gpr(25), r->gpr(26), r->gpr(27), - r->gpr(28), r->gpr(29), r->gpr(30), r->gpr(31)); - exit(1); - QuitEmulator(); - return; - } else { - // We crashed. Save registers, tell tick thread and loop forever - build_sigregs(&sigsegv_regs, r); - emul_thread_fatal = true; - for (;;) ; - } -rti:; -} -#endif - - -/* - * Helpers to share 32-bit addressable data with MacOS - */ - -bool SheepMem::Init(void) -{ - // Size of a native page - page_size = getpagesize(); - - // Allocate SheepShaver globals - proc = base; - if (vm_mac_acquire_fixed(base, size) < 0) - return false; - - // Allocate page with all bits set to 0, right in the middle - // This is also used to catch undesired overlaps between proc and data areas - zero_page = proc + (size / 2); - Mac_memset(zero_page, 0, page_size); - if (vm_protect(Mac2HostAddr(zero_page), page_size, VM_PAGE_READ) < 0) - return false; - -#if EMULATED_PPC - // Allocate alternate stack for PowerPC interrupt routine - sig_stack = base + size; - if (vm_mac_acquire_fixed(sig_stack, SIG_STACK_SIZE) < 0) - return false; -#endif - - data = base + size; - return true; -} - -void SheepMem::Exit(void) -{ - if (data) { - // Delete SheepShaver globals - vm_mac_release(base, size); - -#if EMULATED_PPC - // Delete alternate stack for PowerPC interrupt routine - vm_mac_release(sig_stack, SIG_STACK_SIZE); -#endif - } -} - - -/* - * Display alert - */ - -#ifdef ENABLE_GTK -static void dl_destroyed(void) -{ - gtk_main_quit(); -} - -static void dl_quit(GtkWidget *dialog) -{ - gtk_widget_destroy(dialog); -} - -void display_alert(int title_id, int prefix_id, int button_id, const char *text) -{ - char str[256]; - sprintf(str, GetString(prefix_id), text); - - GtkWidget *dialog = gtk_dialog_new(); - gtk_window_set_title(GTK_WINDOW(dialog), GetString(title_id)); - gtk_container_border_width(GTK_CONTAINER(dialog), 5); - gtk_widget_set_uposition(GTK_WIDGET(dialog), 100, 150); - gtk_signal_connect(GTK_OBJECT(dialog), "destroy", GTK_SIGNAL_FUNC(dl_destroyed), NULL); - - GtkWidget *label = gtk_label_new(str); - gtk_widget_show(label); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), label, TRUE, TRUE, 0); - - GtkWidget *button = gtk_button_new_with_label(GetString(button_id)); - gtk_widget_show(button); - gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(dl_quit), GTK_OBJECT(dialog)); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), button, FALSE, FALSE, 0); - GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); - gtk_widget_grab_default(button); - gtk_widget_show(dialog); - - gtk_main(); -} -#endif - - -/* - * Display error alert - */ - -void ErrorAlert(const char *text) -{ - if (gui_connection) { - if (rpc_method_invoke(gui_connection, RPC_METHOD_ERROR_ALERT, RPC_TYPE_STRING, text, RPC_TYPE_INVALID) == RPC_ERROR_NO_ERROR && - rpc_method_wait_for_reply(gui_connection, RPC_TYPE_INVALID) == RPC_ERROR_NO_ERROR) - return; - } -#if defined(ENABLE_GTK) && !defined(USE_SDL_VIDEO) - if (PrefsFindBool("nogui") || x_display == NULL) { - printf(GetString(STR_SHELL_ERROR_PREFIX), text); - return; - } - VideoQuitFullScreen(); - display_alert(STR_ERROR_ALERT_TITLE, STR_GUI_ERROR_PREFIX, STR_QUIT_BUTTON, text); -#else - printf(GetString(STR_SHELL_ERROR_PREFIX), text); -#endif -} - - -/* - * Display warning alert - */ - -void WarningAlert(const char *text) -{ - if (gui_connection) { - if (rpc_method_invoke(gui_connection, RPC_METHOD_WARNING_ALERT, RPC_TYPE_STRING, text, RPC_TYPE_INVALID) == RPC_ERROR_NO_ERROR && - rpc_method_wait_for_reply(gui_connection, RPC_TYPE_INVALID) == RPC_ERROR_NO_ERROR) - return; - } -#if defined(ENABLE_GTK) && !defined(USE_SDL_VIDEO) - if (PrefsFindBool("nogui") || x_display == NULL) { - printf(GetString(STR_SHELL_WARNING_PREFIX), text); - return; - } - display_alert(STR_WARNING_ALERT_TITLE, STR_GUI_WARNING_PREFIX, STR_OK_BUTTON, text); -#else - printf(GetString(STR_SHELL_WARNING_PREFIX), text); -#endif -} - - -/* - * Display choice alert - */ - -bool ChoiceAlert(const char *text, const char *pos, const char *neg) -{ - printf(GetString(STR_SHELL_WARNING_PREFIX), text); - return false; //!! -} diff --git a/SheepShaver/src/Unix/mkinstalldirs b/SheepShaver/src/Unix/mkinstalldirs deleted file mode 100755 index 6b3b5fc5..00000000 --- a/SheepShaver/src/Unix/mkinstalldirs +++ /dev/null @@ -1,40 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman -# Created: 1993-05-16 -# Public domain - -# $Id$ - -errstatus=0 - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# mkinstalldirs ends here diff --git a/SheepShaver/src/Unix/paranoia.cpp b/SheepShaver/src/Unix/paranoia.cpp deleted file mode 100644 index da18ad1e..00000000 --- a/SheepShaver/src/Unix/paranoia.cpp +++ /dev/null @@ -1,346 +0,0 @@ -/* - * paranoia.cpp - Check undocumented features of the underlying - * kernel that SheepShaver relies upon - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * TODO - * - Check for nested signal handlers vs. sigaltstack() - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "sysdeps.h" -#include "sigregs.h" -#include "main.h" -#include "user_strings.h" - -#define DEBUG 1 -#include "debug.h" - - -// Constants -const uint32 SIG_STACK_SIZE = 0x10000; // Size of signal stack - -// Prototypes -extern "C" void *get_sp(void); -extern "C" void *get_r2(void); -extern "C" void set_r2(void *); -extern "C" void *get_r13(void); -extern "C" void set_r13(void *); -extern void paranoia_check(void); -static void sigusr2_handler(int sig, siginfo_t *sip, void *scp); -static void *tick_func(void *); -static void *emul_func(void *); - -// Global variables -static void *sig_stack = NULL; - -static int err = 0; -static void *sig_sp = NULL; -static void *sig_r5 = NULL; -static int sig_sc_signal = 0; -static void *sig_sc_regs = NULL; -static uint32 sig_r2 = 0; - -static pthread_t tick_thread; -static pthread_t emul_thread; -static volatile uint32 tick_thread_ready = 0; -static volatile uint32 emul_thread_regs[32] = { 0, }; -static volatile uint32 &emul_thread_ready = emul_thread_regs[0]; - - -void paranoia_check(void) -{ - char str[256]; - - printf("Paranoia checks...\n"); - - // Create and install stack for signal handler - sig_stack = malloc(SIG_STACK_SIZE); - if (sig_stack == NULL) { - ErrorAlert(GetString(STR_NOT_ENOUGH_MEMORY_ERR)); - exit(1); - } - - stack_t old_stack; - stack_t new_stack; - new_stack.ss_sp = (char *)sig_stack; - new_stack.ss_flags = 0; - new_stack.ss_size = SIG_STACK_SIZE; - if (sigaltstack(&new_stack, &old_stack) < 0) { - sprintf(str, GetString(STR_SIGALTSTACK_ERR), strerror(errno)); - ErrorAlert(str); - exit(1); - } - - // Install SIGUSR2 signal handler - static struct sigaction old_action; - static struct sigaction sigusr2_action; - sigemptyset(&sigusr2_action.sa_mask); - sigusr2_action.sa_sigaction = sigusr2_handler; - sigusr2_action.sa_flags = SA_SIGINFO | SA_ONSTACK | SA_RESTART; - if (sigaction(SIGUSR2, &sigusr2_action, &old_action) < 0) { - sprintf(str, GetString(STR_SIG_INSTALL_ERR), "SIGUSR2", strerror(errno)); - ErrorAlert(str); - exit(1); - } - - // Start tick thread that will trigger only one SIGUSR2 - pthread_create(&tick_thread, NULL, tick_func, NULL); - - // Get my thread ID and execute MacOS thread function - emul_thread = pthread_self(); - emul_func(NULL); - - // Check error code - switch (err) { - case 1: - printf("FATAL: sigaltstack() doesn't seem to work (sp in signal handler was %p, expected %p..%p)\n", sig_sp, sig_stack, (uintptr)sig_stack + SIG_STACK_SIZE); - break; - case 2: - printf("FATAL: r5 in signal handler (%p) doesn't point to stack\n", sig_r5); - break; - case 3: - printf("FATAL: machine registers in signal handler (%p) doesn't point to stack\n", sig_sc_regs); - break; - case 4: - printf("FATAL: register file in signal handler is corrupted\n"); - break; - } - if (err) { - printf("Maybe you need a different kernel?\n"); - exit(1); - } - - // Clean up - printf("...passed\n"); - sigaction(SIGUSR2, &old_action, NULL); - sigaltstack(&old_stack, NULL); - free(sig_stack); -} - -static void *tick_func(void *) -{ - tick_thread_ready = true; - - // Wait for emul thread to initialize - D(bug("[tick_thread] waiting for emul thread to initialize\n")); - while (!emul_thread_ready) - usleep(0); - - // Trigger interrupt and terminate - D(bug("[tick_thread] trigger interrupt\n")); - pthread_kill(emul_thread, SIGUSR2); - return NULL; -} - -static void *emul_func(void *) -{ - // Wait for tick thread to initialize - D(bug("[emul_thread] waiting for tick thread to initialize\n")); - while (!tick_thread_ready) - usleep(0); - - // Fill in register and wait for an interrupt from the tick thread - D(bug("[emul_thread] filling in registers and waiting for interrupt\n")); -#if defined(__APPLE__) && defined(__MACH__) -#define REG(n) "r" #n -#else -#define REG(n) #n -#endif - asm volatile ("stw " REG(2) ",2*4(%0)\n" - "mr " REG(2) ",%0\n" -#define SAVE_REG(n) \ - "stw " REG(n) "," #n "*4(" REG(2) ")\n" \ - "addi " REG(n) "," REG(2) ","#n"\n" - SAVE_REG(1) - SAVE_REG(3) - SAVE_REG(4) - SAVE_REG(5) - SAVE_REG(6) - SAVE_REG(7) - SAVE_REG(8) - SAVE_REG(9) - SAVE_REG(10) - SAVE_REG(11) - SAVE_REG(12) - SAVE_REG(13) - SAVE_REG(14) - SAVE_REG(15) - SAVE_REG(16) - SAVE_REG(17) - SAVE_REG(18) - SAVE_REG(19) - SAVE_REG(20) - SAVE_REG(21) - SAVE_REG(22) - SAVE_REG(23) - SAVE_REG(24) - SAVE_REG(25) - SAVE_REG(26) - SAVE_REG(27) - SAVE_REG(28) - SAVE_REG(29) - SAVE_REG(30) - SAVE_REG(31) -#undef SAVE_REG - " li " REG(0) ",1\n" - " stw " REG(0) ",0(" REG(2) ")\n" // regs[0] == emul_thread_ready - "0: lwz " REG(0) ",0(" REG(2) ")\n" - " cmpi 0," REG(0) ",0\n" - " bne+ 0b\n" -#define LOAD_REG(n) \ - "lwz " REG(n) "," #n "*4(" REG(2) ")\n" - LOAD_REG(1) - LOAD_REG(3) - LOAD_REG(4) - LOAD_REG(5) - LOAD_REG(6) - LOAD_REG(7) - LOAD_REG(8) - LOAD_REG(9) - LOAD_REG(10) - LOAD_REG(11) - LOAD_REG(12) - LOAD_REG(13) - LOAD_REG(14) - LOAD_REG(15) - LOAD_REG(16) - LOAD_REG(17) - LOAD_REG(18) - LOAD_REG(19) - LOAD_REG(20) - LOAD_REG(21) - LOAD_REG(22) - LOAD_REG(23) - LOAD_REG(24) - LOAD_REG(25) - LOAD_REG(26) - LOAD_REG(27) - LOAD_REG(28) - LOAD_REG(29) - LOAD_REG(30) - LOAD_REG(31) - LOAD_REG(2) -#undef LOAD_REG - : : "r" ((uintptr)&emul_thread_regs[0]) : "r0"); -#undef REG -} - - -void sigusr2_handler(int sig, siginfo_t *sip, void *scp) -{ - machine_regs *r = MACHINE_REGISTERS(scp); - -#ifdef SYSTEM_CLOBBERS_R2 - // Restore pointer to Thread Local Storage - set_r2(TOC); -#endif - -#ifdef SYSTEM_CLOBBERS_R13 - // Restore pointer to .sdata section - set_r13(R13); -#endif - - ucontext_t *ucp = (ucontext_t *)scp; - D(bug("SIGUSR2 caught\n")); - - // Check whether sigaltstack works - sig_sp = get_sp(); - if (sig_sp < sig_stack || sig_sp >= ((uint8 *)sig_stack + SIG_STACK_SIZE)) { - err = 1; - goto ret; - } - - // Check whether r5 points to info on the stack - sig_r5 = ucp; - if (sig_r5 < sig_stack || sig_r5 >= ((uint8 *)sig_stack + SIG_STACK_SIZE)) { - err = 2; - goto ret; - } - - // Check whether context regs points to info on the stack - sig_sc_regs = &r->gpr(0); - if (sig_sc_regs < sig_stack || sig_sc_regs >= ((uint8 *)sig_stack + SIG_STACK_SIZE)) { - err = 3; - goto ret; - } - - // Check whether registers still hold the values we set them to - for (int n = 0; n < 32; n++) { - uint32 expected = (uintptr)&emul_thread_regs[0]; - if (n == 0) - expected = 1; - else if (n != 2) - expected += n; - if (r->gpr(n) != expected) { - D(bug("Register corruption: r%d was %08x, expected %08x\n", n, r->gpr(n), expected)); - err = 4; - goto ret; - } - } - - ret: - // Tell emul_func() to exit - emul_thread_ready = false; -} - - -#ifdef TEST -void *TOC; -void *R13; - -extern "C" void EmulOp(void *r, uint32 pc, int selector); -void EmulOp(void *r, uint32 pc, int selector) -{ -} - -extern "C" void check_load_invoc(uint32 type, int16 id, uint32 h); -void check_load_invoc(uint32 type, int16 id, uint32 h) -{ -} - -void ErrorAlert(const char *text) -{ - printf(GetString(STR_SHELL_ERROR_PREFIX), text); -} - -int main(void) -{ -#ifdef SYSTEM_CLOBBERS_R2 - // Get TOC pointer - TOC = get_r2(); -#endif - -#ifdef SYSTEM_CLOBBERS_R13 - // Get r13 register - R13 = get_r13(); -#endif - - // Check some things - paranoia_check(); -} -#endif diff --git a/SheepShaver/src/Unix/posix_sem.cpp b/SheepShaver/src/Unix/posix_sem.cpp deleted file mode 120000 index f530e6db..00000000 --- a/SheepShaver/src/Unix/posix_sem.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/posix_sem.cpp \ No newline at end of file diff --git a/SheepShaver/src/Unix/ppc_asm.S b/SheepShaver/src/Unix/ppc_asm.S deleted file mode 100644 index 8c1dfede..00000000 --- a/SheepShaver/src/Unix/ppc_asm.S +++ /dev/null @@ -1,932 +0,0 @@ -/* - * asm_linux.S - Assembly routines - * - * SheepShaver (C) 1997-2005 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include - -#define SAVE_FP_EXEC_68K 1 - - -/* - * void *get_sp(void) - Get stack pointer - */ - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(get_sp) -C_SYMBOL_NAME(get_sp): - mr r3,r1 - blr - - -/* - * void *get_r2(void) - Get r2 - */ - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(get_r2) -C_SYMBOL_NAME(get_r2): - mr r3,r2 - blr - - -/* - * void set_r2(void *val {r3}) - Set r2 - */ - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(set_r2) -C_SYMBOL_NAME(set_r2): - mr r2,r3 - blr - - -/* - * void *get_r13(void) - Get r13 (small data pointer under Linux) - */ - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(get_r13) -C_SYMBOL_NAME(get_r13): - mr r3,r13 - blr - -/* - * void set_r13(void *val {r3}) - Set r13 (small data pointer under Linux) - */ - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(set_r13) -C_SYMBOL_NAME(set_r13): - mr r13,r3 - blr - - -/* - * void flush_icache_range(void *start {r3}, void *end {r3}) - Flush D and I cache - */ - -CACHE_LINE_SIZE = 32 -LG_CACHE_LINE_SIZE = 5 - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(flush_icache_range) -C_SYMBOL_NAME(flush_icache_range): - li r5,CACHE_LINE_SIZE-1 - andc r3,r3,r5 - subf r4,r3,r4 - add r4,r4,r5 - srwi. r4,r4,LG_CACHE_LINE_SIZE - beqlr - mtctr r4 - mr r6,r3 -1: dcbst 0,r3 - addi r3,r3,CACHE_LINE_SIZE - bdnz 1b - sync /* wait for dcbst's to get to ram */ - mtctr r4 -2: icbi 0,r6 - addi r6,r6,CACHE_LINE_SIZE - bdnz 2b - sync - isync - blr - - -/* - * long atomic_add(long *var{r3}, long add{r4}) - Atomic add operation - * long atomic_and(long *var{r3}, long and{r4}) - Atomic and operation - * long atomic_or(long *var{r3}, long or{r4}) - Atomic or operation - * int test_and_set(int *var{r3}, int val{r4}) - Atomic test-and-set - */ - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(atomic_add) -C_SYMBOL_NAME(atomic_add): -0: dcbf 0,r3 - sync - ori r0,r0,1 - ori r0,r0,1 - ori r0,r0,1 - ori r0,r0,1 - ori r0,r0,1 - ori r0,r0,1 - isync - lwarx r5,0,r3 - add r0,r4,r5 - stwcx. r0,0,r3 - bne- 0b - mr r3,r5 - isync - blr - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(atomic_and) -C_SYMBOL_NAME(atomic_and): -0: dcbf 0,r3 - sync - ori r0,r0,1 - ori r0,r0,1 - ori r0,r0,1 - ori r0,r0,1 - ori r0,r0,1 - ori r0,r0,1 - isync - lwarx r5,0,r3 - and r0,r4,r5 - stwcx. r0,0,r3 - bne- 0b - mr r3,r5 - isync - blr - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(atomic_or) -C_SYMBOL_NAME(atomic_or): -0: dcbf 0,r3 - sync - ori r0,r0,1 - ori r0,r0,1 - ori r0,r0,1 - ori r0,r0,1 - ori r0,r0,1 - ori r0,r0,1 - isync - lwarx r5,0,r3 - or r0,r4,r5 - stwcx. r0,0,r3 - bne- 0b - mr r3,r5 - isync - blr - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(test_and_set) -C_SYMBOL_NAME(test_and_set): -0: dcbf 0,r3 - sync - ori r0,r0,1 - ori r0,r0,1 - ori r0,r0,1 - ori r0,r0,1 - ori r0,r0,1 - ori r0,r0,1 - isync - lwarx r5,0,r3 - cmpi 0,r5,0x0000 - bne 1f - stwcx. r4,0,r3 - bne- 0b -1: isync - mr r3,r5 - blr - - -/* - * void quit_emulator(void) - Jump to XLM_EMUL_RETURN_PROC - */ - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(quit_emulator) -C_SYMBOL_NAME(quit_emulator): - lwz r0,XLM_EMUL_RETURN_PROC(0) - mtlr r0 - blr - - -/* - * void jump_to_rom(uint32 entry {r3}, uint32 emulator_data {r4}) - Jump to Mac ROM - */ - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(jump_to_rom) -C_SYMBOL_NAME(jump_to_rom): - // Create stack frame - mflr r0 - stw r0,4(r1) - stwu r1,-(20+19*4+18*8)(r1) // maintain 16 byte alignment - - // Save PowerPC registers - stmw r13,20(r1) - stfd f14,20+19*4+0*8(r1) - stfd f15,20+19*4+1*8(r1) - stfd f16,20+19*4+2*8(r1) - stfd f17,20+19*4+3*8(r1) - stfd f18,20+19*4+4*8(r1) - stfd f19,20+19*4+5*8(r1) - stfd f20,20+19*4+6*8(r1) - stfd f21,20+19*4+7*8(r1) - stfd f22,20+19*4+8*8(r1) - stfd f23,20+19*4+9*8(r1) - stfd f24,20+19*4+10*8(r1) - stfd f25,20+19*4+11*8(r1) - stfd f26,20+19*4+12*8(r1) - stfd f27,20+19*4+13*8(r1) - stfd f28,20+19*4+14*8(r1) - stfd f29,20+19*4+15*8(r1) - stfd f30,20+19*4+16*8(r1) - stfd f31,20+19*4+17*8(r1) - - // Move entry address to ctr - mtctr r3 - - // Skip over EMUL_RETURN routine and get its address - bl 1f - - - /* - * EMUL_RETURN: Returned from emulator - */ - - // Restore PowerPC registers - lwz r1,XLM_EMUL_RETURN_STACK(0) - RESTORE_SYSTEM_R2 - lmw r13,20(r1) - lfd f14,20+19*4+0*8(r1) - lfd f15,20+19*4+1*8(r1) - lfd f16,20+19*4+2*8(r1) - lfd f17,20+19*4+3*8(r1) - lfd f18,20+19*4+4*8(r1) - lfd f19,20+19*4+5*8(r1) - lfd f20,20+19*4+6*8(r1) - lfd f21,20+19*4+7*8(r1) - lfd f22,20+19*4+8*8(r1) - lfd f23,20+19*4+9*8(r1) - lfd f24,20+19*4+10*8(r1) - lfd f25,20+19*4+11*8(r1) - lfd f26,20+19*4+12*8(r1) - lfd f27,20+19*4+13*8(r1) - lfd f28,20+19*4+14*8(r1) - lfd f29,20+19*4+15*8(r1) - lfd f30,20+19*4+16*8(r1) - lfd f31,20+19*4+17*8(r1) - - // Exiting from 68k emulator - li r0,1 - stw r0,XLM_IRQ_NEST(0) - li r0,MODE_NATIVE - stw r0,XLM_RUN_MODE(0) - - // Return to caller of jump_to_rom() - lwz r0,20+19*4+18*8+4(r1) - mtlr r0 - addi r1,r1,20+19*4+18*8 - blr - - - // Save address of EMUL_RETURN routine for 68k emulator patch -1: mflr r0 - stw r0,XLM_EMUL_RETURN_PROC(0) - - // Skip over EXEC_RETURN routine and get its address - bl 2f - - - /* - * EXEC_RETURN: Returned from 68k routine executed with Execute68k() - */ - - // Save r25 (contains current 68k interrupt level) - stw r25,XLM_68K_R25(0) - - // Reentering EMUL_OP mode - li r0,MODE_EMUL_OP - stw r0,XLM_RUN_MODE(0) - - // Save 68k registers - lwz r4,48(r1) // Pointer to M68kRegisters - stw r8,0*4(r4) // d[0]...d[7] - stw r9,1*4(r4) - stw r10,2*4(r4) - stw r11,3*4(r4) - stw r12,4*4(r4) - stw r13,5*4(r4) - stw r14,6*4(r4) - stw r15,7*4(r4) - stw r16,8*4(r4) // a[0]..a[6] - stw r17,9*4(r4) - stw r18,10*4(r4) - stw r19,11*4(r4) - stw r20,12*4(r4) - stw r21,13*4(r4) - stw r22,14*4(r4) - - // Restore PowerPC registers - lmw r13,56(r1) -#if SAVE_FP_EXEC_68K - lfd f14,56+19*4+0*8(r1) - lfd f15,56+19*4+1*8(r1) - lfd f16,56+19*4+2*8(r1) - lfd f17,56+19*4+3*8(r1) - lfd f18,56+19*4+4*8(r1) - lfd f19,56+19*4+5*8(r1) - lfd f20,56+19*4+6*8(r1) - lfd f21,56+19*4+7*8(r1) - lfd f22,56+19*4+8*8(r1) - lfd f23,56+19*4+9*8(r1) - lfd f24,56+19*4+10*8(r1) - lfd f25,56+19*4+11*8(r1) - lfd f26,56+19*4+12*8(r1) - lfd f27,56+19*4+13*8(r1) - lfd f28,56+19*4+14*8(r1) - lfd f29,56+19*4+15*8(r1) - lfd f30,56+19*4+16*8(r1) - lfd f31,56+19*4+17*8(r1) -#endif - - // Return to caller - lwz r0,52(r1) - mtcrf 0xff,r0 - lwz r0,56+19*4+18*8+4(r1) - mtlr r0 - addi r1,r1,56+19*4+18*8 - RESTORE_SYSTEM_R2 - RESTORE_SYSTEM_R13 - blr - - - // Save address of EXEC_RETURN routine for 68k emulator patch -2: mflr r0 - stw r0,XLM_EXEC_RETURN_PROC(0) - - // Skip over EMUL_BREAK/EMUL_OP routine and get its address - bl 3f - - - /* - * EMUL_BREAK/EMUL_OP: Execute native routine, selector in r5 (my own private mode switch) - * - * 68k registers are stored in a M68kRegisters struct on the stack - * which the native routine may read and modify - */ - - // Save r25 (contains current 68k interrupt level) - stw r25,XLM_68K_R25(0) - - // Entering EMUL_OP mode within 68k emulator - li r0,MODE_EMUL_OP - stw r0,XLM_RUN_MODE(0) - - // Create PowerPC stack frame, reserve space for M68kRegisters - mr r3,r1 - subi r1,r1,64 // Fake "caller" frame - rlwinm r1,r1,0,0,27 // Align stack - - mfcr r0 - rlwinm r0,r0,0,11,8 - stw r0,4(r1) - mfxer r0 - stw r0,16(r1) - stw r2,12(r1) - stwu r1,-(56+16*4+15*8)(r1) - - // Save 68k registers (M68kRegisters) - stw r8,56+0*4(r1) // d[0]..d[7] - stw r9,56+1*4(r1) - stw r10,56+2*4(r1) - stw r11,56+3*4(r1) - stw r12,56+4*4(r1) - stw r13,56+5*4(r1) - stw r14,56+6*4(r1) - stw r15,56+7*4(r1) - stw r16,56+8*4(r1) // a[0]..a[7] - stw r17,56+9*4(r1) - stw r18,56+10*4(r1) - stw r19,56+11*4(r1) - stw r20,56+12*4(r1) - stw r21,56+13*4(r1) - stw r22,56+14*4(r1) - stw r3,56+15*4(r1) - stfd f0,56+16*4+0*8(r1) - stfd f1,56+16*4+1*8(r1) - stfd f2,56+16*4+2*8(r1) - stfd f3,56+16*4+3*8(r1) - stfd f4,56+16*4+4*8(r1) - stfd f5,56+16*4+5*8(r1) - stfd f6,56+16*4+6*8(r1) - stfd f7,56+16*4+7*8(r1) - mffs f0 - stfd f8,56+16*4+8*8(r1) - stfd f9,56+16*4+9*8(r1) - stfd f10,56+16*4+10*8(r1) - stfd f11,56+16*4+11*8(r1) - stfd f12,56+16*4+12*8(r1) - stfd f13,56+16*4+13*8(r1) - stfd f0,56+16*4+14*8(r1) - - // Execute native routine - RESTORE_SYSTEM_R2 - RESTORE_SYSTEM_R13 - addi r3,r1,56 - mr r4,r24 - bl C_SYMBOL_NAME(EmulOp) - - // Restore 68k registers (M68kRegisters) - lwz r8,56+0*4(r1) // d[0]..d[7] - lwz r9,56+1*4(r1) - lwz r10,56+2*4(r1) - lwz r11,56+3*4(r1) - lwz r12,56+4*4(r1) - lwz r13,56+5*4(r1) - lwz r14,56+6*4(r1) - lwz r15,56+7*4(r1) - lwz r16,56+8*4(r1) // a[0]..a[7] - lwz r17,56+9*4(r1) - lwz r18,56+10*4(r1) - lwz r19,56+11*4(r1) - lwz r20,56+12*4(r1) - lwz r21,56+13*4(r1) - lwz r22,56+14*4(r1) - lwz r3,56+15*4(r1) - lfd f13,56+16*4+14*8(r1) - lfd f0,56+16*4+0*8(r1) - lfd f1,56+16*4+1*8(r1) - lfd f2,56+16*4+2*8(r1) - lfd f3,56+16*4+3*8(r1) - lfd f4,56+16*4+4*8(r1) - lfd f5,56+16*4+5*8(r1) - lfd f6,56+16*4+6*8(r1) - lfd f7,56+16*4+7*8(r1) - mtfsf 0xff,f13 - lfd f8,56+16*4+8*8(r1) - lfd f9,56+16*4+9*8(r1) - lfd f10,56+16*4+10*8(r1) - lfd f11,56+16*4+11*8(r1) - lfd f12,56+16*4+12*8(r1) - lfd f13,56+16*4+13*8(r1) - - // Delete PowerPC stack frame - lwz r2,56+16*4+15*8+12(r1) - lwz r0,56+16*4+15*8+16(r1) - mtxer r0 - lwz r0,56+16*4+15*8+4(r1) - mtcrf 0xff,r0 - mr r1,r3 - - // Reentering 68k emulator - li r0,MODE_68K - stw r0,XLM_RUN_MODE(0) - - // Set r0 to 0 for 68k emulator - li r0,0 - - // Execute next 68k opcode - rlwimi r29,r27,3,13,28 - lhau r27,2(r24) - mtlr r29 - blr - - - // Save address of EMUL_BREAK/EMUL_OP routine for 68k emulator patch -3: mflr r0 - stw r0,XLM_EMUL_OP_PROC(0) - - // Save stack pointer for EMUL_RETURN - stw r1,XLM_EMUL_RETURN_STACK(0) - - // Preset registers for ROM boot routine - lis r3,ASM_HA16(C_SYMBOL_NAME(ROMBase)) // Pointer to ROM boot structure: - lwz r3,ASM_LO16(C_SYMBOL_NAME(ROMBase))(r3) // r3 = ROMBase + 0x30d000 - addis r3,r3,ASM_HA16(0x30d000) - addi r3,r3,ASM_LO16(0x30d000) - - // 68k emulator is now active - li r0,MODE_68K - stw r0,XLM_RUN_MODE(0) - - // Jump to ROM - bctr - - -/* - * void execute_68k(uint32 pc {r3}, M68kRegisters *r {r4}) - Execute 68k routine - */ - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(execute_68k) -C_SYMBOL_NAME(execute_68k): - // Create MacOS stack frame - mflr r0 - stw r0,4(r1) - stwu r1,-(56+19*4+18*8)(r1) - mfcr r0 - stw r4,48(r1) // save pointer to M68kRegisters for EXEC_RETURN - stw r0,52(r1) // save CR - - // Save PowerPC registers - stmw r13,56(r1) -#if SAVE_FP_EXEC_68K - stfd f14,56+19*4+0*8(r1) - stfd f15,56+19*4+1*8(r1) - stfd f16,56+19*4+2*8(r1) - stfd f17,56+19*4+3*8(r1) - stfd f18,56+19*4+4*8(r1) - stfd f19,56+19*4+5*8(r1) - stfd f20,56+19*4+6*8(r1) - stfd f21,56+19*4+7*8(r1) - stfd f22,56+19*4+8*8(r1) - stfd f23,56+19*4+9*8(r1) - stfd f24,56+19*4+10*8(r1) - stfd f25,56+19*4+11*8(r1) - stfd f26,56+19*4+12*8(r1) - stfd f27,56+19*4+13*8(r1) - stfd f28,56+19*4+14*8(r1) - stfd f29,56+19*4+15*8(r1) - stfd f30,56+19*4+16*8(r1) - stfd f31,56+19*4+17*8(r1) -#endif - - // Set up registers for 68k emulator - lwz r31,XLM_KERNEL_DATA(0) // Pointer to Kernel Data - addi r31,r31,0x1000 - li r0,0 - mtcrf 0xff,r0 - creqv 11,11,11 // Supervisor mode - lwz r8,0*4(r4) // d[0]..d[7] - lwz r9,1*4(r4) - lwz r10,2*4(r4) - lwz r11,3*4(r4) - lwz r12,4*4(r4) - lwz r13,5*4(r4) - lwz r14,6*4(r4) - lwz r15,7*4(r4) - lwz r16,8*4(r4) // a[0]..a[6] - lwz r17,9*4(r4) - lwz r18,10*4(r4) - lwz r19,11*4(r4) - lwz r20,12*4(r4) - lwz r21,13*4(r4) - lwz r22,14*4(r4) - li r23,0 - mr r24,r3 - lwz r25,XLM_68K_R25(0) // MSB of SR - li r26,0 - li r28,0 // VBR - lwz r29,0x74(r31) // Pointer to opcode table - lwz r30,0x78(r31) // Address of emulator - - // Push return address (points to EXEC_RETURN opcode) on stack - li r0,XLM_EXEC_RETURN_OPCODE - stwu r0,-4(r1) - - // Reentering 68k emulator - li r0,MODE_68K - stw r0,XLM_RUN_MODE(0) - - // Set r0 to 0 for 68k emulator - li r0,0 - - // Execute 68k opcode - lha r27,0(r24) - rlwimi r29,r27,3,13,28 - lhau r27,2(r24) - mtlr r29 - blr - - -/* - * uint32 call_macos1(uint32 tvect{r3}, uint32 arg1{r4}) ... - Call MacOS routines - */ - -ASM_MACRO_START prolog - mflr r0 - stw r0,4(r1) - stwu r1,-64(r1) -ASM_MACRO_END - -ASM_MACRO_START epilog - lwz r0,64+4(r1) - mtlr r0 - addi r1,r1,64 - RESTORE_SYSTEM_R2 - RESTORE_SYSTEM_R13 - blr -ASM_MACRO_END - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(call_macos) -C_SYMBOL_NAME(call_macos): - prolog - lwz r0,0(r3) // Get routine address - lwz r2,4(r3) // Load TOC pointer - mtctr r0 - bctrl - epilog - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(call_macos1) -C_SYMBOL_NAME(call_macos1): - prolog - lwz r0,0(r3) // Get routine address - lwz r2,4(r3) // Load TOC pointer - mtctr r0 - mr r3,r4 - bctrl - epilog - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(call_macos2) -C_SYMBOL_NAME(call_macos2): - prolog - lwz r0,0(r3) // Get routine address - lwz r2,4(r3) // Load TOC pointer - mtctr r0 - mr r3,r4 - mr r4,r5 - bctrl - epilog - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(call_macos3) -C_SYMBOL_NAME(call_macos3): - prolog - lwz r0,0(r3) // Get routine address - lwz r2,4(r3) // Load TOC pointer - mtctr r0 - mr r3,r4 - mr r4,r5 - mr r5,r6 - bctrl - epilog - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(call_macos4) -C_SYMBOL_NAME(call_macos4): - prolog - lwz r0,0(r3) // Get routine address - lwz r2,4(r3) // Load TOC pointer - mtctr r0 - mr r3,r4 - mr r4,r5 - mr r5,r6 - mr r6,r7 - bctrl - epilog - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(call_macos5) -C_SYMBOL_NAME(call_macos5): - prolog - lwz r0,0(r3) // Get routine address - lwz r2,4(r3) // Load TOC pointer - mtctr r0 - mr r3,r4 - mr r4,r5 - mr r5,r6 - mr r6,r7 - mr r7,r8 - bctrl - epilog - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(call_macos6) -C_SYMBOL_NAME(call_macos6): - prolog - lwz r0,0(r3) // Get routine address - lwz r2,4(r3) // Load TOC pointer - mtctr r0 - mr r3,r4 - mr r4,r5 - mr r5,r6 - mr r6,r7 - mr r7,r8 - mr r8,r9 - bctrl - epilog - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(call_macos7) -C_SYMBOL_NAME(call_macos7): - prolog - lwz r0,0(r3) // Get routine address - lwz r2,4(r3) // Load TOC pointer - mtctr r0 - mr r3,r4 - mr r4,r5 - mr r5,r6 - mr r6,r7 - mr r7,r8 - mr r8,r9 - mr r9,r10 - bctrl - epilog - - -/* - * Native resource manager patches - */ - -ASM_MACRO_START do_get_resource ASM_MACRO_ARG0_DEF - // Create stack frame - mflr r0 - stw r0,8(r1) - stwu r1,-(56+12)(r1) - - // Save type/ID - stw r3,56(r1) - stw r4,56+4(r1) - - // Call old routine - lwz r0,ASM_MACRO_ARG0(0) - lwz r2,XLM_RES_LIB_TOC(0) - mtctr r0 - bctrl - stw r3,56+8(r1) // Save handle - - // Call CheckLoad - RESTORE_SYSTEM_R2 - RESTORE_SYSTEM_R13 - lwz r3,56(r1) - lha r4,56+6(r1) - lwz r5,56+8(r1) - bl C_SYMBOL_NAME(check_load_invoc) - lwz r3,56+8(r1) // Restore handle - - // Return to caller - lwz r0,56+12+8(r1) - mtlr r0 - addi r1,r1,56+12 - blr -ASM_MACRO_END - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(get_resource) -C_SYMBOL_NAME(get_resource): - do_get_resource XLM_GET_RESOURCE - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(get_1_resource) -C_SYMBOL_NAME(get_1_resource): - do_get_resource XLM_GET_1_RESOURCE - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(get_ind_resource) -C_SYMBOL_NAME(get_ind_resource): - do_get_resource XLM_GET_IND_RESOURCE - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(get_1_ind_resource) -C_SYMBOL_NAME(get_1_ind_resource): - do_get_resource XLM_GET_1_IND_RESOURCE - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(r_get_resource) -C_SYMBOL_NAME(r_get_resource): - do_get_resource XLM_R_GET_RESOURCE - -ASM_MACRO_START do_get_named_resource ASM_MACRO_ARG0_DEF - // Create stack frame - mflr r0 - stw r0,8(r1) - stwu r1,-(56+12)(r1) - - // Save type/ID - stw r3,56(r1) - stw r4,56+4(r1) - - // Call old routine - lwz r0,ASM_MACRO_ARG0(0) - lwz r2,XLM_RES_LIB_TOC(0) - mtctr r0 - bctrl - stw r3,56+8(r1) // Save handle - - // Call CheckLoad - RESTORE_SYSTEM_R2 - RESTORE_SYSTEM_R13 - lwz r3,56(r1) - lwz r4,56+4(r1) - lwz r5,56+8(r1) - bl C_SYMBOL_NAME(named_check_load_invoc) - lwz r3,56+8(r1) // Restore handle - - // Return to caller - lwz r0,56+12+8(r1) - mtlr r0 - addi r1,r1,56+12 - blr -ASM_MACRO_END - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(get_named_resource) -C_SYMBOL_NAME(get_named_resource): - do_get_named_resource XLM_GET_NAMED_RESOURCE - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(get_1_named_resource) -C_SYMBOL_NAME(get_1_named_resource): - do_get_named_resource XLM_GET_1_NAMED_RESOURCE - - -/* - * void ppc_interrupt(uint32 entry{r3}, uint32 kernel_data{r4}) - Execute PPC interrupt - */ - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(ppc_interrupt) -C_SYMBOL_NAME(ppc_interrupt): - mflr r0 - stw r0,4(r1) - stwu r1,-64(r1) - - // Get address of return routine - bl 1f - - // Return routine - lwz r0,64+4(r1) - mtlr r0 - addi r1,r1,64 - blr - - // Prepare registers for nanokernel interrupt routine -1: mtctr r1 - mr r1,r4 - stw r6,0x018(r1) - mfctr r6 - stw r6,0x004(r1) - lwz r6,0x65c(r1) - stw r7,0x13c(r6) - stw r8,0x144(r6) - stw r9,0x14c(r6) - stw r10,0x154(r6) - stw r11,0x15c(r6) - stw r12,0x164(r6) - stw r13,0x16c(r6) - - mflr r10 - mfcr r13 - lwz r7,0x660(r1) - mflr r12 - rlwimi. r7,r7,8,0,0 - li r11,0 - ori r11,r11,0xf072 // MSR (SRR1) - mtcrf 0x70,r11 - li r8,0 - - // Enter nanokernel - mtlr r3 - blr - - -/* - * Define signal handlers with alternate stack initialization magic - */ - -#define SIG_STACK_SIZE 0x10000 - -ASM_MACRO_START do_define_signal_handler \ - ASM_MACRO_ARG0_DEF /* name */ \ - ASM_MACRO_ARG1_DEF /* stack */ \ - ASM_MACRO_ARG2_DEF /* stack id */ \ - ASM_MACRO_ARG3_DEF /* signal handler */ - - // Alternate stack lower base for this signal handler - .lcomm ASM_MACRO_ARG1,SIG_STACK_SIZE,ASM_ALIGN_2(4) - ASM_TYPE(ASM_MACRO_ARG1,@object) - - // Represents the current nest level for this signal handler - // Note that in SheepShaver, SIGUSR2 signals are blocked while - // handling other signals so, it's unlikely we ever get a nest - // level greater than 1 - .lcomm ASM_MACRO_ARG2,4,ASM_ALIGN_2(2) - ASM_TYPE(ASM_MACRO_ARG2,@object) - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(ASM_MACRO_ARG0) -C_SYMBOL_NAME(ASM_MACRO_ARG0): - // Preserve args in scratch registers - mflr r14 - mr r15,r3 - mr r16,r4 - mr r17,r5 - mr r18,r1 - - // Atomically increase stack_id - lis r19,ASM_HA16(ASM_MACRO_ARG2) - la r19,ASM_LO16(ASM_MACRO_ARG2)(r19) - li r4,1 - mr r3,r19 - bl C_SYMBOL_NAME(atomic_add) - cmpwi r3,0 - bne- 1f - - // ID was 0, we can use the local stack - lis r9,ASM_HA16(ASM_MACRO_ARG1) - lis r3,(SIG_STACK_SIZE>>16) - la r9,ASM_LO16(ASM_MACRO_ARG1)(r9) - addi r3,r3,((SIG_STACK_SIZE&0xffff)-64) - add r1,r9,r3 - -1: // Invoke signal handler - stwu r1,-16(r1) - mr r3,r15 - mr r4,r16 - mr r5,r17 - bl C_SYMBOL_NAME(ASM_MACRO_ARG3) - addi r1,r1,16 - - // Atomically decrease stack id - mr r3,r19 - li r4,-1 - bl C_SYMBOL_NAME(atomic_add) - - // Restore kernel stack and return - mtlr r14 - mr r1,r18 - blr -ASM_MACRO_END - -#define DEFINE_SIGNAL_HANDLER(NAME) \ - do_define_signal_handler \ - NAME##_handler_init ASM_MACRO_ARG_SEP \ - NAME##_stack ASM_MACRO_ARG_SEP \ - NAME##_stack_id ASM_MACRO_ARG_SEP \ - NAME##_handler - -DEFINE_SIGNAL_HANDLER(sigusr2) diff --git a/SheepShaver/src/Unix/ppc_asm.tmpl b/SheepShaver/src/Unix/ppc_asm.tmpl deleted file mode 100644 index 75c03860..00000000 --- a/SheepShaver/src/Unix/ppc_asm.tmpl +++ /dev/null @@ -1,156 +0,0 @@ -/* Define usage of "reserved" registers */ -#if defined(__linux__) -#define SYSTEM_CLOBBERS_R2 1 /* Pointer to Thread Local Storage */ -#define SYSTEM_CLOBBERS_R13 1 /* Pointer to .sdata section */ -#endif - -#ifdef __ASSEMBLY__ -/* Helper macros */ -#ifdef SYSTEM_CLOBBERS_R2 -#define RESTORE_SYSTEM_R2 lwz r2,XLM_TOC(0) -#define SAVE_SYSTEM_R2 stw r2,XLM_TOC(0) -#else -#define RESTORE_SYSTEM_R2 -#define SAVE_SYSTEM_R2 -#endif -#ifdef SYSTEM_CLOBBERS_R13 -#define RESTORE_SYSTEM_R13 lwz r13,XLM_R13(0) -#define SAVE_SYSTEM_R13 stw r13,XLM_R13(0) -#else -#define RESTORE_SYSTEM_R13 -#define SAVE_SYSTEM_R13 -#endif - -/* Helper macros */ -#define xglue(x, y) x ## y -#define glue(x, y) xglue(x, y) - -/* Apple assembler perticularities */ -#if (defined(__APPLE__) && defined(__MACH__)) -#define C_SYMBOL_NAME(NAME) glue(_, NAME) -#define ASM_TYPE(NAME, TYPE) /* nothing */ -#define ASM_ALIGN_2(EXP) EXP -#define ASM_HA16(VAR) ha16(VAR) -#define ASM_LO16(VAR) lo16(VAR) -#define ASM_MACRO_END .endmacro -#define ASM_MACRO_ARG_SEP , -#define ASM_MACRO_ARG0_DEF /* nothing! */ -#define ASM_MACRO_ARG0 $0 -#define ASM_MACRO_ARG1_DEF /* nothing! */ -#define ASM_MACRO_ARG1 $1 -#define ASM_MACRO_ARG2_DEF /* nothing! */ -#define ASM_MACRO_ARG2 $2 -#define ASM_MACRO_ARG3_DEF /* nothing! */ -#define ASM_MACRO_ARG3 $3 -#endif - -/* Defaults for GNU assembler */ -#ifndef ASM_TYPE -#define ASM_TYPE(NAME, TYPE) .type NAME, TYPE -#endif -#ifndef ASM_ALIGN_2 -#define ASM_ALIGN_2(EXP) (1 << (EXP)) -#endif -#ifndef ASM_HA16 -#define ASM_HA16(VAR) VAR@ha -#endif -#ifndef ASM_LO16 -#define ASM_LO16(VAR) VAR@l -#endif -#ifndef ASM_MACRO_START -#define ASM_MACRO_START .macro -#endif -#ifndef ASM_MACRO_END -#define ASM_MACRO_END .endm -#endif -#ifndef ASM_MACRO_ARG_SEP -#define ASM_MACRO_ARG_SEP -#endif -#ifndef ASM_MACRO_ARG0_DEF -#define ASM_MACRO_ARG0_DEF __asm_macro_arg0 -#define ASM_MACRO_ARG0 \__asm_macro_arg0 -#define ASM_MACRO_ARG1_DEF , __asm_macro_arg1 -#define ASM_MACRO_ARG1 \__asm_macro_arg1 -#define ASM_MACRO_ARG2_DEF , __asm_macro_arg2 -#define ASM_MACRO_ARG2 \__asm_macro_arg2 -#define ASM_MACRO_ARG3_DEF , __asm_macro_arg3 -#define ASM_MACRO_ARG3 \__asm_macro_arg3 -#endif -#ifndef C_SYMBOL_NAME -#define C_SYMBOL_NAME(NAME) NAME -#endif -#ifndef ASM_GLOBAL_DIRECTIVE -#define ASM_GLOBAL_DIRECTIVE .globl -#endif - -/* Register names */ -#if defined(__linux__) || defined(__NetBSD__) -#define r0 0 -#define r1 1 -#define r2 2 -#define r3 3 -#define r4 4 -#define r5 5 -#define r6 6 -#define r7 7 -#define r8 8 -#define r9 9 -#define r10 10 -#define r11 11 -#define r12 12 -#define r13 13 -#define r14 14 -#define r15 15 -#define r16 16 -#define r17 17 -#define r18 18 -#define r19 19 -#define r20 20 -#define r21 21 -#define r22 22 -#define r23 23 -#define r24 24 -#define r25 25 -#define r26 26 -#define r27 27 -#define r28 28 -#define r29 29 -#define r30 30 -#define r31 31 -#endif - -#if defined(__linux__) || defined(__NetBSD__) -#define f0 0 -#define f1 1 -#define f2 2 -#define f3 3 -#define f4 4 -#define f5 5 -#define f6 6 -#define f7 7 -#define f8 8 -#define f9 9 -#define f10 10 -#define f11 11 -#define f12 12 -#define f13 13 -#define f14 14 -#define f15 15 -#define f16 16 -#define f17 17 -#define f18 18 -#define f19 19 -#define f20 20 -#define f21 21 -#define f22 22 -#define f23 23 -#define f24 24 -#define f25 25 -#define f26 26 -#define f27 27 -#define f28 28 -#define f29 29 -#define f30 30 -#define f31 31 -#endif -#endif diff --git a/SheepShaver/src/Unix/prefs_editor_gtk.cpp b/SheepShaver/src/Unix/prefs_editor_gtk.cpp deleted file mode 100644 index b092e824..00000000 --- a/SheepShaver/src/Unix/prefs_editor_gtk.cpp +++ /dev/null @@ -1,1594 +0,0 @@ -/* - * prefs_editor_linux.cpp - Preferences editor, Linux implementation using GTK+ - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" - -#include -#include -#include -#include -#include -#include -#include - -#include "user_strings.h" -#include "version.h" -#include "cdrom.h" -#include "xpram.h" -#include "prefs.h" -#include "prefs_editor.h" - -#define DEBUG 0 -#include "debug.h" - - -// Global variables -static GtkWidget *win; // Preferences window -static bool start_clicked = false; // Return value of PrefsEditor() function -static int screen_width, screen_height; // Screen dimensions - - -// Prototypes -static void create_volumes_pane(GtkWidget *top); -static void create_graphics_pane(GtkWidget *top); -static void create_input_pane(GtkWidget *top); -static void create_serial_pane(GtkWidget *top); -static void create_memory_pane(GtkWidget *top); -static void create_jit_pane(GtkWidget *top); -static void read_settings(void); - - -/* - * Utility functions - */ - -#if ! GLIB_CHECK_VERSION(2,0,0) -#define G_OBJECT(obj) GTK_OBJECT(obj) -#define g_object_get_data(obj, key) gtk_object_get_data((obj), (key)) -#define g_object_set_data(obj, key, data) gtk_object_set_data((obj), (key), (data)) -#endif - -struct opt_desc { - int label_id; - GtkSignalFunc func; -}; - -struct combo_desc { - int label_id; -}; - -struct file_req_assoc { - file_req_assoc(GtkWidget *r, GtkWidget *e) : req(r), entry(e) {} - GtkWidget *req; - GtkWidget *entry; -}; - -static void cb_browse_ok(GtkWidget *button, file_req_assoc *assoc) -{ - gchar *file = (char *)gtk_file_selection_get_filename(GTK_FILE_SELECTION(assoc->req)); - gtk_entry_set_text(GTK_ENTRY(assoc->entry), file); - gtk_widget_destroy(assoc->req); - delete assoc; -} - -static void cb_browse(GtkWidget *widget, void *user_data) -{ - GtkWidget *req = gtk_file_selection_new(GetString(STR_BROWSE_TITLE)); - gtk_signal_connect_object(GTK_OBJECT(req), "delete_event", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(req)); - gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(req)->ok_button), "clicked", GTK_SIGNAL_FUNC(cb_browse_ok), new file_req_assoc(req, (GtkWidget *)user_data)); - gtk_signal_connect_object(GTK_OBJECT(GTK_FILE_SELECTION(req)->cancel_button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(req)); - gtk_widget_show(req); -} - -static GtkWidget *make_browse_button(GtkWidget *entry) -{ - GtkWidget *button; - - button = gtk_button_new_with_label(GetString(STR_BROWSE_CTRL)); - gtk_widget_show(button); - gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc)cb_browse, (void *)entry); - return button; -} - -static void add_menu_item(GtkWidget *menu, int label_id, GtkSignalFunc func) -{ - GtkWidget *item = gtk_menu_item_new_with_label(GetString(label_id)); - gtk_widget_show(item); - gtk_signal_connect(GTK_OBJECT(item), "activate", func, NULL); - gtk_menu_append(GTK_MENU(menu), item); -} - -static GtkWidget *make_pane(GtkWidget *notebook, int title_id) -{ - GtkWidget *frame, *label, *box; - - frame = gtk_frame_new(NULL); - gtk_container_border_width(GTK_CONTAINER(frame), 4); - - box = gtk_vbox_new(FALSE, 4); - gtk_container_set_border_width(GTK_CONTAINER(box), 4); - gtk_container_add(GTK_CONTAINER(frame), box); - - gtk_widget_show_all(frame); - - label = gtk_label_new(GetString(title_id)); - gtk_notebook_append_page(GTK_NOTEBOOK(notebook), frame, label); - return box; -} - -static GtkWidget *make_button_box(GtkWidget *top, int border, const opt_desc *buttons) -{ - GtkWidget *bb, *button; - - bb = gtk_hbutton_box_new(); - gtk_widget_show(bb); - gtk_container_set_border_width(GTK_CONTAINER(bb), border); - gtk_button_box_set_layout(GTK_BUTTON_BOX(bb), GTK_BUTTONBOX_DEFAULT_STYLE); - gtk_button_box_set_spacing(GTK_BUTTON_BOX(bb), 4); - gtk_box_pack_start(GTK_BOX(top), bb, FALSE, FALSE, 0); - - while (buttons->label_id) { - button = gtk_button_new_with_label(GetString(buttons->label_id)); - gtk_widget_show(button); - gtk_signal_connect_object(GTK_OBJECT(button), "clicked", buttons->func, NULL); - gtk_box_pack_start(GTK_BOX(bb), button, TRUE, TRUE, 0); - buttons++; - } - return bb; -} - -static GtkWidget *make_separator(GtkWidget *top) -{ - GtkWidget *sep = gtk_hseparator_new(); - gtk_box_pack_start(GTK_BOX(top), sep, FALSE, FALSE, 0); - gtk_widget_show(sep); - return sep; -} - -static GtkWidget *make_table(GtkWidget *top, int x, int y) -{ - GtkWidget *table = gtk_table_new(x, y, FALSE); - gtk_widget_show(table); - gtk_box_pack_start(GTK_BOX(top), table, FALSE, FALSE, 0); - return table; -} - -static GtkWidget *table_make_option_menu(GtkWidget *table, int row, int label_id, const opt_desc *options, int active) -{ - GtkWidget *label, *opt, *menu; - - label = gtk_label_new(GetString(label_id)); - gtk_widget_show(label); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, row, row + 1, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); - - opt = gtk_option_menu_new(); - gtk_widget_show(opt); - menu = gtk_menu_new(); - - while (options->label_id) { - add_menu_item(menu, options->label_id, options->func); - options++; - } - gtk_menu_set_active(GTK_MENU(menu), active); - - gtk_option_menu_set_menu(GTK_OPTION_MENU(opt), menu); - gtk_table_attach(GTK_TABLE(table), opt, 1, 2, row, row + 1, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4); - return menu; -} - -static GtkWidget *table_make_combobox(GtkWidget *table, int row, int label_id, const char *default_value, GList *glist) -{ - GtkWidget *label, *combo; - char str[32]; - - label = gtk_label_new(GetString(label_id)); - gtk_widget_show(label); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, row, row + 1, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); - - combo = gtk_combo_new(); - gtk_widget_show(combo); - gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist); - - gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), default_value); - gtk_table_attach(GTK_TABLE(table), combo, 1, 2, row, row + 1, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4); - - return combo; -} - -static GtkWidget *table_make_combobox(GtkWidget *table, int row, int label_id, const char *default_value, const combo_desc *options) -{ - GList *glist = NULL; - while (options->label_id) { - glist = g_list_append(glist, (void *)GetString(options->label_id)); - options++; - } - - return table_make_combobox(table, row, label_id, default_value, glist); -} - -static GtkWidget *table_make_file_entry(GtkWidget *table, int row, int label_id, const char *prefs_item, bool only_dirs = false) -{ - GtkWidget *box, *label, *entry, *button; - - label = gtk_label_new(GetString(label_id)); - gtk_widget_show(label); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, row, row + 1, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); - - const char *str = PrefsFindString(prefs_item); - if (str == NULL) - str = ""; - - box = gtk_hbox_new(FALSE, 4); - gtk_widget_show(box); - gtk_table_attach(GTK_TABLE(table), box, 1, 2, row, row + 1, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4); - - entry = gtk_entry_new(); - gtk_entry_set_text(GTK_ENTRY(entry), str); - gtk_widget_show(entry); - gtk_box_pack_start(GTK_BOX(box), entry, TRUE, TRUE, 0); - - button = make_browse_button(entry); - gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0); - g_object_set_data(G_OBJECT(entry), "chooser_button", button); - return entry; -} - -static GtkWidget *make_option_menu(GtkWidget *top, int label_id, const opt_desc *options, int active) -{ - GtkWidget *box, *label, *opt, *menu; - - box = gtk_hbox_new(FALSE, 4); - gtk_widget_show(box); - gtk_box_pack_start(GTK_BOX(top), box, FALSE, FALSE, 0); - - label = gtk_label_new(GetString(label_id)); - gtk_widget_show(label); - gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0); - - opt = gtk_option_menu_new(); - gtk_widget_show(opt); - menu = gtk_menu_new(); - - while (options->label_id) { - add_menu_item(menu, options->label_id, options->func); - options++; - } - gtk_menu_set_active(GTK_MENU(menu), active); - - gtk_option_menu_set_menu(GTK_OPTION_MENU(opt), menu); - gtk_box_pack_start(GTK_BOX(box), opt, FALSE, FALSE, 0); - return menu; -} - -static GtkWidget *make_entry(GtkWidget *top, int label_id, const char *prefs_item) -{ - GtkWidget *box, *label, *entry; - - box = gtk_hbox_new(FALSE, 4); - gtk_widget_show(box); - gtk_box_pack_start(GTK_BOX(top), box, FALSE, FALSE, 0); - - label = gtk_label_new(GetString(label_id)); - gtk_widget_show(label); - gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0); - - entry = gtk_entry_new(); - gtk_widget_show(entry); - const char *str = PrefsFindString(prefs_item); - if (str == NULL) - str = ""; - gtk_entry_set_text(GTK_ENTRY(entry), str); - gtk_box_pack_start(GTK_BOX(box), entry, TRUE, TRUE, 0); - return entry; -} - -static const gchar *get_file_entry_path(GtkWidget *entry) -{ - return gtk_entry_get_text(GTK_ENTRY(entry)); -} - -static GtkWidget *make_checkbox(GtkWidget *top, int label_id, const char *prefs_item, GtkSignalFunc func) -{ - GtkWidget *button = gtk_check_button_new_with_label(GetString(label_id)); - gtk_widget_show(button); - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), PrefsFindBool(prefs_item)); - gtk_signal_connect(GTK_OBJECT(button), "toggled", func, button); - gtk_box_pack_start(GTK_BOX(top), button, FALSE, FALSE, 0); - return button; -} - -static GtkWidget *make_checkbox(GtkWidget *top, int label_id, bool active, GtkSignalFunc func) -{ - GtkWidget *button = gtk_check_button_new_with_label(GetString(label_id)); - gtk_widget_show(button); - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), active); - gtk_signal_connect(GTK_OBJECT(button), "toggled", func, button); - gtk_box_pack_start(GTK_BOX(top), button, FALSE, FALSE, 0); - return button; -} - - -/* - * Show preferences editor - * Returns true when user clicked on "Start", false otherwise - */ - -// Window closed -static gint window_closed(void) -{ - return FALSE; -} - -// Window destroyed -static void window_destroyed(void) -{ - gtk_main_quit(); -} - -// "Start" button clicked -static void cb_start(...) -{ - start_clicked = true; - read_settings(); - SavePrefs(); - gtk_widget_destroy(win); -} - -// "Quit" button clicked -static void cb_quit(...) -{ - start_clicked = false; - gtk_widget_destroy(win); -} - -// "OK" button of "About" dialog clicked -static void dl_quit(GtkWidget *dialog) -{ - gtk_widget_destroy(dialog); -} - -// "About" selected -static void mn_about(...) -{ - GtkWidget *dialog, *label, *button; - - char str[512]; - sprintf(str, - "SheepShaver\nVersion %d.%d\n\n" - "Copyright (C) 1997-2008 Christian Bauer and Marc Hellwig\n" - "E-mail: cb@cebix.net\n" - "http://sheepshaver.cebix.net/\n\n" - "SheepShaver comes with ABSOLUTELY NO\n" - "WARRANTY. This is free software, and\n" - "you are welcome to redistribute it\n" - "under the terms of the GNU General\n" - "Public License.\n", - VERSION_MAJOR, VERSION_MINOR - ); - - dialog = gtk_dialog_new(); - gtk_window_set_title(GTK_WINDOW(dialog), GetString(STR_ABOUT_TITLE)); - gtk_container_border_width(GTK_CONTAINER(dialog), 5); - gtk_widget_set_uposition(GTK_WIDGET(dialog), 100, 150); - - label = gtk_label_new(str); - gtk_widget_show(label); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), label, TRUE, TRUE, 0); - - button = gtk_button_new_with_label(GetString(STR_OK_BUTTON)); - gtk_widget_show(button); - gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(dl_quit), GTK_OBJECT(dialog)); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), button, FALSE, FALSE, 0); - GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); - gtk_widget_grab_default(button); - gtk_widget_show(dialog); -} - -// "Zap NVRAM" selected -static void mn_zap_pram(...) -{ - ZapPRAM(); -} - -// Menu item descriptions -static GtkItemFactoryEntry menu_items[] = { - {(gchar *)GetString(STR_PREFS_MENU_FILE_GTK), NULL, NULL, 0, ""}, - {(gchar *)GetString(STR_PREFS_ITEM_START_GTK), "S", GTK_SIGNAL_FUNC(cb_start), 0, NULL}, - {(gchar *)GetString(STR_PREFS_ITEM_ZAP_PRAM_GTK), NULL, GTK_SIGNAL_FUNC(mn_zap_pram), 0, NULL}, - {(gchar *)GetString(STR_PREFS_ITEM_SEPL_GTK), NULL, NULL, 0, ""}, - {(gchar *)GetString(STR_PREFS_ITEM_QUIT_GTK), "Q", GTK_SIGNAL_FUNC(cb_quit), 0, NULL}, - {(gchar *)GetString(STR_HELP_MENU_GTK), NULL, NULL, 0, ""}, - {(gchar *)GetString(STR_HELP_ITEM_ABOUT_GTK), NULL, GTK_SIGNAL_FUNC(mn_about), 0, NULL} -}; - -bool PrefsEditor(void) -{ - // Get screen dimensions - screen_width = gdk_screen_width(); - screen_height = gdk_screen_height(); - - // Create window - win = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_title(GTK_WINDOW(win), GetString(STR_PREFS_TITLE)); - gtk_signal_connect(GTK_OBJECT(win), "delete_event", GTK_SIGNAL_FUNC(window_closed), NULL); - gtk_signal_connect(GTK_OBJECT(win), "destroy", GTK_SIGNAL_FUNC(window_destroyed), NULL); - - // Create window contents - GtkWidget *box = gtk_vbox_new(FALSE, 4); - gtk_widget_show(box); - gtk_container_add(GTK_CONTAINER(win), box); - - GtkAccelGroup *accel_group = gtk_accel_group_new(); - GtkItemFactory *item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "

", accel_group); - gtk_item_factory_create_items(item_factory, sizeof(menu_items) / sizeof(menu_items[0]), menu_items, NULL); -#if GTK_CHECK_VERSION(1,3,15) - gtk_window_add_accel_group(GTK_WINDOW(win), accel_group); -#else - gtk_accel_group_attach(accel_group, GTK_OBJECT(win)); -#endif - GtkWidget *menu_bar = gtk_item_factory_get_widget(item_factory, "
"); - gtk_widget_show(menu_bar); - gtk_box_pack_start(GTK_BOX(box), menu_bar, FALSE, TRUE, 0); - - GtkWidget *notebook = gtk_notebook_new(); - gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_TOP); - gtk_notebook_set_scrollable(GTK_NOTEBOOK(notebook), FALSE); - gtk_box_pack_start(GTK_BOX(box), notebook, TRUE, TRUE, 0); - gtk_widget_realize(notebook); - - create_volumes_pane(notebook); - create_graphics_pane(notebook); - create_input_pane(notebook); - create_serial_pane(notebook); - create_memory_pane(notebook); - create_jit_pane(notebook); - gtk_widget_show(notebook); - - static const opt_desc buttons[] = { - {STR_START_BUTTON, GTK_SIGNAL_FUNC(cb_start)}, - {STR_QUIT_BUTTON, GTK_SIGNAL_FUNC(cb_quit)}, - {0, NULL} - }; - make_button_box(box, 4, buttons); - - // Show window and enter main loop - gtk_widget_show(win); - gtk_main(); - return start_clicked; -} - - -/* - * "Volumes" pane - */ - -static GtkWidget *volume_list, *w_extfs; -static int selected_volume; - -// Volume in list selected -static void cl_selected(GtkWidget *list, int row, int column) -{ - selected_volume = row; -} - -// Volume selected for addition -static void add_volume_ok(GtkWidget *button, file_req_assoc *assoc) -{ - gchar *file = (gchar *)gtk_file_selection_get_filename(GTK_FILE_SELECTION(assoc->req)); - gtk_clist_append(GTK_CLIST(volume_list), &file); - gtk_widget_destroy(assoc->req); - delete assoc; -} - -// Volume selected for creation -static void create_volume_ok(GtkWidget *button, file_req_assoc *assoc) -{ - gchar *file = (gchar *)gtk_file_selection_get_filename(GTK_FILE_SELECTION(assoc->req)); - - const gchar *str = gtk_entry_get_text(GTK_ENTRY(assoc->entry)); - int size = atoi(str); - - char cmd[1024]; - sprintf(cmd, "dd if=/dev/zero \"of=%s\" bs=1024k count=%d", file, size); - int ret = system(cmd); - if (ret == 0) - gtk_clist_append(GTK_CLIST(volume_list), &file); - gtk_widget_destroy(GTK_WIDGET(assoc->req)); - delete assoc; -} - -// "Add Volume" button clicked -static void cb_add_volume(...) -{ - GtkWidget *req = gtk_file_selection_new(GetString(STR_ADD_VOLUME_TITLE)); - gtk_signal_connect_object(GTK_OBJECT(req), "delete_event", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(req)); - gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(req)->ok_button), "clicked", GTK_SIGNAL_FUNC(add_volume_ok), new file_req_assoc(req, NULL)); - gtk_signal_connect_object(GTK_OBJECT(GTK_FILE_SELECTION(req)->cancel_button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(req)); - gtk_widget_show(req); -} - -// "Create Hardfile" button clicked -static void cb_create_volume(...) -{ - GtkWidget *req = gtk_file_selection_new(GetString(STR_CREATE_VOLUME_TITLE)); - - GtkWidget *box = gtk_hbox_new(FALSE, 4); - gtk_widget_show(box); - GtkWidget *label = gtk_label_new(GetString(STR_HARDFILE_SIZE_CTRL)); - gtk_widget_show(label); - GtkWidget *entry = gtk_entry_new(); - gtk_widget_show(entry); - char str[32]; - sprintf(str, "%d", 40); - gtk_entry_set_text(GTK_ENTRY(entry), str); - gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(box), entry, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(GTK_FILE_SELECTION(req)->main_vbox), box, FALSE, FALSE, 0); - - gtk_signal_connect_object(GTK_OBJECT(req), "delete_event", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(req)); - gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(req)->ok_button), "clicked", GTK_SIGNAL_FUNC(create_volume_ok), new file_req_assoc(req, entry)); - gtk_signal_connect_object(GTK_OBJECT(GTK_FILE_SELECTION(req)->cancel_button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(req)); - gtk_widget_show(req); -} - -// "Remove Volume" button clicked -static void cb_remove_volume(...) -{ - gtk_clist_remove(GTK_CLIST(volume_list), selected_volume); -} - -// "Boot From" selected -static void mn_boot_any(...) {PrefsReplaceInt32("bootdriver", 0);} -static void mn_boot_cdrom(...) {PrefsReplaceInt32("bootdriver", CDROMRefNum);} - -// "No CD-ROM Driver" button toggled -static void tb_nocdrom(GtkWidget *widget) -{ - PrefsReplaceBool("nocdrom", GTK_TOGGLE_BUTTON(widget)->active); -} - -// Read settings from widgets and set preferences -static void read_volumes_settings(void) -{ - while (PrefsFindString("disk")) - PrefsRemoveItem("disk"); - - for (int i=0; irows; i++) { - char *str; - gtk_clist_get_text(GTK_CLIST(volume_list), i, 0, &str); - PrefsAddString("disk", str); - } - - PrefsReplaceString("extfs", gtk_entry_get_text(GTK_ENTRY(w_extfs))); -} - -// Create "Volumes" pane -static void create_volumes_pane(GtkWidget *top) -{ - GtkWidget *box, *scroll, *menu; - - box = make_pane(top, STR_VOLUMES_PANE_TITLE); - - scroll = gtk_scrolled_window_new(NULL, NULL); - gtk_widget_show(scroll); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - volume_list = gtk_clist_new(1); - gtk_widget_show(volume_list); - gtk_clist_set_selection_mode(GTK_CLIST(volume_list), GTK_SELECTION_SINGLE); - gtk_clist_set_shadow_type(GTK_CLIST(volume_list), GTK_SHADOW_NONE); - gtk_clist_set_reorderable(GTK_CLIST(volume_list), true); - gtk_signal_connect(GTK_OBJECT(volume_list), "select_row", GTK_SIGNAL_FUNC(cl_selected), NULL); - char *str; - int32 index = 0; - while ((str = (char *)PrefsFindString("disk", index++)) != NULL) - gtk_clist_append(GTK_CLIST(volume_list), &str); - gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll), volume_list); - gtk_box_pack_start(GTK_BOX(box), scroll, TRUE, TRUE, 0); - selected_volume = 0; - - static const opt_desc buttons[] = { - {STR_ADD_VOLUME_BUTTON, GTK_SIGNAL_FUNC(cb_add_volume)}, - {STR_CREATE_VOLUME_BUTTON, GTK_SIGNAL_FUNC(cb_create_volume)}, - {STR_REMOVE_VOLUME_BUTTON, GTK_SIGNAL_FUNC(cb_remove_volume)}, - {0, NULL}, - }; - make_button_box(box, 0, buttons); - make_separator(box); - - w_extfs = make_entry(box, STR_EXTFS_CTRL, "extfs"); - - static const opt_desc options[] = { - {STR_BOOT_ANY_LAB, GTK_SIGNAL_FUNC(mn_boot_any)}, - {STR_BOOT_CDROM_LAB, GTK_SIGNAL_FUNC(mn_boot_cdrom)}, - {0, NULL} - }; - int bootdriver = PrefsFindInt32("bootdriver"), active = 0; - switch (bootdriver) { - case 0: active = 0; break; - case CDROMRefNum: active = 1; break; - } - menu = make_option_menu(box, STR_BOOTDRIVER_CTRL, options, active); - - make_checkbox(box, STR_NOCDROM_CTRL, "nocdrom", GTK_SIGNAL_FUNC(tb_nocdrom)); -} - - -/* - * "JIT Compiler" pane - */ - -// Are we running a JIT capable CPU? -static bool is_jit_capable(void) -{ -#if USE_JIT - return true; -#elif defined __APPLE__ && defined __MACH__ - // XXX run-time detect so that we can use a PPC GUI prefs editor - static char cpu[10]; - if (cpu[0] == 0) { - FILE *fp = popen("uname -p", "r"); - if (fp == NULL) - return false; - fgets(cpu, sizeof(cpu) - 1, fp); - fclose(fp); - } - if (cpu[0] == 'i' && cpu[2] == '8' && cpu[3] == '6') // XXX assuming i?86 - return true; -#endif - return false; -} - -// Set sensitivity of widgets -static void set_jit_sensitive(void) -{ - const bool jit_enabled = PrefsFindBool("jit"); -} - -// "Use JIT Compiler" button toggled -static void tb_jit(GtkWidget *widget) -{ - PrefsReplaceBool("jit", GTK_TOGGLE_BUTTON(widget)->active); - set_jit_sensitive(); -} - -// Read settings from widgets and set preferences -static void read_jit_settings(void) -{ - bool jit_enabled = is_jit_capable() && PrefsFindBool("jit"); -} - -// "Use built-in 68k DR emulator" button toggled -static void tb_jit_68k(GtkWidget *widget) -{ - PrefsReplaceBool("jit68k", GTK_TOGGLE_BUTTON(widget)->active); -} - -// Create "JIT Compiler" pane -static void create_jit_pane(GtkWidget *top) -{ - GtkWidget *box, *table, *label, *menu; - char str[32]; - - box = make_pane(top, STR_JIT_PANE_TITLE); - - if (is_jit_capable()) { - make_checkbox(box, STR_JIT_CTRL, "jit", GTK_SIGNAL_FUNC(tb_jit)); - set_jit_sensitive(); - } - - make_checkbox(box, STR_JIT_68K_CTRL, "jit68k", GTK_SIGNAL_FUNC(tb_jit_68k)); -} - - -/* - * "Graphics/Sound" pane - */ - -// Display types -enum { - DISPLAY_WINDOW, - DISPLAY_SCREEN -}; - -static GtkWidget *w_frameskip, *w_display_x, *w_display_y; -static GtkWidget *l_frameskip, *l_display_x, *l_display_y; -static int display_type; -static int dis_width, dis_height; -static bool is_fbdev_dga_mode = false; - -static GtkWidget *w_dspdevice_file, *w_mixerdevice_file; - -// Hide/show graphics widgets -static void hide_show_graphics_widgets(void) -{ - switch (display_type) { - case DISPLAY_WINDOW: - gtk_widget_show(w_frameskip); gtk_widget_show(l_frameskip); - break; - case DISPLAY_SCREEN: - gtk_widget_hide(w_frameskip); gtk_widget_hide(l_frameskip); - break; - } -} - -// "Window" video type selected -static void mn_window(...) -{ - display_type = DISPLAY_WINDOW; - hide_show_graphics_widgets(); -} - -// "Fullscreen" video type selected -static void mn_fullscreen(...) -{ - display_type = DISPLAY_SCREEN; - hide_show_graphics_widgets(); -} - -// "5 Hz".."60Hz" selected -static void mn_5hz(...) {PrefsReplaceInt32("frameskip", 12);} -static void mn_7hz(...) {PrefsReplaceInt32("frameskip", 8);} -static void mn_10hz(...) {PrefsReplaceInt32("frameskip", 6);} -static void mn_15hz(...) {PrefsReplaceInt32("frameskip", 4);} -static void mn_30hz(...) {PrefsReplaceInt32("frameskip", 2);} -static void mn_60hz(...) {PrefsReplaceInt32("frameskip", 1);} - -// QuickDraw acceleration -static void tb_gfxaccel(GtkWidget *widget) -{ - PrefsReplaceBool("gfxaccel", GTK_TOGGLE_BUTTON(widget)->active); -} - -// Set sensitivity of widgets -static void set_graphics_sensitive(void) -{ - const bool sound_enabled = !PrefsFindBool("nosound"); - gtk_widget_set_sensitive(w_dspdevice_file, sound_enabled); - gtk_widget_set_sensitive(w_mixerdevice_file, sound_enabled); -} - -// "Disable Sound Output" button toggled -static void tb_nosound(GtkWidget *widget) -{ - PrefsReplaceBool("nosound", GTK_TOGGLE_BUTTON(widget)->active); - set_graphics_sensitive(); -} - -// Read and convert graphics preferences -static void parse_graphics_prefs(void) -{ - display_type = DISPLAY_WINDOW; - dis_width = 640; - dis_height = 480; - - const char *str = PrefsFindString("screen"); - if (str) { - if (sscanf(str, "win/%d/%d", &dis_width, &dis_height) == 2) - display_type = DISPLAY_WINDOW; - else if (sscanf(str, "dga/%d/%d", &dis_width, &dis_height) == 2) - display_type = DISPLAY_SCREEN; -#ifdef ENABLE_FBDEV_DGA - else if (sscanf(str, "fbdev/%d/%d", &dis_width, &dis_height) == 2) { - is_fbdev_dga_mode = true; - display_type = DISPLAY_SCREEN; - } -#endif - } - else { - uint32 window_modes = PrefsFindInt32("windowmodes"); - uint32 screen_modes = PrefsFindInt32("screenmodes"); - if (screen_modes) { - display_type = DISPLAY_SCREEN; - static const struct { - int id; - int width; - int height; - } - modes[] = { - { 1, 640, 480 }, - { 2, 800, 600 }, - { 4, 1024, 768 }, - { 64, 1152, 768 }, - { 8, 1152, 900 }, - { 16, 1280, 1024 }, - { 32, 1600, 1200 }, - { 0, } - }; - for (int i = 0; modes[i].id != 0; i++) { - if (screen_modes & modes[i].id) { - if (modes[i].width <= screen_width && modes[i].height <= screen_height) { - dis_width = modes[i].width; - dis_height = modes[i].height; - } - } - } - } - else if (window_modes) { - display_type = DISPLAY_WINDOW; - if (window_modes & 1) - dis_width = 640, dis_height = 480; - if (window_modes & 2) - dis_width = 800, dis_height = 600; - } - } - if (dis_width == screen_width) - dis_width = 0; - if (dis_height == screen_height) - dis_height = 0; -} - -// Read settings from widgets and set preferences -static void read_graphics_settings(void) -{ - const char *str; - - str = gtk_entry_get_text(GTK_ENTRY(w_display_x)); - dis_width = atoi(str); - - str = gtk_entry_get_text(GTK_ENTRY(w_display_y)); - dis_height = atoi(str); - - char pref[256]; - bool use_screen_mode = true; - switch (display_type) { - case DISPLAY_WINDOW: - sprintf(pref, "win/%d/%d", dis_width, dis_height); - break; - case DISPLAY_SCREEN: - sprintf(pref, "dga/%d/%d", dis_width, dis_height); - break; - default: - use_screen_mode = false; - PrefsRemoveItem("screen"); - return; - } - if (use_screen_mode) { - PrefsReplaceString("screen", pref); - // Old prefs are now migrated - PrefsRemoveItem("windowmodes"); - PrefsRemoveItem("screenmodes"); - } - - PrefsReplaceString("dsp", get_file_entry_path(w_dspdevice_file)); - PrefsReplaceString("mixer", get_file_entry_path(w_mixerdevice_file)); -} - -// Create "Graphics/Sound" pane -static void create_graphics_pane(GtkWidget *top) -{ - GtkWidget *box, *table, *label, *opt, *menu, *combo; - char str[32]; - - parse_graphics_prefs(); - - box = make_pane(top, STR_GRAPHICS_SOUND_PANE_TITLE); - table = make_table(box, 2, 4); - - label = gtk_label_new(GetString(STR_VIDEO_TYPE_CTRL)); - gtk_widget_show(label); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); - - opt = gtk_option_menu_new(); - gtk_widget_show(opt); - menu = gtk_menu_new(); - add_menu_item(menu, STR_WINDOW_CTRL, GTK_SIGNAL_FUNC(mn_window)); - add_menu_item(menu, STR_FULLSCREEN_CTRL, GTK_SIGNAL_FUNC(mn_fullscreen)); - switch (display_type) { - case DISPLAY_WINDOW: - gtk_menu_set_active(GTK_MENU(menu), 0); - break; - case DISPLAY_SCREEN: - gtk_menu_set_active(GTK_MENU(menu), 1); - break; - } - gtk_option_menu_set_menu(GTK_OPTION_MENU(opt), menu); - gtk_table_attach(GTK_TABLE(table), opt, 1, 2, 0, 1, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4); - - l_frameskip = gtk_label_new(GetString(STR_FRAMESKIP_CTRL)); - gtk_widget_show(l_frameskip); - gtk_table_attach(GTK_TABLE(table), l_frameskip, 0, 1, 1, 2, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); - - w_frameskip = gtk_option_menu_new(); - gtk_widget_show(w_frameskip); - menu = gtk_menu_new(); - add_menu_item(menu, STR_REF_5HZ_LAB, GTK_SIGNAL_FUNC(mn_5hz)); - add_menu_item(menu, STR_REF_7_5HZ_LAB, GTK_SIGNAL_FUNC(mn_7hz)); - add_menu_item(menu, STR_REF_10HZ_LAB, GTK_SIGNAL_FUNC(mn_10hz)); - add_menu_item(menu, STR_REF_15HZ_LAB, GTK_SIGNAL_FUNC(mn_15hz)); - add_menu_item(menu, STR_REF_30HZ_LAB, GTK_SIGNAL_FUNC(mn_30hz)); - add_menu_item(menu, STR_REF_60HZ_LAB, GTK_SIGNAL_FUNC(mn_60hz)); - int frameskip = PrefsFindInt32("frameskip"); - int item = -1; - switch (frameskip) { - case 12: item = 0; break; - case 8: item = 1; break; - case 6: item = 2; break; - case 4: item = 3; break; - case 2: item = 4; break; - case 1: item = 5; break; - case 0: item = 5; break; - } - if (item >= 0) - gtk_menu_set_active(GTK_MENU(menu), item); - gtk_option_menu_set_menu(GTK_OPTION_MENU(w_frameskip), menu); - gtk_table_attach(GTK_TABLE(table), w_frameskip, 1, 2, 1, 2, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4); - - l_display_x = gtk_label_new(GetString(STR_DISPLAY_X_CTRL)); - gtk_widget_show(l_display_x); - gtk_table_attach(GTK_TABLE(table), l_display_x, 0, 1, 2, 3, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); - - combo = gtk_combo_new(); - gtk_widget_show(combo); - GList *glist1 = NULL; - glist1 = g_list_append(glist1, (void *)GetString(STR_SIZE_512_LAB)); - glist1 = g_list_append(glist1, (void *)GetString(STR_SIZE_640_LAB)); - glist1 = g_list_append(glist1, (void *)GetString(STR_SIZE_800_LAB)); - glist1 = g_list_append(glist1, (void *)GetString(STR_SIZE_1024_LAB)); - glist1 = g_list_append(glist1, (void *)GetString(STR_SIZE_MAX_LAB)); - gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist1); - if (dis_width) - sprintf(str, "%d", dis_width); - else - strcpy(str, GetString(STR_SIZE_MAX_LAB)); - gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str); - gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 2, 3, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4); - w_display_x = GTK_COMBO(combo)->entry; - - l_display_y = gtk_label_new(GetString(STR_DISPLAY_Y_CTRL)); - gtk_widget_show(l_display_y); - gtk_table_attach(GTK_TABLE(table), l_display_y, 0, 1, 3, 4, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); - - combo = gtk_combo_new(); - gtk_widget_show(combo); - GList *glist2 = NULL; - glist2 = g_list_append(glist2, (void *)GetString(STR_SIZE_384_LAB)); - glist2 = g_list_append(glist2, (void *)GetString(STR_SIZE_480_LAB)); - glist2 = g_list_append(glist2, (void *)GetString(STR_SIZE_600_LAB)); - glist2 = g_list_append(glist2, (void *)GetString(STR_SIZE_768_LAB)); - glist2 = g_list_append(glist2, (void *)GetString(STR_SIZE_MAX_LAB)); - gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist2); - if (dis_height) - sprintf(str, "%d", dis_height); - else - strcpy(str, GetString(STR_SIZE_MAX_LAB)); - gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str); - gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 3, 4, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4); - w_display_y = GTK_COMBO(combo)->entry; - - make_checkbox(box, STR_GFXACCEL_CTRL, PrefsFindBool("gfxaccel"), GTK_SIGNAL_FUNC(tb_gfxaccel)); - - make_separator(box); - make_checkbox(box, STR_NOSOUND_CTRL, "nosound", GTK_SIGNAL_FUNC(tb_nosound)); - w_dspdevice_file = make_entry(box, STR_DSPDEVICE_FILE_CTRL, "dsp"); - w_mixerdevice_file = make_entry(box, STR_MIXERDEVICE_FILE_CTRL, "mixer"); - - set_graphics_sensitive(); - - hide_show_graphics_widgets(); -} - - -/* - * "Input" pane - */ - -static GtkWidget *w_keycode_file; -static GtkWidget *w_mouse_wheel_lines; - -// Set sensitivity of widgets -static void set_input_sensitive(void) -{ - const bool use_keycodes = PrefsFindBool("keycodes"); - gtk_widget_set_sensitive(w_keycode_file, use_keycodes); - gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data(G_OBJECT(w_keycode_file), "chooser_button")), use_keycodes); - gtk_widget_set_sensitive(w_mouse_wheel_lines, PrefsFindInt32("mousewheelmode") == 1); -} - -// "Use Raw Keycodes" button toggled -static void tb_keycodes(GtkWidget *widget) -{ - PrefsReplaceBool("keycodes", GTK_TOGGLE_BUTTON(widget)->active); - set_input_sensitive(); -} - -// "Mouse Wheel Mode" selected -static void mn_wheel_page(...) {PrefsReplaceInt32("mousewheelmode", 0); set_input_sensitive();} -static void mn_wheel_cursor(...) {PrefsReplaceInt32("mousewheelmode", 1); set_input_sensitive();} - -// Read settings from widgets and set preferences -static void read_input_settings(void) -{ - const char *str = get_file_entry_path(w_keycode_file); - if (str && strlen(str)) - PrefsReplaceString("keycodefile", str); - else - PrefsRemoveItem("keycodefile"); - - PrefsReplaceInt32("mousewheellines", gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w_mouse_wheel_lines))); -} - -// Create "Input" pane -static void create_input_pane(GtkWidget *top) -{ - GtkWidget *box, *hbox, *menu, *label, *button; - GtkObject *adj; - - box = make_pane(top, STR_INPUT_PANE_TITLE); - - make_checkbox(box, STR_KEYCODES_CTRL, "keycodes", GTK_SIGNAL_FUNC(tb_keycodes)); - - hbox = gtk_hbox_new(FALSE, 4); - gtk_widget_show(hbox); - gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); - - label = gtk_label_new(GetString(STR_KEYCODES_CTRL)); - gtk_widget_show(label); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - - const char *str = PrefsFindString("keycodefile"); - if (str == NULL) - str = ""; - - w_keycode_file = gtk_entry_new(); - gtk_entry_set_text(GTK_ENTRY(w_keycode_file), str); - gtk_widget_show(w_keycode_file); - gtk_box_pack_start(GTK_BOX(hbox), w_keycode_file, TRUE, TRUE, 0); - - button = make_browse_button(w_keycode_file); - gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); - g_object_set_data(G_OBJECT(w_keycode_file), "chooser_button", button); - - make_separator(box); - - static const opt_desc options[] = { - {STR_MOUSEWHEELMODE_PAGE_LAB, GTK_SIGNAL_FUNC(mn_wheel_page)}, - {STR_MOUSEWHEELMODE_CURSOR_LAB, GTK_SIGNAL_FUNC(mn_wheel_cursor)}, - {0, NULL} - }; - int wheelmode = PrefsFindInt32("mousewheelmode"), active = 0; - switch (wheelmode) { - case 0: active = 0; break; - case 1: active = 1; break; - } - menu = make_option_menu(box, STR_MOUSEWHEELMODE_CTRL, options, active); - - hbox = gtk_hbox_new(FALSE, 4); - gtk_widget_show(hbox); - gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); - - label = gtk_label_new(GetString(STR_MOUSEWHEELLINES_CTRL)); - gtk_widget_show(label); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - - adj = gtk_adjustment_new(PrefsFindInt32("mousewheellines"), 1, 1000, 1, 5, 0); - w_mouse_wheel_lines = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 0.0, 0); - gtk_widget_show(w_mouse_wheel_lines); - gtk_box_pack_start(GTK_BOX(hbox), w_mouse_wheel_lines, FALSE, FALSE, 0); - - set_input_sensitive(); -} - - -/* - * "Serial/Network" pane - */ - -static GtkWidget *w_seriala, *w_serialb, *w_ether; - -// Read settings from widgets and set preferences -static void read_serial_settings(void) -{ - const char *str; - - str = gtk_entry_get_text(GTK_ENTRY(w_seriala)); - PrefsReplaceString("seriala", str); - - str = gtk_entry_get_text(GTK_ENTRY(w_serialb)); - PrefsReplaceString("serialb", str); - - str = gtk_entry_get_text(GTK_ENTRY(w_ether)); - if (str && strlen(str)) - PrefsReplaceString("ether", str); - else - PrefsRemoveItem("ether"); -} - -// Add names of serial devices -static gint gl_str_cmp(gconstpointer a, gconstpointer b) -{ - return strcmp((char *)a, (char *)b); -} - -static GList *add_serial_names(void) -{ - GList *glist = NULL; - - // Search /dev for ttyS* and lp* - DIR *d = opendir("/dev"); - if (d) { - struct dirent *de; - while ((de = readdir(d)) != NULL) { -#if defined(__linux__) - if (strncmp(de->d_name, "ttyS", 4) == 0 || strncmp(de->d_name, "lp", 2) == 0) { -#elif defined(__FreeBSD__) - if (strncmp(de->d_name, "cuaa", 4) == 0 || strncmp(de->d_name, "lpt", 3) == 0) { -#elif defined(__NetBSD__) - if (strncmp(de->d_name, "tty0", 4) == 0 || strncmp(de->d_name, "lpt", 3) == 0) { -#elif defined(sgi) - if (strncmp(de->d_name, "ttyf", 4) == 0 || strncmp(de->d_name, "plp", 3) == 0) { -#else - if (false) { -#endif - char *str = new char[64]; - sprintf(str, "/dev/%s", de->d_name); - glist = g_list_append(glist, str); - } - } - closedir(d); - } - if (glist) - g_list_sort(glist, gl_str_cmp); - else - glist = g_list_append(glist, (void *)""); - return glist; -} - -// Add names of ethernet interfaces -static GList *add_ether_names(void) -{ - GList *glist = NULL; - - // Get list of all Ethernet interfaces - int s = socket(PF_INET, SOCK_DGRAM, 0); - if (s >= 0) { - char inbuf[8192]; - struct ifconf ifc; - ifc.ifc_len = sizeof(inbuf); - ifc.ifc_buf = inbuf; - if (ioctl(s, SIOCGIFCONF, &ifc) == 0) { - struct ifreq req, *ifr = ifc.ifc_req; - for (int i=0; iifr_name, 63); - glist = g_list_append(glist, str); - } - } - } - close(s); - } -#ifdef HAVE_SLIRP - static char s_slirp[] = "slirp"; - glist = g_list_append(glist, s_slirp); -#endif - if (glist) - g_list_sort(glist, gl_str_cmp); - else - glist = g_list_append(glist, (void *)""); - return glist; -} - -// Create "Serial/Network" pane -static void create_serial_pane(GtkWidget *top) -{ - GtkWidget *box, *table, *label, *combo; - GList *glist = add_serial_names(); - - box = make_pane(top, STR_SERIAL_NETWORK_PANE_TITLE); - table = make_table(box, 2, 3); - - label = gtk_label_new(GetString(STR_SERPORTA_CTRL)); - gtk_widget_show(label); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); - - combo = gtk_combo_new(); - gtk_widget_show(combo); - gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist); - const char *str = PrefsFindString("seriala"); - if (str == NULL) - str = ""; - gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str); - gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 0, 1, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4); - w_seriala = GTK_COMBO(combo)->entry; - - label = gtk_label_new(GetString(STR_SERPORTB_CTRL)); - gtk_widget_show(label); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); - - combo = gtk_combo_new(); - gtk_widget_show(combo); - gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist); - str = PrefsFindString("serialb"); - if (str == NULL) - str = ""; - gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str); - gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 1, 2, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4); - w_serialb = GTK_COMBO(combo)->entry; - - label = gtk_label_new(GetString(STR_ETHERNET_IF_CTRL)); - gtk_widget_show(label); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); - - glist = add_ether_names(); - combo = gtk_combo_new(); - gtk_widget_show(combo); - gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist); - str = PrefsFindString("ether"); - if (str == NULL) - str = ""; - gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str); - gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 2, 3, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4); - w_ether = GTK_COMBO(combo)->entry; -} - - -/* - * "Memory/Misc" pane - */ - -static GtkWidget *w_ramsize; -static GtkWidget *w_rom_file; - -// Don't use CPU when idle? -static void tb_idlewait(GtkWidget *widget) -{ - PrefsReplaceBool("idlewait", GTK_TOGGLE_BUTTON(widget)->active); -} - -// "Ignore SEGV" button toggled -static void tb_ignoresegv(GtkWidget *widget) -{ - PrefsReplaceBool("ignoresegv", GTK_TOGGLE_BUTTON(widget)->active); -} - -// Read settings from widgets and set preferences -static void read_memory_settings(void) -{ - const char *str = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(w_ramsize)->entry)); - PrefsReplaceInt32("ramsize", atoi(str) << 20); - - str = gtk_entry_get_text(GTK_ENTRY(w_rom_file)); - if (str && strlen(str)) - PrefsReplaceString("rom", str); - else - PrefsRemoveItem("rom"); -} - -// Create "Memory/Misc" pane -static void create_memory_pane(GtkWidget *top) -{ - GtkWidget *box, *hbox, *table, *label, *menu; - - box = make_pane(top, STR_MEMORY_MISC_PANE_TITLE); - table = make_table(box, 2, 5); - - static const combo_desc options[] = { - STR_RAMSIZE_4MB_LAB, - STR_RAMSIZE_8MB_LAB, - STR_RAMSIZE_16MB_LAB, - STR_RAMSIZE_32MB_LAB, - STR_RAMSIZE_64MB_LAB, - STR_RAMSIZE_128MB_LAB, - STR_RAMSIZE_256MB_LAB, - STR_RAMSIZE_512MB_LAB, - STR_RAMSIZE_1024MB_LAB, - 0 - }; - char default_ramsize[16]; - sprintf(default_ramsize, "%d", PrefsFindInt32("ramsize") >> 20); - w_ramsize = table_make_combobox(table, 0, STR_RAMSIZE_CTRL, default_ramsize, options); - - w_rom_file = table_make_file_entry(table, 1, STR_ROM_FILE_CTRL, "rom"); - - make_checkbox(box, STR_IGNORESEGV_CTRL, "ignoresegv", GTK_SIGNAL_FUNC(tb_ignoresegv)); - make_checkbox(box, STR_IDLEWAIT_CTRL, "idlewait", GTK_SIGNAL_FUNC(tb_idlewait)); -} - - -/* - * Read settings from widgets and set preferences - */ - -static void read_settings(void) -{ - read_volumes_settings(); - read_graphics_settings(); - read_input_settings(); - read_serial_settings(); - read_memory_settings(); - read_jit_settings(); -} - - -#ifdef STANDALONE_GUI -#include -#include -#include "rpc.h" - -/* - * Fake unused data and functions - */ - -uint8 XPRAM[XPRAM_SIZE]; -void MountVolume(void *fh) { } -void FileDiskLayout(loff_t size, uint8 *data, loff_t &start_byte, loff_t &real_size) { } - -#if defined __APPLE__ && defined __MACH__ -void DarwinSysInit(void) { } -void DarwinSysExit(void) { } -void DarwinAddFloppyPrefs(void) { } -void DarwinAddSerialPrefs(void) { } -bool DarwinCDReadTOC(char *, uint8 *) { } -#endif - - -/* - * Display alert - */ - -static void dl_destroyed(void) -{ - gtk_main_quit(); -} - -static void display_alert(int title_id, int prefix_id, int button_id, const char *text) -{ - char str[256]; - sprintf(str, GetString(prefix_id), text); - - GtkWidget *dialog = gtk_dialog_new(); - gtk_window_set_title(GTK_WINDOW(dialog), GetString(title_id)); - gtk_container_border_width(GTK_CONTAINER(dialog), 5); - gtk_widget_set_uposition(GTK_WIDGET(dialog), 100, 150); - gtk_signal_connect(GTK_OBJECT(dialog), "destroy", GTK_SIGNAL_FUNC(dl_destroyed), NULL); - - GtkWidget *label = gtk_label_new(str); - gtk_widget_show(label); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), label, TRUE, TRUE, 0); - - GtkWidget *button = gtk_button_new_with_label(GetString(button_id)); - gtk_widget_show(button); - gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(dl_quit), GTK_OBJECT(dialog)); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), button, FALSE, FALSE, 0); - GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); - gtk_widget_grab_default(button); - gtk_widget_show(dialog); - - gtk_main(); -} - - -/* - * Display error alert - */ - -void ErrorAlert(const char *text) -{ - display_alert(STR_ERROR_ALERT_TITLE, STR_GUI_ERROR_PREFIX, STR_QUIT_BUTTON, text); -} - - -/* - * Display warning alert - */ - -void WarningAlert(const char *text) -{ - display_alert(STR_WARNING_ALERT_TITLE, STR_GUI_WARNING_PREFIX, STR_OK_BUTTON, text); -} - - -/* - * RPC handlers - */ - -static GMainLoop *g_gui_loop; - -static int handle_ErrorAlert(rpc_connection_t *connection) -{ - D(bug("handle_ErrorAlert\n")); - - int error; - char *str; - if ((error = rpc_method_get_args(connection, RPC_TYPE_STRING, &str, RPC_TYPE_INVALID)) < 0) - return error; - - ErrorAlert(str); - free(str); - return RPC_ERROR_NO_ERROR; -} - -static int handle_WarningAlert(rpc_connection_t *connection) -{ - D(bug("handle_WarningAlert\n")); - - int error; - char *str; - if ((error = rpc_method_get_args(connection, RPC_TYPE_STRING, &str, RPC_TYPE_INVALID)) < 0) - return error; - - WarningAlert(str); - free(str); - return RPC_ERROR_NO_ERROR; -} - -static int handle_Exit(rpc_connection_t *connection) -{ - D(bug("handle_Exit\n")); - - g_main_quit(g_gui_loop); - return RPC_ERROR_NO_ERROR; -} - - -/* - * SIGCHLD handler - */ - -static char g_app_path[PATH_MAX]; -static rpc_connection_t *g_gui_connection = NULL; - -static void sigchld_handler(int sig, siginfo_t *sip, void *) -{ - D(bug("Child %d exitted with status = %x\n", sip->si_pid, sip->si_status)); - - // XXX perform a new wait because sip->si_status is sometimes not - // the exit _value_ on MacOS X but rather the usual status field - // from waitpid() -- we could arrange this code in some other way... - int status; - if (waitpid(sip->si_pid, &status, 0) < 0) - status = sip->si_status; - if (WIFEXITED(status)) - status = WEXITSTATUS(status); - if (status & 0x80) - status |= -1 ^0xff; - - if (status < 0) { // negative -> execlp/-errno - char str[256]; - sprintf(str, GetString(STR_NO_B2_EXE_FOUND), g_app_path, strerror(-status)); - ErrorAlert(str); - status = 1; - } - - if (status != 0) { - if (g_gui_connection) - rpc_exit(g_gui_connection); - exit(status); - } -} - - -/* - * Start standalone GUI - */ - -int main(int argc, char *argv[]) -{ - // Init GTK - gtk_set_locale(); - gtk_init(&argc, &argv); - - // Read preferences - PrefsInit(0, argc, argv); - - // Show preferences editor - bool start = PrefsEditor(); - - // Exit preferences - PrefsExit(); - - // Transfer control to the executable - if (start) { - char gui_connection_path[64]; - sprintf(gui_connection_path, "/org/SheepShaver/GUI/%d", getpid()); - - // Catch exits from the child process - struct sigaction sigchld_sa, old_sigchld_sa; - sigemptyset(&sigchld_sa.sa_mask); - sigchld_sa.sa_sigaction = sigchld_handler; - sigchld_sa.sa_flags = SA_NOCLDSTOP | SA_SIGINFO; - if (sigaction(SIGCHLD, &sigchld_sa, &old_sigchld_sa) < 0) { - char str[256]; - sprintf(str, GetString(STR_SIG_INSTALL_ERR), SIGCHLD, strerror(errno)); - ErrorAlert(str); - return 1; - } - - // Search and run the SheepShaver executable - char *p; - strcpy(g_app_path, argv[0]); - if ((p = strstr(g_app_path, "SheepShaverGUI.app/Contents/MacOS")) != NULL) { - strcpy(p, "SheepShaver.app/Contents/MacOS/SheepShaver"); - if (access(g_app_path, X_OK) < 0) { - char str[256]; - sprintf(str, GetString(STR_NO_B2_EXE_FOUND), g_app_path, strerror(errno)); - WarningAlert(str); - strcpy(g_app_path, "/Applications/SheepShaver.app/Contents/MacOS/SheepShaver"); - } - } else { - p = strrchr(g_app_path, '/'); - p = p ? p + 1 : g_app_path; - strcpy(p, "SheepShaver"); - } - - int pid = fork(); - if (pid == 0) { - D(bug("Trying to execute %s\n", g_app_path)); - execlp(g_app_path, g_app_path, "--gui-connection", gui_connection_path, (char *)NULL); -#ifdef _POSIX_PRIORITY_SCHEDULING - // XXX get a chance to run the parent process so that to not confuse/upset GTK... - sched_yield(); -#endif - _exit(-errno); - } - - // Establish a connection to Basilisk II - if ((g_gui_connection = rpc_init_server(gui_connection_path)) == NULL) { - printf("ERROR: failed to initialize GUI-side RPC server connection\n"); - return 1; - } - static const rpc_method_descriptor_t vtable[] = { - { RPC_METHOD_ERROR_ALERT, handle_ErrorAlert }, - { RPC_METHOD_WARNING_ALERT, handle_WarningAlert }, - { RPC_METHOD_EXIT, handle_Exit } - }; - if (rpc_method_add_callbacks(g_gui_connection, vtable, sizeof(vtable) / sizeof(vtable[0])) < 0) { - printf("ERROR: failed to setup GUI method callbacks\n"); - return 1; - } - int socket; - if ((socket = rpc_listen_socket(g_gui_connection)) < 0) { - printf("ERROR: failed to initialize RPC server thread\n"); - return 1; - } - - g_gui_loop = g_main_new(TRUE); - while (g_main_is_running(g_gui_loop)) { - - // Process a few events pending - const int N_EVENTS_DISPATCH = 10; - for (int i = 0; i < N_EVENTS_DISPATCH; i++) { - if (!g_main_iteration(FALSE)) - break; - } - - // Check for RPC events (100 ms timeout) - int ret = rpc_wait_dispatch(g_gui_connection, 100000); - if (ret == 0) - continue; - if (ret < 0) - break; - rpc_dispatch(g_gui_connection); - } - - rpc_exit(g_gui_connection); - return 0; - } - - return 0; -} -#endif diff --git a/SheepShaver/src/Unix/prefs_unix.cpp b/SheepShaver/src/Unix/prefs_unix.cpp deleted file mode 100644 index 7f89a107..00000000 --- a/SheepShaver/src/Unix/prefs_unix.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* - * prefs_unix.cpp - Preferences handling, Unix specific things - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" - -#include -#include -#include - -#include "prefs.h" - - -// Platform-specific preferences items -prefs_desc platform_prefs_items[] = { - {"ether", TYPE_STRING, false, "device name of Mac ethernet adapter"}, - {"etherconfig", TYPE_STRING, false, "path of network config script"}, - {"keycodes", TYPE_BOOLEAN, false, "use keycodes rather than keysyms to decode keyboard"}, - {"keycodefile", TYPE_STRING, false, "path of keycode translation file"}, - {"mousewheelmode", TYPE_INT32, false, "mouse wheel support mode (0=page up/down, 1=cursor up/down)"}, - {"mousewheellines", TYPE_INT32, false, "number of lines to scroll in mouse wheel mode 1"}, - {"dsp", TYPE_STRING, false, "audio output (dsp) device name"}, - {"mixer", TYPE_STRING, false, "audio mixer device name"}, -#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION - {"ignoresegv", TYPE_BOOLEAN, false, "ignore illegal memory accesses"}, -#endif - {"idlewait", TYPE_BOOLEAN, false, "sleep when idle"}, - {NULL, TYPE_END, false, NULL} // End of list -}; - - -// Prefs file name and path -const char PREFS_FILE_NAME[] = ".sheepshaver_prefs"; -static char prefs_path[1024]; - - -/* - * Load preferences from settings file - */ - -void LoadPrefs(const char *vmdir) -{ - if (vmdir) { - snprintf(prefs_path, sizeof(prefs_path), "%s/prefs", vmdir); - FILE *prefs = fopen(prefs_path, "r"); - if (!prefs) { - printf("No file at %s found.\n", prefs_path); - exit(1); - } - LoadPrefsFromStream(prefs); - fclose(prefs); - return; - } - - // Construct prefs path - prefs_path[0] = 0; - char *home = getenv("HOME"); - if (home != NULL && strlen(home) < 1000) { - strncpy(prefs_path, home, 1000); - strcat(prefs_path, "/"); - } - strcat(prefs_path, PREFS_FILE_NAME); - - // Read preferences from settings file - FILE *f = fopen(prefs_path, "r"); - if (f != NULL) { - - // Prefs file found, load settings - LoadPrefsFromStream(f); - fclose(f); - - } else { - - // No prefs file, save defaults - SavePrefs(); - } -} - - -/* - * Save preferences to settings file - */ - -void SavePrefs(void) -{ - FILE *f; - if ((f = fopen(prefs_path, "w")) != NULL) { - SavePrefsToStream(f); - fclose(f); - } -} - - -/* - * Add defaults of platform-specific prefs items - * You may also override the defaults set in PrefsInit() - */ - -void AddPlatformPrefsDefaults(void) -{ - PrefsAddBool("keycodes", false); - PrefsReplaceString("extfs", "/"); - PrefsReplaceInt32("mousewheelmode", 1); - PrefsReplaceInt32("mousewheellines", 3); -#ifdef __linux__ - if (access("/dev/sound/dsp", F_OK) == 0) { - PrefsReplaceString("dsp", "/dev/sound/dsp"); - } else { - PrefsReplaceString("dsp", "/dev/dsp"); - } - if (access("/dev/sound/mixer", F_OK) == 0) { - PrefsReplaceString("mixer", "/dev/sound/mixer"); - } else { - PrefsReplaceString("mixer", "/dev/mixer"); - } -#else - PrefsReplaceString("dsp", "/dev/dsp"); - PrefsReplaceString("mixer", "/dev/mixer"); -#endif -#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION - PrefsAddBool("ignoresegv", false); -#endif - PrefsAddBool("idlewait", true); -} diff --git a/SheepShaver/src/Unix/rpc.h b/SheepShaver/src/Unix/rpc.h deleted file mode 120000 index 98cf8a08..00000000 --- a/SheepShaver/src/Unix/rpc.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/rpc.h \ No newline at end of file diff --git a/SheepShaver/src/Unix/rpc_unix.cpp b/SheepShaver/src/Unix/rpc_unix.cpp deleted file mode 120000 index a960f0b7..00000000 --- a/SheepShaver/src/Unix/rpc_unix.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/rpc_unix.cpp \ No newline at end of file diff --git a/SheepShaver/src/Unix/semaphore.h b/SheepShaver/src/Unix/semaphore.h deleted file mode 120000 index 9e87a545..00000000 --- a/SheepShaver/src/Unix/semaphore.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/semaphore.h \ No newline at end of file diff --git a/SheepShaver/src/Unix/serial_unix.cpp b/SheepShaver/src/Unix/serial_unix.cpp deleted file mode 120000 index ccda34be..00000000 --- a/SheepShaver/src/Unix/serial_unix.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/serial_unix.cpp \ No newline at end of file diff --git a/SheepShaver/src/Unix/sigregs.h b/SheepShaver/src/Unix/sigregs.h deleted file mode 100644 index 44fd9117..00000000 --- a/SheepShaver/src/Unix/sigregs.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * sigregs.h - Extract machine registers from a signal frame - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef SIGREGS_H -#define SIGREGS_H - -#ifndef EMULATED_PPC - -// Common representation of machine registers -struct sigregs { - uint32 nip; - uint32 link; - uint32 ctr; - uint32 msr; - uint32 xer; - uint32 ccr; - uint32 gpr[32]; -}; - -// Extract machine registers from Linux signal frame -#if defined(__linux__) -#include -#define MACHINE_REGISTERS(scp) ((machine_regs *)(((ucontext_t *)scp)->uc_mcontext.regs)) - -struct machine_regs : public pt_regs -{ - u_long & cr() { return pt_regs::ccr; } - uint32 cr() const { return pt_regs::ccr; } - uint32 lr() const { return pt_regs::link; } - uint32 ctr() const { return pt_regs::ctr; } - uint32 xer() const { return pt_regs::xer; } - uint32 msr() const { return pt_regs::msr; } - uint32 dar() const { return pt_regs::dar; } - u_long & pc() { return pt_regs::nip; } - uint32 pc() const { return pt_regs::nip; } - u_long & gpr(int i) { return pt_regs::gpr[i]; } - uint32 gpr(int i) const { return pt_regs::gpr[i]; } -}; -#endif - -// Extract machine registers from NetBSD signal frame -#if defined(__NetBSD__) -#include -#define MACHINE_REGISTERS(scp) ((machine_regs *)&(((ucontext_t *)scp)->uc_mcontext)) - -struct machine_regs : public mcontext_t -{ - long & cr() { return __gregs[_REG_CR]; } - uint32 cr() const { return __gregs[_REG_CR]; } - uint32 lr() const { return __gregs[_REG_LR]; } - uint32 ctr() const { return __gregs[_REG_CTR]; } - uint32 xer() const { return __gregs[_REG_XER]; } - uint32 msr() const { return __gregs[_REG_MSR]; } - uint32 dar() const { return (uint32)(((siginfo_t *)(((unsigned long)this) - offsetof(ucontext_t, uc_mcontext))) - 1)->si_addr; } /* HACK */ - long & pc() { return __gregs[_REG_PC]; } - uint32 pc() const { return __gregs[_REG_PC]; } - long & gpr(int i) { return __gregs[_REG_R0 + i]; } - uint32 gpr(int i) const { return __gregs[_REG_R0 + i]; } -}; -#endif - -// Extract machine registers from Darwin signal frame -#if defined(__APPLE__) && defined(__MACH__) -#include - -#define MACHINE_REGISTERS(scp) ((machine_regs *)(((ucontext_t *)scp)->uc_mcontext)) - -#if __DARWIN_UNIX03 -#define __(x) __CONCAT(__,x) -#else -#define __(x) x -#endif - -#include - -#if __DARWIN_UNIX03 -struct machine_regs : public __darwin_mcontext -#else -struct machine_regs : public mcontext -#endif -{ - uint32 & cr() { return __(ss).__(cr); } - uint32 cr() const { return __(ss).__(cr); } - uint32 lr() const { return __(ss).__(lr); } - uint32 ctr() const { return __(ss).__(ctr); } - uint32 xer() const { return __(ss).__(xer); } - uint32 msr() const { return __(ss).__(srr1); } - uint32 dar() const { return __(es).__(dar); } - uint32 & pc() { return __(ss).__(srr0); } - uint32 pc() const { return __(ss).__(srr0); } - uint32 & gpr(int i) { return (&__(ss).__(r0))[i]; } - uint32 gpr(int i) const { return (&__(ss).__(r0))[i]; } -}; -#endif - -// Convert system-dependent machine registers to generic sigregs -static void build_sigregs(sigregs *srp, machine_regs *mrp) -{ - srp->nip = mrp->pc(); - srp->link = mrp->lr(); - srp->ctr = mrp->ctr(); - srp->msr = mrp->msr(); - srp->xer = mrp->xer(); - srp->ccr = mrp->cr(); - for (int i = 0; i < 32; i++) - srp->gpr[i] = mrp->gpr(i); -} - -#endif - -#endif /* SIGREGS_H */ diff --git a/SheepShaver/src/Unix/sshpty.c b/SheepShaver/src/Unix/sshpty.c deleted file mode 120000 index ffaa2bfc..00000000 --- a/SheepShaver/src/Unix/sshpty.c +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/sshpty.c \ No newline at end of file diff --git a/SheepShaver/src/Unix/sshpty.h b/SheepShaver/src/Unix/sshpty.h deleted file mode 120000 index 9132736a..00000000 --- a/SheepShaver/src/Unix/sshpty.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/sshpty.h \ No newline at end of file diff --git a/SheepShaver/src/Unix/strlcpy.c b/SheepShaver/src/Unix/strlcpy.c deleted file mode 120000 index 59e61670..00000000 --- a/SheepShaver/src/Unix/strlcpy.c +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/strlcpy.c \ No newline at end of file diff --git a/SheepShaver/src/Unix/strlcpy.h b/SheepShaver/src/Unix/strlcpy.h deleted file mode 120000 index 1c551aac..00000000 --- a/SheepShaver/src/Unix/strlcpy.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/strlcpy.h \ No newline at end of file diff --git a/SheepShaver/src/Unix/sys_unix.cpp b/SheepShaver/src/Unix/sys_unix.cpp deleted file mode 120000 index e5769e8d..00000000 --- a/SheepShaver/src/Unix/sys_unix.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/sys_unix.cpp \ No newline at end of file diff --git a/SheepShaver/src/Unix/sysdeps.h b/SheepShaver/src/Unix/sysdeps.h deleted file mode 100644 index 0099527b..00000000 --- a/SheepShaver/src/Unix/sysdeps.h +++ /dev/null @@ -1,491 +0,0 @@ -/* - * sysdeps.h - System dependent definitions for Linux - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef SYSDEPS_H -#define SYSDEPS_H - -#ifndef __STDC__ -#error "Your compiler is not ANSI. Get a real one." -#endif - -#include "config.h" -#include "user_strings_unix.h" - -#ifndef STDC_HEADERS -#error "You don't have ANSI C header files." -#endif - -#ifdef HAVE_UNISTD_H -# include -# include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#ifdef HAVE_PTHREADS -# include -#endif - -#ifdef HAVE_FCNTL_H -# include -#endif - -#ifdef TIME_WITH_SYS_TIME -# include -# include -#else -# ifdef HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - -#ifdef __MACH__ -#include -#endif - -// Fix offsetof() on FreeBSD and GCC >= 3.4 -#if defined(__FreeBSD__) && defined(__cplusplus) && __GNUC__ < 4 -#undef offsetof -/* The cast to "char &" below avoids problems with user-defined - "operator &", which can appear in a POD type. */ -#define offsetof(TYPE, MEMBER) \ - (__offsetof__ (reinterpret_cast \ - (&reinterpret_cast \ - (static_cast (0)->MEMBER)))) -#endif - -// Define for external components -#define SHEEPSHAVER 1 - -// Always use Real Addressing mode on native architectures -// Otherwise, use Direct Addressing mode if NATMEM_OFFSET is set -#if !defined(EMULATED_PPC) -#define REAL_ADDRESSING 1 -#include "ppc_asm.tmpl" -#elif defined(NATMEM_OFFSET) -#define DIRECT_ADDRESSING 1 -#else -#define REAL_ADDRESSING 1 -#endif - -// Always use the complete non-stubs Ethernet driver -#define USE_ETHER_FULL_DRIVER 1 - -#define POWERPC_ROM 1 - -#if EMULATED_PPC -// Mac ROM is write protected when banked memory is used -#if REAL_ADDRESSING || DIRECT_ADDRESSING -# define ROM_IS_WRITE_PROTECTED 0 -# define USE_SCRATCHMEM_SUBTERFUGE 1 -#else -# define ROM_IS_WRITE_PROTECTED 1 -#endif -// Configure PowerPC emulator -#define PPC_REENTRANT_JIT 1 -#define PPC_CHECK_INTERRUPTS 1 -#define PPC_DECODE_CACHE 1 -#define PPC_FLIGHT_RECORDER 1 -#define PPC_PROFILE_COMPILE_TIME 0 -#define PPC_PROFILE_GENERIC_CALLS 0 -#define PPC_PROFILE_REGS_USE 0 -#define KPX_MAX_CPUS 1 -#if ENABLE_DYNGEN -#define PPC_ENABLE_JIT 1 -#endif -#if defined(__i386__) || defined(__x86_64__) -#define DYNGEN_ASM_OPTS 1 -#endif -#else -// Mac ROM is write protected -#define ROM_IS_WRITE_PROTECTED 1 -#define USE_SCRATCHMEM_SUBTERFUGE 0 -#endif - -// Data types -typedef unsigned char uint8; -typedef signed char int8; -#if SIZEOF_SHORT == 2 -typedef unsigned short uint16; -typedef short int16; -#elif SIZEOF_INT == 2 -typedef unsigned int uint16; -typedef int int16; -#else -#error "No 2 byte type, you lose." -#endif -#if SIZEOF_INT == 4 -typedef unsigned int uint32; -typedef int int32; -#elif SIZEOF_LONG == 4 -typedef unsigned long uint32; -typedef long int32; -#else -#error "No 4 byte type, you lose." -#endif -#if SIZEOF_LONG == 8 -typedef unsigned long uint64; -typedef long int64; -#define VAL64(a) (a ## l) -#define UVAL64(a) (a ## ul) -#elif SIZEOF_LONG_LONG == 8 -typedef unsigned long long uint64; -typedef long long int64; -#define VAL64(a) (a ## LL) -#define UVAL64(a) (a ## uLL) -#else -#error "No 8 byte type, you lose." -#endif -#if SIZEOF_VOID_P == 4 -typedef uint32 uintptr; -typedef int32 intptr; -#elif SIZEOF_VOID_P == 8 -typedef uint64 uintptr; -typedef int64 intptr; -#else -#error "Unsupported size of pointer" -#endif - -// Define if the host processor supports fast unaligned load/stores -#if defined __i386__ || defined __x86_64__ -#define UNALIGNED_PROFITABLE 1 -#endif - - -/** - * Helper functions to byteswap data - **/ - -#if defined(__GNUC__) -#if defined(__x86_64__) || defined(__i386__) -// Linux/AMD64 currently has no asm optimized bswap_32() in -#define opt_bswap_32 do_opt_bswap_32 -static inline uint32 do_opt_bswap_32(uint32 x) -{ - uint32 v; - __asm__ __volatile__ ("bswap %0" : "=r" (v) : "0" (x)); - return v; -} -#endif -#endif - -#ifdef HAVE_BYTESWAP_H -#include -#endif - -#ifdef opt_bswap_16 -#undef bswap_16 -#define bswap_16 opt_bswap_16 -#endif -#ifndef bswap_16 -#define bswap_16 generic_bswap_16 -#endif - -static inline uint16 generic_bswap_16(uint16 x) -{ - return ((x & 0xff) << 8) | ((x >> 8) & 0xff); -} - -#ifdef opt_bswap_32 -#undef bswap_32 -#define bswap_32 opt_bswap_32 -#endif -#ifndef bswap_32 -#define bswap_32 generic_bswap_32 -#endif - -static inline uint32 generic_bswap_32(uint32 x) -{ - return (((x & 0xff000000) >> 24) | - ((x & 0x00ff0000) >> 8) | - ((x & 0x0000ff00) << 8) | - ((x & 0x000000ff) << 24) ); -} - -#if defined(__i386__) -#define opt_bswap_64 do_opt_bswap_64 -static inline uint64 do_opt_bswap_64(uint64 x) -{ - return (bswap_32(x >> 32) | (((uint64)bswap_32((uint32)x)) << 32)); -} -#endif - -#ifdef opt_bswap_64 -#undef bswap_64 -#define bswap_64 opt_bswap_64 -#endif -#ifndef bswap_64 -#define bswap_64 generic_bswap_64 -#endif - -static inline uint64 generic_bswap_64(uint64 x) -{ - return (((x & UVAL64(0xff00000000000000)) >> 56) | - ((x & UVAL64(0x00ff000000000000)) >> 40) | - ((x & UVAL64(0x0000ff0000000000)) >> 24) | - ((x & UVAL64(0x000000ff00000000)) >> 8) | - ((x & UVAL64(0x00000000ff000000)) << 8) | - ((x & UVAL64(0x0000000000ff0000)) << 24) | - ((x & UVAL64(0x000000000000ff00)) << 40) | - ((x & UVAL64(0x00000000000000ff)) << 56) ); -} - -#ifdef WORDS_BIGENDIAN -static inline uint16 tswap16(uint16 x) { return x; } -static inline uint32 tswap32(uint32 x) { return x; } -static inline uint64 tswap64(uint64 x) { return x; } -#else -static inline uint16 tswap16(uint16 x) { return bswap_16(x); } -static inline uint32 tswap32(uint32 x) { return bswap_32(x); } -static inline uint64 tswap64(uint64 x) { return bswap_64(x); } -#endif - -// spin locks -#ifdef __GNUC__ - -#if defined(__powerpc__) || defined(__ppc__) -#define HAVE_TEST_AND_SET 1 -static inline int testandset(volatile int *p) -{ - int ret; - __asm__ __volatile__("0: lwarx %0,0,%1\n" - " xor. %0,%3,%0\n" - " bne 1f\n" - " stwcx. %2,0,%1\n" - " bne- 0b\n" - "1: " - : "=&r" (ret) - : "r" (p), "r" (1), "r" (0) - : "cr0", "memory"); - return ret; -} -#endif - -#if defined(__i386__) || defined(__x86_64__) -#define HAVE_TEST_AND_SET 1 -static inline int testandset(volatile int *p) -{ - long int ret; - /* Note: the "xchg" instruction does not need a "lock" prefix */ - __asm__ __volatile__("xchgl %k0, %1" - : "=r" (ret), "=m" (*p) - : "0" (1), "m" (*p) - : "memory"); - return ret; -} -#endif - -#ifdef __s390__ -#define HAVE_TEST_AND_SET 1 -static inline int testandset(volatile int *p) -{ - int ret; - - __asm__ __volatile__("0: cs %0,%1,0(%2)\n" - " jl 0b" - : "=&d" (ret) - : "r" (1), "a" (p), "0" (*p) - : "cc", "memory" ); - return ret; -} -#endif - -#ifdef __alpha__ -#define HAVE_TEST_AND_SET 1 -static inline int testandset(volatile int *p) -{ - int ret; - unsigned long one; - - __asm__ __volatile__("0: mov 1,%2\n" - " ldl_l %0,%1\n" - " stl_c %2,%1\n" - " beq %2,1f\n" - ".subsection 2\n" - "1: br 0b\n" - ".previous" - : "=r" (ret), "=m" (*p), "=r" (one) - : "m" (*p)); - return ret; -} -#endif - -#ifdef __sparc__ -#define HAVE_TEST_AND_SET 1 -static inline int testandset(volatile int *p) -{ - int ret; - - __asm__ __volatile__("ldstub [%1], %0" - : "=r" (ret) - : "r" (p) - : "memory"); - - return (ret ? 1 : 0); -} -#endif - -#ifdef __arm__ -#define HAVE_TEST_AND_SET 1 -static inline int testandset(volatile int *p) -{ - register unsigned int ret; - __asm__ __volatile__("swp %0, %1, [%2]" - : "=r"(ret) - : "0"(1), "r"(p)); - - return ret; -} -#endif - -#endif /* __GNUC__ */ - -typedef volatile int spinlock_t; - -static const spinlock_t SPIN_LOCK_UNLOCKED = 0; - -#if defined(HAVE_TEST_AND_SET) && defined(HAVE_PTHREADS) -// There is nothing to lock if we are not in an multithreaded environment -#define HAVE_SPINLOCKS 1 -static inline void spin_lock(spinlock_t *lock) -{ - while (testandset(lock)); -} - -static inline void spin_unlock(spinlock_t *lock) -{ - *lock = 0; -} - -static inline int spin_trylock(spinlock_t *lock) -{ - return !testandset(lock); -} -#else -static inline void spin_lock(spinlock_t *lock) -{ -} - -static inline void spin_unlock(spinlock_t *lock) -{ -} - -static inline int spin_trylock(spinlock_t *lock) -{ - return 1; -} -#endif - -// Time data type for Time Manager emulation -#ifdef HAVE_CLOCK_GETTIME -typedef struct timespec tm_time_t; -#elif defined(__MACH__) -typedef mach_timespec_t tm_time_t; -#else -typedef struct timeval tm_time_t; -#endif - -/* Define codes for all the float formats that we know of. - * Though we only handle IEEE format. */ -#define UNKNOWN_FLOAT_FORMAT 0 -#define IEEE_FLOAT_FORMAT 1 -#define VAX_FLOAT_FORMAT 2 -#define IBM_FLOAT_FORMAT 3 -#define C4X_FLOAT_FORMAT 4 - -// High-precision timing -#if defined(HAVE_PTHREADS) && defined(HAVE_CLOCK_NANOSLEEP) -#define PRECISE_TIMING 1 -#define PRECISE_TIMING_POSIX 1 -#elif defined(HAVE_PTHREADS) && defined(__MACH__) -#define PRECISE_TIMING 1 -#define PRECISE_TIMING_MACH 1 -#endif - -// Timing functions -extern uint64 GetTicks_usec(void); -extern void Delay_usec(uint32 usec); - -#ifdef HAVE_PTHREADS -// Setup pthread attributes -extern void Set_pthread_attr(pthread_attr_t *attr, int priority); -#endif - -// Various definitions -typedef struct rgb_color { - uint8 red; - uint8 green; - uint8 blue; - uint8 alpha; -} rgb_color; - -// X11 display fast locks -#if defined(HAVE_PTHREADS) -#define X11_LOCK_TYPE pthread_mutex_t -#define X11_LOCK_INIT PTHREAD_MUTEX_INITIALIZER -#define XDisplayLock() pthread_mutex_lock(&x_display_lock); -#define XDisplayUnlock() pthread_mutex_unlock(&x_display_lock); -#elif defined(HAVE_SPINLOCKS) -#define X11_LOCK_TYPE spinlock_t -#define X11_LOCK_INIT SPIN_LOCK_UNLOCKED -#define XDisplayLock() spin_lock(&x_display_lock) -#define XDisplayUnlock() spin_unlock(&x_display_lock) -#else -#define XDisplayLock() -#define XDisplayUnlock() -#endif -#ifdef X11_LOCK_TYPE -extern X11_LOCK_TYPE x_display_lock; -#endif - -// Macro for calling MacOS routines -#define CallMacOS(type, tvect) call_macos((uintptr)tvect) -#define CallMacOS1(type, tvect, arg1) call_macos1((uintptr)tvect, (uintptr)arg1) -#define CallMacOS2(type, tvect, arg1, arg2) call_macos2((uintptr)tvect, (uintptr)arg1, (uintptr)arg2) -#define CallMacOS3(type, tvect, arg1, arg2, arg3) call_macos3((uintptr)tvect, (uintptr)arg1, (uintptr)arg2, (uintptr)arg3) -#define CallMacOS4(type, tvect, arg1, arg2, arg3, arg4) call_macos4((uintptr)tvect, (uintptr)arg1, (uintptr)arg2, (uintptr)arg3, (uintptr)arg4) -#define CallMacOS5(type, tvect, arg1, arg2, arg3, arg4, arg5) call_macos5((uintptr)tvect, (uintptr)arg1, (uintptr)arg2, (uintptr)arg3, (uintptr)arg4, (uintptr)arg5) -#define CallMacOS6(type, tvect, arg1, arg2, arg3, arg4, arg5, arg6) call_macos6((uintptr)tvect, (uintptr)arg1, (uintptr)arg2, (uintptr)arg3, (uintptr)arg4, (uintptr)arg5, (uintptr)arg6) -#define CallMacOS7(type, tvect, arg1, arg2, arg3, arg4, arg5, arg6, arg7) call_macos7((uintptr)tvect, (uintptr)arg1, (uintptr)arg2, (uintptr)arg3, (uintptr)arg4, (uintptr)arg5, (uintptr)arg6, (uintptr)arg7) - -#ifdef __cplusplus -extern "C" { -#endif -extern uint32 call_macos(uint32 tvect); -extern uint32 call_macos1(uint32 tvect, uint32 arg1); -extern uint32 call_macos2(uint32 tvect, uint32 arg1, uint32 arg2); -extern uint32 call_macos3(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3); -extern uint32 call_macos4(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4); -extern uint32 call_macos5(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5); -extern uint32 call_macos6(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5, uint32 arg6); -extern uint32 call_macos7(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5, uint32 arg6, uint32 arg7); -#ifdef __cplusplus -} -#endif - -#endif diff --git a/SheepShaver/src/Unix/timer_unix.cpp b/SheepShaver/src/Unix/timer_unix.cpp deleted file mode 120000 index db93bbd3..00000000 --- a/SheepShaver/src/Unix/timer_unix.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/timer_unix.cpp \ No newline at end of file diff --git a/SheepShaver/src/Unix/tinyxml2.cpp b/SheepShaver/src/Unix/tinyxml2.cpp deleted file mode 120000 index 0609bdc8..00000000 --- a/SheepShaver/src/Unix/tinyxml2.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/tinyxml2.cpp \ No newline at end of file diff --git a/SheepShaver/src/Unix/tinyxml2.h b/SheepShaver/src/Unix/tinyxml2.h deleted file mode 120000 index d90c30e2..00000000 --- a/SheepShaver/src/Unix/tinyxml2.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/tinyxml2.h \ No newline at end of file diff --git a/SheepShaver/src/Unix/tunconfig b/SheepShaver/src/Unix/tunconfig deleted file mode 120000 index 615f7fe9..00000000 --- a/SheepShaver/src/Unix/tunconfig +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/tunconfig \ No newline at end of file diff --git a/SheepShaver/src/Unix/user_strings_unix.cpp b/SheepShaver/src/Unix/user_strings_unix.cpp deleted file mode 100644 index 5a3b21f5..00000000 --- a/SheepShaver/src/Unix/user_strings_unix.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * user_strings_unix.cpp - Localizable strings, Unix specific strings - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" -#include "user_strings.h" - - -// Platform-specific string definitions -user_string_def platform_strings[] = { - // Common strings that have a platform-specific variant - {STR_VOLUME_IS_MOUNTED_WARN, "The volume '%s' is mounted under Linux. Basilisk II will try to unmount it."}, - {STR_EXTFS_CTRL, "Unix Root"}, - {STR_EXTFS_NAME, "Unix Directory Tree"}, - {STR_EXTFS_VOLUME_NAME, "Unix"}, - - // Purely platform-specific strings - {STR_NO_DEV_ZERO_ERR, "Cannot open /dev/zero: %s."}, - {STR_LOW_MEM_MMAP_ERR, "Cannot map Low Memory Globals: %s."}, - {STR_KD_SHMGET_ERR, "Cannot create SHM segment for Kernel Data: %s."}, - {STR_KD_SHMAT_ERR, "Cannot map first Kernel Data area: %s."}, - {STR_KD2_SHMAT_ERR, "Cannot map second Kernel Data area: %s."}, - {STR_ROM_MMAP_ERR, "Cannot map ROM: %s."}, - {STR_RAM_MMAP_ERR, "Cannot map RAM: %s."}, - {STR_RAM_ROM_MMAP_ERR, "Cannot map area for RAM and ROM: %s."}, - {STR_RAM_AREA_TOO_HIGH_ERR, "Cannot map usable RAM area. Try to decrease the MacOS RAM size."}, - {STR_DR_CACHE_MMAP_ERR, "Cannot map DR Cache: %s."}, - {STR_DR_EMULATOR_MMAP_ERR, "Cannot map DR Emulator: %s."}, - {STR_SHEEP_MEM_MMAP_ERR, "Cannot map SheepShaver Data area: %s."}, - {STR_SIGALTSTACK_ERR, "Cannot install alternate signal stack (%s). It seems that you need a newer kernel."}, - {STR_SIG_INSTALL_ERR, "Cannot install %s handler (%s)."}, - {STR_NO_XSERVER_ERR, "Cannot connect to X server %s."}, - {STR_NO_XVISUAL_ERR, "Cannot obtain appropriate X visual."}, - {STR_UNSUPP_DEPTH_ERR, "Unsupported color depth of screen."}, - {STR_PROC_CPUINFO_WARN, "Cannot open /proc/cpuinfo (%s). Assuming 100MHz PowerPC 604."}, - {STR_BLOCKING_NET_SOCKET_WARN, "Cannot set non-blocking I/O to net socket (%s). Ethernet will not be available."}, - {STR_NO_SHEEP_NET_DRIVER_WARN, "Cannot open %s (%s). Ethernet will not be available."}, - {STR_SHEEP_NET_ATTACH_WARN, "Cannot attach to Ethernet card (%s). Ethernet will not be available."}, - {STR_TUN_TAP_CONFIG_WARN, "Cannot configure TUN/TAP device (%s). Ethernet will not be available."}, - {STR_SLIRP_NO_DNS_FOUND_WARN, "Cannot get DNS address. Ethernet will not be available."}, - {STR_NO_AUDIO_DEV_WARN, "Cannot open %s (%s). Audio output will be disabled."}, - {STR_NO_AUDIO_WARN, "No audio device found, audio output will be disabled."}, - {STR_NO_ESD_WARN, "Cannot open ESD connection. Audio output will be disabled."}, - {STR_AUDIO_FORMAT_WARN, "/dev/dsp doesn't support signed 16 bit format. Audio output will be disabled."}, - {STR_SCSI_DEVICE_OPEN_WARN, "Cannot open %s (%s). SCSI Manager access to this device will be disabled."}, - {STR_SCSI_DEVICE_NOT_SCSI_WARN, "%s doesn't seem to comply to the Generic SCSI API. SCSI Manager access to this device will be disabled."}, - {STR_KEYCODE_FILE_WARN, "Cannot open keycode translation file %s (%s)."}, - {STR_KEYCODE_VENDOR_WARN, "Cannot find vendor '%s' in keycode translation file %s."}, - {STR_PREFS_MENU_FILE_GTK, "/_File"}, - {STR_PREFS_ITEM_START_GTK, "/File/_Start SheepShaver"}, - {STR_PREFS_ITEM_ZAP_PRAM_GTK, "/File/_Zap PRAM File"}, - {STR_PREFS_ITEM_SEPL_GTK, "/File/sepl"}, - {STR_PREFS_ITEM_QUIT_GTK, "/File/_Quit SheepShaver"}, - {STR_HELP_MENU_GTK, "/_Help"}, - {STR_HELP_ITEM_ABOUT_GTK, "/Help/_About SheepShaver"}, - {STR_DSPDEVICE_FILE_CTRL, "Audio Output Device"}, - {STR_MIXERDEVICE_FILE_CTRL, "Audio Mixer Device"}, - {STR_BROWSE_TITLE, "Browse file"}, - {STR_BROWSE_CTRL, "Browse..."}, - {STR_INPUT_PANE_TITLE, "Keyboard/Mouse"}, - {STR_KEYCODES_CTRL, "Use Raw Keycodes"}, - {STR_KEYCODE_FILE_CTRL, "Keycode Translation File"}, - {STR_MOUSEWHEELMODE_CTRL, "Mouse Wheel Function"}, - {STR_MOUSEWHEELMODE_PAGE_LAB, "Page Up/Down"}, - {STR_MOUSEWHEELMODE_CURSOR_LAB, "Cursor Up/Down"}, - {STR_MOUSEWHEELLINES_CTRL, "Lines To Scroll"}, - {STR_SUSPEND_WINDOW_TITLE, "SheepShaver suspended. Press Space to reactivate."}, - {STR_VOSF_INIT_ERR, "Cannot initialize Video on SEGV signals."}, - - {STR_OPEN_WINDOW_ERR, "Cannot open Mac window."}, - {STR_WINDOW_TITLE_GRABBED, "SheepShaver (mouse grabbed, press Ctrl-F5 to release)"}, - - {STR_NO_B2_EXE_FOUND, "Could not start %s (%s)."}, - - {-1, NULL} // End marker -}; - - -/* - * Fetch pointer to string, given the string number - */ - -const char *GetString(int num) -{ - // First search for platform-specific string - int i = 0; - while (platform_strings[i].num >= 0) { - if (platform_strings[i].num == num) - return platform_strings[i].str; - i++; - } - - // Not found, search for common string - i = 0; - while (common_strings[i].num >= 0) { - if (common_strings[i].num == num) - return common_strings[i].str; - i++; - } - return NULL; -} diff --git a/SheepShaver/src/Unix/user_strings_unix.h b/SheepShaver/src/Unix/user_strings_unix.h deleted file mode 100644 index be9ea0bb..00000000 --- a/SheepShaver/src/Unix/user_strings_unix.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * user_strings_unix.h - Unix-specific localizable strings - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef USER_STRINGS_LINUX_H -#define USER_STRINGS_LINUX_H - -enum { - STR_NO_DEV_ZERO_ERR = 10000, - STR_LOW_MEM_MMAP_ERR, - STR_KD_SHMGET_ERR, - STR_KD_SHMAT_ERR, - STR_KD2_SHMAT_ERR, - STR_ROM_MMAP_ERR, - STR_RAM_MMAP_ERR, - STR_RAM_ROM_MMAP_ERR, - STR_RAM_AREA_TOO_HIGH_ERR, - STR_DR_CACHE_MMAP_ERR, - STR_DR_EMULATOR_MMAP_ERR, - STR_SHEEP_MEM_MMAP_ERR, - STR_SIGALTSTACK_ERR, - STR_SIG_INSTALL_ERR, - STR_NO_XSERVER_ERR, - STR_NO_XVISUAL_ERR, - STR_UNSUPP_DEPTH_ERR, - STR_VOSF_INIT_ERR, - - STR_PROC_CPUINFO_WARN, - STR_BLOCKING_NET_SOCKET_WARN, - STR_NO_SHEEP_NET_DRIVER_WARN, - STR_SHEEP_NET_ATTACH_WARN, - STR_TUN_TAP_CONFIG_WARN, - STR_SLIRP_NO_DNS_FOUND_WARN, - STR_NO_AUDIO_DEV_WARN, - STR_NO_AUDIO_WARN, - STR_NO_ESD_WARN, - STR_AUDIO_FORMAT_WARN, - STR_SCSI_DEVICE_OPEN_WARN, - STR_SCSI_DEVICE_NOT_SCSI_WARN, - STR_KEYCODE_FILE_WARN, - STR_KEYCODE_VENDOR_WARN, - - STR_PREFS_MENU_FILE_GTK, - STR_PREFS_ITEM_START_GTK, - STR_PREFS_ITEM_ZAP_PRAM_GTK, - STR_PREFS_ITEM_SEPL_GTK, - STR_PREFS_ITEM_QUIT_GTK, - STR_HELP_MENU_GTK, - STR_HELP_ITEM_ABOUT_GTK, - STR_SUSPEND_WINDOW_TITLE, - STR_DSPDEVICE_FILE_CTRL, - STR_MIXERDEVICE_FILE_CTRL, - - STR_BROWSE_CTRL, - STR_BROWSE_TITLE, - STR_INPUT_PANE_TITLE, - STR_KEYCODES_CTRL, - STR_KEYCODE_FILE_CTRL, - STR_MOUSEWHEELMODE_CTRL, - STR_MOUSEWHEELMODE_PAGE_LAB, - STR_MOUSEWHEELMODE_CURSOR_LAB, - STR_MOUSEWHEELLINES_CTRL, - - STR_OPEN_WINDOW_ERR, - STR_WINDOW_TITLE_GRABBED, - - STR_NO_B2_EXE_FOUND -}; - -#endif diff --git a/SheepShaver/src/Unix/vhd_unix.cpp b/SheepShaver/src/Unix/vhd_unix.cpp deleted file mode 120000 index a0c73d90..00000000 --- a/SheepShaver/src/Unix/vhd_unix.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/vhd_unix.cpp \ No newline at end of file diff --git a/SheepShaver/src/Unix/video_x.cpp b/SheepShaver/src/Unix/video_x.cpp deleted file mode 100644 index f7374740..00000000 --- a/SheepShaver/src/Unix/video_x.cpp +++ /dev/null @@ -1,2584 +0,0 @@ -/* - * video_x.cpp - Video/graphics emulation, X11 specific stuff - * - * SheepShaver (C) Marc Hellwig and Christian Bauer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NOTES: - * The Ctrl key works like a qualifier for special actions: - * Ctrl-Tab = suspend DGA mode - * Ctrl-Esc = emergency quit - * Ctrl-F1 = mount floppy - * Ctrl-F5 = grab mouse (in windowed mode) - */ - -#include "sysdeps.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#ifdef ENABLE_FBDEV_DGA -# include -# include -#endif - -#ifdef ENABLE_XF86_DGA -# include -#endif - -#ifdef ENABLE_XF86_VIDMODE -# include -#endif - -#ifdef ENABLE_FBDEV_DGA -# include -#endif - -#include "main.h" -#include "adb.h" -#include "prefs.h" -#include "user_strings.h" -#include "about_window.h" -#include "video.h" -#include "video_defs.h" -#include "video_blit.h" - -#define DEBUG 0 -#include "debug.h" - -#ifndef NO_STD_NAMESPACE -using std::sort; -#endif - - -// Constants -const char KEYCODE_FILE_NAME[] = DATADIR "/keycodes"; -static const bool hw_mac_cursor_accl = true; // Flag: Enable MacOS to X11 copy of cursor? - -// Global variables -static int32 frame_skip; -static int16 mouse_wheel_mode; -static int16 mouse_wheel_lines; -static bool redraw_thread_active = false; // Flag: Redraw thread installed -static pthread_attr_t redraw_thread_attr; // Redraw thread attributes -static volatile bool redraw_thread_cancel; // Flag: Cancel Redraw thread -static pthread_t redraw_thread; // Redraw thread - -static volatile bool thread_stop_req = false; -static sem_t thread_stop_ack; -static sem_t thread_resume_req; - -static bool local_X11; // Flag: X server running on local machine? -static bool has_dga = false; // Flag: Video DGA capable -static bool has_vidmode = false; // Flag: VidMode extension available - -#ifdef ENABLE_VOSF -static bool use_vosf = true; // Flag: VOSF enabled -#else -static const bool use_vosf = false; // VOSF not possible -#endif - -static bool palette_changed = false; // Flag: Palette changed, redraw thread must update palette -static bool ctrl_down = false; // Flag: Ctrl key pressed -static bool caps_on = false; // Flag: Caps Lock on -static bool quit_full_screen = false; // Flag: DGA close requested from redraw thread -static volatile bool quit_full_screen_ack = false; // Acknowledge for quit_full_screen -static bool emerg_quit = false; // Flag: Ctrl-Esc pressed, emergency quit requested from MacOS thread - -static bool emul_suspended = false; // Flag: emulator suspended -static Window suspend_win; // "Suspend" window -static void *fb_save = NULL; // Saved frame buffer for suspend -static bool use_keycodes = false; // Flag: Use keycodes rather than keysyms -static int keycode_table[256]; // X keycode -> Mac keycode translation table - -// X11 variables -static int screen; // Screen number -static int xdepth; // Depth of X screen -static int depth; // Depth of Mac frame buffer -static Window rootwin, the_win; // Root window and our window -static int num_depths = 0; // Number of available X depths -static int *avail_depths = NULL; // List of available X depths -static VisualFormat visualFormat; -static XVisualInfo visualInfo; -static Visual *vis; -static int color_class; -static int rshift, rloss, gshift, gloss, bshift, bloss; // Pixel format of DirectColor/TrueColor modes -static Colormap cmap[2]; // Two colormaps (DGA) for 8-bit mode -static XColor x_palette[256]; // Color palette to be used as CLUT and gamma table -static int orig_accel_numer, orig_accel_denom, orig_threshold; // Original mouse acceleration - -static XColor black, white; -static unsigned long black_pixel, white_pixel; -static int eventmask; -static const int win_eventmask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask | EnterWindowMask | ExposureMask | StructureNotifyMask; -static const int dga_eventmask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask; - -// Variables for window mode -static GC the_gc; -static XImage *img = NULL; -static XShmSegmentInfo shminfo; -static XImage *cursor_image, *cursor_mask_image; -static Pixmap cursor_map, cursor_mask_map; -static Cursor mac_cursor; -static GC cursor_gc, cursor_mask_gc; -static bool cursor_changed = false; // Flag: Cursor changed, window_func must update cursor -static bool have_shm = false; // Flag: SHM present and usable -static uint8 *the_buffer = NULL; // Pointer to Mac frame buffer -static uint8 *the_buffer_copy = NULL; // Copy of Mac frame buffer -static uint32 the_buffer_size; // Size of allocated the_buffer - -// Variables for DGA mode -static bool is_fbdev_dga_mode = false; // Flag: Use FBDev DGA mode? -static int current_dga_cmap; - -#ifdef ENABLE_FBDEV_DGA -static int fb_dev_fd = -1; // Handle to fb device name -static struct fb_fix_screeninfo fb_finfo; // Fixed info -static struct fb_var_screeninfo fb_vinfo; // Variable info -static struct fb_var_screeninfo fb_orig_vinfo; // Variable info to restore later -static struct fb_cmap fb_oldcmap; // Colormap to restore later -#endif - -#ifdef ENABLE_XF86_VIDMODE -// Variables for XF86 VidMode support -static XF86VidModeModeInfo **x_video_modes; // Array of all available modes -static int num_x_video_modes; -#endif - -// Mutex to protect palette -#if defined(HAVE_PTHREADS) -static pthread_mutex_t x_palette_lock = PTHREAD_MUTEX_INITIALIZER; -#define LOCK_PALETTE pthread_mutex_lock(&x_palette_lock) -#define UNLOCK_PALETTE pthread_mutex_unlock(&x_palette_lock) -#elif defined(HAVE_SPINLOCKS) -static spinlock_t x_palette_lock = SPIN_LOCK_UNLOCKED; -#define LOCK_PALETTE spin_lock(&x_palette_lock) -#define UNLOCK_PALETTE spin_unlock(&x_palette_lock) -#else -#define LOCK_PALETTE -#define UNLOCK_PALETTE -#endif - -// Mutex to protect frame buffer -#if defined(HAVE_PTHREADS) -static pthread_mutex_t frame_buffer_lock = PTHREAD_MUTEX_INITIALIZER; -#define LOCK_FRAME_BUFFER pthread_mutex_lock(&frame_buffer_lock); -#define UNLOCK_FRAME_BUFFER pthread_mutex_unlock(&frame_buffer_lock); -#elif defined(HAVE_SPINLOCKS) -static spinlock_t frame_buffer_lock = SPIN_LOCK_UNLOCKED; -#define LOCK_FRAME_BUFFER spin_lock(&frame_buffer_lock) -#define UNLOCK_FRAME_BUFFER spin_unlock(&frame_buffer_lock) -#else -#define LOCK_FRAME_BUFFER -#define UNLOCK_FRAME_BUFFER -#endif - - -// Prototypes -static void *redraw_func(void *arg); - - -// From main_unix.cpp -extern char *x_display_name; -extern Display *x_display; - -// From sys_unix.cpp -extern void SysMountFirstFloppy(void); - -// From clip_unix.cpp -extern void ClipboardSelectionClear(XSelectionClearEvent *); -extern void ClipboardSelectionRequest(XSelectionRequestEvent *); - - -// Video acceleration through SIGSEGV -#ifdef ENABLE_VOSF -# include "video_vosf.h" -#endif - - -/* - * Utility functions - */ - -// Get current video mode -static inline int get_current_mode(void) -{ - return VModes[cur_mode].viAppleMode; -} - -// Find palette size for given color depth -static int palette_size(int mode) -{ - switch (mode) { - case APPLE_1_BIT: return 2; - case APPLE_2_BIT: return 4; - case APPLE_4_BIT: return 16; - case APPLE_8_BIT: return 256; - case APPLE_16_BIT: return 32; - case APPLE_32_BIT: return 256; - default: return 0; - } -} - -// Return bits per pixel for requested depth -static inline int bytes_per_pixel(int depth) -{ - int bpp; - switch (depth) { - case 8: - bpp = 1; - break; - case 15: case 16: - bpp = 2; - break; - case 24: case 32: - bpp = 4; - break; - default: - abort(); - } - return bpp; -} - -// Map video_mode depth ID to numerical depth value -static inline int depth_of_video_mode(int mode) -{ - int depth; - switch (mode) { - case APPLE_1_BIT: - depth = 1; - break; - case APPLE_2_BIT: - depth = 2; - break; - case APPLE_4_BIT: - depth = 4; - break; - case APPLE_8_BIT: - depth = 8; - break; - case APPLE_16_BIT: - depth = 16; - break; - case APPLE_32_BIT: - depth = 32; - break; - default: - abort(); - } - return depth; -} - -// Map RGB color to pixel value (this only works in TrueColor/DirectColor visuals) -static inline uint32 map_rgb(uint8 red, uint8 green, uint8 blue) -{ - return ((red >> rloss) << rshift) | ((green >> gloss) << gshift) | ((blue >> bloss) << bshift); -} - - -// Do we have a visual for handling the specified Mac depth? If so, set the -// global variables "xdepth", "visualInfo", "vis" and "color_class". -static bool find_visual_for_depth(int depth) -{ - D(bug("have_visual_for_depth(%d)\n", depth_of_video_mode(depth))); - - // 1-bit works always and uses default visual - if (depth == APPLE_1_BIT) { - vis = DefaultVisual(x_display, screen); - visualInfo.visualid = XVisualIDFromVisual(vis); - int num = 0; - XVisualInfo *vi = XGetVisualInfo(x_display, VisualIDMask, &visualInfo, &num); - visualInfo = vi[0]; - XFree(vi); - xdepth = visualInfo.depth; - color_class = visualInfo.c_class; - D(bug(" found visual ID 0x%02x, depth %d\n", visualInfo.visualid, xdepth)); - return true; - } - - // Calculate minimum and maximum supported X depth - int min_depth = 1, max_depth = 32; - switch (depth) { -#ifdef ENABLE_VOSF - case APPLE_2_BIT: - case APPLE_4_BIT: // VOSF blitters can convert 2/4/8-bit -> 8/16/32-bit - case APPLE_8_BIT: - min_depth = 8; - max_depth = 32; - break; -#else - case APPLE_2_BIT: - case APPLE_4_BIT: // 2/4-bit requires VOSF blitters - return false; - case APPLE_8_BIT: // 8-bit without VOSF requires an 8-bit visual - min_depth = 8; - max_depth = 8; - break; -#endif - case APPLE_16_BIT: // 16-bit requires a 15/16-bit visual - min_depth = 15; - max_depth = 16; - break; - case APPLE_32_BIT: // 32-bit requires a 24/32-bit visual - min_depth = 24; - max_depth = 32; - break; - } - D(bug(" minimum required X depth is %d, maximum supported X depth is %d\n", min_depth, max_depth)); - - // Try to find a visual for one of the color depths - bool visual_found = false; - for (int i=0; i max_depth) - continue; - - // Determine best color class for this depth - switch (xdepth) { - case 1: // Try StaticGray or StaticColor - if (XMatchVisualInfo(x_display, screen, xdepth, StaticGray, &visualInfo) - || XMatchVisualInfo(x_display, screen, xdepth, StaticColor, &visualInfo)) - visual_found = true; - break; - case 8: // Need PseudoColor - if (XMatchVisualInfo(x_display, screen, xdepth, PseudoColor, &visualInfo)) - visual_found = true; - break; - case 15: - case 16: - case 24: - case 32: // Try DirectColor first, as this will allow gamma correction - if (XMatchVisualInfo(x_display, screen, xdepth, DirectColor, &visualInfo) - || XMatchVisualInfo(x_display, screen, xdepth, TrueColor, &visualInfo)) - visual_found = true; - break; - default: - D(bug(" not a supported depth\n")); - break; - } - } - if (!visual_found) - return false; - - // Visual was found - vis = visualInfo.visual; - color_class = visualInfo.c_class; - D(bug(" found visual ID 0x%02x, depth %d, class ", visualInfo.visualid, xdepth)); -#if DEBUG - switch (color_class) { - case StaticGray: D(bug("StaticGray\n")); break; - case GrayScale: D(bug("GrayScale\n")); break; - case StaticColor: D(bug("StaticColor\n")); break; - case PseudoColor: D(bug("PseudoColor\n")); break; - case TrueColor: D(bug("TrueColor\n")); break; - case DirectColor: D(bug("DirectColor\n")); break; - } -#endif - return true; -} - - -/* - * Open display (window or fullscreen) - */ - -// Set window name and class -static void set_window_name(Window w, int name) -{ - const char *str = GetString(name); - XStoreName(x_display, w, str); - XSetIconName(x_display, w, str); - - XClassHint *hints; - hints = XAllocClassHint(); - if (hints) { - hints->res_name = "SheepShaver"; - hints->res_class = "SheepShaver"; - XSetClassHint(x_display, w, hints); - XFree(hints); - } -} - -// Set window input focus flag -static void set_window_focus(Window w) -{ - XWMHints *hints = XAllocWMHints(); - if (hints) { - hints->input = True; - hints->initial_state = NormalState; - hints->flags = InputHint | StateHint; - XSetWMHints(x_display, w, hints); - XFree(hints); - } -} - -// Set WM_DELETE_WINDOW protocol on window (preventing it from being destroyed by the WM when clicking on the "close" widget) -static Atom WM_DELETE_WINDOW = (Atom)0; -static void set_window_delete_protocol(Window w) -{ - WM_DELETE_WINDOW = XInternAtom(x_display, "WM_DELETE_WINDOW", false); - XSetWMProtocols(x_display, w, &WM_DELETE_WINDOW, 1); -} - -// Wait until window is mapped/unmapped -static void wait_mapped(Window w) -{ - XEvent e; - do { - XMaskEvent(x_display, StructureNotifyMask, &e); - } while ((e.type != MapNotify) || (e.xmap.event != w)); -} - -static void wait_unmapped(Window w) -{ - XEvent e; - do { - XMaskEvent(x_display, StructureNotifyMask, &e); - } while ((e.type != UnmapNotify) || (e.xmap.event != w)); -} - -// Disable mouse acceleration -static void disable_mouse_accel(void) -{ - XChangePointerControl(x_display, True, False, 1, 1, 0); -} - -// Restore mouse acceleration to original value -static void restore_mouse_accel(void) -{ - XChangePointerControl(x_display, True, True, orig_accel_numer, orig_accel_denom, orig_threshold); -} - -// Trap SHM errors -static bool shm_error = false; -static int (*old_error_handler)(Display *, XErrorEvent *); - -static int error_handler(Display *d, XErrorEvent *e) -{ - if (e->error_code == BadAccess) { - shm_error = true; - return 0; - } else - return old_error_handler(d, e); -} - -// Open window -static bool open_window(int width, int height) -{ - int aligned_width = (width + 15) & ~15; - int aligned_height = (height + 15) & ~15; - - // Set absolute mouse mode - ADBSetRelMouseMode(false); - - // Create window - XSetWindowAttributes wattr; - wattr.event_mask = eventmask = win_eventmask; - wattr.background_pixel = (vis == DefaultVisual(x_display, screen) ? black_pixel : 0); - wattr.border_pixel = 0; - wattr.backing_store = NotUseful; - wattr.colormap = (depth == 1 ? DefaultColormap(x_display, screen) : cmap[0]); - the_win = XCreateWindow(x_display, rootwin, 0, 0, width, height, 0, xdepth, - InputOutput, vis, CWEventMask | CWBackPixel | CWBorderPixel | CWBackingStore | CWColormap, &wattr); - - // Set window name/class - set_window_name(the_win, STR_WINDOW_TITLE); - - // Indicate that we want keyboard input - set_window_focus(the_win); - - // Set delete protocol property - set_window_delete_protocol(the_win); - - // Make window unresizable - XSizeHints *hints; - if ((hints = XAllocSizeHints()) != NULL) { - hints->min_width = width; - hints->max_width = width; - hints->min_height = height; - hints->max_height = height; - hints->flags = PMinSize | PMaxSize; - XSetWMNormalHints(x_display, the_win, hints); - XFree((char *)hints); - } - - // Show window - XMapWindow(x_display, the_win); - wait_mapped(the_win); - - // 1-bit mode is big-endian; if the X server is little-endian, we can't - // use SHM because that doesn't allow changing the image byte order - bool need_msb_image = (depth == 1 && XImageByteOrder(x_display) == LSBFirst); - - // Try to create and attach SHM image - have_shm = false; - if (local_X11 && !need_msb_image && XShmQueryExtension(x_display)) { - - // Create SHM image ("height + 2" for safety) - img = XShmCreateImage(x_display, vis, depth == 1 ? 1 : xdepth, depth == 1 ? XYBitmap : ZPixmap, 0, &shminfo, width, height); - shminfo.shmid = shmget(IPC_PRIVATE, (aligned_height + 2) * img->bytes_per_line, IPC_CREAT | 0777); - D(bug(" shm image created\n")); - the_buffer_copy = (uint8 *)shmat(shminfo.shmid, 0, 0); - shminfo.shmaddr = img->data = (char *)the_buffer_copy; - shminfo.readOnly = False; - - // Try to attach SHM image, catching errors - shm_error = false; - old_error_handler = XSetErrorHandler(error_handler); - XShmAttach(x_display, &shminfo); - XSync(x_display, false); - XSetErrorHandler(old_error_handler); - if (shm_error) { - shmdt(shminfo.shmaddr); - XDestroyImage(img); - shminfo.shmid = -1; - } else { - have_shm = true; - shmctl(shminfo.shmid, IPC_RMID, 0); - } - D(bug(" shm image attached\n")); - } - - // Create normal X image if SHM doesn't work ("height + 2" for safety) - if (!have_shm) { - int bytes_per_row = depth == 1 ? aligned_width/8 : TrivialBytesPerRow(aligned_width, DepthModeForPixelDepth(xdepth)); - the_buffer_copy = (uint8 *)malloc((aligned_height + 2) * bytes_per_row); - img = XCreateImage(x_display, vis, depth == 1 ? 1 : xdepth, depth == 1 ? XYBitmap : ZPixmap, 0, (char *)the_buffer_copy, aligned_width, aligned_height, 32, bytes_per_row); - D(bug(" X image created\n")); - } - - // 1-Bit mode is big-endian - if (need_msb_image) { - img->byte_order = MSBFirst; - img->bitmap_bit_order = MSBFirst; - } - -#ifdef ENABLE_VOSF - use_vosf = true; - // Allocate memory for frame buffer (SIZE is extended to page-boundary) - the_host_buffer = the_buffer_copy; - the_buffer_size = page_extend((aligned_height + 2) * img->bytes_per_line); - the_buffer = (uint8 *)vm_acquire(the_buffer_size); - the_buffer_copy = (uint8 *)malloc(the_buffer_size); - D(bug("the_buffer = %p, the_buffer_copy = %p, the_host_buffer = %p\n", the_buffer, the_buffer_copy, the_host_buffer)); -#else - // Allocate memory for frame buffer - the_buffer = (uint8 *)malloc((aligned_height + 2) * img->bytes_per_line); - D(bug("the_buffer = %p, the_buffer_copy = %p\n", the_buffer, the_buffer_copy)); -#endif - screen_base = Host2MacAddr(the_buffer); - - // Create GC - the_gc = XCreateGC(x_display, the_win, 0, 0); - XSetState(x_display, the_gc, black_pixel, white_pixel, GXcopy, AllPlanes); - - // Create cursor - if (hw_mac_cursor_accl) { - cursor_image = XCreateImage(x_display, vis, 1, XYPixmap, 0, (char *)MacCursor + 4, 16, 16, 16, 2); - cursor_image->byte_order = MSBFirst; - cursor_image->bitmap_bit_order = MSBFirst; - cursor_mask_image = XCreateImage(x_display, vis, 1, XYPixmap, 0, (char *)MacCursor + 36, 16, 16, 16, 2); - cursor_mask_image->byte_order = MSBFirst; - cursor_mask_image->bitmap_bit_order = MSBFirst; - cursor_map = XCreatePixmap(x_display, the_win, 16, 16, 1); - cursor_mask_map = XCreatePixmap(x_display, the_win, 16, 16, 1); - cursor_gc = XCreateGC(x_display, cursor_map, 0, 0); - cursor_mask_gc = XCreateGC(x_display, cursor_mask_map, 0, 0); - mac_cursor = XCreatePixmapCursor(x_display, cursor_map, cursor_mask_map, &black, &white, 0, 0); - cursor_changed = false; - } - - // Create no_cursor - else { - mac_cursor = XCreatePixmapCursor(x_display, - XCreatePixmap(x_display, the_win, 1, 1, 1), - XCreatePixmap(x_display, the_win, 1, 1, 1), - &black, &white, 0, 0); - XDefineCursor(x_display, the_win, mac_cursor); - } - - // Init blitting routines - bool native_byte_order; -#ifdef WORDS_BIGENDIAN - native_byte_order = (XImageByteOrder(x_display) == MSBFirst); -#else - native_byte_order = (XImageByteOrder(x_display) == LSBFirst); -#endif -#ifdef ENABLE_VOSF - Screen_blitter_init(visualFormat, native_byte_order, depth); -#endif - - // Set bytes per row - XSync(x_display, false); - return true; -} - -// Open FBDev DGA display -static bool open_fbdev_dga(int width, int height) -{ -#ifdef ENABLE_FBDEV_DGA -#ifdef ENABLE_XF86_VIDMODE - // Switch to best mode - if (has_vidmode) { - int best = -1; - for (int i = 0; i < num_x_video_modes; i++) { - if (x_video_modes[i]->hdisplay == width && x_video_modes[i]->vdisplay == height) { - best = i; - break; - } - }; - assert(best != -1); - XF86VidModeSwitchToMode(x_display, screen, x_video_modes[best]); - XF86VidModeSetViewPort(x_display, screen, 0, 0); - D(bug("[fbdev] VideoMode %d: %d x %d @ %d\n", best, - x_video_modes[best]->hdisplay, x_video_modes[best]->vdisplay, - 1000 * x_video_modes[best]->dotclock / (x_video_modes[best]->htotal * x_video_modes[best]->vtotal))); - } -#endif - - if (ioctl(fb_dev_fd, FBIOGET_FSCREENINFO, &fb_finfo) != 0) { - D(bug("[fbdev] Can't get FSCREENINFO: %s\n", strerror(errno))); - return false; - } - D(bug("[fbdev] Device ID: %s\n", fb_finfo.id)); - D(bug("[fbdev] smem_start: %p [%d bytes]\n", fb_finfo.smem_start, fb_finfo.smem_len)); - - int fb_type = fb_finfo.type; - const char *fb_type_str = NULL; - switch (fb_type) { - case FB_TYPE_PACKED_PIXELS: fb_type_str = "Packed Pixels"; break; - case FB_TYPE_PLANES: fb_type_str = "Non interleaved planes"; break; - case FB_TYPE_INTERLEAVED_PLANES: fb_type_str = "Interleaved planes"; break; - case FB_TYPE_TEXT: fb_type_str = "Text/attributes"; break; - case FB_TYPE_VGA_PLANES: fb_type_str = "EGA/VGA planes"; break; - default: fb_type_str = ""; break; - } - D(bug("[fbdev] type: %s\n", fb_type_str)); - - if (fb_type != FB_TYPE_PACKED_PIXELS) { - D(bug("[fbdev] type '%s' not supported\n", fb_type_str)); - return false; - } - - int fb_visual = fb_finfo.visual; - const char *fb_visual_str; - switch (fb_visual) { - case FB_VISUAL_MONO01: fb_visual_str = "Monochrome 1=Black 0=White"; break; - case FB_VISUAL_MONO10: fb_visual_str = "Monochrome 1=While 0=Black"; break; - case FB_VISUAL_TRUECOLOR: fb_visual_str = "True color"; break; - case FB_VISUAL_PSEUDOCOLOR: fb_visual_str = "Pseudo color (like atari)"; break; - case FB_VISUAL_DIRECTCOLOR: fb_visual_str = "Direct color"; break; - case FB_VISUAL_STATIC_PSEUDOCOLOR: fb_visual_str = "Pseudo color readonly"; break; - default: fb_visual_str = ""; break; - } - D(bug("[fbdev] visual: %s\n", fb_visual_str)); - - if (fb_visual != FB_VISUAL_TRUECOLOR && fb_visual != FB_VISUAL_DIRECTCOLOR) { - D(bug("[fbdev] visual '%s' not supported\n", fb_visual_str)); - return false; - } - - // Map frame buffer - the_buffer = (uint8 *)mmap(NULL, fb_finfo.smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fb_dev_fd, 0); - if (the_buffer == MAP_FAILED) { - D(bug("[fbdev] Can't mmap /dev/fb0: %s\n", strerror(errno))); - return false; - } - - // Set absolute mouse mode - ADBSetRelMouseMode(false); - - // Create window - XSetWindowAttributes wattr; - wattr.event_mask = eventmask = dga_eventmask; - wattr.override_redirect = True; - the_win = XCreateWindow(x_display, rootwin, 0, 0, width, height, 0, xdepth, - InputOutput, DefaultVisual(x_display, screen), - CWEventMask | CWOverrideRedirect, &wattr); - - // Show window - XMapRaised(x_display, the_win); - wait_mapped(the_win); - - // Grab mouse and keyboard - XGrabKeyboard(x_display, the_win, True, - GrabModeAsync, GrabModeAsync, CurrentTime); - XGrabPointer(x_display, the_win, True, - PointerMotionMask | ButtonPressMask | ButtonReleaseMask, - GrabModeAsync, GrabModeAsync, the_win, None, CurrentTime); - disable_mouse_accel(); - - // Create no_cursor - mac_cursor = XCreatePixmapCursor(x_display, - XCreatePixmap(x_display, the_win, 1, 1, 1), - XCreatePixmap(x_display, the_win, 1, 1, 1), - &black, &white, 0, 0); - XDefineCursor(x_display, the_win, mac_cursor); - - // Init blitting routines - int bytes_per_row = TrivialBytesPerRow((width + 7) & ~7, DepthModeForPixelDepth(depth)); -#if ENABLE_VOSF - // Extract current screen color masks (we are in True Color mode) - VisualFormat visualFormat; - visualFormat.depth = xdepth = DefaultDepth(x_display, screen); - XMatchVisualInfo(x_display, screen, xdepth, TrueColor, &visualInfo); - assert(visualFormat.depth == visualInfo.depth); - visualFormat.Rmask = visualInfo.red_mask; - visualFormat.Gmask = visualInfo.green_mask; - visualFormat.Bmask = visualInfo.blue_mask; - D(bug("[fbdev] %d bpp, (%08x,%08x,%08x)\n", - visualFormat.depth, - visualFormat.Rmask, visualFormat.Gmask, visualFormat.Bmask)); - D(bug("[fbdev] Mac depth %d bpp\n", depth)); - - // Screen_blitter_init() returns TRUE if VOSF is mandatory - // i.e. the framebuffer update function is not Blit_Copy_Raw -#ifdef WORDS_BIGENDIAN - const bool native_byte_order = (XImageByteOrder(x_display) == MSBFirst); -#else - const bool native_byte_order = (XImageByteOrder(x_display) == LSBFirst); -#endif - Screen_blitter_init(visualFormat, native_byte_order, depth); - - // Allocate memory for frame buffer (SIZE is extended to page-boundary) - use_vosf = true; - the_host_buffer = the_buffer; - the_buffer_size = page_extend((height + 2) * bytes_per_row); - the_buffer_copy = (uint8 *)malloc(the_buffer_size); - the_buffer = (uint8 *)vm_acquire(the_buffer_size); - D(bug("the_buffer = %p, the_buffer_copy = %p, the_host_buffer = %p\n", the_buffer, the_buffer_copy, the_host_buffer)); -#endif - - // Set frame buffer base - D(bug("the_buffer = %p, use_vosf = %d\n", the_buffer, use_vosf)); - screen_base = Host2MacAddr(the_buffer); - VModes[cur_mode].viRowBytes = bytes_per_row; - return true; -#else - ErrorAlert("SheepShaver has been compiled with DGA support disabled."); - return false; -#endif -} - -// Open XF86 DGA display (!! should use X11 VidMode extensions to set mode) -static bool open_xf86_dga(int width, int height) -{ - if (is_fbdev_dga_mode) - return false; - -#ifdef ENABLE_XF86_DGA - // Set relative mouse mode - ADBSetRelMouseMode(true); - - // Create window - XSetWindowAttributes wattr; - wattr.event_mask = eventmask = dga_eventmask; - wattr.override_redirect = True; - wattr.colormap = (depth == 1 ? DefaultColormap(x_display, screen) : cmap[0]); - the_win = XCreateWindow(x_display, rootwin, 0, 0, width, height, 0, xdepth, - InputOutput, vis, CWEventMask | CWOverrideRedirect | - (color_class == DirectColor ? CWColormap : 0), &wattr); - - // Show window - XMapRaised(x_display, the_win); - wait_mapped(the_win); - -#ifdef ENABLE_XF86_VIDMODE - // Switch to best mode - if (has_vidmode) { - int best = 0; - for (int i=1; ihdisplay >= width && x_video_modes[i]->vdisplay >= height && - x_video_modes[i]->hdisplay <= x_video_modes[best]->hdisplay && x_video_modes[i]->vdisplay <= x_video_modes[best]->vdisplay) { - best = i; - } - } - XF86VidModeSwitchToMode(x_display, screen, x_video_modes[best]); - XF86VidModeSetViewPort(x_display, screen, 0, 0); - } -#endif - - // Establish direct screen connection - XMoveResizeWindow(x_display, the_win, 0, 0, width, height); - XWarpPointer(x_display, None, rootwin, 0, 0, 0, 0, 0, 0); - XGrabKeyboard(x_display, rootwin, True, GrabModeAsync, GrabModeAsync, CurrentTime); - XGrabPointer(x_display, rootwin, True, PointerMotionMask | ButtonPressMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime); - - int v_width, v_bank, v_size; - XF86DGAGetVideo(x_display, screen, (char **)&the_buffer, &v_width, &v_bank, &v_size); - XF86DGADirectVideo(x_display, screen, XF86DGADirectGraphics | XF86DGADirectKeyb | XF86DGADirectMouse); - XF86DGASetViewPort(x_display, screen, 0, 0); - XF86DGASetVidPage(x_display, screen, 0); - - // Set colormap - if (!IsDirectMode(get_current_mode())) { - XSetWindowColormap(x_display, the_win, cmap[current_dga_cmap = 0]); - XF86DGAInstallColormap(x_display, screen, cmap[current_dga_cmap]); - } - XSync(x_display, false); - - // Init blitting routines - int bytes_per_row = TrivialBytesPerRow((v_width + 7) & ~7, DepthModeForPixelDepth(depth)); -#if ENABLE_VOSF - bool native_byte_order; -#ifdef WORDS_BIGENDIAN - native_byte_order = (XImageByteOrder(x_display) == MSBFirst); -#else - native_byte_order = (XImageByteOrder(x_display) == LSBFirst); -#endif -#if REAL_ADDRESSING || DIRECT_ADDRESSING - // Screen_blitter_init() returns TRUE if VOSF is mandatory - // i.e. the framebuffer update function is not Blit_Copy_Raw - use_vosf = Screen_blitter_init(visualFormat, native_byte_order, depth); - - if (use_vosf) { - // Allocate memory for frame buffer (SIZE is extended to page-boundary) - the_host_buffer = the_buffer; - the_buffer_size = page_extend((height + 2) * bytes_per_row); - the_buffer_copy = (uint8 *)malloc(the_buffer_size); - the_buffer = (uint8 *)vm_acquire(the_buffer_size); - D(bug("the_buffer = %p, the_buffer_copy = %p, the_host_buffer = %p\n", the_buffer, the_buffer_copy, the_host_buffer)); - } -#else - use_vosf = false; -#endif -#endif - - // Set frame buffer base - D(bug("the_buffer = %p, use_vosf = %d\n", the_buffer, use_vosf)); - screen_base = Host2MacAddr(the_buffer); - VModes[cur_mode].viRowBytes = bytes_per_row; - return true; -#else - ErrorAlert("SheepShaver has been compiled with DGA support disabled."); - return false; -#endif -} - -// Open DGA display -static bool open_dga(int width, int height) -{ - bool display_open; - - display_open = open_xf86_dga(width, height); -#ifdef ENABLE_FBDEV_DGA - // Try to fallback to FBDev DGA mode - if (!display_open) { - is_fbdev_dga_mode = true; - display_open = open_fbdev_dga(width, height); - } -#endif - - // Common DGA display initialization - if (display_open) { - - // Fake image to get display bounds in the refresh function - if ((img = (XImage *)malloc(sizeof(*img))) == NULL) - return false; - img->width = DisplayWidth(x_display, screen); - img->height = DisplayHeight(x_display, screen); - img->depth = is_fbdev_dga_mode ? xdepth : depth; - img->bytes_per_line = TrivialBytesPerRow(img->width, DepthModeForPixelDepth(img->depth)); - } - - return display_open; -} - -static bool open_display(void) -{ - D(bug("open_display()\n")); - const VideoInfo &mode = VModes[cur_mode]; - - // Get original mouse acceleration - XGetPointerControl(x_display, &orig_accel_numer, &orig_accel_denom, &orig_threshold); - - // Find best available X visual - if (!find_visual_for_depth(mode.viAppleMode)) { - ErrorAlert(GetString(STR_NO_XVISUAL_ERR)); - return false; - } - - // Build up visualFormat structure - visualFormat.fullscreen = (display_type == DIS_SCREEN); - visualFormat.depth = visualInfo.depth; - visualFormat.Rmask = visualInfo.red_mask; - visualFormat.Gmask = visualInfo.green_mask; - visualFormat.Bmask = visualInfo.blue_mask; - - // Create color maps - if (color_class == PseudoColor || color_class == DirectColor) { - cmap[0] = XCreateColormap(x_display, rootwin, vis, AllocAll); - cmap[1] = XCreateColormap(x_display, rootwin, vis, AllocAll); - } else { - cmap[0] = XCreateColormap(x_display, rootwin, vis, AllocNone); - cmap[1] = XCreateColormap(x_display, rootwin, vis, AllocNone); - } - - // Find pixel format of direct modes - if (color_class == DirectColor || color_class == TrueColor) { - rshift = gshift = bshift = 0; - rloss = gloss = bloss = 8; - uint32 mask; - for (mask=vis->red_mask; !(mask&1); mask>>=1) - ++rshift; - for (; mask&1; mask>>=1) - --rloss; - for (mask=vis->green_mask; !(mask&1); mask>>=1) - ++gshift; - for (; mask&1; mask>>=1) - --gloss; - for (mask=vis->blue_mask; !(mask&1); mask>>=1) - ++bshift; - for (; mask&1; mask>>=1) - --bloss; - } - - // Preset palette pixel values for CLUT or gamma table - if (color_class == DirectColor) { - int num = vis->map_entries; - for (int i=0; imap_entries : 256); - for (int i=0; i16/32 expand map - if (!IsDirectMode(get_current_mode()) && xdepth > 8) - for (int i=0; i<256; i++) - ExpandMap[i] = map_rgb(i, i, i); -#endif - - // Create display of requested type - display_type = mode.viType; - depth = depth_of_video_mode(mode.viAppleMode); - - bool display_open; - switch (display_type) { - case DIS_SCREEN: - display_open = open_dga(VModes[cur_mode].viXsize, VModes[cur_mode].viYsize); - break; - case DIS_WINDOW: - display_open = open_window(VModes[cur_mode].viXsize, VModes[cur_mode].viYsize); - break; - default: - display_open = false; - break; - } - -#ifdef ENABLE_VOSF - if (use_vosf) { - // Initialize the VOSF system - LOCK_VOSF; - if (!video_vosf_init()) { - ErrorAlert(GetString(STR_VOSF_INIT_ERR)); - UNLOCK_VOSF; - return false; - } - UNLOCK_VOSF; - } -#endif - - // Zero screen buffers, viRowBytes is initialized at this stage - if (display_open) { - memset(the_buffer, 0, VModes[cur_mode].viRowBytes * VModes[cur_mode].viYsize); - memset(the_buffer_copy, 0, VModes[cur_mode].viRowBytes * VModes[cur_mode].viYsize); - } - return display_open; -} - - -/* - * Close display - */ - -// Close window -static void close_window(void) -{ - if (have_shm) { - XShmDetach(x_display, &shminfo); -#ifdef ENABLE_VOSF - the_host_buffer = NULL; // don't free() in driver_base dtor -#else - the_buffer_copy = NULL; // don't free() in driver_base dtor -#endif - } - if (img) { - if (!have_shm) - img->data = NULL; - XDestroyImage(img); - } - if (have_shm) { - shmdt(shminfo.shmaddr); - shmctl(shminfo.shmid, IPC_RMID, 0); - } - if (the_gc) - XFreeGC(x_display, the_gc); - - XFlush(x_display); - XSync(x_display, false); -} - -// Close FBDev mode -static void close_fbdev_dga(void) -{ -#ifdef ENABLE_FBDEV_DGA - uint8 *fb_base; - if (!use_vosf) - fb_base = the_buffer; -#ifdef ENABLE_VOSF - else - fb_base = the_host_buffer; -#endif - munmap(fb_base, fb_finfo.smem_len); -#endif -} - -// Close XF86 DGA mode -static void close_xf86_dga(void) -{ -#ifdef ENABLE_XF86_DGA - XF86DGADirectVideo(x_display, screen, 0); -#endif -} - -// Close DGA mode -static void close_dga(void) -{ - if (is_fbdev_dga_mode) - close_fbdev_dga(); - else - close_xf86_dga(); - - XUngrabPointer(x_display, CurrentTime); - XUngrabKeyboard(x_display, CurrentTime); - -#ifdef ENABLE_XF86_VIDMODE - if (has_vidmode) - XF86VidModeSwitchToMode(x_display, screen, x_video_modes[0]); -#endif - - // Release fake image (it's not a normal XImage!) - free(img); - img = NULL; - - if (!use_vosf) { - // don't free() the screen buffer in driver_base dtor - the_buffer = NULL; - } -#ifdef ENABLE_VOSF - else { - // don't free() the screen buffer in driver_base dtor - the_host_buffer = NULL; - } -#endif -} - -static void close_display(void) -{ - if (display_type == DIS_SCREEN) - close_dga(); - else if (display_type == DIS_WINDOW) - close_window(); - - // Close window - if (the_win) { - XUnmapWindow(x_display, the_win); - wait_unmapped(the_win); - XDestroyWindow(x_display, the_win); - } - - // Free colormaps - if (cmap[0]) { - XFreeColormap(x_display, cmap[0]); - cmap[0] = 0; - } - if (cmap[1]) { - XFreeColormap(x_display, cmap[1]); - cmap[1] = 0; - } - -#ifdef ENABLE_VOSF - if (use_vosf) { - // Deinitialize VOSF - video_vosf_exit(); - } -#endif - - // Free frame buffer(s) - if (!use_vosf) { - if (the_buffer_copy) { - free(the_buffer_copy); - the_buffer_copy = NULL; - } - } -#ifdef ENABLE_VOSF - else { - // the_buffer shall always be mapped through vm_acquire() so that we can vm_protect() it at will - if (the_buffer != VM_MAP_FAILED) { - D(bug(" releasing the_buffer at %p (%d bytes)\n", the_buffer, the_buffer_size)); - vm_release(the_buffer, the_buffer_size); - the_buffer = NULL; - } - if (the_host_buffer) { - D(bug(" freeing the_host_buffer at %p\n", the_host_buffer)); - free(the_host_buffer); - the_host_buffer = NULL; - } - if (the_buffer_copy) { - D(bug(" freeing the_buffer_copy at %p\n", the_buffer_copy)); - free(the_buffer_copy); - the_buffer_copy = NULL; - } - } -#endif - - // Restore mouse acceleration - restore_mouse_accel(); -} - - -/* - * Initialization - */ - -// Init keycode translation table -static void keycode_init(void) -{ - bool use_kc = PrefsFindBool("keycodes"); - if (use_kc) { - - // Get keycode file path from preferences - const char *kc_path = PrefsFindString("keycodefile"); - - // Open keycode table - FILE *f = fopen(kc_path ? kc_path : KEYCODE_FILE_NAME, "r"); - if (f == NULL) { - char str[256]; - sprintf(str, GetString(STR_KEYCODE_FILE_WARN), kc_path ? kc_path : KEYCODE_FILE_NAME, strerror(errno)); - WarningAlert(str); - return; - } - - // Default translation table - for (int i=0; i<256; i++) - keycode_table[i] = -1; - - // Search for server vendor string, then read keycodes - const char *vendor = ServerVendor(x_display); - // Force use of MacX mappings on MacOS X with Apple's X server - int dummy; - if (XQueryExtension(x_display, "Apple-DRI", &dummy, &dummy, &dummy)) - vendor = "MacX"; - bool vendor_found = false; - char line[256]; - while (fgets(line, 255, f)) { - // Read line - int len = strlen(line); - if (len == 0) - continue; - line[len-1] = 0; - - // Comments begin with "#" or ";" - if (line[0] == '#' || line[0] == ';' || line[0] == 0) - continue; - - if (vendor_found) { - // Read keycode - int x_code, mac_code; - if (sscanf(line, "%d %d", &x_code, &mac_code) == 2) - keycode_table[x_code & 0xff] = mac_code; - else - break; - } else { - // Search for vendor string - if (strstr(vendor, line) == vendor) - vendor_found = true; - } - } - - // Keycode file completely read - fclose(f); - use_keycodes = vendor_found; - - // Vendor not found? Then display warning - if (!vendor_found) { - char str[256]; - sprintf(str, GetString(STR_KEYCODE_VENDOR_WARN), vendor, kc_path ? kc_path : KEYCODE_FILE_NAME); - WarningAlert(str); - return; - } - } -} - -// Find Apple mode matching best specified dimensions -static int find_apple_resolution(int xsize, int ysize) -{ - int apple_id; - if (xsize < 800) - apple_id = APPLE_640x480; - else if (xsize < 1024) - apple_id = APPLE_800x600; - else if (xsize < 1152) - apple_id = APPLE_1024x768; - else if (xsize < 1280) { - if (ysize < 900) - apple_id = APPLE_1152x768; - else - apple_id = APPLE_1152x900; - } - else if (xsize < 1600) - apple_id = APPLE_1280x1024; - else - apple_id = APPLE_1600x1200; - return apple_id; -} - -// Find mode in list of supported modes -static int find_mode(int apple_mode, int apple_id, int type) -{ - for (VideoInfo *p = VModes; p->viType != DIS_INVALID; p++) { - if (p->viType == type && p->viAppleID == apple_id && p->viAppleMode == apple_mode) - return p - VModes; - } - return -1; -} - -// Add custom video mode -static void add_custom_mode(VideoInfo *&p, int type, uint32 x, uint32 y, int apple_mode, int apple_id) -{ - p->viType = type; - p->viXsize = x; - p->viYsize = y; - p->viRowBytes = TrivialBytesPerRow(p->viXsize, apple_mode); - p->viAppleMode = apple_mode; - p->viAppleID = apple_id; - p++; -} - -// Add mode to list of supported modes -static void add_mode(VideoInfo *&p, uint32 allow, uint32 test, int apple_mode, int apple_id, int type) -{ - if (allow & test) { - uint32 x = 0, y = 0; - switch (apple_id) { - case APPLE_W_640x480: - case APPLE_640x480: - x = 640; - y = 480; - break; - case APPLE_W_800x600: - case APPLE_800x600: - x = 800; - y = 600; - break; - case APPLE_1024x768: - x = 1024; - y = 768; - break; - case APPLE_1152x768: - x = 1152; - y = 768; - break; - case APPLE_1152x900: - x = 1152; - y = 900; - break; - case APPLE_1280x1024: - x = 1280; - y = 1024; - break; - case APPLE_1600x1200: - x = 1600; - y = 1200; - break; - } - add_custom_mode(p, type, x, y, apple_mode, apple_id); - } -} - -// Add standard list of windowed modes for given color depth -static void add_window_modes(VideoInfo *&p, int window_modes, int mode) -{ - add_mode(p, window_modes, 1, mode, APPLE_W_640x480, DIS_WINDOW); - add_mode(p, window_modes, 2, mode, APPLE_W_800x600, DIS_WINDOW); -} - -static bool has_mode(int x, int y) -{ -#ifdef ENABLE_XF86_VIDMODE - if (has_vidmode) { - for (int i=0; ihdisplay == x && x_video_modes[i]->vdisplay == y) - return true; - return false; - } -#endif - return DisplayWidth(x_display, screen) >= x && DisplayHeight(x_display, screen) >= y; -} - -bool VideoInit(void) -{ -#ifdef ENABLE_VOSF - // Zero the mainBuffer structure - mainBuffer.dirtyPages = NULL; - mainBuffer.pageInfo = NULL; -#endif - - // Check if X server runs on local machine - local_X11 = (strncmp(XDisplayName(x_display_name), ":", 1) == 0) - || (strncmp(XDisplayName(x_display_name), "/", 1) == 0) - || (strncmp(XDisplayName(x_display_name), "unix:", 5) == 0); - - // Init keycode translation - keycode_init(); - - // Read frame skip prefs - frame_skip = PrefsFindInt32("frameskip"); - if (frame_skip == 0) - frame_skip = 1; - - // Read mouse wheel prefs - mouse_wheel_mode = PrefsFindInt32("mousewheelmode"); - mouse_wheel_lines = PrefsFindInt32("mousewheellines"); - - // Init variables - private_data = NULL; - video_activated = true; - - // Find screen and root window - screen = XDefaultScreen(x_display); - rootwin = XRootWindow(x_display, screen); - - // Get sorted list of available depths - avail_depths = XListDepths(x_display, screen, &num_depths); - if (avail_depths == NULL) { - ErrorAlert(GetString(STR_UNSUPP_DEPTH_ERR)); - return false; - } - sort(avail_depths, avail_depths + num_depths); - - // Get screen depth - xdepth = DefaultDepth(x_display, screen); - -#ifdef ENABLE_XF86_DGA - // DGA available? - int event_base, error_base; - is_fbdev_dga_mode = false; - if (local_X11 && XF86DGAQueryExtension(x_display, &event_base, &error_base)) { - int dga_flags = 0; - XF86DGAQueryDirectVideo(x_display, screen, &dga_flags); - has_dga = dga_flags & XF86DGADirectPresent; -#if defined(__linux__) - // Check r/w permission on /dev/mem for DGA mode to work - if (has_dga && access("/dev/mem", R_OK | W_OK) != 0) - has_dga = false; -#endif - } else - has_dga = false; -#endif - -#ifdef ENABLE_XF86_VIDMODE - // VidMode available? - int vm_event_base, vm_error_base; - has_vidmode = XF86VidModeQueryExtension(x_display, &vm_event_base, &vm_error_base); - if (has_vidmode) { - int vm_major_version, vm_minor_version; - XF86VidModeQueryVersion(x_display, &vm_major_version, &vm_minor_version); - D(bug("VidMode extension %d.%d available\n", vm_major_version, vm_minor_version)); - XF86VidModeGetAllModeLines(x_display, screen, &num_x_video_modes, &x_video_modes); - } -#endif - -#ifdef ENABLE_FBDEV_DGA - // FBDev available? - bool has_fbdev_dga = false; - if (local_X11) { - if ((fb_dev_fd = open("/dev/fb0", O_RDWR)) > 0) { - if (ioctl(fb_dev_fd, FBIOGET_VSCREENINFO, &fb_vinfo) != 0) - close(fb_dev_fd); - else { - has_fbdev_dga = true; - if (!has_dga) { - // Fallback to FBDev DGA mode if XF86 DGA is not possible - has_dga = true; - is_fbdev_dga_mode = true; - } - fb_orig_vinfo = fb_vinfo; - D(bug("Frame buffer device initial resolution: %dx%dx%d\n", fb_vinfo.xres, fb_vinfo.yres, fb_vinfo.bits_per_pixel)); - } - } - } -#endif - - // Find black and white colors - XParseColor(x_display, DefaultColormap(x_display, screen), "rgb:00/00/00", &black); - XAllocColor(x_display, DefaultColormap(x_display, screen), &black); - XParseColor(x_display, DefaultColormap(x_display, screen), "rgb:ff/ff/ff", &white); - XAllocColor(x_display, DefaultColormap(x_display, screen), &white); - black_pixel = BlackPixel(x_display, screen); - white_pixel = WhitePixel(x_display, screen); - - // Mac screen depth follows X depth (for now) - int default_mode = APPLE_8_BIT; - switch (DefaultDepth(x_display, screen)) { - case 1: - default_mode = APPLE_1_BIT; - break; - case 8: - default_mode = APPLE_8_BIT; - break; - case 15: case 16: - default_mode = APPLE_16_BIT; - break; - case 24: case 32: - default_mode = APPLE_32_BIT; - break; - } - - // Get screen mode from preferences - const char *mode_str = PrefsFindString("screen"); - int default_width = 640, default_height = 480; - if (mode_str) { - display_type = DIS_INVALID; - if (sscanf(mode_str, "win/%d/%d", &default_width, &default_height) == 2) - display_type = DIS_WINDOW; -#ifdef ENABLE_XF86_DGA - else if (has_dga && sscanf(mode_str, "dga/%d/%d", &default_width, &default_height) == 2) - display_type = DIS_SCREEN; -#endif -#ifdef ENABLE_FBDEV_DGA - else if (has_fbdev_dga && sscanf(mode_str, "fbdev/%d/%d", &default_width, &default_height) == 2) { - is_fbdev_dga_mode = true; - display_type = DIS_SCREEN; - } -#endif - if (display_type == DIS_INVALID) { - D(bug("Invalid screen mode specified, defaulting to old modes selection\n")); - mode_str = NULL; - } - else { - if (default_width <= 0) - default_width = DisplayWidth(x_display, screen); - else if (default_width > DisplayWidth(x_display, screen)) - default_width = DisplayWidth(x_display, screen); - if (default_height <= 0) - default_height = DisplayHeight(x_display, screen); - else if (default_height > DisplayHeight(x_display, screen)) - default_height = DisplayHeight(x_display, screen); - } - } - - // Construct video mode table - uint32 window_modes = PrefsFindInt32("windowmodes"); - uint32 screen_modes = PrefsFindInt32("screenmodes"); - if (!has_dga) - screen_modes = 0; - if (mode_str) - window_modes = screen_modes = 0; - else if (window_modes == 0 && screen_modes == 0) - window_modes |= 3; // Allow at least 640x480 and 800x600 window modes - - VideoInfo *p = VModes; - if (mode_str) { - if (display_type == DIS_WINDOW) { - for (unsigned int d = APPLE_1_BIT; d <= APPLE_32_BIT; d++) { - if (find_visual_for_depth(d)) { - if (default_width > 640 && default_height > 480) - add_mode(p, 3, 1, d, APPLE_W_640x480, DIS_WINDOW); - if (default_width > 800 && default_height > 600) - add_mode(p, 3, 2, d, APPLE_W_800x600, DIS_WINDOW); - add_custom_mode(p, display_type, default_width, default_height, d, APPLE_CUSTOM); - } - } -#ifdef ENABLE_VOSF - } else if (display_type == DIS_SCREEN && is_fbdev_dga_mode) { - for (unsigned int d = APPLE_1_BIT; d <= default_mode; d++) - if (find_visual_for_depth(d)) - add_custom_mode(p, display_type, default_width, default_height, d, APPLE_CUSTOM); -#endif - } else - add_custom_mode(p, display_type, default_width, default_height, default_mode, APPLE_CUSTOM); - - // Add extra VidMode capable modes - if (display_type == DIS_SCREEN) { - struct { - int w; - int h; - int apple_id; - } - video_modes[] = { - { 640, 480, APPLE_640x480 }, - { 800, 600, APPLE_800x600 }, - { 1024, 768, APPLE_1024x768 }, - { 1152, 768, APPLE_1152x768 }, - { 1152, 900, APPLE_1152x900 }, - { 1280, 1024, APPLE_1280x1024 }, - { 1600, 1200, APPLE_1600x1200 }, - { 0, } - }; - - for (int i = 0; video_modes[i].w != 0; i++) { - const int w = video_modes[i].w; - const int h = video_modes[i].h; - if (w >= default_width || h >= default_height) - continue; - if (has_mode(w, h)) { -#ifdef ENABLE_VOSF - if (is_fbdev_dga_mode) { - for (unsigned int d = APPLE_1_BIT; d <= default_mode; d++) - if (find_visual_for_depth(d)) - add_custom_mode(p, display_type, w, h, d, video_modes[i].apple_id); - } else -#endif - add_custom_mode(p, display_type, w, h, default_mode, video_modes[i].apple_id); - } - } - } - } else if (window_modes) { - for (unsigned int d = APPLE_1_BIT; d <= APPLE_32_BIT; d++) - if (find_visual_for_depth(d)) - add_window_modes(p, window_modes, d); - } else if (has_vidmode) { - if (has_mode(640, 480)) - add_mode(p, screen_modes, 1, default_mode, APPLE_640x480, DIS_SCREEN); - if (has_mode(800, 600)) - add_mode(p, screen_modes, 2, default_mode, APPLE_800x600, DIS_SCREEN); - if (has_mode(1024, 768)) - add_mode(p, screen_modes, 4, default_mode, APPLE_1024x768, DIS_SCREEN); - if (has_mode(1152, 768)) - add_mode(p, screen_modes, 64, default_mode, APPLE_1152x768, DIS_SCREEN); - if (has_mode(1152, 900)) - add_mode(p, screen_modes, 8, default_mode, APPLE_1152x900, DIS_SCREEN); - if (has_mode(1280, 1024)) - add_mode(p, screen_modes, 16, default_mode, APPLE_1280x1024, DIS_SCREEN); - if (has_mode(1600, 1200)) - add_mode(p, screen_modes, 32, default_mode, APPLE_1600x1200, DIS_SCREEN); - } else if (screen_modes) { - int xsize = DisplayWidth(x_display, screen); - int ysize = DisplayHeight(x_display, screen); - int apple_id = find_apple_resolution(xsize, ysize); - p->viType = DIS_SCREEN; - p->viRowBytes = 0; - p->viXsize = xsize; - p->viYsize = ysize; - p->viAppleMode = default_mode; - p->viAppleID = apple_id; - p++; - } - p->viType = DIS_INVALID; // End marker - p->viRowBytes = 0; - p->viXsize = p->viYsize = 0; - p->viAppleMode = 0; - p->viAppleID = 0; - - // Find default mode (window 640x480) - cur_mode = -1; - if (has_dga && screen_modes) { - int screen_width = DisplayWidth(x_display, screen); - int screen_height = DisplayHeight(x_display, screen); - int apple_id = find_apple_resolution(screen_width, screen_height); - if (apple_id != -1) - cur_mode = find_mode(default_mode, apple_id, DIS_SCREEN); - } else if (has_dga && mode_str) - cur_mode = find_mode(default_mode, APPLE_CUSTOM, DIS_SCREEN); - - if (cur_mode == -1) { - // pick up first windowed mode available - for (VideoInfo *p = VModes; p->viType != DIS_INVALID; p++) { - if (p->viType == DIS_WINDOW && p->viAppleMode == default_mode) { - cur_mode = p - VModes; - break; - } - } - } - assert(cur_mode != -1); - -#if DEBUG - D(bug("Available video modes:\n")); - for (p = VModes; p->viType != DIS_INVALID; p++) { - int bits = depth_of_video_mode(p->viAppleMode); - D(bug(" %dx%d (ID %02x), %d colors\n", p->viXsize, p->viYsize, p->viAppleID, 1 << bits)); - } -#endif - - // Open window/screen - if (!open_display()) { - ErrorAlert(GetString(STR_OPEN_WINDOW_ERR)); - return false; - } - -#if 0 - // Ignore errors from now on - XSetErrorHandler(ignore_errors); -#endif - - // Lock down frame buffer - XSync(x_display, false); - LOCK_FRAME_BUFFER; - - // Start periodic thread - XSync(x_display, false); - if (sem_init(&thread_stop_ack, 0, 0) < 0) - return false; - if (sem_init(&thread_resume_req, 0, 0) < 0) - return false; - Set_pthread_attr(&redraw_thread_attr, 0); - redraw_thread_cancel = false; - redraw_thread_active = (pthread_create(&redraw_thread, &redraw_thread_attr, redraw_func, NULL) == 0); - D(bug("Redraw thread installed (%ld)\n", redraw_thread)); - return true; -} - - -/* - * Deinitialization - */ - -void VideoExit(void) -{ - // Stop redraw thread - if (redraw_thread_active) { - redraw_thread_cancel = true; - pthread_cancel(redraw_thread); - pthread_join(redraw_thread, NULL); - sem_destroy(&thread_stop_ack); - sem_destroy(&thread_resume_req); - redraw_thread_active = false; - } - - // Unlock frame buffer - UNLOCK_FRAME_BUFFER; - XSync(x_display, false); - D(bug(" frame buffer unlocked\n")); - -#ifdef ENABLE_VOSF - if (use_vosf) { - // Deinitialize VOSF - video_vosf_exit(); - } -#endif - - // Close window and server connection - if (x_display != NULL) { - XSync(x_display, false); - close_display(); - XFlush(x_display); - XSync(x_display, false); - } - -#ifdef ENABLE_FBDEV_DGA - // Close framebuffer device - if (fb_dev_fd >= 0) { - close(fb_dev_fd); - fb_dev_fd = -1; - } -#endif -} - - -/* - * Suspend/resume emulator - */ - -static void suspend_emul(void) -{ - if (display_type == DIS_SCREEN) { - // Release ctrl key - ADBKeyUp(0x36); - ctrl_down = false; - - // Lock frame buffer (this will stop the MacOS thread) - LOCK_FRAME_BUFFER; - - // Save frame buffer - fb_save = malloc(VModes[cur_mode].viYsize * VModes[cur_mode].viRowBytes); - if (fb_save) - Mac2Host_memcpy(fb_save, screen_base, VModes[cur_mode].viYsize * VModes[cur_mode].viRowBytes); - - // Close full screen display -#if defined(ENABLE_XF86_DGA) || defined(ENABLE_FBDEV_DGA) -#ifdef ENABLE_XF86_DGA - if (!is_fbdev_dga_mode) - XF86DGADirectVideo(x_display, screen, 0); -#endif - XUngrabPointer(x_display, CurrentTime); - XUngrabKeyboard(x_display, CurrentTime); -#endif - restore_mouse_accel(); - XUnmapWindow(x_display, the_win); - wait_unmapped(the_win); - XSync(x_display, false); - - // Open "suspend" window - XSetWindowAttributes wattr; - wattr.event_mask = KeyPressMask; - wattr.background_pixel = (vis == DefaultVisual(x_display, screen) ? black_pixel : 0); - wattr.backing_store = Always; - wattr.colormap = (depth == 1 ? DefaultColormap(x_display, screen) : cmap[0]); - - suspend_win = XCreateWindow(x_display, rootwin, 0, 0, 512, 1, 0, xdepth, - InputOutput, vis, CWEventMask | CWBackPixel | CWBackingStore | CWColormap, &wattr); - set_window_name(suspend_win, STR_SUSPEND_WINDOW_TITLE); - set_window_focus(suspend_win); - XMapWindow(x_display, suspend_win); - emul_suspended = true; - } -} - -static void resume_emul(void) -{ - // Close "suspend" window - XDestroyWindow(x_display, suspend_win); - XSync(x_display, false); - - // Reopen full screen display - XMapRaised(x_display, the_win); - wait_mapped(the_win); - XWarpPointer(x_display, None, rootwin, 0, 0, 0, 0, 0, 0); - Window w = is_fbdev_dga_mode ? the_win : rootwin; - XGrabKeyboard(x_display, w, True, GrabModeAsync, GrabModeAsync, CurrentTime); - XGrabPointer(x_display, w, True, PointerMotionMask | ButtonPressMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, is_fbdev_dga_mode ? w : None, None, CurrentTime); - disable_mouse_accel(); -#ifdef ENABLE_XF86_DGA - if (!is_fbdev_dga_mode) { - XF86DGADirectVideo(x_display, screen, XF86DGADirectGraphics | XF86DGADirectKeyb | XF86DGADirectMouse); - XF86DGASetViewPort(x_display, screen, 0, 0); - } -#endif - XSync(x_display, false); - - // the_buffer already contains the data to restore. i.e. since a temporary - // frame buffer is used when VOSF is actually used, fb_save is therefore - // not necessary. -#ifdef ENABLE_VOSF - if (use_vosf) { - LOCK_VOSF; - PFLAG_SET_ALL; - memset(the_buffer_copy, 0, VModes[cur_mode].viRowBytes * VModes[cur_mode].viYsize); - UNLOCK_VOSF; - } -#endif - - // Restore frame buffer - if (fb_save) { -#ifdef ENABLE_VOSF - // Don't copy fb_save to the temporary frame buffer in VOSF mode - if (!use_vosf) -#endif - Host2Mac_memcpy(screen_base, fb_save, VModes[cur_mode].viYsize * VModes[cur_mode].viRowBytes); - free(fb_save); - fb_save = NULL; - } - - // Unlock frame buffer (and continue MacOS thread) - UNLOCK_FRAME_BUFFER; - emul_suspended = false; -} - - -/* - * Close screen in full-screen mode - */ - -void VideoQuitFullScreen(void) -{ - D(bug("VideoQuitFullScreen()\n")); - if (display_type == DIS_SCREEN) { - quit_full_screen = true; - while (!quit_full_screen_ack) ; - } -} - - -/* - * X11 event handling - */ - -// Translate key event to Mac keycode -static int kc_decode(KeySym ks) -{ - switch (ks) { - case XK_A: case XK_a: return 0x00; - case XK_B: case XK_b: return 0x0b; - case XK_C: case XK_c: return 0x08; - case XK_D: case XK_d: return 0x02; - case XK_E: case XK_e: return 0x0e; - case XK_F: case XK_f: return 0x03; - case XK_G: case XK_g: return 0x05; - case XK_H: case XK_h: return 0x04; - case XK_I: case XK_i: return 0x22; - case XK_J: case XK_j: return 0x26; - case XK_K: case XK_k: return 0x28; - case XK_L: case XK_l: return 0x25; - case XK_M: case XK_m: return 0x2e; - case XK_N: case XK_n: return 0x2d; - case XK_O: case XK_o: return 0x1f; - case XK_P: case XK_p: return 0x23; - case XK_Q: case XK_q: return 0x0c; - case XK_R: case XK_r: return 0x0f; - case XK_S: case XK_s: return 0x01; - case XK_T: case XK_t: return 0x11; - case XK_U: case XK_u: return 0x20; - case XK_V: case XK_v: return 0x09; - case XK_W: case XK_w: return 0x0d; - case XK_X: case XK_x: return 0x07; - case XK_Y: case XK_y: return 0x10; - case XK_Z: case XK_z: return 0x06; - - case XK_1: case XK_exclam: return 0x12; - case XK_2: case XK_at: return 0x13; - case XK_3: case XK_numbersign: return 0x14; - case XK_4: case XK_dollar: return 0x15; - case XK_5: case XK_percent: return 0x17; - case XK_6: return 0x16; - case XK_7: return 0x1a; - case XK_8: return 0x1c; - case XK_9: return 0x19; - case XK_0: return 0x1d; - - case XK_grave: case XK_asciitilde: return 0x0a; - case XK_minus: case XK_underscore: return 0x1b; - case XK_equal: case XK_plus: return 0x18; - case XK_bracketleft: case XK_braceleft: return 0x21; - case XK_bracketright: case XK_braceright: return 0x1e; - case XK_backslash: case XK_bar: return 0x2a; - case XK_semicolon: case XK_colon: return 0x29; - case XK_apostrophe: case XK_quotedbl: return 0x27; - case XK_comma: case XK_less: return 0x2b; - case XK_period: case XK_greater: return 0x2f; - case XK_slash: case XK_question: return 0x2c; - - case XK_Tab: if (ctrl_down) {suspend_emul(); return -1;} else return 0x30; - case XK_Return: return 0x24; - case XK_space: return 0x31; - case XK_BackSpace: return 0x33; - - case XK_Delete: return 0x75; - case XK_Insert: return 0x72; - case XK_Home: case XK_Help: return 0x73; - case XK_End: return 0x77; -#ifdef __hpux - case XK_Prior: return 0x74; - case XK_Next: return 0x79; -#else - case XK_Page_Up: return 0x74; - case XK_Page_Down: return 0x79; -#endif - - case XK_Control_L: return 0x36; - case XK_Control_R: return 0x36; - case XK_Shift_L: return 0x38; - case XK_Shift_R: return 0x38; - case XK_Alt_L: return 0x37; - case XK_Alt_R: return 0x37; - case XK_Meta_L: return 0x3a; - case XK_Meta_R: return 0x3a; - case XK_Menu: return 0x32; - case XK_Caps_Lock: return 0x39; - case XK_Num_Lock: return 0x47; - - case XK_Up: return 0x3e; - case XK_Down: return 0x3d; - case XK_Left: return 0x3b; - case XK_Right: return 0x3c; - - case XK_Escape: if (ctrl_down) {quit_full_screen = true; emerg_quit = true; return -1;} else return 0x35; - - case XK_F1: if (ctrl_down) {SysMountFirstFloppy(); return -1;} else return 0x7a; - case XK_F2: return 0x78; - case XK_F3: return 0x63; - case XK_F4: return 0x76; - case XK_F5: return 0x60; - case XK_F6: return 0x61; - case XK_F7: return 0x62; - case XK_F8: return 0x64; - case XK_F9: return 0x65; - case XK_F10: return 0x6d; - case XK_F11: return 0x67; - case XK_F12: return 0x6f; - - case XK_Print: return 0x69; - case XK_Scroll_Lock: return 0x6b; - case XK_Pause: return 0x71; - -#if defined(XK_KP_Prior) && defined(XK_KP_Left) && defined(XK_KP_Insert) && defined (XK_KP_End) - case XK_KP_0: case XK_KP_Insert: return 0x52; - case XK_KP_1: case XK_KP_End: return 0x53; - case XK_KP_2: case XK_KP_Down: return 0x54; - case XK_KP_3: case XK_KP_Next: return 0x55; - case XK_KP_4: case XK_KP_Left: return 0x56; - case XK_KP_5: case XK_KP_Begin: return 0x57; - case XK_KP_6: case XK_KP_Right: return 0x58; - case XK_KP_7: case XK_KP_Home: return 0x59; - case XK_KP_8: case XK_KP_Up: return 0x5b; - case XK_KP_9: case XK_KP_Prior: return 0x5c; - case XK_KP_Decimal: case XK_KP_Delete: return 0x41; -#else - case XK_KP_0: return 0x52; - case XK_KP_1: return 0x53; - case XK_KP_2: return 0x54; - case XK_KP_3: return 0x55; - case XK_KP_4: return 0x56; - case XK_KP_5: return 0x57; - case XK_KP_6: return 0x58; - case XK_KP_7: return 0x59; - case XK_KP_8: return 0x5b; - case XK_KP_9: return 0x5c; - case XK_KP_Decimal: return 0x41; -#endif - case XK_KP_Add: return 0x45; - case XK_KP_Subtract: return 0x4e; - case XK_KP_Multiply: return 0x43; - case XK_KP_Divide: return 0x4b; - case XK_KP_Enter: return 0x4c; - case XK_KP_Equal: return 0x51; - } - return -1; -} - -static int event2keycode(XKeyEvent &ev, bool key_down) -{ - KeySym ks; - int i = 0; - - do { - ks = XLookupKeysym(&ev, i++); - int as = kc_decode(ks); - if (as >= 0) - return as; - if (as == -2) - return as; - } while (ks != NoSymbol); - - return -1; -} - -static void handle_events(void) -{ - // Handle events - for (;;) { - XEvent event; - - XDisplayLock(); - if (!XCheckMaskEvent(x_display, eventmask, &event)) { - // Handle clipboard events - if (XCheckTypedEvent(x_display, SelectionRequest, &event)) - ClipboardSelectionRequest(&event.xselectionrequest); - else if (XCheckTypedEvent(x_display, SelectionClear, &event)) - ClipboardSelectionClear(&event.xselectionclear); - - // Window "close" widget clicked - else if (XCheckTypedEvent(x_display, ClientMessage, &event)) { - if (event.xclient.format == 32 && event.xclient.data.l[0] == WM_DELETE_WINDOW) { - ADBKeyDown(0x7f); // Power key - ADBKeyUp(0x7f); - } - } - - XDisplayUnlock(); - break; - } - XDisplayUnlock(); - - switch (event.type) { - // Mouse button - case ButtonPress: { - unsigned int button = ((XButtonEvent *)&event)->button; - if (button < 4) - ADBMouseDown(button - 1); - else if (button < 6) { // Wheel mouse - if (mouse_wheel_mode == 0) { - int key = (button == 5) ? 0x79 : 0x74; // Page up/down - ADBKeyDown(key); - ADBKeyUp(key); - } else { - int key = (button == 5) ? 0x3d : 0x3e; // Cursor up/down - for(int i=0; ibutton; - if (button < 4) - ADBMouseUp(button - 1); - break; - } - - // Mouse entered window - case EnterNotify: - if (event.xcrossing.mode != NotifyGrab && event.xcrossing.mode != NotifyUngrab) - ADBMouseMoved(event.xmotion.x, event.xmotion.y); - break; - - // Mouse moved - case MotionNotify: - ADBMouseMoved(event.xmotion.x, event.xmotion.y); - break; - - // Keyboard - case KeyPress: { - int code = -1; - if (use_keycodes) { - if (event2keycode(event.xkey, true) != -2) // This is called to process the hotkeys - code = keycode_table[event.xkey.keycode & 0xff]; - } else - code = event2keycode(event.xkey, true); - if (code >= 0) { - if (!emul_suspended) { - if (code == 0x39) { // Caps Lock pressed - if (caps_on) { - ADBKeyUp(code); - caps_on = false; - } else { - ADBKeyDown(code); - caps_on = true; - } - } else - ADBKeyDown(code); - if (code == 0x36) - ctrl_down = true; - } else { - if (code == 0x31) - resume_emul(); // Space wakes us up - } - } - break; - } - case KeyRelease: { - int code = -1; - if (use_keycodes) { - if (event2keycode(event.xkey, false) != -2) // This is called to process the hotkeys - code = keycode_table[event.xkey.keycode & 0xff]; - } else - code = event2keycode(event.xkey, false); - if (code >= 0 && code != 0x39) { // Don't propagate Caps Lock releases - ADBKeyUp(code); - if (code == 0x36) - ctrl_down = false; - } - break; - } - - // Hidden parts exposed, force complete refresh - case Expose: -#ifdef ENABLE_VOSF - if (use_vosf) { // VOSF refresh - LOCK_VOSF; - PFLAG_SET_ALL; - memset(the_buffer_copy, 0, VModes[cur_mode].viRowBytes * VModes[cur_mode].viYsize); - UNLOCK_VOSF; - } - else -#endif - memset(the_buffer_copy, 0, VModes[cur_mode].viRowBytes * VModes[cur_mode].viYsize); - break; - } - } -} - - -/* - * Execute video VBL routine - */ - -void VideoVBL(void) -{ - if (emerg_quit) - QuitEmulator(); - - // Temporarily give up frame buffer lock (this is the point where - // we are suspended when the user presses Ctrl-Tab) - UNLOCK_FRAME_BUFFER; - LOCK_FRAME_BUFFER; - - // Execute video VBL - if (private_data != NULL && private_data->interruptsEnabled) - VSLDoInterruptService(private_data->vslServiceID); -} - - -/* - * Change video mode - */ - -int16 video_mode_change(VidLocals *csSave, uint32 ParamPtr) -{ - /* return if no mode change */ - if ((csSave->saveData == ReadMacInt32(ParamPtr + csData)) && - (csSave->saveMode == ReadMacInt16(ParamPtr + csMode))) return noErr; - - /* first find video mode in table */ - for (int i=0; VModes[i].viType != DIS_INVALID; i++) { - if ((ReadMacInt16(ParamPtr + csMode) == VModes[i].viAppleMode) && - (ReadMacInt32(ParamPtr + csData) == VModes[i].viAppleID)) { - csSave->saveMode = ReadMacInt16(ParamPtr + csMode); - csSave->saveData = ReadMacInt32(ParamPtr + csData); - csSave->savePage = ReadMacInt16(ParamPtr + csPage); - - // Disable interrupts and pause redraw thread - thread_stop_req = true; - sem_wait(&thread_stop_ack); - thread_stop_req = false; - DisableInterrupt(); - - /* close old display */ - close_display(); - - /* open new display */ - cur_mode = i; - bool ok = open_display(); - - /* opening the screen failed? Then bail out */ - if (!ok) { - ErrorAlert(GetString(STR_FULL_SCREEN_ERR)); - QuitEmulator(); - } - - WriteMacInt32(ParamPtr + csBaseAddr, screen_base); - csSave->saveBaseAddr=screen_base; - csSave->saveData=VModes[cur_mode].viAppleID;/* First mode ... */ - csSave->saveMode=VModes[cur_mode].viAppleMode; - - // Enable interrupts and resume redraw thread - EnableInterrupt(); - sem_post(&thread_resume_req); - return noErr; - } - } - return paramErr; -} - - -/* - * Set color palette - */ - -void video_set_palette(void) -{ - LOCK_PALETTE; - - // Convert colors to XColor array - int mode = get_current_mode(); - int num_in = palette_size(mode); - int num_out = 256; - bool stretch = false; - if (IsDirectMode(mode)) { - // If X is in 565 mode we have to stretch the gamma table from 32 to 64 entries - num_out = vis->map_entries; - stretch = true; - } - XColor *p = x_palette; - for (int i=0; ired = mac_pal[c].red * 0x0101; - p->green = mac_pal[c].green * 0x0101; - p->blue = mac_pal[c].blue * 0x0101; - p++; - } - -#ifdef ENABLE_VOSF - // Recalculate pixel color expansion map - if (!IsDirectMode(mode) && xdepth > 8) { - for (int i=0; i<256; i++) { - int c = i & (num_in-1); // If there are less than 256 colors, we repeat the first entries (this makes color expansion easier) - ExpandMap[i] = map_rgb(mac_pal[c].red, mac_pal[c].green, mac_pal[c].blue); - } - - // We have to redraw everything because the interpretation of pixel values changed - LOCK_VOSF; - PFLAG_SET_ALL; - if (display_type == DIS_SCREEN) - PFLAG_SET_VERY_DIRTY; - UNLOCK_VOSF; - } -#endif - - // Tell redraw thread to change palette - palette_changed = true; - - UNLOCK_PALETTE; -} - - -/* - * Can we set the MacOS cursor image into the window? - */ - -bool video_can_change_cursor(void) -{ - return hw_mac_cursor_accl && (display_type != DIS_SCREEN); -} - - -/* - * Set cursor image for window - */ - -void video_set_cursor(void) -{ - cursor_changed = true; -} - - -/* - * Thread for window refresh, event handling and other periodic actions - */ - -static void update_display(void) -{ - // Incremental update code - int wide = 0, high = 0, x1, x2, y1, y2, i, j; - int bytes_per_row = VModes[cur_mode].viRowBytes; - int bytes_per_pixel = VModes[cur_mode].viRowBytes / VModes[cur_mode].viXsize; - uint8 *p, *p2; - - // Check for first line from top and first line from bottom that have changed - y1 = 0; - for (j=0; j=y1; j--) { - if (memcmp(&the_buffer[j * bytes_per_row], &the_buffer_copy[j * bytes_per_row], bytes_per_row)) { - y2 = j; - break; - } - } - high = y2 - y1 + 1; - - // Check for first column from left and first column from right that have changed - if (high) { - if (depth == 1) { - x1 = VModes[cur_mode].viXsize; - for (j=y1; j<=y2; j++) { - p = &the_buffer[j * bytes_per_row]; - p2 = &the_buffer_copy[j * bytes_per_row]; - for (i=0; i<(x1>>3); i++) { - if (*p != *p2) { - x1 = i << 3; - break; - } - p++; - p2++; - } - } - x2 = x1; - for (j=y1; j<=y2; j++) { - p = &the_buffer[j * bytes_per_row]; - p2 = &the_buffer_copy[j * bytes_per_row]; - p += bytes_per_row; - p2 += bytes_per_row; - for (i=(VModes[cur_mode].viXsize>>3); i>(x2>>3); i--) { - p--; - p2--; - if (*p != *p2) { - x2 = i << 3; - break; - } - } - } - wide = x2 - x1; - - // Update copy of the_buffer - if (high && wide) { - for (j=y1; j<=y2; j++) { - i = j * bytes_per_row + (x1 >> 3); - memcpy(&the_buffer_copy[i], &the_buffer[i], wide >> 3); - } - } - - } else { - x1 = VModes[cur_mode].viXsize; - for (j=y1; j<=y2; j++) { - p = &the_buffer[j * bytes_per_row]; - p2 = &the_buffer_copy[j * bytes_per_row]; - for (i=0; ix2; i--) { - p -= bytes_per_pixel; - p2 -= bytes_per_pixel; - if (memcmp(p, p2, bytes_per_pixel)) { - x2 = i; - break; - } - } - } - wide = x2 - x1; - - // Update copy of the_buffer - if (high && wide) { - for (j=y1; j<=y2; j++) { - i = j * bytes_per_row + x1 * bytes_per_pixel; - memcpy(&the_buffer_copy[i], &the_buffer[i], bytes_per_pixel * wide); - } - } - } - } - - // Refresh display - if (high && wide) { - XDisplayLock(); - if (have_shm) - XShmPutImage(x_display, the_win, the_gc, img, x1, y1, x1, y1, wide, high, 0); - else - XPutImage(x_display, the_win, the_gc, img, x1, y1, x1, y1, wide, high); - XDisplayUnlock(); - } -} - -const int VIDEO_REFRESH_HZ = 60; -const int VIDEO_REFRESH_DELAY = 1000000 / VIDEO_REFRESH_HZ; - -static void handle_palette_changes(void) -{ - LOCK_PALETTE; - - if (palette_changed && !emul_suspended) { - palette_changed = false; - - int mode = get_current_mode(); - if (color_class == PseudoColor || color_class == DirectColor) { - int num = vis->map_entries; - bool set_clut = true; - if (!IsDirectMode(mode) && color_class == DirectColor) { - if (display_type == DIS_WINDOW) - set_clut = false; // Indexed mode on true color screen, don't set CLUT - } - - if (set_clut) { - XDisplayLock(); - XStoreColors(x_display, cmap[0], x_palette, num); - XStoreColors(x_display, cmap[1], x_palette, num); - XSync(x_display, false); - XDisplayUnlock(); - } - } - -#ifdef ENABLE_XF86_DGA - if (display_type == DIS_SCREEN && !is_fbdev_dga_mode) { - current_dga_cmap ^= 1; - if (!IsDirectMode(mode) && cmap[current_dga_cmap]) - XF86DGAInstallColormap(x_display, screen, cmap[current_dga_cmap]); - } -#endif - } - - UNLOCK_PALETTE; -} - -static void *redraw_func(void *arg) -{ - int fd = ConnectionNumber(x_display); - - uint64 start = GetTicks_usec(); - int64 ticks = 0; - uint64 next = GetTicks_usec() + VIDEO_REFRESH_DELAY; - - while (!redraw_thread_cancel) { - - // Pause if requested (during video mode switches) - if (thread_stop_req) { - sem_post(&thread_stop_ack); - sem_wait(&thread_resume_req); - } - - int64 delay = next - GetTicks_usec(); - if (delay < -VIDEO_REFRESH_DELAY) { - - // We are lagging far behind, so we reset the delay mechanism - next = GetTicks_usec(); - - } else if (delay <= 0) { - - // Delay expired, refresh display - next += VIDEO_REFRESH_DELAY; - ticks++; - - // Handle X11 events - handle_events(); - - // Quit DGA mode if requested - if (quit_full_screen) { - quit_full_screen = false; - if (display_type == DIS_SCREEN) { - XDisplayLock(); -#if defined(ENABLE_XF86_DGA) || defined(ENABLE_FBDEV_DGA) -#ifdef ENABLE_XF86_DGA - if (!is_fbdev_dga_mode) - XF86DGADirectVideo(x_display, screen, 0); -#endif - XUngrabPointer(x_display, CurrentTime); - XUngrabKeyboard(x_display, CurrentTime); - XUnmapWindow(x_display, the_win); - wait_unmapped(the_win); - XDestroyWindow(x_display, the_win); -#endif - XSync(x_display, false); - XDisplayUnlock(); - quit_full_screen_ack = true; - return NULL; - } - } - - // Refresh display and set cursor image in window mode - static int tick_counter = 0; - if (display_type == DIS_WINDOW) { - tick_counter++; - if (tick_counter >= frame_skip) { - tick_counter = 0; - - // Update display -#ifdef ENABLE_VOSF - if (use_vosf) { - XDisplayLock(); - if (mainBuffer.dirty) { - LOCK_VOSF; - update_display_window_vosf(); - UNLOCK_VOSF; - XSync(x_display, false); // Let the server catch up - } - XDisplayUnlock(); - } - else -#endif - update_display(); - - // Set new cursor image if it was changed - if (hw_mac_cursor_accl && cursor_changed) { - cursor_changed = false; - uint8 *x_data = (uint8 *)cursor_image->data; - uint8 *x_mask = (uint8 *)cursor_mask_image->data; - for (int i = 0; i < 32; i++) { - x_mask[i] = MacCursor[4 + i] | MacCursor[36 + i]; - x_data[i] = MacCursor[4 + i]; - } - XDisplayLock(); - XFreeCursor(x_display, mac_cursor); - XPutImage(x_display, cursor_map, cursor_gc, cursor_image, 0, 0, 0, 0, 16, 16); - XPutImage(x_display, cursor_mask_map, cursor_mask_gc, cursor_mask_image, 0, 0, 0, 0, 16, 16); - mac_cursor = XCreatePixmapCursor(x_display, cursor_map, cursor_mask_map, &black, &white, MacCursor[2], MacCursor[3]); - XDefineCursor(x_display, the_win, mac_cursor); - XDisplayUnlock(); - } - } - } -#ifdef ENABLE_VOSF - else if (use_vosf) { - // Update display (VOSF variant) - if (++tick_counter >= frame_skip) { - tick_counter = 0; - if (mainBuffer.dirty) { - LOCK_VOSF; - update_display_dga_vosf(); - UNLOCK_VOSF; - } - } - } -#endif - - // Set new palette if it was changed - handle_palette_changes(); - - } else { - - // No display refresh pending, check for X events - fd_set readfds; - FD_ZERO(&readfds); - FD_SET(fd, &readfds); - struct timeval timeout; - timeout.tv_sec = 0; - timeout.tv_usec = delay; - if (select(fd+1, &readfds, NULL, NULL, &timeout) > 0) - handle_events(); - } - } - return NULL; -} - - -/* - * Record dirty area from NQD - */ - -void video_set_dirty_area(int x, int y, int w, int h) -{ - VideoInfo const & mode = VModes[cur_mode]; - const int screen_width = VIDEO_MODE_X; - const int screen_height = VIDEO_MODE_Y; - const int bytes_per_row = VIDEO_MODE_ROW_BYTES; - -#ifdef ENABLE_VOSF - if (use_vosf) { - vosf_set_dirty_area(x, y, w, h, screen_width, screen_height, bytes_per_row); - return; - } -#endif - - // XXX handle dirty bounding boxes for non-VOSF modes -} diff --git a/SheepShaver/src/Unix/xpram_unix.cpp b/SheepShaver/src/Unix/xpram_unix.cpp deleted file mode 120000 index 12e37c98..00000000 --- a/SheepShaver/src/Unix/xpram_unix.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Unix/xpram_unix.cpp \ No newline at end of file diff --git a/SheepShaver/src/VideoDriverStub.i b/SheepShaver/src/VideoDriverStub.i deleted file mode 100644 index ad2ed630..00000000 --- a/SheepShaver/src/VideoDriverStub.i +++ /dev/null @@ -1,24 +0,0 @@ - 0x4a, 0x6f, 0x79, 0x21, 0x70, 0x65, 0x66, 0x66, 0x70, 0x77, 0x70, 0x63, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x01, 0x10, - 0x00, 0x04, 0x04, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, - 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x01, 0x40, 0x02, 0x01, 0x04, 0x00, - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x80, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x68, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x54, 0x68, 0x65, 0x44, 0x72, 0x69, 0x76, 0x65, - 0x72, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x6f, 0x44, 0x72, - 0x69, 0x76, 0x65, 0x72, 0x49, 0x4f, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, - 0x00, 0x14, 0xbd, 0xe0, 0x00, 0x0a, 0xd1, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, - 0x00, 0x01, 0x02, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x90, 0x61, 0x00, 0x18, 0x90, 0x81, 0x00, 0x1c, 0x90, 0xa1, 0x00, 0x20, 0x90, 0xc1, 0x00, 0x24, - 0x90, 0xe1, 0x00, 0x28, 0x80, 0x40, 0x28, 0x08, 0x80, 0x00, 0x28, 0xd8, 0x7c, 0x09, 0x03, 0xa6, - 0x4e, 0x80, 0x04, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x24, 0x6d, 0x74, 0x65, 0x6a, 0x04, 0x26, 0x05, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x1a, 0x21, - 0x01, 0x01, 0x21, 0x80, 0x04, 0x3b, 0x06, 0x19, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x5f, - 0x56, 0x69, 0x64, 0x65, 0x6f, 0x5f, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x5f, 0x53, 0x68, 0x65, 0x65, - 0x70, 0x00, 0x29, 0x2a, 0x01, 0x6e, 0x64, 0x72, 0x76, 0x76, 0x69, 0x64, 0x6f, 0x01, 0x03, diff --git a/SheepShaver/src/Windows/Makefile.in b/SheepShaver/src/Windows/Makefile.in deleted file mode 100755 index edd28f59..00000000 --- a/SheepShaver/src/Windows/Makefile.in +++ /dev/null @@ -1,221 +0,0 @@ -# Windows Makefile for SheepShaver - -## System specific configuration -@SET_MAKE@ -SHELL = /bin/sh - -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -datadir = @datadir@ -mandir = @mandir@ -man1dir = $(mandir)/man1 - -DESTDIR = - -SDL_CFLAGS = @SDL_CFLAGS@ -SDL_LIBS = @SDL_LIBS@ -WANT_GTK = @WANT_GTK@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ - -SLIRP_CFLAGS = @SLIRP_CFLAGS@ -SLIRP_SRCS = \ - ../slirp/bootp.c ../slirp/ip_output.c ../slirp/tcp_input.c \ - ../slirp/cksum.c ../slirp/mbuf.c ../slirp/tcp_output.c \ - ../slirp/debug.c ../slirp/misc.c ../slirp/tcp_subr.c \ - ../slirp/if.c ../slirp/sbuf.c ../slirp/tcp_timer.c \ - ../slirp/ip_icmp.c ../slirp/slirp.c ../slirp/tftp.c \ - ../slirp/ip_input.c ../slirp/socket.c ../slirp/udp.c -SLIRP_OBJS = $(SLIRP_SRCS:../slirp/%.c=$(OBJ_DIR)/slirp-%.o) - -LN_S = @LN_S@ -WINDRES = @WINDRES@ -CC = @CC@ -CXX = @CXX@ -CFLAGS = @CFLAGS@ $(SDL_CFLAGS) -CXXFLAGS = @CXXFLAGS@ $(SDL_CFLAGS) -CPPFLAGS = @CPPFLAGS@ -I../include -I. -I../slirp -DEFS = @DEFS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -lwsock32 -liphlpapi -CPUSRCS = @CPUSRCS@ -PERL = @PERL@ - -USE_DYNGEN = @USE_DYNGEN@ -DYNGENSRCS = @DYNGENSRCS@ -DYNGEN_CC = $(CXX) -DYNGEN_OP_FLAGS = @DYNGEN_OP_FLAGS@ - -HOST_CC = gcc -HOST_CXX = g++ -HOST_CFLAGS = -O2 -HOST_CXXFLAGS = -O2 -HOST_LDFLAGS = - -## Files -UNIXSRCS = vm_alloc.cpp vm_alloc.h sigsegv.cpp sigsegv.h video_vosf.h video_blit.cpp video_blit.h - -ROUTERSRCS = router/arp.cpp router/dump.cpp router/dynsockets.cpp router/ftp.cpp \ - router/icmp.cpp router/mib/interfaces.cpp router/iphelp.cpp router/ipsocket.cpp \ - router/mib/mibaccess.cpp router/router.cpp router/tcp.cpp router/udp.cpp b2ether/packet32.cpp - -SRCS = ../main.cpp main_windows.cpp ../prefs.cpp ../prefs_items.cpp prefs_windows.cpp \ - sys_windows.cpp cdenable/cache.cpp cdenable/eject_nt.cpp cdenable/ntcd.cpp \ - ../rom_patches.cpp ../rsrc_patches.cpp ../emul_op.cpp ../name_registry.cpp \ - ../macos_util.cpp ../timer.cpp timer_windows.cpp ../xpram.cpp xpram_windows.cpp \ - ../adb.cpp ../sony.cpp ../disk.cpp ../cdrom.cpp ../scsi.cpp ../dummy/scsi_dummy.cpp \ - ../gfxaccel.cpp ../video.cpp ../SDL/video_sdl.cpp video_blit.cpp \ - ../audio.cpp ../SDL/audio_sdl.cpp ../ether.cpp ether_windows.cpp \ - ../thunks.cpp ../serial.cpp serial_windows.cpp ../extfs.cpp extfs_windows.cpp \ - about_window_windows.cpp ../user_strings.cpp user_strings_windows.cpp \ - ../dummy/prefs_editor_dummy.cpp clip_windows.cpp util_windows.cpp kernel_windows.cpp \ - vm_alloc.cpp sigsegv.cpp posix_emu.cpp SheepShaver.rc \ - $(CPUSRCS) $(ROUTERSRCS) $(SLIRP_OBJS) - -UI_SRCS = ../prefs.cpp prefs_windows.cpp prefs_editor_gtk.cpp xpram_windows.cpp \ - ../prefs_items.cpp ../user_strings.cpp user_strings_windows.cpp util_windows.cpp \ - b2ether/packet32.cpp SheepShaverGUI.rc - -UI_APP = SheepShaverGUI.exe - -APP = SheepShaver.exe - -PROGS = $(APP) - -ifeq ($(WANT_GTK),yes) -PROGS += $(UI_APP) -endif - -## Rules -.PHONY: clean distclean -.SUFFIXES: -.SUFFIXES: .c .cpp .S .o .h - -all: $(PROGS) - -$(UNIXSRCS): %: ../Unix/% - $(LN_S) $< $@ - -OBJ_DIR = obj -$(OBJ_DIR):: - @[ -d $(OBJ_DIR) ] || mkdir $(OBJ_DIR) > /dev/null 2>&1 - -define SRCS_LIST_TO_OBJS - $(addprefix $(OBJ_DIR)/, $(addsuffix .o, $(foreach file, $(SRCS), \ - $(basename $(notdir $(file)))))) -endef -OBJS = $(SRCS_LIST_TO_OBJS) - -define UI_SRCS_LIST_TO_OBJS - $(addprefix $(OBJ_DIR)/, $(addsuffix .o, $(foreach file, $(UI_SRCS), \ - $(basename $(notdir $(file)))))) -endef -UI_OBJS = $(UI_SRCS_LIST_TO_OBJS) - -define DYNGENSRCS_LIST_TO_OBJS - $(addprefix $(OBJ_DIR)/, $(addsuffix .ho, $(foreach file, $(DYNGENSRCS), \ - $(basename $(notdir $(file)))))) -endef -DYNGENOBJS = $(DYNGENSRCS_LIST_TO_OBJS) - -SRC_PATHS += $(sort $(foreach file, $(SRCS), $(dir $(file)))) -VPATH := -VPATH += $(addprefix :, $(subst ,:, $(filter-out $($(subst, :, ,$(VPATH))), $(SRC_PATHS)))) - -$(APP): $(UNIXSRCS) $(OBJ_DIR) $(OBJS) - $(CXX) -o $(APP) $(LDFLAGS) $(OBJS) $(LIBS) $(SDL_LIBS) - -$(UI_APP): $(UNIXSRCS) $(OBJ_DIR) $(UI_OBJS) - $(CXX) -o $@ $(LDFLAGS) $(UI_OBJS) $(LIBS) $(GTK_LIBS) -mwindows -mno-cygwin - -mostlyclean: - rm -f $(APP) $(UI_APP) $(OBJ_DIR)/* core* *.core *~ *.bak - -clean: mostlyclean - rm -f $(UNIXSRCS) - rm -f dyngen basic-dyngen-ops.hpp ppc-dyngen-ops.hpp ppc-execute-impl.cpp - -distclean: clean - rm -rf $(OBJ_DIR) - rm -rf autom4te.cache - rm -f Makefile - rm -f config.cache config.log config.status config.h - -depend dep: - makedepend $(CPPFLAGS) -Y. $(SRCS) 2>/dev/null - -$(OBJ_DIR)/%.ho : %.c - $(HOST_CC) $(CPPFLAGS) $(DEFS) $(HOST_CFLAGS) -c $< -o $@ -$(OBJ_DIR)/%.ho : %.cpp - $(HOST_CXX) $(CPPFLAGS) $(DEFS) $(HOST_CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/slirp-%.o : ../slirp/%.c - $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) $(SLIRP_CFLAGS) -c $< -o $@ -$(OBJ_DIR)/%.o : %.c - $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) -c $< -o $@ -$(OBJ_DIR)/%.o : %.cpp - $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/%.o : %.mm - $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -c $< -o $@ -$(OBJ_DIR)/%.o : %.S - $(CPP) $(CPPFLAGS) -D__ASSEMBLY__ $< -o $*.out.s - $(AS) $(ASFLAGS) -o $@ $*.out.s - rm $*.out.s -$(OBJ_DIR)/prefs_editor_gtk.o: prefs_editor_gtk.cpp - $(CXX) -O2 -mno-cygwin -mms-bitfields $(CPPFLAGS) $(DEFS) $(GTK_CFLAGS) -c $< -o $@ - -# Windows resources -$(OBJ_DIR)/%.o: %.rc - $(WINDRES) --include-dir ../Windows -i $< -o $@ - -# Kheperix CPU emulator -kpxsrcdir = ../kpx_cpu/src -GENEXECPL = $(kpxsrcdir)/cpu/ppc/genexec.pl -DYNGEN = dyngen.exe - -ifeq ($(USE_DYNGEN),yes) -DYNGENDEPS = basic-dyngen-ops.hpp ppc-dyngen-ops.hpp - -$(DYNGEN): $(DYNGENOBJS) - $(HOST_CXX) -o $@ $(LDFLAGS) $(DYNGENOBJS) - -$(OBJ_DIR)/basic-dyngen.o: basic-dyngen-ops.hpp -$(OBJ_DIR)/basic-dyngen-ops.o: $(kpxsrcdir)/cpu/jit/basic-dyngen-ops.cpp - $(DYNGEN_CC) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) $(DYNGEN_OP_FLAGS) -c $< -o $@ -basic-dyngen-ops.hpp: $(OBJ_DIR)/basic-dyngen-ops.o $(DYNGEN) - ./$(DYNGEN) -o $@ $< - -$(OBJ_DIR)/ppc-dyngen.o: ppc-dyngen-ops.hpp -$(OBJ_DIR)/ppc-dyngen-ops.o: $(kpxsrcdir)/cpu/ppc/ppc-dyngen-ops.cpp basic-dyngen-ops.hpp - $(DYNGEN_CC) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) $(DYNGEN_OP_FLAGS) -c $< -o $@ -ppc-dyngen-ops.hpp: $(OBJ_DIR)/ppc-dyngen-ops.o $(DYNGEN) - ./$(DYNGEN) -o $@ $< - -$(OBJ_DIR)/sheepshaver_glue.o $(OBJ_DIR)/ppc-cpu.o $(OBJ_DIR)/ppc-decode.o $(OBJ_DIR)/ppc-translate.o $(OBJ_DIR)/ppc-jit.o: basic-dyngen-ops.hpp ppc-dyngen-ops.hpp -endif - -$(OBJ_DIR)/ppc-execute.o: ppc-execute-impl.cpp -ppc-execute-impl.cpp: $(kpxsrcdir)/cpu/ppc/ppc-decode.cpp $(GENEXECPL) $(DYNGENDEPS) - $(CPP) $(CPPFLAGS) -DGENEXEC $< | $(PERL) $(GENEXECPL) > $@ - -# PowerPC CPU tester -TESTSRCS_ = mathlib/ieeefp.cpp mathlib/mathlib.cpp cpu/ppc/ppc-cpu.cpp cpu/ppc/ppc-decode.cpp cpu/ppc/ppc-execute.cpp cpu/ppc/ppc-translate.cpp test/test-powerpc.cpp $(MONSRCS) vm_alloc.cpp utils/utils-cpuinfo.cpp -ifeq ($(USE_DYNGEN),yes) -TESTSRCS_ += cpu/jit/jit-cache.cpp cpu/jit/basic-dyngen.cpp cpu/ppc/ppc-dyngen.cpp cpu/ppc/ppc-jit.cpp -endif -TESTSRCS = $(TESTSRCS_:%.cpp=$(kpxsrcdir)/%.cpp) - -define TESTSRCS_LIST_TO_OBJS - $(addprefix $(OBJ_DIR)/, $(addsuffix .o, $(foreach file, $(TESTSRCS), \ - $(basename $(notdir $(file)))))) -endef -TESTOBJS = $(TESTSRCS_LIST_TO_OBJS) - -$(OBJ_DIR)/test-powerpc.o: $(kpxsrcdir)/test/test-powerpc.cpp - $(HOST_CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -DEMU_KHEPERIX -c $< -o $@ - -test-powerpc.exe: $(TESTOBJS) - $(HOST_CXX) -o $@ $(LDFLAGS) $(TESTOBJS) -mconsole - -#------------------------------------------------------------------------- -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/SheepShaver/src/Windows/SheepShaver.ico b/SheepShaver/src/Windows/SheepShaver.ico deleted file mode 100755 index 40c862d2ca7b612cd1215d47bbd65f17e5a4faf8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2238 zcmc(fF-+@L7==%UCqC==5a-543^Qe|YkEej)CQM)iQ zBBcW(%7oPRiIEXUvfS^t<0Q08x7zw_bME>7bMLi@)ZyIO5!bG6x>77@7m#!SrvK~c ztdwrItIf?#B}qb`9qsP!YHx2(`}_MkI5^PZ;h~O>j&yu{tdo-yot~cR?CebE=jXb( zxX@%W(dFf(LI}FPzShmnjc#vmb$55C`}=!6JUr;}@lj7tPkMfS*2~L_USD7J_V%WV zY5WDh!*B32`~cs>5qt|dsCNFzeG0$APjCVMa9YFvU~_?vRRvQ`A%F)5f~pGW0X?7x zbSntx9^IpRbdT=QJ-S18=nmbXJ9I}$r6~mP-~f}AXlkWX@*#i+2MFloLjVsBXoOBa z1n}U%8dX#BA%F)5g36N*0X#Thg8a?R@&ox0z=H#tppy^wPCYo_4|MV&fCmTGtP12q z01pmi{P=}wkOv+dusO_w_hk8=dH@kcz2KJRv*!D*bY$8K2{pcJ4Id$28vp7C@l>Wm3cXUyrac9!`tmM<n42);`&KFhPU32^P3ynX`9HpnL%%@z5OD`h0>TEX&h3&?$ulr zXDU*qg+`5GZOk5(F;bXiv@n=$Wm2)MAFVrDOI<(LJY^oVFb@-0^e}CnX`U;e59dRh z>qxrdhJ)-fD>IgsmT5UGF%(#$tG=#Md%r4sy?@|; z&ZJC>WURX0md0l>z_K#rWje-S_4U#%zx>7wY5cM2fk7Il^$yF17Y0SlgZf!IwsS!J z2Q3YX1_RzenavtQ#Q2BLvHBSnmAoQ8kB`}CHkx4>r%_f_u`nz;#L-5^2Rh3!U>VoD zOG!+NGULJKVZ)7KxcUHWPdBRSlW5!+a-^?TFR*=zg(1&pjK;Hg)@}9G-CA+P{7Yk5 WMXVglC(YKTuvFI`?C0lyKK=%pC1gMV diff --git a/SheepShaver/src/Windows/SheepShaver.rc b/SheepShaver/src/Windows/SheepShaver.rc deleted file mode 100755 index b7e5281d..00000000 --- a/SheepShaver/src/Windows/SheepShaver.rc +++ /dev/null @@ -1 +0,0 @@ -SheepShaver ICON PRELOAD "SheepShaver.ico" diff --git a/SheepShaver/src/Windows/SheepShaverGUI.ico b/SheepShaver/src/Windows/SheepShaverGUI.ico deleted file mode 100755 index 67d4c55fab03db3146193a2c8fcfc69907eaabc3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1078 zcmchWJ#vIF422(?%(zQ90##;@kt4aI_0fEslqu7ZPqGc(#SJMUkfo~K;7@qcE31@<9aF-IC#51-QI&H>nq%`<+h!WfVQh$Ucf(}0+9O}TOLWlj#9k%d?_(vS@ zhtB_uPxal<*Ed7Oev8uSQNQgbmCE;P?Qr=cz4!c0+y9GgUz_t8Uf?$88GTHN8OOs+ zyI@7VHs?NE)M(_bp)q{oDCCYUpxD>wQo&^eIyQw6C(kdq=CwL?pBy+RocOn|vgQ2( DRT%bz diff --git a/SheepShaver/src/Windows/SheepShaverGUI.rc b/SheepShaver/src/Windows/SheepShaverGUI.rc deleted file mode 100644 index db7ed548..00000000 --- a/SheepShaver/src/Windows/SheepShaverGUI.rc +++ /dev/null @@ -1,2 +0,0 @@ -SheepShaverGUI ICON PRELOAD "SheepShaverGUI.ico" - diff --git a/SheepShaver/src/Windows/about_window_windows.cpp b/SheepShaver/src/Windows/about_window_windows.cpp deleted file mode 100755 index 4527aad5..00000000 --- a/SheepShaver/src/Windows/about_window_windows.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - * about_window_windows.cpp - "About" window, Windows implementation - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "about_window.h" - - -/* - * Open "About" window - */ - -void OpenAboutWindow(void) -{ -} diff --git a/SheepShaver/src/Windows/b2ether b/SheepShaver/src/Windows/b2ether deleted file mode 120000 index cf8fd89b..00000000 --- a/SheepShaver/src/Windows/b2ether +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Windows/b2ether \ No newline at end of file diff --git a/SheepShaver/src/Windows/cd_defs.h b/SheepShaver/src/Windows/cd_defs.h deleted file mode 120000 index fdaec5bd..00000000 --- a/SheepShaver/src/Windows/cd_defs.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Windows/cd_defs.h \ No newline at end of file diff --git a/SheepShaver/src/Windows/cdenable b/SheepShaver/src/Windows/cdenable deleted file mode 120000 index 3b36f98c..00000000 --- a/SheepShaver/src/Windows/cdenable +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Windows/cdenable \ No newline at end of file diff --git a/SheepShaver/src/Windows/clip_windows.cpp b/SheepShaver/src/Windows/clip_windows.cpp deleted file mode 120000 index 2669ccc9..00000000 --- a/SheepShaver/src/Windows/clip_windows.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Windows/clip_windows.cpp \ No newline at end of file diff --git a/SheepShaver/src/Windows/configure.ac b/SheepShaver/src/Windows/configure.ac deleted file mode 100755 index dcb4bfe0..00000000 --- a/SheepShaver/src/Windows/configure.ac +++ /dev/null @@ -1,266 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -dnl Written in 2002 by Christian Bauer - -AC_INIT([SheepShaver], 2.3, [Christian.Bauer@uni-mainz.de], SheepShaver) -AC_CONFIG_SRCDIR(main_windows.cpp) -AC_CONFIG_AUX_DIR(../Unix) -AC_PREREQ(2.52) -AC_CONFIG_HEADER(config.h) - -dnl Canonical system information. -AC_CANONICAL_HOST -AC_CANONICAL_TARGET - -dnl Options. -AC_ARG_ENABLE(jit, [ --enable-jit enable JIT compiler [default=yes]], [WANT_JIT=$enableval], [WANT_JIT=yes]) -AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes]) - -dnl Checks for programs. -AC_PROG_CC -AC_PROG_CPP -AC_PROG_CXX -AC_PROG_MAKE_SET -AC_PROG_EGREP -AC_PROG_LN_S -AC_PATH_PROG(PERL, [perl]) -AC_CHECK_TOOL(WINDRES, windres) - -dnl We use GTK+ if possible. -if [[ "x$WANT_GTK" = "xyes" ]]; then - AM_PATH_GTK_2_0(1.3.15, [], [ - AC_MSG_WARN([Could not find GTK+ 2.0, disabling user interface.]) - WANT_GTK=no - ]) -fi -AC_SUBST(WANT_GTK) - -dnl We use 64-bit file size support if possible. -AC_SYS_LARGEFILE - -dnl Checks for header files. -AC_HEADER_STDC - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_C_BIGENDIAN -AC_C_CONST -AC_C_INLINE -AC_CHECK_SIZEOF(short, 2) -AC_CHECK_SIZEOF(int, 4) -AC_CHECK_SIZEOF(long, 4) -AC_CHECK_SIZEOF(long long, 8) -AC_CHECK_SIZEOF(float, 4) -AC_CHECK_SIZEOF(double, 8) -AC_CHECK_SIZEOF(void *, 4) -AC_TYPE_OFF_T -AC_CHECK_TYPES(loff_t) -AC_TYPE_SIZE_T - -dnl Checks for library functions. -AC_CHECK_FUNCS(strdup strerror) -AC_CHECK_FUNCS(exp2f log2f exp2 log2) -AC_CHECK_FUNCS(floorf roundf ceilf truncf) -AC_CHECK_FUNCS(floor round ceil trunc) - -dnl Define a macro that translates a yesno-variable into a C macro definition -dnl to be put into the config.h file -dnl $1 -- the macro to define -dnl $2 -- the value to translate -dnl $3 -- template name -AC_DEFUN([AC_TRANSLATE_DEFINE], [ - if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then - AC_DEFINE($1, 1, $3) - fi -]) - -dnl Check that VirtualAlloc(), VirtualProtect() work -AC_CACHE_CHECK([whether VirtualProtect works], - ac_cv_VirtualProtect_works, [ - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - ac_cv_VirtualProtect_works=yes - dnl First the tests that should segfault - for test_def in NONE_READ NONE_WRITE READ_WRITE; do - AC_TRY_RUN([ - #define HAVE_WIN32_VM 1 - #define CONFIGURE_TEST_VM_MAP - #define TEST_VM_PROT_$test_def - #include "../Unix/vm_alloc.cpp" - ], ac_cv_VirtualProtect_works=no, rm -f core, - dnl When cross-compiling, assume it works - ac_cv_VirtualProtect_works="yes" - ) - done - AC_TRY_RUN([ - #define HAVE_WIN32_VM 1 - #define CONFIGURE_TEST_VM_MAP - #define TEST_VM_PROT_RDWR_WRITE - #include "../Unix/vm_alloc.cpp" - ], , ac_cv_VirtualProtect_works=no, - dnl When cross-compiling, assume it works - ac_cv_VirtualProtect_works="yes" - ) - AC_LANG_RESTORE - ] -) -if [[ "x$ac_cv_VirtualProtect_works" = "xyes" ]]; then - AC_DEFINE(HAVE_WIN32_VM, 1, [Define if your system has a working Win32-based memory allocator.]) -else - AC_MSG_ERROR([Sorry, Windows VM functions don't work as expected on your system.]) -fi - -dnl Check if Windows exceptions are supported. -AC_CACHE_CHECK([whether your system supports Windows exceptions], - ac_cv_have_win32_exceptions, [ - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_RUN([ - #define HAVE_WIN32_EXCEPTIONS 1 - #define CONFIGURE_TEST_SIGSEGV_RECOVERY - #include "../Unix/vm_alloc.cpp" - #include "../Unix/sigsegv.cpp" - ], - ac_cv_have_win32_exceptions=yes, - ac_cv_have_win32_exceptions=no, - dnl When cross-compiling, assume it works - ac_cv_have_win32_exceptions="yes" - ) - AC_LANG_RESTORE - ] -) -if [[ "x$ac_cv_have_win32_exceptions" = "xyes" ]]; then - AC_DEFINE(HAVE_WIN32_EXCEPTIONS, 1, [Define if your system supports Windows exceptions.]) -else - AC_MSG_ERROR([Sorry, Windows exceptions don't work as expected on your system.]) -fi - -dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler) -AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler], - ac_cv_have_skip_instruction, [ - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_RUN([ - #define HAVE_SIGSEGV_SKIP_INSTRUCTION 1 - #define CONFIGURE_TEST_SIGSEGV_RECOVERY - #include "../Unix/vm_alloc.cpp" - #include "../Unix/sigsegv.cpp" - ], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no, - dnl When cross-compiling, assume it works - ac_cv_have_skip_instruction="yes" - ) - AC_LANG_RESTORE - ] -) -AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction", - [Define if we can ignore the fault (instruction skipping in SIGSEGV handler).]) - -dnl We really want VOSF (Video on SEGV Signals) screen updates acceleration -AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.]) - -dnl Check for GCC 2.7 or higher. -HAVE_GCC27=no -AC_MSG_CHECKING(for GCC 2.7 or higher) -AC_EGREP_CPP(xyes, -[#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5 - xyes -#endif -], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no)) - -dnl Check for GCC 3.0 or higher. -HAVE_GCC30=no -AC_MSG_CHECKING(for GCC 3.0 or higher) -AC_EGREP_CPP(xyes, -[#if __GNUC__ >= 3 - xyes -#endif -], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no)) - -dnl Add -fno-strict-aliasing for slirp sources -if [[ "x$HAVE_GCC30" = "xyes" ]]; then - SAVED_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fno-strict-aliasing" - AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing], - ac_cv_gcc_no_strict_aliasing, [ - AC_TRY_COMPILE([],[], - [ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")], - [ac_cv_gcc_no_strict_aliasing=no]) - ]) - CFLAGS="$SAVED_CFLAGS" -fi - -dnl CPU emulator sources -CPUSRCS="\ - ../kpx_cpu/src/mathlib/ieeefp.cpp \ - ../kpx_cpu/src/mathlib/mathlib.cpp \ - ../kpx_cpu/src/cpu/ppc/ppc-cpu.cpp \ - ../kpx_cpu/src/cpu/ppc/ppc-decode.cpp \ - ../kpx_cpu/src/cpu/ppc/ppc-execute.cpp \ - ../kpx_cpu/src/cpu/ppc/ppc-translate.cpp \ - ../kpx_cpu/src/utils/utils-cpuinfo.cpp" -CPPFLAGS="$CPPFLAGS -I../kpx_cpu/include -I../kpx_cpu/src" - -dnl Enable JIT compiler, if possible -USE_DYNGEN="no" -if [[ "x$WANT_JIT" = "xyes" ]]; then - case $host_cpu in - i?86) - DYNGEN_OP_FLAGS="-fomit-frame-pointer -mpreferred-stack-boundary=2" - if [[ "x$HAVE_GCC30" = "xyes" ]]; then - DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -falign-functions=0" - else - DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -malign-functions=0" - fi - ;; - esac - USE_DYNGEN="yes" - DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-limit=10000 -g0" - if [[ "x$HAVE_GCC30" = "xyes" ]]; then - DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-reorder-blocks -fno-optimize-sibling-calls" - fi - AC_DEFINE(ENABLE_DYNGEN, 1, [Define to enable dyngen engine]) - DYNGENSRCS="\ - ../kpx_cpu/src/cpu/jit/dyngen.c \ - ../kpx_cpu/src/cpu/jit/cxxdemangle.cpp" - CPUSRCS="\ - ../kpx_cpu/src/cpu/jit/jit-cache.cpp \ - ../kpx_cpu/src/cpu/jit/basic-dyngen.cpp \ - ../kpx_cpu/src/cpu/ppc/ppc-dyngen.cpp \ - ../kpx_cpu/src/cpu/ppc/ppc-jit.cpp $CPUSRCS" - CPPFLAGS="$CPPFLAGS -DUSE_JIT" -fi -CPUSRCS="$CPUSRCS ../kpx_cpu/sheepshaver_glue.cpp ../kpx_cpu/ppc-dis.c" - -dnl Use the dummy prefs file. -CPUSRCS="$CPUSRCS ../dummy/prefs_dummy.cpp" - -dnl We really want SDL for now -AC_CHECK_TOOL(sdl_config, sdl-config, [AC_MSG_ERROR([Sorry, you currently need SDL for this port])]) -SDL_CFLAGS=`$sdl_config --cflags` -AC_SUBST(SDL_CFLAGS) -SDL_LIBS=`$sdl_config --libs` -AC_SUBST(SDL_LIBS) -AC_DEFINE(USE_SDL, 1, [Define to enble SDL support]) -AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support]) -AC_DEFINE(USE_SDL_AUDIO, 1, [Define to enable SDL audio support]) - -dnl Remove the "-g" option if set for GCC. -if [[ "x$HAVE_GCC27" = "xyes" ]]; then - CFLAGS=`echo $CFLAGS | sed -e 's/-g\b//g'` - CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g\b//g'` -fi - -dnl Generate Makefile. -AC_SUBST(PERL) -AC_SUBST(USE_DYNGEN) -AC_SUBST(DYNGENSRCS) -AC_SUBST(DYNGEN_OP_FLAGS) -AC_SUBST(CPUSRCS) -AC_OUTPUT([Makefile]) - -dnl Print summary. -echo -echo SheepShaver configuration summary: -echo -echo Enable JIT compiler .............. : $WANT_JIT -echo GTK user interface ............... : $WANT_GTK -echo -echo "Configuration done. Now type \"make\"." diff --git a/SheepShaver/src/Windows/ether_windows.cpp b/SheepShaver/src/Windows/ether_windows.cpp deleted file mode 120000 index 44595188..00000000 --- a/SheepShaver/src/Windows/ether_windows.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Windows/ether_windows.cpp \ No newline at end of file diff --git a/SheepShaver/src/Windows/ether_windows.h b/SheepShaver/src/Windows/ether_windows.h deleted file mode 120000 index 6659d3c9..00000000 --- a/SheepShaver/src/Windows/ether_windows.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Windows/ether_windows.h \ No newline at end of file diff --git a/SheepShaver/src/Windows/extfs_windows.cpp b/SheepShaver/src/Windows/extfs_windows.cpp deleted file mode 120000 index 26d851b3..00000000 --- a/SheepShaver/src/Windows/extfs_windows.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Windows/extfs_windows.cpp \ No newline at end of file diff --git a/SheepShaver/src/Windows/kernel_windows.cpp b/SheepShaver/src/Windows/kernel_windows.cpp deleted file mode 120000 index d9c12cdc..00000000 --- a/SheepShaver/src/Windows/kernel_windows.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Windows/kernel_windows.cpp \ No newline at end of file diff --git a/SheepShaver/src/Windows/kernel_windows.h b/SheepShaver/src/Windows/kernel_windows.h deleted file mode 120000 index 10e68ceb..00000000 --- a/SheepShaver/src/Windows/kernel_windows.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Windows/kernel_windows.h \ No newline at end of file diff --git a/SheepShaver/src/Windows/main_windows.cpp b/SheepShaver/src/Windows/main_windows.cpp deleted file mode 100755 index 2d63d76b..00000000 --- a/SheepShaver/src/Windows/main_windows.cpp +++ /dev/null @@ -1,828 +0,0 @@ -/* - * main_windows.cpp - Emulation core, Windows implementation - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include -#include - -#include - -#include "sysdeps.h" -#include "main.h" -#include "version.h" -#include "prefs.h" -#include "prefs_editor.h" -#include "cpu_emulation.h" -#include "emul_op.h" -#include "xlowmem.h" -#include "xpram.h" -#include "timer.h" -#include "adb.h" -#include "video.h" -#include "sys.h" -#include "macos_util.h" -#include "rom_patches.h" -#include "user_strings.h" -#include "vm_alloc.h" -#include "sigsegv.h" -#include "util_windows.h" -#include "kernel_windows.h" - -#define DEBUG 0 -#include "debug.h" - -#ifdef ENABLE_MON -#include "mon.h" -#endif - - -// Constants -const char ROM_FILE_NAME[] = "ROM"; -const char ROM_FILE_NAME2[] = "Mac OS ROM"; - -const uintptr ROM_BASE = 0x40800000; // Base address of ROM - -const uint32 SIG_STACK_SIZE = 0x10000; // Size of signal stack - - -// Global variables (exported) -uint32 RAMBase; // Base address of Mac RAM -uint32 RAMSize; // Size of Mac RAM -uint32 ROMBase; // Base address of Mac ROM -uint32 KernelDataAddr; // Address of Kernel Data -uint32 BootGlobsAddr; // Address of BootGlobs structure at top of Mac RAM -uint32 DRCacheAddr; // Address of DR Cache -uint32 PVR; // Theoretical PVR -int64 CPUClockSpeed; // Processor clock speed (Hz) -int64 BusClockSpeed; // Bus clock speed (Hz) -int64 TimebaseSpeed; // Timebase clock speed (Hz) -uint8 *RAMBaseHost; // Base address of Mac RAM (host address space) -uint8 *ROMBaseHost; // Base address of Mac ROM (host address space) -DWORD win_os; // Windows OS id -DWORD win_os_major; // Windows OS version major - - -// Global variables -static int kernel_area = -1; // SHM ID of Kernel Data area -static bool rom_area_mapped = false; // Flag: Mac ROM mmap()ped -static bool ram_area_mapped = false; // Flag: Mac RAM mmap()ped -static bool dr_cache_area_mapped = false; // Flag: Mac DR Cache mmap()ped -static bool dr_emulator_area_mapped = false;// Flag: Mac DR Emulator mmap()ped -static KernelData *kernel_data; // Pointer to Kernel Data -static EmulatorData *emulator_data; - -static uint8 last_xpram[XPRAM_SIZE]; // Buffer for monitoring XPRAM changes -static bool nvram_thread_active = false; // Flag: NVRAM watchdog installed -static volatile bool nvram_thread_cancel; // Flag: Cancel NVRAM thread -static HANDLE nvram_thread = NULL; // NVRAM watchdog -static bool tick_thread_active = false; // Flag: MacOS thread installed -static volatile bool tick_thread_cancel; // Flag: Cancel 60Hz thread -static HANDLE tick_thread = NULL; // 60Hz thread -static HANDLE emul_thread = NULL; // MacOS thread -static uintptr sig_stack = 0; // Stack for PowerPC interrupt routine - -uint32 SheepMem::page_size; // Size of a native page -uintptr SheepMem::zero_page = 0; // Address of ro page filled in with zeros -uintptr SheepMem::base = 0x60000000; // Address of SheepShaver data -uintptr SheepMem::proc; // Bottom address of SheepShave procedures -uintptr SheepMem::data; // Top of SheepShaver data (stack like storage) - - -// Prototypes -static bool kernel_data_init(void); -static void kernel_data_exit(void); -static void Quit(void); -static DWORD WINAPI nvram_func(void *arg); -static DWORD WINAPI tick_func(void *arg); - -static void jump_to_rom(uint32 entry); -extern void emul_ppc(uint32 start); -extern void init_emul_ppc(void); -extern void exit_emul_ppc(void); -sigsegv_return_t sigsegv_handler(sigsegv_info_t *sip); - - -/* - * Return signal stack base - */ - -uintptr SignalStackBase(void) -{ - return sig_stack + SIG_STACK_SIZE; -} - - -/* - * Memory management helpers - */ - -static inline int vm_mac_acquire(uint32 addr, uint32 size) -{ - return vm_acquire_fixed(Mac2HostAddr(addr), size); -} - -static inline int vm_mac_release(uint32 addr, uint32 size) -{ - return vm_release(Mac2HostAddr(addr), size); -} - - -/* - * Main program - */ - -static void usage(const char *prg_name) -{ - printf("Usage: %s [OPTION...]\n", prg_name); - printf("\nUnix options:\n"); - printf(" --display STRING\n X display to use\n"); - PrefsPrintUsage(); - exit(0); -} - -int main(int argc, char **argv) -{ - char str[256]; - int16 i16; - HANDLE rom_fh; - const char *rom_path; - uint32 rom_size; - DWORD actual; - uint8 *rom_tmp; - - // Initialize variables - RAMBase = 0; - - // Print some info - printf(GetString(STR_ABOUT_TEXT1), VERSION_MAJOR, VERSION_MINOR); - printf(" %s\n", GetString(STR_ABOUT_TEXT2)); - - // Read preferences - PrefsInit(NULL, argc, argv); - - // Parse command line arguments - for (int i=1; i= 4.0 - OSVERSIONINFO osvi; - ZeroMemory(&osvi, sizeof(OSVERSIONINFO)); - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - if (!GetVersionEx(&osvi)) { - ErrorAlert("Could not determine OS type"); - QuitEmulator(); - } - win_os = osvi.dwPlatformId; - win_os_major = osvi.dwMajorVersion; - if (win_os != VER_PLATFORM_WIN32_NT || win_os_major < 4) { - ErrorAlert(GetString(STR_NO_WIN32_NT_4)); - QuitEmulator(); - } - - // Check that drivers are installed - if (!check_drivers()) - QuitEmulator(); - - // Load win32 libraries - KernelInit(); - - // FIXME: default to DIB driver - if (getenv("SDL_VIDEODRIVER") == NULL) - putenv("SDL_VIDEODRIVER=windib"); - - // Initialize SDL system - int sdl_flags = 0; -#ifdef USE_SDL_VIDEO - sdl_flags |= SDL_INIT_VIDEO; -#endif -#ifdef USE_SDL_AUDIO - sdl_flags |= SDL_INIT_AUDIO; -#endif - assert(sdl_flags != 0); - if (SDL_Init(sdl_flags) == -1) { - char str[256]; - sprintf(str, "Could not initialize SDL: %s.\n", SDL_GetError()); - ErrorAlert(str); - goto quit; - } - atexit(SDL_Quit); - -#ifdef ENABLE_MON - // Initialize mon - mon_init(); -#endif - - // Install SIGSEGV handler for CPU emulator - if (!sigsegv_install_handler(sigsegv_handler)) { - sprintf(str, GetString(STR_SIGSEGV_INSTALL_ERR), strerror(errno)); - ErrorAlert(str); - goto quit; - } - - // Initialize VM system - vm_init(); - - // Get system info - PVR = 0x00040000; // Default: 604 - CPUClockSpeed = 100000000; // Default: 100MHz - BusClockSpeed = 100000000; // Default: 100MHz - TimebaseSpeed = 25000000; // Default: 25MHz - PVR = 0x000c0000; // Default: 7400 (with AltiVec) - D(bug("PVR: %08x (assumed)\n", PVR)); - - // Init system routines - SysInit(); - - // Show preferences editor - if (!PrefsFindBool("nogui")) - if (!PrefsEditor()) - goto quit; - - // Create areas for Kernel Data - if (!kernel_data_init()) - goto quit; - kernel_data = (KernelData *)Mac2HostAddr(KERNEL_DATA_BASE); - emulator_data = &kernel_data->ed; - KernelDataAddr = KERNEL_DATA_BASE; - D(bug("Kernel Data at %p (%08x)\n", kernel_data, KERNEL_DATA_BASE)); - D(bug("Emulator Data at %p (%08x)\n", emulator_data, KERNEL_DATA_BASE + offsetof(KernelData, ed))); - - // Create area for DR Cache - if (vm_mac_acquire(DR_EMULATOR_BASE, DR_EMULATOR_SIZE) < 0) { - sprintf(str, GetString(STR_DR_EMULATOR_MMAP_ERR), strerror(errno)); - ErrorAlert(str); - goto quit; - } - dr_emulator_area_mapped = true; - if (vm_mac_acquire(DR_CACHE_BASE, DR_CACHE_SIZE) < 0) { - sprintf(str, GetString(STR_DR_CACHE_MMAP_ERR), strerror(errno)); - ErrorAlert(str); - goto quit; - } - dr_cache_area_mapped = true; - DRCacheAddr = (uint32)Mac2HostAddr(DR_CACHE_BASE); - D(bug("DR Cache at %p (%08x)\n", DRCacheAddr, DR_CACHE_BASE)); - - // Create area for SheepShaver data - if (!SheepMem::Init()) { - sprintf(str, GetString(STR_SHEEP_MEM_MMAP_ERR), strerror(errno)); - ErrorAlert(str); - goto quit; - } - - // Create area for Mac ROM - if (vm_mac_acquire(ROM_BASE, ROM_AREA_SIZE) < 0) { - sprintf(str, GetString(STR_ROM_MMAP_ERR), strerror(errno)); - ErrorAlert(str); - goto quit; - } - ROMBase = ROM_BASE; - ROMBaseHost = Mac2HostAddr(ROMBase); - rom_area_mapped = true; - D(bug("ROM area at %p (%08x)\n", ROMBaseHost, ROMBase)); - - // Create area for Mac RAM - RAMSize = PrefsFindInt32("ramsize"); - if (RAMSize < 8*1024*1024) { - WarningAlert(GetString(STR_SMALL_RAM_WARN)); - RAMSize = 8*1024*1024; - } - RAMBase = 0; - if (vm_mac_acquire(RAMBase, RAMSize) < 0) { - sprintf(str, GetString(STR_RAM_MMAP_ERR), strerror(errno)); - ErrorAlert(str); - goto quit; - } - RAMBaseHost = Mac2HostAddr(RAMBase); - ram_area_mapped = true; - D(bug("RAM area at %p (%08x)\n", RAMBaseHost, RAMBase)); - - if (RAMBase > ROMBase) { - ErrorAlert(GetString(STR_RAM_HIGHER_THAN_ROM_ERR)); - goto quit; - } - - // Load Mac ROM - rom_path = PrefsFindString("rom"); - rom_fh = CreateFile(rom_path && *rom_path ? rom_path : ROM_FILE_NAME, - GENERIC_READ, 0, NULL, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, NULL); - - if (rom_fh == INVALID_HANDLE_VALUE) { - rom_fh = CreateFile(ROM_FILE_NAME2, - GENERIC_READ, 0, NULL, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, NULL); - - if (rom_fh == INVALID_HANDLE_VALUE) { - ErrorAlert(GetString(STR_NO_ROM_FILE_ERR)); - goto quit; - } - } - printf(GetString(STR_READING_ROM_FILE)); - rom_size = GetFileSize(rom_fh, NULL); - rom_tmp = new uint8[ROM_SIZE]; - ReadFile(rom_fh, (void *)rom_tmp, ROM_SIZE, &actual, NULL); - CloseHandle(rom_fh); - - // Decode Mac ROM - if (!DecodeROM(rom_tmp, actual)) { - if (rom_size != 4*1024*1024) { - ErrorAlert(GetString(STR_ROM_SIZE_ERR)); - goto quit; - } else { - ErrorAlert(GetString(STR_ROM_FILE_READ_ERR)); - goto quit; - } - } - delete[] rom_tmp; - - // Initialize native timers - timer_init(); - - // Initialize everything - if (!InitAll(NULL)) - goto quit; - D(bug("Initialization complete\n")); - - // Write protect ROM - vm_protect(ROMBaseHost, ROM_AREA_SIZE, VM_PAGE_READ); - - // Start 60Hz thread - tick_thread_cancel = false; - tick_thread_active = ((tick_thread = create_thread(tick_func)) != NULL); - SetThreadPriority(tick_thread, THREAD_PRIORITY_ABOVE_NORMAL); - D(bug("Tick thread installed (%ld)\n", tick_thread)); - - // Start NVRAM watchdog thread - memcpy(last_xpram, XPRAM, XPRAM_SIZE); - nvram_thread_cancel = false; - nvram_thread_active = ((nvram_thread = create_thread(nvram_func, NULL)) != NULL); - SetThreadPriority(nvram_thread, THREAD_PRIORITY_BELOW_NORMAL); - D(bug("NVRAM thread installed (%ld)\n", nvram_thread)); - - // Get my thread ID and jump to ROM boot routine - emul_thread = GetCurrentThread(); - D(bug("Jumping to ROM\n")); - jump_to_rom(ROMBase + 0x310000); - D(bug("Returned from ROM\n")); - -quit: - Quit(); - return 0; -} - - -/* - * Cleanup and quit - */ - -static void Quit(void) -{ - // Exit PowerPC emulation - exit_emul_ppc(); - - // Stop 60Hz thread - if (tick_thread_active) { - tick_thread_cancel = true; - wait_thread(tick_thread); - } - - // Stop NVRAM watchdog thread - if (nvram_thread_active) { - nvram_thread_cancel = true; - wait_thread(nvram_thread); - } - - // Deinitialize everything - ExitAll(); - - // Delete SheepShaver globals - SheepMem::Exit(); - - // Delete RAM area - if (ram_area_mapped) - vm_mac_release(RAMBase, RAMSize); - - // Delete ROM area - if (rom_area_mapped) - vm_mac_release(ROMBase, ROM_AREA_SIZE); - - // Delete DR cache areas - if (dr_emulator_area_mapped) - vm_mac_release(DR_EMULATOR_BASE, DR_EMULATOR_SIZE); - if (dr_cache_area_mapped) - vm_mac_release(DR_CACHE_BASE, DR_CACHE_SIZE); - - // Delete Kernel Data area - kernel_data_exit(); - - // Exit system routines - SysExit(); - - // Exit preferences - PrefsExit(); - - // Release win32 libraries - KernelExit(); - -#ifdef ENABLE_MON - // Exit mon - mon_exit(); -#endif - - exit(0); -} - - -/* - * Initialize Kernel Data segments - */ - -static HANDLE kernel_handle; // Shared memory handle for Kernel Data -static DWORD allocation_granule; // Minimum size of allocateable are (64K) -static DWORD kernel_area_size; // Size of Kernel Data area - -static bool kernel_data_init(void) -{ - char str[256]; - SYSTEM_INFO si; - GetSystemInfo(&si); - allocation_granule = si.dwAllocationGranularity; - kernel_area_size = (KERNEL_AREA_SIZE + allocation_granule - 1) & -allocation_granule; - - char rcs[10]; - LPVOID kernel_addr; - kernel_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, kernel_area_size, NULL); - if (kernel_handle == NULL) { - sprintf(rcs, "%d", GetLastError()); - sprintf(str, GetString(STR_KD_SHMGET_ERR), rcs); - ErrorAlert(str); - return false; - } - kernel_addr = (LPVOID)Mac2HostAddr(KERNEL_DATA_BASE & -allocation_granule); - if (MapViewOfFileEx(kernel_handle, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, kernel_area_size, kernel_addr) != kernel_addr) { - sprintf(rcs, "%d", GetLastError()); - sprintf(str, GetString(STR_KD_SHMAT_ERR), rcs); - ErrorAlert(str); - return false; - } - kernel_addr = (LPVOID)Mac2HostAddr(KERNEL_DATA2_BASE & -allocation_granule); - if (MapViewOfFileEx(kernel_handle, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, kernel_area_size, kernel_addr) != kernel_addr) { - sprintf(rcs, "%d", GetLastError()); - sprintf(str, GetString(STR_KD2_SHMAT_ERR), rcs); - ErrorAlert(str); - return false; - } - return true; -} - - -/* - * Deallocate Kernel Data segments - */ - -static void kernel_data_exit(void) -{ - if (kernel_handle) { - UnmapViewOfFile(Mac2HostAddr(KERNEL_DATA_BASE & -allocation_granule)); - UnmapViewOfFile(Mac2HostAddr(KERNEL_DATA2_BASE & -allocation_granule)); - CloseHandle(kernel_handle); - } -} - - -/* - * Jump into Mac ROM, start 680x0 emulator - */ - -void jump_to_rom(uint32 entry) -{ - init_emul_ppc(); - emul_ppc(entry); -} - - -/* - * Quit emulator (cause return from jump_to_rom) - */ - -void QuitEmulator(void) -{ - Quit(); -} - - -/* - * Pause/resume emulator - */ - -void PauseEmulator(void) -{ - SuspendThread(emul_thread); -} - -void ResumeEmulator(void) -{ - ResumeThread(emul_thread); -} - - -/* - * Dump 68k registers - */ - -void Dump68kRegs(M68kRegisters *r) -{ - // Display 68k registers - for (int i=0; i<8; i++) { - printf("d%d: %08x", i, r->d[i]); - if (i == 3 || i == 7) - printf("\n"); - else - printf(", "); - } - for (int i=0; i<8; i++) { - printf("a%d: %08x", i, r->a[i]); - if (i == 3 || i == 7) - printf("\n"); - else - printf(", "); - } -} - - -/* - * Make code executable - */ - -void MakeExecutable(int dummy, uint32 start, uint32 length) -{ - if ((start >= ROMBase) && (start < (ROMBase + ROM_SIZE))) - return; - FlushCodeCache(start, start + length); -} - - -/* - * NVRAM watchdog thread (saves NVRAM every minute) - */ - -static void nvram_watchdog(void) -{ - if (memcmp(last_xpram, XPRAM, XPRAM_SIZE)) { - memcpy(last_xpram, XPRAM, XPRAM_SIZE); - SaveXPRAM(); - } -} - -static DWORD nvram_func(void *arg) -{ - while (!nvram_thread_cancel) { - for (int i=0; i<60 && !nvram_thread_cancel; i++) - Delay_usec(999999); // Only wait 1 second so we quit promptly when nvram_thread_cancel becomes true - nvram_watchdog(); - } - return 0; -} - - -/* - * 60Hz thread (really 60.15Hz) - */ - -static DWORD tick_func(void *arg) -{ - int tick_counter = 0; - uint64 start = GetTicks_usec(); - int64 ticks = 0; - uint64 next = GetTicks_usec(); - - while (!tick_thread_cancel) { - - // Wait - next += 16625; - int64 delay = next - GetTicks_usec(); - if (delay > 0) - Delay_usec(delay); - else if (delay < -16625) - next = GetTicks_usec(); - ticks++; - - // Pseudo Mac 1Hz interrupt, update local time - if (++tick_counter > 60) { - tick_counter = 0; - WriteMacInt32(0x20c, TimerDateTime()); - } - - // Trigger 60Hz interrupt - if (ReadMacInt32(XLM_IRQ_NEST) == 0) { - SetInterruptFlag(INTFLAG_VIA); - TriggerInterrupt(); - } - } - - uint64 end = GetTicks_usec(); - D(bug("%lu ticks in %lu usec = %f ticks/sec\n", (unsigned long)ticks, (unsigned long)(end - start), ticks * 1000000.0 / (end - start))); - return 0; -} - - -/* - * Mutexes - */ - -struct B2_mutex { - mutex_t m; -}; - -B2_mutex *B2_create_mutex(void) -{ - return new B2_mutex; -} - -void B2_lock_mutex(B2_mutex *mutex) -{ - mutex->m.lock(); -} - -void B2_unlock_mutex(B2_mutex *mutex) -{ - mutex->m.unlock(); -} - -void B2_delete_mutex(B2_mutex *mutex) -{ - delete mutex; -} - - -/* - * Interrupt flags (must be handled atomically!) - */ - -volatile uint32 InterruptFlags = 0; -static mutex_t intflags_mutex; - -void SetInterruptFlag(uint32 flag) -{ - intflags_mutex.lock(); - InterruptFlags |= flag; - intflags_mutex.unlock(); -} - -void ClearInterruptFlag(uint32 flag) -{ - intflags_mutex.lock(); - InterruptFlags &= ~flag; - intflags_mutex.unlock(); -} - - -/* - * Disable interrupts - */ - -void DisableInterrupt(void) -{ - WriteMacInt32(XLM_IRQ_NEST, int32(ReadMacInt32(XLM_IRQ_NEST)) + 1); -} - - -/* - * Enable interrupts - */ - -void EnableInterrupt(void) -{ - WriteMacInt32(XLM_IRQ_NEST, int32(ReadMacInt32(XLM_IRQ_NEST)) - 1); -} - - -/* - * Helpers to share 32-bit addressable data with MacOS - */ - -bool SheepMem::Init(void) -{ - // Size of a native page - page_size = vm_get_page_size(); - - // Allocate SheepShaver globals - proc = base; - if (vm_mac_acquire(base, size) < 0) - return false; - - // Allocate page with all bits set to 0, right in the middle - // This is also used to catch undesired overlaps between proc and data areas - zero_page = proc + (size / 2); - Mac_memset(zero_page, 0, page_size); - if (vm_protect(Mac2HostAddr(zero_page), page_size, VM_PAGE_READ) < 0) - return false; - - // Allocate alternate stack for PowerPC interrupt routine - sig_stack = base + size; - if (vm_mac_acquire(sig_stack, SIG_STACK_SIZE) < 0) - return false; - - data = base + size; - return true; -} - -void SheepMem::Exit(void) -{ - if (data) { - // Delete SheepShaver globals - vm_mac_release(base, size); - - // Delete alternate stack for PowerPC interrupt routine - vm_mac_release(sig_stack, SIG_STACK_SIZE); - } -} - - -/* - * Get the main window handle - */ - -#ifdef USE_SDL_VIDEO -#include -HWND GetMainWindowHandle(void) -{ - SDL_SysWMinfo wmInfo; - SDL_VERSION(&wmInfo.version); - return SDL_GetWMInfo(&wmInfo) ? wmInfo.window : NULL; -} -#endif - - -/* - * Display alert - */ - -static void display_alert(int title_id, const char *text, int flags) -{ - HWND hMainWnd = GetMainWindowHandle(); - MessageBox(hMainWnd, text, GetString(title_id), MB_OK | flags); -} - - -/* - * Display error alert - */ - -void ErrorAlert(const char *text) -{ - if (PrefsFindBool("nogui")) - return; - - VideoQuitFullScreen(); - display_alert(STR_ERROR_ALERT_TITLE, text, MB_ICONSTOP); -} - - -/* - * Display warning alert - */ - -void WarningAlert(const char *text) -{ - if (PrefsFindBool("nogui")) - return; - - display_alert(STR_WARNING_ALERT_TITLE, text, MB_ICONINFORMATION); -} - - -/* - * Display choice alert - */ - -bool ChoiceAlert(const char *text, const char *pos, const char *neg) -{ - printf(GetString(STR_SHELL_WARNING_PREFIX), text); - return false; //!! -} diff --git a/SheepShaver/src/Windows/posix_emu.cpp b/SheepShaver/src/Windows/posix_emu.cpp deleted file mode 120000 index 336f134f..00000000 --- a/SheepShaver/src/Windows/posix_emu.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Windows/posix_emu.cpp \ No newline at end of file diff --git a/SheepShaver/src/Windows/posix_emu.h b/SheepShaver/src/Windows/posix_emu.h deleted file mode 120000 index 6fd82b8b..00000000 --- a/SheepShaver/src/Windows/posix_emu.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Windows/posix_emu.h \ No newline at end of file diff --git a/SheepShaver/src/Windows/prefs_editor_gtk.cpp b/SheepShaver/src/Windows/prefs_editor_gtk.cpp deleted file mode 120000 index b94e7615..00000000 --- a/SheepShaver/src/Windows/prefs_editor_gtk.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Windows/prefs_editor_gtk.cpp \ No newline at end of file diff --git a/SheepShaver/src/Windows/prefs_windows.cpp b/SheepShaver/src/Windows/prefs_windows.cpp deleted file mode 100755 index 3f83b045..00000000 --- a/SheepShaver/src/Windows/prefs_windows.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* - * prefs_windows.cpp - Preferences handling, Windows specific stuff - * - * SheepShaver (C) 1997-2008 Christian Bauer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" - -#include -#include - -#include -using std::string; - -#include "prefs.h" - - -// Platform-specific preferences items -prefs_desc platform_prefs_items[] = { - {"ether", TYPE_STRING, false, "device name of Mac ethernet adapter"}, - {"keycodes", TYPE_BOOLEAN, false, "use keycodes rather than keysyms to decode keyboard"}, - {"keycodefile", TYPE_STRING, false, "path of keycode translation file"}, - {"mousewheelmode", TYPE_INT32, false, "mouse wheel support mode (0=page up/down, 1=cursor up/down)"}, - {"mousewheellines", TYPE_INT32, false, "number of lines to scroll in mouse wheel mode 1"}, -#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION - {"ignoresegv", TYPE_BOOLEAN, false, "ignore illegal memory accesses"}, -#endif - {"idlewait", TYPE_BOOLEAN, false, "sleep when idle"}, - {"keycodes", TYPE_BOOLEAN, false, "use keycodes rather than keysyms to decode keyboard"}, - {"keycodefile", TYPE_STRING, false, "path of keycode translation file"}, - {"mousewheelmode", TYPE_INT32, false, "mouse wheel support mode (0=page up/down, 1=cursor up/down)"}, - {"mousewheellines", TYPE_INT32, false, "number of lines to scroll in mouse wheel mode 1"}, - {"enableextfs", TYPE_BOOLEAN, false, "enable extfs system"}, - {"debugextfs", TYPE_BOOLEAN, false, "debug extfs system"}, - {"extdrives", TYPE_STRING, false, "define allowed extfs drives"}, - {"pollmedia", TYPE_BOOLEAN, false, "poll for new media (e.g. cd, floppy)"}, - {"etherguid", TYPE_STRING, false, "GUID of the ethernet device to use"}, - {"etherpermanentaddress", TYPE_BOOLEAN, false, "use permanent NIC address to identify itself"}, - {"ethermulticastmode", TYPE_INT32, false, "how to multicast packets"}, - {"etherfakeaddress", TYPE_STRING, false, "optional fake hardware address"}, - {"routerenabled", TYPE_BOOLEAN, false, "enable NAT/Router module"}, - {"ftp_port_list", TYPE_STRING, false, "FTP ports list"}, - {"tcp_port", TYPE_STRING, false, "TCP ports list"}, - {"portfile0", TYPE_STRING, false, "output file for serial port 0"}, - {"portfile1", TYPE_STRING, false, "output file for serial port 1"}, - - {NULL, TYPE_END, false, NULL} // End of list -}; - - -// Prefs file name and path -const char PREFS_FILE_NAME[] = "SheepShaver_prefs"; -string UserPrefsPath; -static string prefs_path; - - -/* - * Load preferences from settings file - */ - -void LoadPrefs(const char *vmdir) -{ - // Construct prefs path - if (UserPrefsPath.empty()) { - int pwd_len = GetCurrentDirectory(0, NULL); - char *pwd = new char[pwd_len]; - if (GetCurrentDirectory(pwd_len, pwd) == pwd_len - 1) - prefs_path = string(pwd) + '\\'; - delete[] pwd; - prefs_path += PREFS_FILE_NAME; - } else - prefs_path = UserPrefsPath; - - // Read preferences from settings file - FILE *f = fopen(prefs_path.c_str(), "r"); - if (f != NULL) { - - // Prefs file found, load settings - LoadPrefsFromStream(f); - fclose(f); - - } else { - - // No prefs file, save defaults - SavePrefs(); - } -} - - -/* - * Save preferences to settings file - */ - -void SavePrefs(void) -{ - FILE *f; - if ((f = fopen(prefs_path.c_str(), "w")) != NULL) { - SavePrefsToStream(f); - fclose(f); - } -} - - -/* - * Add defaults of platform-specific prefs items - * You may also override the defaults set in PrefsInit() - */ - -void AddPlatformPrefsDefaults(void) -{ - PrefsAddBool("keycodes", false); - PrefsReplaceBool("pollmedia", true); - PrefsReplaceBool("enableextfs", false); - PrefsReplaceString("extfs", ""); - PrefsReplaceString("extdrives", "CDEFGHIJKLMNOPQRSTUVWXYZ"); - PrefsReplaceInt32("mousewheelmode", 1); - PrefsReplaceInt32("mousewheellines", 3); - PrefsAddInt32("windowmodes", 3); - PrefsAddInt32("screenmodes", 0x3f); -#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION - PrefsAddBool("ignoresegv", false); -#endif - PrefsAddBool("idlewait", true); - PrefsReplaceBool("etherpermanentaddress", true); - PrefsReplaceInt32("ethermulticastmode", 0); - PrefsReplaceBool("routerenabled", false); - PrefsReplaceString("ftp_port_list", "21"); - PrefsReplaceString("seriala", "COM1"); - PrefsReplaceString("serialb", "COM2"); - PrefsReplaceString("portfile0", "C:\\B2TEMP0.OUT"); - PrefsReplaceString("portfile1", "C:\\B2TEMP1.OUT"); -} diff --git a/SheepShaver/src/Windows/router b/SheepShaver/src/Windows/router deleted file mode 120000 index e8619d55..00000000 --- a/SheepShaver/src/Windows/router +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Windows/router \ No newline at end of file diff --git a/SheepShaver/src/Windows/serial_windows.cpp b/SheepShaver/src/Windows/serial_windows.cpp deleted file mode 120000 index 88454f92..00000000 --- a/SheepShaver/src/Windows/serial_windows.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Windows/serial_windows.cpp \ No newline at end of file diff --git a/SheepShaver/src/Windows/sys_windows.cpp b/SheepShaver/src/Windows/sys_windows.cpp deleted file mode 120000 index 3eacbe88..00000000 --- a/SheepShaver/src/Windows/sys_windows.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Windows/sys_windows.cpp \ No newline at end of file diff --git a/SheepShaver/src/Windows/sysdeps.h b/SheepShaver/src/Windows/sysdeps.h deleted file mode 100755 index f5aaee12..00000000 --- a/SheepShaver/src/Windows/sysdeps.h +++ /dev/null @@ -1,400 +0,0 @@ -/* - * sysdeps.h - System dependent definitions for Windows - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef SYSDEPS_H -#define SYSDEPS_H - -#ifndef __STDC__ -#error "Your compiler is not ANSI. Get a real one." -#endif - -#include "config.h" -#include "user_strings_windows.h" - -#ifndef STDC_HEADERS -#error "You don't have ANSI C header files." -#endif - -#include -#include -#include -#include -#include -#include -#ifdef __WIN32__ -#include -#endif -#include - - -// Define for external components -#define SHEEPSHAVER 1 -#define POWERPC_ROM 1 -#define EMULATED_PPC 1 -#define CONFIG_WIN32 1 - -// Use Direct Addressing mode -#define DIRECT_ADDRESSING 1 -#define NATMEM_OFFSET 0x11000000 - -// Always use the complete (non-stubs based) Ethernet driver -#if DIRECT_ADDRESSING -#define USE_ETHER_FULL_DRIVER 1 -#endif - -// Mac ROM is write protected when banked memory is used -#if REAL_ADDRESSING || DIRECT_ADDRESSING -# define ROM_IS_WRITE_PROTECTED 0 -# define USE_SCRATCHMEM_SUBTERFUGE 1 -#else -# define ROM_IS_WRITE_PROTECTED 1 -#endif -// Configure PowerPC emulator -#define PPC_REENTRANT_JIT 1 -#define PPC_CHECK_INTERRUPTS 1 -#define PPC_DECODE_CACHE 1 -#define PPC_FLIGHT_RECORDER 1 -#define PPC_PROFILE_COMPILE_TIME 0 -#define PPC_PROFILE_GENERIC_CALLS 0 -#define KPX_MAX_CPUS 1 -#if ENABLE_DYNGEN -#define PPC_ENABLE_JIT 1 -#endif -#if defined(__i386__) -#define DYNGEN_ASM_OPTS 1 -#endif - -// Data types -typedef unsigned char uint8; -typedef signed char int8; -#if SIZEOF_SHORT == 2 -typedef unsigned short uint16; -typedef short int16; -#elif SIZEOF_INT == 2 -typedef unsigned int uint16; -typedef int int16; -#else -#error "No 2 byte type, you lose." -#endif -#if SIZEOF_INT == 4 -typedef unsigned int uint32; -typedef int int32; -#elif SIZEOF_LONG == 4 -typedef unsigned long uint32; -typedef long int32; -#else -#error "No 4 byte type, you lose." -#endif -#if SIZEOF_LONG == 8 -typedef unsigned long uint64; -typedef long int64; -#define VAL64(a) (a ## l) -#define UVAL64(a) (a ## ul) -#elif SIZEOF_LONG_LONG == 8 -typedef unsigned long long uint64; -typedef long long int64; -#define VAL64(a) (a ## LL) -#define UVAL64(a) (a ## uLL) -#else -#error "No 8 byte type, you lose." -#endif -#if SIZEOF_VOID_P == 4 -typedef uint32 uintptr; -typedef int32 intptr; -#elif SIZEOF_VOID_P == 8 -typedef uint64 uintptr; -typedef int64 intptr; -#else -#error "Unsupported size of pointer" -#endif - -// Define if the host processor supports fast unaligned load/stores -#if defined __i386__ || defined __x86_64__ -#define UNALIGNED_PROFITABLE 1 -#endif - - -/** - * Helper functions to byteswap data - **/ - -#if defined(__GNUC__) -#if defined(__x86_64__) || defined(__i386__) -// Linux/AMD64 currently has no asm optimized bswap_32() in -#define opt_bswap_32 do_opt_bswap_32 -static inline uint32 do_opt_bswap_32(uint32 x) -{ - uint32 v; - __asm__ __volatile__ ("bswap %0" : "=r" (v) : "0" (x)); - return v; -} -#endif -#endif - -#ifdef opt_bswap_16 -#undef bswap_16 -#define bswap_16 opt_bswap_16 -#endif -#ifndef bswap_16 -#define bswap_16 generic_bswap_16 -#endif - -static inline uint16 generic_bswap_16(uint16 x) -{ - return ((x & 0xff) << 8) | ((x >> 8) & 0xff); -} - -#ifdef opt_bswap_32 -#undef bswap_32 -#define bswap_32 opt_bswap_32 -#endif -#ifndef bswap_32 -#define bswap_32 generic_bswap_32 -#endif - -static inline uint32 generic_bswap_32(uint32 x) -{ - return (((x & 0xff000000) >> 24) | - ((x & 0x00ff0000) >> 8) | - ((x & 0x0000ff00) << 8) | - ((x & 0x000000ff) << 24) ); -} - -#if defined(__i386__) -#define opt_bswap_64 do_opt_bswap_64 -static inline uint64 do_opt_bswap_64(uint64 x) -{ - return (bswap_32(x >> 32) | (((uint64)bswap_32((uint32)x)) << 32)); -} -#endif - -#ifdef opt_bswap_64 -#undef bswap_64 -#define bswap_64 opt_bswap_64 -#endif -#ifndef bswap_64 -#define bswap_64 generic_bswap_64 -#endif - -static inline uint64 generic_bswap_64(uint64 x) -{ - return (((x & UVAL64(0xff00000000000000)) >> 56) | - ((x & UVAL64(0x00ff000000000000)) >> 40) | - ((x & UVAL64(0x0000ff0000000000)) >> 24) | - ((x & UVAL64(0x000000ff00000000)) >> 8) | - ((x & UVAL64(0x00000000ff000000)) << 8) | - ((x & UVAL64(0x0000000000ff0000)) << 24) | - ((x & UVAL64(0x000000000000ff00)) << 40) | - ((x & UVAL64(0x00000000000000ff)) << 56) ); -} - -#ifdef WORDS_BIGENDIAN -static inline uint16 tswap16(uint16 x) { return x; } -static inline uint32 tswap32(uint32 x) { return x; } -static inline uint64 tswap64(uint64 x) { return x; } -#else -static inline uint16 tswap16(uint16 x) { return bswap_16(x); } -static inline uint32 tswap32(uint32 x) { return bswap_32(x); } -static inline uint64 tswap64(uint64 x) { return bswap_64(x); } -#endif - -#define do_byteswap_16_g bswap_16 -#define do_byteswap_16_c(x) \ - ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)) - -#define do_byteswap_32_g bswap_32 -#define do_byteswap_32_c(x) \ - ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ - (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) - -#if defined(__GNUC__) -#define do_byteswap_16(x) \ - (__extension__ \ - ({ register uint16 __v, __x = (x); \ - if (__builtin_constant_p(__x)) \ - __v = do_byteswap_16_c(__x); \ - else \ - __v = do_byteswap_16_g(__x); \ - __v; })) - -#define do_byteswap_32(x) \ - (__extension__ \ - ({ register uint32 __v, __x = (x); \ - if (__builtin_constant_p(__x)) \ - __v = do_byteswap_32_c(__x); \ - else \ - __v = do_byteswap_32_g(__x); \ - __v; })) -#else -#define do_byteswap_16(x) do_byteswap_16_g(x) -#define do_byteswap_32(x) do_byteswap_32_g(x) -#endif - -#if defined(__i386__) || defined(__x86_64__) -#define ntohl(x) do_byteswap_32(x) -#define ntohs(x) do_byteswap_16(x) -#define htonl(x) do_byteswap_32(x) -#define htons(x) do_byteswap_16(x) -#endif - - -/* - * Spin locks - */ - -#ifdef __GNUC__ - -#if defined(__powerpc__) || defined(__ppc__) -#define HAVE_TEST_AND_SET 1 -static inline int testandset(volatile int *p) -{ - int ret; - __asm__ __volatile__("0: lwarx %0,0,%1\n" - " xor. %0,%3,%0\n" - " bne 1f\n" - " stwcx. %2,0,%1\n" - " bne- 0b\n" - "1: " - : "=&r" (ret) - : "r" (p), "r" (1), "r" (0) - : "cr0", "memory"); - return ret; -} -#endif - -#if defined(__i386__) || defined(__x86_64__) -#define HAVE_TEST_AND_SET 1 -static inline int testandset(volatile int *p) -{ - long int ret; - /* Note: the "xchg" instruction does not need a "lock" prefix */ - __asm__ __volatile__("xchgl %k0, %1" - : "=r" (ret), "=m" (*p) - : "0" (1), "m" (*p) - : "memory"); - return ret; -} -#endif - -#ifdef __alpha__ -#define HAVE_TEST_AND_SET 1 -static inline int testandset(volatile int *p) -{ - int ret; - unsigned long one; - - __asm__ __volatile__("0: mov 1,%2\n" - " ldl_l %0,%1\n" - " stl_c %2,%1\n" - " beq %2,1f\n" - ".subsection 2\n" - "1: br 0b\n" - ".previous" - : "=r" (ret), "=m" (*p), "=r" (one) - : "m" (*p)); - return ret; -} -#endif - -#endif /* __GNUC__ */ - -typedef volatile int spinlock_t; - -static const spinlock_t SPIN_LOCK_UNLOCKED = 0; - -#if HAVE_TEST_AND_SET -#define HAVE_SPINLOCKS 1 -static inline void spin_lock(spinlock_t *lock) -{ - while (testandset(lock)); -} - -static inline void spin_unlock(spinlock_t *lock) -{ - *lock = 0; -} - -static inline int spin_trylock(spinlock_t *lock) -{ - return !testandset(lock); -} -#else -static inline void spin_lock(spinlock_t *lock) -{ -} - -static inline void spin_unlock(spinlock_t *lock) -{ -} - -static inline int spin_trylock(spinlock_t *lock) -{ - return 1; -} -#endif - -// Time data type for Time Manager emulation -typedef int64 tm_time_t; - -// Timing functions -extern void timer_init(void); -extern uint64 GetTicks_usec(void); -extern void Delay_usec(uint32 usec); - -// Various definitions -typedef struct rgb_color { - uint8 red; - uint8 green; - uint8 blue; - uint8 alpha; -} rgb_color; - -// Macro for calling MacOS routines -#define CallMacOS(type, tvect) call_macos((uintptr)tvect) -#define CallMacOS1(type, tvect, arg1) call_macos1((uintptr)tvect, (uintptr)arg1) -#define CallMacOS2(type, tvect, arg1, arg2) call_macos2((uintptr)tvect, (uintptr)arg1, (uintptr)arg2) -#define CallMacOS3(type, tvect, arg1, arg2, arg3) call_macos3((uintptr)tvect, (uintptr)arg1, (uintptr)arg2, (uintptr)arg3) -#define CallMacOS4(type, tvect, arg1, arg2, arg3, arg4) call_macos4((uintptr)tvect, (uintptr)arg1, (uintptr)arg2, (uintptr)arg3, (uintptr)arg4) -#define CallMacOS5(type, tvect, arg1, arg2, arg3, arg4, arg5) call_macos5((uintptr)tvect, (uintptr)arg1, (uintptr)arg2, (uintptr)arg3, (uintptr)arg4, (uintptr)arg5) -#define CallMacOS6(type, tvect, arg1, arg2, arg3, arg4, arg5, arg6) call_macos6((uintptr)tvect, (uintptr)arg1, (uintptr)arg2, (uintptr)arg3, (uintptr)arg4, (uintptr)arg5, (uintptr)arg6) -#define CallMacOS7(type, tvect, arg1, arg2, arg3, arg4, arg5, arg6, arg7) call_macos7((uintptr)tvect, (uintptr)arg1, (uintptr)arg2, (uintptr)arg3, (uintptr)arg4, (uintptr)arg5, (uintptr)arg6, (uintptr)arg7) - -#ifdef __cplusplus -extern "C" { -#endif -extern uint32 call_macos(uint32 tvect); -extern uint32 call_macos1(uint32 tvect, uint32 arg1); -extern uint32 call_macos2(uint32 tvect, uint32 arg1, uint32 arg2); -extern uint32 call_macos3(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3); -extern uint32 call_macos4(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4); -extern uint32 call_macos5(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5); -extern uint32 call_macos6(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5, uint32 arg6); -extern uint32 call_macos7(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5, uint32 arg6, uint32 arg7); -#ifdef __cplusplus -} -#endif - -// Misc platform specific definitions -#ifdef __WIN32__ -typedef int64 loff_t; -#endif -#define ATTRIBUTE_PACKED __attribute__((__packed__)) - -#endif diff --git a/SheepShaver/src/Windows/timer_windows.cpp b/SheepShaver/src/Windows/timer_windows.cpp deleted file mode 120000 index b43201a9..00000000 --- a/SheepShaver/src/Windows/timer_windows.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Windows/timer_windows.cpp \ No newline at end of file diff --git a/SheepShaver/src/Windows/user_strings_windows.cpp b/SheepShaver/src/Windows/user_strings_windows.cpp deleted file mode 100755 index 92555c8f..00000000 --- a/SheepShaver/src/Windows/user_strings_windows.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* - * user_strings_windows.cpp - Localizable strings, Windows specific strings - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" -#include "user_strings.h" - - -// Platform-specific string definitions -user_string_def platform_strings[] = { - // Common strings that have a platform-specific variant - {STR_EXTFS_VOLUME_NAME, "My Computer"}, - - // Purely platform-specific strings - {STR_LOW_MEM_MMAP_ERR, "Cannot map Low Memory Globals: %s."}, - {STR_KD_SHMGET_ERR, "Cannot create SHM segment for Kernel Data: %s."}, - {STR_KD_SHMAT_ERR, "Cannot map first Kernel Data area: %s."}, - {STR_KD2_SHMAT_ERR, "Cannot map second Kernel Data area: %s."}, - {STR_ROM_MMAP_ERR, "Cannot map ROM: %s."}, - {STR_RAM_MMAP_ERR, "Cannot map RAM: %s."}, - {STR_DR_CACHE_MMAP_ERR, "Cannot map DR Cache: %s."}, - {STR_DR_EMULATOR_MMAP_ERR, "Cannot map DR Emulator: %s."}, - {STR_SHEEP_MEM_MMAP_ERR, "Cannot map SheepShaver Data area: %s."}, - {STR_NO_XVISUAL_ERR, "Cannot obtain appropriate X visual."}, - {STR_SLIRP_NO_DNS_FOUND_WARN, "Cannot get DNS address. Ethernet will not be available."}, - {STR_NO_AUDIO_WARN, "No audio device found, audio output will be disabled."}, - {STR_KEYCODE_FILE_WARN, "Cannot open keycode translation file %s (%s)."}, - {STR_KEYCODE_VENDOR_WARN, "Cannot find vendor '%s' in keycode translation file %s."}, - {STR_VOSF_INIT_ERR, "Cannot initialize Video on SEGV signals."}, - - {STR_OPEN_WINDOW_ERR, "Cannot open Mac window."}, - {STR_WINDOW_TITLE_GRABBED, "SheepShaver (mouse grabbed, press Ctrl-F5 to release)"}, - {STR_NO_WIN32_NT_4, "SheepShaver does not run on Windows NT versions less than 4.0"}, - - {STR_PREFS_MENU_FILE_GTK, "/_File"}, - {STR_PREFS_ITEM_START_GTK, "/File/_Start SheepShaver"}, - {STR_PREFS_ITEM_ZAP_PRAM_GTK, "/File/_Zap PRAM File"}, - {STR_PREFS_ITEM_SEPL_GTK, "/File/sepl"}, - {STR_PREFS_ITEM_QUIT_GTK, "/File/_Quit SheepShaver"}, - {STR_HELP_MENU_GTK, "/_Help"}, - {STR_HELP_ITEM_ABOUT_GTK, "/Help/_About SheepShaver"}, - - {STR_FILE_CTRL, "File"}, - {STR_BROWSE_TITLE, "Browse file"}, - {STR_BROWSE_CTRL, "Browse..."}, - {STR_SERIAL_PANE_TITLE, "Serial"}, - {STR_NETWORK_PANE_TITLE, "Network"}, - {STR_INPUT_PANE_TITLE, "Keyboard/Mouse"}, - {STR_KEYCODES_CTRL, "Use Raw Keycodes"}, - {STR_KEYCODE_FILE_CTRL, "Keycode Translation File"}, - {STR_MOUSEWHEELMODE_CTRL, "Mouse Wheel Function"}, - {STR_MOUSEWHEELMODE_PAGE_LAB, "Page Up/Down"}, - {STR_MOUSEWHEELMODE_CURSOR_LAB, "Cursor Up/Down"}, - {STR_MOUSEWHEELLINES_CTRL, "Lines To Scroll"}, - {STR_POLLMEDIA_CTRL, "Try to automatically detect new removable media (enable polling)"}, - {STR_EXTFS_ENABLE_CTRL, "Enable \"My Computer\" icon on your Mac desktop (external file system)"}, - {STR_EXTFS_DRIVES_CTRL, "Mount drives"}, - {STR_ETHER_FTP_PORT_LIST_CTRL, "FTP ports"}, - {STR_ETHER_TCP_PORT_LIST_CTRL, "Server ports"}, - - {-1, NULL} // End marker -}; - - -/* - * Search for main volume name - */ - -static const char *get_volume_name(void) -{ - HKEY hHelpKey; - DWORD key_type, cbData; - - static char volume[256]; - memset(volume, 0, sizeof(volume)); - - // Try Windows 2000 key first - if (ERROR_SUCCESS == RegOpenKey( - HKEY_CURRENT_USER, - "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CLSID\\{20D04FE0-3AEA-1069-A2D8-08002B30309D}", - &hHelpKey)) - { - cbData = sizeof(volume); - RegQueryValueEx( hHelpKey, 0, NULL, &key_type, (unsigned char *)volume, &cbData ); - RegCloseKey(hHelpKey); - } - - if (volume[0] == 0 && - ERROR_SUCCESS == RegOpenKey( - HKEY_CURRENT_USER, - "Software\\Classes\\CLSID\\{20D04FE0-3AEA-1069-A2D8-08002B30309D}", - &hHelpKey)) - { - cbData = sizeof(volume); - RegQueryValueEx( hHelpKey, 0, NULL, &key_type, (unsigned char *)volume, &cbData ); - RegCloseKey(hHelpKey); - } - - if (volume[0] == 0 && - ERROR_SUCCESS == RegOpenKey( - HKEY_CLASSES_ROOT, - "CLSID\\{20D04FE0-3AEA-1069-A2D8-08002B30309D}", - &hHelpKey)) - { - cbData = sizeof(volume); - RegQueryValueEx( hHelpKey, 0, NULL, &key_type, (unsigned char *)volume, &cbData ); - RegCloseKey(hHelpKey); - } - - // Fix the error that some "tweak" apps do. - if (stricmp(volume, "%USERNAME% on %COMPUTER%") == 0) - volume[0] = '\0'; - - // No volume name found, default to "My Computer" - if (volume[0] == 0) - strcpy(volume, "My Computer"); - - return volume; -} - - -/* - * Fetch pointer to string, given the string number - */ - -const char *GetString(int num) -{ - // First, search for platform-specific variable string - switch (num) { - case STR_EXTFS_VOLUME_NAME: - return get_volume_name(); - } - - // Next, search for platform-specific string - int i = 0; - while (platform_strings[i].num >= 0) { - if (platform_strings[i].num == num) - return platform_strings[i].str; - i++; - } - - // Not found, search for common string - i = 0; - while (common_strings[i].num >= 0) { - if (common_strings[i].num == num) - return common_strings[i].str; - i++; - } - return NULL; -} diff --git a/SheepShaver/src/Windows/user_strings_windows.h b/SheepShaver/src/Windows/user_strings_windows.h deleted file mode 100755 index 7980c5f7..00000000 --- a/SheepShaver/src/Windows/user_strings_windows.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * user_strings_windows.h - Windows-specific localizable strings - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef USER_STRINGS_WINDOWS_H -#define USER_STRINGS_WINDOWS_H - -enum { - STR_LOW_MEM_MMAP_ERR = 10000, - STR_KD_SHMGET_ERR, - STR_KD_SHMAT_ERR, - STR_KD2_SHMAT_ERR, - STR_ROM_MMAP_ERR, - STR_RAM_MMAP_ERR, - STR_DR_CACHE_MMAP_ERR, - STR_DR_EMULATOR_MMAP_ERR, - STR_SHEEP_MEM_MMAP_ERR, - STR_SIGSEGV_INSTALL_ERR, - STR_NO_XVISUAL_ERR, - STR_VOSF_INIT_ERR, - STR_SLIRP_NO_DNS_FOUND_WARN, - STR_NO_AUDIO_WARN, - STR_KEYCODE_FILE_WARN, - STR_KEYCODE_VENDOR_WARN, - STR_OPEN_WINDOW_ERR, - STR_WINDOW_TITLE_GRABBED, - STR_NO_WIN32_NT_4, - - STR_PREFS_MENU_FILE_GTK, - STR_PREFS_ITEM_START_GTK, - STR_PREFS_ITEM_ZAP_PRAM_GTK, - STR_PREFS_ITEM_SEPL_GTK, - STR_PREFS_ITEM_QUIT_GTK, - STR_HELP_MENU_GTK, - STR_HELP_ITEM_ABOUT_GTK, - - STR_FILE_CTRL, - STR_BROWSE_CTRL, - STR_BROWSE_TITLE, - STR_SERIAL_PANE_TITLE, - STR_NETWORK_PANE_TITLE, - STR_INPUT_PANE_TITLE, - STR_KEYCODES_CTRL, - STR_KEYCODE_FILE_CTRL, - STR_MOUSEWHEELMODE_CTRL, - STR_MOUSEWHEELMODE_PAGE_LAB, - STR_MOUSEWHEELMODE_CURSOR_LAB, - STR_MOUSEWHEELLINES_CTRL, - STR_POLLMEDIA_CTRL, - STR_EXTFS_ENABLE_CTRL, - STR_EXTFS_DRIVES_CTRL, - STR_ETHER_FTP_PORT_LIST_CTRL, - STR_ETHER_TCP_PORT_LIST_CTRL, -}; - -#endif diff --git a/SheepShaver/src/Windows/util_windows.cpp b/SheepShaver/src/Windows/util_windows.cpp deleted file mode 120000 index 74810981..00000000 --- a/SheepShaver/src/Windows/util_windows.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Windows/util_windows.cpp \ No newline at end of file diff --git a/SheepShaver/src/Windows/util_windows.h b/SheepShaver/src/Windows/util_windows.h deleted file mode 120000 index f875032d..00000000 --- a/SheepShaver/src/Windows/util_windows.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Windows/util_windows.h \ No newline at end of file diff --git a/SheepShaver/src/Windows/xpram_windows.cpp b/SheepShaver/src/Windows/xpram_windows.cpp deleted file mode 120000 index 4c317a37..00000000 --- a/SheepShaver/src/Windows/xpram_windows.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/Windows/xpram_windows.cpp \ No newline at end of file diff --git a/SheepShaver/src/adb.cpp b/SheepShaver/src/adb.cpp deleted file mode 120000 index 1cc36b98..00000000 --- a/SheepShaver/src/adb.cpp +++ /dev/null @@ -1 +0,0 @@ -../../BasiliskII/src/adb.cpp \ No newline at end of file diff --git a/SheepShaver/src/audio.cpp b/SheepShaver/src/audio.cpp deleted file mode 120000 index 3cc4fd95..00000000 --- a/SheepShaver/src/audio.cpp +++ /dev/null @@ -1 +0,0 @@ -../../BasiliskII/src/audio.cpp \ No newline at end of file diff --git a/SheepShaver/src/cdrom.cpp b/SheepShaver/src/cdrom.cpp deleted file mode 120000 index d97cd44d..00000000 --- a/SheepShaver/src/cdrom.cpp +++ /dev/null @@ -1 +0,0 @@ -../../BasiliskII/src/cdrom.cpp \ No newline at end of file diff --git a/SheepShaver/src/disk.cpp b/SheepShaver/src/disk.cpp deleted file mode 120000 index f994afaa..00000000 --- a/SheepShaver/src/disk.cpp +++ /dev/null @@ -1 +0,0 @@ -../../BasiliskII/src/disk.cpp \ No newline at end of file diff --git a/SheepShaver/src/dummy/audio_dummy.cpp b/SheepShaver/src/dummy/audio_dummy.cpp deleted file mode 120000 index 6c3904ce..00000000 --- a/SheepShaver/src/dummy/audio_dummy.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/dummy/audio_dummy.cpp \ No newline at end of file diff --git a/SheepShaver/src/dummy/clip_dummy.cpp b/SheepShaver/src/dummy/clip_dummy.cpp deleted file mode 120000 index d5f48422..00000000 --- a/SheepShaver/src/dummy/clip_dummy.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/dummy/clip_dummy.cpp \ No newline at end of file diff --git a/SheepShaver/src/dummy/ether_dummy.cpp b/SheepShaver/src/dummy/ether_dummy.cpp deleted file mode 100644 index 5046b051..00000000 --- a/SheepShaver/src/dummy/ether_dummy.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * ether_dummy.cpp - Ethernet device driver, dummy implementation - * - * Basilisk II (C) 1997-2008 Christian Bauer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" - -#include "cpu_emulation.h" -#include "main.h" -#include "ether.h" -#include "ether_defs.h" - -#define DEBUG 0 -#include "debug.h" - - -/* - * Init ethernet - */ - -void EtherInit(void) -{ -} - - -/* - * Exit ethernet - */ - -void EtherExit(void) -{ -} - - -/* - * Get ethernet hardware address - */ - -void AO_get_ethernet_address(uint32 addr) -{ -} - - -/* - * Enable multicast address - */ - -void AO_enable_multicast(uint32 addr) -{ -} - - -/* - * Disable multicast address - */ - -void AO_disable_multicast(uint32 addr) -{ -} - - -/* - * Transmit one packet - */ - -void AO_transmit_packet(uint32 mp) -{ -} - - -/* - * Ethernet interrupt - */ - -void EtherIRQ(void) -{ -} diff --git a/SheepShaver/src/dummy/prefs_dummy.cpp b/SheepShaver/src/dummy/prefs_dummy.cpp deleted file mode 100644 index d51409b5..00000000 --- a/SheepShaver/src/dummy/prefs_dummy.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * prefs_dummy.cpp - Dummy implementation of prefs_init() and prefs_exit(). - * - * Copyright (C) 2007 Alexei Svitkine - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" - -/* - * Initialization - */ - -void prefs_init(void) -{ -} - -/* - * Exit Deinitialization - */ - -void prefs_exit(void) -{ -} - diff --git a/SheepShaver/src/dummy/prefs_editor_dummy.cpp b/SheepShaver/src/dummy/prefs_editor_dummy.cpp deleted file mode 120000 index 66b5d559..00000000 --- a/SheepShaver/src/dummy/prefs_editor_dummy.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/dummy/prefs_editor_dummy.cpp \ No newline at end of file diff --git a/SheepShaver/src/dummy/scsi_dummy.cpp b/SheepShaver/src/dummy/scsi_dummy.cpp deleted file mode 120000 index ae968210..00000000 --- a/SheepShaver/src/dummy/scsi_dummy.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/dummy/scsi_dummy.cpp \ No newline at end of file diff --git a/SheepShaver/src/dummy/serial_dummy.cpp b/SheepShaver/src/dummy/serial_dummy.cpp deleted file mode 120000 index 26af78ab..00000000 --- a/SheepShaver/src/dummy/serial_dummy.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/dummy/serial_dummy.cpp \ No newline at end of file diff --git a/SheepShaver/src/emul_op.cpp b/SheepShaver/src/emul_op.cpp deleted file mode 100644 index 9e01554d..00000000 --- a/SheepShaver/src/emul_op.cpp +++ /dev/null @@ -1,496 +0,0 @@ -/* - * emul_op.cpp - 68k opcodes for ROM patches - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -#include "sysdeps.h" -#include "main.h" -#include "version.h" -#include "prefs.h" -#include "cpu_emulation.h" -#include "xlowmem.h" -#include "xpram.h" -#include "timer.h" -#include "adb.h" -#include "sony.h" -#include "disk.h" -#include "cdrom.h" -#include "scsi.h" -#include "video.h" -#include "audio.h" -#include "ether.h" -#include "serial.h" -#include "clip.h" -#include "extfs.h" -#include "macos_util.h" -#include "rom_patches.h" -#include "rsrc_patches.h" -#include "name_registry.h" -#include "user_strings.h" -#include "emul_op.h" -#include "thunks.h" - -#define DEBUG 0 -#include "debug.h" - - -// TVector of MakeExecutable -static uint32 MakeExecutableTvec; - - -/* - * Execute EMUL_OP opcode (called by 68k emulator) - */ - -void EmulOp(M68kRegisters *r, uint32 pc, int selector) -{ - D(bug("EmulOp %04x at %08x\n", selector, pc)); - switch (selector) { - case OP_BREAK: // Breakpoint - printf("*** Breakpoint\n"); - Dump68kRegs(r); - break; - - case OP_XPRAM1: { // Read/write from/to XPRam - uint32 len = r->d[3]; - uint8 *adr = Mac2HostAddr(r->a[3]); - D(bug("XPRAMReadWrite d3: %08lx, a3: %p\n", len, adr)); - int ofs = len & 0xffff; - len >>= 16; - if (len & 0x8000) { - len &= 0x7fff; - for (uint32 i=0; id[1] = XPRAM[(r->d[1] & 0xff) + 0x1300]; - break; - - case OP_XPRAM3: // Write to XPRam - XPRAM[(r->d[1] & 0xff) + 0x1300] = r->d[2]; - break; - - case OP_NVRAM1: { // Read from NVRAM - int ofs = r->d[0]; - r->d[0] = XPRAM[ofs & 0x1fff]; - bool localtalk = !(XPRAM[0x13e0] || XPRAM[0x13e1]); // LocalTalk enabled? - switch (ofs) { - case 0x13e0: // Disable LocalTalk (use EtherTalk instead) - if (localtalk) - r->d[0] = 0x00; - break; - case 0x13e1: - if (localtalk) - r->d[0] = 0x01; - break; - case 0x13e2: - if (localtalk) - r->d[0] = 0x00; - break; - case 0x13e3: - if (localtalk) - r->d[0] = 0x0a; - break; - } - break; - } - - case OP_NVRAM2: // Write to NVRAM - XPRAM[r->d[0] & 0x1fff] = r->d[1]; - break; - - case OP_NVRAM3: // Read/write from/to NVRAM - if (r->d[3]) { - r->d[0] = XPRAM[(r->d[4] + 0x1300) & 0x1fff]; - } else { - XPRAM[(r->d[4] + 0x1300) & 0x1fff] = r->d[5]; - r->d[0] = 0; - } - break; - - case OP_FIX_MEMTOP: // Fixes MemTop in BootGlobs during startup - D(bug("Fix MemTop\n")); - WriteMacInt32(BootGlobsAddr - 20, RAMBase + RAMSize); // MemTop - r->a[6] = RAMBase + RAMSize; - break; - - case OP_FIX_MEMSIZE: { // Fixes physical/logical RAM size during startup - D(bug("Fix MemSize\n")); - uint32 diff = ReadMacInt32(0x1ef8) - ReadMacInt32(0x1ef4); - WriteMacInt32(0x1ef8, RAMSize); // Physical RAM size - WriteMacInt32(0x1ef4, RAMSize - diff); // Logical RAM size - break; - } - - case OP_FIX_BOOTSTACK: // Fixes boot stack pointer in boot 3 resource - D(bug("Fix BootStack\n")); - r->a[1] = r->a[7] = RAMBase + RAMSize * 3 / 4; - break; - - case OP_SONY_OPEN: // Floppy driver functions - r->d[0] = SonyOpen(r->a[0], r->a[1]); - break; - case OP_SONY_PRIME: - r->d[0] = SonyPrime(r->a[0], r->a[1]); - break; - case OP_SONY_CONTROL: - r->d[0] = SonyControl(r->a[0], r->a[1]); - break; - case OP_SONY_STATUS: - r->d[0] = SonyStatus(r->a[0], r->a[1]); - break; - - case OP_DISK_OPEN: // Disk driver functions - r->d[0] = DiskOpen(r->a[0], r->a[1]); - break; - case OP_DISK_PRIME: - r->d[0] = DiskPrime(r->a[0], r->a[1]); - break; - case OP_DISK_CONTROL: - r->d[0] = DiskControl(r->a[0], r->a[1]); - break; - case OP_DISK_STATUS: - r->d[0] = DiskStatus(r->a[0], r->a[1]); - break; - - case OP_CDROM_OPEN: // CD-ROM driver functions - r->d[0] = CDROMOpen(r->a[0], r->a[1]); - break; - case OP_CDROM_PRIME: - r->d[0] = CDROMPrime(r->a[0], r->a[1]); - break; - case OP_CDROM_CONTROL: - r->d[0] = CDROMControl(r->a[0], r->a[1]); - break; - case OP_CDROM_STATUS: - r->d[0] = CDROMStatus(r->a[0], r->a[1]); - break; - - case OP_AUDIO_DISPATCH: // Audio component functions - r->d[0] = AudioDispatch(r->a[3], r->a[4]); - break; - - case OP_SOUNDIN_OPEN: // Sound input driver functions - r->d[0] = SoundInOpen(r->a[0], r->a[1]); - break; - case OP_SOUNDIN_PRIME: - r->d[0] = SoundInPrime(r->a[0], r->a[1]); - break; - case OP_SOUNDIN_CONTROL: - r->d[0] = SoundInControl(r->a[0], r->a[1]); - break; - case OP_SOUNDIN_STATUS: - r->d[0] = SoundInStatus(r->a[0], r->a[1]); - break; - case OP_SOUNDIN_CLOSE: - r->d[0] = SoundInClose(r->a[0], r->a[1]); - break; - - case OP_ADBOP: // ADBOp() replacement - ADBOp(r->d[0], Mac2HostAddr(ReadMacInt32(r->a[0]))); - break; - - case OP_INSTIME: // InsTime() replacement - r->d[0] = InsTime(r->a[0], r->d[1]); - break; - case OP_RMVTIME: // RmvTime() replacement - r->d[0] = RmvTime(r->a[0]); - break; - case OP_PRIMETIME: // PrimeTime() replacement - r->d[0] = PrimeTime(r->a[0], r->d[0]); - break; - - case OP_MICROSECONDS: // Microseconds() replacement - Microseconds(r->a[0], r->d[0]); - break; - - case OP_ZERO_SCRAP: // ZeroScrap() patch - ZeroScrap(); - break; - - case OP_PUT_SCRAP: // PutScrap() patch - PutScrap(ReadMacInt32(r->a[7] + 8), Mac2HostAddr(ReadMacInt32(r->a[7] + 4)), ReadMacInt32(r->a[7] + 12)); - break; - - case OP_GET_SCRAP: // GetScrap() patch - GetScrap((void **)Mac2HostAddr(ReadMacInt32(r->a[7] + 4)), ReadMacInt32(r->a[7] + 8), ReadMacInt32(r->a[7] + 12)); - break; - - case OP_DEBUG_STR: // DebugStr() shows warning message - if (PrefsFindBool("nogui")) { - uint8 *pstr = Mac2HostAddr(ReadMacInt32(r->a[7] + 4)); - char str[256]; - int i; - for (i=0; i> 8, M68K_EMUL_OP_DEBUG_STR & 0xFF, - 0x4e, 0x74, // rtd #4 - 0x00, 0x04 - }; - BUILD_SHEEPSHAVER_PROCEDURE(proc); - WriteMacInt32(0x1dfc, proc); - break; - } - - case OP_NAME_REGISTRY: // Patch Name Registry and initialize CallUniversalProc - r->d[0] = (uint32)-1; - PatchNameRegistry(); - InitCallUniversalProc(); - break; - - case OP_RESET: // Early in MacOS reset - D(bug("*** RESET ***\n")); - TimerReset(); - MacOSUtilReset(); - AudioReset(); - - // Enable DR emulator (disabled for now) - if (PrefsFindBool("jit68k") && 0) { - D(bug("DR activated\n")); - WriteMacInt32(KernelDataAddr + 0x17a0, 3); // Prepare for DR emulator activation - WriteMacInt32(KernelDataAddr + 0x17c0, DR_CACHE_BASE); - WriteMacInt32(KernelDataAddr + 0x17c4, DR_CACHE_SIZE); - WriteMacInt32(KernelDataAddr + 0x1b04, DR_CACHE_BASE); - WriteMacInt32(KernelDataAddr + 0x1b00, DR_EMULATOR_BASE); - memcpy((void *)DR_EMULATOR_BASE, (void *)(ROMBase + 0x370000), DR_EMULATOR_SIZE); - MakeExecutable(0, DR_EMULATOR_BASE, DR_EMULATOR_SIZE); - } - break; - - case OP_IRQ: // Level 1 interrupt - WriteMacInt16(ReadMacInt32(KernelDataAddr + 0x67c), 0); // Clear interrupt - r->d[0] = 0; - if (HasMacStarted()) { - if (InterruptFlags & INTFLAG_VIA) { - ClearInterruptFlag(INTFLAG_VIA); -#if !PRECISE_TIMING - TimerInterrupt(); -#endif - ExecuteNative(NATIVE_VIDEO_VBL); - - static int tick_counter = 0; - if (++tick_counter >= 60) { - tick_counter = 0; - SonyInterrupt(); - DiskInterrupt(); - CDROMInterrupt(); - } - - r->d[0] = 1; // Flag: 68k interrupt routine executes VBLTasks etc. - } - if (InterruptFlags & INTFLAG_SERIAL) { - ClearInterruptFlag(INTFLAG_SERIAL); - SerialInterrupt(); - } - if (InterruptFlags & INTFLAG_ETHER) { - ClearInterruptFlag(INTFLAG_ETHER); - ExecuteNative(NATIVE_ETHER_IRQ); - } - if (InterruptFlags & INTFLAG_TIMER) { - ClearInterruptFlag(INTFLAG_TIMER); - TimerInterrupt(); - } - if (InterruptFlags & INTFLAG_AUDIO) { - ClearInterruptFlag(INTFLAG_AUDIO); - AudioInterrupt(); - } - if (InterruptFlags & INTFLAG_ADB) { - ClearInterruptFlag(INTFLAG_ADB); - ADBInterrupt(); - } - } else - r->d[0] = 1; - break; - - case OP_SCSI_DISPATCH: { // SCSIDispatch() replacement - uint32 ret = ReadMacInt32(r->a[7]); - uint16 sel = ReadMacInt16(r->a[7] + 4); - r->a[7] += 6; -// D(bug("SCSIDispatch(%d)\n", sel)); - int stack; - switch (sel) { - case 0: // SCSIReset - WriteMacInt16(r->a[7], SCSIReset()); - stack = 0; - break; - case 1: // SCSIGet - WriteMacInt16(r->a[7], SCSIGet()); - stack = 0; - break; - case 2: // SCSISelect - case 11: // SCSISelAtn - WriteMacInt16(r->a[7] + 2, SCSISelect(ReadMacInt8(r->a[7] + 1))); - stack = 2; - break; - case 3: // SCSICmd - WriteMacInt16(r->a[7] + 6, SCSICmd(ReadMacInt16(r->a[7]), Mac2HostAddr(ReadMacInt32(r->a[7] + 2)))); - stack = 6; - break; - case 4: // SCSIComplete - WriteMacInt16(r->a[7] + 12, SCSIComplete(ReadMacInt32(r->a[7]), ReadMacInt32(r->a[7] + 4), ReadMacInt32(r->a[7] + 8))); - stack = 12; - break; - case 5: // SCSIRead - case 8: // SCSIRBlind - WriteMacInt16(r->a[7] + 4, SCSIRead(ReadMacInt32(r->a[7]))); - stack = 4; - break; - case 6: // SCSIWrite - case 9: // SCSIWBlind - WriteMacInt16(r->a[7] + 4, SCSIWrite(ReadMacInt32(r->a[7]))); - stack = 4; - break; - case 10: // SCSIStat - WriteMacInt16(r->a[7], SCSIStat()); - stack = 0; - break; - case 12: // SCSIMsgIn - WriteMacInt16(r->a[7] + 4, 0); - stack = 4; - break; - case 13: // SCSIMsgOut - WriteMacInt16(r->a[7] + 2, 0); - stack = 2; - break; - case 14: // SCSIMgrBusy - WriteMacInt16(r->a[7], SCSIMgrBusy()); - stack = 0; - break; - default: - printf("FATAL: SCSIDispatch: illegal selector\n"); - stack = 0; - //!! SysError(12) - } - r->a[0] = ret; - r->a[7] += stack; - break; - } - - case OP_SCSI_ATOMIC: // SCSIAtomic() replacement - D(bug("SCSIAtomic\n")); - r->d[0] = (uint32)-7887; - break; - - case OP_CHECK_SYSV: { // Check we are not using MacOS < 8.1 with a NewWorld ROM - r->a[1] = r->d[1]; - r->a[0] = ReadMacInt32(r->d[1]); - uint32 sysv = ReadMacInt16(r->a[0]); - D(bug("Detected MacOS version %d.%d.%d\n", (sysv >> 8) & 0xf, (sysv >> 4) & 0xf, sysv & 0xf)); - if (ROMType == ROMTYPE_NEWWORLD && sysv < 0x0801) - r->d[1] = 0; - break; - } - - case OP_NTRB_17_PATCH: - r->a[2] = ReadMacInt32(r->a[7]); - r->a[7] += 4; - if (ReadMacInt16(r->a[2] + 6) == 17) - PatchNativeResourceManager(); - break; - - case OP_NTRB_17_PATCH2: - r->a[7] += 8; - PatchNativeResourceManager(); - break; - - case OP_NTRB_17_PATCH3: - r->a[2] = ReadMacInt32(r->a[7]); - r->a[7] += 4; - D(bug("%d %d\n", ReadMacInt16(r->a[2]), ReadMacInt16(r->a[2] + 6))); - if (ReadMacInt16(r->a[2]) == 11 && ReadMacInt16(r->a[2] + 6) == 17) - PatchNativeResourceManager(); - break; - - case OP_NTRB_17_PATCH4: - r->d[0] = ReadMacInt16(r->a[7]); - r->a[7] += 2; - D(bug("%d %d\n", ReadMacInt16(r->a[2]), ReadMacInt16(r->a[2] + 6))); - if (ReadMacInt16(r->a[2]) == 11 && ReadMacInt16(r->a[2] + 6) == 17) - PatchNativeResourceManager(); - break; - - case OP_CHECKLOAD: { // vCheckLoad() patch - uint32 type = ReadMacInt32(r->a[7]); - r->a[7] += 4; - int16 id = ReadMacInt16(r->a[2]); - if (r->a[0] == 0) - break; - uint32 adr = ReadMacInt32(r->a[0]); - if (adr == 0) - break; - uint16 *p = (uint16 *)Mac2HostAddr(adr); - uint32 size = ReadMacInt32(adr - 8) & 0xffffff; - CheckLoad(type, id, p, size); - break; - } - - case OP_EXTFS_COMM: // External file system routines - WriteMacInt16(r->a[7] + 14, ExtFSComm(ReadMacInt16(r->a[7] + 12), ReadMacInt32(r->a[7] + 8), ReadMacInt32(r->a[7] + 4))); - break; - - case OP_EXTFS_HFS: - WriteMacInt16(r->a[7] + 20, ExtFSHFS(ReadMacInt32(r->a[7] + 16), ReadMacInt16(r->a[7] + 14), ReadMacInt32(r->a[7] + 10), ReadMacInt32(r->a[7] + 6), ReadMacInt16(r->a[7] + 4))); - break; - - case OP_IDLE_TIME: - // Sleep if no events pending - if (ReadMacInt32(0x14c) == 0) - idle_wait(); - r->a[0] = ReadMacInt32(0x2b6); - break; - - case OP_IDLE_TIME_2: - // Sleep if no events pending - if (ReadMacInt32(0x14c) == 0) - idle_wait(); - r->d[0] = (uint32)-2; - break; - - default: - printf("FATAL: EMUL_OP called with bogus selector %08x\n", selector); - QuitEmulator(); - break; - } -} diff --git a/SheepShaver/src/emul_ppc/emul_ppc.cpp b/SheepShaver/src/emul_ppc/emul_ppc.cpp deleted file mode 100644 index 10584d72..00000000 --- a/SheepShaver/src/emul_ppc/emul_ppc.cpp +++ /dev/null @@ -1,1661 +0,0 @@ -/* - * emul_ppc.cpp - PowerPC processor emulation - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* -TODO: -addme -addmeo -addze -addzeo -dcbst -dcbt -dcbtst -divwuo -fabs -fadd -fadds -fcmpo -fcmpu -fctiw -fctiwz -fdiv -fdivs -fmadd -fmadds -fmr -fmsub -fmsubs -fmul -fmuls -fnabs -fneg -fnmadd -fnmadds -fnmsub -fnmsubs -fres -frsp -frsqrte -fsel -fsqrt -fsqrts -fsub -fsubs -lfdu -lfdux -lfdx -lfs -lfsu -lfsux -lfsx -lhbrx -lwbrx -mcrfs -mcrxr -mtfsb0 -mtfsb1 -mtfsfi -mulhwu -mullwo -nego -sc -stfdu -stfdux -stfdx -stfs -stfsu -stfsux -stfsx -sthbrx -stwbrx -subfo -subfme -subfmeo -subfze -subfzeo -tw -twi - -CHECK: -crxor -creqv - */ - -#include -#include - -#include "sysdeps.h" -#include "cpu_emulation.h" -#include "main.h" -#include "xlowmem.h" -#include "emul_op.h" - -#if ENABLE_MON -#include "mon.h" -#include "mon_disass.h" -#endif - -#define DEBUG 1 -#include "debug.h" - -#define FLIGHT_RECORDER 1 - - -// PowerPC user mode registers -uint32 r[32]; -double fr[32]; -uint32 lr, ctr; -uint32 cr, xer; -uint32 fpscr; -uint32 pc; - -// Convert 8-bit field mask (e.g. mtcrf) to bit mask -static uint32 field2mask[256]; - - -/* - * Flight recorder - */ - -#if FLIGHT_RECORDER -struct rec_step { - uint32 r[32]; - double fr[32]; - uint32 lr, ctr; - uint32 cr, xer; - uint32 fpscr; - uint32 pc; - uint32 opcode; -}; - -const int LOG_SIZE = 8192; -static rec_step log[LOG_SIZE]; -static int log_ptr = 0; - -static void record_step(uint32 opcode) -{ - for (int i=0; i<32; i++) { - log[log_ptr].r[i] = r[i]; - log[log_ptr].fr[i] = fr[i]; - } - log[log_ptr].lr = lr; - log[log_ptr].ctr = ctr; - log[log_ptr].cr = cr; - log[log_ptr].xer = xer; - log[log_ptr].fpscr = fpscr; - log[log_ptr].pc = pc; - log[log_ptr].opcode = opcode; - log_ptr++; - if (log_ptr == LOG_SIZE) - log_ptr = 0; -} - -static void dump_log(void) -{ - FILE *f = fopen("log", "w"); - if (f == NULL) - return; - for (int i=0; i> 4) & 0x0f000000); -} - - -/* - * Convert mask begin/end to mask - */ - -static uint32 mbme2mask(uint32 op) -{ - uint32 mb = (op >> 6) & 0x1f; - uint32 me = (op >> 1) & 0x1f; - uint32 m = 0; - uint32 i; - - if (mb <= me) - for (i=mb; i<=me; i++) - m |= 0x80000000 >> i; - else { - for (i=0; i<=me; i++) - m |= 0x80000000 >> i; - for (i=mb; i<=31; i++) - m |= 0x80000000 >> i; - } - return m; -} - - -/* - * Emulate instruction with primary opcode = 19 - */ - -static void emul19(uint32 op) -{ - uint32 exop = (op >> 1) & 0x3ff; - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - switch (exop) { - - case 0: { // mcrf - uint32 crfd = 0x1c - (rd & 0x1c); - uint32 crfa = 0x1c - (ra & 0x1c); - uint32 crf = (cr >> crfa) & 0xf; - cr = (cr & ~(0xf << crfd)) | (crf << crfd); - break; - } - - case 16: { // bclr - uint32 oldpc = pc; - if (!(rd & 4)) { - ctr--; - if (rd & 2) { - if (ctr) - goto blr_nobranch; - } else { - if (!ctr) - goto blr_nobranch; - } - } - if (!(rd & 0x10)) { - if (rd & 8) { - if (!(cr & (0x80000000 >> ra))) - goto blr_nobranch; - } else { - if (cr & (0x80000000 >> ra)) - goto blr_nobranch; - } - } - pc = lr & 0xfffffffc; -blr_nobranch: - if (op & 1) - lr = oldpc; - break; - } - - case 33: // crnor - if ((cr & (0x80000000 >> ra)) || ((cr & (0x80000000 >> ((op >> 11) & 0x1f))))) - cr &= ~(0x80000000 >> rd); - else - cr |= 0x80000000 >> rd; - break; - - case 129: // crandc - if ((cr & (0x80000000 >> ra)) && !((cr & (0x80000000 >> ((op >> 11) & 0x1f))))) - cr |= 0x80000000 >> rd; - else - cr &= ~(0x80000000 >> rd); - break; - - case 150: // isync - break; - - case 193: { // crxor - uint32 mask = 0x80000000 >> rd; - cr = (((((cr >> (31 - ra)) ^ (cr >> (31 - ((op >> 11) & 0x1f)))) & 1) << (31 - rd)) & mask) | (cr & ~mask); - break; - } - - case 225: // crnand - if ((cr & (0x80000000 >> ra)) && ((cr & (0x80000000 >> ((op >> 11) & 0x1f))))) - cr &= ~(0x80000000 >> rd); - else - cr |= 0x80000000 >> rd; - break; - - case 257: // crand - if ((cr & (0x80000000 >> ra)) && ((cr & (0x80000000 >> ((op >> 11) & 0x1f))))) - cr |= 0x80000000 >> rd; - else - cr &= ~(0x80000000 >> rd); - break; - - case 289: { // creqv - uint32 mask = 0x80000000 >> rd; - cr = (((~((cr >> (31 - ra)) ^ (cr >> (31 - ((op >> 11) & 0x1f)))) & 1) << (31 - rd)) & mask) | (cr & ~mask); - break; - } - - case 417: // crorc - if ((cr & (0x80000000 >> ra)) || !((cr & (0x80000000 >> ((op >> 11) & 0x1f))))) - cr |= 0x80000000 >> rd; - else - cr &= ~(0x80000000 >> rd); - break; - - case 449: // cror - if ((cr & (0x80000000 >> ra)) || ((cr & (0x80000000 >> ((op >> 11) & 0x1f))))) - cr |= 0x80000000 >> rd; - else - cr &= ~(0x80000000 >> rd); - break; - - case 528: { // bcctr - if (op & 1) - lr = pc; - if (!(rd & 4)) { - ctr--; - if (rd & 2) { - if (ctr) - goto bctr_nobranch; - } else { - if (!ctr) - goto bctr_nobranch; - } - } - if (!(rd & 0x10)) { - if (rd & 8) { - if (!(cr & (0x80000000 >> ra))) - goto bctr_nobranch; - } else { - if (cr & (0x80000000 >> ra)) - goto bctr_nobranch; - } - } - pc = ctr & 0xfffffffc; -bctr_nobranch: - break; - } - - default: - printf("Illegal 19 opcode %08x (exop %d) at %08x\n", op, exop, pc-4); - dump(); - break; - } -} - - -/* - * Emulate instruction with primary opcode = 31 - */ - -static void emul31(uint32 op) -{ - uint32 exop = (op >> 1) & 0x3ff; - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - uint32 rb = (op >> 11) & 0x1f; - switch (exop) { - - case 0: { // cmpw - uint32 crfd = 0x1c - (rd & 0x1c); - uint8 crf = 0; - if (r[ra] == r[rb]) - crf |= 2; - else if ((int32)r[ra] < (int32)r[rb]) - crf |= 8; - else - crf |= 4; - if (xer & 0x80000000) - crf |= 1; - cr = (cr & ~(0xf << crfd)) | (crf << crfd); - break; - } - - case 8: { // subfc - uint64 tmp = (uint64)r[rb] - (uint64)r[ra]; - r[rd] = tmp; - if (tmp & 0x100000000LL) - xer &= ~0x20000000; - else - xer |= 0x20000000; - if (op & 1) - record(r[rd]); - break; - } - - case 10: { // addc - uint64 tmp = (uint64)r[ra] + (uint64)r[rb]; - r[rd] = tmp; - if (tmp & 0x100000000LL) - xer |= 0x20000000; - else - xer &= ~0x20000000; - if (op & 1) - record(r[rd]); - break; - } - - case 19: // mfcr - r[rd] = cr; - break; - - case 20: // lwarx - r[rd] = ReadMacInt32(r[rb] + (ra ? r[ra] : 0)); - //!! set reservation bit - break; - - case 23: // lwzx - r[rd] = ReadMacInt32(r[rb] + (ra ? r[ra] : 0)); - break; - - case 24: // slw - r[ra] = r[rd] << (r[rb] & 0x3f); - if (op & 1) - record(r[ra]); - break; - - case 26: { // cntlzw - uint32 mask = 0x80000000; - for (int i=0; i<32; i++, mask>>=1) { - if (r[rd] & mask) { - r[ra] = i; - goto cntlzw_done; - } - } - r[ra] = 32; -cntlzw_done:if (op & 1) - record(r[ra]); - break; - } - - case 28: // and - r[ra] = r[rd] & r[rb]; - if (op & 1) - record(r[ra]); - break; - - case 32: { // cmplw - uint32 crfd = 0x1c - (rd & 0x1c); - uint8 crf = 0; - if (r[ra] == r[rb]) - crf |= 2; - else if (r[ra] < r[rb]) - crf |= 8; - else - crf |= 4; - if (xer & 0x80000000) - crf |= 1; - cr = (cr & ~(0xf << crfd)) | (crf << crfd); - break; - } - - case 40: // subf - r[rd] = r[rb] - r[ra]; - if (op & 1) - record(r[rd]); - break; - - case 55: // lwzux - r[ra] += r[rb]; - r[rd] = ReadMacInt32(r[ra]); - break; - - case 60: // andc - r[ra] = r[rd] & ~r[rb]; - if (op & 1) - record(r[ra]); - break; - - case 75: // mulhw - r[rd] = ((int64)(int32)r[ra] * (int32)r[rb]) >> 32; - if (op & 1) - record(r[rd]); - break; - - case 86: // dcbf - break; - - case 87: // lbzx - r[rd] = ReadMacInt8(r[rb] + (ra ? r[ra] : 0)); - break; - - case 104: // neg - if (r[ra] == 0x80000000) - r[rd] = 0x80000000; - else - r[rd] = -(int32)r[ra]; - if (op & 1) - record(r[rd]); - break; - - case 119: // lbzux - r[ra] += r[rb]; - r[rd] = ReadMacInt8(r[ra]); - break; - - case 124: // nor - r[ra] = ~(r[rd] | r[rb]); - if (op & 1) - record(r[ra]); - break; - - case 136: { // subfe - uint64 tmp = (uint64)r[rb] - (uint64)r[ra]; - if (!(xer & 0x20000000)) - tmp--; - r[rd] = tmp; - if (tmp & 0x100000000LL) - xer &= ~0x20000000; - else - xer |= 0x20000000; - if (op & 1) - record(r[rd]); - break; - } - - case 138: { // adde - uint64 tmp = (uint64)r[ra] + (uint64)r[rb]; - if (xer & 0x20000000) - tmp++; - r[rd] = tmp; - if (tmp & 0x100000000LL) - xer |= 0x20000000; - else - xer &= ~0x20000000; - if (op & 1) - record(r[rd]); - break; - } - - case 144: { // mtcrf - uint32 mask = field2mask[(op >> 12) & 0xff]; - cr = (r[rd] & mask) | (cr & ~mask); - break; - } - - case 150: // stwcx - //!! check reserved bit - WriteMacInt32(r[rb] + (ra ? r[ra] : 0), r[rd]); - record(0); - break; - - case 151: // stwx - WriteMacInt32(r[rb] + (ra ? r[ra] : 0), r[rd]); - break; - - case 183: // stwux - r[ra] += r[rb]; - WriteMacInt32(r[ra], r[rd]); - break; - - case 215: // stbx - WriteMacInt8(r[rb] + (ra ? r[ra] : 0), r[rd]); - break; - - case 235: // mullw - r[rd] = (int32)r[ra] * (int32)r[rb]; - if (op & 1) - record(r[rd]); - break; - - case 247: // stbux - r[ra] += r[rb]; - WriteMacInt8(r[ra], r[rd]); - break; - - case 266: // add - r[rd] = r[ra] + r[rb]; - if (op & 1) - record(r[rd]); - break; - - case 279: // lhzx - r[rd] = ReadMacInt16(r[rb] + (ra ? r[ra] : 0)); - break; - - case 284: // eqv - r[ra] = ~(r[rd] ^ r[rb]); - if (op & 1) - record(r[ra]); - break; - - case 311: // lhzux - r[ra] += r[rb]; - r[rd] = ReadMacInt16(r[ra]); - break; - - case 316: // xor - r[ra] = r[rd] ^ r[rb]; - if (op & 1) - record(r[ra]); - break; - - case 339: { // mfspr - uint32 spr = ra | (rb << 5); - switch (spr) { - case 1: r[rd] = xer; break; - case 8: r[rd] = lr; break; - case 9: r[rd] = ctr; break; - default: - printf("Illegal mfspr opcode %08x at %08x\n", op, pc-4); - dump(); - } - break; - } - - case 343: // lhax - r[rd] = (int32)(int16)ReadMacInt16(r[rb] + (ra ? r[ra] : 0)); - break; - - case 371: // mftb - r[rd] = 0; //!! - break; - - case 375: // lhaux - r[ra] += r[rb]; - r[rd] = (int32)(int16)ReadMacInt16(r[ra]); - break; - - case 407: // sthx - WriteMacInt16(r[rb] + (ra ? r[ra] : 0), r[rd]); - break; - - case 412: // orc - r[ra] = r[rd] | ~r[rb]; - if (op & 1) - record(r[ra]); - break; - - case 439: // sthux - r[ra] += r[rb]; - WriteMacInt16(r[ra], r[rd]); - break; - - case 444: // or - r[ra] = r[rd] | r[rb]; - if (op & 1) - record(r[ra]); - break; - - case 459: // divwu - if (r[rb]) - r[rd] = r[ra] / r[rb]; - if (op & 1) - record(r[rd]); - break; - - case 467: { // mtspr - uint32 spr = ra | (rb << 5); - switch (spr) { - case 1: xer = r[rd] & 0xe000007f; break; - case 8: lr = r[rd]; break; - case 9: ctr = r[rd]; break; - default: - printf("Illegal mtspr opcode %08x at %08x\n", op, pc-4); - dump(); - } - break; - } - - case 476: // nand - r[ra] = ~(r[rd] & r[rb]); - if (op & 1) - record(r[ra]); - break; - - case 491: // divw - if (r[rb]) - r[rd] = (int32)r[ra] / (int32)r[rb]; - if (op & 1) - record(r[rd]); - break; - - case 520: { // subfco - uint64 tmp = (uint64)r[rb] - (uint64)r[ra]; - uint32 ov = (r[ra] ^ r[rb]) & ((uint32)tmp ^ r[rb]); - r[rd] = tmp; - if (tmp & 0x100000000LL) - xer &= ~0x20000000; - else - xer |= 0x20000000; - if (ov & 0x80000000) - xer |= 0xc0000000; - else - xer &= ~0x40000000; - if (op & 1) - record(r[rd]); - break; - } - - case 522: { // addco - uint64 tmp = (uint64)r[ra] + (uint64)r[rb]; - uint32 ov = (r[ra] ^ (uint32)tmp) & (r[rb] ^ (uint32)tmp); - r[rd] = tmp; - if (tmp & 0x100000000LL) - xer |= 0x20000000; - else - xer &= ~0x20000000; - if (ov & 0x80000000) - xer |= 0xc0000000; - else - xer &= ~0x40000000; - if (op & 1) - record(r[rd]); - break; - } - - case 533: { // lswx - uint32 addr = r[rb] + (ra ? r[ra] : 0); - int nb = xer & 0x7f; - int reg = rd; - for (int i=0; i> (r[rb] & 0x3f); - if (op & 1) - record(r[ra]); - break; - - case 597: { // lswi - uint32 addr = ra ? r[ra] : 0; - int nb = rb ? rb : 32; - int reg = rd; - for (int i=0; i> shift)); - shift -= 8; - if ((i & 3) == 3) { - shift = 24; - reg = (reg + 1) & 0x1f; - } - } - break; - } - - case 725: { // stswi - uint32 addr = ra ? r[ra] : 0; - int nb = rb ? rb : 32; - int reg = rd; - int shift = 24; - for (int i=0; i> shift)); - shift -= 8; - if ((i & 3) == 3) { - shift = 24; - reg = (reg + 1) & 0x1f; - } - } - break; - } - - case 778: { // addo - uint32 tmp = r[ra] + r[rb]; - uint32 ov = (r[ra] ^ tmp) & (r[rb] ^ tmp); - r[rd] = tmp; - if (ov & 0x80000000) - xer |= 0xc0000000; - else - xer &= ~0x40000000; - if (op & 1) - record(r[rd]); - break; - } - - case 792: { // sraw - uint32 sh = r[rb] & 0x3f; - uint32 mask = ~(0xffffffff << sh); - if ((r[rd] & 0x80000000) && (r[rd] & mask)) - xer |= 0x20000000; - else - xer &= ~0x20000000; - r[ra] = (int32)r[rd] >> sh; - if (op & 1) - record(r[ra]); - break; - } - - case 824: { // srawi - uint32 mask = ~(0xffffffff << rb); - if ((r[rd] & 0x80000000) && (r[rd] & mask)) - xer |= 0x20000000; - else - xer &= ~0x20000000; - r[ra] = (int32)r[rd] >> rb; - if (op & 1) - record(r[ra]); - break; - } - - case 854: // eieio - break; - - case 922: // extsh - r[ra] = (int32)(int16)r[rd]; - if (op & 1) - record(r[ra]); - break; - - case 954: // extsb - r[ra] = (int32)(int8)r[rd]; - if (op & 1) - record(r[ra]); - break; - - case 982: // icbi - break; - - case 1003: // divwo - if (r[rb] == 0 || (r[ra] == 0x80000000 && r[rb] == 0xffffffff)) - xer |= 0xc0000000; - else { - r[rd] = (int32)r[ra] / (int32)r[rb]; - xer &= ~0x40000000; - } - if (op & 1) - record(r[rd]); - break; - -#if 0 - case 1014: // dcbz - memset(r[rb] + (ra ? r[ra] : 0), 0, 32); - break; -#endif - - default: - printf("Illegal 31 opcode %08x (exop %d) at %08x\n", op, exop, pc-4); - dump(); - break; - } -} - - -/* - * Emulate instruction with primary opcode = 59 - */ - -static void emul59(uint32 op) -{ - uint32 exop = (op >> 1) & 0x3ff; - switch (exop) { - default: - printf("Illegal 59 opcode %08x (exop %d) at %08x\n", op, exop, pc-4); - dump(); - break; - } -} - - -/* - * Emulate instruction with primary opcode = 63 - */ - -static void emul63(uint32 op) -{ - uint32 exop = (op >> 1) & 0x3ff; - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - uint32 rb = (op >> 11) & 0x1f; - switch (exop) { - - case 583: // mffs - fr[rd] = (double)(uint64)fpscr; - if (op & 1) - record1(); - break; - - case 711: // mtfsf - //!! - if (op & 1) - record1(); - break; - - default: - printf("Illegal 63 opcode %08x (exop %d) at %08x\n", op, exop, pc-4); - dump(); - break; - } -} - - -/* - * Emulation loop - */ - -void emul_ppc(uint32 start) -{ - pc = start; -//uint32 old_val = 0; - for (;;) { -//uint32 val = ReadMacInt32(0x68fff778); -//if (val != old_val) { -// printf("insn at %08lx changed %08lx->%08lx\n", pc-4, old_val, val); -// old_val = val; -//} - uint32 op = ReadMacInt32(pc); -#if FLIGHT_RECORDER - record_step(op); -#endif -// printf("%08lx at %08lx\n", op, pc); - uint32 primop = op >> 26; - pc += 4; - switch (primop) { - - case 6: // SheepShaver extensions - printf("Extended opcode %08x at %08x (68k pc %08x)\n", op, pc-4, r[24]); - switch (op & 0x3f) { - case 0: // EMUL_RETURN - QuitEmulator(); - break; - - case 1: // EXEC_RETURN - //!! - dump(); - break; - - default: { // EMUL_OP - M68kRegisters r68; - WriteMacInt32(XLM_68K_R25, r[25]); - WriteMacInt32(XLM_RUN_MODE, MODE_EMUL_OP); - for (int i=0; i<8; i++) - r68.d[i] = r[8 + i]; - for (int i=0; i<7; i++) - r68.a[i] = r[16 + i]; - r68.a[7] = r[1]; - EmulOp(&r68, r[24], (op & 0x3f) - 2); - for (int i=0; i<8; i++) - r[8 + i] = r68.d[i]; - for (int i=0; i<7; i++) - r[16 + i] = r68.a[i]; - r[1] = r68.a[7]; - WriteMacInt32(XLM_RUN_MODE, MODE_68K); - break; - } - } - break; - - case 7: { // mulli - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - r[rd] = (int32)r[ra] * (int32)(int16)(op & 0xffff); - break; - } - - case 8: { // subfic - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - uint64 tmp = (uint32)(int32)(int16)(op & 0xffff) - (uint64)r[ra]; - r[rd] = tmp; - if (tmp & 0x100000000LL) - xer &= ~0x20000000; - else - xer |= 0x20000000; - break; - } - - case 10: { // cmpli - uint32 crfd = 0x1c - ((op >> 21) & 0x1c); - uint32 ra = (op >> 16) & 0x1f; - uint32 val = (op & 0xffff); - uint8 crf = 0; - if (r[ra] == val) - crf |= 2; - else if (r[ra] < val) - crf |= 8; - else - crf |= 4; - if (xer & 0x80000000) - crf |= 1; - cr = (cr & ~(0xf << crfd)) | (crf << crfd); - break; - } - - case 11: { // cmpi - uint32 crfd = 0x1c - ((op >> 21) & 0x1c); - uint32 ra = (op >> 16) & 0x1f; - int32 val = (int32)(int16)(op & 0xffff); - uint8 crf = 0; - if ((int32)r[ra] == val) - crf |= 2; - else if ((int32)r[ra] < val) - crf |= 8; - else - crf |= 4; - if (xer & 0x80000000) - crf |= 1; - cr = (cr & ~(0xf << crfd)) | (crf << crfd); - break; - } - - case 12: { // addic - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - uint64 tmp = (uint64)r[ra] + (uint32)(int32)(int16)(op & 0xffff); - r[rd] = tmp; - if (tmp & 0x100000000LL) - xer |= 0x20000000; - else - xer &= ~0x20000000; - break; - } - - case 13: { // addic. - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - uint64 tmp = (uint64)r[ra] + (uint32)(int32)(int16)(op & 0xffff); - r[rd] = tmp; - if (tmp & 0x100000000LL) - xer |= 0x20000000; - else - xer &= ~0x20000000; - record(r[rd]); - break; - } - - case 14: { // addi - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - r[rd] = (ra ? r[ra] : 0) + (int32)(int16)(op & 0xffff); - break; - } - - case 15: { // addis - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - r[rd] = (ra ? r[ra] : 0) + (op << 16); - break; - } - - case 16: { // bc - uint32 bo = (op >> 21) & 0x1f; - uint32 bi = (op >> 16) & 0x1f; - if (op & 1) - lr = pc; - if (!(bo & 4)) { - ctr--; - if (bo & 2) { - if (ctr) - goto bc_nobranch; - } else { - if (!ctr) - goto bc_nobranch; - } - } - if (!(bo & 0x10)) { - if (bo & 8) { - if (!(cr & (0x80000000 >> bi))) - goto bc_nobranch; - } else { - if (cr & (0x80000000 >> bi)) - goto bc_nobranch; - } - } - if (op & 2) - pc = (int32)(int16)(op & 0xfffc); - else - pc += (int32)(int16)(op & 0xfffc) - 4; -bc_nobranch: - break; - } - - case 18: { // b - int32 target = op & 0x03fffffc; - if (target & 0x02000000) - target |= 0xfc000000; - if (op & 1) - lr = pc; - if (op & 2) - pc = target; - else - pc += target - 4; - break; - } - - case 19: - emul19(op); - break; - - case 20: { // rlwimi - uint32 rs = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - uint32 sh = (op >> 11) & 0x1f; - uint32 mask = mbme2mask(op); - r[ra] = (((r[rs] << sh) | (r[rs] >> (32-sh))) & mask) | (r[ra] & ~mask); - if (op & 1) - record(r[ra]); - break; - } - - case 21: { // rlwinm - uint32 rs = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - uint32 sh = (op >> 11) & 0x1f; - r[ra] = ((r[rs] << sh) | (r[rs] >> (32-sh))) & mbme2mask(op); - if (op & 1) - record(r[ra]); - break; - } - - case 23: { // rlwnm - uint32 rs = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - uint32 sh = r[(op >> 11) & 0x1f] & 0x1f; - r[ra] = ((r[rs] << sh) | (r[rs] >> (32-sh))) & mbme2mask(op); - if (op & 1) - record(r[ra]); - break; - } - - case 24: { // ori - uint32 rs = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - r[ra] = r[rs] | (op & 0xffff); - break; - } - - case 25: { // oris - uint32 rs = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - r[ra] = r[rs] | (op << 16); - break; - } - - case 26: { // xori - uint32 rs = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - r[ra] = r[rs] ^ (op & 0xffff); - break; - } - - case 27: { // xoris - uint32 rs = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - r[ra] = r[rs] ^ (op << 16); - break; - } - - case 28: { // andi. - uint32 rs = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - r[ra] = r[rs] & (op & 0xffff); - record(r[ra]); - break; - } - - case 29: { // andis. - uint32 rs = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - r[ra] = r[rs] & (op << 16); - record(r[ra]); - break; - } - - case 31: - emul31(op); - break; - - case 32: { // lwz - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - r[rd] = ReadMacInt32(int16(op & 0xffff) + (ra ? r[ra] : 0)); - break; - } - - case 33: { // lwzu - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - r[ra] += int16(op & 0xffff); - r[rd] = ReadMacInt32(r[ra]); - break; - } - - case 34: { // lbz - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - r[rd] = ReadMacInt8(int16(op & 0xffff) + (ra ? r[ra] : 0)); - break; - } - - case 35: { // lbzu - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - r[ra] += int16(op & 0xffff); - r[rd] = ReadMacInt8(r[ra]); - break; - } - - case 36: { // stw - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - WriteMacInt32(int16(op & 0xffff) + (ra ? r[ra] : 0), r[rd]); - break; - } - - case 37: { // stwu - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - r[ra] += int16(op & 0xffff); - WriteMacInt32(r[ra], r[rd]); - break; - } - - case 38: { // stb - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - WriteMacInt8(int16(op & 0xffff) + (ra ? r[ra] : 0), r[rd]); - break; - } - - case 39: { // stbu - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - r[ra] += int16(op & 0xffff); - WriteMacInt8(r[ra], r[rd]); - break; - } - - case 40: { // lhz - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - r[rd] = ReadMacInt16(int16(op & 0xffff) + (ra ? r[ra] : 0)); - break; - } - - case 41: { // lhzu - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - r[ra] += int16(op & 0xffff); - r[rd] = ReadMacInt16(r[ra]); - break; - } - - case 42: { // lha - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - r[rd] = (int32)(int16)ReadMacInt16(int16(op & 0xffff) + (ra ? r[ra] : 0)); - break; - } - - case 43: { // lhau - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - r[ra] += int16(op & 0xffff); - r[rd] = (int32)(int16)ReadMacInt16(r[ra]); - break; - } - - case 44: { // sth - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - WriteMacInt16(int16(op & 0xffff) + (ra ? r[ra] : 0), r[rd]); - break; - } - - case 45: { // sthu - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - r[ra] += int16(op & 0xffff); - WriteMacInt16(r[ra], r[rd]); - break; - } - - case 46: { // lmw - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - uint32 addr = int16(op & 0xffff) + (ra ? r[ra] : 0); - while (rd <= 31) { - r[rd] = ReadMacInt32(addr); - rd++; - addr += 4; - } - break; - } - - case 47: { // stmw - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - uint32 addr = int16(op & 0xffff) + (ra ? r[ra] : 0); - while (rd <= 31) { - WriteMacInt32(addr, r[rd]); - rd++; - addr += 4; - } - break; - } - - case 50: { // lfd - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - fr[rd] = (double)ReadMacInt64(int16(op & 0xffff) + (ra ? r[ra] : 0)); - break; - } - - case 54: { // stfd - uint32 rd = (op >> 21) & 0x1f; - uint32 ra = (op >> 16) & 0x1f; - WriteMacInt64(int16(op & 0xffff) + (ra ? r[ra] : 0), (uint64)fr[rd]); - break; - } - - case 59: - emul59(op); - break; - - case 63: - emul63(op); - break; - - default: - printf("Illegal opcode %08x at %08x\n", op, pc-4); - dump(); - break; - } - } -} - - -static struct sigaction sigsegv_action; - -static void sigsegv_handler(int sig) -{ - printf("SIGSEGV\n"); - dump(); -} - -void init_emul_ppc(void) -{ - // Init field2mask - for (int i=0; i<256; i++) { - uint32 mask = 0; - if (i & 0x01) mask |= 0x0000000f; - if (i & 0x02) mask |= 0x000000f0; - if (i & 0x04) mask |= 0x00000f00; - if (i & 0x08) mask |= 0x0000f000; - if (i & 0x10) mask |= 0x000f0000; - if (i & 0x20) mask |= 0x00f00000; - if (i & 0x40) mask |= 0x0f000000; - if (i & 0x80) mask |= 0xf0000000; - field2mask[i] = mask; - } - - // Init registers - for (int i=0; i<32; i++) { - r[i] = 0; - fr[i] = 0.0; - } - lr = ctr = 0; - cr = xer = 0; - fpscr = 0; - - r[3] = ROMBase + 0x30d000; - - // Install SIGSEGV handler - sigemptyset(&sigsegv_action.sa_mask); - sigsegv_action.sa_handler = (__sighandler_t)sigsegv_handler; - sigsegv_action.sa_flags = 0; - sigsegv_action.sa_restorer = NULL; - sigaction(SIGSEGV, &sigsegv_action, NULL); - -#if FLIGHT_RECORDER && ENABLE_MON - // Install "log" command in mon - mon_add_command("log", dump_log, "log Dump PowerPC emulation log\n"); -#endif -} - - -/* - * Execute 68k subroutine (must be ended with EXEC_RETURN) - * This must only be called by the emul_thread when in EMUL_OP mode - * r->a[7] is unused, the routine runs on the caller's stack - */ - -void Execute68k(uint32 pc, M68kRegisters *r) -{ - printf("ERROR: Execute68k() unimplemented\n"); - QuitEmulator(); -} - - -/* - * Execute 68k A-Trap from EMUL_OP routine - * r->a[7] is unused, the routine runs on the caller's stack - */ - -void Execute68kTrap(uint16 trap, M68kRegisters *r) -{ - printf("ERROR: Execute68kTrap() unimplemented\n"); - QuitEmulator(); -} - - -/* - * Call MacOS PPC code - */ - -uint32 call_macos(uint32 tvect) -{ - printf("ERROR: call_macos() unimplemented\n"); - QuitEmulator(); - return 0; -} - -uint32 call_macos1(uint32 tvect, uint32 arg1) -{ - printf("ERROR: call_macos1() unimplemented\n"); - QuitEmulator(); - return 0; -} - -uint32 call_macos2(uint32 tvect, uint32 arg1, uint32 arg2) -{ - printf("ERROR: call_macos2() unimplemented\n"); - QuitEmulator(); - return 0; -} - -uint32 call_macos3(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3) -{ - printf("ERROR: call_macos3() unimplemented\n"); - QuitEmulator(); - return 0; -} - -uint32 call_macos4(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4) -{ - printf("ERROR: call_macos4() unimplemented\n"); - QuitEmulator(); - return 0; -} - -uint32 call_macos5(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5) -{ - printf("ERROR: call_macos5() unimplemented\n"); - QuitEmulator(); - return 0; -} - -uint32 call_macos6(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5, uint32 arg6) -{ - printf("ERROR: call_macos6() unimplemented\n"); - QuitEmulator(); - return 0; -} - -uint32 call_macos7(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5, uint32 arg6, uint32 arg7) -{ - printf("ERROR: call_macos7() unimplemented\n"); - QuitEmulator(); - return 0; -} - - -/* - * Atomic operations - */ - -extern int atomic_add(int *var, int v) -{ - int ret = *var; - *var += v; - return ret; -} - -extern int atomic_and(int *var, int v) -{ - int ret = *var; - *var &= v; - return ret; -} - -extern int atomic_or(int *var, int v) -{ - int ret = *var; - *var |= v; - return ret; -} - - -extern "C" void get_resource(void); -extern "C" void get_1_resource(void); -extern "C" void get_ind_resource(void); -extern "C" void get_1_ind_resource(void); -extern "C" void r_get_resource(void); - -void get_resource(void) -{ - printf("ERROR: get_resource() unimplemented\n"); - QuitEmulator(); -} - -void get_1_resource(void) -{ - printf("ERROR: get_1_resource() unimplemented\n"); - QuitEmulator(); -} - -void get_ind_resource(void) -{ - printf("ERROR: get_ind_resource() unimplemented\n"); - QuitEmulator(); -} - -void get_1_ind_resource(void) -{ - printf("ERROR: get_1_ind_resource() unimplemented\n"); - QuitEmulator(); -} - -void r_get_resource(void) -{ - printf("ERROR: r_get_resource() unimplemented\n"); - QuitEmulator(); -} diff --git a/SheepShaver/src/ether.cpp b/SheepShaver/src/ether.cpp deleted file mode 100644 index 2a1e53c7..00000000 --- a/SheepShaver/src/ether.cpp +++ /dev/null @@ -1,1738 +0,0 @@ -/* - * ether.cpp - SheepShaver Ethernet Device Driver (DLPI) - * - * SheepShaver (C) 1997-2008 Marc Hellwig and Christian Bauer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * TODO - * - 802.2 TEST/XID - * - MIB statistics - */ - -#include - -#include "sysdeps.h" -#include "cpu_emulation.h" -#include "ether.h" -#include "ether_defs.h" -#include "macos_util.h" - -#define DEBUG 0 -#include "debug.h" - -// Packet types -enum { - kPktDIX = 0, - kPkt8022SAP = 1, - kPkt8022GroupSAP = 2, - kPkt8022SNAP = 3, - kPktIPX = 4, - kPktUnknown = 5 -}; - - -/* - * Stream private data structure - */ - -static const int kGroupSAPMapSize = 128/32; // Number of 32-bit values we need for 128 bits -static const int kGSshift = 6; -static const int kGSmask = 0x1F; - -struct multicast_node { - nw_multicast_node_p next; - uint8 addr[kEnetPhysicalAddressLength]; -}; - -struct DLPIStream { - void SetGroupSAP(uint8 sap) - { - group_sap[sap >> kGSshift] |= (1L << ((sap >> 1) & kGSmask)); - } - - void ClearGroupSAP(uint8 sap) - { - group_sap[sap >> kGSshift] &= ~(1L << ((sap >> 1) & kGSmask)); - } - - void ClearAllGroupSAPs(void) - { - for (int i=0; i> kGSshift] & (1L << ((sap >> 1) & kGSmask)); - } - - void AddMulticast(uint8 *addr) - { - multicast_node *n = (multicast_node *)Mac2HostAddr(Mac_sysalloc(sizeof(multicast_node))); - memcpy(n->addr, addr, kEnetPhysicalAddressLength); - n->next = multicast_list; - multicast_list = n; - } - - void RemoveMulticast(uint8 *addr) - { - multicast_node *p = multicast_list; - while (p) { - if (memcmp(addr, p->addr, kEnetPhysicalAddressLength) == 0) - goto found; - p = p->next; - } - return; - found: - multicast_node *q = (multicast_node *)&multicast_list; - while (q) { - if (q->next == p) { - q->next = p->next; - Mac_sysfree(Host2MacAddr((uint8 *)p)); - return; - } - q = q->next; - } - } - - uint8 *IsMulticastRegistered(uint8 *addr) - { - multicast_node *n = multicast_list; - while (n) { - if (memcmp(addr, n->addr, kEnetPhysicalAddressLength) == 0) - return n->addr; - n = n->next; - } - return NULL; - } - - nw_uint32 minor_num; // Minor device number of this stream - nw_uint32 dlpi_state; // DLPI state of this stream - nw_uint32 flags; // Flags - nw_uint16 dlsap; // SAP bound to this stream - nw_bool framing_8022; // Using 802.2 framing? This is only used to report the MAC type for DL_INFO_ACK and can be set with an ioctl() call - nw_bool raw_mode; // Using raw mode? Header is treated as data - nw_queue_p rdq; // Read queue for this stream - nw_uint32 group_sap[kGroupSAPMapSize]; // Map of bound group SAPs - uint8 snap[k8022SNAPLength]; // SNAP bound to this stream - nw_multicast_node_p multicast_list; // List of enabled multicast addresses -}; - -// Hack to make DLPIStream list initialization early to NULL (do we really need this?) -struct DLPIStreamInit { - DLPIStreamInit(nw_DLPIStream_p *dlpi_stream_p) { *dlpi_stream_p = NULL; } -}; - -// Stream flags -enum { - kSnapStream = 0x00000001, - kAcceptMulticasts = 0x00000002, - kAcceptAll8022Packets = 0x00000004, - kFastPathMode = 0x00000008 -}; - -// List of opened streams (used internally by OpenTransport) -static nw_DLPIStream_p dlpi_stream_list; -static DLPIStreamInit dlpi_stream_init(&dlpi_stream_list); - -// Are we open? -bool ether_driver_opened = false; - -// Our ethernet hardware address -static uint8 hardware_address[6] = {0, 0, 0, 0, 0, 0}; - -// Statistics -int32 num_wput = 0; -int32 num_error_acks = 0; -int32 num_tx_packets = 0; -int32 num_tx_raw_packets = 0; -int32 num_tx_normal_packets = 0; -int32 num_tx_buffer_full = 0; -int32 num_rx_packets = 0; -int32 num_ether_irq = 0; -int32 num_unitdata_ind = 0; -int32 num_rx_fastpath = 0; -int32 num_rx_no_mem = 0; -int32 num_rx_dropped = 0; -int32 num_rx_stream_not_ready = 0; -int32 num_rx_no_unitdata_mem = 0; - - -// Function pointers of imported functions -typedef mblk_t *(*allocb_ptr)(size_t size, int pri); -static uint32 allocb_tvect = 0; -mblk_t *allocb(size_t arg1, int arg2) -{ - return (mblk_t *)Mac2HostAddr((uint32)CallMacOS2(allocb_ptr, allocb_tvect, arg1, arg2)); -} -typedef void (*freeb_ptr)(mblk_t *); -static uint32 freeb_tvect = 0; -static inline void freeb(mblk_t *arg1) -{ - CallMacOS1(freeb_ptr, freeb_tvect, arg1); -} -typedef int16 (*freemsg_ptr)(mblk_t *); -static uint32 freemsg_tvect = 0; -static inline int16 freemsg(mblk_t *arg1) -{ - return (int16)CallMacOS1(freemsg_ptr, freemsg_tvect, arg1); -} -typedef mblk_t *(*copyb_ptr)(mblk_t *); -static uint32 copyb_tvect = 0; -static inline mblk_t *copyb(mblk_t *arg1) -{ - return (mblk_t *)Mac2HostAddr((uint32)CallMacOS1(copyb_ptr, copyb_tvect, arg1)); -} -typedef mblk_t *(*dupmsg_ptr)(mblk_t *); -static uint32 dupmsg_tvect = 0; -static inline mblk_t *dupmsg(mblk_t *arg1) -{ - return (mblk_t *)Mac2HostAddr((uint32)CallMacOS1(dupmsg_ptr, dupmsg_tvect, arg1)); -} -typedef mblk_t *(*getq_ptr)(queue_t *); -static uint32 getq_tvect = 0; -static inline mblk_t *getq(queue_t *arg1) -{ - return (mblk_t *)Mac2HostAddr((uint32)CallMacOS1(getq_ptr, getq_tvect, arg1)); -} -typedef int (*putq_ptr)(queue_t *, mblk_t *); -static uint32 putq_tvect = 0; -static inline int putq(queue_t *arg1, mblk_t *arg2) -{ - return (int)CallMacOS2(putq_ptr, putq_tvect, arg1, arg2); -} -typedef int (*putnext_ptr)(queue_t *, mblk_t *); -static uint32 putnext_tvect = 0; -static inline int putnext(queue_t *arg1, mblk_t *arg2) -{ - return (int)CallMacOS2(putnext_ptr, putnext_tvect, arg1, arg2); -} -typedef int (*putnextctl1_ptr)(queue_t *, int type, int c); -static uint32 putnextctl1_tvect = 0; -static inline int putnextctl1(queue_t *arg1, int arg2, int arg3) -{ - return (int)CallMacOS3(putnextctl1_ptr, putnextctl1_tvect, arg1, arg2, arg3); -} -typedef int (*canputnext_ptr)(queue_t *); -static uint32 canputnext_tvect = 0; -static inline int canputnext(queue_t *arg1) -{ - return (int)CallMacOS1(canputnext_ptr, canputnext_tvect, arg1); -} -typedef int (*qreply_ptr)(queue_t *, mblk_t *); -static uint32 qreply_tvect = 0; -static inline int qreply(queue_t *arg1, mblk_t *arg2) -{ - return (int)CallMacOS2(qreply_ptr, qreply_tvect, arg1, arg2); -} -typedef void (*flushq_ptr)(queue_t *, int flag); -static uint32 flushq_tvect = 0; -static inline void flushq(queue_t *arg1, int arg2) -{ - CallMacOS2(flushq_ptr, flushq_tvect, arg1, arg2); -} -typedef int (*msgdsize_ptr)(const mblk_t *); -static uint32 msgdsize_tvect = 0; -static inline int msgdsize(const mblk_t *arg1) -{ - return (int)CallMacOS1(msgdsize_ptr, msgdsize_tvect, arg1); -} -typedef void (*otenterint_ptr)(void); -static uint32 otenterint_tvect = 0; -void OTEnterInterrupt(void) -{ - CallMacOS(otenterint_ptr, otenterint_tvect); -} -typedef void (*otleaveint_ptr)(void); -static uint32 otleaveint_tvect = 0; -void OTLeaveInterrupt(void) -{ - CallMacOS(otleaveint_ptr, otleaveint_tvect); -} -typedef int (*mi_open_comm_ptr)(DLPIStream **mi_opp_orig, size_t size, queue_t *q, void *dev, int flag, int sflag, void *credp); -static uint32 mi_open_comm_tvect = 0; -static inline int mi_open_comm(DLPIStream **arg1, size_t arg2, queue_t *arg3, void *arg4, int arg5, int arg6, void *arg7) -{ - return (int)CallMacOS7(mi_open_comm_ptr, mi_open_comm_tvect, arg1, arg2, arg3, arg4, arg5, arg6, arg7); -} -typedef int (*mi_close_comm_ptr)(DLPIStream **mi_opp_orig, queue_t *q); -static uint32 mi_close_comm_tvect = 0; -static inline int mi_close_comm(DLPIStream **arg1, queue_t *arg2) -{ - return (int)CallMacOS2(mi_close_comm_ptr, mi_close_comm_tvect, arg1, arg2); -} -typedef DLPIStream *(*mi_next_ptr_ptr)(DLPIStream *); -static uint32 mi_next_ptr_tvect = 0; -static inline DLPIStream *mi_next_ptr(DLPIStream *arg1) -{ - return (DLPIStream *)Mac2HostAddr((uint32)CallMacOS1(mi_next_ptr_ptr, mi_next_ptr_tvect, arg1)); -} -#ifdef USE_ETHER_FULL_DRIVER -typedef void (*ether_dispatch_packet_ptr)(uint32 p, uint32 size); -static uint32 ether_dispatch_packet_tvect = 0; -#endif - -// Prototypes -static void ether_ioctl(DLPIStream *the_stream, queue_t* q, mblk_t* mp); -static void ether_flush(queue_t* q, mblk_t* mp); -static mblk_t *build_tx_packet_header(DLPIStream *the_stream, mblk_t *mp, bool fast_path); -static void transmit_packet(mblk_t *mp); -static void DLPI_error_ack(DLPIStream *the_stream, queue_t *q, mblk_t *ack_mp, uint32 prim, uint32 err, uint32 uerr); -static void DLPI_ok_ack(DLPIStream *the_stream, queue_t *q, mblk_t *ack_mp, uint32 prim); -static void DLPI_info(DLPIStream *the_stream, queue_t *q, mblk_t *mp); -static void DLPI_phys_addr(DLPIStream *the_stream, queue_t *q, mblk_t *mp); -static void DLPI_bind(DLPIStream *the_stream, queue_t *q, mblk_t *mp); -static void DLPI_unbind(DLPIStream *the_stream, queue_t *q, mblk_t *mp); -static void DLPI_subs_bind(DLPIStream *the_stream, queue_t *q, mblk_t *mp); -static void DLPI_subs_unbind(DLPIStream *the_stream, queue_t *q, mblk_t *mp); -static void DLPI_enable_multi(DLPIStream *the_stream, queue_t *q, mblk_t *mp); -static void DLPI_disable_multi(DLPIStream *the_stream, queue_t *q, mblk_t *mp); -static void DLPI_unit_data(DLPIStream *the_stream, queue_t *q, mblk_t *mp); - - -/* - * Initialize ethernet stream module - */ - -static uint8 InitStreamModuleImpl(void *theID) -{ - D(bug("InitStreamModule\n")); - - // Don't re-open if already open - if (ether_driver_opened) - return true; - ether_driver_opened = false; - - // Import functions from OTKernelLib - allocb_tvect = FindLibSymbol("\013OTKernelLib", "\006allocb"); - D(bug("allocb TVECT at %08lx\n", allocb_tvect)); - if (allocb_tvect == 0) - return false; - freeb_tvect = FindLibSymbol("\013OTKernelLib", "\005freeb"); - D(bug("freeb TVECT at %08lx\n", freeb_tvect)); - if (freeb_tvect == 0) - return false; - freemsg_tvect = FindLibSymbol("\013OTKernelLib", "\007freemsg"); - D(bug("freemsg TVECT at %08lx\n", freemsg_tvect)); - if (freemsg_tvect == 0) - return false; - copyb_tvect = FindLibSymbol("\013OTKernelLib", "\005copyb"); - D(bug("copyb TVECT at %08lx\n", copyb_tvect)); - if (copyb_tvect == 0) - return false; - dupmsg_tvect = FindLibSymbol("\013OTKernelLib", "\006dupmsg"); - D(bug("dupmsg TVECT at %08lx\n", dupmsg_tvect)); - if (dupmsg_tvect == 0) - return false; - getq_tvect = FindLibSymbol("\013OTKernelLib", "\004getq"); - D(bug("getq TVECT at %08lx\n", getq_tvect)); - if (getq_tvect == 0) - return false; - putq_tvect = FindLibSymbol("\013OTKernelLib", "\004putq"); - D(bug("putq TVECT at %08lx\n", putq_tvect)); - if (putq_tvect == 0) - return false; - putnext_tvect = FindLibSymbol("\013OTKernelLib", "\007putnext"); - D(bug("putnext TVECT at %08lx\n", putnext_tvect)); - if (putnext_tvect == 0) - return false; - putnextctl1_tvect = FindLibSymbol("\013OTKernelLib", "\013putnextctl1"); - D(bug("putnextctl1 TVECT at %08lx\n", putnextctl1_tvect)); - if (putnextctl1_tvect == 0) - return false; - canputnext_tvect = FindLibSymbol("\013OTKernelLib", "\012canputnext"); - D(bug("canputnext TVECT at %08lx\n", canputnext_tvect)); - if (canputnext_tvect == 0) - return false; - qreply_tvect = FindLibSymbol("\013OTKernelLib", "\006qreply"); - D(bug("qreply TVECT at %08lx\n", qreply_tvect)); - if (qreply_tvect == 0) - return false; - flushq_tvect = FindLibSymbol("\013OTKernelLib", "\006flushq"); - D(bug("flushq TVECT at %08lx\n", flushq_tvect)); - if (flushq_tvect == 0) - return false; - msgdsize_tvect = FindLibSymbol("\013OTKernelLib", "\010msgdsize"); - D(bug("msgdsize TVECT at %08lx\n", msgdsize_tvect)); - if (msgdsize_tvect == 0) - return false; - otenterint_tvect = FindLibSymbol("\017OTKernelUtilLib", "\020OTEnterInterrupt"); - D(bug("OTEnterInterrupt TVECT at %08lx\n", otenterint_tvect)); - if (otenterint_tvect == 0) - return false; - otleaveint_tvect = FindLibSymbol("\017OTKernelUtilLib", "\020OTLeaveInterrupt"); - D(bug("OTLeaveInterrupt TVECT at %08lx\n", otleaveint_tvect)); - if (otleaveint_tvect == 0) - return false; - mi_open_comm_tvect = FindLibSymbol("\013OTKernelLib", "\014mi_open_comm"); - D(bug("mi_open_comm TVECT at %08lx\n", mi_open_comm_tvect)); - if (mi_open_comm_tvect == 0) - return false; - mi_close_comm_tvect = FindLibSymbol("\013OTKernelLib", "\015mi_close_comm"); - D(bug("mi_close_comm TVECT at %08lx\n", mi_close_comm_tvect)); - if (mi_close_comm_tvect == 0) - return false; - mi_next_ptr_tvect = FindLibSymbol("\013OTKernelLib", "\013mi_next_ptr"); - D(bug("mi_next_ptr TVECT at %08lx\n", mi_next_ptr_tvect)); - if (mi_next_ptr_tvect == 0) - return false; - -#ifndef USE_ETHER_FULL_DRIVER - // Initialize stream list (which might be leftover) - dlpi_stream_list = NULL; - - // Ask add-on for ethernet hardware address - AO_get_ethernet_address(Host2MacAddr(hardware_address)); -#endif - - // Yes, we're open - ether_driver_opened = true; - return true; -} - -uint8 InitStreamModule(void *theID) -{ - // Common initialization code - bool net_open = InitStreamModuleImpl(theID); - - // Call InitStreamModule() in native side -#ifdef BUILD_ETHER_FULL_DRIVER - extern bool NativeInitStreamModule(void *); - if (!NativeInitStreamModule((void *)ether_dispatch_packet)) - net_open = false; -#endif - - // Import functions from the Ethernet driver -#ifdef USE_ETHER_FULL_DRIVER - ether_dispatch_packet_tvect = (uintptr)theID; - D(bug("ether_dispatch_packet TVECT at %08lx\n", ether_dispatch_packet_tvect)); - if (ether_dispatch_packet_tvect == 0) - net_open = false; -#endif - - return net_open; -} - - -/* - * Terminate ethernet stream module - */ - -static void TerminateStreamModuleImpl(void) -{ - D(bug("TerminateStreamModule\n")); - -#ifndef USE_ETHER_FULL_DRIVER - // This happens sometimes. I don't know why. - if (dlpi_stream_list != NULL) - printf("FATAL: TerminateStreamModule() called, but streams still open\n"); -#endif - - // Sorry, we're closed - ether_driver_opened = false; -} - -void TerminateStreamModule(void) -{ - // Common termination code - TerminateStreamModuleImpl(); - - // Call TerminateStreamModule() in native side -#ifdef BUILD_ETHER_FULL_DRIVER - extern void NativeTerminateStreamModule(void); - NativeTerminateStreamModule(); -#endif -} - - -/* - * Open new stream - */ - -int ether_open(queue_t *rdq, void *dev, int flag, int sflag, void *creds) -{ - D(bug("ether_open(%p,%p,%d,%d,%p)\n", rdq, dev, flag, sflag, creds)); - - // Return if driver was closed - if (!ether_driver_opened) { - printf("FATAL: ether_open(): Ethernet driver not opened\n"); - return MAC_ENXIO; - } - - // If we're being reopened, just return - if (rdq->q_ptr != NULL) - return 0; - - // Allocate DLPIStream structure - int err = mi_open_comm((DLPIStream **)&dlpi_stream_list, sizeof(DLPIStream), rdq, dev, flag, sflag, creds); - if (err) - return err; - DLPIStream *the_stream = (DLPIStream *)rdq->q_ptr; - the_stream->rdq = rdq; - the_stream->dlpi_state = DL_UNBOUND; - the_stream->flags = 0; - the_stream->dlsap = 0; - the_stream->framing_8022 = false; - the_stream->raw_mode = false; - the_stream->multicast_list = NULL; - return 0; -} - - -/* - * Close stream - */ - -int ether_close(queue_t *rdq, int flag, void *creds) -{ - D(bug("ether_close(%p,%d,%p)\n", rdq, flag, creds)); - - // Return if driver was closed - if (!ether_driver_opened) { - printf("FATAL: ether_close(): Ethernet driver not opened\n"); - return MAC_ENXIO; - } - - // Get stream - DLPIStream *the_stream = (DLPIStream *)rdq->q_ptr; - - // Don't close if never opened - if (the_stream == NULL) - return 0; - - // Disable all registered multicast addresses - while (the_stream->multicast_list) { - AO_disable_multicast(Host2MacAddr(the_stream->multicast_list->addr)); - the_stream->RemoveMulticast(the_stream->multicast_list->addr); - } - the_stream->multicast_list = NULL; - - // Delete the DLPIStream - return mi_close_comm((DLPIStream **)&dlpi_stream_list, rdq); -} - - -/* - * Put something on the write queue - */ - -int ether_wput(queue_t *q, mblk_t *mp) -{ - D(bug("ether_wput(%p,%p)\n", q, mp)); - - // Return if driver was closed - if (!ether_driver_opened) { - printf("FATAL: ether_wput(): Ethernet driver not opened\n"); - return MAC_ENXIO; - } - - // Get stream - DLPIStream *the_stream = (DLPIStream *)q->q_ptr; - if (the_stream == NULL) - return MAC_ENXIO; - - D(bug(" db_type %d\n", (int)mp->b_datap->db_type)); - switch (mp->b_datap->db_type) { - - case M_DATA: - // Transmit raw packet - D(bug(" raw packet\n")); - num_tx_raw_packets++; - transmit_packet(mp); - break; - - case M_PROTO: - case M_PCPROTO: { - union DL_primitives *dlp = (union DL_primitives *)(void *)mp->b_rptr; - uint32 prim = dlp->dl_primitive; - D(bug(" dl_primitive %d\n", prim)); - switch (prim) { - case DL_UNITDATA_REQ: - // Transmit normal packet - num_tx_normal_packets++; - DLPI_unit_data(the_stream, q, mp); - break; - - case DL_INFO_REQ: - DLPI_info(the_stream, q, mp); - break; - - case DL_PHYS_ADDR_REQ: - DLPI_phys_addr(the_stream, q, mp); - break; - - case DL_BIND_REQ: - DLPI_bind(the_stream, q, mp); - break; - - case DL_UNBIND_REQ: - DLPI_unbind(the_stream, q, mp); - break; - - case DL_SUBS_BIND_REQ: - DLPI_subs_bind(the_stream, q, mp); - break; - - case DL_SUBS_UNBIND_REQ: - DLPI_subs_unbind(the_stream, q, mp); - break; - - case DL_ENABMULTI_REQ: - DLPI_enable_multi(the_stream, q, mp); - break; - - case DL_DISABMULTI_REQ: - DLPI_disable_multi(the_stream, q, mp); - break; - - default: - D(bug("WARNING: ether_wsrv(): Unknown primitive\n")); - DLPI_error_ack(the_stream, q, mp, prim, DL_NOTSUPPORTED, 0); - break; - } - break; - } - - case M_IOCTL: - ether_ioctl(the_stream, q, mp); - break; - - case M_FLUSH: - ether_flush(q, mp); - break; - - default: - D(bug("WARNING: ether_wput(): Unknown message type\n")); - freemsg(mp); - break; - } - num_wput++; - return 0; -} - - -/* - * Dequeue and process messages from the read queue - */ - -int ether_rsrv(queue_t *q) -{ - mblk_t *mp; - while ((mp = getq(q)) != NULL) { - if (canputnext(q)) - putnext(q, mp); - else { - freemsg(mp); - flushq(q, FLUSHDATA); - break; - } - } - return 0; -} - - -/* - * Handle ioctl calls - */ - -static void ether_ioctl(DLPIStream *the_stream, queue_t *q, mblk_t *mp) -{ - struct iocblk *ioc = (struct iocblk *)(void *)mp->b_rptr; - D(bug(" ether_ioctl(%p,%p) cmd %d\n", q, mp, (int)ioc->ioc_cmd)); - - switch (ioc->ioc_cmd) { - - case I_OTSetFramingType: { // Toggles what the general info primitive returns for dl_mac_type in dl_info_ack_t structure - mblk_t *info_mp = mp->b_cont; - if (info_mp == NULL || ((info_mp->b_wptr - info_mp->b_rptr) != sizeof(uint32))) { - ioc->ioc_error = MAC_EINVAL; - goto ioctl_error; - } - uint32 framing_type = ntohl(*(uint32 *)(void *)info_mp->b_rptr); - D(bug(" I_OTSetFramingType type %d\n", framing_type)); - if (framing_type != kOTGetFramingValue) - the_stream->framing_8022 = (framing_type == kOTFraming8022); - mp->b_cont = NULL; - freemsg(info_mp); - if (the_stream->framing_8022) - ioc->ioc_rval = kOTFraming8022; - else - ioc->ioc_rval = kOTFramingEthernet; - goto ioctl_ok; - } - - case DL_IOC_HDR_INFO: { // Special Mentat call, for fast transmits - D(bug(" DL_IOC_HDR_INFO\n")); - mblk_t *info_mp = mp->b_cont; - - // Copy DL_UNITDATA_REQ block - mblk_t *unitdata_mp = copyb(info_mp); - if (unitdata_mp == NULL) { - ioc->ioc_error = MAC_ENOMEM; - goto ioctl_error; - } - unitdata_mp->b_datap->db_type = M_PROTO; - - // Construct header (converts DL_UNITDATA_REQ -> M_DATA) - mblk_t *header_mp = build_tx_packet_header(the_stream, unitdata_mp, true); - - if (header_mp == NULL) { - // Could not allocate a message block large enough - ioc->ioc_error = MAC_ENOMEM; - goto ioctl_error; - } - - // Attach header block at the end - mp->b_cont->b_cont = header_mp; - the_stream->flags |= kFastPathMode; - goto ioctl_ok; - } - - case I_OTSetRawMode: { - mblk_t *info_mp = mp->b_cont; - dl_recv_control_t *dlrc; - if (info_mp == NULL || ((info_mp->b_wptr - info_mp->b_rptr) != sizeof(dlrc->dl_primitive))) { - ioc->ioc_error = MAC_EINVAL; - goto ioctl_error; - } - dlrc = (dl_recv_control_t *)(void *)info_mp->b_rptr; - D(bug(" I_OTSetRawMode primitive %d\n", (int)dlrc->dl_primitive)); - the_stream->raw_mode = true; - goto ioctl_ok; - } - - default: - D(bug("WARNING: Unknown ether_ioctl() call\n")); - ioc->ioc_error = MAC_EINVAL; - goto ioctl_error; - } - -ioctl_ok: - ioc->ioc_count = 0; - for (mblk_t *mp1 = mp; (mp1 = mp1->b_cont) != NULL;) - ioc->ioc_count += mp1->b_wptr - mp1->b_rptr; - ioc->ioc_error = 0; - mp->b_datap->db_type = M_IOCACK; - qreply(q, mp); - return; - -ioctl_error: - mp->b_datap->db_type = M_IOCNAK; - qreply(q, mp); - return; -} - - -/* - * Flush call, send it up to the read side of the stream - */ - -static void ether_flush(queue_t* q, mblk_t* mp) -{ - D(bug(" ether_flush(%p,%p)\n", q, mp)); - - uint8 *rptr = mp->b_rptr; - if (*rptr & FLUSHW) - flushq(q, FLUSHALL); - if (*rptr & FLUSHR) { - flushq(RD(q), FLUSHALL); - *rptr &= ~FLUSHW; - qreply(q, mp); - } else - freemsg(mp); -} - - -/* - * Classify packet into the different types of protocols - */ - -static uint16 classify_packet_type(uint16 primarySAP, uint16 secondarySAP) -{ - if (primarySAP >= kMinDIXSAP) - return kPktDIX; - - if ((primarySAP == kIPXSAP) && (secondarySAP == kIPXSAP)) - return kPktIPX; - - if (primarySAP == kSNAPSAP) - return kPkt8022SNAP; - - if (primarySAP <= k8022GlobalSAP) - return kPkt8022SAP; - - return kPktUnknown; -} - - -/* - * Check if the address is a multicast, broadcast or standard address - */ - -static int32 get_address_type(uint8 *addr) -{ - if (addr[0] & 1) { // Multicast/broadcast flag - if (OTIs48BitBroadcastAddress(addr)) - return keaBroadcast; - else - return keaMulticast; - } else - return keaStandardAddress; -} - - -/* - * Reuse a message block, make room for more data - */ - -static mblk_t *reuse_message_block(mblk_t *mp, uint16 needed_size) -{ - mblk_t *nmp; - - if ((mp->b_datap->db_ref == 1) && ((mp->b_datap->db_lim - mp->b_datap->db_base) >= needed_size)) { - mp->b_datap->db_type = M_DATA; - mp->b_rptr = mp->b_datap->db_base; - mp->b_wptr = mp->b_datap->db_base + needed_size; - } else { - nmp = mp->b_cont; // Grab the M_DATA blocks - mp->b_cont = NULL; // Detach the M_(PC)PROTO - freemsg(mp); // Free the M_(PC)PROTO - mp = nmp; // Point to the M_DATA blocks - - // Try to get space on the first M_DATA block - if (mp && (mp->b_datap->db_ref == 1) && ((mp->b_rptr - mp->b_datap->db_base) >= needed_size)) - mp->b_rptr -= needed_size; - else { - // Try to allocate a new message - if ((nmp = allocb(needed_size, BPRI_HI)) == NULL) { - // Could not get a new message block so lets forget about the message altogether - freemsg(mp); // Free the original M_DATA portion of the message - mp = NULL; // Indicates the reuse failed - } else { - nmp->b_cont = mp; // Attach the new message block as the head - nmp->b_wptr += needed_size; - mp = nmp; - } - } - } - - return mp; -} - - -/* - * Built header for packet to be transmitted (convert DL_UNITDATA_REQ -> M_DATA) - * The passed-in message has the header info in the first message block and the data - * in the following blocks - */ - -static mblk_t *build_tx_packet_header(DLPIStream *the_stream, mblk_t *mp, bool fast_path) -{ - // Only handle unit_data requests - dl_unitdata_req_t *req = (dl_unitdata_req_t *)(void *)mp->b_rptr; - if (req->dl_primitive != DL_UNITDATA_REQ) { - freemsg(mp); - return NULL; - } - - // Extract destination address and its length - uint8 *destAddrOrig = ((uint8 *)req) + req->dl_dest_addr_offset; - uint32 destAddrLen = req->dl_dest_addr_length; - uint8 ctrl = 0x03; - - // Extract DLSAP - uint16 dlsap; - switch (destAddrLen) { - case kEnetPhysicalAddressLength: - dlsap = the_stream->dlsap; - break; - case kEnetAndSAPAddressLength: - dlsap = ntohs(*(uint16 *)(destAddrOrig + kEnetPhysicalAddressLength)); - break; - case kEnetPhysicalAddressLength + k8022DLSAPLength + k8022SNAPLength: // SNAP SAP - dlsap = ntohs(*(uint16 *)(destAddrOrig + kEnetPhysicalAddressLength)); - break; - default: - dlsap = the_stream->dlsap; - break; - } - - // Extract data size (excluding header info) and packet type - uint16 datasize = msgdsize(mp); - uint16 packetType = classify_packet_type(the_stream->dlsap, dlsap); - - // Calculate header size and protocol type/size field - uint16 hdrsize, proto; - switch (packetType) { - case kPktDIX: - hdrsize = kEnetPacketHeaderLength; - proto = dlsap; - break; - case kPkt8022SAP: - hdrsize = kEnetPacketHeaderLength + k8022BasicHeaderLength; - if (fast_path) - proto = 0; - else - proto = datasize + k8022BasicHeaderLength; - break; - case kPkt8022SNAP: - hdrsize = kEnetPacketHeaderLength + k8022SNAPHeaderLength; - if (fast_path) - proto = 0; - else - proto = datasize + k8022SNAPHeaderLength; - break; - case kPktIPX: - hdrsize = kEnetPacketHeaderLength; - if (fast_path) - proto = 0; - else - proto = datasize; - break; - default: - hdrsize = kEnetPacketHeaderLength; - proto = dlsap; - break; - } - - // We need to copy the dest address info in the message before we can reuse it - uint8 destAddrCopy[kMaxBoundAddrLength]; - memcpy(destAddrCopy, destAddrOrig, destAddrLen); - - // Resize header info in message block - if ((mp = reuse_message_block(mp, hdrsize)) == NULL) - return NULL; - struct T8022FullPacketHeader *packetHeader = (struct T8022FullPacketHeader *)(void *)mp->b_rptr; - - // Set protocol type/size field - packetHeader->fEnetPart.fProto = proto; - - // Set destination ethernet address - OTCopy48BitAddress(destAddrCopy, packetHeader->fEnetPart.fDestAddr); - - // Set other header fields - switch (packetType) { - case kPkt8022SAP: - packetHeader->f8022Part.fDSAP = (uint8)dlsap; - packetHeader->f8022Part.fSSAP = (uint8)the_stream->dlsap; - packetHeader->f8022Part.fCtrl = ctrl; - break; - case kPkt8022SNAP: { - uint8 *snapStart; - packetHeader->f8022Part.fDSAP = (uint8)dlsap; - packetHeader->f8022Part.fSSAP = (uint8)the_stream->dlsap; - packetHeader->f8022Part.fCtrl = ctrl; - if (destAddrLen >= kEnetAndSAPAddressLength + k8022SNAPLength) - snapStart = destAddrCopy + kEnetAndSAPAddressLength; - else - snapStart = the_stream->snap; - OTCopy8022SNAP(snapStart, packetHeader->f8022Part.fSNAP); - break; - } - } - - // Return updated message - return mp; -} - - -/* - * Transmit packet - */ - -static void transmit_packet(mblk_t *mp) -{ - EnetPacketHeader *enetHeader = (EnetPacketHeader *)(void *)mp->b_rptr; - - // Fill in length in 802.3 packets - if (enetHeader->fProto == 0) - enetHeader->fProto = msgdsize(mp) - sizeof(EnetPacketHeader); - - // Fill in ethernet source address - OTCopy48BitAddress(hardware_address, enetHeader->fSourceAddr); - - // Tell add-on to transmit packet - AO_transmit_packet(Host2MacAddr((uint8 *)mp)); - freemsg(mp); -} - - -/* - * Handle incoming packet (one stream), construct DL_UNITDATA_IND message - */ - -static void handle_received_packet(DLPIStream *the_stream, mblk_t *mp, uint16 packet_type, int32 dest_addr_type) -{ - // Find address and header length - uint32 addr_len; - uint32 header_len; - switch (packet_type) { - case kPkt8022SAP: - addr_len = kEnetAndSAPAddressLength; - header_len = kEnetPacketHeaderLength + k8022BasicHeaderLength; - break; - case kPkt8022SNAP: - addr_len = kEnetAndSAPAddressLength + k8022SNAPLength; - header_len = kEnetPacketHeaderLength + k8022SNAPHeaderLength; - break; - default: // DIX and IPX - addr_len = kEnetAndSAPAddressLength; - header_len = kEnetPacketHeaderLength; - break; - } - - // In Fast Path mode, don't send DL_UNITDATA_IND messages for unicast packets - if ((the_stream->flags & kFastPathMode) && dest_addr_type == keaStandardAddress) { - if (the_stream->raw_mode == false) - mp->b_rptr += header_len; - num_rx_fastpath++; - putq(the_stream->rdq, mp); - return; - } - - // Allocate the dl_unitdata_ind_t message - mblk_t *nmp; - if ((nmp = allocb(sizeof(dl_unitdata_ind_t) + 2*addr_len, BPRI_HI)) == NULL) { - freemsg(mp); - num_rx_no_unitdata_mem++; - return; - } - - // Set message type - nmp->b_datap->db_type = M_PROTO; - dl_unitdata_ind_t *ind = (dl_unitdata_ind_t*)(void *)nmp->b_rptr; - ind->dl_primitive = DL_UNITDATA_IND; - nmp->b_wptr += (sizeof(dl_unitdata_ind_t) + 2*addr_len); - - // Link M_DATA block - nmp->b_cont = mp; - - // Set address fields - ind->dl_dest_addr_length = addr_len; - ind->dl_dest_addr_offset = sizeof(dl_unitdata_ind_t); - ind->dl_src_addr_length = addr_len; - ind->dl_src_addr_offset = sizeof(dl_unitdata_ind_t) + addr_len; - - // Set address type - ind->dl_group_address = dest_addr_type; - - // Set address fields - T8022FullPacketHeader *packetHeader = (T8022FullPacketHeader *)(void *)mp->b_rptr; - T8022AddressStruct *destAddr = ((T8022AddressStruct*)(nmp->b_rptr + ind->dl_dest_addr_offset)); - T8022AddressStruct *srcAddr = ((T8022AddressStruct*)(nmp->b_rptr + ind->dl_src_addr_offset)); - - OTCopy48BitAddress(packetHeader->fEnetPart.fDestAddr, destAddr->fHWAddr); - OTCopy48BitAddress(packetHeader->fEnetPart.fSourceAddr, srcAddr->fHWAddr); - - destAddr->fSAP = packetHeader->f8022Part.fDSAP; - srcAddr->fSAP = packetHeader->f8022Part.fSSAP; - - if (packet_type == kPkt8022SNAP) { - OTCopy8022SNAP(packetHeader->f8022Part.fSNAP, destAddr->fSNAP); - OTCopy8022SNAP(packetHeader->f8022Part.fSNAP, srcAddr->fSNAP); - } - - // "Hide" the ethernet and protocol header(s) - if (the_stream->raw_mode == false) - mp->b_rptr += header_len; - - // Pass message up the stream - num_unitdata_ind++; - putq(the_stream->rdq, nmp); - return; -} - - -/* - * Packet received, distribute it to the streams that want it - */ - -void ether_packet_received(mblk_t *mp) -{ - // Extract address and types - EnetPacketHeader *pkt = (EnetPacketHeader *)(void *)mp->b_rptr; - T8022FullPacketHeader *fullpkt = (T8022FullPacketHeader *)pkt; - uint16 sourceSAP, destSAP; - destSAP = fullpkt->fEnetPart.fProto; - if (destSAP >= kMinDIXSAP) { - // Classic ethernet - sourceSAP = destSAP; - } else { - destSAP = fullpkt->f8022Part.fDSAP; - sourceSAP = fullpkt->f8022Part.fSSAP; - } - uint16 packetType = classify_packet_type(sourceSAP, destSAP); - int32 destAddressType = get_address_type(pkt->fDestAddr); - - // Look which streams want it - DLPIStream *the_stream, *found_stream = NULL; - uint16 found_packetType = 0; - int32 found_destAddressType = 0; - for (the_stream = dlpi_stream_list; the_stream != NULL; the_stream = mi_next_ptr(the_stream)) { - - // Don't send to unbound streams - if (the_stream->dlpi_state == DL_UNBOUND) - continue; - - // Does this stream want all 802.2 packets? - if ((the_stream->flags & kAcceptAll8022Packets) && (destSAP <= 0xff)) - goto type_found; - - // No, check SAP/SNAP - if (destSAP == the_stream->dlsap) { - if (the_stream->flags & kSnapStream) { - // Check SNAPs if necessary - uint8 sum = fullpkt->f8022Part.fSNAP[0] ^ the_stream->snap[0]; - sum |= fullpkt->f8022Part.fSNAP[1] ^ the_stream->snap[1]; - sum |= fullpkt->f8022Part.fSNAP[2] ^ the_stream->snap[2]; - sum |= fullpkt->f8022Part.fSNAP[3] ^ the_stream->snap[3]; - sum |= fullpkt->f8022Part.fSNAP[4] ^ the_stream->snap[4]; - if (sum == 0) - goto type_found; - } else { - // No SNAP, found a match since saps match - goto type_found; - } - } else { - // Check for an 802.3 Group/Global (odd) - if (((packetType == kPkt8022SAP) || (packetType == kPkt8022SNAP)) && (destSAP & 1) && the_stream->TestGroupSAP(destSAP)) - goto type_found; - } - - // No stream for this SAP/SNAP found - continue; - -type_found: - // If it's a multicast packet, it must be in the stream's multicast list - if ((destAddressType == keaMulticast) && (the_stream->flags & kAcceptMulticasts) && (!the_stream->IsMulticastRegistered(pkt->fDestAddr))) - continue; - - // Send packet to stream - // found_stream keeps a pointer to the previously found stream, so that only the last - // stream gets the original message, the other ones get duplicates - if (found_stream) - handle_received_packet(found_stream, dupmsg(mp), found_packetType, found_destAddressType); - found_stream = the_stream; - found_packetType = packetType; - found_destAddressType = destAddressType; - } - - // Send original message to last found stream - if (found_stream) - handle_received_packet(found_stream, mp, found_packetType, found_destAddressType); - else { - freemsg(mp); // Nobody wants it *snief* - num_rx_dropped++; - } -} - -void ether_dispatch_packet(uint32 p, uint32 size) -{ -#ifdef USE_ETHER_FULL_DRIVER - // Call handler from the Ethernet driver - D(bug("ether_dispatch_packet\n")); - D(bug(" packet data at %p, %d bytes\n", p, size)); - CallMacOS2(ether_dispatch_packet_ptr, ether_dispatch_packet_tvect, p, size); -#else - // Wrap packet in message block - num_rx_packets++; - mblk_t *mp; - if ((mp = allocb(size, 0)) != NULL) { - D(bug(" packet data at %p\n", (void *)mp->b_rptr)); - Mac2Host_memcpy(mp->b_rptr, p, size); - mp->b_wptr += size; - ether_packet_received(mp); - } else { - D(bug("WARNING: Cannot allocate mblk for received packet\n")); - num_rx_no_mem++; - } -#endif -} - - -/* - * Build and send an error acknowledge - */ - -static void DLPI_error_ack(DLPIStream *the_stream, queue_t *q, mblk_t *ack_mp, uint32 prim, uint32 err, uint32 uerr) -{ - D(bug(" DLPI_error_ack(%p,%p) prim %d, err %d, uerr %d\n", the_stream, ack_mp, prim, err, uerr)); - num_error_acks++; - - if (ack_mp != NULL) - freemsg(ack_mp); - if ((ack_mp = allocb(sizeof(dl_error_ack_t), BPRI_HI)) == NULL) - return; - - ack_mp->b_datap->db_type = M_PCPROTO; - dl_error_ack_t *errp = (dl_error_ack_t *)(void *)ack_mp->b_wptr; - errp->dl_primitive = DL_ERROR_ACK; - errp->dl_error_primitive = prim; - errp->dl_errno = err; - errp->dl_unix_errno = uerr; - ack_mp->b_wptr += sizeof(dl_error_ack_t); - qreply(q, ack_mp); -} - - -/* - * Build and send an OK acknowledge - */ - -static void DLPI_ok_ack(DLPIStream *the_stream, queue_t *q, mblk_t *ack_mp, uint32 prim) -{ - if (ack_mp->b_datap->db_ref != 1) { - // Message already in use, create a new one - freemsg(ack_mp); - if ((ack_mp = allocb(sizeof(dl_error_ack_t), BPRI_HI)) == NULL) - return; - } else { - // Message free - if (ack_mp->b_cont != NULL) { - freemsg(ack_mp->b_cont); - ack_mp->b_cont = NULL; - } - } - - ack_mp->b_datap->db_type = M_PCPROTO; - dl_ok_ack_t *ackp = (dl_ok_ack_t *)(void *)ack_mp->b_rptr; - ackp->dl_primitive = DL_OK_ACK; - ackp->dl_correct_primitive = prim; - ack_mp->b_wptr = ack_mp->b_rptr + sizeof(dl_ok_ack_t); - qreply(q, ack_mp); -} - - -/* - * Handle DL_INFO_REQ (report general information) - */ - -static void DLPI_info(DLPIStream *the_stream, queue_t *q, mblk_t *mp) -{ - D(bug(" DLPI_info(%p)\n", the_stream)); - uint32 saplen = 0; - uint32 addrlen = kEnetPhysicalAddressLength; - uint32 bcastlen = kEnetPhysicalAddressLength; - uint32 hdrlen = kEnetPacketHeaderLength; - - // Calculate header length - if (the_stream->dlpi_state != DL_UNBOUND) { - saplen = (the_stream->flags & kSnapStream) ? k8022DLSAPLength+k8022SNAPLength : k8022DLSAPLength; - if (the_stream->dlsap == kSNAPSAP) - hdrlen = kEnetPacketHeaderLength + k8022SNAPHeaderLength; // SNAP address - else if ((the_stream->dlsap <= kMax8022SAP) || (the_stream->dlsap == kIPXSAP)) - hdrlen = kEnetPacketHeaderLength + k8022BasicHeaderLength; // SAP or IPX - else - hdrlen = kEnetPacketHeaderLength; // Basic Ethernet - } - - // Allocate message block for reply - mblk_t *ack_mp; - if ((ack_mp = allocb(sizeof(dl_info_ack_t) + addrlen + saplen + bcastlen, BPRI_LO)) == NULL) { - DLPI_error_ack(the_stream, q, mp, DL_INFO_REQ, DL_SYSERR, MAC_ENOMEM); - return; - } - - // Set up message type - ack_mp->b_datap->db_type = M_PCPROTO; - dl_info_ack_t *ackp = (dl_info_ack_t *)(void *)ack_mp->b_rptr; - ackp->dl_primitive = DL_INFO_ACK; - - // Info/version fields - ackp->dl_service_mode = DL_CLDLS; - ackp->dl_provider_style = DL_STYLE1; - ackp->dl_version = DL_VERSION_2; - ackp->dl_current_state = the_stream->dlpi_state; - ackp->dl_mac_type = the_stream->framing_8022 ? DL_CSMACD : DL_ETHER; - ackp->dl_reserved = 0; - ackp->dl_qos_length = 0; - ackp->dl_qos_offset = (uint32)DL_UNKNOWN; - ackp->dl_qos_range_length = 0; - ackp->dl_qos_range_offset = (uint32)DL_UNKNOWN; - ackp->dl_growth = 0; - ackp->dl_min_sdu = 1; - ackp->dl_max_sdu = kEnetTSDU - hdrlen; - - // Address fields - ackp->dl_sap_length = -saplen; // Negative to indicate sap follows physical address - ackp->dl_addr_length = addrlen + saplen; - ackp->dl_addr_offset = sizeof(dl_info_ack_t); - T8022AddressStruct *boundAddr = ((T8022AddressStruct *)(ack_mp->b_rptr + ackp->dl_addr_offset)); - OTCopy48BitAddress(hardware_address, boundAddr->fHWAddr); - if (saplen) { - boundAddr->fSAP = the_stream->dlsap; - if (the_stream->flags & kSnapStream) - OTCopy8022SNAP(the_stream->snap, boundAddr->fSNAP); - } - ackp->dl_brdcst_addr_length = bcastlen; - ackp->dl_brdcst_addr_offset = sizeof(dl_info_ack_t) + addrlen + saplen; - OTSet48BitBroadcastAddress(ack_mp->b_rptr + ackp->dl_brdcst_addr_offset); - - // Advance write pointer - ack_mp->b_wptr += sizeof(dl_info_ack_t) + addrlen + saplen + bcastlen; - - // Free request - freemsg(mp); - - // Send reply - qreply(q, ack_mp); - return; -} - - -/* - * Handle DL_PHYS_ADDR_REQ (report physical address) - */ - -static void DLPI_phys_addr(DLPIStream *the_stream, queue_t *q, mblk_t *mp) -{ - D(bug(" DLPI_phys_addr(%p,%p)\n", the_stream, mp)); - dl_phys_addr_req_t *req = (dl_phys_addr_req_t *)(void *)mp->b_rptr; - - // Allocate message block for reply - mblk_t *ack_mp; - if ((ack_mp = allocb(sizeof(dl_phys_addr_ack_t) + kEnetPhysicalAddressLength, BPRI_HI)) == NULL) { - DLPI_error_ack(the_stream, q, mp, DL_PHYS_ADDR_REQ, DL_SYSERR, MAC_ENOMEM); - return; - } - - // Set up message type - ack_mp->b_datap->db_type = M_PCPROTO; - dl_phys_addr_ack_t *ackp = (dl_phys_addr_ack_t *)(void *)ack_mp->b_wptr; - ackp->dl_primitive = DL_PHYS_ADDR_ACK; - - // Fill in address - ackp->dl_addr_length = kEnetPhysicalAddressLength; - ackp->dl_addr_offset = sizeof(dl_phys_addr_ack_t); - ack_mp->b_wptr += sizeof(dl_phys_addr_ack_t) + kEnetPhysicalAddressLength; - if (req->dl_addr_type == DL_CURR_PHYS_ADDR || req->dl_addr_type == DL_FACT_PHYS_ADDR) - OTCopy48BitAddress(hardware_address, ack_mp->b_rptr + ackp->dl_addr_offset); - else { - DLPI_error_ack(the_stream, q, mp, DL_PHYS_ADDR_REQ, DL_BADPRIM, 0); - return; - } - - // Free request - freemsg(mp); - - // Send reply - qreply(q, ack_mp); - return; -} - - -/* - * Handle DL_BIND_REQ (bind a stream) - */ - -static void DLPI_bind(DLPIStream *the_stream, queue_t *q, mblk_t *mp) -{ - dl_bind_req_t *req = (dl_bind_req_t *)(void *)mp->b_rptr; - uint32 sap = req->dl_sap; - D(bug(" DLPI_bind(%p,%p) SAP %04x\n", the_stream, mp, sap)); - - // Stream must be unbound - if (the_stream->dlpi_state != DL_UNBOUND) { - DLPI_error_ack(the_stream, q, mp, DL_BIND_REQ, DL_OUTSTATE, 0); - return; - } - - // We only support connectionless data link services - if (req->dl_service_mode != DL_CLDLS || req->dl_max_conind != 0) { - DLPI_error_ack(the_stream, q, mp, DL_BIND_REQ, DL_UNSUPPORTED, 0); - return; - } - - // Don't bind to 802.2 group saps, can't check 802.2 global sap (0xFF) - // because it looks like IPX - if ((sap <= kMax8022SAP) && (sap & 1)) { - DLPI_error_ack(the_stream, q, mp, DL_BIND_REQ, DL_BADADDR, 0); - return; - } - - if (classify_packet_type(sap, sap) == kPktUnknown) { - DLPI_error_ack(the_stream, q, mp, DL_BIND_REQ, DL_BADADDR, 0); - return; - } - - // Allocate message block for reply - mblk_t *ack_mp; - if ((ack_mp = allocb(sizeof(dl_bind_ack_t) + kEnetAndSAPAddressLength, BPRI_HI)) == NULL) { - DLPI_error_ack(the_stream, q, mp, DL_BIND_REQ, DL_SYSERR, MAC_ENOMEM); - return; - } - - // Set up message type - ack_mp->b_datap->db_type = M_PCPROTO; - dl_bind_ack_t *ackp = (dl_bind_ack_t *)(void *)ack_mp->b_rptr; - ackp->dl_primitive = DL_BIND_ACK; - - // Fill in other fields - ackp->dl_sap = sap; - ackp->dl_addr_length = kEnetAndSAPAddressLength; - ackp->dl_addr_offset = sizeof(dl_bind_ack_t); - ackp->dl_max_conind = 0; - ackp->dl_xidtest_flg = 0; - - T8022AddressStruct *addrInfo = (T8022AddressStruct *)(ack_mp->b_rptr + sizeof(dl_bind_ack_t)); - OTCopy48BitAddress(hardware_address, addrInfo->fHWAddr); - addrInfo->fSAP = sap; - - // Must move b_wptr past the address info data - ack_mp->b_wptr = ack_mp->b_rptr + sizeof(dl_bind_ack_t) + kEnetAndSAPAddressLength; - - // Set group SAP if necessary - the_stream->ClearAllGroupSAPs(); - if (sap <= kMax8022SAP) - the_stream->SetGroupSAP(k8022GlobalSAP); - - // The stream is now bound and idle - the_stream->dlpi_state = DL_IDLE; - the_stream->dlsap = sap; - the_stream->flags &= ~kSnapStream; - - // Free request - freemsg(mp); - - // Send reply - qreply(q, ack_mp); - return; -} - - -/* - * Handle DL_UNBIND_REQ (unbind a stream) - */ - -static void DLPI_unbind(DLPIStream *the_stream, queue_t *q, mblk_t *mp) -{ - D(bug(" DLPI_unbind(%p,%p)\n", the_stream, mp)); - - // Stream must be bound and idle - if (the_stream->dlpi_state != DL_IDLE) { - DLPI_error_ack(the_stream, q, mp, DL_UNBIND_REQ, DL_OUTSTATE, 0); - return; - } - - // Stream is now unbound - the_stream->dlpi_state = DL_UNBOUND; - the_stream->dlsap = 0; - - // Flush all pending outbound messages - flushq(q, FLUSHDATA); - - // Flush all inbound messages pending on the stream - flushq(RD(q), FLUSHDATA); - putnextctl1(RD(q), M_FLUSH, FLUSHRW); - - // Send reply - DLPI_ok_ack(the_stream, q, mp, DL_UNBIND_REQ); - return; -} - - -/* - * Handle DL_SUBS_BIND_REQ (register 802.2 SAP group addresses and SNAPs) - */ - -static void DLPI_subs_bind(DLPIStream *the_stream, queue_t *q, mblk_t *mp) -{ - dl_subs_bind_req_t *req = (dl_subs_bind_req_t *)(void *)mp->b_rptr; - uint8 *sap = ((uint8 *)req) + req->dl_subs_sap_offset; - int32 length = req->dl_subs_sap_length; - uint16 theSap = ntohs(*((uint16 *)sap)); - int32 error = 0; - D(bug(" DLPI_subs_bind(%p,%p) SAP %02x%02x%02x%02x%02x\n", the_stream, mp, sap[0], sap[1], sap[2], sap[3], sap[4])); - - // Stream must be idle - if (the_stream->dlpi_state != DL_IDLE) { - DLPI_error_ack(the_stream, q, mp, DL_SUBS_BIND_REQ, DL_OUTSTATE, 0); - return; - } - - // Check if address is valid - switch (req->dl_subs_bind_class) { - case DL_PEER_BIND: // Bind a group address - if (the_stream->dlsap <= kMax8022SAP) { - if ((theSap & 1) && (length == sizeof(theSap))) - the_stream->SetGroupSAP(theSap); - else - if (theSap == 0x0000) // special case to receive all 802.2 packets - the_stream->flags |= kAcceptAll8022Packets; - else - error = DL_BADADDR; - } else - error = DL_UNSUPPORTED; - break; - - case DL_HIERARCHICAL_BIND: // Bind an additional SNAP - if (the_stream->dlsap == kSNAPSAP) { - if (the_stream->flags & kSnapStream) - error = DL_TOOMANY; // only one SNAP binding allowed - else { - OTCopy8022SNAP(sap, the_stream->snap); - the_stream->flags |= kSnapStream; - } - } else - error = DL_BADADDR; - break; - - default: - error = DL_UNSUPPORTED; - break; - } - if (error) { - DLPI_error_ack(the_stream, q, mp, DL_SUBS_BIND_REQ, error, 0); - return; - } - - // Allocate message block for reply - mblk_t *ack_mp; - if ((ack_mp = allocb(sizeof(dl_subs_bind_ack_t) + length, BPRI_HI)) == NULL) { - DLPI_error_ack(the_stream, q, mp, DL_SUBS_BIND_REQ, DL_SYSERR, MAC_ENOMEM); - return; - } - - // Set up message type - ack_mp->b_datap->db_type = M_PCPROTO; - dl_subs_bind_ack_t *ackp = (dl_subs_bind_ack_t *)(void *)ack_mp->b_wptr; - memset(ackp, 0, sizeof(dl_subs_bind_ack_t) + length); - ackp->dl_primitive = DL_SUBS_BIND_ACK; - - // Fill in other fields - ackp->dl_subs_sap_length = length; - ackp->dl_subs_sap_offset = length ? sizeof(dl_subs_bind_ack_t) : 0; - ack_mp->b_wptr += sizeof(dl_subs_bind_ack_t); - if (length) - memcpy(ack_mp->b_wptr, sap, length); - ack_mp->b_wptr += length; - - // Free request - freemsg(mp); - - // Send reply - qreply(q, ack_mp); - return; -} - - -/* - * Handle DL_SUBS_UNBIND_REQ (unregister 802.2 SAP group addresses and snaps) - */ - -static void DLPI_subs_unbind(DLPIStream *the_stream, queue_t *q, mblk_t *mp) -{ - dl_subs_unbind_req_t *req = (dl_subs_unbind_req_t *)(void *)mp->b_rptr; - uint8 *sap = ((uint8 *)req) + req->dl_subs_sap_offset; - int32 length = req->dl_subs_sap_length; - int32 error = 0; - D(bug(" DLPI_subs_unbind(%p,%p) SAP %02x%02x%02x%02x%02x\n", the_stream, mp, sap[0], sap[1], sap[2], sap[3], sap[4])); - - // Stream must be idle - if (the_stream->dlpi_state != DL_IDLE) { - DLPI_error_ack(the_stream, q, mp, DL_SUBS_UNBIND_REQ, DL_OUTSTATE, 0); - return; - } - - // Check if we are unbinding from an address we are bound to - if (length == k8022SAPLength) { - if ((*sap & 1) && (*sap != kIPXSAP)) { - if (the_stream->dlsap <= kMax8022SAP) - the_stream->ClearGroupSAP(*sap); - else - error = DL_UNSUPPORTED; - } else - error = DL_BADADDR; - } else if (length == k8022SNAPLength) { - if (the_stream->dlsap == kSNAPSAP) { - if (the_stream->flags & kSnapStream) { - if (memcmp(the_stream->snap, sap, length) != 0) - error = DL_BADADDR; - } else - error = DL_BADADDR; - } else - error = DL_UNSUPPORTED; - } - if (error) { - DLPI_error_ack(the_stream, q, mp, DL_SUBS_UNBIND_REQ, error, 0); - return; - } - - // Stream is no longer bound to SNAP - the_stream->flags &= ~kSnapStream; - - // Send reply - DLPI_ok_ack(the_stream, q, mp, DL_SUBS_UNBIND_REQ); - return; -} - - -/* - * Handles DL_ENABMULTI_REQ (enable multicast address) - */ - -static void DLPI_enable_multi(DLPIStream *the_stream, queue_t *q, mblk_t *mp) -{ - dl_enabmulti_req_t* req = (dl_enabmulti_req_t*)(void *)mp->b_rptr; - uint8 *reqaddr = (uint8 *)(mp->b_rptr + req->dl_addr_offset); - D(bug(" DLPI_enable_multi(%p,%p) addr %02x%02x%02x%02x%02x%02x\n", the_stream, mp, reqaddr[0], reqaddr[1], reqaddr[2], reqaddr[3], reqaddr[4], reqaddr[5])); - - // Address must be a multicast address - if (get_address_type(reqaddr) != keaMulticast) { - DLPI_error_ack(the_stream, q, mp, DL_ENABMULTI_REQ, DL_BADADDR, 0); - return; - } - - // Address already in multicast list? - if (the_stream->IsMulticastRegistered(reqaddr)) { - DLPI_error_ack(the_stream, q, mp, DL_ENABMULTI_REQ, DL_BADADDR, 0); - return; - } - - // Tell add-on to enable multicast address - AO_enable_multicast(Host2MacAddr((uint8 *)reqaddr)); - - // Add new address to multicast list - uint8 *addr = Mac2HostAddr(Mac_sysalloc(kEnetPhysicalAddressLength)); - OTCopy48BitAddress(reqaddr, addr); - the_stream->AddMulticast(addr); - - // On receive now check multicast packets - the_stream->flags |= kAcceptMulticasts; - - // Send reply - DLPI_ok_ack(the_stream, q, mp, DL_ENABMULTI_REQ); - return; -} - - -/* - * Handles DL_DISABMULTI_REQ (disable multicast address) - */ - -static void DLPI_disable_multi(DLPIStream *the_stream, queue_t *q, mblk_t *mp) -{ - dl_disabmulti_req_t *req = (dl_disabmulti_req_t*)(void *)mp->b_rptr; - uint8 *reqaddr = (uint8 *)(mp->b_rptr + req->dl_addr_offset); - D(bug(" DLPI_disable_multi(%p,%p) addr %02x%02x%02x%02x%02x%02x\n", the_stream, mp, reqaddr[0], reqaddr[1], reqaddr[2], reqaddr[3], reqaddr[4], reqaddr[5])); - - // Address must be a multicast address - if (get_address_type(reqaddr) != keaMulticast) { - DLPI_error_ack(the_stream, q, mp, DL_DISABMULTI_REQ, DL_BADADDR, 0); - return; - } - - // Find address in multicast list - uint8 *addr = the_stream->IsMulticastRegistered(reqaddr); - if (addr == NULL) { - DLPI_error_ack(the_stream, q, mp, DL_DISABMULTI_REQ, DL_BADADDR, 0); - return; - } - - // Found, then remove - the_stream->RemoveMulticast(addr); - Mac_sysfree(Host2MacAddr(addr)); - - // Tell add-on to disable multicast address - AO_disable_multicast(Host2MacAddr((uint8 *)reqaddr)); - - // No longer check multicast packets if no multicast addresses are registered - if (the_stream->multicast_list == NULL) - the_stream->flags &= ~kAcceptMulticasts; - - // Send reply - DLPI_ok_ack(the_stream, q, mp, DL_DISABMULTI_REQ); - return; -} - - -/* - * Handle DL_UNITDATA_REQ (transmit packet) - */ - -static void DLPI_unit_data(DLPIStream *the_stream, queue_t *q, mblk_t *mp) -{ - D(bug(" DLPI_unit_data(%p,%p)\n", the_stream, mp)); - dl_unitdata_req_t *req = (dl_unitdata_req_t *)(void *)mp->b_rptr; - - // Stream must be idle - if (the_stream->dlpi_state != DL_IDLE) { - - // Not idle, send error response - dl_uderror_ind_t *errp; - mblk_t *bp; - - int i = sizeof(dl_uderror_ind_t) + req->dl_dest_addr_length; - if ((bp = allocb(i, BPRI_HI)) == NULL) { - freemsg(mp); - return; - } - bp->b_datap->db_type = M_PROTO; - errp = (dl_uderror_ind_t *)(void *)bp->b_wptr; - errp->dl_primitive = DL_UDERROR_IND; - errp->dl_errno = DL_OUTSTATE; - errp->dl_unix_errno = 0; - errp->dl_dest_addr_length = req->dl_dest_addr_length; - errp->dl_dest_addr_offset = sizeof(dl_uderror_ind_t); - bp->b_wptr += sizeof(dl_uderror_ind_t); - memcpy((uint8 *)bp->b_wptr, ((uint8 *)req) + req->dl_dest_addr_offset, req->dl_dest_addr_length); - bp->b_wptr += req->dl_dest_addr_length; - qreply(q, bp); - - freemsg(mp); - return; - } - - // Build packet header and transmit packet - if ((mp = build_tx_packet_header(the_stream, mp, false)) != NULL) - transmit_packet(mp); -} - - -/* - * Ethernet packet allocator - */ - -#if SIZEOF_VOID_P != 4 || REAL_ADDRESSING == 0 -static uint32 ether_packet = 0; // Ethernet packet (cached allocation) -static uint32 n_ether_packets = 0; // Number of ethernet packets allocated so far (should be at most 1) - -EthernetPacket::EthernetPacket() -{ - ++n_ether_packets; - if (ether_packet && n_ether_packets == 1) - packet = ether_packet; - else { - packet = Mac_sysalloc(1516); - assert(packet != 0); - Mac_memset(packet, 0, 1516); - if (ether_packet == 0) - ether_packet = packet; - } -} - -EthernetPacket::~EthernetPacket() -{ - --n_ether_packets; - if (packet != ether_packet) - Mac_sysfree(packet); - if (n_ether_packets > 0) { - bug("WARNING: Nested allocation of ethernet packets!\n"); - } -} -#endif diff --git a/SheepShaver/src/extfs.cpp b/SheepShaver/src/extfs.cpp deleted file mode 120000 index 62314724..00000000 --- a/SheepShaver/src/extfs.cpp +++ /dev/null @@ -1 +0,0 @@ -../../BasiliskII/src/extfs.cpp \ No newline at end of file diff --git a/SheepShaver/src/gfxaccel.cpp b/SheepShaver/src/gfxaccel.cpp deleted file mode 100644 index ed65e5d8..00000000 --- a/SheepShaver/src/gfxaccel.cpp +++ /dev/null @@ -1,461 +0,0 @@ -/* - * gfxaccel.cpp - Generic Native QuickDraw acceleration - * - * SheepShaver (C) 1997-2008 Marc Hellwig and Christian Bauer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" - -#include "prefs.h" -#include "video.h" -#include "video_defs.h" - -#define DEBUG 0 -#include "debug.h" - - -/* - * Utility functions - */ - -// Return bytes per pixel for requested depth -static inline int bytes_per_pixel(int depth) -{ - int bpp; - switch (depth) { - case 8: - bpp = 1; - break; - case 15: case 16: - bpp = 2; - break; - case 24: case 32: - bpp = 4; - break; - default: - abort(); - } - return bpp; -} - -// Pass-through dirty areas to redraw functions -static inline void NQD_set_dirty_area(uint32 p) -{ - if (ReadMacInt32(p + acclDestBaseAddr) == screen_base) { - int16 x = (int16)ReadMacInt16(p + acclDestRect + 2) - (int16)ReadMacInt16(p + acclDestBoundsRect + 2); - int16 y = (int16)ReadMacInt16(p + acclDestRect + 0) - (int16)ReadMacInt16(p + acclDestBoundsRect + 0); - int16 w = (int16)ReadMacInt16(p + acclDestRect + 6) - (int16)ReadMacInt16(p + acclDestRect + 2); - int16 h = (int16)ReadMacInt16(p + acclDestRect + 4) - (int16)ReadMacInt16(p + acclDestRect + 0); - video_set_dirty_area(x, y, w, h); - } -} - - -/* - * Rectangle inversion - */ - -template< int bpp > -static inline void do_invrect(uint8 *dest, uint32 length) -{ -#define INVERT_1(PTR, OFS) ((uint8 *)(PTR))[OFS] = ~((uint8 *)(PTR))[OFS] -#define INVERT_2(PTR, OFS) ((uint16 *)(PTR))[OFS] = ~((uint16 *)(PTR))[OFS] -#define INVERT_4(PTR, OFS) ((uint32 *)(PTR))[OFS] = ~((uint32 *)(PTR))[OFS] -#define INVERT_8(PTR, OFS) ((uint64 *)(PTR))[OFS] = ~((uint64 *)(PTR))[OFS] - -#ifndef UNALIGNED_PROFITABLE - // Align on 16-bit boundaries - if (bpp < 16 && (((uintptr)dest) & 1)) { - INVERT_1(dest, 0); - dest += 1; length -= 1; - } - - // Align on 32-bit boundaries - if (bpp < 32 && (((uintptr)dest) & 2)) { - INVERT_2(dest, 0); - dest += 2; length -= 2; - } -#endif - - // Invert 8-byte words - if (length >= 8) { - const int r = (length / 8) % 8; - dest += r * 8; - - int n = ((length / 8) + 7) / 8; - switch (r) { - case 0: do { - dest += 64; - INVERT_8(dest, -8); - case 7: INVERT_8(dest, -7); - case 6: INVERT_8(dest, -6); - case 5: INVERT_8(dest, -5); - case 4: INVERT_8(dest, -4); - case 3: INVERT_8(dest, -3); - case 2: INVERT_8(dest, -2); - case 1: INVERT_8(dest, -1); - } while (--n > 0); - } - } - - // 32-bit cell to invert? - if (length & 4) { - INVERT_4(dest, 0); - if (bpp <= 16) - dest += 4; - } - - // 16-bit cell to invert? - if (bpp <= 16 && (length & 2)) { - INVERT_2(dest, 0); - if (bpp <= 8) - dest += 2; - } - - // 8-bit cell to invert? - if (bpp <= 8 && (length & 1)) - INVERT_1(dest, 0); - -#undef INVERT_1 -#undef INVERT_2 -#undef INVERT_4 -#undef INVERT_8 -} - -void NQD_invrect(uint32 p) -{ - D(bug("accl_invrect %08x\n", p)); - - // Get inversion parameters - int16 dest_X = (int16)ReadMacInt16(p + acclDestRect + 2) - (int16)ReadMacInt16(p + acclDestBoundsRect + 2); - int16 dest_Y = (int16)ReadMacInt16(p + acclDestRect + 0) - (int16)ReadMacInt16(p + acclDestBoundsRect + 0); - int16 width = (int16)ReadMacInt16(p + acclDestRect + 6) - (int16)ReadMacInt16(p + acclDestRect + 2); - int16 height = (int16)ReadMacInt16(p + acclDestRect + 4) - (int16)ReadMacInt16(p + acclDestRect + 0); - D(bug(" dest X %d, dest Y %d\n", dest_X, dest_Y)); - D(bug(" width %d, height %d, bytes_per_row %d\n", width, height, (int32)ReadMacInt32(p + acclDestRowBytes))); - - //!!?? pen_mode == 14 - - // And perform the inversion - const int bpp = bytes_per_pixel(ReadMacInt32(p + acclDestPixelSize)); - const int dest_row_bytes = (int32)ReadMacInt32(p + acclDestRowBytes); - uint8 *dest = Mac2HostAddr(ReadMacInt32(p + acclDestBaseAddr) + (dest_Y * dest_row_bytes) + (dest_X * bpp)); - width *= bpp; - switch (bpp) { - case 1: - for (int i = 0; i < height; i++) { - do_invrect<8>(dest, width); - dest += dest_row_bytes; - } - break; - case 2: - for (int i = 0; i < height; i++) { - do_invrect<16>(dest, width); - dest += dest_row_bytes; - } - break; - case 4: - for (int i = 0; i < height; i++) { - do_invrect<32>(dest, width); - dest += dest_row_bytes; - } - break; - } -} - - -/* - * Rectangle filling - */ - -template< int bpp > -static inline void do_fillrect(uint8 *dest, uint32 color, uint32 length) -{ -#define FILL_1(PTR, OFS, VAL) ((uint8 *)(PTR))[OFS] = (VAL) -#define FILL_2(PTR, OFS, VAL) ((uint16 *)(PTR))[OFS] = (VAL) -#define FILL_4(PTR, OFS, VAL) ((uint32 *)(PTR))[OFS] = (VAL) -#define FILL_8(PTR, OFS, VAL) ((uint64 *)(PTR))[OFS] = (VAL) - -#ifndef UNALIGNED_PROFITABLE - // Align on 16-bit boundaries - if (bpp < 16 && (((uintptr)dest) & 1)) { - FILL_1(dest, 0, color); - dest += 1; length -= 1; - } - - // Align on 32-bit boundaries - if (bpp < 32 && (((uintptr)dest) & 2)) { - FILL_2(dest, 0, color); - dest += 2; length -= 2; - } -#endif - - // Fill 8-byte words - if (length >= 8) { - const uint64 c = (((uint64)color) << 32) | color; - const int r = (length / 8) % 8; - dest += r * 8; - - int n = ((length / 8) + 7) / 8; - switch (r) { - case 0: do { - dest += 64; - FILL_8(dest, -8, c); - case 7: FILL_8(dest, -7, c); - case 6: FILL_8(dest, -6, c); - case 5: FILL_8(dest, -5, c); - case 4: FILL_8(dest, -4, c); - case 3: FILL_8(dest, -3, c); - case 2: FILL_8(dest, -2, c); - case 1: FILL_8(dest, -1, c); - } while (--n > 0); - } - } - - // 32-bit cell to fill? - if (length & 4) { - FILL_4(dest, 0, color); - if (bpp <= 16) - dest += 4; - } - - // 16-bit cell to fill? - if (bpp <= 16 && (length & 2)) { - FILL_2(dest, 0, color); - if (bpp <= 8) - dest += 2; - } - - // 8-bit cell to fill? - if (bpp <= 8 && (length & 1)) - FILL_1(dest, 0, color); - -#undef FILL_1 -#undef FILL_2 -#undef FILL_4 -#undef FILL_8 -} - -void NQD_fillrect(uint32 p) -{ - D(bug("accl_fillrect %08x\n", p)); - - // Get filling parameters - int16 dest_X = (int16)ReadMacInt16(p + acclDestRect + 2) - (int16)ReadMacInt16(p + acclDestBoundsRect + 2); - int16 dest_Y = (int16)ReadMacInt16(p + acclDestRect + 0) - (int16)ReadMacInt16(p + acclDestBoundsRect + 0); - int16 width = (int16)ReadMacInt16(p + acclDestRect + 6) - (int16)ReadMacInt16(p + acclDestRect + 2); - int16 height = (int16)ReadMacInt16(p + acclDestRect + 4) - (int16)ReadMacInt16(p + acclDestRect + 0); - uint32 color = htonl(ReadMacInt32(p + acclPenMode) == 8 ? ReadMacInt32(p + acclForePen) : ReadMacInt32(p + acclBackPen)); - D(bug(" dest X %d, dest Y %d\n", dest_X, dest_Y)); - D(bug(" width %d, height %d\n", width, height)); - D(bug(" bytes_per_row %d color %08x\n", (int32)ReadMacInt32(p + acclDestRowBytes), color)); - - // And perform the fill - const int bpp = bytes_per_pixel(ReadMacInt32(p + acclDestPixelSize)); - const int dest_row_bytes = (int32)ReadMacInt32(p + acclDestRowBytes); - uint8 *dest = Mac2HostAddr(ReadMacInt32(p + acclDestBaseAddr) + (dest_Y * dest_row_bytes) + (dest_X * bpp)); - width *= bpp; - switch (bpp) { - case 1: - for (int i = 0; i < height; i++) { - memset(dest, color, width); - dest += dest_row_bytes; - } - break; - case 2: - for (int i = 0; i < height; i++) { - do_fillrect<16>(dest, color, width); - dest += dest_row_bytes; - } - break; - case 4: - for (int i = 0; i < height; i++) { - do_fillrect<32>(dest, color, width); - dest += dest_row_bytes; - } - break; - } -} - -bool NQD_fillrect_hook(uint32 p) -{ - D(bug("accl_fillrect_hook %08x\n", p)); - NQD_set_dirty_area(p); - - // Check if we can accelerate this fillrect - if (ReadMacInt32(p + 0x284) != 0 && ReadMacInt32(p + acclDestPixelSize) >= 8) { - const int transfer_mode = ReadMacInt32(p + acclTransferMode); - if (transfer_mode == 8) { - // Fill - WriteMacInt32(p + acclDrawProc, NativeTVECT(NATIVE_NQD_FILLRECT)); - return true; - } - else if (transfer_mode == 10) { - // Invert - WriteMacInt32(p + acclDrawProc, NativeTVECT(NATIVE_NQD_INVRECT)); - return true; - } - } - return false; -} - - -/* - * Isomorphic rectangle blitting - */ - -void NQD_bitblt(uint32 p) -{ - D(bug("accl_bitblt %08x\n", p)); - - // Get blitting parameters - int16 src_X = (int16)ReadMacInt16(p + acclSrcRect + 2) - (int16)ReadMacInt16(p + acclSrcBoundsRect + 2); - int16 src_Y = (int16)ReadMacInt16(p + acclSrcRect + 0) - (int16)ReadMacInt16(p + acclSrcBoundsRect + 0); - int16 dest_X = (int16)ReadMacInt16(p + acclDestRect + 2) - (int16)ReadMacInt16(p + acclDestBoundsRect + 2); - int16 dest_Y = (int16)ReadMacInt16(p + acclDestRect + 0) - (int16)ReadMacInt16(p + acclDestBoundsRect + 0); - int16 width = (int16)ReadMacInt16(p + acclDestRect + 6) - (int16)ReadMacInt16(p + acclDestRect + 2); - int16 height = (int16)ReadMacInt16(p + acclDestRect + 4) - (int16)ReadMacInt16(p + acclDestRect + 0); - D(bug(" src addr %08x, dest addr %08x\n", ReadMacInt32(p + acclSrcBaseAddr), ReadMacInt32(p + acclDestBaseAddr))); - D(bug(" src X %d, src Y %d, dest X %d, dest Y %d\n", src_X, src_Y, dest_X, dest_Y)); - D(bug(" width %d, height %d\n", width, height)); - - // And perform the blit - const int bpp = bytes_per_pixel(ReadMacInt32(p + acclSrcPixelSize)); - width *= bpp; - if ((int32)ReadMacInt32(p + acclSrcRowBytes) > 0) { - const int src_row_bytes = (int32)ReadMacInt32(p + acclSrcRowBytes); - const int dst_row_bytes = (int32)ReadMacInt32(p + acclDestRowBytes); - uint8 *src = Mac2HostAddr(ReadMacInt32(p + acclSrcBaseAddr) + (src_Y * src_row_bytes) + (src_X * bpp)); - uint8 *dst = Mac2HostAddr(ReadMacInt32(p + acclDestBaseAddr) + (dest_Y * dst_row_bytes) + (dest_X * bpp)); - for (int i = 0; i < height; i++) { - memmove(dst, src, width); - src += src_row_bytes; - dst += dst_row_bytes; - } - } - else { - const int src_row_bytes = -(int32)ReadMacInt32(p + acclSrcRowBytes); - const int dst_row_bytes = -(int32)ReadMacInt32(p + acclDestRowBytes); - uint8 *src = Mac2HostAddr(ReadMacInt32(p + acclSrcBaseAddr) + ((src_Y + height - 1) * src_row_bytes) + (src_X * bpp)); - uint8 *dst = Mac2HostAddr(ReadMacInt32(p + acclDestBaseAddr) + ((dest_Y + height - 1) * dst_row_bytes) + (dest_X * bpp)); - for (int i = height - 1; i >= 0; i--) { - memmove(dst, src, width); - src -= src_row_bytes; - dst -= dst_row_bytes; - } - } -} - -/* - BitBlt transfer modes: - 0 : srcCopy - 1 : srcOr - 2 : srcXor - 3 : srcBic - 4 : notSrcCopy - 5 : notSrcOr - 6 : notSrcXor - 7 : notSrcBic - 32 : blend - 33 : addPin - 34 : addOver - 35 : subPin - 36 : transparent - 37 : adMax - 38 : subOver - 39 : adMin - 50 : hilite -*/ - -bool NQD_bitblt_hook(uint32 p) -{ - D(bug("accl_draw_hook %08x\n", p)); - NQD_set_dirty_area(p); - - // Check if we can accelerate this bitblt - if (ReadMacInt32(p + 0x018) + ReadMacInt32(p + 0x128) == 0 && - ReadMacInt32(p + 0x130) == 0 && - ReadMacInt32(p + acclSrcPixelSize) >= 8 && - ReadMacInt32(p + acclSrcPixelSize) == ReadMacInt32(p + acclDestPixelSize) && - (int32)(ReadMacInt32(p + acclSrcRowBytes) ^ ReadMacInt32(p + acclDestRowBytes)) >= 0 && // same sign? - ReadMacInt32(p + acclTransferMode) == 0 && // srcCopy? - (int32)ReadMacInt32(p + 0x15c) > 0) { - - // Yes, set function pointer - WriteMacInt32(p + acclDrawProc, NativeTVECT(NATIVE_NQD_BITBLT)); - return true; - } - return false; -} - -// Unknown hook -bool NQD_unknown_hook(uint32 arg) -{ - D(bug("accl_unknown_hook %08x\n", arg)); - NQD_set_dirty_area(arg); - - return false; -} - -// Wait for graphics operation to finish -bool NQD_sync_hook(uint32 arg) -{ - D(bug("accl_sync_hook %08x\n", arg)); - return true; -} - - -/* - * Install Native QuickDraw acceleration hooks - */ - -void VideoInstallAccel(void) -{ - // Install acceleration hooks - if (PrefsFindBool("gfxaccel")) { - D(bug("Video: Installing acceleration hooks\n")); - uint32 base; - - SheepVar bitblt_hook_info(sizeof(accl_hook_info)); - base = bitblt_hook_info.addr(); - WriteMacInt32(base + 0, NativeTVECT(NATIVE_NQD_BITBLT_HOOK)); - WriteMacInt32(base + 4, NativeTVECT(NATIVE_NQD_SYNC_HOOK)); - WriteMacInt32(base + 8, ACCL_BITBLT); - NQDMisc(6, bitblt_hook_info.addr()); - - SheepVar fillrect_hook_info(sizeof(accl_hook_info)); - base = fillrect_hook_info.addr(); - WriteMacInt32(base + 0, NativeTVECT(NATIVE_NQD_FILLRECT_HOOK)); - WriteMacInt32(base + 4, NativeTVECT(NATIVE_NQD_SYNC_HOOK)); - WriteMacInt32(base + 8, ACCL_FILLRECT); - NQDMisc(6, fillrect_hook_info.addr()); - - for (int op = 0; op < 8; op++) { - switch (op) { - case ACCL_BITBLT: - case ACCL_FILLRECT: - continue; - } - SheepVar unknown_hook_info(sizeof(accl_hook_info)); - base = unknown_hook_info.addr(); - WriteMacInt32(base + 0, NativeTVECT(NATIVE_NQD_UNKNOWN_HOOK)); - WriteMacInt32(base + 4, NativeTVECT(NATIVE_NQD_SYNC_HOOK)); - WriteMacInt32(base + 8, op); - NQDMisc(6, unknown_hook_info.addr()); - } - } -} diff --git a/SheepShaver/src/include/about_window.h b/SheepShaver/src/include/about_window.h deleted file mode 100644 index 6c2d8d82..00000000 --- a/SheepShaver/src/include/about_window.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * about_window.h - "About" window - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef ABOUT_WINDOW_H -#define ABOUT_WINDOW_H - -extern void OpenAboutWindow(void); - -#endif diff --git a/SheepShaver/src/include/adb.h b/SheepShaver/src/include/adb.h deleted file mode 120000 index e65ef4a4..00000000 --- a/SheepShaver/src/include/adb.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/include/adb.h \ No newline at end of file diff --git a/SheepShaver/src/include/audio.h b/SheepShaver/src/include/audio.h deleted file mode 120000 index 73ebba7e..00000000 --- a/SheepShaver/src/include/audio.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/include/audio.h \ No newline at end of file diff --git a/SheepShaver/src/include/audio_defs.h b/SheepShaver/src/include/audio_defs.h deleted file mode 120000 index 04523f25..00000000 --- a/SheepShaver/src/include/audio_defs.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/include/audio_defs.h \ No newline at end of file diff --git a/SheepShaver/src/include/cdrom.h b/SheepShaver/src/include/cdrom.h deleted file mode 120000 index d7300f7a..00000000 --- a/SheepShaver/src/include/cdrom.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/include/cdrom.h \ No newline at end of file diff --git a/SheepShaver/src/include/clip.h b/SheepShaver/src/include/clip.h deleted file mode 120000 index 23f10c02..00000000 --- a/SheepShaver/src/include/clip.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/include/clip.h \ No newline at end of file diff --git a/SheepShaver/src/include/cpu_emulation.h b/SheepShaver/src/include/cpu_emulation.h deleted file mode 100644 index aa4b7a70..00000000 --- a/SheepShaver/src/include/cpu_emulation.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * cpu_emulation.h - Definitions for CPU emulation and Mac memory access - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef CPU_EMULATION_H -#define CPU_EMULATION_H - - -/* - * Memory system - */ - -// Constants -const uint32 ROM_SIZE = 0x400000; // Size of ROM file -const uint32 ROM_AREA_SIZE = 0x500000; // Size of ROM area -const uintptr DR_EMULATOR_BASE = 0x68070000; // Address of DR emulator code -const uint32 DR_EMULATOR_SIZE = 0x10000; // Size of DR emulator code -const uintptr DR_CACHE_BASE = 0x69000000; // Address of DR cache -const uint32 DR_CACHE_SIZE = 0x80000; // Size of DR Cache - -const uintptr KERNEL_DATA_BASE = 0x68ffe000; // Address of Kernel Data -const uintptr KERNEL_DATA2_BASE = 0x5fffe000; // Alternate address of Kernel Data -const uint32 KERNEL_AREA_SIZE = 0x2000; // Size of Kernel Data area - -// MacOS 68k Emulator Data -struct EmulatorData { - uint32 v[0x400]; -}; - -// MacOS Kernel Data -struct KernelData { - uint32 v[0x400]; - EmulatorData ed; -}; - -// RAM and ROM pointers (allocated and set by main_*.cpp) -extern uint32 RAMBase; // Base address of Mac RAM -extern uint32 RAMSize; // Size address of Mac RAM -extern uint8 *RAMBaseHost; // Base address of Mac RAM (host address space) - -extern uint32 ROMBase; // Base address of Mac ROM -extern uint8 *ROMBaseHost; // Base address of Mac ROM (host address space) - -// Mac memory access functions -#if EMULATED_PPC -#include "cpu/vm.hpp" -static inline uint32 ReadMacInt8(uint32 addr) {return vm_read_memory_1(addr);} -static inline void WriteMacInt8(uint32 addr, uint32 v) {vm_write_memory_1(addr, v);} -static inline uint32 ReadMacInt16(uint32 addr) {return vm_read_memory_2(addr);} -static inline void WriteMacInt16(uint32 addr, uint32 v) {vm_write_memory_2(addr, v);} -static inline uint32 ReadMacInt32(uint32 addr) {return vm_read_memory_4(addr);} -static inline void WriteMacInt32(uint32 addr, uint32 v) {vm_write_memory_4(addr, v);} -static inline uint64 ReadMacInt64(uint32 addr) {return vm_read_memory_8(addr);} -static inline void WriteMacInt64(uint32 addr, uint64 v) {vm_write_memory_8(addr, v);} -static inline uint32 Host2MacAddr(uint8 *addr) {return vm_do_get_virtual_address(addr);} -static inline uint8 *Mac2HostAddr(uint32 addr) {return vm_do_get_real_address(addr);} -static inline void *Mac_memset(uint32 addr, int c, size_t n) {return vm_memset(addr, c, n);} -static inline void *Mac2Host_memcpy(void *dest, uint32 src, size_t n) {return vm_memcpy(dest, src, n);} -static inline void *Host2Mac_memcpy(uint32 dest, const void *src, size_t n) {return vm_memcpy(dest, src, n);} -static inline void *Mac2Mac_memcpy(uint32 dest, uint32 src, size_t n) {return vm_memcpy(dest, src, n);} -#else -static inline uint32 ReadMacInt8(uint32 addr) {return *(uint8 *)addr;} -static inline void WriteMacInt8(uint32 addr, uint32 b) {*(uint8 *)addr = b;} -static inline uint32 ReadMacInt16(uint32 addr) {return *(uint16 *)addr;} -static inline uint32 ReadMacInt32(uint32 addr) {return *(uint32 *)addr;} -static inline uint64 ReadMacInt64(uint32 addr) {return *(uint64 *)addr;} -static inline void WriteMacInt16(uint32 addr, uint32 w) {*(uint16 *)addr = w;} -static inline void WriteMacInt32(uint32 addr, uint32 l) {*(uint32 *)addr = l;} -static inline void WriteMacInt64(uint32 addr, uint64 ll) {*(uint64 *)addr = ll;} -static inline uint32 Host2MacAddr(uint8 *addr) {return (uint32)addr;} -static inline uint8 *Mac2HostAddr(uint32 addr) {return (uint8 *)addr;} -static inline void *Mac_memset(uint32 addr, int c, size_t n) {return memset(Mac2HostAddr(addr), c, n);} -static inline void *Mac2Host_memcpy(void *dest, uint32 src, size_t n) {return memcpy(dest, Mac2HostAddr(src), n);} -static inline void *Host2Mac_memcpy(uint32 dest, const void *src, size_t n) {return memcpy(Mac2HostAddr(dest), src, n);} -static inline void *Mac2Mac_memcpy(uint32 dest, uint32 src, size_t n) {return memcpy(Mac2HostAddr(dest), Mac2HostAddr(src), n);} -#endif - - -/* - * 680x0 and PPC emulation - */ - -// 68k procedure helper to write a big endian 16-bit word -#ifdef WORDS_BIGENDIAN -#define PW(W) W -#else -#define PW(X) ((((X) >> 8) & 0xff) | (((X) & 0xff) << 8)) -#endif - -// PowerPC procedure helper to write a big-endian 32-bit word -#ifdef WORDS_BIGENDIAN -#define PL(X) X -#else -#define PL(X) \ - ((((X) & 0xff000000) >> 24) | (((X) & 0x00ff0000) >> 8) | \ - (((X) & 0x0000ff00) << 8) | (((X) & 0x000000ff) << 24)) -#endif - -struct M68kRegisters; -extern void Execute68k(uint32, M68kRegisters *r); // Execute 68k subroutine from EMUL_OP routine, must be ended with RTS -extern void Execute68kTrap(uint16 trap, M68kRegisters *r); // Execute 68k A-Trap from EMUL_OP routine -#if EMULATED_PPC -extern void FlushCodeCache(uintptr start, uintptr end); // Invalidate emulator caches -#endif -extern void ExecuteNative(int selector); // Execute native code from EMUL_OP routine (real mode switch) - -#endif diff --git a/SheepShaver/src/include/debug.h b/SheepShaver/src/include/debug.h deleted file mode 120000 index 6a0dd40c..00000000 --- a/SheepShaver/src/include/debug.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/include/debug.h \ No newline at end of file diff --git a/SheepShaver/src/include/disk.h b/SheepShaver/src/include/disk.h deleted file mode 120000 index d785c55d..00000000 --- a/SheepShaver/src/include/disk.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/include/disk.h \ No newline at end of file diff --git a/SheepShaver/src/include/emul_op.h b/SheepShaver/src/include/emul_op.h deleted file mode 100644 index 9f9a323e..00000000 --- a/SheepShaver/src/include/emul_op.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * emul_op.h - 68k opcodes for ROM patches - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef EMUL_OP_H -#define EMUL_OP_H - -// PowerPC opcodes -const uint32 POWERPC_NOP = 0x60000000; -const uint32 POWERPC_ILLEGAL = 0x00000000; -const uint32 POWERPC_BLR = 0x4e800020; -const uint32 POWERPC_BCTR = 0x4e800420; -const uint32 POWERPC_EMUL_OP = 0x18000000; // Base opcode for EMUL_OP opcodes (only used with PPC emulation) - -// 68k opcodes -const uint16 M68K_ILLEGAL = 0x4afc; -const uint16 M68K_NOP = 0x4e71; -const uint16 M68K_RTS = 0x4e75; -const uint16 M68K_RTD = 0x4e74; -const uint16 M68K_JMP = 0x4ef9; -const uint16 M68K_JMP_A0 = 0x4ed0; -const uint16 M68K_JSR = 0x4eb9; -const uint16 M68K_JSR_A0 = 0x4e90; -enum { // Selectors for EMUL_OP opcodes - OP_BREAK, OP_XPRAM1, OP_XPRAM2, OP_XPRAM3, OP_NVRAM1, OP_NVRAM2, OP_NVRAM3, - OP_FIX_MEMTOP, OP_FIX_MEMSIZE, OP_FIX_BOOTSTACK, - OP_SONY_OPEN, OP_SONY_PRIME, OP_SONY_CONTROL, OP_SONY_STATUS, - OP_DISK_OPEN, OP_DISK_PRIME, OP_DISK_CONTROL, OP_DISK_STATUS, - OP_CDROM_OPEN, OP_CDROM_PRIME, OP_CDROM_CONTROL, OP_CDROM_STATUS, - OP_AUDIO_DISPATCH, OP_SOUNDIN_OPEN, OP_SOUNDIN_PRIME, OP_SOUNDIN_CONTROL, OP_SOUNDIN_STATUS, OP_SOUNDIN_CLOSE, - OP_ADBOP, OP_INSTIME, OP_RMVTIME, OP_PRIMETIME, OP_MICROSECONDS, OP_ZERO_SCRAP, OP_PUT_SCRAP, OP_GET_SCRAP, - OP_DEBUG_STR, OP_INSTALL_DRIVERS, OP_NAME_REGISTRY, OP_RESET, OP_IRQ, - OP_SCSI_DISPATCH, OP_SCSI_ATOMIC, - OP_CHECK_SYSV, OP_NTRB_17_PATCH, OP_NTRB_17_PATCH2, OP_NTRB_17_PATCH3, OP_NTRB_17_PATCH4, OP_CHECKLOAD, - OP_EXTFS_COMM, OP_EXTFS_HFS, OP_IDLE_TIME, OP_IDLE_TIME_2, - OP_MAX -}; -const uint16 M68K_EMUL_RETURN = 0xfe40; // Extended opcodes -const uint16 M68K_EXEC_RETURN = 0xfe41; -const uint16 M68K_EXEC_NATIVE = 0xfe42; -const uint16 M68K_EMUL_BREAK = 0xfe43; -const uint16 M68K_EMUL_OP_XPRAM1 = M68K_EMUL_BREAK + OP_XPRAM1; -const uint16 M68K_EMUL_OP_XPRAM2 = M68K_EMUL_BREAK + OP_XPRAM2; -const uint16 M68K_EMUL_OP_XPRAM3 = M68K_EMUL_BREAK + OP_XPRAM3; -const uint16 M68K_EMUL_OP_NVRAM1 = M68K_EMUL_BREAK + OP_NVRAM1; -const uint16 M68K_EMUL_OP_NVRAM2 = M68K_EMUL_BREAK + OP_NVRAM2; -const uint16 M68K_EMUL_OP_NVRAM3 = M68K_EMUL_BREAK + OP_NVRAM3; -const uint16 M68K_EMUL_OP_FIX_MEMTOP = M68K_EMUL_BREAK + OP_FIX_MEMTOP; -const uint16 M68K_EMUL_OP_FIX_MEMSIZE = M68K_EMUL_BREAK + OP_FIX_MEMSIZE; -const uint16 M68K_EMUL_OP_FIX_BOOTSTACK = M68K_EMUL_BREAK + OP_FIX_BOOTSTACK; -const uint16 M68K_EMUL_OP_SONY_OPEN = M68K_EMUL_BREAK + OP_SONY_OPEN; -const uint16 M68K_EMUL_OP_SONY_PRIME = M68K_EMUL_BREAK + OP_SONY_PRIME; -const uint16 M68K_EMUL_OP_SONY_CONTROL = M68K_EMUL_BREAK + OP_SONY_CONTROL; -const uint16 M68K_EMUL_OP_SONY_STATUS = M68K_EMUL_BREAK + OP_SONY_STATUS; -const uint16 M68K_EMUL_OP_DISK_OPEN = M68K_EMUL_BREAK + OP_DISK_OPEN; -const uint16 M68K_EMUL_OP_DISK_PRIME = M68K_EMUL_BREAK + OP_DISK_PRIME; -const uint16 M68K_EMUL_OP_DISK_CONTROL = M68K_EMUL_BREAK + OP_DISK_CONTROL; -const uint16 M68K_EMUL_OP_DISK_STATUS = M68K_EMUL_BREAK + OP_DISK_STATUS; -const uint16 M68K_EMUL_OP_CDROM_OPEN = M68K_EMUL_BREAK + OP_CDROM_OPEN; -const uint16 M68K_EMUL_OP_CDROM_PRIME = M68K_EMUL_BREAK + OP_CDROM_PRIME; -const uint16 M68K_EMUL_OP_CDROM_CONTROL = M68K_EMUL_BREAK + OP_CDROM_CONTROL; -const uint16 M68K_EMUL_OP_CDROM_STATUS = M68K_EMUL_BREAK + OP_CDROM_STATUS; -const uint16 M68K_EMUL_OP_AUDIO_DISPATCH = M68K_EMUL_BREAK + OP_AUDIO_DISPATCH; -const uint16 M68K_EMUL_OP_SOUNDIN_OPEN = M68K_EMUL_BREAK + OP_SOUNDIN_OPEN; -const uint16 M68K_EMUL_OP_SOUNDIN_CLOSE = M68K_EMUL_BREAK + OP_SOUNDIN_CLOSE; -const uint16 M68K_EMUL_OP_SOUNDIN_PRIME = M68K_EMUL_BREAK + OP_SOUNDIN_PRIME; -const uint16 M68K_EMUL_OP_SOUNDIN_CONTROL = M68K_EMUL_BREAK + OP_SOUNDIN_CONTROL; -const uint16 M68K_EMUL_OP_SOUNDIN_STATUS = M68K_EMUL_BREAK + OP_SOUNDIN_STATUS; -const uint16 M68K_EMUL_OP_ADBOP = M68K_EMUL_BREAK + OP_ADBOP; -const uint16 M68K_EMUL_OP_INSTIME = M68K_EMUL_BREAK + OP_INSTIME; -const uint16 M68K_EMUL_OP_RMVTIME = M68K_EMUL_BREAK + OP_RMVTIME; -const uint16 M68K_EMUL_OP_PRIMETIME = M68K_EMUL_BREAK + OP_PRIMETIME; -const uint16 M68K_EMUL_OP_MICROSECONDS = M68K_EMUL_BREAK + OP_MICROSECONDS; -const uint16 M68K_EMUL_OP_ZERO_SCRAP = M68K_EMUL_BREAK + OP_ZERO_SCRAP; -const uint16 M68K_EMUL_OP_PUT_SCRAP = M68K_EMUL_BREAK + OP_PUT_SCRAP; -const uint16 M68K_EMUL_OP_GET_SCRAP = M68K_EMUL_BREAK + OP_GET_SCRAP; -const uint16 M68K_EMUL_OP_DEBUG_STR = M68K_EMUL_BREAK + OP_DEBUG_STR; -const uint16 M68K_EMUL_OP_INSTALL_DRIVERS = M68K_EMUL_BREAK + OP_INSTALL_DRIVERS; -const uint16 M68K_EMUL_OP_NAME_REGISTRY = M68K_EMUL_BREAK + OP_NAME_REGISTRY; -const uint16 M68K_EMUL_OP_RESET = M68K_EMUL_BREAK + OP_RESET; -const uint16 M68K_EMUL_OP_IRQ = M68K_EMUL_BREAK + OP_IRQ; -const uint16 M68K_EMUL_OP_SCSI_DISPATCH = M68K_EMUL_BREAK + OP_SCSI_DISPATCH; -const uint16 M68K_EMUL_OP_SCSI_ATOMIC = M68K_EMUL_BREAK + OP_SCSI_ATOMIC; -const uint16 M68K_EMUL_OP_CHECK_SYSV = M68K_EMUL_BREAK + OP_CHECK_SYSV; -const uint16 M68K_EMUL_OP_NTRB_17_PATCH = M68K_EMUL_BREAK + OP_NTRB_17_PATCH; -const uint16 M68K_EMUL_OP_NTRB_17_PATCH2 = M68K_EMUL_BREAK + OP_NTRB_17_PATCH2; -const uint16 M68K_EMUL_OP_NTRB_17_PATCH3 = M68K_EMUL_BREAK + OP_NTRB_17_PATCH3; -const uint16 M68K_EMUL_OP_NTRB_17_PATCH4 = M68K_EMUL_BREAK + OP_NTRB_17_PATCH4; -const uint16 M68K_EMUL_OP_CHECKLOAD = M68K_EMUL_BREAK + OP_CHECKLOAD; -const uint16 M68K_EMUL_OP_EXTFS_COMM = M68K_EMUL_BREAK + OP_EXTFS_COMM; -const uint16 M68K_EMUL_OP_EXTFS_HFS = M68K_EMUL_BREAK + OP_EXTFS_HFS; -const uint16 M68K_EMUL_OP_IDLE_TIME = M68K_EMUL_BREAK + OP_IDLE_TIME; -const uint16 M68K_EMUL_OP_IDLE_TIME_2 = M68K_EMUL_BREAK + OP_IDLE_TIME_2; - -extern "C" void EmulOp(M68kRegisters *r, uint32 pc, int selector); - -#endif diff --git a/SheepShaver/src/include/ether.h b/SheepShaver/src/include/ether.h deleted file mode 100644 index b46a08e6..00000000 --- a/SheepShaver/src/include/ether.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * ether.h - SheepShaver Ethernet Device Driver - * - * SheepShaver (C) 1997-2008 Marc Hellwig and Christian Bauer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef ETHER_H -#define ETHER_H - -struct queue; -struct msgb; -typedef struct queue queue_t; -typedef struct msgb mblk_t; - -extern uint8 InitStreamModule(void *theID); -extern void TerminateStreamModule(void); -extern int ether_open(queue_t *rdq, void *dev, int flag, int sflag, void *creds); -extern int ether_close(queue_t *rdq, int flag, void *creds); -extern int ether_wput(queue_t *q, mblk_t *mp); -extern int ether_rsrv(queue_t *q); - -// System specific and internal functions/data -extern void EtherInit(void); -extern void EtherExit(void); - -extern void EtherIRQ(void); - -extern void AO_get_ethernet_address(uint32 addr); -extern void AO_enable_multicast(uint32 addr); -extern void AO_disable_multicast(uint32 addr); -extern void AO_transmit_packet(uint32 mp); - -extern mblk_t *allocb(size_t size, int pri); -extern void OTEnterInterrupt(void); -extern void OTLeaveInterrupt(void); - -extern void ether_dispatch_packet(uint32 p, uint32 length); -extern void ether_packet_received(mblk_t *mp); - -extern bool ether_driver_opened; - -// Ethernet packet allocator (optimized for 32-bit platforms in real addressing mode) -class EthernetPacket { -#if SIZEOF_VOID_P == 4 && REAL_ADDRESSING - uint8 packet[1516]; - public: - uint32 addr(void) const { return (uint32)packet; } -#else - uint32 packet; - public: - EthernetPacket(); - ~EthernetPacket(); - uint32 addr(void) const { return packet; } -#endif -}; - -// Copy packet data from message block to linear buffer (must hold at -// least 1514 bytes), returns packet length -static inline int ether_msgb_to_buffer(uint32 mp, uint8 *p) -{ - int len = 0; - while (mp) { - uint32 size = ReadMacInt32(mp + 16) - ReadMacInt32(mp + 12); - Mac2Host_memcpy(p, ReadMacInt32(mp + 12), size); - len += size; - p += size; - mp = ReadMacInt32(mp + 8); - } - return len; -} - -extern int32 num_wput; -extern int32 num_error_acks; -extern int32 num_tx_packets; -extern int32 num_tx_raw_packets; -extern int32 num_tx_normal_packets; -extern int32 num_tx_buffer_full; -extern int32 num_rx_packets; -extern int32 num_ether_irq; -extern int32 num_unitdata_ind; -extern int32 num_rx_fastpath; -extern int32 num_rx_no_mem; -extern int32 num_rx_dropped; -extern int32 num_rx_stream_not_ready; -extern int32 num_rx_no_unitdata_mem; - -#endif diff --git a/SheepShaver/src/include/ether_defs.h b/SheepShaver/src/include/ether_defs.h deleted file mode 100644 index 390aee4c..00000000 --- a/SheepShaver/src/include/ether_defs.h +++ /dev/null @@ -1,563 +0,0 @@ -/* - * ether_defs.h - Definitions for DLPI Ethernet Driver - * - * SheepShaver (C) 1997-2008 Marc Hellwig and Christian Bauer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef ETHER_DEFS_H -#define ETHER_DEFS_H - - -#if __MWERKS__ && __POWERPC__ -#define PRAGMA_ALIGN_SUPPORTED 1 -#define PACKED__ -#elif defined __GNUC__ -#define PACKED__ __attribute__ ((packed)) -#elif defined __sgi -#define PRAGMA_PACK_SUPPORTED 1 -#define PACKED__ -#else -#error "Packed attribute or pragma shall be supported" -#endif - - -/* - * Macros - */ - -// Get pointer to the read queue, assumes 'q' is a write queue ptr -#define RD(q) (&q[-1]) - -// Get pointer to the write queue, assumes 'q' is a read queue ptr -#define WR(q) (&q[1]) - -#define OTCompare48BitAddresses(p1, p2) \ - (*(const uint32*)((const uint8*)(p1)) == *(const uint32*)((const uint8*)(p2)) && \ - *(const uint16*)(((const uint8*)(p1))+4) == *(const uint16*)(((const uint8*)(p2))+4) ) - -#define OTCopy48BitAddress(p1, p2) \ - (*(uint32*)((uint8*)(p2)) = *(const uint32*)((const uint8*)(p1)), \ - *(uint16*)(((uint8*)(p2))+4) = *(const uint16*)(((const uint8*)(p1))+4) ) - -#define OTClear48BitAddress(p1) \ - (*(uint32*)((uint8*)(p1)) = 0, \ - *(uint16*)(((uint8*)(p1))+4) = 0 ) - -#define OTCompare8022SNAP(p1, p2) \ - (*(const uint32*)((const uint8*)(p1)) == *(const uint32*)((const uint8*)(p2)) && \ - *(((const uint8*)(p1))+4) == *(((const uint8*)(p2))+4) ) - -#define OTCopy8022SNAP(p1, p2) \ - (*(uint32*)((uint8*)(p2)) = *(const uint32*)((const uint8*)(p1)), \ - *(((uint8*)(p2))+4) = *(((const uint8*)(p1))+4) ) - -#define OTIs48BitBroadcastAddress(p1) \ - (*(uint32*)((uint8*)(p1)) == 0xffffffff && \ - *(uint16*)(((uint8*)(p1))+4) == 0xffff ) - -#define OTSet48BitBroadcastAddress(p1) \ - (*(uint32*)((uint8*)(p1)) = 0xffffffff, \ - *(uint16*)(((uint8*)(p1))+4) = 0xffff ) - -#define OTIs48BitZeroAddress(p1) \ - (*(uint32*)((uint8*)(p1)) == 0 && \ - *(uint16*)(((uint8*)(p1))+4) == 0 ) - - -/* - * Constants - */ - -enum { - // Address and packet lengths - kEnetPhysicalAddressLength = 6, - k8022SAPLength = 1, - k8022DLSAPLength = 2, - k8022SNAPLength = 5, - kMaxBoundAddrLength = 6 + 2 + 5, // addr/SAP/SNAP - kEnetAndSAPAddressLength = kEnetPhysicalAddressLength + k8022DLSAPLength, - kEnetPacketHeaderLength = (2 * kEnetPhysicalAddressLength) + k8022DLSAPLength, - k8022BasicHeaderLength = 3, // SSAP/DSAP/Control - k8022SNAPHeaderLength = k8022SNAPLength + k8022BasicHeaderLength, - kMinDIXSAP = 1501, - kEnetTSDU = 1514, - - // Special addresses - kSNAPSAP = 0xaa, - kMax8022SAP = 0xfe, - k8022GlobalSAP = 0xff, - kIPXSAP = 0xff, - - // DLPI interface states - DL_UNBOUND = 0, - - // Message types - M_DATA = 0, - M_PROTO = 1, - M_IOCTL = 14, - M_IOCACK = 129, - M_IOCNAK = 130, - M_PCPROTO = 131, // priority message - M_FLUSH = 134, - FLUSHDATA = 0, - FLUSHALL = 1, - FLUSHR = 1, - FLUSHW = 2, - FLUSHRW = 3, - - // DLPI primitives - DL_INFO_REQ = 0, - DL_BIND_REQ = 1, - DL_PEER_BIND = 1, - DL_HIERARCHICAL_BIND = 2, - DL_UNBIND_REQ = 2, - DL_INFO_ACK = 3, - DL_BIND_ACK = 4, - DL_ERROR_ACK = 5, - DL_OK_ACK = 6, - DL_UNITDATA_REQ = 7, - DL_UNITDATA_IND = 8, - DL_UDERROR_IND = 9, - DL_SUBS_UNBIND_REQ = 21, - DL_SUBS_BIND_REQ = 27, - DL_SUBS_BIND_ACK = 28, - DL_ENABMULTI_REQ = 29, - DL_DISABMULTI_REQ = 30, - DL_PHYS_ADDR_REQ = 49, - DL_PHYS_ADDR_ACK = 50, - DL_FACT_PHYS_ADDR = 1, - DL_CURR_PHYS_ADDR = 2, - - // DLPI states - DL_IDLE = 3, - - // DLPI error codes - DL_BADADDR = 1, // improper address format - DL_OUTSTATE = 3, // improper state - DL_SYSERR = 4, // UNIX system error - DL_UNSUPPORTED = 7, // service unsupported - DL_BADPRIM = 9, // primitive unknown - DL_NOTSUPPORTED = 18, // primitive not implemented - DL_TOOMANY = 19, // limit exceeded - - // errnos - MAC_ENXIO = 6, - MAC_ENOMEM = 12, - MAC_EINVAL = 22, - - // Various DLPI constants - DL_CLDLS = 2, // connectionless data link service - DL_STYLE1 = 0x500, - DL_VERSION_2 = 2, - DL_CSMACD = 0, - DL_ETHER = 4, - DL_UNKNOWN = -1, - - // ioctl() codes - I_OTSetFramingType = (('O' << 8) | 2), - kOTGetFramingValue = -1, - kOTFramingEthernet = 1, - kOTFramingEthernetIPX = 2, - kOTFramingEthernet8023 = 4, - kOTFraming8022 = 8, - I_OTSetRawMode = (('O' << 8) | 3), - DL_IOC_HDR_INFO = (('l' << 8) | 10), - - // Buffer allocation priority - BPRI_LO = 1, - BPRI_HI = 3, - - // Misc constants - kEnetModuleID = 7101 -}; - -enum EAddrType { - keaStandardAddress = 0, - keaMulticast, - keaBroadcast, - keaBadAddress -}; - - -/* - * Data member wrappers - */ - -// Forward declarations -struct datab; -struct msgb; -struct queue; -struct multicast_node; -struct DLPIStream; - -// Optimize for 32-bit big endian targets -#if defined(WORDS_BIGENDIAN) && (SIZEOF_VOID_P == 4) - -// Predefined member types -typedef int8 nw_int8; -typedef int16 nw_int16; -typedef int32 nw_int32; -typedef uint8 nw_uint8; -typedef uint16 nw_uint16; -typedef uint32 nw_uint32; -typedef int nw_bool; -typedef uint8 * nw_uint8_p; -typedef void * nw_void_p; -typedef datab * nw_datab_p; -typedef msgb * nw_msgb_p; -typedef queue * nw_queue_p; -typedef multicast_node *nw_multicast_node_p; -typedef DLPIStream * nw_DLPIStream_p; - -#else - -// Big-endian memory accessor -template< int nbytes > -struct nw_memory_helper; - -template<> -struct nw_memory_helper<1> { - static inline uint8 load(void *ptr) { return *((uint8 *)ptr); } - static inline void store(void *ptr, uint8 val) { *((uint8 *)ptr) = val; } -}; - -template<> -struct nw_memory_helper<2> { - static inline uint16 load(void *ptr) { return ntohs(*((uint16 *)ptr)); } - static inline void store(void *ptr, uint16 val) { *((uint16 *)ptr) = htons(val); } -}; - -template<> -struct nw_memory_helper<4> { - static inline uint32 load(void *ptr) { return ntohl(*((uint32 *)ptr)); } - static inline void store(void *ptr, uint32 val) { *((uint32 *)ptr) = htonl(val); } -}; - -// Scalar data member wrapper (specialise for pointer member types?) -template< class type, class public_type > -class nw_scalar_member_helper { - uint8 _pad[sizeof(type)]; -public: - operator public_type () const { - return (public_type)(uintptr)nw_memory_helper::load((void *)this); - } - public_type operator -> () const { - return this->operator public_type (); - } - nw_scalar_member_helper & operator = (public_type val) { - nw_memory_helper::store((void *)this, (type)(uintptr)val); - return *this; - } - nw_scalar_member_helper & operator += (int val) { - *this = *this + val; - return *this; - } - nw_scalar_member_helper & operator -= (int val) { - *this = *this - val; - return *this; - } - nw_scalar_member_helper & operator &= (int val) { - *this = *this & val; - return *this; - } - nw_scalar_member_helper & operator |= (int val) { - *this = *this | val; - return *this; - } -}; - -// Predefined member types -typedef nw_scalar_member_helper nw_int8; -typedef nw_scalar_member_helper nw_int16; -typedef nw_scalar_member_helper nw_int32; -typedef nw_scalar_member_helper nw_uint8; -typedef nw_scalar_member_helper nw_uint16; -typedef nw_scalar_member_helper nw_uint32; -typedef nw_scalar_member_helper nw_bool; -typedef nw_scalar_member_helper nw_uint8_p; -typedef nw_scalar_member_helper nw_void_p; -typedef nw_scalar_member_helper nw_datab_p; -typedef nw_scalar_member_helper nw_msgb_p; -typedef nw_scalar_member_helper nw_queue_p; -typedef nw_scalar_member_helper nw_multicast_node_p; -typedef nw_scalar_member_helper nw_DLPIStream_p; - -#endif - - -/* - * Structures - */ - -// Data block -struct datab { - nw_datab_p db_freep; - nw_uint8_p db_base; - nw_uint8_p db_lim; - nw_uint8 db_ref; - nw_uint8 db_type; - // ... -}; - -// Message block -struct msgb { - nw_msgb_p b_next; - nw_msgb_p b_prev; - nw_msgb_p b_cont; - nw_uint8_p b_rptr; - nw_uint8_p b_wptr; - nw_datab_p b_datap; - // ... -}; - -// Queue (full structure required because of size) -struct queue { - nw_void_p q_qinfo; - nw_msgb_p q_first; - nw_msgb_p q_last; - nw_queue_p q_next; - nw_queue_p q_link; - nw_DLPIStream_p q_ptr; - nw_uint32 q_count; - nw_int32 q_minpsz; - nw_int32 q_maxpsz; - nw_uint32 q_hiwat; - nw_uint32 q_lowat; - nw_void_p q_bandp; - nw_uint16 q_flag; - nw_uint8 q_nband; - uint8 _q_pad1[1]; - nw_void_p q_osx; - nw_queue_p q_ffcp; - nw_queue_p q_bfcp; -}; -typedef struct queue queue_t; - -// M_IOCTL parameters -struct iocblk { - nw_int32 ioc_cmd; - nw_void_p ioc_cr; - nw_uint32 ioc_id; - nw_uint32 ioc_count; - nw_int32 ioc_error; - nw_int32 ioc_rval; - int32 _ioc_filler[4]; -}; - -// Priority specification -struct dl_priority_t { - nw_int32 dl_min, dl_max; -}; - -// DPLI primitives -struct dl_info_req_t { - nw_uint32 dl_primitive; // DL_INFO_REQ -}; - -struct dl_info_ack_t { - nw_uint32 dl_primitive; // DL_INFO_ACK - nw_uint32 dl_max_sdu; - nw_uint32 dl_min_sdu; - nw_uint32 dl_addr_length; - nw_uint32 dl_mac_type; - nw_uint32 dl_reserved; - nw_uint32 dl_current_state; - nw_int32 dl_sap_length; - nw_uint32 dl_service_mode; - nw_uint32 dl_qos_length; - nw_uint32 dl_qos_offset; - nw_uint32 dl_qos_range_length; - nw_uint32 dl_qos_range_offset; - nw_uint32 dl_provider_style; - nw_uint32 dl_addr_offset; - nw_uint32 dl_version; - nw_uint32 dl_brdcst_addr_length; - nw_uint32 dl_brdcst_addr_offset; - nw_uint32 dl_growth; -}; - -struct dl_bind_req_t { - nw_uint32 dl_primitive; // DL_BIND_REQ - nw_uint32 dl_sap; - nw_uint32 dl_max_conind; - nw_uint16 dl_service_mode; - nw_uint16 dl_conn_mgmt; - nw_uint32 dl_xidtest_flg; -}; - -struct dl_bind_ack_t { - nw_uint32 dl_primitive; // DL_BIND_ACK - nw_uint32 dl_sap; - nw_uint32 dl_addr_length; - nw_uint32 dl_addr_offset; - nw_uint32 dl_max_conind; - nw_uint32 dl_xidtest_flg; -}; - -struct dl_error_ack_t { - nw_uint32 dl_primitive; // DL_ERROR_ACK - nw_uint32 dl_error_primitive; - nw_uint32 dl_errno; - nw_uint32 dl_unix_errno; -}; - -struct dl_ok_ack_t { - nw_uint32 dl_primitive; // DL_ERROR_ACK - nw_uint32 dl_correct_primitive; -}; - -struct dl_unitdata_req_t { - nw_uint32 dl_primitive; // DL_UNITDATA_REQ - nw_uint32 dl_dest_addr_length; - nw_uint32 dl_dest_addr_offset; - dl_priority_t dl_priority; -}; - -struct dl_unitdata_ind_t { - nw_uint32 dl_primitive; // DL_UNITDATA_IND - nw_uint32 dl_dest_addr_length; - nw_uint32 dl_dest_addr_offset; - nw_uint32 dl_src_addr_length; - nw_uint32 dl_src_addr_offset; - nw_uint32 dl_group_address; -}; - -struct dl_uderror_ind_t { - nw_uint32 dl_primitive; // DL_UDERROR_IND - nw_uint32 dl_dest_addr_length; - nw_uint32 dl_dest_addr_offset; - nw_uint32 dl_unix_errno; - nw_uint32 dl_errno; -}; - -struct dl_subs_bind_req_t { - nw_uint32 dl_primitive; // DL_SUBS_BIND_REQ - nw_uint32 dl_subs_sap_offset; - nw_uint32 dl_subs_sap_length; - nw_uint32 dl_subs_bind_class; -}; - -struct dl_subs_bind_ack_t { - nw_uint32 dl_primitive; // DL_SUBS_BIND_ACK - nw_uint32 dl_subs_sap_offset; - nw_uint32 dl_subs_sap_length; -}; - -struct dl_subs_unbind_req_t { - nw_uint32 dl_primitive; // DL_SUBS_UNBIND_REQ - nw_uint32 dl_subs_sap_offset; - nw_uint32 dl_subs_sap_length; -}; - -struct dl_enabmulti_req_t { - nw_uint32 dl_primitive; // DL_ENABMULTI_REQ - nw_uint32 dl_addr_length; - nw_uint32 dl_addr_offset; -}; - -struct dl_disabmulti_req_t { - nw_uint32 dl_primitive; // DL_DISABMULTI_REQ - nw_uint32 dl_addr_length; - nw_uint32 dl_addr_offset; -}; - -struct dl_phys_addr_req_t { - nw_uint32 dl_primitive; // DL_PHYS_ADDR_REQ - nw_uint32 dl_addr_type; -}; - -struct dl_phys_addr_ack_t { - nw_uint32 dl_primitive; // DL_PHYS_ADDR_ACK - nw_uint32 dl_addr_length; - nw_uint32 dl_addr_offset; -}; - -// Parameters for I_OTSetRawMode/kOTSetRecvMode ioctl() -struct dl_recv_control_t { - nw_uint32 dl_primitive; - nw_uint32 dl_flags; - nw_uint32 dl_truncation_length; -}; - -union DL_primitives { - nw_uint32 dl_primitive; - dl_info_req_t info_req; - dl_info_ack_t info_ack; - dl_bind_req_t bind_req; - dl_bind_ack_t bind_ack; - dl_error_ack_t error_ack; - dl_ok_ack_t ok_ack; - dl_unitdata_req_t unitdata_req; - dl_unitdata_ind_t unitdata_ind; - dl_uderror_ind_t uderror_ind; - dl_subs_bind_req_t subs_bind_req; - dl_subs_bind_ack_t subs_bind_ack; - dl_subs_unbind_req_t subs_unbind_req; - dl_enabmulti_req_t enabmulti_req; - dl_disabmulti_req_t disabmulti_req; - dl_phys_addr_req_t phys_addr_req; - dl_phys_addr_ack_t phys_addr_ack; -}; - -#ifdef PRAGMA_ALIGN_SUPPORTED -#pragma options align=mac68k -#endif - -#ifdef PRAGMA_PACK_SUPPORTED -#pragma pack(1) -#endif - -// Packet headers -struct EnetPacketHeader { - uint8 fDestAddr[6]; - uint8 fSourceAddr[6]; - nw_uint16 fProto; -} PACKED__; - -struct T8022Header { - uint8 fDSAP; - uint8 fSSAP; - uint8 fCtrl; -} PACKED__; - -struct T8022SNAPHeader { - uint8 fDSAP; - uint8 fSSAP; - uint8 fCtrl; - uint8 fSNAP[k8022SNAPLength]; -} PACKED__; - -struct T8022FullPacketHeader { - EnetPacketHeader fEnetPart; - T8022SNAPHeader f8022Part; -} PACKED__; - -struct T8022AddressStruct { - uint8 fHWAddr[6]; - nw_uint16 fSAP; - uint8 fSNAP[k8022SNAPLength]; -} PACKED__; - -#ifdef PRAGMA_PACK_SUPPORTED -#pragma pack(0) -#endif - -#ifdef PRAGMA_ALIGN_SUPPORTED -#pragma options align=reset -#endif - -#endif diff --git a/SheepShaver/src/include/extfs.h b/SheepShaver/src/include/extfs.h deleted file mode 120000 index a86e2538..00000000 --- a/SheepShaver/src/include/extfs.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/include/extfs.h \ No newline at end of file diff --git a/SheepShaver/src/include/extfs_defs.h b/SheepShaver/src/include/extfs_defs.h deleted file mode 120000 index 0970ce1f..00000000 --- a/SheepShaver/src/include/extfs_defs.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/include/extfs_defs.h \ No newline at end of file diff --git a/SheepShaver/src/include/macos_util.h b/SheepShaver/src/include/macos_util.h deleted file mode 100644 index 0b8e3eee..00000000 --- a/SheepShaver/src/include/macos_util.h +++ /dev/null @@ -1,376 +0,0 @@ -/* - * macos_util.h - MacOS definitions/utility functions - * - * SheepShaver (C) Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef MACOS_UTIL_H -#define MACOS_UTIL_H - -#include "cpu_emulation.h" -#include "thunks.h" -#include - - -/* - * General definitions - */ - -struct Point { - int16 v; - int16 h; -}; - -struct Rect { - int16 top; - int16 left; - int16 bottom; - int16 right; -}; - - -/* - * Queues - */ - -enum { // Queue types - dummyType = 0, - vType = 1, - ioQType = 2, - drvQType = 3, - evType = 4, - fsQType = 5, - sIQType = 6, - dtQType = 7, - nmType = 8 -}; - -enum { // QElem struct - qLink = 0, - qType = 4, - qData = 6 -}; - -enum { // QHdr struct - qFlags = 0, - qHead = 2, - qTail = 6 -}; - - -/* - * Definitions for Deferred Task Manager - */ - -enum { // DeferredTask struct - dtFlags = 6, - dtAddr = 8, - dtParam = 12, - dtReserved = 16 -}; - - -/* - * Definitions for Device Manager - */ - -// Error codes -enum { - noErr = 0, - controlErr = -17, /* I/O System Errors */ - statusErr = -18, /* I/O System Errors */ - readErr = -19, /* I/O System Errors */ - writErr = -20, /* I/O System Errors */ - badUnitErr = -21, /* I/O System Errors */ - unitEmptyErr = -22, /* I/O System Errors */ - openErr = -23, /* I/O System Errors */ - closErr = -24, /* I/O System Errors */ - abortErr = -27, /* IO call aborted by KillIO */ - notOpenErr = -28, /* Driver not open */ - dskFulErr = -34, /* disk full */ - nsvErr = -35, /* no such volume */ - ioErr = -36, /* I/O error (bummers) */ - bdNamErr = -37, /* bad name */ - fnOpnErr = -38, /* file not open */ - eofErr = -39, /* End-of-file encountered */ - posErr = -40, /* tried to position to before start of file (r/w) */ - tmfoErr = -42, /* too many files open */ - fnfErr = -43, /* file not found */ - wPrErr = -44, /* diskette is write protected. */ - fLckdErr = -45, /* file is locked */ - fBsyErr = -47, /* file busy, dir not empty */ - dupFNErr = -48, /* duplicate filename already exists */ - paramErr = -50, /* error in user parameter list */ - rfNumErr = -51, /* bad ioRefNum */ - permErr = -54, /* permission error */ - nsDrvErr = -56, /* no such driver number */ - extFSErr = -58, /* external file system */ - noDriveErr = -64, /* drive not installed */ - offLinErr = -65, /* r/w requested for an off-line drive */ - noNybErr = -66, /* couldn't find 5 nybbles in 200 tries */ - noAdrMkErr = -67, /* couldn't find valid addr mark */ - dataVerErr = -68, /* read verify compare failed */ - badCksmErr = -69, /* addr mark checksum didn't check */ - badBtSlpErr = -70, /* bad addr mark bit slip nibbles */ - noDtaMkErr = -71, /* couldn't find a data mark header */ - badDCksum = -72, /* bad data mark checksum */ - badDBtSlp = -73, /* bad data mark bit slip nibbles */ - wrUnderrun = -74, /* write underrun occurred */ - cantStepErr = -75, /* step handshake failed */ - tk0BadErr = -76, /* track 0 detect doesn't change */ - initIWMErr = -77, /* unable to initialize IWM */ - twoSideErr = -78, /* tried to read 2nd side on a 1-sided drive */ - spdAdjErr = -79, /* unable to correctly adjust disk speed */ - seekErr = -80, /* track number wrong on address mark */ - sectNFErr = -81, /* sector number never found on a track */ - fmt1Err = -82, /* can't find sector 0 after track format */ - fmt2Err = -83, /* can't get enough sync */ - verErr = -84, /* track failed to verify */ - memFullErr = -108, - dirNFErr = -120 /* directory not found */ -}; - -// Misc constants -enum { - goodbye = -1, /* heap being reinitialized */ - - ioInProgress = 1, /* predefined value of ioResult while I/O is pending */ - aRdCmd = 2, /* low byte of ioTrap for Read calls */ - aWrCmd = 3, /* low byte of ioTrap for Write calls */ - asyncTrpBit = 10, /* trap word modifier */ - noQueueBit = 9, /* trap word modifier */ - - dReadEnable = 0, /* set if driver responds to read requests */ - dWritEnable = 1, /* set if driver responds to write requests */ - dCtlEnable = 2, /* set if driver responds to control requests */ - dStatEnable = 3, /* set if driver responds to status requests */ - dNeedGoodBye = 4, /* set if driver needs time for performing periodic tasks */ - dNeedTime = 5, /* set if driver needs time for performing periodic tasks */ - dNeedLock = 6, /* set if driver must be locked in memory as soon as it is opened */ - - dOpened = 5, /* driver is open */ - dRAMBased = 6, /* dCtlDriver is a handle (1) or pointer (0) */ - drvrActive = 7, /* driver is currently processing a request */ - - rdVerify = 64, - - fsCurPerm = 0, // Whatever is currently allowed - fsRdPerm = 1, // Exclusive read - fsWrPerm = 2, // Exclusive write - fsRdWrPerm = 3, // Exclusive read/write - fsRdWrShPerm = 4, // Shared read/write - - fsAtMark = 0, // At current mark - fsFromStart = 1, // Set mark rel to BOF - fsFromLEOF = 2, // Set mark rel to logical EOF - fsFromMark = 3, // Set mark rel to current mark - - sony = 0, - hard20 = 1 -}; - -enum { /* Large Volume Constants */ - kWidePosOffsetBit = 8, - kMaximumBlocksIn4GB = 0x007FFFFF -}; - -enum { // IOParam struct - ioTrap = 6, - ioCmdAddr = 8, - ioCompletion = 12, - ioResult = 16, - ioNamePtr = 18, - ioVRefNum = 22, - ioRefNum = 24, - ioVersNum = 26, - ioPermssn = 27, - ioMisc = 28, - ioBuffer = 32, - ioReqCount = 36, - ioActCount = 40, - ioPosMode = 44, - ioPosOffset = 46, - ioWPosOffset = 46, // Wide positioning offset when ioPosMode has kWidePosOffsetBit set - SIZEOF_IOParam = 50 -}; - -enum { // CntrlParam struct - csCode = 26, - csParam = 28 -}; - -enum { // DrvSts struct - dsTrack = 0, - dsWriteProt = 2, - dsDiskInPlace = 3, - dsInstalled = 4, - dsSides = 5, - dsQLink = 6, - dsQType = 10, - dsQDrive = 12, - dsQRefNum = 14, - dsQFSID = 16, - dsTwoSideFmt = 18, - dsNewIntf = 19, - dsDiskErrs = 20, - dsMFMDrive = 22, - dsMFMDisk = 23, - dsTwoMegFmt = 24 -}; - -enum { // DrvSts2 struct - dsDriveSize = 18, - dsDriveS1 = 20, - dsDriveType = 22, - dsDriveManf = 24, - dsDriveChar = 26, - dsDriveMisc = 28, - SIZEOF_DrvSts = 30 -}; - -enum { // DCtlEntry struct - dCtlDriver = 0, - dCtlFlags = 4, - dCtlQHdr = 6, - dCtlPosition = 16, - dCtlStorage = 20, - dCtlRefNum = 24, - dCtlCurTicks = 26, - dCtlWindow = 30, - dCtlDelay = 34, - dCtlEMask = 36, - dCtlMenu = 38, - dCtlSlot = 40, - dCtlSlotId = 41, - dCtlDevBase = 42, - dCtlOwner = 46, - dCtlExtDev = 50, - dCtlFillByte = 51, - dCtlNodeID = 52 -}; - - -/* - * Definitions for native Device Manager - */ - -// Registry EntryID -struct RegEntryID { - uint32 contents[4]; -}; - -// Command codes -enum { - kOpenCommand = 0, - kCloseCommand = 1, - kReadCommand = 2, - kWriteCommand = 3, - kControlCommand = 4, - kStatusCommand = 5, - kKillIOCommand = 6, - kInitializeCommand = 7, /* init driver and device*/ - kFinalizeCommand = 8, /* shutdown driver and device*/ - kReplaceCommand = 9, /* replace an old driver*/ - kSupersededCommand = 10, /* prepare to be replaced by a new driver*/ - kSuspendCommand = 11, /* prepare driver to go to sleep*/ - kResumeCommand = 12 /* wake up sleeping driver*/ -}; - -// Command kinds -enum { - kSynchronousIOCommandKind = 0x00000001, - kAsynchronousIOCommandKind = 0x00000002, - kImmediateIOCommandKind = 0x00000004 -}; - - -/* - * Definitions for Mixed Mode Manager - */ - -typedef uint32 ProcInfoType; -typedef int8 ISAType; -typedef uint16 RoutineFlagsType; -typedef uint32 ProcPtr; -typedef uint8 RDFlagsType; - -struct RoutineRecord { - ProcInfoType procInfo; /* calling conventions */ - int8 reserved1; /* Must be 0 */ - ISAType ISA; /* Instruction Set Architecture */ - RoutineFlagsType routineFlags; /* Flags for each routine */ - ProcPtr procDescriptor; /* Where is the thing weÕre calling? */ - uint32 reserved2; /* Must be 0 */ - uint32 selector; /* For dispatched routines, the selector */ -}; - -struct RoutineDescriptor { - uint16 goMixedModeTrap; /* Our A-Trap */ - int8 version; /* Current Routine Descriptor version */ - RDFlagsType routineDescriptorFlags; /* Routine Descriptor Flags */ - uint32 reserved1; /* Unused, must be zero */ - uint8 reserved2; /* Unused, must be zero */ - uint8 selectorInfo; /* If a dispatched routine, calling convention, else 0 */ - uint16 routineCount; /* Number of routines in this RD */ - RoutineRecord routineRecords[1]; /* The individual routines */ -}; - -struct SheepRoutineDescriptor - : public SheepVar -{ - SheepRoutineDescriptor(ProcInfoType procInfo, uint32 procedure) - : SheepVar(sizeof(RoutineDescriptor)) - { - const uintptr desc = addr(); - Mac_memset(desc, 0, sizeof(RoutineDescriptor)); - WriteMacInt16(desc + offsetof(RoutineDescriptor, goMixedModeTrap), 0xAAFE); - WriteMacInt8 (desc + offsetof(RoutineDescriptor, version), 7); - WriteMacInt32(desc + offsetof(RoutineDescriptor, routineRecords) + offsetof(RoutineRecord, procInfo), procInfo); - WriteMacInt8 (desc + offsetof(RoutineDescriptor, routineRecords) + offsetof(RoutineRecord, ISA), 1); - WriteMacInt16(desc + offsetof(RoutineDescriptor, routineRecords) + offsetof(RoutineRecord, routineFlags), 0 | 0 | 4); - WriteMacInt32(desc + offsetof(RoutineDescriptor, routineRecords) + offsetof(RoutineRecord, procDescriptor), procedure); - } -}; - - -// Functions -extern void MacOSUtilReset(void); -extern void Enqueue(uint32 elem, uint32 list); // Enqueue QElem to list -extern int FindFreeDriveNumber(int num); // Find first free drive number, starting at "num" -extern void MountVolume(void *fh); // Mount volume with given file handle (see sys.h) -extern void FileDiskLayout(loff_t size, uint8 *data, loff_t &start_byte, loff_t &real_size); // Calculate disk image file layout given file size and first 256 data bytes -extern uint32 FindLibSymbol(const char *lib, const char *sym); // Find symbol in shared library -extern void InitCallUniversalProc(void); // Init CallUniversalProc() -extern long CallUniversalProc(void *upp, uint32 info); // CallUniversalProc() -extern uint32 TimeToMacTime(time_t t); // Convert time_t value to MacOS time -extern uint32 Mac_sysalloc(uint32 size); // Allocate block in MacOS system heap zone -extern void Mac_sysfree(uint32 addr); // Release block occupied by the nonrelocatable block p - -// Construct four-character-code from string -#define FOURCC(a,b,c,d) (((uint32)(a) << 24) | ((uint32)(b) << 16) | ((uint32)(c) << 8) | (uint32)(d)) - -// Emulator identification codes (4 and 2 characters) -const uint32 EMULATOR_ID_4 = 0x62616168; // 'baah' -const uint16 EMULATOR_ID_2 = 0x6261; // 'ba' - -// Test if basic MacOS initializations (of the ROM) are done -static inline bool HasMacStarted(void) -{ - return ReadMacInt32(0xcfc) == FOURCC('W','L','S','C'); // Mac warm start flag -} - -#endif diff --git a/SheepShaver/src/include/main.h b/SheepShaver/src/include/main.h deleted file mode 100644 index e595c04a..00000000 --- a/SheepShaver/src/include/main.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * main.h - Emulation core - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef MAIN_H -#define MAIN_H - -// Global variables -extern void *TOC; // TOC pointer -extern void *R13; // r13 register -extern uint32 KernelDataAddr; // Address of Kernel Data -extern uint32 BootGlobsAddr; // Address of BootGlobs structure at top of Mac RAM -extern uint32 PVR; // Theoretical PVR -extern int64 CPUClockSpeed; // Processor clock speed (Hz) -extern int64 BusClockSpeed; // Bus clock speed (Hz) -extern int64 TimebaseSpeed; // Timebase clock speed (Hz) - -#ifdef __BEOS__ -extern system_info SysInfo; // System information -#endif - -// 68k register structure (for Execute68k()) -struct M68kRegisters { - uint32 d[8]; - uint32 a[8]; -}; - - -// Functions -extern bool InitAll(const char *vmdir); -extern void ExitAll(void); -extern void Dump68kRegs(M68kRegisters *r); // Dump 68k registers -extern void MakeExecutable(int dummy, uint32 start, uint32 length); // Make code executable -extern void PatchAfterStartup(void); // Patches after system startup -extern void QuitEmulator(void); // Quit emulator (must only be called from main thread) -extern void ErrorAlert(const char *text); // Display error alert -extern void WarningAlert(const char *text); // Display warning alert -extern bool ChoiceAlert(const char *text, const char *pos, const char *neg); // Display choice alert - -// Mutexes (non-recursive) -struct B2_mutex; -extern B2_mutex *B2_create_mutex(void); -extern void B2_lock_mutex(B2_mutex *mutex); -extern void B2_unlock_mutex(B2_mutex *mutex); -extern void B2_delete_mutex(B2_mutex *mutex); - -// Interrupt flags -enum { - INTFLAG_VIA = 1, // 60.15Hz VBL - INTFLAG_SERIAL = 2, // Serial driver - INTFLAG_ETHER = 4, // Ethernet driver - INTFLAG_AUDIO = 16, // Audio block read - INTFLAG_TIMER = 32, // Time Manager - INTFLAG_ADB = 64 // ADB -}; - -extern volatile uint32 InterruptFlags; // Currently pending interrupts -extern void SetInterruptFlag(uint32); -extern void ClearInterruptFlag(uint32); -extern void TriggerInterrupt(void); // Trigger SIGUSR1 interrupt in emulator thread -extern void DisableInterrupt(void); // Disable SIGUSR1 interrupt (can be nested) -extern void EnableInterrupt(void); // Enable SIGUSR1 interrupt (can be nested) - -#endif diff --git a/SheepShaver/src/include/name_registry.h b/SheepShaver/src/include/name_registry.h deleted file mode 100644 index ef7cbbfe..00000000 --- a/SheepShaver/src/include/name_registry.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * name_registry.h - Name Registry handling - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef NAME_REGISTRY_H -#define NAME_REGISTRY_H - -extern void DoPatchNameRegistry(void); -extern void PatchNameRegistry(void); - -#endif diff --git a/SheepShaver/src/include/pict.h b/SheepShaver/src/include/pict.h deleted file mode 120000 index 6e5a0b71..00000000 --- a/SheepShaver/src/include/pict.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/include/pict.h \ No newline at end of file diff --git a/SheepShaver/src/include/prefs.h b/SheepShaver/src/include/prefs.h deleted file mode 120000 index 64a7ae51..00000000 --- a/SheepShaver/src/include/prefs.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/include/prefs.h \ No newline at end of file diff --git a/SheepShaver/src/include/prefs_editor.h b/SheepShaver/src/include/prefs_editor.h deleted file mode 100644 index 68b0326d..00000000 --- a/SheepShaver/src/include/prefs_editor.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * prefs_editor.h - Preferences editor - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PREFS_EDITOR_H -#define PREFS_EDITOR_H - -#ifdef __BEOS__ -extern void PrefsEditor(uint32 msg); -#else -extern bool PrefsEditor(void); -#endif - -#endif diff --git a/SheepShaver/src/include/rom_patches.h b/SheepShaver/src/include/rom_patches.h deleted file mode 100644 index c263606a..00000000 --- a/SheepShaver/src/include/rom_patches.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * rom_patches.h - ROM patches - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef ROM_PATCHES_H -#define ROM_PATCHES_H - -// ROM types -enum { - ROMTYPE_TNT, - ROMTYPE_ALCHEMY, - ROMTYPE_ZANZIBAR, - ROMTYPE_GAZELLE, - ROMTYPE_GOSSAMER, - ROMTYPE_NEWWORLD -}; -extern int ROMType; - -extern bool DecodeROM(uint8 *data, uint32 size); -extern bool PatchROM(void); -extern void InstallDrivers(void); - -extern void AddSifter(uint32 type, int16 id); -extern bool FindSifter(uint32 type, int16 id); - -#endif diff --git a/SheepShaver/src/include/rsrc_patches.h b/SheepShaver/src/include/rsrc_patches.h deleted file mode 100644 index 2f367e12..00000000 --- a/SheepShaver/src/include/rsrc_patches.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * rsrc_patches.h - Resource patches - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef RSRC_PATCHES_H -#define RSRC_PATCHES_H - -extern void CheckLoad(uint32 type, int16 id, uint16 *p, uint32 size); -extern void CheckLoad(uint32 type, const char *name, uint16 *p, uint32 size); -extern void PatchNativeResourceManager(void); - -#endif diff --git a/SheepShaver/src/include/scsi.h b/SheepShaver/src/include/scsi.h deleted file mode 120000 index b5aa39cc..00000000 --- a/SheepShaver/src/include/scsi.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/include/scsi.h \ No newline at end of file diff --git a/SheepShaver/src/include/serial.h b/SheepShaver/src/include/serial.h deleted file mode 120000 index 42183f36..00000000 --- a/SheepShaver/src/include/serial.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/include/serial.h \ No newline at end of file diff --git a/SheepShaver/src/include/serial_defs.h b/SheepShaver/src/include/serial_defs.h deleted file mode 120000 index 1765fd10..00000000 --- a/SheepShaver/src/include/serial_defs.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/include/serial_defs.h \ No newline at end of file diff --git a/SheepShaver/src/include/sony.h b/SheepShaver/src/include/sony.h deleted file mode 120000 index d9eb3144..00000000 --- a/SheepShaver/src/include/sony.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/include/sony.h \ No newline at end of file diff --git a/SheepShaver/src/include/sys.h b/SheepShaver/src/include/sys.h deleted file mode 120000 index 5581536a..00000000 --- a/SheepShaver/src/include/sys.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/include/sys.h \ No newline at end of file diff --git a/SheepShaver/src/include/thunks.h b/SheepShaver/src/include/thunks.h deleted file mode 100644 index e1280f39..00000000 --- a/SheepShaver/src/include/thunks.h +++ /dev/null @@ -1,222 +0,0 @@ -/* - * thunks.h - Thunks to share data and code with MacOS - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef THUNKS_H -#define THUNKS_H - -#include "cpu_emulation.h" - -/* - * Native function invocation - */ - -enum { - NATIVE_PATCH_NAME_REGISTRY, - NATIVE_VIDEO_INSTALL_ACCEL, - NATIVE_VIDEO_VBL, - NATIVE_VIDEO_DO_DRIVER_IO, - NATIVE_ETHER_AO_GET_HWADDR, - NATIVE_ETHER_AO_ADD_MULTI, - NATIVE_ETHER_AO_DEL_MULTI, - NATIVE_ETHER_AO_SEND_PACKET, - NATIVE_ETHER_IRQ, - NATIVE_ETHER_INIT, - NATIVE_ETHER_TERM, - NATIVE_ETHER_OPEN, - NATIVE_ETHER_CLOSE, - NATIVE_ETHER_WPUT, - NATIVE_ETHER_RSRV, - NATIVE_SERIAL_NOTHING, - NATIVE_SERIAL_OPEN, - NATIVE_SERIAL_PRIME_IN, - NATIVE_SERIAL_PRIME_OUT, - NATIVE_SERIAL_CONTROL, - NATIVE_SERIAL_STATUS, - NATIVE_SERIAL_CLOSE, - NATIVE_GET_RESOURCE, - NATIVE_GET_1_RESOURCE, - NATIVE_GET_IND_RESOURCE, - NATIVE_GET_1_IND_RESOURCE, - NATIVE_R_GET_RESOURCE, - NATIVE_MAKE_EXECUTABLE, - NATIVE_CHECK_LOAD_INVOC, - NATIVE_NQD_SYNC_HOOK, - NATIVE_NQD_BITBLT_HOOK, - NATIVE_NQD_FILLRECT_HOOK, - NATIVE_NQD_UNKNOWN_HOOK, - NATIVE_NQD_BITBLT, - NATIVE_NQD_INVRECT, - NATIVE_NQD_FILLRECT, - NATIVE_NAMED_CHECK_LOAD_INVOC, - NATIVE_GET_NAMED_RESOURCE, - NATIVE_GET_1_NAMED_RESOURCE, - NATIVE_OP_MAX -}; - -// Initialize the thunks system -extern bool ThunksInit(void); - -// Exit the thunks system -extern void ThunksExit(void); - -// Return the fake PowerPC opcode to handle specified native code -#if EMULATED_PPC -extern uint32 NativeOpcode(int selector); -#endif - -// Return the native function descriptor (TVECT) -extern uint32 NativeTVECT(int selector); - -// Return the native function address -extern uint32 NativeFunction(int selector); - -// Return the routine descriptor address of the native function -extern uint32 NativeRoutineDescriptor(int selector); - - -/* - * Helpers to share 32-bit addressable data with MacOS - * - * There are two distinct allocatable regions: - * - * - The Data region is used to share data between MacOS and - * SheepShaver. This is stack-like allocation since it is - * meant to only hold temporary data which dies at the end - * of the current function scope. - * - * - The Procedure region is used to hold permanent M68K or - * PowerPC code to assist native routine implementations. - * - * - The Procedure region grows up whereas the Data region - * grows down. They may intersect into the ZeroPage, which - * is a read-only page with all bits set to zero. In practise, - * the intersection is unlikely since the Procedure region is - * static and the Data region is meant to be small (< 256 KB). - */ - -class SheepMem { - static uint32 align(uint32 size); -protected: - static uint32 page_size; - static uintptr zero_page; - static uintptr base; - static uintptr data; - static uintptr proc; - static const uint32 size = 0x80000; // 512 KB -public: - static bool Init(void); - static void Exit(void); - static uint32 PageSize(); - static uint32 ZeroPage(); - static uint32 Reserve(uint32 size); - static void Release(uint32 size); - static uint32 ReserveProc(uint32 size); - friend class SheepVar; -}; - -inline uint32 SheepMem::align(uint32 size) -{ - // Align on 4 bytes boundaries - return (size + 3) & -4; -} - -inline uint32 SheepMem::PageSize() -{ - return page_size; -} - -inline uint32 SheepMem::ZeroPage() -{ - return zero_page; -} - -inline uint32 SheepMem::Reserve(uint32 size) -{ - data -= align(size); - assert(data >= proc); - return data; -} - -inline void SheepMem::Release(uint32 size) -{ - data += align(size); -} - -inline uint32 SheepMem::ReserveProc(uint32 size) -{ - uint32 mproc = proc; - proc += align(size); - assert(proc < data); - return mproc; -} - -static inline uint32 SheepProc(const uint8 *proc, uint32 proc_size) -{ - uint32 mac_proc = SheepMem::ReserveProc(proc_size); - Host2Mac_memcpy(mac_proc, proc, proc_size); - return mac_proc; -} - -#define BUILD_SHEEPSHAVER_PROCEDURE(PROC) \ - static uint32 PROC = 0; \ - if (PROC == 0) \ - PROC = SheepProc(PROC##_template, sizeof(PROC##_template)) - -class SheepVar -{ - uint32 m_base; - uint32 m_size; -public: - SheepVar(uint32 requested_size); - ~SheepVar() { SheepMem::Release(m_size); } - uint32 addr() const { return m_base; } -}; - -inline SheepVar::SheepVar(uint32 requested_size) -{ - m_size = SheepMem::align(requested_size); - m_base = SheepMem::Reserve(m_size); -} - -// TODO: optimize for 32-bit platforms - -template< int requested_size > -struct SheepArray : public SheepVar -{ - SheepArray() : SheepVar(requested_size) { } -}; - -struct SheepVar32 : public SheepVar -{ - SheepVar32() : SheepVar(4) { } - SheepVar32(uint32 value) : SheepVar(4) { set_value(value); } - uint32 value() const { return ReadMacInt32(addr()); } - void set_value(uint32 v) { WriteMacInt32(addr(), v); } -}; - -struct SheepString : public SheepVar -{ - SheepString(const char *str) : SheepVar(strlen(str) + 1) - { if (str) strcpy(value(), str); else WriteMacInt8(addr(), 0); } - char *value() const - { return (char *)Mac2HostAddr(addr()); } -}; - -#endif diff --git a/SheepShaver/src/include/timer.h b/SheepShaver/src/include/timer.h deleted file mode 120000 index a7ee23e9..00000000 --- a/SheepShaver/src/include/timer.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/include/timer.h \ No newline at end of file diff --git a/SheepShaver/src/include/user_strings.h b/SheepShaver/src/include/user_strings.h deleted file mode 100644 index 12ea12eb..00000000 --- a/SheepShaver/src/include/user_strings.h +++ /dev/null @@ -1,194 +0,0 @@ -/* - * user_strings.h - Localizable strings - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef USER_STRINGS_H -#define USER_STRINGS_H - -// Common string numbers -enum { - // General messages - STR_ABOUT_TEXT1 = 0, - STR_ABOUT_TEXT2, - STR_READING_ROM_FILE, - STR_SHELL_ERROR_PREFIX, - STR_GUI_ERROR_PREFIX, - STR_ERROR_ALERT_TITLE, - STR_SHELL_WARNING_PREFIX, - STR_GUI_WARNING_PREFIX, - STR_WARNING_ALERT_TITLE, - STR_NOTICE_ALERT_TITLE, - STR_ABOUT_TITLE, - STR_OK_BUTTON, - STR_START_BUTTON, - STR_QUIT_BUTTON, - STR_CANCEL_BUTTON, - STR_IGNORE_BUTTON, - - // Error messages - STR_NOT_ENOUGH_MEMORY_ERR = 1000, - STR_NO_KERNEL_DATA_ERR, - STR_NO_RAM_AREA_ERR, - STR_NO_ROM_FILE_ERR, - STR_RAM_HIGHER_THAN_ROM_ERR, - STR_ROM_FILE_READ_ERR, - STR_ROM_SIZE_ERR, - STR_UNSUPPORTED_ROM_TYPE_ERR, - STR_POWER_INSTRUCTION_ERR, - STR_MEM_ACCESS_ERR, - STR_MEM_ACCESS_READ, - STR_MEM_ACCESS_WRITE, - STR_UNKNOWN_SEGV_ERR, - STR_NO_NAME_REGISTRY_ERR, - STR_FULL_SCREEN_ERR, - STR_SCSI_BUFFER_ERR, - STR_SCSI_SG_FULL_ERR, - - // Warning messages - STR_SMALL_RAM_WARN = 2000, - STR_VOLUME_IS_MOUNTED_WARN, - STR_CANNOT_UNMOUNT_WARN, - STR_CREATE_VOLUME_WARN, - - // Preferences window - STR_PREFS_TITLE = 3000, - STR_PREFS_MENU = 3020, - STR_PREFS_ITEM_ABOUT, - STR_PREFS_ITEM_START, - STR_PREFS_ITEM_ZAP_PRAM, - STR_PREFS_ITEM_QUIT, - - STR_NONE_LAB = 3100, - - // Volumes pane - STR_VOLUMES_PANE_TITLE = 3200, - STR_ADD_VOLUME_BUTTON, - STR_CREATE_VOLUME_BUTTON, - STR_REMOVE_VOLUME_BUTTON, - STR_ADD_VOLUME_PANEL_BUTTON, - STR_CREATE_VOLUME_PANEL_BUTTON, - STR_CDROM_DRIVE_CTRL, - STR_BOOTDRIVER_CTRL, - STR_BOOT_ANY_LAB, - STR_BOOT_CDROM_LAB, - STR_NOCDROM_CTRL, - STR_EXTFS_CTRL, - STR_ADD_VOLUME_TITLE, - STR_CREATE_VOLUME_TITLE, - STR_HARDFILE_SIZE_CTRL, - - // Graphics pane - STR_GRAPHICS_SOUND_PANE_TITLE = 3300, - STR_FRAMESKIP_CTRL, - STR_REF_5HZ_LAB, - STR_REF_7_5HZ_LAB, - STR_REF_10HZ_LAB, - STR_REF_15HZ_LAB, - STR_REF_30HZ_LAB, - STR_REF_60HZ_LAB, - STR_REF_DYNAMIC_LAB, - STR_GFXACCEL_CTRL, - STR_8_BIT_CTRL, - STR_16_BIT_CTRL, - STR_32_BIT_CTRL, - STR_W_640x480_CTRL, - STR_W_800x600_CTRL, - STR_640x480_CTRL, - STR_800x600_CTRL, - STR_1024x768_CTRL, - STR_1152x768_CTRL, - STR_1152x900_CTRL, - STR_1280x1024_CTRL, - STR_1600x1200_CTRL, - STR_VIDEO_MODE_CTRL, - STR_FULLSCREEN_CTRL, - STR_WINDOW_CTRL, - STR_VIDEO_TYPE_CTRL, - STR_DISPLAY_X_CTRL, - STR_DISPLAY_Y_CTRL, - STR_SIZE_384_LAB, - STR_SIZE_480_LAB, - STR_SIZE_512_LAB, - STR_SIZE_600_LAB, - STR_SIZE_640_LAB, - STR_SIZE_768_LAB, - STR_SIZE_800_LAB, - STR_SIZE_1024_LAB, - STR_SIZE_MAX_LAB, - STR_NOSOUND_CTRL, - - // Serial/Network pane - STR_SERIAL_NETWORK_PANE_TITLE = 3400, - STR_SERPORTA_CTRL, - STR_SERPORTB_CTRL, - STR_NONET_CTRL, - STR_ETHERNET_IF_CTRL, - - // Memory/Misc pane - STR_MEMORY_MISC_PANE_TITLE = 3500, - STR_RAMSIZE_CTRL, - STR_RAMSIZE_4MB_LAB, - STR_RAMSIZE_8MB_LAB, - STR_RAMSIZE_16MB_LAB, - STR_RAMSIZE_32MB_LAB, - STR_RAMSIZE_64MB_LAB, - STR_RAMSIZE_128MB_LAB, - STR_RAMSIZE_256MB_LAB, - STR_RAMSIZE_512MB_LAB, - STR_RAMSIZE_1024MB_LAB, - STR_RAMSIZE_SLIDER, - STR_RAMSIZE_FMT, - STR_IGNORESEGV_CTRL, - STR_IDLEWAIT_CTRL, - STR_ROM_FILE_CTRL, - - // JIT Compiler pane - STR_JIT_PANE_TITLE = 3700, - STR_JIT_CTRL, - STR_JIT_68K_CTRL, - - // Mac window - STR_WINDOW_TITLE = 4000, - STR_WINDOW_TITLE_FROZEN, - STR_WINDOW_MENU = 4050, - STR_WINDOW_ITEM_ABOUT, - STR_WINDOW_ITEM_REFRESH, - STR_WINDOW_ITEM_MOUNT, - - // Audio - STR_SOUND_IN_NAME = 6000, - - // External file system - STR_EXTFS_NAME = 7000, - STR_EXTFS_VOLUME_NAME -}; - -// Common and platform-specific string definitions -struct user_string_def { - int num; - const char *str; -}; - -extern user_string_def common_strings[]; -extern user_string_def platform_strings[]; - -// Fetch pointer to string, given the string number -extern const char *GetString(int num); - -#endif diff --git a/SheepShaver/src/include/version.h b/SheepShaver/src/include/version.h deleted file mode 100644 index 78a3837f..00000000 --- a/SheepShaver/src/include/version.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * version.h - Version information - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef VERSION_H -#define VERSION_H - -const int VERSION_MAJOR = 2; -const int VERSION_MINOR = 4; - -#endif diff --git a/SheepShaver/src/include/video.h b/SheepShaver/src/include/video.h deleted file mode 100644 index 3b82203e..00000000 --- a/SheepShaver/src/include/video.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * video.h - Video/graphics emulation - * - * SheepShaver (C) 1997-2008 Marc Hellwig and Christian Bauer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef VIDEO_H -#define VIDEO_H - -extern bool VideoActivated(void); -extern bool VideoSnapshot(int xsize, int ysize, uint8 *p); - -extern int16 VideoDoDriverIO(uint32 spaceID, uint32 commandID, uint32 commandContents, uint32 commandCode, uint32 commandKind); - -// System specific and internal functions/data -struct VideoInfo { - int viType; // Screen/Window - uint32 viRowBytes; // width of each row in memory - uint16 viXsize,viYsize; // Window - uint32 viAppleMode; // Screen Color Depth - uint32 viAppleID; // Screen DisplayID -}; - -extern struct VideoInfo VModes[]; // List of available video modes - -enum { // viAppleMode - APPLE_1_BIT = 0x80, - APPLE_2_BIT, - APPLE_4_BIT, - APPLE_8_BIT, - APPLE_16_BIT, - APPLE_32_BIT -}; - -// 1, 2, 4 and 8 bit depths use a color palette -inline bool IsDirectMode(int mode) -{ - return mode == APPLE_16_BIT || mode == APPLE_32_BIT; -} - -// Return the depth code that corresponds to the specified bits-per-pixel value -inline int DepthModeForPixelDepth(int depth) -{ - switch (depth) { - case 1: return APPLE_1_BIT; - case 2: return APPLE_2_BIT; - case 4: return APPLE_4_BIT; - case 8: return APPLE_8_BIT; - case 15: case 16: return APPLE_16_BIT; - case 24: case 32: return APPLE_32_BIT; - default: return APPLE_1_BIT; - } -} - -// Return a bytes-per-row value (assuming no padding) for the specified depth and pixel width -inline uint32 TrivialBytesPerRow(uint32 width, int mode) -{ - switch (mode) { - case APPLE_1_BIT: return width / 8; - case APPLE_2_BIT: return width / 4; - case APPLE_4_BIT: return width / 2; - case APPLE_8_BIT: return width; - case APPLE_16_BIT: return width * 2; - case APPLE_32_BIT: return width * 4; - default: return width; - } -} - -enum { // viAppleID - APPLE_640x480 = 0x81, - APPLE_W_640x480, - APPLE_800x600, - APPLE_W_800x600, - APPLE_1024x768, - APPLE_1152x768, - APPLE_1152x900, - APPLE_1280x1024, - APPLE_1600x1200, - APPLE_CUSTOM, - APPLE_ID_MIN = APPLE_640x480, - APPLE_ID_MAX = APPLE_CUSTOM -}; - -enum { // Display type - DIS_INVALID, - DIS_SCREEN, - DIS_WINDOW -}; - -extern bool video_activated; // Flag: video display activated, mouse and keyboard data valid -extern uint32 screen_base; // Frame buffer base address -extern int cur_mode; // Number of current video mode (index in VModes array) -extern int display_type; // Current display type (see above) -extern rgb_color mac_pal[256]; -extern uint8 remap_mac_be[256]; -extern uint8 MacCursor[68]; - -struct VidLocals{ - uint16 saveMode; - uint32 saveData; - uint16 savePage; - uint32 saveBaseAddr; - uint32 gammaTable; // Mac address of gamma tble - uint32 maxGammaTableSize; // Biggest gamma table allocated - uint32 saveVidParms; - bool luminanceMapping; // Luminance mapping on/off - bool cursorHardware; // True if using hardware cursor - int32 cursorX; // Hardware cursor state - int32 cursorY; - uint32 cursorVisible; - uint32 cursorSet; - bool cursorHotFlag; - uint8 cursorHotX; - uint8 cursorHotY; - uint32 vslServiceID; // VSL interrupt service ID - bool interruptsEnabled; // VBL interrupts on/off - uint32 regEntryID; // Mac address of the service owner -}; - -extern VidLocals *private_data; // Pointer to driver local variables (there is only one display, so this is ok) - -extern bool VideoInit(void); -extern void VideoExit(void); -extern void VideoVBL(void); -extern void VideoInstallAccel(void); -extern void VideoQuitFullScreen(void); - -extern void video_set_palette(void); -extern void video_set_cursor(void); -extern bool video_can_change_cursor(void); -extern int16 video_mode_change(VidLocals *csSave, uint32 ParamPtr); -extern void video_set_dirty_area(int x, int y, int w, int h); - -extern int16 VSLDoInterruptService(uint32 arg1); -extern void NQDMisc(uint32 arg1, uintptr arg2); - -// Native QuickDraw acceleration callbacks -extern bool NQD_sync_hook(uint32); -extern bool NQD_bitblt_hook(uint32); -extern bool NQD_fillrect_hook(uint32); -extern bool NQD_unknown_hook(uint32); -extern void NQD_bitblt(uint32); -extern void NQD_invrect(uint32); -extern void NQD_fillrect(uint32); - -extern bool keyfile_valid; - -#endif diff --git a/SheepShaver/src/include/video_defs.h b/SheepShaver/src/include/video_defs.h deleted file mode 100644 index ef9e2824..00000000 --- a/SheepShaver/src/include/video_defs.h +++ /dev/null @@ -1,413 +0,0 @@ -/* - * video_defs.h - MacOS types and structures for video - * - * SheepShaver (C) 1997-2008 Marc Hellwig and Christian Bauer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef VIDEO_DEFS_H -#define VIDEO_DEFS_H - -#include "macos_util.h" -#include - - -/* - * Definitions for Display Manager - */ - -/* csMode values describing pixel depth in VDSwitchInfo */ -enum { - firstVidMode=128, // first depth mode, representing lowest supported - // pixel depth - secondVidMode, thirdVidMode, fourthVidMode, fifthVidMode, sixthVidMode - // following modes represent pixel depths in ascending - // order -}; - -/* csDisplayType values in VDDisplayConnectInfoRec */ -enum { - kUnknownConnect=1, // reserved - kPanelTFTConnect, // fixed-in-place LCS (TFT, aka "active matrix") panels - kFixedModeCRTConnect, // very limited displays - kMultiModeCRT1Connect, // 12" optional, 13" default, 16" required - kMultiModeCRT2Connect, // 12" optional, 13" req., 16" def., 19" req. - kMultiModeCRT3Connect, // 12" optional, 13" req., 16" req., 19" req.,21" def. - kMultiModeCRT4Connect, // expansion to large multimode (not yet implemented) - kModelessConnect, // expansion to modeless model (not yet implemented) - kFullPageConnect, // 640x818 (to get 8bpp in 512K case) and - // 640x870 (nothing else supported) - kVGAConnect, // 640x480 VGA default -- nothing else req. - kNTSCConnect, // NTSC ST(default), FF, STconv, FFconv - kPALConnect, // PAL ST(default), FF, STconv, FFconv - kHRConnect, // 640x400 (to get 8bpp in 256K case) and - // 640x480 (nothing else supported) - kPanelFSTNConnect // fixed-in-place LCD FSTN (aka "supertwist") panels -}; - -/* csConnectFlags values in VDDisplayConnectInfoRec */ -enum { - kAllModesValid=0, // all display modes not deleted by PrimaryInit code - // are optional - kAllModesSafe, // all display modes not deleted by PrimaryInit code - // are required; is you set this bit, set the - // kAllModesValid bit, too - kHasDirectConnect=3, // for future expansions, setting this bit means that - // your driver can talk directly to the display - // (e.g. there is a serial data link via sense lines) - kIsMonoDev, // this display does not support color - kUncertainConnect // there may not be a display; Monitors control panel - // makes the user confirm some operations--like moving - // the menu bar-- when this bit is set -}; - -/* csTimingFormat value in VDTimingInfoRec */ -#define kDeclROMtables FOURCC('d','e','c','l') // use information in this record instead of looking - // in the decl. ROM for timing info; used for patching - // existing card without updating declaration ROM - -/* csTimingData values in VDTimingInfoRec */ -enum { - timingUnknown = 0, // unknown timing - timingApple_512x384_60hz = 130, /* 512x384 (60 Hz) Rubik timing. */ - timingApple_560x384_60hz = 135, /* 560x384 (60 Hz) Rubik-560 timing. */ - timingApple_640x480_67hz = 140, /* 640x480 (67 Hz) HR timing. */ - timingApple_640x400_67hz = 145, /* 640x400 (67 Hz) HR-400 timing. */ - timingVESA_640x480_60hz = 150, /* 640x480 (60 Hz) VGA timing. */ - timingVESA_640x480_72hz = 152, /* 640x480 (72 Hz) VGA timing. */ - timingVESA_640x480_75hz = 154, /* 640x480 (75 Hz) VGA timing. */ - timingVESA_640x480_85hz = 158, /* 640x480 (85 Hz) VGA timing. */ - timingGTF_640x480_120hz = 159, /* 640x480 (120 Hz) VESA Generalized Timing Formula */ - timingApple_640x870_75hz = 160, /* 640x870 (75 Hz) FPD timing.*/ - timingApple_640x818_75hz = 165, /* 640x818 (75 Hz) FPD-818 timing.*/ - timingApple_832x624_75hz = 170, /* 832x624 (75 Hz) GoldFish timing.*/ - timingVESA_800x600_56hz = 180, /* 800x600 (56 Hz) SVGA timing. */ - timingVESA_800x600_60hz = 182, /* 800x600 (60 Hz) SVGA timing. */ - timingVESA_800x600_72hz = 184, /* 800x600 (72 Hz) SVGA timing. */ - timingVESA_800x600_75hz = 186, /* 800x600 (75 Hz) SVGA timing. */ - timingVESA_800x600_85hz = 188, /* 800x600 (85 Hz) SVGA timing. */ - timingVESA_1024x768_60hz = 190, /* 1024x768 (60 Hz) VESA 1K-60Hz timing. */ - timingVESA_1024x768_70hz = 200, /* 1024x768 (70 Hz) VESA 1K-70Hz timing. */ - timingVESA_1024x768_75hz = 204, /* 1024x768 (75 Hz) VESA 1K-75Hz timing (very similar to timingApple_1024x768_75hz). */ - timingVESA_1024x768_85hz = 208, /* 1024x768 (85 Hz) VESA timing. */ - timingApple_1024x768_75hz = 210, /* 1024x768 (75 Hz) Apple 19" RGB. */ - timingApple_1152x870_75hz = 220, /* 1152x870 (75 Hz) Apple 21" RGB. */ - timingVESA_1280x960_75hz = 250, /* 1280x960 (75 Hz) */ - timingVESA_1280x960_60hz = 252, /* 1280x960 (60 Hz) */ - timingVESA_1280x960_85hz = 254, /* 1280x960 (85 Hz) */ - timingVESA_1280x1024_60hz = 260, /* 1280x1024 (60 Hz) */ - timingVESA_1280x1024_75hz = 262, /* 1280x1024 (75 Hz) */ - timingVESA_1280x1024_85hz = 268, /* 1280x1024 (85 Hz) */ - timingVESA_1600x1200_60hz = 280, /* 1600x1200 (60 Hz) VESA proposed timing. */ - timingVESA_1600x1200_65hz = 282, /* 1600x1200 (65 Hz) VESA proposed timing. */ - timingVESA_1600x1200_70hz = 284, /* 1600x1200 (70 Hz) VESA proposed timing. */ - timingVESA_1600x1200_75hz = 286, /* 1600x1200 (75 Hz) VESA proposed timing. */ - timingVESA_1600x1200_80hz = 288, /* 1600x1200 (80 Hz) VESA proposed timing (pixel clock is 216 Mhz dot clock). */ - timingSMPTE240M_60hz = 400, /* 60Hz V, 33.75KHz H, interlaced timing, 16:9 aspect, typical resolution of 1920x1035. */ - timingFilmRate_48hz = 410 /* 48Hz V, 25.20KHz H, non-interlaced timing, typical resolution of 640x480. */ -}; - -/* csTimingFlags values in VDTimingInfoRec */ -enum { - kModeValid=0, // this display mode is optional - kModeSafe, // this display mode is required; if you set this - // bit, you should also set the kModeValid bit - kModeDefault, // this display mode is the default for the attached - // display; if you set this bit, you should also set - // the kModeSafe and kModeValid bits - kShowModeNow, // show this mode in Monitors control panel; useful - // for SVGA modes - kModeNotResize, - kModeRequiresPan -}; - -/* code for Display Manager control request */ -enum { - cscReset=0, - cscKillIO, - cscSetMode, - cscSetEntries, - cscSetGamma, - cscGrayPage, - cscGrayScreen=5, - cscSetGray, - cscSetInterrupt, - cscDirectSetEntries, - cscSetDefaultMode, - cscSwitchMode, // switch to another display mode - cscSetSync, - cscSavePreferredConfiguration=16, - cscSetHardwareCursor=22, - cscDrawHardwareCursor, - cscSetConvolution, - cscSetPowerState, - cscPrivateControlCall, // Takes a VDPrivateSelectorDataRec - cscSetMultiConnect, // From a GDI point of view, this call should be implemented completely in the HAL and not at all in the core. - cscSetClutBehavior, // Takes a VDClutBehavior - cscUnusedCall=127 // This call used to expend the scrn resource. Its imbedded data contains more control info -}; - -/* Constants for the GetNextResolution call */ - -enum { - kDisplayModeIDCurrent = 0x00, /* Reference the Current DisplayModeID */ - kDisplayModeIDInvalid = (long)0xFFFFFFFF, /* A bogus DisplayModeID in all cases */ - kDisplayModeIDFindFirstResolution = (long)0xFFFFFFFE, /* Used in cscGetNextResolution to reset iterator */ - kDisplayModeIDNoMoreResolutions = (long)0xFFFFFFFD /* Used in cscGetNextResolution to indicate End Of List */ -}; - -/* codes for Display Manager status requests */ -enum { - cscGetMode=2, - cscGetEntries, - cscGetPageCnt, - cscGetPages=4, // This is what C&D 2 calls it. - cscGetPageBase, - cscGetBaseAddr=5, // This is what C&D 2 calls it. - cscGetGray, - cscGetInterrupt, - cscGetGamma, - cscGetDefaultMode, - cscGetCurMode, // save the current display mode - cscGetSync, - cscGetConnection, // return information about display capabilities of - // connected display - cscGetModeTiming, // return scan timings data for a display mode - cscGetModeBaseAddress, // Return base address information about a particular mode - cscGetScanProc, // QuickTime scan chasing routine - cscGetPreferredConfiguration, - cscGetNextResolution, - cscGetVideoParameters, - cscGetGammaInfoList =20, - cscRetrieveGammaTable, - cscSupportsHardwareCursor, - cscGetHardwareCursorDrawState, - cscGetConvolution, - cscGetPowerState, - cscPrivateStatusCall, // Takes a VDPrivateSelectorDataRec - cscGetDDCBlock, // Takes a VDDDCBlockRec - cscGetMultiConnect, // From a GDI point of view, this call should be implemented completely in the HAL and not at all in the core. - cscGetClutBehavior // Takes a VDClutBehavior -}; - -enum { // VDSwitchInfo struct - csMode = 0, - csData = 2, - csPage = 6, - csBaseAddr = 8 -}; - -enum { // VDSetEntry struct - csTable = 0, // Pointer to ColorSpec[] - csStart = 4, - csCount = 6 -}; - -enum { // VDGammaRecord - csGTable = 0 -}; - -enum { // ColorSpec table entry - csValue = 0, - csRed = 2, - csGreen = 4, - csBlue = 6 -}; - -enum { // VDVideoParametersInfo struct - csDisplayModeID = 0, - csDepthMode = 4, - csVPBlockPtr = 6, - csPageCount = 10, - csDeviceType = 14 -}; - -enum { // VPBlock struct - vpBaseOffset = 0, - vpRowBytes = 4, - vpBounds = 6, - vpVersion = 14, - vpPackType = 16, - vpPackSize = 18, - vpHRes = 22, - vpVRes = 26, - vpPixelType = 30, - vpPixelSize = 32, - vpCmpCount = 34, - vpCmpSize = 36, - vpPlaneBytes = 38 -}; - -enum { // VDDisplayConnectInfo struct - csDisplayType = 0, - csConnectTaggedType = 2, - csConnectTaggedData = 3, - csConnectFlags = 4, - csDisplayComponent = 8, - csConnectReserved = 12 -}; - -enum { // VDTimingInfo struct - csTimingMode = 0, - csTimingReserved = 4, - csTimingFormat = 8, - csTimingData = 12, - csTimingFlags = 16 -}; - -enum { // VDResolutionInfo struct - csPreviousDisplayModeID = 0, - csRIDisplayModeID = 4, - csHorizontalPixels = 8, - csVerticalLines = 12, - csRefreshRate = 16, - csMaxDepthMode = 20, - csResolutionFlags = 22 -}; - -enum { // VDDrawHardwareCursor/VDHardwareCursorDrawState struct - csCursorX = 0, - csCursorY = 4, - csCursorVisible = 8, - csCursorSet = 12 -}; - -enum { // struct GammaTbl - gVersion = 0, - gType = 2, - gFormulaSize = 4, - gChanCnt = 6, - gDataCnt = 8, - gDataWidth = 10, - gFormulaData = 12, // variable size - SIZEOF_GammaTbl = 12 -}; - -enum { - kCursorImageMajorVersion = 0x0001, - kCursorImageMinorVersion = 0x0000 -}; - -enum { // CursorImage struct - ciMajorVersion = 0, - ciMinorVersion = 2, - ciCursorPixMap = 4, // Handle to PixMap - ciCursorBitMask = 8 // Handle to BitMap -}; - - -/* - * Structures for graphics acceleration - */ - -typedef uint32 CTabHandle; - -// Parameter block passed to acceleration hooks -struct accl_params { - uint32 unknown0[3]; - - uint32 transfer_mode; - uint32 pen_mode; - - uint32 unknown1[2]; - - uint32 fore_pen; - uint32 back_pen; - - uint32 unknown2[3]; - - uint32 src_base_addr; - int32 src_row_bytes; - int16 src_bounds[4]; - uint32 src_unknown1; - uint32 src_pixel_type; - uint32 src_pixel_size; - uint32 src_cmp_count; - uint32 src_cmp_size; - CTabHandle src_pm_table; - uint32 src_unknown2; - uint32 src_unknown3; - uint32 src_unknown4; - - uint32 dest_base_addr; - int32 dest_row_bytes; - int16 dest_bounds[4]; - uint32 dest_unknown1; - uint32 dest_pixel_type; - uint32 dest_pixel_size; - uint32 dest_cmp_count; - uint32 dest_cmp_size; - CTabHandle dest_pm_table; - uint32 dest_unknown2; - uint32 dest_unknown3; - uint32 dest_unknown4; - - uint32 unknown3[13]; - - int16 src_rect[4]; - int16 dest_rect[4]; - - uint32 unknown4[38]; - - uint32 draw_proc; - // Argument for accl_sync_hook at offset 0x4f8 -}; - -enum { - acclTransferMode = offsetof(accl_params, transfer_mode), - acclPenMode = offsetof(accl_params, pen_mode), - acclForePen = offsetof(accl_params, fore_pen), - acclBackPen = offsetof(accl_params, back_pen), - acclSrcBaseAddr = offsetof(accl_params, src_base_addr), - acclSrcRowBytes = offsetof(accl_params, src_row_bytes), - acclSrcBoundsRect = offsetof(accl_params, src_bounds), - acclSrcPixelType = offsetof(accl_params, src_pixel_type), - acclSrcPixelSize = offsetof(accl_params, src_pixel_size), - acclSrcCmpCount = offsetof(accl_params, src_cmp_count), - acclSrcCmpSize = offsetof(accl_params, src_cmp_size), - acclSrcPMTable = offsetof(accl_params, src_pm_table), - acclDestBaseAddr = offsetof(accl_params, dest_base_addr), - acclDestRowBytes = offsetof(accl_params, dest_row_bytes), - acclDestBoundsRect = offsetof(accl_params, dest_bounds), - acclDestPixelType = offsetof(accl_params, dest_pixel_type), - acclDestPixelSize = offsetof(accl_params, dest_pixel_size), - acclDestCmpCount = offsetof(accl_params, dest_cmp_count), - acclDestCmpSize = offsetof(accl_params, dest_cmp_size), - acclDestPMTable = offsetof(accl_params, dest_pm_table), - acclSrcRect = offsetof(accl_params, src_rect), - acclDestRect = offsetof(accl_params, dest_rect), - acclDrawProc = offsetof(accl_params, draw_proc) -}; - -// Hook info for NQDMisc -struct accl_hook_info { - uint32 draw_func; - uint32 sync_func; - uint32 code; -}; - -// Hook function index -enum { - ACCL_BITBLT, - ACCL_BLTMASK, - ACCL_FILLRECT, - ACCL_FILLMASK - // 4: bitblt - // 5: lines - // 6: fill -}; - -#endif diff --git a/SheepShaver/src/include/xlowmem.h b/SheepShaver/src/include/xlowmem.h deleted file mode 100644 index c986d73d..00000000 --- a/SheepShaver/src/include/xlowmem.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * xlowmem.h - Definitions for extra Low Memory globals (0x2800..) - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef XLOWMEM_H -#define XLOWMEM_H - -// Modes for XLM_RUN_MODE -#define MODE_68K 0 // 68k emulator active -#define MODE_NATIVE 1 // Switched to native mode -#define MODE_EMUL_OP 2 // 68k emulator active, within EMUL_OP routine - -#define XLM_SIGNATURE 0x2800 // SheepShaver signature -#define XLM_KERNEL_DATA 0x2804 // Pointer to Kernel Data -#define XLM_TOC 0x2808 // TOC pointer of emulator -#define XLM_SHEEP_OBJ 0x280c // Pointer to SheepShaver object -#define XLM_RUN_MODE 0x2810 // Current run mode, see enum above -#define XLM_68K_R25 0x2814 // Contents of the 68k emulator's r25 (which contains the interrupt level), saved upon entering EMUL_OP mode, used by Execute68k() and the USR1 signal handler -#define XLM_IRQ_NEST 0x2818 // Interrupt disable nesting counter (>0: disabled) -#define XLM_PVR 0x281c // Theoretical PVR -#define XLM_BUS_CLOCK 0x2820 // Bus clock speed in Hz (for DriverServicesLib patch) -#define XLM_EMUL_RETURN_PROC 0x2824 // Pointer to EMUL_RETURN routine -#define XLM_EXEC_RETURN_PROC 0x2828 // Pointer to EXEC_RETURN routine -#define XLM_EMUL_OP_PROC 0x282c // Pointer to EMUL_OP routine -#define XLM_EMUL_RETURN_STACK 0x2830 // Stack pointer for EMUL_RETURN -#define XLM_RES_LIB_TOC 0x2834 // TOC pointer of Resources library -#define XLM_GET_RESOURCE 0x2838 // Pointer to native GetResource() routine -#define XLM_GET_1_RESOURCE 0x283c // Pointer to native Get1Resource() routine -#define XLM_GET_IND_RESOURCE 0x2840 // Pointer to native GetIndResource() routine -#define XLM_GET_1_IND_RESOURCE 0x2844 // Pointer to native Get1IndResource() routine -#define XLM_R_GET_RESOURCE 0x2848 // Pointer to native RGetResource() routine -#define XLM_EXEC_RETURN_OPCODE 0x284c // EXEC_RETURN opcode for Execute68k() -#define XLM_ZERO_PAGE 0x2850 // Pointer to read-only page with all bits set to 0 -#define XLM_R13 0x2854 // Pointer to .sdata section (Linux) -#define XLM_GET_NAMED_RESOURCE 0x2858 // Pointer to native GetNamedResource() routine -#define XLM_GET_1_NAMED_RESOURCE 0x285c // Pointer to native Get1NamedResource() routine - -#define XLM_ETHER_AO_GET_HWADDR 0x28b0 // Pointer to ethernet A0_get_ethernet_address() function -#define XLM_ETHER_AO_ADD_MULTI 0x28b4 // Pointer to ethernet A0_enable_multicast() function -#define XLM_ETHER_AO_DEL_MULTI 0x28b8 // Pointer to ethernet A0_disable_multicast() function -#define XLM_ETHER_AO_SEND_PACKET 0x28bc // Pointer to ethernet A0_transmit_packet() function -#define XLM_ETHER_INIT 0x28c0 // Pointer to ethernet InitStreamModule() function -#define XLM_ETHER_TERM 0x28c4 // Pointer to ethernet TerminateStreamModule() function -#define XLM_ETHER_OPEN 0x28c8 // Pointer to ethernet ether_open() function -#define XLM_ETHER_CLOSE 0x28cc // Pointer to ethernet ether_close() function -#define XLM_ETHER_WPUT 0x28d0 // Pointer to ethernet ether_wput() function -#define XLM_ETHER_RSRV 0x28d4 // Pointer to ethernet ether_rsrv() function -#define XLM_VIDEO_DOIO 0x28d8 // Pointer to video DoDriverIO() function - -#endif diff --git a/SheepShaver/src/include/xpram.h b/SheepShaver/src/include/xpram.h deleted file mode 120000 index 382aa791..00000000 --- a/SheepShaver/src/include/xpram.h +++ /dev/null @@ -1 +0,0 @@ -../../../BasiliskII/src/include/xpram.h \ No newline at end of file diff --git a/SheepShaver/src/kpx_cpu/dis-asm.h b/SheepShaver/src/kpx_cpu/dis-asm.h deleted file mode 100644 index 639ace1a..00000000 --- a/SheepShaver/src/kpx_cpu/dis-asm.h +++ /dev/null @@ -1,483 +0,0 @@ -/* Interface between the opcode library and its callers. - Written by Cygnus Support, 1993. - - The opcode library (libopcodes.a) provides instruction decoders for - a large variety of instruction sets, callable with an identical - interface, for making instruction-processing programs more independent - of the instruction set being processed. */ - -#ifndef DIS_ASM_H -#define DIS_ASM_H - -#include -#include - -typedef int (*fprintf_function)(FILE *f, const char *fmt, ...); - -typedef void *PTR; -typedef uint64_t bfd_vma; -typedef int64_t bfd_signed_vma; -typedef uint8_t bfd_byte; -#define sprintf_vma(s,x) sprintf (s, "%0" PRIx64, x) -#define snprintf_vma(s,ss,x) snprintf (s, ss, "%0" PRIx64, x) - -#define BFD64 - -enum bfd_flavour { - bfd_target_unknown_flavour, - bfd_target_aout_flavour, - bfd_target_coff_flavour, - bfd_target_ecoff_flavour, - bfd_target_elf_flavour, - bfd_target_ieee_flavour, - bfd_target_nlm_flavour, - bfd_target_oasys_flavour, - bfd_target_tekhex_flavour, - bfd_target_srec_flavour, - bfd_target_ihex_flavour, - bfd_target_som_flavour, - bfd_target_os9k_flavour, - bfd_target_versados_flavour, - bfd_target_msdos_flavour, - bfd_target_evax_flavour -}; - -enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN }; - -enum bfd_architecture -{ - bfd_arch_unknown, /* File arch not known */ - bfd_arch_obscure, /* Arch known, not one of these */ - bfd_arch_m68k, /* Motorola 68xxx */ -#define bfd_mach_m68000 1 -#define bfd_mach_m68008 2 -#define bfd_mach_m68010 3 -#define bfd_mach_m68020 4 -#define bfd_mach_m68030 5 -#define bfd_mach_m68040 6 -#define bfd_mach_m68060 7 -#define bfd_mach_cpu32 8 -#define bfd_mach_mcf5200 9 -#define bfd_mach_mcf5206e 10 -#define bfd_mach_mcf5307 11 -#define bfd_mach_mcf5407 12 -#define bfd_mach_mcf528x 13 -#define bfd_mach_mcfv4e 14 -#define bfd_mach_mcf521x 15 -#define bfd_mach_mcf5249 16 -#define bfd_mach_mcf547x 17 -#define bfd_mach_mcf548x 18 - bfd_arch_vax, /* DEC Vax */ - bfd_arch_i960, /* Intel 960 */ - /* The order of the following is important. - lower number indicates a machine type that - only accepts a subset of the instructions - available to machines with higher numbers. - The exception is the "ca", which is - incompatible with all other machines except - "core". */ - -#define bfd_mach_i960_core 1 -#define bfd_mach_i960_ka_sa 2 -#define bfd_mach_i960_kb_sb 3 -#define bfd_mach_i960_mc 4 -#define bfd_mach_i960_xa 5 -#define bfd_mach_i960_ca 6 -#define bfd_mach_i960_jx 7 -#define bfd_mach_i960_hx 8 - - bfd_arch_a29k, /* AMD 29000 */ - bfd_arch_sparc, /* SPARC */ -#define bfd_mach_sparc 1 -/* The difference between v8plus and v9 is that v9 is a true 64 bit env. */ -#define bfd_mach_sparc_sparclet 2 -#define bfd_mach_sparc_sparclite 3 -#define bfd_mach_sparc_v8plus 4 -#define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns. */ -#define bfd_mach_sparc_sparclite_le 6 -#define bfd_mach_sparc_v9 7 -#define bfd_mach_sparc_v9a 8 /* with ultrasparc add'ns. */ -#define bfd_mach_sparc_v8plusb 9 /* with cheetah add'ns. */ -#define bfd_mach_sparc_v9b 10 /* with cheetah add'ns. */ -/* Nonzero if MACH has the v9 instruction set. */ -#define bfd_mach_sparc_v9_p(mach) \ - ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \ - && (mach) != bfd_mach_sparc_sparclite_le) - bfd_arch_mips, /* MIPS Rxxxx */ -#define bfd_mach_mips3000 3000 -#define bfd_mach_mips3900 3900 -#define bfd_mach_mips4000 4000 -#define bfd_mach_mips4010 4010 -#define bfd_mach_mips4100 4100 -#define bfd_mach_mips4300 4300 -#define bfd_mach_mips4400 4400 -#define bfd_mach_mips4600 4600 -#define bfd_mach_mips4650 4650 -#define bfd_mach_mips5000 5000 -#define bfd_mach_mips6000 6000 -#define bfd_mach_mips8000 8000 -#define bfd_mach_mips10000 10000 -#define bfd_mach_mips16 16 - bfd_arch_i386, /* Intel 386 */ -#define bfd_mach_i386_i386 0 -#define bfd_mach_i386_i8086 1 -#define bfd_mach_i386_i386_intel_syntax 2 -#define bfd_mach_x86_64 3 -#define bfd_mach_x86_64_intel_syntax 4 - bfd_arch_we32k, /* AT&T WE32xxx */ - bfd_arch_tahoe, /* CCI/Harris Tahoe */ - bfd_arch_i860, /* Intel 860 */ - bfd_arch_romp, /* IBM ROMP PC/RT */ - bfd_arch_alliant, /* Alliant */ - bfd_arch_convex, /* Convex */ - bfd_arch_m88k, /* Motorola 88xxx */ - bfd_arch_pyramid, /* Pyramid Technology */ - bfd_arch_h8300, /* Hitachi H8/300 */ -#define bfd_mach_h8300 1 -#define bfd_mach_h8300h 2 -#define bfd_mach_h8300s 3 - bfd_arch_powerpc, /* PowerPC */ -#define bfd_mach_ppc 0 -#define bfd_mach_ppc64 1 -#define bfd_mach_ppc_403 403 -#define bfd_mach_ppc_403gc 4030 -#define bfd_mach_ppc_e500 500 -#define bfd_mach_ppc_505 505 -#define bfd_mach_ppc_601 601 -#define bfd_mach_ppc_602 602 -#define bfd_mach_ppc_603 603 -#define bfd_mach_ppc_ec603e 6031 -#define bfd_mach_ppc_604 604 -#define bfd_mach_ppc_620 620 -#define bfd_mach_ppc_630 630 -#define bfd_mach_ppc_750 750 -#define bfd_mach_ppc_860 860 -#define bfd_mach_ppc_a35 35 -#define bfd_mach_ppc_rs64ii 642 -#define bfd_mach_ppc_rs64iii 643 -#define bfd_mach_ppc_7400 7400 - bfd_arch_rs6000, /* IBM RS/6000 */ - bfd_arch_hppa, /* HP PA RISC */ -#define bfd_mach_hppa10 10 -#define bfd_mach_hppa11 11 -#define bfd_mach_hppa20 20 -#define bfd_mach_hppa20w 25 - bfd_arch_d10v, /* Mitsubishi D10V */ - bfd_arch_z8k, /* Zilog Z8000 */ -#define bfd_mach_z8001 1 -#define bfd_mach_z8002 2 - bfd_arch_h8500, /* Hitachi H8/500 */ - bfd_arch_sh, /* Hitachi SH */ -#define bfd_mach_sh 1 -#define bfd_mach_sh2 0x20 -#define bfd_mach_sh_dsp 0x2d -#define bfd_mach_sh2a 0x2a -#define bfd_mach_sh2a_nofpu 0x2b -#define bfd_mach_sh2e 0x2e -#define bfd_mach_sh3 0x30 -#define bfd_mach_sh3_nommu 0x31 -#define bfd_mach_sh3_dsp 0x3d -#define bfd_mach_sh3e 0x3e -#define bfd_mach_sh4 0x40 -#define bfd_mach_sh4_nofpu 0x41 -#define bfd_mach_sh4_nommu_nofpu 0x42 -#define bfd_mach_sh4a 0x4a -#define bfd_mach_sh4a_nofpu 0x4b -#define bfd_mach_sh4al_dsp 0x4d -#define bfd_mach_sh5 0x50 - bfd_arch_alpha, /* Dec Alpha */ -#define bfd_mach_alpha 1 -#define bfd_mach_alpha_ev4 0x10 -#define bfd_mach_alpha_ev5 0x20 -#define bfd_mach_alpha_ev6 0x30 - bfd_arch_arm, /* Advanced Risc Machines ARM */ -#define bfd_mach_arm_unknown 0 -#define bfd_mach_arm_2 1 -#define bfd_mach_arm_2a 2 -#define bfd_mach_arm_3 3 -#define bfd_mach_arm_3M 4 -#define bfd_mach_arm_4 5 -#define bfd_mach_arm_4T 6 -#define bfd_mach_arm_5 7 -#define bfd_mach_arm_5T 8 -#define bfd_mach_arm_5TE 9 -#define bfd_mach_arm_XScale 10 -#define bfd_mach_arm_ep9312 11 -#define bfd_mach_arm_iWMMXt 12 -#define bfd_mach_arm_iWMMXt2 13 - bfd_arch_ns32k, /* National Semiconductors ns32000 */ - bfd_arch_w65, /* WDC 65816 */ - bfd_arch_tic30, /* Texas Instruments TMS320C30 */ - bfd_arch_v850, /* NEC V850 */ -#define bfd_mach_v850 0 - bfd_arch_arc, /* Argonaut RISC Core */ -#define bfd_mach_arc_base 0 - bfd_arch_m32r, /* Mitsubishi M32R/D */ -#define bfd_mach_m32r 0 /* backwards compatibility */ - bfd_arch_mn10200, /* Matsushita MN10200 */ - bfd_arch_mn10300, /* Matsushita MN10300 */ - bfd_arch_cris, /* Axis CRIS */ -#define bfd_mach_cris_v0_v10 255 -#define bfd_mach_cris_v32 32 -#define bfd_mach_cris_v10_v32 1032 - bfd_arch_microblaze, /* Xilinx MicroBlaze. */ - bfd_arch_ia64, /* HP/Intel ia64 */ -#define bfd_mach_ia64_elf64 64 -#define bfd_mach_ia64_elf32 32 - bfd_arch_last - }; -#define bfd_mach_s390_31 31 -#define bfd_mach_s390_64 64 - -typedef struct symbol_cache_entry -{ - const char *name; - union - { - PTR p; - bfd_vma i; - } udata; -} asymbol; - -enum dis_insn_type { - dis_noninsn, /* Not a valid instruction */ - dis_nonbranch, /* Not a branch instruction */ - dis_branch, /* Unconditional branch */ - dis_condbranch, /* Conditional branch */ - dis_jsr, /* Jump to subroutine */ - dis_condjsr, /* Conditional jump to subroutine */ - dis_dref, /* Data reference instruction */ - dis_dref2 /* Two data references in instruction */ -}; - -/* This struct is passed into the instruction decoding routine, - and is passed back out into each callback. The various fields are used - for conveying information from your main routine into your callbacks, - for passing information into the instruction decoders (such as the - addresses of the callback functions), or for passing information - back from the instruction decoders to their callers. - - It must be initialized before it is first passed; this can be done - by hand, or using one of the initialization macros below. */ - -typedef struct disassemble_info { - fprintf_function fprintf_func; - FILE *stream; - PTR application_data; - - /* Target description. We could replace this with a pointer to the bfd, - but that would require one. There currently isn't any such requirement - so to avoid introducing one we record these explicitly. */ - /* The bfd_flavour. This can be bfd_target_unknown_flavour. */ - enum bfd_flavour flavour; - /* The bfd_arch value. */ - enum bfd_architecture arch; - /* The bfd_mach value. */ - unsigned long mach; - /* Endianness (for bi-endian cpus). Mono-endian cpus can ignore this. */ - enum bfd_endian endian; - - /* An array of pointers to symbols either at the location being disassembled - or at the start of the function being disassembled. The array is sorted - so that the first symbol is intended to be the one used. The others are - present for any misc. purposes. This is not set reliably, but if it is - not NULL, it is correct. */ - asymbol **symbols; - /* Number of symbols in array. */ - int num_symbols; - - /* For use by the disassembler. - The top 16 bits are reserved for public use (and are documented here). - The bottom 16 bits are for the internal use of the disassembler. */ - unsigned long flags; -#define INSN_HAS_RELOC 0x80000000 - PTR private_data; - - /* Function used to get bytes to disassemble. MEMADDR is the - address of the stuff to be disassembled, MYADDR is the address to - put the bytes in, and LENGTH is the number of bytes to read. - INFO is a pointer to this struct. - Returns an errno value or 0 for success. */ - int (*read_memory_func) - (bfd_vma memaddr, bfd_byte *myaddr, int length, - struct disassemble_info *info); - - /* Function which should be called if we get an error that we can't - recover from. STATUS is the errno value from read_memory_func and - MEMADDR is the address that we were trying to read. INFO is a - pointer to this struct. */ - void (*memory_error_func) - (int status, bfd_vma memaddr, struct disassemble_info *info); - - /* Function called to print ADDR. */ - void (*print_address_func) - (bfd_vma addr, struct disassemble_info *info); - - /* Function called to determine if there is a symbol at the given ADDR. - If there is, the function returns 1, otherwise it returns 0. - This is used by ports which support an overlay manager where - the overlay number is held in the top part of an address. In - some circumstances we want to include the overlay number in the - address, (normally because there is a symbol associated with - that address), but sometimes we want to mask out the overlay bits. */ - int (* symbol_at_address_func) - (bfd_vma addr, struct disassemble_info * info); - - /* These are for buffer_read_memory. */ - bfd_byte *buffer; - bfd_vma buffer_vma; - int buffer_length; - - /* This variable may be set by the instruction decoder. It suggests - the number of bytes objdump should display on a single line. If - the instruction decoder sets this, it should always set it to - the same value in order to get reasonable looking output. */ - int bytes_per_line; - - /* the next two variables control the way objdump displays the raw data */ - /* For example, if bytes_per_line is 8 and bytes_per_chunk is 4, the */ - /* output will look like this: - 00: 00000000 00000000 - with the chunks displayed according to "display_endian". */ - int bytes_per_chunk; - enum bfd_endian display_endian; - - /* Results from instruction decoders. Not all decoders yet support - this information. This info is set each time an instruction is - decoded, and is only valid for the last such instruction. - - To determine whether this decoder supports this information, set - insn_info_valid to 0, decode an instruction, then check it. */ - - char insn_info_valid; /* Branch info has been set. */ - char branch_delay_insns; /* How many sequential insn's will run before - a branch takes effect. (0 = normal) */ - char data_size; /* Size of data reference in insn, in bytes */ - enum dis_insn_type insn_type; /* Type of instruction */ - bfd_vma target; /* Target address of branch or dref, if known; - zero if unknown. */ - bfd_vma target2; /* Second target address for dref2 */ - - /* Command line options specific to the target disassembler. */ - char * disassembler_options; - -} disassemble_info; - - -/* Standard disassemblers. Disassemble one instruction at the given - target address. Return number of bytes processed. */ -typedef int (*disassembler_ftype) (bfd_vma, disassemble_info *); - -int print_insn_tci(bfd_vma, disassemble_info*); -int print_insn_big_mips (bfd_vma, disassemble_info*); -int print_insn_little_mips (bfd_vma, disassemble_info*); -int print_insn_i386 (bfd_vma, disassemble_info*); -int print_insn_m68k (bfd_vma, disassemble_info*); -int print_insn_z8001 (bfd_vma, disassemble_info*); -int print_insn_z8002 (bfd_vma, disassemble_info*); -int print_insn_h8300 (bfd_vma, disassemble_info*); -int print_insn_h8300h (bfd_vma, disassemble_info*); -int print_insn_h8300s (bfd_vma, disassemble_info*); -int print_insn_h8500 (bfd_vma, disassemble_info*); -int print_insn_alpha (bfd_vma, disassemble_info*); -disassembler_ftype arc_get_disassembler (int, int); -int print_insn_arm (bfd_vma, disassemble_info*); -int print_insn_sparc (bfd_vma, disassemble_info*); -int print_insn_big_a29k (bfd_vma, disassemble_info*); -int print_insn_little_a29k (bfd_vma, disassemble_info*); -int print_insn_i960 (bfd_vma, disassemble_info*); -int print_insn_sh (bfd_vma, disassemble_info*); -int print_insn_shl (bfd_vma, disassemble_info*); -int print_insn_hppa (bfd_vma, disassemble_info*); -int print_insn_m32r (bfd_vma, disassemble_info*); -int print_insn_m88k (bfd_vma, disassemble_info*); -int print_insn_mn10200 (bfd_vma, disassemble_info*); -int print_insn_mn10300 (bfd_vma, disassemble_info*); -int print_insn_ns32k (bfd_vma, disassemble_info*); -int print_insn_big_powerpc (bfd_vma, disassemble_info*); -int print_insn_little_powerpc (bfd_vma, disassemble_info*); -int print_insn_rs6000 (bfd_vma, disassemble_info*); -int print_insn_w65 (bfd_vma, disassemble_info*); -int print_insn_d10v (bfd_vma, disassemble_info*); -int print_insn_v850 (bfd_vma, disassemble_info*); -int print_insn_tic30 (bfd_vma, disassemble_info*); -int print_insn_ppc (bfd_vma, disassemble_info*); -int print_insn_s390 (bfd_vma, disassemble_info*); -int print_insn_crisv32 (bfd_vma, disassemble_info*); -int print_insn_crisv10 (bfd_vma, disassemble_info*); -int print_insn_microblaze (bfd_vma, disassemble_info*); -int print_insn_ia64 (bfd_vma, disassemble_info*); - -#if 0 -/* Fetch the disassembler for a given BFD, if that support is available. */ -disassembler_ftype disassembler(bfd *); -#endif - - -/* This block of definitions is for particular callers who read instructions - into a buffer before calling the instruction decoder. */ - -/* Here is a function which callers may wish to use for read_memory_func. - It gets bytes from a buffer. */ -int buffer_read_memory(bfd_vma, bfd_byte *, int, struct disassemble_info *); - -/* This function goes with buffer_read_memory. - It prints a message using info->fprintf_func and info->stream. */ -void perror_memory(int, bfd_vma, struct disassemble_info *); - - -/* Just print the address in hex. This is included for completeness even - though both GDB and objdump provide their own (to print symbolic - addresses). */ -void generic_print_address(bfd_vma, struct disassemble_info *); - -/* Always true. */ -int generic_symbol_at_address(bfd_vma, struct disassemble_info *); - -/* Macro to initialize a disassemble_info struct. This should be called - by all applications creating such a struct. */ -#define INIT_DISASSEMBLE_INFO(INFO, STREAM, FPRINTF_FUNC) \ - (INFO).flavour = bfd_target_unknown_flavour, \ - (INFO).arch = bfd_arch_unknown, \ - (INFO).mach = 0, \ - (INFO).endian = BFD_ENDIAN_UNKNOWN, \ - INIT_DISASSEMBLE_INFO_NO_ARCH(INFO, STREAM, FPRINTF_FUNC) - -/* Call this macro to initialize only the internal variables for the - disassembler. Architecture dependent things such as byte order, or machine - variant are not touched by this macro. This makes things much easier for - GDB which must initialize these things separately. */ - -#define INIT_DISASSEMBLE_INFO_NO_ARCH(INFO, STREAM, FPRINTF_FUNC) \ - (INFO).fprintf_func = (FPRINTF_FUNC), \ - (INFO).stream = (STREAM), \ - (INFO).symbols = NULL, \ - (INFO).num_symbols = 0, \ - (INFO).private_data = NULL, \ - (INFO).buffer = NULL, \ - (INFO).buffer_vma = 0, \ - (INFO).buffer_length = 0, \ - (INFO).read_memory_func = buffer_read_memory, \ - (INFO).memory_error_func = perror_memory, \ - (INFO).print_address_func = generic_print_address, \ - (INFO).symbol_at_address_func = generic_symbol_at_address, \ - (INFO).flags = 0, \ - (INFO).bytes_per_line = 0, \ - (INFO).bytes_per_chunk = 0, \ - (INFO).display_endian = BFD_ENDIAN_UNKNOWN, \ - (INFO).disassembler_options = NULL, \ - (INFO).insn_info_valid = 0 - -#define _(x) x -#define ATTRIBUTE_UNUSED __attribute__((unused)) - -/* from libbfd */ - -bfd_vma bfd_getl64 (const bfd_byte *addr); -bfd_vma bfd_getl32 (const bfd_byte *addr); -bfd_vma bfd_getb32 (const bfd_byte *addr); -bfd_vma bfd_getl16 (const bfd_byte *addr); -bfd_vma bfd_getb16 (const bfd_byte *addr); -typedef int bfd_boolean; - -#endif /* ! defined (DIS_ASM_H) */ diff --git a/SheepShaver/src/kpx_cpu/include/a.out-defs.h b/SheepShaver/src/kpx_cpu/include/a.out-defs.h deleted file mode 100644 index d876677a..00000000 --- a/SheepShaver/src/kpx_cpu/include/a.out-defs.h +++ /dev/null @@ -1,443 +0,0 @@ -/* a.out.h - - Copyright 1997, 1998, 1999, 2001 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#ifndef _A_OUT_H_ -#define _A_OUT_H_ - -#ifdef __cplusplus -extern "C" { -#endif -#define COFF_IMAGE_WITH_PE -#define COFF_LONG_SECTION_NAMES - -/*** coff information for Intel 386/486. */ - - -/********************** FILE HEADER **********************/ - -struct external_filehdr { - int16_t f_magic; /* magic number */ - int16_t f_nscns; /* number of sections */ - uint32_t f_timdat; /* time & date stamp */ - uint32_t f_symptr; /* file pointer to symtab */ - uint32_t f_nsyms; /* number of symtab entries */ - int16_t f_opthdr; /* sizeof(optional hdr) */ - int16_t f_flags; /* flags */ -}; - -/* Bits for f_flags: - * F_RELFLG relocation info stripped from file - * F_EXEC file is executable (no unresolved external references) - * F_LNNO line numbers stripped from file - * F_LSYMS local symbols stripped from file - * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax) - */ - -#define F_RELFLG (0x0001) -#define F_EXEC (0x0002) -#define F_LNNO (0x0004) -#define F_LSYMS (0x0008) - - - -#define I386MAGIC 0x14c -#define I386PTXMAGIC 0x154 -#define I386AIXMAGIC 0x175 - -/* This is Lynx's all-platform magic number for executables. */ - -#define LYNXCOFFMAGIC 0415 - -#define I386BADMAG(x) (((x).f_magic != I386MAGIC) \ - && (x).f_magic != I386AIXMAGIC \ - && (x).f_magic != I386PTXMAGIC \ - && (x).f_magic != LYNXCOFFMAGIC) - -#define FILHDR struct external_filehdr -#define FILHSZ 20 - - -/********************** AOUT "OPTIONAL HEADER"= - **********************/ - - -typedef struct -{ - uint16_t magic; /* type of file */ - uint16_t vstamp; /* version stamp */ - uint32_t tsize; /* text size in bytes, padded to FW bdry*/ - uint32_t dsize; /* initialized data " " */ - uint32_t bsize; /* uninitialized data " " */ - uint32_t entry; /* entry pt. */ - uint32_t text_start; /* base of text used for this file */ - uint32_t data_start; /* base of data used for this file= - */ -} -AOUTHDR; - -#define AOUTSZ 28 -#define AOUTHDRSZ 28 - -#define OMAGIC 0404 /* object files, eg as output */ -#define ZMAGIC 0413 /* demand load format, eg normal ld output */ -#define STMAGIC 0401 /* target shlib */ -#define SHMAGIC 0443 /* host shlib */ - - -/* define some NT default values */ -/* #define NT_IMAGE_BASE 0x400000 moved to internal.h */ -#define NT_SECTION_ALIGNMENT 0x1000 -#define NT_FILE_ALIGNMENT 0x200 -#define NT_DEF_RESERVE 0x100000 -#define NT_DEF_COMMIT 0x1000 - -/********************** SECTION HEADER **********************/ - - -struct external_scnhdr { - char s_name[8]; /* section name */ - uint32_t s_paddr; /* physical address, offset - of last addr in scn */ - uint32_t s_vaddr; /* virtual address */ - uint32_t s_size; /* section size */ - uint32_t s_scnptr; /* file ptr to raw data for section */ - uint32_t s_relptr; /* file ptr to relocation */ - uint32_t s_lnnoptr; /* file ptr to line numbers */ - uint16_t s_nreloc; /* number of relocation entries */ - uint16_t s_nlnno; /* number of line number entries*/ - uint32_t s_flags; /* flags */ -}; - -#define SCNHDR struct external_scnhdr -#define SCNHSZ 40 - -/* - * names of "special" sections - */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" -#define _COMMENT ".comment" -#define _LIB ".lib" - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ -struct external_lineno { - union { - uint32_t l_symndx; /* function name symbol index, iff l_lnno 0 */ - uint32_t l_paddr; /* (physical) address of line number */ - } l_addr; - uint16_t l_lnno; /* line number */ -}; - -#define LINENO struct external_lineno -#define LINESZ 6 - -/********************** SYMBOLS **********************/ - -#define E_SYMNMLEN 8 /* # characters in a symbol name */ -#define E_FILNMLEN 14 /* # characters in a file name */ -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ - -struct external_syment -{ - union { - char e_name[E_SYMNMLEN]; - struct { - uint32_t e_zeroes; - uint32_t e_offset; - } e; - } e; - uint32_t e_value; - uint16_t e_scnum; - uint16_t e_type; - char e_sclass[1]; - char e_numaux[1]; -} __attribute__((packed)); - -#ifndef _WIN32 -#define N_BTMASK (0xf) -#define N_TMASK (0x30) -#define N_BTSHFT (4) -#define N_TSHIFT (2) -#endif - -union external_auxent { - struct { - uint32_t x_tagndx; /* str, un, or enum tag indx */ - union { - struct { - uint16_t x_lnno; /* declaration line number */ - uint16_t x_size; /* str/union/array size */ - } x_lnsz; - uint32_t x_fsize; /* size of function */ - } x_misc; - union { - struct { /* if ISFCN, tag, or .bb */ - uint32_t x_lnnoptr; /* ptr to fcn line # */ - uint32_t x_endndx; /* entry ndx past block end */ - } x_fcn; - struct { /* if ISARY, up to 4 dimen. */ - char x_dimen[E_DIMNUM][2]; - } x_ary; - } x_fcnary; - uint16_t x_tvndx; /* tv index */ - } x_sym; - - union { - char x_fname[E_FILNMLEN]; - struct { - uint32_t x_zeroes; - uint32_t x_offset; - } x_n; - } x_file; - - struct { - uint32_t x_scnlen; /* section length */ - uint16_t x_nreloc; /* # relocation entries */ - uint16_t x_nlinno; /* # line numbers */ - uint32_t x_checksum; /* section COMDAT checksum */ - uint16_t x_associated;/* COMDAT associated section index */ - char x_comdat[1]; /* COMDAT selection number */ - } x_scn; - - struct { - uint32_t x_tvfill; /* tv fill value */ - uint16_t x_tvlen; /* length of .tv */ - char x_tvran[2][2]; /* tv range */ - } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ - -}; - -#define SYMENT struct external_syment -#define SYMESZ 18 -#define AUXENT union external_auxent -#define AUXESZ 18 - -#define _ETEXT "etext" - -/********************** RELOCATION DIRECTIVES **********************/ - -struct external_reloc { - char r_vaddr[4]; - char r_symndx[4]; - char r_type[2]; -}; - -#define RELOC struct external_reloc -#define RELSZ 10 - -/* end of coff/i386.h */ - -/* PE COFF header information */ - -#ifndef _PE_H -#define _PE_H - -/* NT specific file attributes */ -#ifndef _WIN32 -#define IMAGE_FILE_RELOCS_STRIPPED 0x0001 -#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 -#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 -#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 -#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 -#define IMAGE_FILE_32BIT_MACHINE 0x0100 -#define IMAGE_FILE_DEBUG_STRIPPED 0x0200 -#define IMAGE_FILE_SYSTEM 0x1000 -#define IMAGE_FILE_DLL 0x2000 -#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 -#endif - -/* additional flags to be set for section headers to allow the NT loader to - read and write to the section data (to replace the addresses of data in - dlls for one thing); also to execute the section in .text's case= - */ -#ifndef _WIN32 -#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 -#define IMAGE_SCN_MEM_EXECUTE 0x20000000 -#define IMAGE_SCN_MEM_READ 0x40000000 -#define IMAGE_SCN_MEM_WRITE 0x80000000 -#endif - -/* - * Section characteristics added for ppc-nt - */ - -#ifndef _WIN32 -#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved. */ - -#define IMAGE_SCN_CNT_CODE 0x00000020 /* Section contains code. */ -#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 /* Section contains initialized data. */ -#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 /* Section contains uninitialized data. */ - -#define IMAGE_SCN_LNK_OTHER 0x00000100 /* Reserved. */ -#define IMAGE_SCN_LNK_INFO 0x00000200 /* Section contains comments or some other type of information. */ -#define IMAGE_SCN_LNK_REMOVE 0x00000800 /* Section contents will not become part of image. */ -#define IMAGE_SCN_LNK_COMDAT 0x00001000 /* Section contents comdat. */ - -#define IMAGE_SCN_MEM_FARDATA 0x00008000 - -#define IMAGE_SCN_MEM_PURGEABLE 0x00020000 -#define IMAGE_SCN_MEM_16BIT 0x00020000 -#define IMAGE_SCN_MEM_LOCKED 0x00040000 -#define IMAGE_SCN_MEM_PRELOAD 0x00080000 - -#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 -#define IMAGE_SCN_ALIGN_2BYTES 0x00200000 -#define IMAGE_SCN_ALIGN_4BYTES 0x00300000 -#define IMAGE_SCN_ALIGN_8BYTES 0x00400000 -#define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default alignment if no others are specified. */ -#define IMAGE_SCN_ALIGN_32BYTES 0x00600000 -#define IMAGE_SCN_ALIGN_64BYTES 0x00700000 - - -#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 /* Section contains extended relocations. */ -#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 /* Section is not cachable. */ -#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 /* Section is not pageable. */ -#define IMAGE_SCN_MEM_SHARED 0x10000000 /* Section is shareable. */ -#endif - -/* COMDAT selection codes. */ - -#ifndef _WIN32 -#define IMAGE_COMDAT_SELECT_NODUPLICATES (1) /* Warn if duplicates. */ -#define IMAGE_COMDAT_SELECT_ANY (2) /* No warning. */ -#define IMAGE_COMDAT_SELECT_SAME_SIZE (3) /* Warn if different size. */ -#define IMAGE_COMDAT_SELECT_EXACT_MATCH (4) /* Warn if different. */ -#define IMAGE_COMDAT_SELECT_ASSOCIATIVE (5) /* Base on other section. */ -#endif - -/* Magic values that are true for all dos/nt implementations */ -#define DOSMAGIC 0x5a4d -#define NT_SIGNATURE 0x00004550 - -/* NT allows long filenames, we want to accommodate this. This may break - some of the bfd functions */ -#undef FILNMLEN -#define FILNMLEN 18 /* # characters in a file name */ - - -#ifdef COFF_IMAGE_WITH_PE -/* The filehdr is only weired in images */ - -#undef FILHDR -struct external_PE_filehdr -{ - /* DOS header fields */ - uint16_t e_magic; /* Magic number, 0x5a4d */ - uint16_t e_cblp; /* Bytes on last page of file, 0x90 */ - uint16_t e_cp; /* Pages in file, 0x3 */ - uint16_t e_crlc; /* Relocations, 0x0 */ - uint16_t e_cparhdr; /* Size of header in paragraphs, 0x4 */ - uint16_t e_minalloc; /* Minimum extra paragraphs needed, 0x0 */ - uint16_t e_maxalloc; /* Maximum extra paragraphs needed, 0xFFFF */ - uint16_t e_ss; /* Initial (relative) SS value, 0x0 */ - uint16_t e_sp; /* Initial SP value, 0xb8 */ - uint16_t e_csum; /* Checksum, 0x0 */ - uint16_t e_ip; /* Initial IP value, 0x0 */ - uint16_t e_cs; /* Initial (relative) CS value, 0x0 */ - uint16_t e_lfarlc; /* File address of relocation table, 0x40 */ - uint16_t e_ovno; /* Overlay number, 0x0 */ - char e_res[4][2]; /* Reserved words, all 0x0 */ - uint16_t e_oemid; /* OEM identifier (for e_oeminfo), 0x0 */ - uint16_t e_oeminfo; /* OEM information; e_oemid specific, 0x0 */ - char e_res2[10][2]; /* Reserved words, all 0x0 */ - uint32_t e_lfanew; /* File address of new exe header, 0x80 */ - char dos_message[16][4]; /* other stuff, always follow DOS header */ - unsigned int nt_signature; /* required NT signature, 0x4550 */ - - /* From standard header */ - - uint16_t f_magic; /* magic number */ - uint16_t f_nscns; /* number of sections */ - uint32_t f_timdat; /* time & date stamp */ - uint32_t f_symptr; /* file pointer to symtab */ - uint32_t f_nsyms; /* number of symtab entries */ - uint16_t f_opthdr; /* sizeof(optional hdr) */ - uint16_t f_flags; /* flags */ -}; - - -#define FILHDR struct external_PE_filehdr -#undef FILHSZ -#define FILHSZ 152 - -#endif - -typedef struct -{ - uint16_t magic; /* type of file */ - uint16_t vstamp; /* version stamp */ - uint32_t tsize; /* text size in bytes, padded to FW bdry*/ - uint32_t dsize; /* initialized data " " */ - uint32_t bsize; /* uninitialized data " " */ - uint32_t entry; /* entry pt. */ - uint32_t text_start; /* base of text used for this file */ - uint32_t data_start; /* base of all data used for this file */ - - /* NT extra fields; see internal.h for descriptions */ - uint32_t ImageBase; - uint32_t SectionAlignment; - uint32_t FileAlignment; - uint16_t MajorOperatingSystemVersion; - uint16_t MinorOperatingSystemVersion; - uint16_t MajorImageVersion; - uint16_t MinorImageVersion; - uint16_t MajorSubsystemVersion; - uint16_t MinorSubsystemVersion; - char Reserved1[4]; - uint32_t SizeOfImage; - uint32_t SizeOfHeaders; - uint32_t CheckSum; - uint16_t Subsystem; - uint16_t DllCharacteristics; - uint32_t SizeOfStackReserve; - uint32_t SizeOfStackCommit; - uint32_t SizeOfHeapReserve; - uint32_t SizeOfHeapCommit; - uint32_t LoaderFlags; - uint32_t NumberOfRvaAndSizes; - /* IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; */ - char DataDirectory[16][2][4]; /* 16 entries, 2 elements/entry, 4 chars */ - -} PEAOUTHDR; - - -#undef AOUTSZ -#define AOUTSZ (AOUTHDRSZ + 196) - -#undef E_FILNMLEN -#define E_FILNMLEN 18 /* # characters in a file name */ -#endif - -/* end of coff/pe.h */ - -#define DT_NON (0) /* no derived type */ -#define DT_PTR (1) /* pointer */ -#define DT_FCN (2) /* function */ -#define DT_ARY (3) /* array */ - -#ifndef _WIN32 -#define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT)) -#define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT)) -#define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT)) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* _A_OUT_H_ */ - diff --git a/SheepShaver/src/kpx_cpu/include/basic-blockinfo.hpp b/SheepShaver/src/kpx_cpu/include/basic-blockinfo.hpp deleted file mode 100644 index e3399671..00000000 --- a/SheepShaver/src/kpx_cpu/include/basic-blockinfo.hpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - * basic-blockinfo.hpp - PowerPC basic block information - * - * Kheperix (C) 2003 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef BASIC_BLOCKINFO_H -#define BASIC_BLOCKINFO_H - -struct basic_block_info -{ - typedef basic_block_info block_info; - static const int MAX_TARGETS = 2; - - struct dependency - { - block_info * source; - block_info * target; - dependency * next; - dependency ** prev_p; - }; - - uintptr pc; - uintptr end_pc; - int32 count; - uint32 size; - uint32 c1; - uint32 c2; - - // List of blocks we depend on - dependency dep[MAX_TARGETS]; - - // List of blocks that depends on this block - dependency * deplist; - - void init(uintptr start_pc); - void remove_dep(dependency *d); - void remove_deps(); - void create_jmpdep(block_info *tbi, int i); - void maybe_create_jmpdep(block_info *tbi); - bool intersect(uintptr start, uintptr end); -}; - -inline void -basic_block_info::init(uintptr start_pc) -{ - pc = start_pc; - deplist = NULL; - for (int i = 0; i < MAX_TARGETS; i++) { - dep[i].source = NULL; - dep[i].target = NULL; - dep[i].next = NULL; - dep[i].prev_p = NULL; - } -} - -inline void -basic_block_info::remove_dep(dependency *d) -{ - if (d->prev_p) - *(d->prev_p) = d->next; - if (d->next) - d->next->prev_p = d->prev_p; - d->prev_p = NULL; - d->next = NULL; -} - -inline void -basic_block_info::remove_deps() -{ - for (int i = 0; i < MAX_TARGETS; i++) - remove_dep(&dep[i]); -} - -inline void -basic_block_info::create_jmpdep(block_info *tbi, int i) -{ - dep[i].source = this; - dep[i].target = tbi; - dep[i].next = tbi->deplist; - if (dep[i].next) - dep[i].next->prev_p = &(dep[i].next); - dep[i].prev_p = &(tbi->deplist); - tbi->deplist = &(dep[i]); -} - -inline void -basic_block_info::maybe_create_jmpdep(block_info *tbi) -{ - for (int i = 0; i < MAX_TARGETS && dep[i].target != tbi; i++) { - if (dep[i].source == NULL) { - create_jmpdep(tbi, i); - break; - } - } -} - -inline bool -basic_block_info::intersect(uintptr start, uintptr end) -{ - return (pc >= start && pc < end) || (end_pc >= start && end_pc < end); -} - -#endif /* BASIC_BLOCKINFO_H */ diff --git a/SheepShaver/src/kpx_cpu/include/basic-cpu.hpp b/SheepShaver/src/kpx_cpu/include/basic-cpu.hpp deleted file mode 100644 index 568ddb0b..00000000 --- a/SheepShaver/src/kpx_cpu/include/basic-cpu.hpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * basic-cpu.hpp - Basic CPU definitions - * - * Kheperix (C) 2003 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef BASIC_CPU_H -#define BASIC_CPU_H - -#include "sysdeps.h" -#include -#include "task-plugin.hpp" - -/** - * Generic register value - **/ - -union any_register -{ - uint32 i; - uint64 j; - float f; - double d; - - // Explicit casts may be required to use those constructors - any_register(uint32 v = 0) : i(v) { } - any_register(uint64 v) : j(v) { } - any_register(float v) : f(v) { } - any_register(double v) : d(v) { } -}; - -/** - * Basic CPU model - **/ - -struct basic_cpu - : public task_plugin -{ - // Basic register set - struct registers - { - enum { - PC = -1, // Program Counter - SP = -2, // Stack Pointer - }; - }; - - // Constructor & destructor - basic_cpu(task_struct * parent_task); - virtual ~basic_cpu(); - - // Execute code at current address - virtual void execute() = 0; - - // Set VALUE to register ID - virtual void set_register(int id, any_register const & value) = 0; - - // Get register ID - virtual any_register get_register(int id) = 0; - - // Start emulation, returns exit status - int run(); - - // Stop emulation - void exit(int status); - -private: - jmp_buf env; - int exit_status; -}; - -// Alias basic register set -typedef basic_cpu::registers basic_registers; - -#endif /* BASIC_CPU_H */ diff --git a/SheepShaver/src/kpx_cpu/include/basic-plugin.hpp b/SheepShaver/src/kpx_cpu/include/basic-plugin.hpp deleted file mode 100644 index 77da79f2..00000000 --- a/SheepShaver/src/kpx_cpu/include/basic-plugin.hpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - * basic-plugin.hpp - Basic plugin definition - * - * Kheperix (C) 2003 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef BASIC_PLUGIN_H -#define BASIC_PLUGIN_H - -struct basic_plugin -{ - virtual ~basic_plugin() { } -}; - -#endif /* BASIC_PLUGIN_H */ diff --git a/SheepShaver/src/kpx_cpu/include/block-alloc.hpp b/SheepShaver/src/kpx_cpu/include/block-alloc.hpp deleted file mode 100644 index 70217e40..00000000 --- a/SheepShaver/src/kpx_cpu/include/block-alloc.hpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - * block_alloc.hpp - Memory allocation in blocks - * - * Kheperix (C) 2003 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef BLOCK_ALLOC_H -#define BLOCK_ALLOC_H - -/** - * Slow memory allocator - * - * Each time a DATA item is requested (resp. released), the block - * is immediately allocated (resp. free'd). - **/ - -template< class data > -struct slow_allocator -{ - data * acquire() const { return new data; } - void release(data * const x) const { delete x; } -}; - -/** - * Lazy memory allocator - * - * Allocate a big memory block, typically larger than a page, - * that contains up to POOL_COUNT data items of type DATA. - **/ - -template< class data > -class lazy_allocator -{ - static const int pool_size = 4096; - static const int pool_count = 1 + pool_size / sizeof(data); - - struct chunk - { - data value; - chunk * next; - }; - - struct pool - { - chunk chunks[pool_count]; - pool * next; - }; - - pool * pools; - chunk * chunks; - -public: - lazy_allocator() : pools(0), chunks(0) { } - ~lazy_allocator(); - data * acquire(); - void release(data * const); -}; - -template< class data > -lazy_allocator::~lazy_allocator() -{ - pool * p = pools; - while (p) { - pool * d = p; - p = p->next; - delete d; - } -} - -template< class data > -data * lazy_allocator::acquire() -{ - if (!chunks) { - // There is no chunk left, allocate a new pool and link the - // chunks into the free list - pool * p = new pool; - for (chunk * c = &p->chunks[0]; c < &p->chunks[pool_count]; c++) { - c->next = chunks; - chunks = c; - } - p->next = pools; - pools = p; - } - chunk * c = chunks; - chunks = c->next; - return &c->value; -} - -template< class data > -void lazy_allocator::release(data * const d) -{ - chunk *c = (chunk *)d; - c->next = chunks; - chunks = c; -} - -/** - * Helper memory allocator - **/ - -template< class data_type, template< class > class allocator_type = lazy_allocator > -class allocator_helper -{ - static allocator_type allocator; -public: - static inline void *allocate() - { return allocator.acquire(); } - static inline void deallocate(void * p) - { allocator.release((data_type *)p); } -}; - -#endif /* BLOCK_ALLOC_H */ diff --git a/SheepShaver/src/kpx_cpu/include/elf-defs.h b/SheepShaver/src/kpx_cpu/include/elf-defs.h deleted file mode 100644 index 8fe6b053..00000000 --- a/SheepShaver/src/kpx_cpu/include/elf-defs.h +++ /dev/null @@ -1,2360 +0,0 @@ -/* This file defines standard ELF types, structures, and macros. - Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef ELF_DEFS_H -#define ELF_DEFS_H 1 - -/* Standard ELF types. */ - -/* Type for a 16-bit quantity. */ -typedef uint16 Elf32_Half; -typedef uint16 Elf64_Half; - -/* Types for signed and unsigned 32-bit quantities. */ -typedef uint32 Elf32_Word; -typedef int32 Elf32_Sword; -typedef uint32 Elf64_Word; -typedef int32 Elf64_Sword; - -/* Types for signed and unsigned 64-bit quantities. */ -typedef uint64 Elf32_Xword; -typedef int64 Elf32_Sxword; -typedef uint64 Elf64_Xword; -typedef int64 Elf64_Sxword; - -/* Type of addresses. */ -typedef uint32 Elf32_Addr; -typedef uint64 Elf64_Addr; - -/* Type of file offsets. */ -typedef uint32 Elf32_Off; -typedef uint64 Elf64_Off; - -/* Type for section indices, which are 16-bit quantities. */ -typedef uint16 Elf32_Section; -typedef uint16 Elf64_Section; - -/* Type for version symbol information. */ -typedef Elf32_Half Elf32_Versym; -typedef Elf64_Half Elf64_Versym; - - -/* The ELF file header. This appears at the start of every ELF file. */ - -#define EI_NIDENT (16) - -typedef struct -{ - unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ - Elf32_Half e_type; /* Object file type */ - Elf32_Half e_machine; /* Architecture */ - Elf32_Word e_version; /* Object file version */ - Elf32_Addr e_entry; /* Entry point virtual address */ - Elf32_Off e_phoff; /* Program header table file offset */ - Elf32_Off e_shoff; /* Section header table file offset */ - Elf32_Word e_flags; /* Processor-specific flags */ - Elf32_Half e_ehsize; /* ELF header size in bytes */ - Elf32_Half e_phentsize; /* Program header table entry size */ - Elf32_Half e_phnum; /* Program header table entry count */ - Elf32_Half e_shentsize; /* Section header table entry size */ - Elf32_Half e_shnum; /* Section header table entry count */ - Elf32_Half e_shstrndx; /* Section header string table index */ -} Elf32_Ehdr; - -typedef struct -{ - unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ - Elf64_Half e_type; /* Object file type */ - Elf64_Half e_machine; /* Architecture */ - Elf64_Word e_version; /* Object file version */ - Elf64_Addr e_entry; /* Entry point virtual address */ - Elf64_Off e_phoff; /* Program header table file offset */ - Elf64_Off e_shoff; /* Section header table file offset */ - Elf64_Word e_flags; /* Processor-specific flags */ - Elf64_Half e_ehsize; /* ELF header size in bytes */ - Elf64_Half e_phentsize; /* Program header table entry size */ - Elf64_Half e_phnum; /* Program header table entry count */ - Elf64_Half e_shentsize; /* Section header table entry size */ - Elf64_Half e_shnum; /* Section header table entry count */ - Elf64_Half e_shstrndx; /* Section header string table index */ -} Elf64_Ehdr; - -/* Fields in the e_ident array. The EI_* macros are indices into the - array. The macros under each EI_* macro are the values the byte - may have. */ - -#define EI_MAG0 0 /* File identification byte 0 index */ -#define ELFMAG0 0x7f /* Magic number byte 0 */ - -#define EI_MAG1 1 /* File identification byte 1 index */ -#define ELFMAG1 'E' /* Magic number byte 1 */ - -#define EI_MAG2 2 /* File identification byte 2 index */ -#define ELFMAG2 'L' /* Magic number byte 2 */ - -#define EI_MAG3 3 /* File identification byte 3 index */ -#define ELFMAG3 'F' /* Magic number byte 3 */ - -/* Conglomeration of the identification bytes, for easy testing as a word. */ -#define ELFMAG "\177ELF" -#define SELFMAG 4 - -#define EI_CLASS 4 /* File class byte index */ -#define ELFCLASSNONE 0 /* Invalid class */ -#define ELFCLASS32 1 /* 32-bit objects */ -#define ELFCLASS64 2 /* 64-bit objects */ -#define ELFCLASSNUM 3 - -#define EI_DATA 5 /* Data encoding byte index */ -#define ELFDATANONE 0 /* Invalid data encoding */ -#define ELFDATA2LSB 1 /* 2's complement, little endian */ -#define ELFDATA2MSB 2 /* 2's complement, big endian */ -#define ELFDATANUM 3 - -#define EI_VERSION 6 /* File version byte index */ - /* Value must be EV_CURRENT */ - -#define EI_OSABI 7 /* OS ABI identification */ -#define ELFOSABI_NONE 0 /* UNIX System V ABI */ -#define ELFOSABI_SYSV 0 /* Alias. */ -#define ELFOSABI_HPUX 1 /* HP-UX */ -#define ELFOSABI_NETBSD 2 /* NetBSD. */ -#define ELFOSABI_LINUX 3 /* Linux. */ -#define ELFOSABI_SOLARIS 6 /* Sun Solaris. */ -#define ELFOSABI_AIX 7 /* IBM AIX. */ -#define ELFOSABI_IRIX 8 /* SGI Irix. */ -#define ELFOSABI_FREEBSD 9 /* FreeBSD. */ -#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX. */ -#define ELFOSABI_MODESTO 11 /* Novell Modesto. */ -#define ELFOSABI_OPENBSD 12 /* OpenBSD. */ -#define ELFOSABI_ARM 97 /* ARM */ -#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ - -#define EI_ABIVERSION 8 /* ABI version */ - -#define EI_PAD 9 /* Byte index of padding bytes */ - -/* Legal values for e_type (object file type). */ - -#define ET_NONE 0 /* No file type */ -#define ET_REL 1 /* Relocatable file */ -#define ET_EXEC 2 /* Executable file */ -#define ET_DYN 3 /* Shared object file */ -#define ET_CORE 4 /* Core file */ -#define ET_NUM 5 /* Number of defined types */ -#define ET_LOOS 0xfe00 /* OS-specific range start */ -#define ET_HIOS 0xfeff /* OS-specific range end */ -#define ET_LOPROC 0xff00 /* Processor-specific range start */ -#define ET_HIPROC 0xffff /* Processor-specific range end */ - -/* Legal values for e_machine (architecture). */ - -#define EM_NONE 0 /* No machine */ -#define EM_M32 1 /* AT&T WE 32100 */ -#define EM_SPARC 2 /* SUN SPARC */ -#define EM_386 3 /* Intel 80386 */ -#define EM_68K 4 /* Motorola m68k family */ -#define EM_88K 5 /* Motorola m88k family */ -#define EM_486 6 /* Perhaps disused */ -#define EM_860 7 /* Intel 80860 */ -#define EM_MIPS 8 /* MIPS R3000 big-endian */ -#define EM_S370 9 /* IBM System/370 */ -#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */ - -#define EM_PARISC 15 /* HPPA */ -#define EM_VPP500 17 /* Fujitsu VPP500 */ -#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ -#define EM_960 19 /* Intel 80960 */ -#define EM_PPC 20 /* PowerPC */ -#define EM_PPC64 21 /* PowerPC 64-bit */ -#define EM_S390 22 /* IBM S390 */ - -#define EM_V800 36 /* NEC V800 series */ -#define EM_FR20 37 /* Fujitsu FR20 */ -#define EM_RH32 38 /* TRW RH-32 */ -#define EM_RCE 39 /* Motorola RCE */ -#define EM_ARM 40 /* ARM */ -#define EM_FAKE_ALPHA 41 /* Digital Alpha */ -#define EM_SH 42 /* Hitachi SH */ -#define EM_SPARCV9 43 /* SPARC v9 64-bit */ -#define EM_TRICORE 44 /* Siemens Tricore */ -#define EM_ARC 45 /* Argonaut RISC Core */ -#define EM_H8_300 46 /* Hitachi H8/300 */ -#define EM_H8_300H 47 /* Hitachi H8/300H */ -#define EM_H8S 48 /* Hitachi H8S */ -#define EM_H8_500 49 /* Hitachi H8/500 */ -#define EM_IA_64 50 /* Intel Merced */ -#define EM_MIPS_X 51 /* Stanford MIPS-X */ -#define EM_COLDFIRE 52 /* Motorola Coldfire */ -#define EM_68HC12 53 /* Motorola M68HC12 */ -#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/ -#define EM_PCP 55 /* Siemens PCP */ -#define EM_NCPU 56 /* Sony nCPU embeeded RISC */ -#define EM_NDR1 57 /* Denso NDR1 microprocessor */ -#define EM_STARCORE 58 /* Motorola Start*Core processor */ -#define EM_ME16 59 /* Toyota ME16 processor */ -#define EM_ST100 60 /* STMicroelectronic ST100 processor */ -#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/ -#define EM_X86_64 62 /* AMD x86-64 architecture */ -#define EM_PDSP 63 /* Sony DSP Processor */ - -#define EM_FX66 66 /* Siemens FX66 microcontroller */ -#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */ -#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */ -#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */ -#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */ -#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */ -#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */ -#define EM_SVX 73 /* Silicon Graphics SVx */ -#define EM_ST19 74 /* STMicroelectronics ST19 8 bit mc */ -#define EM_VAX 75 /* Digital VAX */ -#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ -#define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded processor */ -#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */ -#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */ -#define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */ -#define EM_HUANY 81 /* Harvard University machine-independent object files */ -#define EM_PRISM 82 /* SiTera Prism */ -#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */ -#define EM_FR30 84 /* Fujitsu FR30 */ -#define EM_D10V 85 /* Mitsubishi D10V */ -#define EM_D30V 86 /* Mitsubishi D30V */ -#define EM_V850 87 /* NEC v850 */ -#define EM_M32R 88 /* Mitsubishi M32R */ -#define EM_MN10300 89 /* Matsushita MN10300 */ -#define EM_MN10200 90 /* Matsushita MN10200 */ -#define EM_PJ 91 /* picoJava */ -#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */ -#define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */ -#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */ -#define EM_NUM 95 - -/* If it is necessary to assign new unofficial EM_* values, please - pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the - chances of collision with official or non-GNU unofficial values. */ - -#define EM_ALPHA 0x9026 - -/* Legal values for e_version (version). */ - -#define EV_NONE 0 /* Invalid ELF version */ -#define EV_CURRENT 1 /* Current version */ -#define EV_NUM 2 - -/* Section header. */ - -typedef struct -{ - Elf32_Word sh_name; /* Section name (string tbl index) */ - Elf32_Word sh_type; /* Section type */ - Elf32_Word sh_flags; /* Section flags */ - Elf32_Addr sh_addr; /* Section virtual addr at execution */ - Elf32_Off sh_offset; /* Section file offset */ - Elf32_Word sh_size; /* Section size in bytes */ - Elf32_Word sh_link; /* Link to another section */ - Elf32_Word sh_info; /* Additional section information */ - Elf32_Word sh_addralign; /* Section alignment */ - Elf32_Word sh_entsize; /* Entry size if section holds table */ -} Elf32_Shdr; - -typedef struct -{ - Elf64_Word sh_name; /* Section name (string tbl index) */ - Elf64_Word sh_type; /* Section type */ - Elf64_Xword sh_flags; /* Section flags */ - Elf64_Addr sh_addr; /* Section virtual addr at execution */ - Elf64_Off sh_offset; /* Section file offset */ - Elf64_Xword sh_size; /* Section size in bytes */ - Elf64_Word sh_link; /* Link to another section */ - Elf64_Word sh_info; /* Additional section information */ - Elf64_Xword sh_addralign; /* Section alignment */ - Elf64_Xword sh_entsize; /* Entry size if section holds table */ -} Elf64_Shdr; - -/* Special section indices. */ - -#define SHN_UNDEF 0 /* Undefined section */ -#define SHN_LORESERVE 0xff00 /* Start of reserved indices */ -#define SHN_LOPROC 0xff00 /* Start of processor-specific */ -#define SHN_HIPROC 0xff1f /* End of processor-specific */ -#define SHN_LOOS 0xff20 /* Start of OS-specific */ -#define SHN_HIOS 0xff3f /* End of OS-specific */ -#define SHN_ABS 0xfff1 /* Associated symbol is absolute */ -#define SHN_COMMON 0xfff2 /* Associated symbol is common */ -#define SHN_XINDEX 0xffff /* Index is in extra table. */ -#define SHN_HIRESERVE 0xffff /* End of reserved indices */ - -/* Legal values for sh_type (section type). */ - -#define SHT_NULL 0 /* Section header table entry unused */ -#define SHT_PROGBITS 1 /* Program data */ -#define SHT_SYMTAB 2 /* Symbol table */ -#define SHT_STRTAB 3 /* String table */ -#define SHT_RELA 4 /* Relocation entries with addends */ -#define SHT_HASH 5 /* Symbol hash table */ -#define SHT_DYNAMIC 6 /* Dynamic linking information */ -#define SHT_NOTE 7 /* Notes */ -#define SHT_NOBITS 8 /* Program space with no data (bss) */ -#define SHT_REL 9 /* Relocation entries, no addends */ -#define SHT_SHLIB 10 /* Reserved */ -#define SHT_DYNSYM 11 /* Dynamic linker symbol table */ -#define SHT_INIT_ARRAY 14 /* Array of constructors */ -#define SHT_FINI_ARRAY 15 /* Array of destructors */ -#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */ -#define SHT_GROUP 17 /* Section group */ -#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */ -#define SHT_NUM 19 /* Number of defined types. */ -#define SHT_LOOS 0x60000000 /* Start OS-specific */ -#define SHT_GNU_LIBLIST 0x6ffffff7 /* Prelink library list */ -#define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content. */ -#define SHT_LOSUNW 0x6ffffffa /* Sun-specific low bound. */ -#define SHT_SUNW_move 0x6ffffffa -#define SHT_SUNW_COMDAT 0x6ffffffb -#define SHT_SUNW_syminfo 0x6ffffffc -#define SHT_GNU_verdef 0x6ffffffd /* Version definition section. */ -#define SHT_GNU_verneed 0x6ffffffe /* Version needs section. */ -#define SHT_GNU_versym 0x6fffffff /* Version symbol table. */ -#define SHT_HISUNW 0x6fffffff /* Sun-specific high bound. */ -#define SHT_HIOS 0x6fffffff /* End OS-specific type */ -#define SHT_LOPROC 0x70000000 /* Start of processor-specific */ -#define SHT_HIPROC 0x7fffffff /* End of processor-specific */ -#define SHT_LOUSER 0x80000000 /* Start of application-specific */ -#define SHT_HIUSER 0x8fffffff /* End of application-specific */ - -/* Legal values for sh_flags (section flags). */ - -#define SHF_WRITE (1 << 0) /* Writable */ -#define SHF_ALLOC (1 << 1) /* Occupies memory during execution */ -#define SHF_EXECINSTR (1 << 2) /* Executable */ -#define SHF_MERGE (1 << 4) /* Might be merged */ -#define SHF_STRINGS (1 << 5) /* Contains nul-terminated strings */ -#define SHF_INFO_LINK (1 << 6) /* `sh_info' contains SHT index */ -#define SHF_LINK_ORDER (1 << 7) /* Preserve order after combining */ -#define SHF_OS_NONCONFORMING (1 << 8) /* Non-standard OS specific handling - required */ -#define SHF_GROUP (1 << 9) /* Section is member of a group. */ -#define SHF_TLS (1 << 10) /* Section hold thread-local data. */ -#define SHF_MASKOS 0x0ff00000 /* OS-specific. */ -#define SHF_MASKPROC 0xf0000000 /* Processor-specific */ - -/* Section group handling. */ -#define GRP_COMDAT 0x1 /* Mark group as COMDAT. */ - -/* Symbol table entry. */ - -typedef struct -{ - Elf32_Word st_name; /* Symbol name (string tbl index) */ - Elf32_Addr st_value; /* Symbol value */ - Elf32_Word st_size; /* Symbol size */ - unsigned char st_info; /* Symbol type and binding */ - unsigned char st_other; /* Symbol visibility */ - Elf32_Section st_shndx; /* Section index */ -} Elf32_Sym; - -typedef struct -{ - Elf64_Word st_name; /* Symbol name (string tbl index) */ - unsigned char st_info; /* Symbol type and binding */ - unsigned char st_other; /* Symbol visibility */ - Elf64_Section st_shndx; /* Section index */ - Elf64_Addr st_value; /* Symbol value */ - Elf64_Xword st_size; /* Symbol size */ -} Elf64_Sym; - -/* The syminfo section if available contains additional information about - every dynamic symbol. */ - -typedef struct -{ - Elf32_Half si_boundto; /* Direct bindings, symbol bound to */ - Elf32_Half si_flags; /* Per symbol flags */ -} Elf32_Syminfo; - -typedef struct -{ - Elf64_Half si_boundto; /* Direct bindings, symbol bound to */ - Elf64_Half si_flags; /* Per symbol flags */ -} Elf64_Syminfo; - -/* Possible values for si_boundto. */ -#define SYMINFO_BT_SELF 0xffff /* Symbol bound to self */ -#define SYMINFO_BT_PARENT 0xfffe /* Symbol bound to parent */ -#define SYMINFO_BT_LOWRESERVE 0xff00 /* Beginning of reserved entries */ - -/* Possible bitmasks for si_flags. */ -#define SYMINFO_FLG_DIRECT 0x0001 /* Direct bound symbol */ -#define SYMINFO_FLG_PASSTHRU 0x0002 /* Pass-thru symbol for translator */ -#define SYMINFO_FLG_COPY 0x0004 /* Symbol is a copy-reloc */ -#define SYMINFO_FLG_LAZYLOAD 0x0008 /* Symbol bound to object to be lazy - loaded */ -/* Syminfo version values. */ -#define SYMINFO_NONE 0 -#define SYMINFO_CURRENT 1 -#define SYMINFO_NUM 2 - - -/* How to extract and insert information held in the st_info field. */ - -#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4) -#define ELF32_ST_TYPE(val) ((val) & 0xf) -#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf)) - -/* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */ -#define ELF64_ST_BIND(val) ELF32_ST_BIND (val) -#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val) -#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type)) - -/* Legal values for ST_BIND subfield of st_info (symbol binding). */ - -#define STB_LOCAL 0 /* Local symbol */ -#define STB_GLOBAL 1 /* Global symbol */ -#define STB_WEAK 2 /* Weak symbol */ -#define STB_NUM 3 /* Number of defined types. */ -#define STB_LOOS 10 /* Start of OS-specific */ -#define STB_HIOS 12 /* End of OS-specific */ -#define STB_LOPROC 13 /* Start of processor-specific */ -#define STB_HIPROC 15 /* End of processor-specific */ - -/* Legal values for ST_TYPE subfield of st_info (symbol type). */ - -#define STT_NOTYPE 0 /* Symbol type is unspecified */ -#define STT_OBJECT 1 /* Symbol is a data object */ -#define STT_FUNC 2 /* Symbol is a code object */ -#define STT_SECTION 3 /* Symbol associated with a section */ -#define STT_FILE 4 /* Symbol's name is file name */ -#define STT_COMMON 5 /* Symbol is a common data object */ -#define STT_TLS 6 /* Symbol is thread-local data object*/ -#define STT_NUM 7 /* Number of defined types. */ -#define STT_LOOS 10 /* Start of OS-specific */ -#define STT_HIOS 12 /* End of OS-specific */ -#define STT_LOPROC 13 /* Start of processor-specific */ -#define STT_HIPROC 15 /* End of processor-specific */ - - -/* Symbol table indices are found in the hash buckets and chain table - of a symbol hash table section. This special index value indicates - the end of a chain, meaning no further symbols are found in that bucket. */ - -#define STN_UNDEF 0 /* End of a chain. */ - - -/* How to extract and insert information held in the st_other field. */ - -#define ELF32_ST_VISIBILITY(o) ((o) & 0x03) - -/* For ELF64 the definitions are the same. */ -#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o) - -/* Symbol visibility specification encoded in the st_other field. */ -#define STV_DEFAULT 0 /* Default symbol visibility rules */ -#define STV_INTERNAL 1 /* Processor specific hidden class */ -#define STV_HIDDEN 2 /* Sym unavailable in other modules */ -#define STV_PROTECTED 3 /* Not preemptible, not exported */ - - -/* Relocation table entry without addend (in section of type SHT_REL). */ - -typedef struct -{ - Elf32_Addr r_offset; /* Address */ - Elf32_Word r_info; /* Relocation type and symbol index */ -} Elf32_Rel; - -/* I have seen two different definitions of the Elf64_Rel and - Elf64_Rela structures, so we'll leave them out until Novell (or - whoever) gets their act together. */ -/* The following, at least, is used on Sparc v9, MIPS, and Alpha. */ - -typedef struct -{ - Elf64_Addr r_offset; /* Address */ - Elf64_Xword r_info; /* Relocation type and symbol index */ -} Elf64_Rel; - -/* Relocation table entry with addend (in section of type SHT_RELA). */ - -typedef struct -{ - Elf32_Addr r_offset; /* Address */ - Elf32_Word r_info; /* Relocation type and symbol index */ - Elf32_Sword r_addend; /* Addend */ -} Elf32_Rela; - -typedef struct -{ - Elf64_Addr r_offset; /* Address */ - Elf64_Xword r_info; /* Relocation type and symbol index */ - Elf64_Sxword r_addend; /* Addend */ -} Elf64_Rela; - -/* How to extract and insert information held in the r_info field. */ - -#define ELF32_R_SYM(val) ((val) >> 8) -#define ELF32_R_TYPE(val) ((val) & 0xff) -#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff)) - -#define ELF64_R_SYM(i) ((i) >> 32) -#define ELF64_R_TYPE(i) ((i) & 0xffffffff) -#define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type)) - -/* Program segment header. */ - -typedef struct -{ - Elf32_Word p_type; /* Segment type */ - Elf32_Off p_offset; /* Segment file offset */ - Elf32_Addr p_vaddr; /* Segment virtual address */ - Elf32_Addr p_paddr; /* Segment physical address */ - Elf32_Word p_filesz; /* Segment size in file */ - Elf32_Word p_memsz; /* Segment size in memory */ - Elf32_Word p_flags; /* Segment flags */ - Elf32_Word p_align; /* Segment alignment */ -} Elf32_Phdr; - -typedef struct -{ - Elf64_Word p_type; /* Segment type */ - Elf64_Word p_flags; /* Segment flags */ - Elf64_Off p_offset; /* Segment file offset */ - Elf64_Addr p_vaddr; /* Segment virtual address */ - Elf64_Addr p_paddr; /* Segment physical address */ - Elf64_Xword p_filesz; /* Segment size in file */ - Elf64_Xword p_memsz; /* Segment size in memory */ - Elf64_Xword p_align; /* Segment alignment */ -} Elf64_Phdr; - -/* Legal values for p_type (segment type). */ - -#define PT_NULL 0 /* Program header table entry unused */ -#define PT_LOAD 1 /* Loadable program segment */ -#define PT_DYNAMIC 2 /* Dynamic linking information */ -#define PT_INTERP 3 /* Program interpreter */ -#define PT_NOTE 4 /* Auxiliary information */ -#define PT_SHLIB 5 /* Reserved */ -#define PT_PHDR 6 /* Entry for header table itself */ -#define PT_TLS 7 /* Thread-local storage segment */ -#define PT_NUM 8 /* Number of defined types */ -#define PT_LOOS 0x60000000 /* Start of OS-specific */ -#define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */ -#define PT_LOSUNW 0x6ffffffa -#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */ -#define PT_SUNWSTACK 0x6ffffffb /* Stack segment */ -#define PT_HISUNW 0x6fffffff -#define PT_HIOS 0x6fffffff /* End of OS-specific */ -#define PT_LOPROC 0x70000000 /* Start of processor-specific */ -#define PT_HIPROC 0x7fffffff /* End of processor-specific */ - -/* Legal values for p_flags (segment flags). */ - -#define PF_X (1 << 0) /* Segment is executable */ -#define PF_W (1 << 1) /* Segment is writable */ -#define PF_R (1 << 2) /* Segment is readable */ -#define PF_MASKOS 0x0ff00000 /* OS-specific */ -#define PF_MASKPROC 0xf0000000 /* Processor-specific */ - -/* Legal values for note segment descriptor types for core files. */ - -#define NT_PRSTATUS 1 /* Contains copy of prstatus struct */ -#define NT_FPREGSET 2 /* Contains copy of fpregset struct */ -#define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */ -#define NT_PRXREG 4 /* Contains copy of prxregset struct */ -#define NT_TASKSTRUCT 4 /* Contains copy of task structure */ -#define NT_PLATFORM 5 /* String from sysinfo(SI_PLATFORM) */ -#define NT_AUXV 6 /* Contains copy of auxv array */ -#define NT_GWINDOWS 7 /* Contains copy of gwindows struct */ -#define NT_ASRS 8 /* Contains copy of asrset struct */ -#define NT_PSTATUS 10 /* Contains copy of pstatus struct */ -#define NT_PSINFO 13 /* Contains copy of psinfo struct */ -#define NT_PRCRED 14 /* Contains copy of prcred struct */ -#define NT_UTSNAME 15 /* Contains copy of utsname struct */ -#define NT_LWPSTATUS 16 /* Contains copy of lwpstatus struct */ -#define NT_LWPSINFO 17 /* Contains copy of lwpinfo struct */ -#define NT_PRFPXREG 20 /* Contains copy of fprxregset struct*/ - -/* Legal values for the note segment descriptor types for object files. */ - -#define NT_VERSION 1 /* Contains a version string. */ - - -/* Dynamic section entry. */ - -typedef struct -{ - Elf32_Sword d_tag; /* Dynamic entry type */ - union - { - Elf32_Word d_val; /* Integer value */ - Elf32_Addr d_ptr; /* Address value */ - } d_un; -} Elf32_Dyn; - -typedef struct -{ - Elf64_Sxword d_tag; /* Dynamic entry type */ - union - { - Elf64_Xword d_val; /* Integer value */ - Elf64_Addr d_ptr; /* Address value */ - } d_un; -} Elf64_Dyn; - -/* Legal values for d_tag (dynamic entry type). */ - -#define DT_NULL 0 /* Marks end of dynamic section */ -#define DT_NEEDED 1 /* Name of needed library */ -#define DT_PLTRELSZ 2 /* Size in bytes of PLT relocs */ -#define DT_PLTGOT 3 /* Processor defined value */ -#define DT_HASH 4 /* Address of symbol hash table */ -#define DT_STRTAB 5 /* Address of string table */ -#define DT_SYMTAB 6 /* Address of symbol table */ -#define DT_RELA 7 /* Address of Rela relocs */ -#define DT_RELASZ 8 /* Total size of Rela relocs */ -#define DT_RELAENT 9 /* Size of one Rela reloc */ -#define DT_STRSZ 10 /* Size of string table */ -#define DT_SYMENT 11 /* Size of one symbol table entry */ -#define DT_INIT 12 /* Address of init function */ -#define DT_FINI 13 /* Address of termination function */ -#define DT_SONAME 14 /* Name of shared object */ -#define DT_RPATH 15 /* Library search path (deprecated) */ -#define DT_SYMBOLIC 16 /* Start symbol search here */ -#define DT_REL 17 /* Address of Rel relocs */ -#define DT_RELSZ 18 /* Total size of Rel relocs */ -#define DT_RELENT 19 /* Size of one Rel reloc */ -#define DT_PLTREL 20 /* Type of reloc in PLT */ -#define DT_DEBUG 21 /* For debugging; unspecified */ -#define DT_TEXTREL 22 /* Reloc might modify .text */ -#define DT_JMPREL 23 /* Address of PLT relocs */ -#define DT_BIND_NOW 24 /* Process relocations of object */ -#define DT_INIT_ARRAY 25 /* Array with addresses of init fct */ -#define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */ -#define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */ -#define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */ -#define DT_RUNPATH 29 /* Library search path */ -#define DT_FLAGS 30 /* Flags for the object being loaded */ -#define DT_ENCODING 32 /* Start of encoded range */ -#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/ -#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */ -#define DT_NUM 34 /* Number used */ -#define DT_LOOS 0x6000000d /* Start of OS-specific */ -#define DT_HIOS 0x6ffff000 /* End of OS-specific */ -#define DT_LOPROC 0x70000000 /* Start of processor-specific */ -#define DT_HIPROC 0x7fffffff /* End of processor-specific */ -#define DT_PROCNUM DT_MIPS_NUM /* Most used by any processor */ - -/* DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the - Dyn.d_un.d_val field of the Elf*_Dyn structure. This follows Sun's - approach. */ -#define DT_VALRNGLO 0x6ffffd00 -#define DT_GNU_PRELINKED 0x6ffffdf5 /* Prelinking timestamp */ -#define DT_GNU_CONFLICTSZ 0x6ffffdf6 /* Size of conflict section */ -#define DT_GNU_LIBLISTSZ 0x6ffffdf7 /* Size of library list */ -#define DT_CHECKSUM 0x6ffffdf8 -#define DT_PLTPADSZ 0x6ffffdf9 -#define DT_MOVEENT 0x6ffffdfa -#define DT_MOVESZ 0x6ffffdfb -#define DT_FEATURE_1 0x6ffffdfc /* Feature selection (DTF_*). */ -#define DT_POSFLAG_1 0x6ffffdfd /* Flags for DT_* entries, effecting - the following DT_* entry. */ -#define DT_SYMINSZ 0x6ffffdfe /* Size of syminfo table (in bytes) */ -#define DT_SYMINENT 0x6ffffdff /* Entry size of syminfo */ -#define DT_VALRNGHI 0x6ffffdff -#define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag)) /* Reverse order! */ -#define DT_VALNUM 12 - -/* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the - Dyn.d_un.d_ptr field of the Elf*_Dyn structure. - - If any adjustment is made to the ELF object after it has been - built these entries will need to be adjusted. */ -#define DT_ADDRRNGLO 0x6ffffe00 -#define DT_GNU_CONFLICT 0x6ffffef8 /* Start of conflict section */ -#define DT_GNU_LIBLIST 0x6ffffef9 /* Library list */ -#define DT_CONFIG 0x6ffffefa /* Configuration information. */ -#define DT_DEPAUDIT 0x6ffffefb /* Dependency auditing. */ -#define DT_AUDIT 0x6ffffefc /* Object auditing. */ -#define DT_PLTPAD 0x6ffffefd /* PLT padding. */ -#define DT_MOVETAB 0x6ffffefe /* Move table. */ -#define DT_SYMINFO 0x6ffffeff /* Syminfo table. */ -#define DT_ADDRRNGHI 0x6ffffeff -#define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) /* Reverse order! */ -#define DT_ADDRNUM 10 - -/* The versioning entry types. The next are defined as part of the - GNU extension. */ -#define DT_VERSYM 0x6ffffff0 - -#define DT_RELACOUNT 0x6ffffff9 -#define DT_RELCOUNT 0x6ffffffa - -/* These were chosen by Sun. */ -#define DT_FLAGS_1 0x6ffffffb /* State flags, see DF_1_* below. */ -#define DT_VERDEF 0x6ffffffc /* Address of version definition - table */ -#define DT_VERDEFNUM 0x6ffffffd /* Number of version definitions */ -#define DT_VERNEED 0x6ffffffe /* Address of table with needed - versions */ -#define DT_VERNEEDNUM 0x6fffffff /* Number of needed versions */ -#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */ -#define DT_VERSIONTAGNUM 16 - -/* Sun added these machine-independent extensions in the "processor-specific" - range. Be compatible. */ -#define DT_AUXILIARY 0x7ffffffd /* Shared object to load before self */ -#define DT_FILTER 0x7fffffff /* Shared object to get values from */ -#define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1) -#define DT_EXTRANUM 3 - -/* Values of `d_un.d_val' in the DT_FLAGS entry. */ -#define DF_ORIGIN 0x00000001 /* Object may use DF_ORIGIN */ -#define DF_SYMBOLIC 0x00000002 /* Symbol resolutions starts here */ -#define DF_TEXTREL 0x00000004 /* Object contains text relocations */ -#define DF_BIND_NOW 0x00000008 /* No lazy binding for this object */ -#define DF_STATIC_TLS 0x00000010 /* Module uses the static TLS model */ - -/* State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1 - entry in the dynamic section. */ -#define DF_1_NOW 0x00000001 /* Set RTLD_NOW for this object. */ -#define DF_1_GLOBAL 0x00000002 /* Set RTLD_GLOBAL for this object. */ -#define DF_1_GROUP 0x00000004 /* Set RTLD_GROUP for this object. */ -#define DF_1_NODELETE 0x00000008 /* Set RTLD_NODELETE for this object.*/ -#define DF_1_LOADFLTR 0x00000010 /* Trigger filtee loading at runtime.*/ -#define DF_1_INITFIRST 0x00000020 /* Set RTLD_INITFIRST for this object*/ -#define DF_1_NOOPEN 0x00000040 /* Set RTLD_NOOPEN for this object. */ -#define DF_1_ORIGIN 0x00000080 /* $ORIGIN must be handled. */ -#define DF_1_DIRECT 0x00000100 /* Direct binding enabled. */ -#define DF_1_TRANS 0x00000200 -#define DF_1_INTERPOSE 0x00000400 /* Object is used to interpose. */ -#define DF_1_NODEFLIB 0x00000800 /* Ignore default lib search path. */ -#define DF_1_NODUMP 0x00001000 /* Object can't be dldump'ed. */ -#define DF_1_CONFALT 0x00002000 /* Configuration alternative created.*/ -#define DF_1_ENDFILTEE 0x00004000 /* Filtee terminates filters search. */ -#define DF_1_DISPRELDNE 0x00008000 /* Disp reloc applied at build time. */ -#define DF_1_DISPRELPND 0x00010000 /* Disp reloc applied at run-time. */ - -/* Flags for the feature selection in DT_FEATURE_1. */ -#define DTF_1_PARINIT 0x00000001 -#define DTF_1_CONFEXP 0x00000002 - -/* Flags in the DT_POSFLAG_1 entry effecting only the next DT_* entry. */ -#define DF_P1_LAZYLOAD 0x00000001 /* Lazyload following object. */ -#define DF_P1_GROUPPERM 0x00000002 /* Symbols from next object are not - generally available. */ - -/* Version definition sections. */ - -typedef struct -{ - Elf32_Half vd_version; /* Version revision */ - Elf32_Half vd_flags; /* Version information */ - Elf32_Half vd_ndx; /* Version Index */ - Elf32_Half vd_cnt; /* Number of associated aux entries */ - Elf32_Word vd_hash; /* Version name hash value */ - Elf32_Word vd_aux; /* Offset in bytes to verdaux array */ - Elf32_Word vd_next; /* Offset in bytes to next verdef - entry */ -} Elf32_Verdef; - -typedef struct -{ - Elf64_Half vd_version; /* Version revision */ - Elf64_Half vd_flags; /* Version information */ - Elf64_Half vd_ndx; /* Version Index */ - Elf64_Half vd_cnt; /* Number of associated aux entries */ - Elf64_Word vd_hash; /* Version name hash value */ - Elf64_Word vd_aux; /* Offset in bytes to verdaux array */ - Elf64_Word vd_next; /* Offset in bytes to next verdef - entry */ -} Elf64_Verdef; - - -/* Legal values for vd_version (version revision). */ -#define VER_DEF_NONE 0 /* No version */ -#define VER_DEF_CURRENT 1 /* Current version */ -#define VER_DEF_NUM 2 /* Given version number */ - -/* Legal values for vd_flags (version information flags). */ -#define VER_FLG_BASE 0x1 /* Version definition of file itself */ -#define VER_FLG_WEAK 0x2 /* Weak version identifier */ - -/* Versym symbol index values. */ -#define VER_NDX_LOCAL 0 /* Symbol is local. */ -#define VER_NDX_GLOBAL 1 /* Symbol is global. */ -#define VER_NDX_LORESERVE 0xff00 /* Beginning of reserved entries. */ -#define VER_NDX_ELIMINATE 0xff01 /* Symbol is to be eliminated. */ - -/* Auxialiary version information. */ - -typedef struct -{ - Elf32_Word vda_name; /* Version or dependency names */ - Elf32_Word vda_next; /* Offset in bytes to next verdaux - entry */ -} Elf32_Verdaux; - -typedef struct -{ - Elf64_Word vda_name; /* Version or dependency names */ - Elf64_Word vda_next; /* Offset in bytes to next verdaux - entry */ -} Elf64_Verdaux; - - -/* Version dependency section. */ - -typedef struct -{ - Elf32_Half vn_version; /* Version of structure */ - Elf32_Half vn_cnt; /* Number of associated aux entries */ - Elf32_Word vn_file; /* Offset of filename for this - dependency */ - Elf32_Word vn_aux; /* Offset in bytes to vernaux array */ - Elf32_Word vn_next; /* Offset in bytes to next verneed - entry */ -} Elf32_Verneed; - -typedef struct -{ - Elf64_Half vn_version; /* Version of structure */ - Elf64_Half vn_cnt; /* Number of associated aux entries */ - Elf64_Word vn_file; /* Offset of filename for this - dependency */ - Elf64_Word vn_aux; /* Offset in bytes to vernaux array */ - Elf64_Word vn_next; /* Offset in bytes to next verneed - entry */ -} Elf64_Verneed; - - -/* Legal values for vn_version (version revision). */ -#define VER_NEED_NONE 0 /* No version */ -#define VER_NEED_CURRENT 1 /* Current version */ -#define VER_NEED_NUM 2 /* Given version number */ - -/* Auxiliary needed version information. */ - -typedef struct -{ - Elf32_Word vna_hash; /* Hash value of dependency name */ - Elf32_Half vna_flags; /* Dependency specific information */ - Elf32_Half vna_other; /* Unused */ - Elf32_Word vna_name; /* Dependency name string offset */ - Elf32_Word vna_next; /* Offset in bytes to next vernaux - entry */ -} Elf32_Vernaux; - -typedef struct -{ - Elf64_Word vna_hash; /* Hash value of dependency name */ - Elf64_Half vna_flags; /* Dependency specific information */ - Elf64_Half vna_other; /* Unused */ - Elf64_Word vna_name; /* Dependency name string offset */ - Elf64_Word vna_next; /* Offset in bytes to next vernaux - entry */ -} Elf64_Vernaux; - - -/* Legal values for vna_flags. */ -#define VER_FLG_WEAK 0x2 /* Weak version identifier */ - - -/* Auxiliary vector. */ - -/* This vector is normally only used by the program interpreter. The - usual definition in an ABI supplement uses the name auxv_t. The - vector is not usually defined in a standard file, but it - can't hurt. We rename it to avoid conflicts. The sizes of these - types are an arrangement between the exec server and the program - interpreter, so we don't fully specify them here. */ - -typedef struct -{ - int a_type; /* Entry type */ - union - { - long int a_val; /* Integer value */ - void *a_ptr; /* Pointer value */ - void (*a_fcn) (void); /* Function pointer value */ - } a_un; -} Elf32_auxv_t; - -typedef struct -{ - long int a_type; /* Entry type */ - union - { - long int a_val; /* Integer value */ - void *a_ptr; /* Pointer value */ - void (*a_fcn) (void); /* Function pointer value */ - } a_un; -} Elf64_auxv_t; - -/* Legal values for a_type (entry type). */ - -#define AT_NULL 0 /* End of vector */ -#define AT_IGNORE 1 /* Entry should be ignored */ -#define AT_EXECFD 2 /* File descriptor of program */ -#define AT_PHDR 3 /* Program headers for program */ -#define AT_PHENT 4 /* Size of program header entry */ -#define AT_PHNUM 5 /* Number of program headers */ -#define AT_PAGESZ 6 /* System page size */ -#define AT_BASE 7 /* Base address of interpreter */ -#define AT_FLAGS 8 /* Flags */ -#define AT_ENTRY 9 /* Entry point of program */ -#define AT_NOTELF 10 /* Program is not ELF */ -#define AT_UID 11 /* Real uid */ -#define AT_EUID 12 /* Effective uid */ -#define AT_GID 13 /* Real gid */ -#define AT_EGID 14 /* Effective gid */ -#define AT_CLKTCK 17 /* Frequency of times() */ - -/* Some more special a_type values describing the hardware. */ -#define AT_PLATFORM 15 /* String identifying platform. */ -#define AT_HWCAP 16 /* Machine dependent hints about - processor capabilities. */ - -/* This entry gives some information about the FPU initialization - performed by the kernel. */ -#define AT_FPUCW 18 /* Used FPU control word. */ - -/* Cache block sizes. */ -#define AT_DCACHEBSIZE 19 /* Data cache block size. */ -#define AT_ICACHEBSIZE 20 /* Instruction cache block size. */ -#define AT_UCACHEBSIZE 21 /* Unified cache block size. */ - -/* A special ignored value for PPC, used by the kernel to control the - interpretation of the AUXV. Must be > 16. */ -#define AT_IGNOREPPC 22 /* Entry should be ignored */ - -/* Pointer to the global system page used for system calls and other - nice things. */ -#define AT_SYSINFO 32 - - -/* Note section contents. Each entry in the note section begins with - a header of a fixed form. */ - -typedef struct -{ - Elf32_Word n_namesz; /* Length of the note's name. */ - Elf32_Word n_descsz; /* Length of the note's descriptor. */ - Elf32_Word n_type; /* Type of the note. */ -} Elf32_Nhdr; - -typedef struct -{ - Elf64_Word n_namesz; /* Length of the note's name. */ - Elf64_Word n_descsz; /* Length of the note's descriptor. */ - Elf64_Word n_type; /* Type of the note. */ -} Elf64_Nhdr; - -/* Known names of notes. */ - -/* Solaris entries in the note section have this name. */ -#define ELF_NOTE_SOLARIS "SUNW Solaris" - -/* Note entries for GNU systems have this name. */ -#define ELF_NOTE_GNU "GNU" - - -/* Defined types of notes for Solaris. */ - -/* Value of descriptor (one word) is desired pagesize for the binary. */ -#define ELF_NOTE_PAGESIZE_HINT 1 - - -/* Defined note types for GNU systems. */ - -/* ABI information. The descriptor consists of words: - word 0: OS descriptor - word 1: major version of the ABI - word 2: minor version of the ABI - word 3: subminor version of the ABI -*/ -#define ELF_NOTE_ABI 1 - -/* Known OSes. These value can appear in word 0 of an ELF_NOTE_ABI - note section entry. */ -#define ELF_NOTE_OS_LINUX 0 -#define ELF_NOTE_OS_GNU 1 -#define ELF_NOTE_OS_SOLARIS2 2 -#define ELF_NOTE_OS_FREEBSD 3 - - -/* Move records. */ -typedef struct -{ - Elf32_Xword m_value; /* Symbol value. */ - Elf32_Word m_info; /* Size and index. */ - Elf32_Word m_poffset; /* Symbol offset. */ - Elf32_Half m_repeat; /* Repeat count. */ - Elf32_Half m_stride; /* Stride info. */ -} Elf32_Move; - -typedef struct -{ - Elf64_Xword m_value; /* Symbol value. */ - Elf64_Xword m_info; /* Size and index. */ - Elf64_Xword m_poffset; /* Symbol offset. */ - Elf64_Half m_repeat; /* Repeat count. */ - Elf64_Half m_stride; /* Stride info. */ -} Elf64_Move; - -/* Macro to construct move records. */ -#define ELF32_M_SYM(info) ((info) >> 8) -#define ELF32_M_SIZE(info) ((unsigned char) (info)) -#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char) (size)) - -#define ELF64_M_SYM(info) ELF32_M_SYM (info) -#define ELF64_M_SIZE(info) ELF32_M_SIZE (info) -#define ELF64_M_INFO(sym, size) ELF32_M_INFO (sym, size) - - -/* Motorola 68k specific definitions. */ - -/* Values for Elf32_Ehdr.e_flags. */ -#define EF_CPU32 0x00810000 - -/* m68k relocs. */ - -#define R_68K_NONE 0 /* No reloc */ -#define R_68K_32 1 /* Direct 32 bit */ -#define R_68K_16 2 /* Direct 16 bit */ -#define R_68K_8 3 /* Direct 8 bit */ -#define R_68K_PC32 4 /* PC relative 32 bit */ -#define R_68K_PC16 5 /* PC relative 16 bit */ -#define R_68K_PC8 6 /* PC relative 8 bit */ -#define R_68K_GOT32 7 /* 32 bit PC relative GOT entry */ -#define R_68K_GOT16 8 /* 16 bit PC relative GOT entry */ -#define R_68K_GOT8 9 /* 8 bit PC relative GOT entry */ -#define R_68K_GOT32O 10 /* 32 bit GOT offset */ -#define R_68K_GOT16O 11 /* 16 bit GOT offset */ -#define R_68K_GOT8O 12 /* 8 bit GOT offset */ -#define R_68K_PLT32 13 /* 32 bit PC relative PLT address */ -#define R_68K_PLT16 14 /* 16 bit PC relative PLT address */ -#define R_68K_PLT8 15 /* 8 bit PC relative PLT address */ -#define R_68K_PLT32O 16 /* 32 bit PLT offset */ -#define R_68K_PLT16O 17 /* 16 bit PLT offset */ -#define R_68K_PLT8O 18 /* 8 bit PLT offset */ -#define R_68K_COPY 19 /* Copy symbol at runtime */ -#define R_68K_GLOB_DAT 20 /* Create GOT entry */ -#define R_68K_JMP_SLOT 21 /* Create PLT entry */ -#define R_68K_RELATIVE 22 /* Adjust by program base */ -/* Keep this the last entry. */ -#define R_68K_NUM 23 - -/* Intel 80386 specific definitions. */ - -/* i386 relocs. */ - -#define R_386_NONE 0 /* No reloc */ -#define R_386_32 1 /* Direct 32 bit */ -#define R_386_PC32 2 /* PC relative 32 bit */ -#define R_386_GOT32 3 /* 32 bit GOT entry */ -#define R_386_PLT32 4 /* 32 bit PLT address */ -#define R_386_COPY 5 /* Copy symbol at runtime */ -#define R_386_GLOB_DAT 6 /* Create GOT entry */ -#define R_386_JMP_SLOT 7 /* Create PLT entry */ -#define R_386_RELATIVE 8 /* Adjust by program base */ -#define R_386_GOTOFF 9 /* 32 bit offset to GOT */ -#define R_386_GOTPC 10 /* 32 bit PC relative offset to GOT */ -#define R_386_32PLT 11 -#define R_386_TLS_TPOFF 14 /* Offset in static TLS block */ -#define R_386_TLS_IE 15 /* Address of GOT entry for static TLS - block offset */ -#define R_386_TLS_GOTIE 16 /* GOT entry for static TLS block - offset */ -#define R_386_TLS_LE 17 /* Offset relative to static TLS - block */ -#define R_386_TLS_GD 18 /* Direct 32 bit for GNU version of - general dynamic thread local data */ -#define R_386_TLS_LDM 19 /* Direct 32 bit for GNU version of - local dynamic thread local data - in LE code */ -#define R_386_16 20 -#define R_386_PC16 21 -#define R_386_8 22 -#define R_386_PC8 23 -#define R_386_TLS_GD_32 24 /* Direct 32 bit for general dynamic - thread local data */ -#define R_386_TLS_GD_PUSH 25 /* Tag for pushl in GD TLS code */ -#define R_386_TLS_GD_CALL 26 /* Relocation for call to - __tls_get_addr() */ -#define R_386_TLS_GD_POP 27 /* Tag for popl in GD TLS code */ -#define R_386_TLS_LDM_32 28 /* Direct 32 bit for local dynamic - thread local data in LE code */ -#define R_386_TLS_LDM_PUSH 29 /* Tag for pushl in LDM TLS code */ -#define R_386_TLS_LDM_CALL 30 /* Relocation for call to - __tls_get_addr() in LDM code */ -#define R_386_TLS_LDM_POP 31 /* Tag for popl in LDM TLS code */ -#define R_386_TLS_LDO_32 32 /* Offset relative to TLS block */ -#define R_386_TLS_IE_32 33 /* GOT entry for negated static TLS - block offset */ -#define R_386_TLS_LE_32 34 /* Negated offset relative to static - TLS block */ -#define R_386_TLS_DTPMOD32 35 /* ID of module containing symbol */ -#define R_386_TLS_DTPOFF32 36 /* Offset in TLS block */ -#define R_386_TLS_TPOFF32 37 /* Negated offset in static TLS block */ -/* Keep this the last entry. */ -#define R_386_NUM 38 - -/* SUN SPARC specific definitions. */ - -/* Legal values for ST_TYPE subfield of st_info (symbol type). */ - -#define STT_REGISTER 13 /* Global register reserved to app. */ - -/* Values for Elf64_Ehdr.e_flags. */ - -#define EF_SPARCV9_MM 3 -#define EF_SPARCV9_TSO 0 -#define EF_SPARCV9_PSO 1 -#define EF_SPARCV9_RMO 2 -#define EF_SPARC_LEDATA 0x800000 /* little endian data */ -#define EF_SPARC_EXT_MASK 0xFFFF00 -#define EF_SPARC_32PLUS 0x000100 /* generic V8+ features */ -#define EF_SPARC_SUN_US1 0x000200 /* Sun UltraSPARC1 extensions */ -#define EF_SPARC_HAL_R1 0x000400 /* HAL R1 extensions */ -#define EF_SPARC_SUN_US3 0x000800 /* Sun UltraSPARCIII extensions */ - -/* SPARC relocs. */ - -#define R_SPARC_NONE 0 /* No reloc */ -#define R_SPARC_8 1 /* Direct 8 bit */ -#define R_SPARC_16 2 /* Direct 16 bit */ -#define R_SPARC_32 3 /* Direct 32 bit */ -#define R_SPARC_DISP8 4 /* PC relative 8 bit */ -#define R_SPARC_DISP16 5 /* PC relative 16 bit */ -#define R_SPARC_DISP32 6 /* PC relative 32 bit */ -#define R_SPARC_WDISP30 7 /* PC relative 30 bit shifted */ -#define R_SPARC_WDISP22 8 /* PC relative 22 bit shifted */ -#define R_SPARC_HI22 9 /* High 22 bit */ -#define R_SPARC_22 10 /* Direct 22 bit */ -#define R_SPARC_13 11 /* Direct 13 bit */ -#define R_SPARC_LO10 12 /* Truncated 10 bit */ -#define R_SPARC_GOT10 13 /* Truncated 10 bit GOT entry */ -#define R_SPARC_GOT13 14 /* 13 bit GOT entry */ -#define R_SPARC_GOT22 15 /* 22 bit GOT entry shifted */ -#define R_SPARC_PC10 16 /* PC relative 10 bit truncated */ -#define R_SPARC_PC22 17 /* PC relative 22 bit shifted */ -#define R_SPARC_WPLT30 18 /* 30 bit PC relative PLT address */ -#define R_SPARC_COPY 19 /* Copy symbol at runtime */ -#define R_SPARC_GLOB_DAT 20 /* Create GOT entry */ -#define R_SPARC_JMP_SLOT 21 /* Create PLT entry */ -#define R_SPARC_RELATIVE 22 /* Adjust by program base */ -#define R_SPARC_UA32 23 /* Direct 32 bit unaligned */ - -/* Additional Sparc64 relocs. */ - -#define R_SPARC_PLT32 24 /* Direct 32 bit ref to PLT entry */ -#define R_SPARC_HIPLT22 25 /* High 22 bit PLT entry */ -#define R_SPARC_LOPLT10 26 /* Truncated 10 bit PLT entry */ -#define R_SPARC_PCPLT32 27 /* PC rel 32 bit ref to PLT entry */ -#define R_SPARC_PCPLT22 28 /* PC rel high 22 bit PLT entry */ -#define R_SPARC_PCPLT10 29 /* PC rel trunc 10 bit PLT entry */ -#define R_SPARC_10 30 /* Direct 10 bit */ -#define R_SPARC_11 31 /* Direct 11 bit */ -#define R_SPARC_64 32 /* Direct 64 bit */ -#define R_SPARC_OLO10 33 /* 10bit with secondary 13bit addend */ -#define R_SPARC_HH22 34 /* Top 22 bits of direct 64 bit */ -#define R_SPARC_HM10 35 /* High middle 10 bits of ... */ -#define R_SPARC_LM22 36 /* Low middle 22 bits of ... */ -#define R_SPARC_PC_HH22 37 /* Top 22 bits of pc rel 64 bit */ -#define R_SPARC_PC_HM10 38 /* High middle 10 bit of ... */ -#define R_SPARC_PC_LM22 39 /* Low miggle 22 bits of ... */ -#define R_SPARC_WDISP16 40 /* PC relative 16 bit shifted */ -#define R_SPARC_WDISP19 41 /* PC relative 19 bit shifted */ -#define R_SPARC_7 43 /* Direct 7 bit */ -#define R_SPARC_5 44 /* Direct 5 bit */ -#define R_SPARC_6 45 /* Direct 6 bit */ -#define R_SPARC_DISP64 46 /* PC relative 64 bit */ -#define R_SPARC_PLT64 47 /* Direct 64 bit ref to PLT entry */ -#define R_SPARC_HIX22 48 /* High 22 bit complemented */ -#define R_SPARC_LOX10 49 /* Truncated 11 bit complemented */ -#define R_SPARC_H44 50 /* Direct high 12 of 44 bit */ -#define R_SPARC_M44 51 /* Direct mid 22 of 44 bit */ -#define R_SPARC_L44 52 /* Direct low 10 of 44 bit */ -#define R_SPARC_REGISTER 53 /* Global register usage */ -#define R_SPARC_UA64 54 /* Direct 64 bit unaligned */ -#define R_SPARC_UA16 55 /* Direct 16 bit unaligned */ -#define R_SPARC_TLS_GD_HI22 56 -#define R_SPARC_TLS_GD_LO10 57 -#define R_SPARC_TLS_GD_ADD 58 -#define R_SPARC_TLS_GD_CALL 59 -#define R_SPARC_TLS_LDM_HI22 60 -#define R_SPARC_TLS_LDM_LO10 61 -#define R_SPARC_TLS_LDM_ADD 62 -#define R_SPARC_TLS_LDM_CALL 63 -#define R_SPARC_TLS_LDO_HIX22 64 -#define R_SPARC_TLS_LDO_LOX10 65 -#define R_SPARC_TLS_LDO_ADD 66 -#define R_SPARC_TLS_IE_HI22 67 -#define R_SPARC_TLS_IE_LO10 68 -#define R_SPARC_TLS_IE_LD 69 -#define R_SPARC_TLS_IE_LDX 70 -#define R_SPARC_TLS_IE_ADD 71 -#define R_SPARC_TLS_LE_HIX22 72 -#define R_SPARC_TLS_LE_LOX10 73 -#define R_SPARC_TLS_DTPMOD32 74 -#define R_SPARC_TLS_DTPMOD64 75 -#define R_SPARC_TLS_DTPOFF32 76 -#define R_SPARC_TLS_DTPOFF64 77 -#define R_SPARC_TLS_TPOFF32 78 -#define R_SPARC_TLS_TPOFF64 79 -/* Keep this the last entry. */ -#define R_SPARC_NUM 80 - -/* For Sparc64, legal values for d_tag of Elf64_Dyn. */ - -#define DT_SPARC_REGISTER 0x70000001 -#define DT_SPARC_NUM 2 - -/* Bits present in AT_HWCAP, primarily for Sparc32. */ - -#define HWCAP_SPARC_FLUSH 1 /* The cpu supports flush insn. */ -#define HWCAP_SPARC_STBAR 2 -#define HWCAP_SPARC_SWAP 4 -#define HWCAP_SPARC_MULDIV 8 -#define HWCAP_SPARC_V9 16 /* The cpu is v9, so v8plus is ok. */ -#define HWCAP_SPARC_ULTRA3 32 - -/* MIPS R3000 specific definitions. */ - -/* Legal values for e_flags field of Elf32_Ehdr. */ - -#define EF_MIPS_NOREORDER 1 /* A .noreorder directive was used */ -#define EF_MIPS_PIC 2 /* Contains PIC code */ -#define EF_MIPS_CPIC 4 /* Uses PIC calling sequence */ -#define EF_MIPS_XGOT 8 -#define EF_MIPS_64BIT_WHIRL 16 -#define EF_MIPS_ABI2 32 -#define EF_MIPS_ABI_ON32 64 -#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level */ - -/* Legal values for MIPS architecture level. */ - -#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code. */ -#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code. */ -#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code. */ -#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code. */ -#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */ -#define EF_MIPS_ARCH_32 0x60000000 /* MIPS32 code. */ -#define EF_MIPS_ARCH_64 0x70000000 /* MIPS64 code. */ - -/* The following are non-official names and should not be used. */ - -#define E_MIPS_ARCH_1 0x00000000 /* -mips1 code. */ -#define E_MIPS_ARCH_2 0x10000000 /* -mips2 code. */ -#define E_MIPS_ARCH_3 0x20000000 /* -mips3 code. */ -#define E_MIPS_ARCH_4 0x30000000 /* -mips4 code. */ -#define E_MIPS_ARCH_5 0x40000000 /* -mips5 code. */ -#define E_MIPS_ARCH_32 0x60000000 /* MIPS32 code. */ -#define E_MIPS_ARCH_64 0x70000000 /* MIPS64 code. */ - -/* Special section indices. */ - -#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols */ -#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */ -#define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */ -#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */ -#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */ - -/* Legal values for sh_type field of Elf32_Shdr. */ - -#define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link */ -#define SHT_MIPS_MSYM 0x70000001 -#define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols */ -#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes */ -#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */ -#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging information*/ -#define SHT_MIPS_REGINFO 0x70000006 /* Register usage information */ -#define SHT_MIPS_PACKAGE 0x70000007 -#define SHT_MIPS_PACKSYM 0x70000008 -#define SHT_MIPS_RELD 0x70000009 -#define SHT_MIPS_IFACE 0x7000000b -#define SHT_MIPS_CONTENT 0x7000000c -#define SHT_MIPS_OPTIONS 0x7000000d /* Miscellaneous options. */ -#define SHT_MIPS_SHDR 0x70000010 -#define SHT_MIPS_FDESC 0x70000011 -#define SHT_MIPS_EXTSYM 0x70000012 -#define SHT_MIPS_DENSE 0x70000013 -#define SHT_MIPS_PDESC 0x70000014 -#define SHT_MIPS_LOCSYM 0x70000015 -#define SHT_MIPS_AUXSYM 0x70000016 -#define SHT_MIPS_OPTSYM 0x70000017 -#define SHT_MIPS_LOCSTR 0x70000018 -#define SHT_MIPS_LINE 0x70000019 -#define SHT_MIPS_RFDESC 0x7000001a -#define SHT_MIPS_DELTASYM 0x7000001b -#define SHT_MIPS_DELTAINST 0x7000001c -#define SHT_MIPS_DELTACLASS 0x7000001d -#define SHT_MIPS_DWARF 0x7000001e /* DWARF debugging information. */ -#define SHT_MIPS_DELTADECL 0x7000001f -#define SHT_MIPS_SYMBOL_LIB 0x70000020 -#define SHT_MIPS_EVENTS 0x70000021 /* Event section. */ -#define SHT_MIPS_TRANSLATE 0x70000022 -#define SHT_MIPS_PIXIE 0x70000023 -#define SHT_MIPS_XLATE 0x70000024 -#define SHT_MIPS_XLATE_DEBUG 0x70000025 -#define SHT_MIPS_WHIRL 0x70000026 -#define SHT_MIPS_EH_REGION 0x70000027 -#define SHT_MIPS_XLATE_OLD 0x70000028 -#define SHT_MIPS_PDR_EXCEPTION 0x70000029 - -/* Legal values for sh_flags field of Elf32_Shdr. */ - -#define SHF_MIPS_GPREL 0x10000000 /* Must be part of global data area */ -#define SHF_MIPS_MERGE 0x20000000 -#define SHF_MIPS_ADDR 0x40000000 -#define SHF_MIPS_STRINGS 0x80000000 -#define SHF_MIPS_NOSTRIP 0x08000000 -#define SHF_MIPS_LOCAL 0x04000000 -#define SHF_MIPS_NAMES 0x02000000 -#define SHF_MIPS_NODUPE 0x01000000 - - -/* Symbol tables. */ - -/* MIPS specific values for `st_other'. */ -#define STO_MIPS_DEFAULT 0x0 -#define STO_MIPS_INTERNAL 0x1 -#define STO_MIPS_HIDDEN 0x2 -#define STO_MIPS_PROTECTED 0x3 -#define STO_MIPS_SC_ALIGN_UNUSED 0xff - -/* MIPS specific values for `st_info'. */ -#define STB_MIPS_SPLIT_COMMON 13 - -/* Entries found in sections of type SHT_MIPS_GPTAB. */ - -typedef union -{ - struct - { - Elf32_Word gt_current_g_value; /* -G value used for compilation */ - Elf32_Word gt_unused; /* Not used */ - } gt_header; /* First entry in section */ - struct - { - Elf32_Word gt_g_value; /* If this value were used for -G */ - Elf32_Word gt_bytes; /* This many bytes would be used */ - } gt_entry; /* Subsequent entries in section */ -} Elf32_gptab; - -/* Entry found in sections of type SHT_MIPS_REGINFO. */ - -typedef struct -{ - Elf32_Word ri_gprmask; /* General registers used */ - Elf32_Word ri_cprmask[4]; /* Coprocessor registers used */ - Elf32_Sword ri_gp_value; /* $gp register value */ -} Elf32_RegInfo; - -/* Entries found in sections of type SHT_MIPS_OPTIONS. */ - -typedef struct -{ - unsigned char kind; /* Determines interpretation of the - variable part of descriptor. */ - unsigned char size; /* Size of descriptor, including header. */ - Elf32_Section section; /* Section header index of section affected, - 0 for global options. */ - Elf32_Word info; /* Kind-specific information. */ -} Elf_Options; - -/* Values for `kind' field in Elf_Options. */ - -#define ODK_NULL 0 /* Undefined. */ -#define ODK_REGINFO 1 /* Register usage information. */ -#define ODK_EXCEPTIONS 2 /* Exception processing options. */ -#define ODK_PAD 3 /* Section padding options. */ -#define ODK_HWPATCH 4 /* Hardware workarounds performed */ -#define ODK_FILL 5 /* record the fill value used by the linker. */ -#define ODK_TAGS 6 /* reserve space for desktop tools to write. */ -#define ODK_HWAND 7 /* HW workarounds. 'AND' bits when merging. */ -#define ODK_HWOR 8 /* HW workarounds. 'OR' bits when merging. */ - -/* Values for `info' in Elf_Options for ODK_EXCEPTIONS entries. */ - -#define OEX_FPU_MIN 0x1f /* FPE's which MUST be enabled. */ -#define OEX_FPU_MAX 0x1f00 /* FPE's which MAY be enabled. */ -#define OEX_PAGE0 0x10000 /* page zero must be mapped. */ -#define OEX_SMM 0x20000 /* Force sequential memory mode? */ -#define OEX_FPDBUG 0x40000 /* Force floating point debug mode? */ -#define OEX_PRECISEFP OEX_FPDBUG -#define OEX_DISMISS 0x80000 /* Dismiss invalid address faults? */ - -#define OEX_FPU_INVAL 0x10 -#define OEX_FPU_DIV0 0x08 -#define OEX_FPU_OFLO 0x04 -#define OEX_FPU_UFLO 0x02 -#define OEX_FPU_INEX 0x01 - -/* Masks for `info' in Elf_Options for an ODK_HWPATCH entry. */ - -#define OHW_R4KEOP 0x1 /* R4000 end-of-page patch. */ -#define OHW_R8KPFETCH 0x2 /* may need R8000 prefetch patch. */ -#define OHW_R5KEOP 0x4 /* R5000 end-of-page patch. */ -#define OHW_R5KCVTL 0x8 /* R5000 cvt.[ds].l bug. clean=1. */ - -#define OPAD_PREFIX 0x1 -#define OPAD_POSTFIX 0x2 -#define OPAD_SYMBOL 0x4 - -/* Entry found in `.options' section. */ - -typedef struct -{ - Elf32_Word hwp_flags1; /* Extra flags. */ - Elf32_Word hwp_flags2; /* Extra flags. */ -} Elf_Options_Hw; - -/* Masks for `info' in ElfOptions for ODK_HWAND and ODK_HWOR entries. */ - -#define OHWA0_R4KEOP_CHECKED 0x00000001 -#define OHWA1_R4KEOP_CLEAN 0x00000002 - -/* MIPS relocs. */ - -#define R_MIPS_NONE 0 /* No reloc */ -#define R_MIPS_16 1 /* Direct 16 bit */ -#define R_MIPS_32 2 /* Direct 32 bit */ -#define R_MIPS_REL32 3 /* PC relative 32 bit */ -#define R_MIPS_26 4 /* Direct 26 bit shifted */ -#define R_MIPS_HI16 5 /* High 16 bit */ -#define R_MIPS_LO16 6 /* Low 16 bit */ -#define R_MIPS_GPREL16 7 /* GP relative 16 bit */ -#define R_MIPS_LITERAL 8 /* 16 bit literal entry */ -#define R_MIPS_GOT16 9 /* 16 bit GOT entry */ -#define R_MIPS_PC16 10 /* PC relative 16 bit */ -#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */ -#define R_MIPS_GPREL32 12 /* GP relative 32 bit */ - -#define R_MIPS_SHIFT5 16 -#define R_MIPS_SHIFT6 17 -#define R_MIPS_64 18 -#define R_MIPS_GOT_DISP 19 -#define R_MIPS_GOT_PAGE 20 -#define R_MIPS_GOT_OFST 21 -#define R_MIPS_GOT_HI16 22 -#define R_MIPS_GOT_LO16 23 -#define R_MIPS_SUB 24 -#define R_MIPS_INSERT_A 25 -#define R_MIPS_INSERT_B 26 -#define R_MIPS_DELETE 27 -#define R_MIPS_HIGHER 28 -#define R_MIPS_HIGHEST 29 -#define R_MIPS_CALL_HI16 30 -#define R_MIPS_CALL_LO16 31 -#define R_MIPS_SCN_DISP 32 -#define R_MIPS_REL16 33 -#define R_MIPS_ADD_IMMEDIATE 34 -#define R_MIPS_PJUMP 35 -#define R_MIPS_RELGOT 36 -#define R_MIPS_JALR 37 -/* Keep this the last entry. */ -#define R_MIPS_NUM 38 - -/* Legal values for p_type field of Elf32_Phdr. */ - -#define PT_MIPS_REGINFO 0x70000000 /* Register usage information */ -#define PT_MIPS_RTPROC 0x70000001 /* Runtime procedure table. */ -#define PT_MIPS_OPTIONS 0x70000002 - -/* Special program header types. */ - -#define PF_MIPS_LOCAL 0x10000000 - -/* Legal values for d_tag field of Elf32_Dyn. */ - -#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime linker interface version */ -#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */ -#define DT_MIPS_ICHECKSUM 0x70000003 /* Checksum */ -#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */ -#define DT_MIPS_FLAGS 0x70000005 /* Flags */ -#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Base address */ -#define DT_MIPS_MSYM 0x70000007 -#define DT_MIPS_CONFLICT 0x70000008 /* Address of CONFLICT section */ -#define DT_MIPS_LIBLIST 0x70000009 /* Address of LIBLIST section */ -#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local GOT entries */ -#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of CONFLICT entries */ -#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of LIBLIST entries */ -#define DT_MIPS_SYMTABNO 0x70000011 /* Number of DYNSYM entries */ -#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */ -#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in DYNSYM */ -#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */ -#define DT_MIPS_RLD_MAP 0x70000016 /* Address of run time loader map. */ -#define DT_MIPS_DELTA_CLASS 0x70000017 /* Delta C++ class definition. */ -#define DT_MIPS_DELTA_CLASS_NO 0x70000018 /* Number of entries in - DT_MIPS_DELTA_CLASS. */ -#define DT_MIPS_DELTA_INSTANCE 0x70000019 /* Delta C++ class instances. */ -#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a /* Number of entries in - DT_MIPS_DELTA_INSTANCE. */ -#define DT_MIPS_DELTA_RELOC 0x7000001b /* Delta relocations. */ -#define DT_MIPS_DELTA_RELOC_NO 0x7000001c /* Number of entries in - DT_MIPS_DELTA_RELOC. */ -#define DT_MIPS_DELTA_SYM 0x7000001d /* Delta symbols that Delta - relocations refer to. */ -#define DT_MIPS_DELTA_SYM_NO 0x7000001e /* Number of entries in - DT_MIPS_DELTA_SYM. */ -#define DT_MIPS_DELTA_CLASSSYM 0x70000020 /* Delta symbols that hold the - class declaration. */ -#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 /* Number of entries in - DT_MIPS_DELTA_CLASSSYM. */ -#define DT_MIPS_CXX_FLAGS 0x70000022 /* Flags indicating for C++ flavor. */ -#define DT_MIPS_PIXIE_INIT 0x70000023 -#define DT_MIPS_SYMBOL_LIB 0x70000024 -#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025 -#define DT_MIPS_LOCAL_GOTIDX 0x70000026 -#define DT_MIPS_HIDDEN_GOTIDX 0x70000027 -#define DT_MIPS_PROTECTED_GOTIDX 0x70000028 -#define DT_MIPS_OPTIONS 0x70000029 /* Address of .options. */ -#define DT_MIPS_INTERFACE 0x7000002a /* Address of .interface. */ -#define DT_MIPS_DYNSTR_ALIGN 0x7000002b -#define DT_MIPS_INTERFACE_SIZE 0x7000002c /* Size of the .interface section. */ -#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d /* Address of rld_text_rsolve - function stored in GOT. */ -#define DT_MIPS_PERF_SUFFIX 0x7000002e /* Default suffix of dso to be added - by rld on dlopen() calls. */ -#define DT_MIPS_COMPACT_SIZE 0x7000002f /* (O32)Size of compact rel section. */ -#define DT_MIPS_GP_VALUE 0x70000030 /* GP value for aux GOTs. */ -#define DT_MIPS_AUX_DYNAMIC 0x70000031 /* Address of aux .dynamic. */ -#define DT_MIPS_NUM 0x32 - -/* Legal values for DT_MIPS_FLAGS Elf32_Dyn entry. */ - -#define RHF_NONE 0 /* No flags */ -#define RHF_QUICKSTART (1 << 0) /* Use quickstart */ -#define RHF_NOTPOT (1 << 1) /* Hash size not power of 2 */ -#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2) /* Ignore LD_LIBRARY_PATH */ -#define RHF_NO_MOVE (1 << 3) -#define RHF_SGI_ONLY (1 << 4) -#define RHF_GUARANTEE_INIT (1 << 5) -#define RHF_DELTA_C_PLUS_PLUS (1 << 6) -#define RHF_GUARANTEE_START_INIT (1 << 7) -#define RHF_PIXIE (1 << 8) -#define RHF_DEFAULT_DELAY_LOAD (1 << 9) -#define RHF_REQUICKSTART (1 << 10) -#define RHF_REQUICKSTARTED (1 << 11) -#define RHF_CORD (1 << 12) -#define RHF_NO_UNRES_UNDEF (1 << 13) -#define RHF_RLD_ORDER_SAFE (1 << 14) - -/* Entries found in sections of type SHT_MIPS_LIBLIST. */ - -typedef struct -{ - Elf32_Word l_name; /* Name (string table index) */ - Elf32_Word l_time_stamp; /* Timestamp */ - Elf32_Word l_checksum; /* Checksum */ - Elf32_Word l_version; /* Interface version */ - Elf32_Word l_flags; /* Flags */ -} Elf32_Lib; - -typedef struct -{ - Elf64_Word l_name; /* Name (string table index) */ - Elf64_Word l_time_stamp; /* Timestamp */ - Elf64_Word l_checksum; /* Checksum */ - Elf64_Word l_version; /* Interface version */ - Elf64_Word l_flags; /* Flags */ -} Elf64_Lib; - - -/* Legal values for l_flags. */ - -#define LL_NONE 0 -#define LL_EXACT_MATCH (1 << 0) /* Require exact match */ -#define LL_IGNORE_INT_VER (1 << 1) /* Ignore interface version */ -#define LL_REQUIRE_MINOR (1 << 2) -#define LL_EXPORTS (1 << 3) -#define LL_DELAY_LOAD (1 << 4) -#define LL_DELTA (1 << 5) - -/* Entries found in sections of type SHT_MIPS_CONFLICT. */ - -typedef Elf32_Addr Elf32_Conflict; - - -/* HPPA specific definitions. */ - -/* Legal values for e_flags field of Elf32_Ehdr. */ - -#define EF_PARISC_TRAPNIL 0x00010000 /* Trap nil pointer dereference. */ -#define EF_PARISC_EXT 0x00020000 /* Program uses arch. extensions. */ -#define EF_PARISC_LSB 0x00040000 /* Program expects little endian. */ -#define EF_PARISC_WIDE 0x00080000 /* Program expects wide mode. */ -#define EF_PARISC_NO_KABP 0x00100000 /* No kernel assisted branch - prediction. */ -#define EF_PARISC_LAZYSWAP 0x00400000 /* Allow lazy swapping. */ -#define EF_PARISC_ARCH 0x0000ffff /* Architecture version. */ - -/* Defined values for `e_flags & EF_PARISC_ARCH' are: */ - -#define EFA_PARISC_1_0 0x020b /* PA-RISC 1.0 big-endian. */ -#define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */ -#define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */ - -/* Additional section indeces. */ - -#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared - symbols in ANSI C. */ -#define SHN_PARISC_HUGE_COMMON 0xff01 /* Common blocks in huge model. */ - -/* Legal values for sh_type field of Elf32_Shdr. */ - -#define SHT_PARISC_EXT 0x70000000 /* Contains product specific ext. */ -#define SHT_PARISC_UNWIND 0x70000001 /* Unwind information. */ -#define SHT_PARISC_DOC 0x70000002 /* Debug info for optimized code. */ - -/* Legal values for sh_flags field of Elf32_Shdr. */ - -#define SHF_PARISC_SHORT 0x20000000 /* Section with short addressing. */ -#define SHF_PARISC_HUGE 0x40000000 /* Section far from gp. */ -#define SHF_PARISC_SBP 0x80000000 /* Static branch prediction code. */ - -/* Legal values for ST_TYPE subfield of st_info (symbol type). */ - -#define STT_PARISC_MILLICODE 13 /* Millicode function entry point. */ - -#define STT_HP_OPAQUE (STT_LOOS + 0x1) -#define STT_HP_STUB (STT_LOOS + 0x2) - -/* HPPA relocs. */ - -#define R_PARISC_NONE 0 /* No reloc. */ -#define R_PARISC_DIR32 1 /* Direct 32-bit reference. */ -#define R_PARISC_DIR21L 2 /* Left 21 bits of eff. address. */ -#define R_PARISC_DIR17R 3 /* Right 17 bits of eff. address. */ -#define R_PARISC_DIR17F 4 /* 17 bits of eff. address. */ -#define R_PARISC_DIR14R 6 /* Right 14 bits of eff. address. */ -#define R_PARISC_PCREL32 9 /* 32-bit rel. address. */ -#define R_PARISC_PCREL21L 10 /* Left 21 bits of rel. address. */ -#define R_PARISC_PCREL17R 11 /* Right 17 bits of rel. address. */ -#define R_PARISC_PCREL17F 12 /* 17 bits of rel. address. */ -#define R_PARISC_PCREL14R 14 /* Right 14 bits of rel. address. */ -#define R_PARISC_DPREL21L 18 /* Left 21 bits of rel. address. */ -#define R_PARISC_DPREL14R 22 /* Right 14 bits of rel. address. */ -#define R_PARISC_GPREL21L 26 /* GP-relative, left 21 bits. */ -#define R_PARISC_GPREL14R 30 /* GP-relative, right 14 bits. */ -#define R_PARISC_LTOFF21L 34 /* LT-relative, left 21 bits. */ -#define R_PARISC_LTOFF14R 38 /* LT-relative, right 14 bits. */ -#define R_PARISC_SECREL32 41 /* 32 bits section rel. address. */ -#define R_PARISC_SEGBASE 48 /* No relocation, set segment base. */ -#define R_PARISC_SEGREL32 49 /* 32 bits segment rel. address. */ -#define R_PARISC_PLTOFF21L 50 /* PLT rel. address, left 21 bits. */ -#define R_PARISC_PLTOFF14R 54 /* PLT rel. address, right 14 bits. */ -#define R_PARISC_LTOFF_FPTR32 57 /* 32 bits LT-rel. function pointer. */ -#define R_PARISC_LTOFF_FPTR21L 58 /* LT-rel. fct ptr, left 21 bits. */ -#define R_PARISC_LTOFF_FPTR14R 62 /* LT-rel. fct ptr, right 14 bits. */ -#define R_PARISC_FPTR64 64 /* 64 bits function address. */ -#define R_PARISC_PLABEL32 65 /* 32 bits function address. */ -#define R_PARISC_PCREL64 72 /* 64 bits PC-rel. address. */ -#define R_PARISC_PCREL22F 74 /* 22 bits PC-rel. address. */ -#define R_PARISC_PCREL14WR 75 /* PC-rel. address, right 14 bits. */ -#define R_PARISC_PCREL14DR 76 /* PC rel. address, right 14 bits. */ -#define R_PARISC_PCREL16F 77 /* 16 bits PC-rel. address. */ -#define R_PARISC_PCREL16WF 78 /* 16 bits PC-rel. address. */ -#define R_PARISC_PCREL16DF 79 /* 16 bits PC-rel. address. */ -#define R_PARISC_DIR64 80 /* 64 bits of eff. address. */ -#define R_PARISC_DIR14WR 83 /* 14 bits of eff. address. */ -#define R_PARISC_DIR14DR 84 /* 14 bits of eff. address. */ -#define R_PARISC_DIR16F 85 /* 16 bits of eff. address. */ -#define R_PARISC_DIR16WF 86 /* 16 bits of eff. address. */ -#define R_PARISC_DIR16DF 87 /* 16 bits of eff. address. */ -#define R_PARISC_GPREL64 88 /* 64 bits of GP-rel. address. */ -#define R_PARISC_GPREL14WR 91 /* GP-rel. address, right 14 bits. */ -#define R_PARISC_GPREL14DR 92 /* GP-rel. address, right 14 bits. */ -#define R_PARISC_GPREL16F 93 /* 16 bits GP-rel. address. */ -#define R_PARISC_GPREL16WF 94 /* 16 bits GP-rel. address. */ -#define R_PARISC_GPREL16DF 95 /* 16 bits GP-rel. address. */ -#define R_PARISC_LTOFF64 96 /* 64 bits LT-rel. address. */ -#define R_PARISC_LTOFF14WR 99 /* LT-rel. address, right 14 bits. */ -#define R_PARISC_LTOFF14DR 100 /* LT-rel. address, right 14 bits. */ -#define R_PARISC_LTOFF16F 101 /* 16 bits LT-rel. address. */ -#define R_PARISC_LTOFF16WF 102 /* 16 bits LT-rel. address. */ -#define R_PARISC_LTOFF16DF 103 /* 16 bits LT-rel. address. */ -#define R_PARISC_SECREL64 104 /* 64 bits section rel. address. */ -#define R_PARISC_SEGREL64 112 /* 64 bits segment rel. address. */ -#define R_PARISC_PLTOFF14WR 115 /* PLT-rel. address, right 14 bits. */ -#define R_PARISC_PLTOFF14DR 116 /* PLT-rel. address, right 14 bits. */ -#define R_PARISC_PLTOFF16F 117 /* 16 bits LT-rel. address. */ -#define R_PARISC_PLTOFF16WF 118 /* 16 bits PLT-rel. address. */ -#define R_PARISC_PLTOFF16DF 119 /* 16 bits PLT-rel. address. */ -#define R_PARISC_LTOFF_FPTR64 120 /* 64 bits LT-rel. function ptr. */ -#define R_PARISC_LTOFF_FPTR14WR 123 /* LT-rel. fct. ptr., right 14 bits. */ -#define R_PARISC_LTOFF_FPTR14DR 124 /* LT-rel. fct. ptr., right 14 bits. */ -#define R_PARISC_LTOFF_FPTR16F 125 /* 16 bits LT-rel. function ptr. */ -#define R_PARISC_LTOFF_FPTR16WF 126 /* 16 bits LT-rel. function ptr. */ -#define R_PARISC_LTOFF_FPTR16DF 127 /* 16 bits LT-rel. function ptr. */ -#define R_PARISC_LORESERVE 128 -#define R_PARISC_COPY 128 /* Copy relocation. */ -#define R_PARISC_IPLT 129 /* Dynamic reloc, imported PLT */ -#define R_PARISC_EPLT 130 /* Dynamic reloc, exported PLT */ -#define R_PARISC_TPREL32 153 /* 32 bits TP-rel. address. */ -#define R_PARISC_TPREL21L 154 /* TP-rel. address, left 21 bits. */ -#define R_PARISC_TPREL14R 158 /* TP-rel. address, right 14 bits. */ -#define R_PARISC_LTOFF_TP21L 162 /* LT-TP-rel. address, left 21 bits. */ -#define R_PARISC_LTOFF_TP14R 166 /* LT-TP-rel. address, right 14 bits.*/ -#define R_PARISC_LTOFF_TP14F 167 /* 14 bits LT-TP-rel. address. */ -#define R_PARISC_TPREL64 216 /* 64 bits TP-rel. address. */ -#define R_PARISC_TPREL14WR 219 /* TP-rel. address, right 14 bits. */ -#define R_PARISC_TPREL14DR 220 /* TP-rel. address, right 14 bits. */ -#define R_PARISC_TPREL16F 221 /* 16 bits TP-rel. address. */ -#define R_PARISC_TPREL16WF 222 /* 16 bits TP-rel. address. */ -#define R_PARISC_TPREL16DF 223 /* 16 bits TP-rel. address. */ -#define R_PARISC_LTOFF_TP64 224 /* 64 bits LT-TP-rel. address. */ -#define R_PARISC_LTOFF_TP14WR 227 /* LT-TP-rel. address, right 14 bits.*/ -#define R_PARISC_LTOFF_TP14DR 228 /* LT-TP-rel. address, right 14 bits.*/ -#define R_PARISC_LTOFF_TP16F 229 /* 16 bits LT-TP-rel. address. */ -#define R_PARISC_LTOFF_TP16WF 230 /* 16 bits LT-TP-rel. address. */ -#define R_PARISC_LTOFF_TP16DF 231 /* 16 bits LT-TP-rel. address. */ -#define R_PARISC_HIRESERVE 255 - -/* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */ - -#define PT_HP_TLS (PT_LOOS + 0x0) -#define PT_HP_CORE_NONE (PT_LOOS + 0x1) -#define PT_HP_CORE_VERSION (PT_LOOS + 0x2) -#define PT_HP_CORE_KERNEL (PT_LOOS + 0x3) -#define PT_HP_CORE_COMM (PT_LOOS + 0x4) -#define PT_HP_CORE_PROC (PT_LOOS + 0x5) -#define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6) -#define PT_HP_CORE_STACK (PT_LOOS + 0x7) -#define PT_HP_CORE_SHM (PT_LOOS + 0x8) -#define PT_HP_CORE_MMF (PT_LOOS + 0x9) -#define PT_HP_PARALLEL (PT_LOOS + 0x10) -#define PT_HP_FASTBIND (PT_LOOS + 0x11) -#define PT_HP_OPT_ANNOT (PT_LOOS + 0x12) -#define PT_HP_HSL_ANNOT (PT_LOOS + 0x13) -#define PT_HP_STACK (PT_LOOS + 0x14) - -#define PT_PARISC_ARCHEXT 0x70000000 -#define PT_PARISC_UNWIND 0x70000001 - -/* Legal values for p_flags field of Elf32_Phdr/Elf64_Phdr. */ - -#define PF_PARISC_SBP 0x08000000 - -#define PF_HP_PAGE_SIZE 0x00100000 -#define PF_HP_FAR_SHARED 0x00200000 -#define PF_HP_NEAR_SHARED 0x00400000 -#define PF_HP_CODE 0x01000000 -#define PF_HP_MODIFY 0x02000000 -#define PF_HP_LAZYSWAP 0x04000000 -#define PF_HP_SBP 0x08000000 - - -/* Alpha specific definitions. */ - -/* Legal values for e_flags field of Elf64_Ehdr. */ - -#define EF_ALPHA_32BIT 1 /* All addresses must be < 2GB. */ -#define EF_ALPHA_CANRELAX 2 /* Relocations for relaxing exist. */ - -/* Legal values for sh_type field of Elf64_Shdr. */ - -/* These two are primerily concerned with ECOFF debugging info. */ -#define SHT_ALPHA_DEBUG 0x70000001 -#define SHT_ALPHA_REGINFO 0x70000002 - -/* Legal values for sh_flags field of Elf64_Shdr. */ - -#define SHF_ALPHA_GPREL 0x10000000 - -/* Legal values for st_other field of Elf64_Sym. */ -#define STO_ALPHA_NOPV 0x80 /* No PV required. */ -#define STO_ALPHA_STD_GPLOAD 0x88 /* PV only used for initial ldgp. */ - -/* Alpha relocs. */ - -#define R_ALPHA_NONE 0 /* No reloc */ -#define R_ALPHA_REFLONG 1 /* Direct 32 bit */ -#define R_ALPHA_REFQUAD 2 /* Direct 64 bit */ -#define R_ALPHA_GPREL32 3 /* GP relative 32 bit */ -#define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */ -#define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */ -#define R_ALPHA_GPDISP 6 /* Add displacement to GP */ -#define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */ -#define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */ -#define R_ALPHA_SREL16 9 /* PC relative 16 bit */ -#define R_ALPHA_SREL32 10 /* PC relative 32 bit */ -#define R_ALPHA_SREL64 11 /* PC relative 64 bit */ -#define R_ALPHA_GPRELHIGH 17 /* GP relative 32 bit, high 16 bits */ -#define R_ALPHA_GPRELLOW 18 /* GP relative 32 bit, low 16 bits */ -#define R_ALPHA_GPREL16 19 /* GP relative 16 bit */ -#define R_ALPHA_COPY 24 /* Copy symbol at runtime */ -#define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */ -#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */ -#define R_ALPHA_RELATIVE 27 /* Adjust by program base */ -#define R_ALPHA_TLS_GD_HI 28 -#define R_ALPHA_TLSGD 29 -#define R_ALPHA_TLS_LDM 30 -#define R_ALPHA_DTPMOD64 31 -#define R_ALPHA_GOTDTPREL 32 -#define R_ALPHA_DTPREL64 33 -#define R_ALPHA_DTPRELHI 34 -#define R_ALPHA_DTPRELLO 35 -#define R_ALPHA_DTPREL16 36 -#define R_ALPHA_GOTTPREL 37 -#define R_ALPHA_TPREL64 38 -#define R_ALPHA_TPRELHI 39 -#define R_ALPHA_TPRELLO 40 -#define R_ALPHA_TPREL16 41 -/* Keep this the last entry. */ -#define R_ALPHA_NUM 46 - -/* Magic values of the LITUSE relocation addend. */ -#define LITUSE_ALPHA_ADDR 0 -#define LITUSE_ALPHA_BASE 1 -#define LITUSE_ALPHA_BYTOFF 2 -#define LITUSE_ALPHA_JSR 3 -#define LITUSE_ALPHA_TLS_GD 4 -#define LITUSE_ALPHA_TLS_LDM 5 - - -/* PowerPC specific declarations */ - -/* Values for Elf32/64_Ehdr.e_flags. */ -#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */ - -/* Cygnus local bits below */ -#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/ -#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib - flag */ - -/* PowerPC relocations defined by the ABIs */ -#define R_PPC_NONE 0 -#define R_PPC_ADDR32 1 /* 32bit absolute address */ -#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */ -#define R_PPC_ADDR16 3 /* 16bit absolute address */ -#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */ -#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */ -#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */ -#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */ -#define R_PPC_ADDR14_BRTAKEN 8 -#define R_PPC_ADDR14_BRNTAKEN 9 -#define R_PPC_REL24 10 /* PC relative 26 bit */ -#define R_PPC_REL14 11 /* PC relative 16 bit */ -#define R_PPC_REL14_BRTAKEN 12 -#define R_PPC_REL14_BRNTAKEN 13 -#define R_PPC_GOT16 14 -#define R_PPC_GOT16_LO 15 -#define R_PPC_GOT16_HI 16 -#define R_PPC_GOT16_HA 17 -#define R_PPC_PLTREL24 18 -#define R_PPC_COPY 19 -#define R_PPC_GLOB_DAT 20 -#define R_PPC_JMP_SLOT 21 -#define R_PPC_RELATIVE 22 -#define R_PPC_LOCAL24PC 23 -#define R_PPC_UADDR32 24 -#define R_PPC_UADDR16 25 -#define R_PPC_REL32 26 -#define R_PPC_PLT32 27 -#define R_PPC_PLTREL32 28 -#define R_PPC_PLT16_LO 29 -#define R_PPC_PLT16_HI 30 -#define R_PPC_PLT16_HA 31 -#define R_PPC_SDAREL16 32 -#define R_PPC_SECTOFF 33 -#define R_PPC_SECTOFF_LO 34 -#define R_PPC_SECTOFF_HI 35 -#define R_PPC_SECTOFF_HA 36 -/* Keep this the last entry. */ -#define R_PPC_NUM 37 - -/* PowerPC64 relocations defined by the ABIs */ -#define R_PPC64_NONE R_PPC_NONE -#define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address. */ -#define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned. */ -#define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address. */ -#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of abs. address. */ -#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of abs. address. */ -#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */ -#define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned. */ -#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN -#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN -#define R_PPC64_REL24 R_PPC_REL24 /* PC relative 26 bit, word aligned. */ -#define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit. */ -#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN -#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN -#define R_PPC64_GOT16 R_PPC_GOT16 -#define R_PPC64_GOT16_LO R_PPC_GOT16_LO -#define R_PPC64_GOT16_HI R_PPC_GOT16_HI -#define R_PPC64_GOT16_HA R_PPC_GOT16_HA - -#define R_PPC64_COPY R_PPC_COPY -#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT -#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT -#define R_PPC64_RELATIVE R_PPC_RELATIVE - -#define R_PPC64_UADDR32 R_PPC_UADDR32 -#define R_PPC64_UADDR16 R_PPC_UADDR16 -#define R_PPC64_REL32 R_PPC_REL32 -#define R_PPC64_PLT32 R_PPC_PLT32 -#define R_PPC64_PLTREL32 R_PPC_PLTREL32 -#define R_PPC64_PLT16_LO R_PPC_PLT16_LO -#define R_PPC64_PLT16_HI R_PPC_PLT16_HI -#define R_PPC64_PLT16_HA R_PPC_PLT16_HA - -#define R_PPC64_SECTOFF R_PPC_SECTOFF -#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO -#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI -#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA -#define R_PPC64_ADDR30 37 /* word30 (S + A - P) >> 2. */ -#define R_PPC64_ADDR64 38 /* doubleword64 S + A. */ -#define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A). */ -#define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A). */ -#define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A). */ -#define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A). */ -#define R_PPC64_UADDR64 43 /* doubleword64 S + A. */ -#define R_PPC64_REL64 44 /* doubleword64 S + A - P. */ -#define R_PPC64_PLT64 45 /* doubleword64 L + A. */ -#define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P. */ -#define R_PPC64_TOC16 47 /* half16* S + A - .TOC. */ -#define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.). */ -#define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.). */ -#define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.). */ -#define R_PPC64_TOC 51 /* doubleword64 .TOC. */ -#define R_PPC64_PLTGOT16 52 /* half16* M + A. */ -#define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A). */ -#define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A). */ -#define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A). */ - -#define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) >> 2. */ -#define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) >> 2. */ -#define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) >> 2. */ -#define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) >> 2. */ -#define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) >> 2. */ -#define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) >> 2. */ -#define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) >> 2. */ -#define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) >> 2. */ -#define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) >> 2. */ -#define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) >> 2. */ -#define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) >> 2. */ -/* Keep this the last entry. */ -#define R_PPC64_NUM 67 - -/* The remaining relocs are from the Embedded ELF ABI, and are not - in the SVR4 ELF ABI. */ -#define R_PPC_EMB_NADDR32 101 -#define R_PPC_EMB_NADDR16 102 -#define R_PPC_EMB_NADDR16_LO 103 -#define R_PPC_EMB_NADDR16_HI 104 -#define R_PPC_EMB_NADDR16_HA 105 -#define R_PPC_EMB_SDAI16 106 -#define R_PPC_EMB_SDA2I16 107 -#define R_PPC_EMB_SDA2REL 108 -#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */ -#define R_PPC_EMB_MRKREF 110 -#define R_PPC_EMB_RELSEC16 111 -#define R_PPC_EMB_RELST_LO 112 -#define R_PPC_EMB_RELST_HI 113 -#define R_PPC_EMB_RELST_HA 114 -#define R_PPC_EMB_BIT_FLD 115 -#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */ - -/* Diab tool relocations. */ -#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */ -#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */ -#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */ -#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */ -#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */ -#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */ - -/* This is a phony reloc to handle any old fashioned TOC16 references - that may still be in object files. */ -#define R_PPC_TOC16 255 - -/* PowerPC64 specific values for the Dyn d_tag field. */ -#define DT_PPC64_GLINK (DT_LOPROC + 0) -#define DT_PPC64_NUM 1 - -/* ARM specific declarations */ - -/* Processor specific flags for the ELF header e_flags field. */ -#define EF_ARM_RELEXEC 0x01 -#define EF_ARM_HASENTRY 0x02 -#define EF_ARM_INTERWORK 0x04 -#define EF_ARM_APCS_26 0x08 -#define EF_ARM_APCS_FLOAT 0x10 -#define EF_ARM_PIC 0x20 -#define EF_ARM_ALIGN8 0x40 /* 8-bit structure alignment is in use */ -#define EF_ARM_NEW_ABI 0x80 -#define EF_ARM_OLD_ABI 0x100 - -/* Other constants defined in the ARM ELF spec. version B-01. */ -/* NB. These conflict with values defined above. */ -#define EF_ARM_SYMSARESORTED 0x04 -#define EF_ARM_DYNSYMSUSESEGIDX 0x08 -#define EF_ARM_MAPSYMSFIRST 0x10 -#define EF_ARM_EABIMASK 0XFF000000 - -#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK) -#define EF_ARM_EABI_UNKNOWN 0x00000000 -#define EF_ARM_EABI_VER1 0x01000000 -#define EF_ARM_EABI_VER2 0x02000000 - -/* Additional symbol types for Thumb */ -#define STT_ARM_TFUNC 0xd - -/* ARM-specific values for sh_flags */ -#define SHF_ARM_ENTRYSECT 0x10000000 /* Section contains an entry point */ -#define SHF_ARM_COMDEF 0x80000000 /* Section may be multiply defined - in the input to a link step */ - -/* ARM-specific program header flags */ -#define PF_ARM_SB 0x10000000 /* Segment contains the location - addressed by the static base */ - -/* ARM relocs. */ -#define R_ARM_NONE 0 /* No reloc */ -#define R_ARM_PC24 1 /* PC relative 26 bit branch */ -#define R_ARM_ABS32 2 /* Direct 32 bit */ -#define R_ARM_REL32 3 /* PC relative 32 bit */ -#define R_ARM_PC13 4 -#define R_ARM_ABS16 5 /* Direct 16 bit */ -#define R_ARM_ABS12 6 /* Direct 12 bit */ -#define R_ARM_THM_ABS5 7 -#define R_ARM_ABS8 8 /* Direct 8 bit */ -#define R_ARM_SBREL32 9 -#define R_ARM_THM_PC22 10 -#define R_ARM_THM_PC8 11 -#define R_ARM_AMP_VCALL9 12 -#define R_ARM_SWI24 13 -#define R_ARM_THM_SWI8 14 -#define R_ARM_XPC25 15 -#define R_ARM_THM_XPC22 16 -#define R_ARM_COPY 20 /* Copy symbol at runtime */ -#define R_ARM_GLOB_DAT 21 /* Create GOT entry */ -#define R_ARM_JUMP_SLOT 22 /* Create PLT entry */ -#define R_ARM_RELATIVE 23 /* Adjust by program base */ -#define R_ARM_GOTOFF 24 /* 32 bit offset to GOT */ -#define R_ARM_GOTPC 25 /* 32 bit PC relative offset to GOT */ -#define R_ARM_GOT32 26 /* 32 bit GOT entry */ -#define R_ARM_PLT32 27 /* 32 bit PLT address */ -#define R_ARM_ALU_PCREL_7_0 32 -#define R_ARM_ALU_PCREL_15_8 33 -#define R_ARM_ALU_PCREL_23_15 34 -#define R_ARM_LDR_SBREL_11_0 35 -#define R_ARM_ALU_SBREL_19_12 36 -#define R_ARM_ALU_SBREL_27_20 37 -#define R_ARM_GNU_VTENTRY 100 -#define R_ARM_GNU_VTINHERIT 101 -#define R_ARM_THM_PC11 102 /* thumb unconditional branch */ -#define R_ARM_THM_PC9 103 /* thumb conditional branch */ -#define R_ARM_RXPC25 249 -#define R_ARM_RSBREL32 250 -#define R_ARM_THM_RPC22 251 -#define R_ARM_RREL32 252 -#define R_ARM_RABS22 253 -#define R_ARM_RPC24 254 -#define R_ARM_RBASE 255 -/* Keep this the last entry. */ -#define R_ARM_NUM 256 - -/* IA-64 specific declarations. */ - -/* Processor specific flags for the Ehdr e_flags field. */ -#define EF_IA_64_MASKOS 0x0000000f /* os-specific flags */ -#define EF_IA_64_ABI64 0x00000010 /* 64-bit ABI */ -#define EF_IA_64_ARCH 0xff000000 /* arch. version mask */ - -/* Processor specific values for the Phdr p_type field. */ -#define PT_IA_64_ARCHEXT (PT_LOPROC + 0) /* arch extension bits */ -#define PT_IA_64_UNWIND (PT_LOPROC + 1) /* ia64 unwind bits */ - -/* Processor specific flags for the Phdr p_flags field. */ -#define PF_IA_64_NORECOV 0x80000000 /* spec insns w/o recovery */ - -/* Processor specific values for the Shdr sh_type field. */ -#define SHT_IA_64_EXT (SHT_LOPROC + 0) /* extension bits */ -#define SHT_IA_64_UNWIND (SHT_LOPROC + 1) /* unwind bits */ - -/* Processor specific flags for the Shdr sh_flags field. */ -#define SHF_IA_64_SHORT 0x10000000 /* section near gp */ -#define SHF_IA_64_NORECOV 0x20000000 /* spec insns w/o recovery */ - -/* Processor specific values for the Dyn d_tag field. */ -#define DT_IA_64_PLT_RESERVE (DT_LOPROC + 0) -#define DT_IA_64_NUM 1 - -/* IA-64 relocations. */ -#define R_IA64_NONE 0x00 /* none */ -#define R_IA64_IMM14 0x21 /* symbol + addend, add imm14 */ -#define R_IA64_IMM22 0x22 /* symbol + addend, add imm22 */ -#define R_IA64_IMM64 0x23 /* symbol + addend, mov imm64 */ -#define R_IA64_DIR32MSB 0x24 /* symbol + addend, data4 MSB */ -#define R_IA64_DIR32LSB 0x25 /* symbol + addend, data4 LSB */ -#define R_IA64_DIR64MSB 0x26 /* symbol + addend, data8 MSB */ -#define R_IA64_DIR64LSB 0x27 /* symbol + addend, data8 LSB */ -#define R_IA64_GPREL22 0x2a /* @gprel(sym + add), add imm22 */ -#define R_IA64_GPREL64I 0x2b /* @gprel(sym + add), mov imm64 */ -#define R_IA64_GPREL32MSB 0x2c /* @gprel(sym + add), data4 MSB */ -#define R_IA64_GPREL32LSB 0x2d /* @gprel(sym + add), data4 LSB */ -#define R_IA64_GPREL64MSB 0x2e /* @gprel(sym + add), data8 MSB */ -#define R_IA64_GPREL64LSB 0x2f /* @gprel(sym + add), data8 LSB */ -#define R_IA64_LTOFF22 0x32 /* @ltoff(sym + add), add imm22 */ -#define R_IA64_LTOFF64I 0x33 /* @ltoff(sym + add), mov imm64 */ -#define R_IA64_PLTOFF22 0x3a /* @pltoff(sym + add), add imm22 */ -#define R_IA64_PLTOFF64I 0x3b /* @pltoff(sym + add), mov imm64 */ -#define R_IA64_PLTOFF64MSB 0x3e /* @pltoff(sym + add), data8 MSB */ -#define R_IA64_PLTOFF64LSB 0x3f /* @pltoff(sym + add), data8 LSB */ -#define R_IA64_FPTR64I 0x43 /* @fptr(sym + add), mov imm64 */ -#define R_IA64_FPTR32MSB 0x44 /* @fptr(sym + add), data4 MSB */ -#define R_IA64_FPTR32LSB 0x45 /* @fptr(sym + add), data4 LSB */ -#define R_IA64_FPTR64MSB 0x46 /* @fptr(sym + add), data8 MSB */ -#define R_IA64_FPTR64LSB 0x47 /* @fptr(sym + add), data8 LSB */ -#define R_IA64_PCREL60B 0x48 /* @pcrel(sym + add), brl */ -#define R_IA64_PCREL21B 0x49 /* @pcrel(sym + add), ptb, call */ -#define R_IA64_PCREL21M 0x4a /* @pcrel(sym + add), chk.s */ -#define R_IA64_PCREL21F 0x4b /* @pcrel(sym + add), fchkf */ -#define R_IA64_PCREL32MSB 0x4c /* @pcrel(sym + add), data4 MSB */ -#define R_IA64_PCREL32LSB 0x4d /* @pcrel(sym + add), data4 LSB */ -#define R_IA64_PCREL64MSB 0x4e /* @pcrel(sym + add), data8 MSB */ -#define R_IA64_PCREL64LSB 0x4f /* @pcrel(sym + add), data8 LSB */ -#define R_IA64_LTOFF_FPTR22 0x52 /* @ltoff(@fptr(s+a)), imm22 */ -#define R_IA64_LTOFF_FPTR64I 0x53 /* @ltoff(@fptr(s+a)), imm64 */ -#define R_IA64_LTOFF_FPTR32MSB 0x54 /* @ltoff(@fptr(s+a)), data4 MSB */ -#define R_IA64_LTOFF_FPTR32LSB 0x55 /* @ltoff(@fptr(s+a)), data4 LSB */ -#define R_IA64_LTOFF_FPTR64MSB 0x56 /* @ltoff(@fptr(s+a)), data8 MSB */ -#define R_IA64_LTOFF_FPTR64LSB 0x57 /* @ltoff(@fptr(s+a)), data8 LSB */ -#define R_IA64_SEGREL32MSB 0x5c /* @segrel(sym + add), data4 MSB */ -#define R_IA64_SEGREL32LSB 0x5d /* @segrel(sym + add), data4 LSB */ -#define R_IA64_SEGREL64MSB 0x5e /* @segrel(sym + add), data8 MSB */ -#define R_IA64_SEGREL64LSB 0x5f /* @segrel(sym + add), data8 LSB */ -#define R_IA64_SECREL32MSB 0x64 /* @secrel(sym + add), data4 MSB */ -#define R_IA64_SECREL32LSB 0x65 /* @secrel(sym + add), data4 LSB */ -#define R_IA64_SECREL64MSB 0x66 /* @secrel(sym + add), data8 MSB */ -#define R_IA64_SECREL64LSB 0x67 /* @secrel(sym + add), data8 LSB */ -#define R_IA64_REL32MSB 0x6c /* data 4 + REL */ -#define R_IA64_REL32LSB 0x6d /* data 4 + REL */ -#define R_IA64_REL64MSB 0x6e /* data 8 + REL */ -#define R_IA64_REL64LSB 0x6f /* data 8 + REL */ -#define R_IA64_LTV32MSB 0x74 /* symbol + addend, data4 MSB */ -#define R_IA64_LTV32LSB 0x75 /* symbol + addend, data4 LSB */ -#define R_IA64_LTV64MSB 0x76 /* symbol + addend, data8 MSB */ -#define R_IA64_LTV64LSB 0x77 /* symbol + addend, data8 LSB */ -#define R_IA64_PCREL21BI 0x79 /* @pcrel(sym + add), 21bit inst */ -#define R_IA64_PCREL22 0x7a /* @pcrel(sym + add), 22bit inst */ -#define R_IA64_PCREL64I 0x7b /* @pcrel(sym + add), 64bit inst */ -#define R_IA64_IPLTMSB 0x80 /* dynamic reloc, imported PLT, MSB */ -#define R_IA64_IPLTLSB 0x81 /* dynamic reloc, imported PLT, LSB */ -#define R_IA64_COPY 0x84 /* copy relocation */ -#define R_IA64_SUB 0x85 /* Addend and symbol difference */ -#define R_IA64_LTOFF22X 0x86 /* LTOFF22, relaxable. */ -#define R_IA64_LDXMOV 0x87 /* Use of LTOFF22X. */ -#define R_IA64_TPREL14 0x91 /* @tprel(sym + add), imm14 */ -#define R_IA64_TPREL22 0x92 /* @tprel(sym + add), imm22 */ -#define R_IA64_TPREL64I 0x93 /* @tprel(sym + add), imm64 */ -#define R_IA64_TPREL64MSB 0x96 /* @tprel(sym + add), data8 MSB */ -#define R_IA64_TPREL64LSB 0x97 /* @tprel(sym + add), data8 LSB */ -#define R_IA64_LTOFF_TPREL22 0x9a /* @ltoff(@tprel(s+a)), imm2 */ -#define R_IA64_DTPMOD64MSB 0xa6 /* @dtpmod(sym + add), data8 MSB */ -#define R_IA64_DTPMOD64LSB 0xa7 /* @dtpmod(sym + add), data8 LSB */ -#define R_IA64_LTOFF_DTPMOD22 0xaa /* @ltoff(@dtpmod(sym + add)), imm22 */ -#define R_IA64_DTPREL14 0xb1 /* @dtprel(sym + add), imm14 */ -#define R_IA64_DTPREL22 0xb2 /* @dtprel(sym + add), imm22 */ -#define R_IA64_DTPREL64I 0xb3 /* @dtprel(sym + add), imm64 */ -#define R_IA64_DTPREL32MSB 0xb4 /* @dtprel(sym + add), data4 MSB */ -#define R_IA64_DTPREL32LSB 0xb5 /* @dtprel(sym + add), data4 LSB */ -#define R_IA64_DTPREL64MSB 0xb6 /* @dtprel(sym + add), data8 MSB */ -#define R_IA64_DTPREL64LSB 0xb7 /* @dtprel(sym + add), data8 LSB */ -#define R_IA64_LTOFF_DTPREL22 0xba /* @ltoff(@dtprel(s+a)), imm22 */ - -/* SH specific declarations */ - -/* SH relocs. */ -#define R_SH_NONE 0 -#define R_SH_DIR32 1 -#define R_SH_REL32 2 -#define R_SH_DIR8WPN 3 -#define R_SH_IND12W 4 -#define R_SH_DIR8WPL 5 -#define R_SH_DIR8WPZ 6 -#define R_SH_DIR8BP 7 -#define R_SH_DIR8W 8 -#define R_SH_DIR8L 9 -#define R_SH_SWITCH16 25 -#define R_SH_SWITCH32 26 -#define R_SH_USES 27 -#define R_SH_COUNT 28 -#define R_SH_ALIGN 29 -#define R_SH_CODE 30 -#define R_SH_DATA 31 -#define R_SH_LABEL 32 -#define R_SH_SWITCH8 33 -#define R_SH_GNU_VTINHERIT 34 -#define R_SH_GNU_VTENTRY 35 -#define R_SH_TLS_GD_32 144 -#define R_SH_TLS_LD_32 145 -#define R_SH_TLS_LDO_32 146 -#define R_SH_TLS_IE_32 147 -#define R_SH_TLS_LE_32 148 -#define R_SH_TLS_DTPMOD32 149 -#define R_SH_TLS_DTPOFF32 150 -#define R_SH_TLS_TPOFF32 151 -#define R_SH_GOT32 160 -#define R_SH_PLT32 161 -#define R_SH_COPY 162 -#define R_SH_GLOB_DAT 163 -#define R_SH_JMP_SLOT 164 -#define R_SH_RELATIVE 165 -#define R_SH_GOTOFF 166 -#define R_SH_GOTPC 167 -/* Keep this the last entry. */ -#define R_SH_NUM 256 - -/* Additional s390 relocs */ - -#define R_390_NONE 0 /* No reloc. */ -#define R_390_8 1 /* Direct 8 bit. */ -#define R_390_12 2 /* Direct 12 bit. */ -#define R_390_16 3 /* Direct 16 bit. */ -#define R_390_32 4 /* Direct 32 bit. */ -#define R_390_PC32 5 /* PC relative 32 bit. */ -#define R_390_GOT12 6 /* 12 bit GOT offset. */ -#define R_390_GOT32 7 /* 32 bit GOT offset. */ -#define R_390_PLT32 8 /* 32 bit PC relative PLT address. */ -#define R_390_COPY 9 /* Copy symbol at runtime. */ -#define R_390_GLOB_DAT 10 /* Create GOT entry. */ -#define R_390_JMP_SLOT 11 /* Create PLT entry. */ -#define R_390_RELATIVE 12 /* Adjust by program base. */ -#define R_390_GOTOFF32 13 /* 32 bit offset to GOT. */ -#define R_390_GOTPC 14 /* 32 bit PC relative offset to GOT. */ -#define R_390_GOT16 15 /* 16 bit GOT offset. */ -#define R_390_PC16 16 /* PC relative 16 bit. */ -#define R_390_PC16DBL 17 /* PC relative 16 bit shifted by 1. */ -#define R_390_PLT16DBL 18 /* 16 bit PC rel. PLT shifted by 1. */ -#define R_390_PC32DBL 19 /* PC relative 32 bit shifted by 1. */ -#define R_390_PLT32DBL 20 /* 32 bit PC rel. PLT shifted by 1. */ -#define R_390_GOTPCDBL 21 /* 32 bit PC rel. GOT shifted by 1. */ -#define R_390_64 22 /* Direct 64 bit. */ -#define R_390_PC64 23 /* PC relative 64 bit. */ -#define R_390_GOT64 24 /* 64 bit GOT offset. */ -#define R_390_PLT64 25 /* 64 bit PC relative PLT address. */ -#define R_390_GOTENT 26 /* 32 bit PC rel. to GOT entry >> 1. */ -#define R_390_GOTOFF16 27 /* 16 bit offset to GOT. */ -#define R_390_GOTOFF64 28 /* 64 bit offset to GOT. */ -#define R_390_GOTPLT12 29 /* 12 bit offset to jump slot. */ -#define R_390_GOTPLT16 30 /* 16 bit offset to jump slot. */ -#define R_390_GOTPLT32 31 /* 32 bit offset to jump slot. */ -#define R_390_GOTPLT64 32 /* 64 bit offset to jump slot. */ -#define R_390_GOTPLTENT 33 /* 32 bit rel. offset to jump slot. */ -#define R_390_PLTOFF16 34 /* 16 bit offset from GOT to PLT. */ -#define R_390_PLTOFF32 35 /* 32 bit offset from GOT to PLT. */ -#define R_390_PLTOFF64 36 /* 16 bit offset from GOT to PLT. */ -#define R_390_TLS_LOAD 37 /* Tag for load insn in TLS code. */ -#define R_390_TLS_GDCALL 38 /* Tag for function call in general - dynamic TLS code. */ -#define R_390_TLS_LDCALL 39 /* Tag for function call in local - dynamic TLS code. */ -#define R_390_TLS_GD32 40 /* Direct 32 bit for general dynamic - thread local data. */ -#define R_390_TLS_GD64 41 /* Direct 64 bit for general dynamic - thread local data. */ -#define R_390_TLS_GOTIE12 42 /* 12 bit GOT offset for static TLS - block offset. */ -#define R_390_TLS_GOTIE32 43 /* 32 bit GOT offset for static TLS - block offset. */ -#define R_390_TLS_GOTIE64 44 /* 64 bit GOT offset for static TLS - block offset. */ -#define R_390_TLS_LDM32 45 /* Direct 32 bit for local dynamic - thread local data in LE code. */ -#define R_390_TLS_LDM64 46 /* Direct 64 bit for local dynamic - thread local data in LE code. */ -#define R_390_TLS_IE32 47 /* 32 bit address of GOT entry for - negated static TLS block offset. */ -#define R_390_TLS_IE64 48 /* 64 bit address of GOT entry for - negated static TLS block offset. */ -#define R_390_TLS_IEENT 49 /* 32 bit rel. offset to GOT entry for - negated static TLS block offset. */ -#define R_390_TLS_LE32 50 /* 32 bit negated offset relative to - static TLS block. */ -#define R_390_TLS_LE64 51 /* 64 bit negated offset relative to - static TLS block. */ -#define R_390_TLS_LDO32 52 /* 32 bit offset relative to TLS - block. */ -#define R_390_TLS_LDO64 53 /* 64 bit offset relative to TLS - block. */ -#define R_390_TLS_DTPMOD 54 /* ID of module containing symbol. */ -#define R_390_TLS_DTPOFF 55 /* Offset in TLS block. */ -#define R_390_TLS_TPOFF 56 /* Negated offset in static TLS - block. */ - -/* Keep this the last entry. */ -#define R_390_NUM 57 - -/* CRIS relocations. */ -#define R_CRIS_NONE 0 -#define R_CRIS_8 1 -#define R_CRIS_16 2 -#define R_CRIS_32 3 -#define R_CRIS_8_PCREL 4 -#define R_CRIS_16_PCREL 5 -#define R_CRIS_32_PCREL 6 -#define R_CRIS_GNU_VTINHERIT 7 -#define R_CRIS_GNU_VTENTRY 8 -#define R_CRIS_COPY 9 -#define R_CRIS_GLOB_DAT 10 -#define R_CRIS_JUMP_SLOT 11 -#define R_CRIS_RELATIVE 12 -#define R_CRIS_16_GOT 13 -#define R_CRIS_32_GOT 14 -#define R_CRIS_16_GOTPLT 15 -#define R_CRIS_32_GOTPLT 16 -#define R_CRIS_32_GOTREL 17 -#define R_CRIS_32_PLT_GOTREL 18 -#define R_CRIS_32_PLT_PCREL 19 - -#define R_CRIS_NUM 20 - -/* AMD x86-64 relocations. */ -#define R_X86_64_NONE 0 /* No reloc */ -#define R_X86_64_64 1 /* Direct 64 bit */ -#define R_X86_64_PC32 2 /* PC relative 32 bit signed */ -#define R_X86_64_GOT32 3 /* 32 bit GOT entry */ -#define R_X86_64_PLT32 4 /* 32 bit PLT address */ -#define R_X86_64_COPY 5 /* Copy symbol at runtime */ -#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */ -#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */ -#define R_X86_64_RELATIVE 8 /* Adjust by program base */ -#define R_X86_64_GOTPCREL 9 /* 32 bit signed PC relative - offset to GOT */ -#define R_X86_64_32 10 /* Direct 32 bit zero extended */ -#define R_X86_64_32S 11 /* Direct 32 bit sign extended */ -#define R_X86_64_16 12 /* Direct 16 bit zero extended */ -#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */ -#define R_X86_64_8 14 /* Direct 8 bit sign extended */ -#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */ -#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */ -#define R_X86_64_DTPOFF64 17 /* Offset in module's TLS block */ -#define R_X86_64_TPOFF64 18 /* Offset in initial TLS block */ -#define R_X86_64_TLSGD 19 /* 32 bit signed PC relative offset - to two GOT entries for GD symbol */ -#define R_X86_64_TLSLD 20 /* 32 bit signed PC relative offset - to two GOT entries for LD symbol */ -#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */ -#define R_X86_64_GOTTPOFF 22 /* 32 bit signed PC relative offset - to GOT entry for IE symbol */ -#define R_X86_64_TPOFF32 23 /* Offset in initial TLS block */ - -#define R_X86_64_NUM 24 - -#endif /* elf.h */ diff --git a/SheepShaver/src/kpx_cpu/include/nvmemfun.hpp b/SheepShaver/src/kpx_cpu/include/nvmemfun.hpp deleted file mode 100644 index efad01ff..00000000 --- a/SheepShaver/src/kpx_cpu/include/nvmemfun.hpp +++ /dev/null @@ -1,167 +0,0 @@ -/* - * nvmemfun.hpp - Non-virtual member function wrappers - * - * Kheperix (C) 2003 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef NVMEMFUN_H -#define NVMEMFUN_H - -#include - -#if defined __GNUC__ -#define HAVE_FAST_NV_MEM_FUN 1 -#define MEM_FUN_WORDS 2 -#if defined __GXX_ABI_VERSION /* GCC >= 3.0 */ -#define MEM_FUN_OFFSET 0 -#else -#define MEM_FUN_OFFSET 1 -#endif -#endif - -#if defined __ICC -#define HAVE_FAST_NV_MEM_FUN 1 -#define MEM_FUN_WORDS 2 -#define MEM_FUN_OFFSET 0 /* GNU C++ ABI v3 */ -#endif - -#if defined __EDG__ && defined __sgi -#define HAVE_FAST_NV_MEM_FUN 1 -#define MEM_FUN_WORDS 3 -#define MEM_FUN_OFFSET 2 -#endif - -#if HAVE_FAST_NV_MEM_FUN - -template< class PMF, class PF > -inline PF nv_mem_fun_of(PMF pmf) { - if (pmf == 0) - return 0; - union { PMF pmf; uintptr p[MEM_FUN_WORDS]; } x; - x.pmf = pmf; - return (PF)x.p[MEM_FUN_OFFSET]; -} - -template< class R, class T > -class nv_mem_fun_t : public std::unary_function { - typedef R (T::*pmf_t)(); - typedef R (*pf_t)(T *); - pf_t pf; -public: - nv_mem_fun_t(pmf_t pmf) : pf(nv_mem_fun_of(pmf)) {} - R operator()(T *p) const { return (*pf)(p); } - pf_t ptr() const { return pf; } -}; - -template< class R, class T > -class const_nv_mem_fun_t : public std::unary_function { - typedef R (T::*pmf_t)(); - typedef R (*pf_t)(T *); - pf_t const pf; -public: - const_nv_mem_fun_t(pmf_t const pmf) : pf(nv_mem_fun_of(pmf)) {} - R operator()(const T *p) const { return (*pf)(p); } - pf_t ptr() const { return pf; } -}; - -template< class R, class T, class A > -class nv_mem_fun1_t : public std::binary_function { - typedef R (T::*pmf_t)(A); - typedef R (*pf_t)(T *, A x); - pf_t pf; -public: - nv_mem_fun1_t(pmf_t pmf) : pf(nv_mem_fun_of(pmf)) {} - R operator()(T *p, A x) const { return (*pf)(p, x); } - pf_t ptr() const { return pf; } -}; - -template< class R, class T, class A > -class const_nv_mem_fun1_t : public std::binary_function { - typedef R (T::*pmf_t)(A); - typedef R (*pf_t)(T *, A x); - pf_t const pf; -public: - const_nv_mem_fun1_t(pmf_t const pmf) : pf(nv_mem_fun_of(pmf)) {} - R operator()(const T *p, A x) const { return (*pf)(p, x); } - pf_t ptr() const { return pf; } -}; - -#else - -template< class R, class T > -class nv_mem_fun_t : public std::unary_function { - typedef R (T::*pmf_t)(); - pmf_t pf; -public: - nv_mem_fun_t(R (T::*pmf)()) : pf(pmf) {} - R operator()(T *p) const { return (p->*pf)(); } - pmf_t ptr() const { return pf; } -}; - -template< class R, class T > -class const_nv_mem_fun_t : public std::unary_function { - typedef R (T::*pmf_t)() const; - pmf_t pf; -public: - const_nv_mem_fun_t(R (T::*pmf)() const) : pf(pmf) {} - R operator()(const T *p) const { return (p->*pf)(); } - pmf_t ptr() const { return pf; } -}; - -template< class R, class T, class A > -class nv_mem_fun1_t : public std::binary_function { - typedef R (T::*pmf_t)(A); - pmf_t pf; -public: - nv_mem_fun1_t(R (T::*pmf)(A)) : pf(pmf) {} - R operator()(T *p, A x) const { return (p->*pf)(x); } - pmf_t ptr() const { return pf; } -}; - -template< class R, class T, class A > -class const_nv_mem_fun1_t : public std::binary_function { - typedef R (T::*pmf_t)(A) const; - pmf_t pf; -public: - const_nv_mem_fun1_t(R (T::*pmf)(A) const) : pf(pmf) {} - R operator()(const T *p, A x) const { return (p->*pf)(x); } - pmf_t ptr() const { return pf; } -}; - -#endif - -template< class R, class T > -inline nv_mem_fun_t nv_mem_fun(R (T::*pmf)()) { - return nv_mem_fun_t(pmf); -} - -template< class R, class T > -inline const_nv_mem_fun_t nv_mem_fun(R (T::*pmf)() const) { - return const_nv_mem_fun_t(pmf); -} - -template< class R, class T, class A > -inline nv_mem_fun1_t nv_mem_fun(R (T::*pmf)(A)) { - return nv_mem_fun1_t(pmf); -} - -template< class R, class T, class A > -inline const_nv_mem_fun1_t nv_mem_fun(R (T::*pmf)(A) const) { - return const_nv_mem_fun1_t(pmf); -} - -#endif /* NVMEMFUN_H */ diff --git a/SheepShaver/src/kpx_cpu/include/task-plugin.hpp b/SheepShaver/src/kpx_cpu/include/task-plugin.hpp deleted file mode 100644 index c57fcd08..00000000 --- a/SheepShaver/src/kpx_cpu/include/task-plugin.hpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * task-plugin.hpp - Task plugin definition - * - * Kheperix (C) 2003 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef TASK_PLUGIN_H -#define TASK_PLUGIN_H - -#include "basic-plugin.hpp" - -// Forward declarations -class task_struct; -class basic_kernel; -class basic_cpu; -class program_info; - -// Base class for all task components -class task_plugin - : public basic_plugin -{ - // Parent task - task_struct * task; - -public: - - // Constructor - task_plugin(task_struct * parent_task) : task(parent_task) { } - - // Public accessors to resolve various components of a task - basic_kernel * kernel() const; - basic_cpu * cpu() const; - program_info * program() const; -}; - -// Get out of specified task -extern void task_exit(task_plugin *task, int status); - -#endif /* TASK_PLUGIN_H */ diff --git a/SheepShaver/src/kpx_cpu/ppc-dis.c b/SheepShaver/src/kpx_cpu/ppc-dis.c deleted file mode 100644 index a2478e63..00000000 --- a/SheepShaver/src/kpx_cpu/ppc-dis.c +++ /dev/null @@ -1,5489 +0,0 @@ -/* ppc-dis.c -- Disassemble PowerPC instructions - Copyright 1994, 1995, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 - Free Software Foundation, Inc. - Written by Ian Lance Taylor, Cygnus Support - -This file is part of GDB, GAS, and the GNU binutils. - -GDB, GAS, and the GNU binutils are free software; you can redistribute -them and/or modify them under the terms of the GNU General Public -License as published by the Free Software Foundation; either version -2, or (at your option) any later version. - -GDB, GAS, and the GNU binutils are distributed in the hope that they -will be useful, but WITHOUT ANY WARRANTY; without even the implied -warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See -the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this file; see the file COPYING. If not, -see . */ - -#include -#include - -#include "dis-asm.h" - -#define BFD_DEFAULT_TARGET_SIZE 64 - -/* ppc.h -- Header file for PowerPC opcode table - Copyright 1994, 1995, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Cygnus Support - -This file is part of GDB, GAS, and the GNU binutils. - -GDB, GAS, and the GNU binutils are free software; you can redistribute -them and/or modify them under the terms of the GNU General Public -License as published by the Free Software Foundation; either version -1, or (at your option) any later version. - -GDB, GAS, and the GNU binutils are distributed in the hope that they -will be useful, but WITHOUT ANY WARRANTY; without even the implied -warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See -the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this file; see the file COPYING. If not, -see . */ - -/* The opcode table is an array of struct powerpc_opcode. */ - -struct powerpc_opcode -{ - /* The opcode name. */ - const char *name; - - /* The opcode itself. Those bits which will be filled in with - operands are zeroes. */ - unsigned long opcode; - - /* The opcode mask. This is used by the disassembler. This is a - mask containing ones indicating those bits which must match the - opcode field, and zeroes indicating those bits which need not - match (and are presumably filled in by operands). */ - unsigned long mask; - - /* One bit flags for the opcode. These are used to indicate which - specific processors support the instructions. The defined values - are listed below. */ - unsigned long flags; - - /* An array of operand codes. Each code is an index into the - operand table. They appear in the order which the operands must - appear in assembly code, and are terminated by a zero. */ - unsigned char operands[8]; -}; - -/* The table itself is sorted by major opcode number, and is otherwise - in the order in which the disassembler should consider - instructions. */ -extern const struct powerpc_opcode powerpc_opcodes[]; -extern const int powerpc_num_opcodes; - -/* Values defined for the flags field of a struct powerpc_opcode. */ - -/* Opcode is defined for the PowerPC architecture. */ -#define PPC_OPCODE_PPC 1 - -/* Opcode is defined for the POWER (RS/6000) architecture. */ -#define PPC_OPCODE_POWER 2 - -/* Opcode is defined for the POWER2 (Rios 2) architecture. */ -#define PPC_OPCODE_POWER2 4 - -/* Opcode is only defined on 32 bit architectures. */ -#define PPC_OPCODE_32 8 - -/* Opcode is only defined on 64 bit architectures. */ -#define PPC_OPCODE_64 0x10 - -/* Opcode is supported by the Motorola PowerPC 601 processor. The 601 - is assumed to support all PowerPC (PPC_OPCODE_PPC) instructions, - but it also supports many additional POWER instructions. */ -#define PPC_OPCODE_601 0x20 - -/* Opcode is supported in both the Power and PowerPC architectures - (ie, compiler's -mcpu=common or assembler's -mcom). */ -#define PPC_OPCODE_COMMON 0x40 - -/* Opcode is supported for any Power or PowerPC platform (this is - for the assembler's -many option, and it eliminates duplicates). */ -#define PPC_OPCODE_ANY 0x80 - -/* Opcode is supported as part of the 64-bit bridge. */ -#define PPC_OPCODE_64_BRIDGE 0x100 - -/* Opcode is supported by Altivec Vector Unit */ -#define PPC_OPCODE_ALTIVEC 0x200 - -/* Opcode is supported by PowerPC 403 processor. */ -#define PPC_OPCODE_403 0x400 - -/* Opcode is supported by PowerPC BookE processor. */ -#define PPC_OPCODE_BOOKE 0x800 - -/* Opcode is only supported by 64-bit PowerPC BookE processor. */ -#define PPC_OPCODE_BOOKE64 0x1000 - -/* Opcode is supported by PowerPC 440 processor. */ -#define PPC_OPCODE_440 0x2000 - -/* Opcode is only supported by Power4 architecture. */ -#define PPC_OPCODE_POWER4 0x4000 - -/* Opcode isn't supported by Power4 architecture. */ -#define PPC_OPCODE_NOPOWER4 0x8000 - -/* Opcode is only supported by POWERPC Classic architecture. */ -#define PPC_OPCODE_CLASSIC 0x10000 - -/* Opcode is only supported by e500x2 Core. */ -#define PPC_OPCODE_SPE 0x20000 - -/* Opcode is supported by e500x2 Integer select APU. */ -#define PPC_OPCODE_ISEL 0x40000 - -/* Opcode is an e500 SPE floating point instruction. */ -#define PPC_OPCODE_EFS 0x80000 - -/* Opcode is supported by branch locking APU. */ -#define PPC_OPCODE_BRLOCK 0x100000 - -/* Opcode is supported by performance monitor APU. */ -#define PPC_OPCODE_PMR 0x200000 - -/* Opcode is supported by cache locking APU. */ -#define PPC_OPCODE_CACHELCK 0x400000 - -/* Opcode is supported by machine check APU. */ -#define PPC_OPCODE_RFMCI 0x800000 - -/* Opcode is only supported by Power5 architecture. */ -#define PPC_OPCODE_POWER5 0x1000000 - -/* Opcode is supported by PowerPC e300 family. */ -#define PPC_OPCODE_E300 0x2000000 - -/* Opcode is only supported by Power6 architecture. */ -#define PPC_OPCODE_POWER6 0x4000000 - -/* Opcode is only supported by PowerPC Cell family. */ -#define PPC_OPCODE_CELL 0x8000000 - -/* A macro to extract the major opcode from an instruction. */ -#define PPC_OP(i) (((i) >> 26) & 0x3f) - -/* The operands table is an array of struct powerpc_operand. */ - -struct powerpc_operand -{ - /* A bitmask of bits in the operand. */ - unsigned int bitm; - - /* How far the operand is left shifted in the instruction. - -1 to indicate that BITM and SHIFT cannot be used to determine - where the operand goes in the insn. */ - int shift; - - /* Insertion function. This is used by the assembler. To insert an - operand value into an instruction, check this field. - - If it is NULL, execute - i |= (op & o->bitm) << o->shift; - (i is the instruction which we are filling in, o is a pointer to - this structure, and op is the operand value). - - If this field is not NULL, then simply call it with the - instruction and the operand value. It will return the new value - of the instruction. If the ERRMSG argument is not NULL, then if - the operand value is illegal, *ERRMSG will be set to a warning - string (the operand will be inserted in any case). If the - operand value is legal, *ERRMSG will be unchanged (most operands - can accept any value). */ - unsigned long (*insert) - (unsigned long instruction, long op, int dialect, const char **errmsg); - - /* Extraction function. This is used by the disassembler. To - extract this operand type from an instruction, check this field. - - If it is NULL, compute - op = (i >> o->shift) & o->bitm; - if ((o->flags & PPC_OPERAND_SIGNED) != 0) - sign_extend (op); - (i is the instruction, o is a pointer to this structure, and op - is the result). - - If this field is not NULL, then simply call it with the - instruction value. It will return the value of the operand. If - the INVALID argument is not NULL, *INVALID will be set to - non-zero if this operand type can not actually be extracted from - this operand (i.e., the instruction does not match). If the - operand is valid, *INVALID will not be changed. */ - long (*extract) (unsigned long instruction, int dialect, int *invalid); - - /* One bit syntax flags. */ - unsigned long flags; -}; - -/* Elements in the table are retrieved by indexing with values from - the operands field of the powerpc_opcodes table. */ - -extern const struct powerpc_operand powerpc_operands[]; -extern const unsigned int num_powerpc_operands; - -/* Values defined for the flags field of a struct powerpc_operand. */ - -/* This operand takes signed values. */ -#define PPC_OPERAND_SIGNED (0x1) - -/* This operand takes signed values, but also accepts a full positive - range of values when running in 32 bit mode. That is, if bits is - 16, it takes any value from -0x8000 to 0xffff. In 64 bit mode, - this flag is ignored. */ -#define PPC_OPERAND_SIGNOPT (0x2) - -/* This operand does not actually exist in the assembler input. This - is used to support extended mnemonics such as mr, for which two - operands fields are identical. The assembler should call the - insert function with any op value. The disassembler should call - the extract function, ignore the return value, and check the value - placed in the valid argument. */ -#define PPC_OPERAND_FAKE (0x4) - -/* The next operand should be wrapped in parentheses rather than - separated from this one by a comma. This is used for the load and - store instructions which want their operands to look like - reg,displacement(reg) - */ -#define PPC_OPERAND_PARENS (0x8) - -/* This operand may use the symbolic names for the CR fields, which - are - lt 0 gt 1 eq 2 so 3 un 3 - cr0 0 cr1 1 cr2 2 cr3 3 - cr4 4 cr5 5 cr6 6 cr7 7 - These may be combined arithmetically, as in cr2*4+gt. These are - only supported on the PowerPC, not the POWER. */ -#define PPC_OPERAND_CR (0x10) - -/* This operand names a register. The disassembler uses this to print - register names with a leading 'r'. */ -#define PPC_OPERAND_GPR (0x20) - -/* Like PPC_OPERAND_GPR, but don't print a leading 'r' for r0. */ -#define PPC_OPERAND_GPR_0 (0x40) - -/* This operand names a floating point register. The disassembler - prints these with a leading 'f'. */ -#define PPC_OPERAND_FPR (0x80) - -/* This operand is a relative branch displacement. The disassembler - prints these symbolically if possible. */ -#define PPC_OPERAND_RELATIVE (0x100) - -/* This operand is an absolute branch address. The disassembler - prints these symbolically if possible. */ -#define PPC_OPERAND_ABSOLUTE (0x200) - -/* This operand is optional, and is zero if omitted. This is used for - example, in the optional BF field in the comparison instructions. The - assembler must count the number of operands remaining on the line, - and the number of operands remaining for the opcode, and decide - whether this operand is present or not. The disassembler should - print this operand out only if it is not zero. */ -#define PPC_OPERAND_OPTIONAL (0x400) - -/* This flag is only used with PPC_OPERAND_OPTIONAL. If this operand - is omitted, then for the next operand use this operand value plus - 1, ignoring the next operand field for the opcode. This wretched - hack is needed because the Power rotate instructions can take - either 4 or 5 operands. The disassembler should print this operand - out regardless of the PPC_OPERAND_OPTIONAL field. */ -#define PPC_OPERAND_NEXT (0x800) - -/* This operand should be regarded as a negative number for the - purposes of overflow checking (i.e., the normal most negative - number is disallowed and one more than the normal most positive - number is allowed). This flag will only be set for a signed - operand. */ -#define PPC_OPERAND_NEGATIVE (0x1000) - -/* This operand names a vector unit register. The disassembler - prints these with a leading 'v'. */ -#define PPC_OPERAND_VR (0x2000) - -/* This operand is for the DS field in a DS form instruction. */ -#define PPC_OPERAND_DS (0x4000) - -/* This operand is for the DQ field in a DQ form instruction. */ -#define PPC_OPERAND_DQ (0x8000) - -/* Valid range of operand is 0..n rather than 0..n-1. */ -#define PPC_OPERAND_PLUS1 (0x10000) - -/* The POWER and PowerPC assemblers use a few macros. We keep them - with the operands table for simplicity. The macro table is an - array of struct powerpc_macro. */ - -struct powerpc_macro -{ - /* The macro name. */ - const char *name; - - /* The number of operands the macro takes. */ - unsigned int operands; - - /* One bit flags for the opcode. These are used to indicate which - specific processors support the instructions. The values are the - same as those for the struct powerpc_opcode flags field. */ - unsigned long flags; - - /* A format string to turn the macro into a normal instruction. - Each %N in the string is replaced with operand number N (zero - based). */ - const char *format; -}; - -extern const struct powerpc_macro powerpc_macros[]; -extern const int powerpc_num_macros; - -/* ppc-opc.c -- PowerPC opcode list - Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Cygnus Support - - This file is part of GDB, GAS, and the GNU binutils. - - GDB, GAS, and the GNU binutils are free software; you can redistribute - them and/or modify them under the terms of the GNU General Public - License as published by the Free Software Foundation; either version - 2, or (at your option) any later version. - - GDB, GAS, and the GNU binutils are distributed in the hope that they - will be useful, but WITHOUT ANY WARRANTY; without even the implied - warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this file; see the file COPYING. - If not, see . */ - -/* This file holds the PowerPC opcode table. The opcode table - includes almost all of the extended instruction mnemonics. This - permits the disassembler to use them, and simplifies the assembler - logic, at the cost of increasing the table size. The table is - strictly constant data, so the compiler should be able to put it in - the .text section. - - This file also holds the operand table. All knowledge about - inserting operands into instructions and vice-versa is kept in this - file. */ - -/* Local insertion and extraction functions. */ - -static unsigned long insert_bat (unsigned long, long, int, const char **); -static long extract_bat (unsigned long, int, int *); -static unsigned long insert_bba (unsigned long, long, int, const char **); -static long extract_bba (unsigned long, int, int *); -static unsigned long insert_bdm (unsigned long, long, int, const char **); -static long extract_bdm (unsigned long, int, int *); -static unsigned long insert_bdp (unsigned long, long, int, const char **); -static long extract_bdp (unsigned long, int, int *); -static unsigned long insert_bo (unsigned long, long, int, const char **); -static long extract_bo (unsigned long, int, int *); -static unsigned long insert_boe (unsigned long, long, int, const char **); -static long extract_boe (unsigned long, int, int *); -static unsigned long insert_fxm (unsigned long, long, int, const char **); -static long extract_fxm (unsigned long, int, int *); -static unsigned long insert_mbe (unsigned long, long, int, const char **); -static long extract_mbe (unsigned long, int, int *); -static unsigned long insert_mb6 (unsigned long, long, int, const char **); -static long extract_mb6 (unsigned long, int, int *); -static long extract_nb (unsigned long, int, int *); -static unsigned long insert_nsi (unsigned long, long, int, const char **); -static long extract_nsi (unsigned long, int, int *); -static unsigned long insert_ral (unsigned long, long, int, const char **); -static unsigned long insert_ram (unsigned long, long, int, const char **); -static unsigned long insert_raq (unsigned long, long, int, const char **); -static unsigned long insert_ras (unsigned long, long, int, const char **); -static unsigned long insert_rbs (unsigned long, long, int, const char **); -static long extract_rbs (unsigned long, int, int *); -static unsigned long insert_sh6 (unsigned long, long, int, const char **); -static long extract_sh6 (unsigned long, int, int *); -static unsigned long insert_spr (unsigned long, long, int, const char **); -static long extract_spr (unsigned long, int, int *); -static unsigned long insert_sprg (unsigned long, long, int, const char **); -static long extract_sprg (unsigned long, int, int *); -static unsigned long insert_tbr (unsigned long, long, int, const char **); -static long extract_tbr (unsigned long, int, int *); - -/* The operands table. - - The fields are bitm, shift, insert, extract, flags. - - We used to put parens around the various additions, like the one - for BA just below. However, that caused trouble with feeble - compilers with a limit on depth of a parenthesized expression, like - (reportedly) the compiler in Microsoft Developer Studio 5. So we - omit the parens, since the macros are never used in a context where - the addition will be ambiguous. */ - -const struct powerpc_operand powerpc_operands[] = -{ - /* The zero index is used to indicate the end of the list of - operands. */ -#define UNUSED 0 - { 0, 0, NULL, NULL, 0 }, - - /* The BA field in an XL form instruction. */ -#define BA UNUSED + 1 - /* The BI field in a B form or XL form instruction. */ -#define BI BA -#define BI_MASK (0x1f << 16) - { 0x1f, 16, NULL, NULL, PPC_OPERAND_CR }, - - /* The BA field in an XL form instruction when it must be the same - as the BT field in the same instruction. */ -#define BAT BA + 1 - { 0x1f, 16, insert_bat, extract_bat, PPC_OPERAND_FAKE }, - - /* The BB field in an XL form instruction. */ -#define BB BAT + 1 -#define BB_MASK (0x1f << 11) - { 0x1f, 11, NULL, NULL, PPC_OPERAND_CR }, - - /* The BB field in an XL form instruction when it must be the same - as the BA field in the same instruction. */ -#define BBA BB + 1 - { 0x1f, 11, insert_bba, extract_bba, PPC_OPERAND_FAKE }, - - /* The BD field in a B form instruction. The lower two bits are - forced to zero. */ -#define BD BBA + 1 - { 0xfffc, 0, NULL, NULL, PPC_OPERAND_RELATIVE | PPC_OPERAND_SIGNED }, - - /* The BD field in a B form instruction when absolute addressing is - used. */ -#define BDA BD + 1 - { 0xfffc, 0, NULL, NULL, PPC_OPERAND_ABSOLUTE | PPC_OPERAND_SIGNED }, - - /* The BD field in a B form instruction when the - modifier is used. - This sets the y bit of the BO field appropriately. */ -#define BDM BDA + 1 - { 0xfffc, 0, insert_bdm, extract_bdm, - PPC_OPERAND_RELATIVE | PPC_OPERAND_SIGNED }, - - /* The BD field in a B form instruction when the - modifier is used - and absolute address is used. */ -#define BDMA BDM + 1 - { 0xfffc, 0, insert_bdm, extract_bdm, - PPC_OPERAND_ABSOLUTE | PPC_OPERAND_SIGNED }, - - /* The BD field in a B form instruction when the + modifier is used. - This sets the y bit of the BO field appropriately. */ -#define BDP BDMA + 1 - { 0xfffc, 0, insert_bdp, extract_bdp, - PPC_OPERAND_RELATIVE | PPC_OPERAND_SIGNED }, - - /* The BD field in a B form instruction when the + modifier is used - and absolute addressing is used. */ -#define BDPA BDP + 1 - { 0xfffc, 0, insert_bdp, extract_bdp, - PPC_OPERAND_ABSOLUTE | PPC_OPERAND_SIGNED }, - - /* The BF field in an X or XL form instruction. */ -#define BF BDPA + 1 - /* The CRFD field in an X form instruction. */ -#define CRFD BF - { 0x7, 23, NULL, NULL, PPC_OPERAND_CR }, - - /* The BF field in an X or XL form instruction. */ -#define BFF BF + 1 - { 0x7, 23, NULL, NULL, 0 }, - - /* An optional BF field. This is used for comparison instructions, - in which an omitted BF field is taken as zero. */ -#define OBF BFF + 1 - { 0x7, 23, NULL, NULL, PPC_OPERAND_CR | PPC_OPERAND_OPTIONAL }, - - /* The BFA field in an X or XL form instruction. */ -#define BFA OBF + 1 - { 0x7, 18, NULL, NULL, PPC_OPERAND_CR }, - - /* The BO field in a B form instruction. Certain values are - illegal. */ -#define BO BFA + 1 -#define BO_MASK (0x1f << 21) - { 0x1f, 21, insert_bo, extract_bo, 0 }, - - /* The BO field in a B form instruction when the + or - modifier is - used. This is like the BO field, but it must be even. */ -#define BOE BO + 1 - { 0x1e, 21, insert_boe, extract_boe, 0 }, - -#define BH BOE + 1 - { 0x3, 11, NULL, NULL, PPC_OPERAND_OPTIONAL }, - - /* The BT field in an X or XL form instruction. */ -#define BT BH + 1 - { 0x1f, 21, NULL, NULL, PPC_OPERAND_CR }, - - /* The condition register number portion of the BI field in a B form - or XL form instruction. This is used for the extended - conditional branch mnemonics, which set the lower two bits of the - BI field. This field is optional. */ -#define CR BT + 1 - { 0x7, 18, NULL, NULL, PPC_OPERAND_CR | PPC_OPERAND_OPTIONAL }, - - /* The CRB field in an X form instruction. */ -#define CRB CR + 1 - /* The MB field in an M form instruction. */ -#define MB CRB -#define MB_MASK (0x1f << 6) - { 0x1f, 6, NULL, NULL, 0 }, - - /* The CRFS field in an X form instruction. */ -#define CRFS CRB + 1 - { 0x7, 0, NULL, NULL, PPC_OPERAND_CR }, - - /* The CT field in an X form instruction. */ -#define CT CRFS + 1 - /* The MO field in an mbar instruction. */ -#define MO CT - { 0x1f, 21, NULL, NULL, PPC_OPERAND_OPTIONAL }, - - /* The D field in a D form instruction. This is a displacement off - a register, and implies that the next operand is a register in - parentheses. */ -#define D CT + 1 - { 0xffff, 0, NULL, NULL, PPC_OPERAND_PARENS | PPC_OPERAND_SIGNED }, - - /* The DE field in a DE form instruction. This is like D, but is 12 - bits only. */ -#define DE D + 1 - { 0xfff, 4, NULL, NULL, PPC_OPERAND_PARENS | PPC_OPERAND_SIGNED }, - - /* The DES field in a DES form instruction. This is like DS, but is 14 - bits only (12 stored.) */ -#define DES DE + 1 - { 0x3ffc, 2, NULL, NULL, PPC_OPERAND_PARENS | PPC_OPERAND_SIGNED }, - - /* The DQ field in a DQ form instruction. This is like D, but the - lower four bits are forced to zero. */ -#define DQ DES + 1 - { 0xfff0, 0, NULL, NULL, - PPC_OPERAND_PARENS | PPC_OPERAND_SIGNED | PPC_OPERAND_DQ }, - - /* The DS field in a DS form instruction. This is like D, but the - lower two bits are forced to zero. */ -#undef DS -#define DS DQ + 1 - { 0xfffc, 0, NULL, NULL, - PPC_OPERAND_PARENS | PPC_OPERAND_SIGNED | PPC_OPERAND_DS }, - - /* The E field in a wrteei instruction. */ -#define E DS + 1 - { 0x1, 15, NULL, NULL, 0 }, - - /* The FL1 field in a POWER SC form instruction. */ -#define FL1 E + 1 - /* The U field in an X form instruction. */ -#define U FL1 - { 0xf, 12, NULL, NULL, 0 }, - - /* The FL2 field in a POWER SC form instruction. */ -#define FL2 FL1 + 1 - { 0x7, 2, NULL, NULL, 0 }, - - /* The FLM field in an XFL form instruction. */ -#define FLM FL2 + 1 - { 0xff, 17, NULL, NULL, 0 }, - - /* The FRA field in an X or A form instruction. */ -#define FRA FLM + 1 -#define FRA_MASK (0x1f << 16) - { 0x1f, 16, NULL, NULL, PPC_OPERAND_FPR }, - - /* The FRB field in an X or A form instruction. */ -#define FRB FRA + 1 -#define FRB_MASK (0x1f << 11) - { 0x1f, 11, NULL, NULL, PPC_OPERAND_FPR }, - - /* The FRC field in an A form instruction. */ -#define FRC FRB + 1 -#define FRC_MASK (0x1f << 6) - { 0x1f, 6, NULL, NULL, PPC_OPERAND_FPR }, - - /* The FRS field in an X form instruction or the FRT field in a D, X - or A form instruction. */ -#define FRS FRC + 1 -#define FRT FRS - { 0x1f, 21, NULL, NULL, PPC_OPERAND_FPR }, - - /* The FXM field in an XFX instruction. */ -#define FXM FRS + 1 - { 0xff, 12, insert_fxm, extract_fxm, 0 }, - - /* Power4 version for mfcr. */ -#define FXM4 FXM + 1 - { 0xff, 12, insert_fxm, extract_fxm, PPC_OPERAND_OPTIONAL }, - - /* The L field in a D or X form instruction. */ -#define L FXM4 + 1 - { 0x1, 21, NULL, NULL, PPC_OPERAND_OPTIONAL }, - - /* The LEV field in a POWER SVC form instruction. */ -#define SVC_LEV L + 1 - { 0x7f, 5, NULL, NULL, 0 }, - - /* The LEV field in an SC form instruction. */ -#define LEV SVC_LEV + 1 - { 0x7f, 5, NULL, NULL, PPC_OPERAND_OPTIONAL }, - - /* The LI field in an I form instruction. The lower two bits are - forced to zero. */ -#define LI LEV + 1 - { 0x3fffffc, 0, NULL, NULL, PPC_OPERAND_RELATIVE | PPC_OPERAND_SIGNED }, - - /* The LI field in an I form instruction when used as an absolute - address. */ -#define LIA LI + 1 - { 0x3fffffc, 0, NULL, NULL, PPC_OPERAND_ABSOLUTE | PPC_OPERAND_SIGNED }, - - /* The LS field in an X (sync) form instruction. */ -#define LS LIA + 1 - { 0x3, 21, NULL, NULL, PPC_OPERAND_OPTIONAL }, - - /* The ME field in an M form instruction. */ -#define ME LS + 1 -#define ME_MASK (0x1f << 1) - { 0x1f, 1, NULL, NULL, 0 }, - - /* The MB and ME fields in an M form instruction expressed a single - operand which is a bitmask indicating which bits to select. This - is a two operand form using PPC_OPERAND_NEXT. See the - description in opcode/ppc.h for what this means. */ -#define MBE ME + 1 - { 0x1f, 6, NULL, NULL, PPC_OPERAND_OPTIONAL | PPC_OPERAND_NEXT }, - { -1, 0, insert_mbe, extract_mbe, 0 }, - - /* The MB or ME field in an MD or MDS form instruction. The high - bit is wrapped to the low end. */ -#define MB6 MBE + 2 -#define ME6 MB6 -#define MB6_MASK (0x3f << 5) - { 0x3f, 5, insert_mb6, extract_mb6, 0 }, - - /* The NB field in an X form instruction. The value 32 is stored as - 0. */ -#define NB MB6 + 1 - { 0x1f, 11, NULL, extract_nb, PPC_OPERAND_PLUS1 }, - - /* The NSI field in a D form instruction. This is the same as the - SI field, only negated. */ -#define NSI NB + 1 - { 0xffff, 0, insert_nsi, extract_nsi, - PPC_OPERAND_NEGATIVE | PPC_OPERAND_SIGNED }, - - /* The RA field in an D, DS, DQ, X, XO, M, or MDS form instruction. */ -#define RA NSI + 1 -#define RA_MASK (0x1f << 16) - { 0x1f, 16, NULL, NULL, PPC_OPERAND_GPR }, - - /* As above, but 0 in the RA field means zero, not r0. */ -#define RA0 RA + 1 - { 0x1f, 16, NULL, NULL, PPC_OPERAND_GPR_0 }, - - /* The RA field in the DQ form lq instruction, which has special - value restrictions. */ -#define RAQ RA0 + 1 - { 0x1f, 16, insert_raq, NULL, PPC_OPERAND_GPR_0 }, - - /* The RA field in a D or X form instruction which is an updating - load, which means that the RA field may not be zero and may not - equal the RT field. */ -#define RAL RAQ + 1 - { 0x1f, 16, insert_ral, NULL, PPC_OPERAND_GPR_0 }, - - /* The RA field in an lmw instruction, which has special value - restrictions. */ -#define RAM RAL + 1 - { 0x1f, 16, insert_ram, NULL, PPC_OPERAND_GPR_0 }, - - /* The RA field in a D or X form instruction which is an updating - store or an updating floating point load, which means that the RA - field may not be zero. */ -#define RAS RAM + 1 - { 0x1f, 16, insert_ras, NULL, PPC_OPERAND_GPR_0 }, - - /* The RA field of the tlbwe instruction, which is optional. */ -#define RAOPT RAS + 1 - { 0x1f, 16, NULL, NULL, PPC_OPERAND_GPR | PPC_OPERAND_OPTIONAL }, - - /* The RB field in an X, XO, M, or MDS form instruction. */ -#define RB RAOPT + 1 -#define RB_MASK (0x1f << 11) - { 0x1f, 11, NULL, NULL, PPC_OPERAND_GPR }, - - /* The RB field in an X form instruction when it must be the same as - the RS field in the instruction. This is used for extended - mnemonics like mr. */ -#define RBS RB + 1 - { 0x1f, 11, insert_rbs, extract_rbs, PPC_OPERAND_FAKE }, - - /* The RS field in a D, DS, X, XFX, XS, M, MD or MDS form - instruction or the RT field in a D, DS, X, XFX or XO form - instruction. */ -#define RS RBS + 1 -#define RT RS -#define RT_MASK (0x1f << 21) - { 0x1f, 21, NULL, NULL, PPC_OPERAND_GPR }, - - /* The RS and RT fields of the DS form stq instruction, which have - special value restrictions. */ -#define RSQ RS + 1 -#define RTQ RSQ - { 0x1e, 21, NULL, NULL, PPC_OPERAND_GPR_0 }, - - /* The RS field of the tlbwe instruction, which is optional. */ -#define RSO RSQ + 1 -#define RTO RSO - { 0x1f, 21, NULL, NULL, PPC_OPERAND_GPR | PPC_OPERAND_OPTIONAL }, - - /* The SH field in an X or M form instruction. */ -#define SH RSO + 1 -#define SH_MASK (0x1f << 11) - /* The other UIMM field in a EVX form instruction. */ -#define EVUIMM SH - { 0x1f, 11, NULL, NULL, 0 }, - - /* The SH field in an MD form instruction. This is split. */ -#define SH6 SH + 1 -#define SH6_MASK ((0x1f << 11) | (1 << 1)) - { 0x3f, -1, insert_sh6, extract_sh6, 0 }, - - /* The SH field of the tlbwe instruction, which is optional. */ -#define SHO SH6 + 1 - { 0x1f, 11, NULL, NULL, PPC_OPERAND_OPTIONAL }, - - /* The SI field in a D form instruction. */ -#define SI SHO + 1 - { 0xffff, 0, NULL, NULL, PPC_OPERAND_SIGNED }, - - /* The SI field in a D form instruction when we accept a wide range - of positive values. */ -#define SISIGNOPT SI + 1 - { 0xffff, 0, NULL, NULL, PPC_OPERAND_SIGNED | PPC_OPERAND_SIGNOPT }, - - /* The SPR field in an XFX form instruction. This is flipped--the - lower 5 bits are stored in the upper 5 and vice- versa. */ -#define SPR SISIGNOPT + 1 -#define PMR SPR -#define SPR_MASK (0x3ff << 11) - { 0x3ff, 11, insert_spr, extract_spr, 0 }, - - /* The BAT index number in an XFX form m[ft]ibat[lu] instruction. */ -#define SPRBAT SPR + 1 -#define SPRBAT_MASK (0x3 << 17) - { 0x3, 17, NULL, NULL, 0 }, - - /* The SPRG register number in an XFX form m[ft]sprg instruction. */ -#define SPRG SPRBAT + 1 - { 0x1f, 16, insert_sprg, extract_sprg, 0 }, - - /* The SR field in an X form instruction. */ -#define SR SPRG + 1 - { 0xf, 16, NULL, NULL, 0 }, - - /* The STRM field in an X AltiVec form instruction. */ -#define STRM SR + 1 - { 0x3, 21, NULL, NULL, 0 }, - - /* The SV field in a POWER SC form instruction. */ -#define SV STRM + 1 - { 0x3fff, 2, NULL, NULL, 0 }, - - /* The TBR field in an XFX form instruction. This is like the SPR - field, but it is optional. */ -#define TBR SV + 1 - { 0x3ff, 11, insert_tbr, extract_tbr, PPC_OPERAND_OPTIONAL }, - - /* The TO field in a D or X form instruction. */ -#define TO TBR + 1 -#define TO_MASK (0x1f << 21) - { 0x1f, 21, NULL, NULL, 0 }, - - /* The UI field in a D form instruction. */ -#define UI TO + 1 - { 0xffff, 0, NULL, NULL, 0 }, - - /* The VA field in a VA, VX or VXR form instruction. */ -#define VA UI + 1 - { 0x1f, 16, NULL, NULL, PPC_OPERAND_VR }, - - /* The VB field in a VA, VX or VXR form instruction. */ -#define VB VA + 1 - { 0x1f, 11, NULL, NULL, PPC_OPERAND_VR }, - - /* The VC field in a VA form instruction. */ -#define VC VB + 1 - { 0x1f, 6, NULL, NULL, PPC_OPERAND_VR }, - - /* The VD or VS field in a VA, VX, VXR or X form instruction. */ -#define VD VC + 1 -#define VS VD - { 0x1f, 21, NULL, NULL, PPC_OPERAND_VR }, - - /* The SIMM field in a VX form instruction. */ -#define SIMM VD + 1 - { 0x1f, 16, NULL, NULL, PPC_OPERAND_SIGNED}, - - /* The UIMM field in a VX form instruction, and TE in Z form. */ -#define UIMM SIMM + 1 -#define TE UIMM - { 0x1f, 16, NULL, NULL, 0 }, - - /* The SHB field in a VA form instruction. */ -#define SHB UIMM + 1 - { 0xf, 6, NULL, NULL, 0 }, - - /* The other UIMM field in a half word EVX form instruction. */ -#define EVUIMM_2 SHB + 1 - { 0x3e, 10, NULL, NULL, PPC_OPERAND_PARENS }, - - /* The other UIMM field in a word EVX form instruction. */ -#define EVUIMM_4 EVUIMM_2 + 1 - { 0x7c, 9, NULL, NULL, PPC_OPERAND_PARENS }, - - /* The other UIMM field in a double EVX form instruction. */ -#define EVUIMM_8 EVUIMM_4 + 1 - { 0xf8, 8, NULL, NULL, PPC_OPERAND_PARENS }, - - /* The WS field. */ -#define WS EVUIMM_8 + 1 - { 0x7, 11, NULL, NULL, 0 }, - - /* The L field in an mtmsrd or A form instruction or W in an X form. */ -#define A_L WS + 1 -#define W A_L - { 0x1, 16, NULL, NULL, PPC_OPERAND_OPTIONAL }, - -#define RMC A_L + 1 - { 0x3, 9, NULL, NULL, 0 }, - -#define R RMC + 1 - { 0x1, 16, NULL, NULL, 0 }, - -#define SP R + 1 - { 0x3, 19, NULL, NULL, 0 }, - -#define S SP + 1 - { 0x1, 20, NULL, NULL, 0 }, - - /* SH field starting at bit position 16. */ -#define SH16 S + 1 - /* The DCM and DGM fields in a Z form instruction. */ -#define DCM SH16 -#define DGM DCM - { 0x3f, 10, NULL, NULL, 0 }, - - /* The EH field in larx instruction. */ -#define EH SH16 + 1 - { 0x1, 0, NULL, NULL, PPC_OPERAND_OPTIONAL }, - - /* The L field in an mtfsf or XFL form instruction. */ -#define XFL_L EH + 1 - { 0x1, 25, NULL, NULL, PPC_OPERAND_OPTIONAL}, -}; - -const unsigned int num_powerpc_operands = (sizeof (powerpc_operands) - / sizeof (powerpc_operands[0])); - -/* The functions used to insert and extract complicated operands. */ - -/* The BA field in an XL form instruction when it must be the same as - the BT field in the same instruction. This operand is marked FAKE. - The insertion function just copies the BT field into the BA field, - and the extraction function just checks that the fields are the - same. */ - -static unsigned long -insert_bat (unsigned long insn, - long value ATTRIBUTE_UNUSED, - int dialect ATTRIBUTE_UNUSED, - const char **errmsg ATTRIBUTE_UNUSED) -{ - return insn | (((insn >> 21) & 0x1f) << 16); -} - -static long -extract_bat (unsigned long insn, - int dialect ATTRIBUTE_UNUSED, - int *invalid) -{ - if (((insn >> 21) & 0x1f) != ((insn >> 16) & 0x1f)) - *invalid = 1; - return 0; -} - -/* The BB field in an XL form instruction when it must be the same as - the BA field in the same instruction. This operand is marked FAKE. - The insertion function just copies the BA field into the BB field, - and the extraction function just checks that the fields are the - same. */ - -static unsigned long -insert_bba (unsigned long insn, - long value ATTRIBUTE_UNUSED, - int dialect ATTRIBUTE_UNUSED, - const char **errmsg ATTRIBUTE_UNUSED) -{ - return insn | (((insn >> 16) & 0x1f) << 11); -} - -static long -extract_bba (unsigned long insn, - int dialect ATTRIBUTE_UNUSED, - int *invalid) -{ - if (((insn >> 16) & 0x1f) != ((insn >> 11) & 0x1f)) - *invalid = 1; - return 0; -} - -/* The BD field in a B form instruction when the - modifier is used. - This modifier means that the branch is not expected to be taken. - For chips built to versions of the architecture prior to version 2 - (ie. not Power4 compatible), we set the y bit of the BO field to 1 - if the offset is negative. When extracting, we require that the y - bit be 1 and that the offset be positive, since if the y bit is 0 - we just want to print the normal form of the instruction. - Power4 compatible targets use two bits, "a", and "t", instead of - the "y" bit. "at" == 00 => no hint, "at" == 01 => unpredictable, - "at" == 10 => not taken, "at" == 11 => taken. The "t" bit is 00001 - in BO field, the "a" bit is 00010 for branch on CR(BI) and 01000 - for branch on CTR. We only handle the taken/not-taken hint here. - Note that we don't relax the conditions tested here when - disassembling with -Many because insns using extract_bdm and - extract_bdp always occur in pairs. One or the other will always - be valid. */ - -static unsigned long -insert_bdm (unsigned long insn, - long value, - int dialect, - const char **errmsg ATTRIBUTE_UNUSED) -{ - if ((dialect & PPC_OPCODE_POWER4) == 0) - { - if ((value & 0x8000) != 0) - insn |= 1 << 21; - } - else - { - if ((insn & (0x14 << 21)) == (0x04 << 21)) - insn |= 0x02 << 21; - else if ((insn & (0x14 << 21)) == (0x10 << 21)) - insn |= 0x08 << 21; - } - return insn | (value & 0xfffc); -} - -static long -extract_bdm (unsigned long insn, - int dialect, - int *invalid) -{ - if ((dialect & PPC_OPCODE_POWER4) == 0) - { - if (((insn & (1 << 21)) == 0) != ((insn & (1 << 15)) == 0)) - *invalid = 1; - } - else - { - if ((insn & (0x17 << 21)) != (0x06 << 21) - && (insn & (0x1d << 21)) != (0x18 << 21)) - *invalid = 1; - } - - return ((insn & 0xfffc) ^ 0x8000) - 0x8000; -} - -/* The BD field in a B form instruction when the + modifier is used. - This is like BDM, above, except that the branch is expected to be - taken. */ - -static unsigned long -insert_bdp (unsigned long insn, - long value, - int dialect, - const char **errmsg ATTRIBUTE_UNUSED) -{ - if ((dialect & PPC_OPCODE_POWER4) == 0) - { - if ((value & 0x8000) == 0) - insn |= 1 << 21; - } - else - { - if ((insn & (0x14 << 21)) == (0x04 << 21)) - insn |= 0x03 << 21; - else if ((insn & (0x14 << 21)) == (0x10 << 21)) - insn |= 0x09 << 21; - } - return insn | (value & 0xfffc); -} - -static long -extract_bdp (unsigned long insn, - int dialect, - int *invalid) -{ - if ((dialect & PPC_OPCODE_POWER4) == 0) - { - if (((insn & (1 << 21)) == 0) == ((insn & (1 << 15)) == 0)) - *invalid = 1; - } - else - { - if ((insn & (0x17 << 21)) != (0x07 << 21) - && (insn & (0x1d << 21)) != (0x19 << 21)) - *invalid = 1; - } - - return ((insn & 0xfffc) ^ 0x8000) - 0x8000; -} - -/* Check for legal values of a BO field. */ - -static int -valid_bo (long value, int dialect, int extract) -{ - if ((dialect & PPC_OPCODE_POWER4) == 0) - { - int valid; - /* Certain encodings have bits that are required to be zero. - These are (z must be zero, y may be anything): - 001zy - 011zy - 1z00y - 1z01y - 1z1zz - */ - switch (value & 0x14) - { - default: - case 0: - valid = 1; - break; - case 0x4: - valid = (value & 0x2) == 0; - break; - case 0x10: - valid = (value & 0x8) == 0; - break; - case 0x14: - valid = value == 0x14; - break; - } - /* When disassembling with -Many, accept power4 encodings too. */ - if (valid - || (dialect & PPC_OPCODE_ANY) == 0 - || !extract) - return valid; - } - - /* Certain encodings have bits that are required to be zero. - These are (z must be zero, a & t may be anything): - 0000z - 0001z - 0100z - 0101z - 001at - 011at - 1a00t - 1a01t - 1z1zz - */ - if ((value & 0x14) == 0) - return (value & 0x1) == 0; - else if ((value & 0x14) == 0x14) - return value == 0x14; - else - return 1; -} - -/* The BO field in a B form instruction. Warn about attempts to set - the field to an illegal value. */ - -static unsigned long -insert_bo (unsigned long insn, - long value, - int dialect, - const char **errmsg) -{ - if (!valid_bo (value, dialect, 0)) - *errmsg = _("invalid conditional option"); - return insn | ((value & 0x1f) << 21); -} - -static long -extract_bo (unsigned long insn, - int dialect, - int *invalid) -{ - long value; - - value = (insn >> 21) & 0x1f; - if (!valid_bo (value, dialect, 1)) - *invalid = 1; - return value; -} - -/* The BO field in a B form instruction when the + or - modifier is - used. This is like the BO field, but it must be even. When - extracting it, we force it to be even. */ - -static unsigned long -insert_boe (unsigned long insn, - long value, - int dialect, - const char **errmsg) -{ - if (!valid_bo (value, dialect, 0)) - *errmsg = _("invalid conditional option"); - else if ((value & 1) != 0) - *errmsg = _("attempt to set y bit when using + or - modifier"); - - return insn | ((value & 0x1f) << 21); -} - -static long -extract_boe (unsigned long insn, - int dialect, - int *invalid) -{ - long value; - - value = (insn >> 21) & 0x1f; - if (!valid_bo (value, dialect, 1)) - *invalid = 1; - return value & 0x1e; -} - -/* FXM mask in mfcr and mtcrf instructions. */ - -static unsigned long -insert_fxm (unsigned long insn, - long value, - int dialect, - const char **errmsg) -{ - /* If we're handling the mfocrf and mtocrf insns ensure that exactly - one bit of the mask field is set. */ - if ((insn & (1 << 20)) != 0) - { - if (value == 0 || (value & -value) != value) - { - *errmsg = _("invalid mask field"); - value = 0; - } - } - - /* If the optional field on mfcr is missing that means we want to use - the old form of the instruction that moves the whole cr. In that - case we'll have VALUE zero. There doesn't seem to be a way to - distinguish this from the case where someone writes mfcr %r3,0. */ - else if (value == 0) - ; - - /* If only one bit of the FXM field is set, we can use the new form - of the instruction, which is faster. Unlike the Power4 branch hint - encoding, this is not backward compatible. Do not generate the - new form unless -mpower4 has been given, or -many and the two - operand form of mfcr was used. */ - else if ((value & -value) == value - && ((dialect & PPC_OPCODE_POWER4) != 0 - || ((dialect & PPC_OPCODE_ANY) != 0 - && (insn & (0x3ff << 1)) == 19 << 1))) - insn |= 1 << 20; - - /* Any other value on mfcr is an error. */ - else if ((insn & (0x3ff << 1)) == 19 << 1) - { - *errmsg = _("ignoring invalid mfcr mask"); - value = 0; - } - - return insn | ((value & 0xff) << 12); -} - -static long -extract_fxm (unsigned long insn, - int dialect ATTRIBUTE_UNUSED, - int *invalid) -{ - long mask = (insn >> 12) & 0xff; - - /* Is this a Power4 insn? */ - if ((insn & (1 << 20)) != 0) - { - /* Exactly one bit of MASK should be set. */ - if (mask == 0 || (mask & -mask) != mask) - *invalid = 1; - } - - /* Check that non-power4 form of mfcr has a zero MASK. */ - else if ((insn & (0x3ff << 1)) == 19 << 1) - { - if (mask != 0) - *invalid = 1; - } - - return mask; -} - -/* The MB and ME fields in an M form instruction expressed as a single - operand which is itself a bitmask. The extraction function always - marks it as invalid, since we never want to recognize an - instruction which uses a field of this type. */ - -static unsigned long -insert_mbe (unsigned long insn, - long value, - int dialect ATTRIBUTE_UNUSED, - const char **errmsg) -{ - unsigned long uval, mask; - int mb, me, mx, count, last; - - uval = value; - - if (uval == 0) - { - *errmsg = _("illegal bitmask"); - return insn; - } - - mb = 0; - me = 32; - if ((uval & 1) != 0) - last = 1; - else - last = 0; - count = 0; - - /* mb: location of last 0->1 transition */ - /* me: location of last 1->0 transition */ - /* count: # transitions */ - - for (mx = 0, mask = 1L << 31; mx < 32; ++mx, mask >>= 1) - { - if ((uval & mask) && !last) - { - ++count; - mb = mx; - last = 1; - } - else if (!(uval & mask) && last) - { - ++count; - me = mx; - last = 0; - } - } - if (me == 0) - me = 32; - - if (count != 2 && (count != 0 || ! last)) - *errmsg = _("illegal bitmask"); - - return insn | (mb << 6) | ((me - 1) << 1); -} - -static long -extract_mbe (unsigned long insn, - int dialect ATTRIBUTE_UNUSED, - int *invalid) -{ - long ret; - int mb, me; - int i; - - *invalid = 1; - - mb = (insn >> 6) & 0x1f; - me = (insn >> 1) & 0x1f; - if (mb < me + 1) - { - ret = 0; - for (i = mb; i <= me; i++) - ret |= 1L << (31 - i); - } - else if (mb == me + 1) - ret = ~0; - else /* (mb > me + 1) */ - { - ret = ~0; - for (i = me + 1; i < mb; i++) - ret &= ~(1L << (31 - i)); - } - return ret; -} - -/* The MB or ME field in an MD or MDS form instruction. The high bit - is wrapped to the low end. */ - -static unsigned long -insert_mb6 (unsigned long insn, - long value, - int dialect ATTRIBUTE_UNUSED, - const char **errmsg ATTRIBUTE_UNUSED) -{ - return insn | ((value & 0x1f) << 6) | (value & 0x20); -} - -static long -extract_mb6 (unsigned long insn, - int dialect ATTRIBUTE_UNUSED, - int *invalid ATTRIBUTE_UNUSED) -{ - return ((insn >> 6) & 0x1f) | (insn & 0x20); -} - -/* The NB field in an X form instruction. The value 32 is stored as - 0. */ - -static long -extract_nb (unsigned long insn, - int dialect ATTRIBUTE_UNUSED, - int *invalid ATTRIBUTE_UNUSED) -{ - long ret; - - ret = (insn >> 11) & 0x1f; - if (ret == 0) - ret = 32; - return ret; -} - -/* The NSI field in a D form instruction. This is the same as the SI - field, only negated. The extraction function always marks it as - invalid, since we never want to recognize an instruction which uses - a field of this type. */ - -static unsigned long -insert_nsi (unsigned long insn, - long value, - int dialect ATTRIBUTE_UNUSED, - const char **errmsg ATTRIBUTE_UNUSED) -{ - return insn | (-value & 0xffff); -} - -static long -extract_nsi (unsigned long insn, - int dialect ATTRIBUTE_UNUSED, - int *invalid) -{ - *invalid = 1; - return -(((insn & 0xffff) ^ 0x8000) - 0x8000); -} - -/* The RA field in a D or X form instruction which is an updating - load, which means that the RA field may not be zero and may not - equal the RT field. */ - -static unsigned long -insert_ral (unsigned long insn, - long value, - int dialect ATTRIBUTE_UNUSED, - const char **errmsg) -{ - if (value == 0 - || (unsigned long) value == ((insn >> 21) & 0x1f)) - *errmsg = "invalid register operand when updating"; - return insn | ((value & 0x1f) << 16); -} - -/* The RA field in an lmw instruction, which has special value - restrictions. */ - -static unsigned long -insert_ram (unsigned long insn, - long value, - int dialect ATTRIBUTE_UNUSED, - const char **errmsg) -{ - if ((unsigned long) value >= ((insn >> 21) & 0x1f)) - *errmsg = _("index register in load range"); - return insn | ((value & 0x1f) << 16); -} - -/* The RA field in the DQ form lq instruction, which has special - value restrictions. */ - -static unsigned long -insert_raq (unsigned long insn, - long value, - int dialect ATTRIBUTE_UNUSED, - const char **errmsg) -{ - long rtvalue = (insn & RT_MASK) >> 21; - - if (value == rtvalue) - *errmsg = _("source and target register operands must be different"); - return insn | ((value & 0x1f) << 16); -} - -/* The RA field in a D or X form instruction which is an updating - store or an updating floating point load, which means that the RA - field may not be zero. */ - -static unsigned long -insert_ras (unsigned long insn, - long value, - int dialect ATTRIBUTE_UNUSED, - const char **errmsg) -{ - if (value == 0) - *errmsg = _("invalid register operand when updating"); - return insn | ((value & 0x1f) << 16); -} - -/* The RB field in an X form instruction when it must be the same as - the RS field in the instruction. This is used for extended - mnemonics like mr. This operand is marked FAKE. The insertion - function just copies the BT field into the BA field, and the - extraction function just checks that the fields are the same. */ - -static unsigned long -insert_rbs (unsigned long insn, - long value ATTRIBUTE_UNUSED, - int dialect ATTRIBUTE_UNUSED, - const char **errmsg ATTRIBUTE_UNUSED) -{ - return insn | (((insn >> 21) & 0x1f) << 11); -} - -static long -extract_rbs (unsigned long insn, - int dialect ATTRIBUTE_UNUSED, - int *invalid) -{ - if (((insn >> 21) & 0x1f) != ((insn >> 11) & 0x1f)) - *invalid = 1; - return 0; -} - -/* The SH field in an MD form instruction. This is split. */ - -static unsigned long -insert_sh6 (unsigned long insn, - long value, - int dialect ATTRIBUTE_UNUSED, - const char **errmsg ATTRIBUTE_UNUSED) -{ - return insn | ((value & 0x1f) << 11) | ((value & 0x20) >> 4); -} - -static long -extract_sh6 (unsigned long insn, - int dialect ATTRIBUTE_UNUSED, - int *invalid ATTRIBUTE_UNUSED) -{ - return ((insn >> 11) & 0x1f) | ((insn << 4) & 0x20); -} - -/* The SPR field in an XFX form instruction. This is flipped--the - lower 5 bits are stored in the upper 5 and vice- versa. */ - -static unsigned long -insert_spr (unsigned long insn, - long value, - int dialect ATTRIBUTE_UNUSED, - const char **errmsg ATTRIBUTE_UNUSED) -{ - return insn | ((value & 0x1f) << 16) | ((value & 0x3e0) << 6); -} - -static long -extract_spr (unsigned long insn, - int dialect ATTRIBUTE_UNUSED, - int *invalid ATTRIBUTE_UNUSED) -{ - return ((insn >> 16) & 0x1f) | ((insn >> 6) & 0x3e0); -} - -/* Some dialects have 8 SPRG registers instead of the standard 4. */ - -static unsigned long -insert_sprg (unsigned long insn, - long value, - int dialect, - const char **errmsg) -{ - /* This check uses PPC_OPCODE_403 because PPC405 is later defined - as a synonym. If ever a 405 specific dialect is added this - check should use that instead. */ - if (value > 7 - || (value > 3 - && (dialect & (PPC_OPCODE_BOOKE | PPC_OPCODE_403)) == 0)) - *errmsg = _("invalid sprg number"); - - /* If this is mfsprg4..7 then use spr 260..263 which can be read in - user mode. Anything else must use spr 272..279. */ - if (value <= 3 || (insn & 0x100) != 0) - value |= 0x10; - - return insn | ((value & 0x17) << 16); -} - -static long -extract_sprg (unsigned long insn, - int dialect, - int *invalid) -{ - unsigned long val = (insn >> 16) & 0x1f; - - /* mfsprg can use 260..263 and 272..279. mtsprg only uses spr 272..279 - If not BOOKE or 405, then both use only 272..275. */ - if (val <= 3 - || (val < 0x10 && (insn & 0x100) != 0) - || (val - 0x10 > 3 - && (dialect & (PPC_OPCODE_BOOKE | PPC_OPCODE_403)) == 0)) - *invalid = 1; - return val & 7; -} - -/* The TBR field in an XFX instruction. This is just like SPR, but it - is optional. When TBR is omitted, it must be inserted as 268 (the - magic number of the TB register). These functions treat 0 - (indicating an omitted optional operand) as 268. This means that - ``mftb 4,0'' is not handled correctly. This does not matter very - much, since the architecture manual does not define mftb as - accepting any values other than 268 or 269. */ - -#define TB (268) - -static unsigned long -insert_tbr (unsigned long insn, - long value, - int dialect ATTRIBUTE_UNUSED, - const char **errmsg ATTRIBUTE_UNUSED) -{ - if (value == 0) - value = TB; - return insn | ((value & 0x1f) << 16) | ((value & 0x3e0) << 6); -} - -static long -extract_tbr (unsigned long insn, - int dialect ATTRIBUTE_UNUSED, - int *invalid ATTRIBUTE_UNUSED) -{ - long ret; - - ret = ((insn >> 16) & 0x1f) | ((insn >> 6) & 0x3e0); - if (ret == TB) - ret = 0; - return ret; -} - -/* Macros used to form opcodes. */ - -/* The main opcode. */ -#define OP(x) ((((unsigned long)(x)) & 0x3f) << 26) -#define OP_MASK OP (0x3f) - -/* The main opcode combined with a trap code in the TO field of a D - form instruction. Used for extended mnemonics for the trap - instructions. */ -#define OPTO(x,to) (OP (x) | ((((unsigned long)(to)) & 0x1f) << 21)) -#define OPTO_MASK (OP_MASK | TO_MASK) - -/* The main opcode combined with a comparison size bit in the L field - of a D form or X form instruction. Used for extended mnemonics for - the comparison instructions. */ -#define OPL(x,l) (OP (x) | ((((unsigned long)(l)) & 1) << 21)) -#define OPL_MASK OPL (0x3f,1) - -/* An A form instruction. */ -#define A(op, xop, rc) (OP (op) | ((((unsigned long)(xop)) & 0x1f) << 1) | (((unsigned long)(rc)) & 1)) -#define A_MASK A (0x3f, 0x1f, 1) - -/* An A_MASK with the FRB field fixed. */ -#define AFRB_MASK (A_MASK | FRB_MASK) - -/* An A_MASK with the FRC field fixed. */ -#define AFRC_MASK (A_MASK | FRC_MASK) - -/* An A_MASK with the FRA and FRC fields fixed. */ -#define AFRAFRC_MASK (A_MASK | FRA_MASK | FRC_MASK) - -/* An AFRAFRC_MASK, but with L bit clear. */ -#define AFRALFRC_MASK (AFRAFRC_MASK & ~((unsigned long) 1 << 16)) - -/* A B form instruction. */ -#define B(op, aa, lk) (OP (op) | ((((unsigned long)(aa)) & 1) << 1) | ((lk) & 1)) -#define B_MASK B (0x3f, 1, 1) - -/* A B form instruction setting the BO field. */ -#define BBO(op, bo, aa, lk) (B ((op), (aa), (lk)) | ((((unsigned long)(bo)) & 0x1f) << 21)) -#define BBO_MASK BBO (0x3f, 0x1f, 1, 1) - -/* A BBO_MASK with the y bit of the BO field removed. This permits - matching a conditional branch regardless of the setting of the y - bit. Similarly for the 'at' bits used for power4 branch hints. */ -#define Y_MASK (((unsigned long) 1) << 21) -#define AT1_MASK (((unsigned long) 3) << 21) -#define AT2_MASK (((unsigned long) 9) << 21) -#define BBOY_MASK (BBO_MASK &~ Y_MASK) -#define BBOAT_MASK (BBO_MASK &~ AT1_MASK) - -/* A B form instruction setting the BO field and the condition bits of - the BI field. */ -#define BBOCB(op, bo, cb, aa, lk) \ - (BBO ((op), (bo), (aa), (lk)) | ((((unsigned long)(cb)) & 0x3) << 16)) -#define BBOCB_MASK BBOCB (0x3f, 0x1f, 0x3, 1, 1) - -/* A BBOCB_MASK with the y bit of the BO field removed. */ -#define BBOYCB_MASK (BBOCB_MASK &~ Y_MASK) -#define BBOATCB_MASK (BBOCB_MASK &~ AT1_MASK) -#define BBOAT2CB_MASK (BBOCB_MASK &~ AT2_MASK) - -/* A BBOYCB_MASK in which the BI field is fixed. */ -#define BBOYBI_MASK (BBOYCB_MASK | BI_MASK) -#define BBOATBI_MASK (BBOAT2CB_MASK | BI_MASK) - -/* An Context form instruction. */ -#define CTX(op, xop) (OP (op) | (((unsigned long)(xop)) & 0x7)) -#define CTX_MASK CTX(0x3f, 0x7) - -/* An User Context form instruction. */ -#define UCTX(op, xop) (OP (op) | (((unsigned long)(xop)) & 0x1f)) -#define UCTX_MASK UCTX(0x3f, 0x1f) - -/* The main opcode mask with the RA field clear. */ -#define DRA_MASK (OP_MASK | RA_MASK) - -/* A DS form instruction. */ -#define DSO(op, xop) (OP (op) | ((xop) & 0x3)) -#define DS_MASK DSO (0x3f, 3) - -/* A DE form instruction. */ -#define DEO(op, xop) (OP (op) | ((xop) & 0xf)) -#define DE_MASK DEO (0x3e, 0xf) - -/* An EVSEL form instruction. */ -#define EVSEL(op, xop) (OP (op) | (((unsigned long)(xop)) & 0xff) << 3) -#define EVSEL_MASK EVSEL(0x3f, 0xff) - -/* An M form instruction. */ -#define M(op, rc) (OP (op) | ((rc) & 1)) -#define M_MASK M (0x3f, 1) - -/* An M form instruction with the ME field specified. */ -#define MME(op, me, rc) (M ((op), (rc)) | ((((unsigned long)(me)) & 0x1f) << 1)) - -/* An M_MASK with the MB and ME fields fixed. */ -#define MMBME_MASK (M_MASK | MB_MASK | ME_MASK) - -/* An M_MASK with the SH and ME fields fixed. */ -#define MSHME_MASK (M_MASK | SH_MASK | ME_MASK) - -/* An MD form instruction. */ -#define MD(op, xop, rc) (OP (op) | ((((unsigned long)(xop)) & 0x7) << 2) | ((rc) & 1)) -#define MD_MASK MD (0x3f, 0x7, 1) - -/* An MD_MASK with the MB field fixed. */ -#define MDMB_MASK (MD_MASK | MB6_MASK) - -/* An MD_MASK with the SH field fixed. */ -#define MDSH_MASK (MD_MASK | SH6_MASK) - -/* An MDS form instruction. */ -#define MDS(op, xop, rc) (OP (op) | ((((unsigned long)(xop)) & 0xf) << 1) | ((rc) & 1)) -#define MDS_MASK MDS (0x3f, 0xf, 1) - -/* An MDS_MASK with the MB field fixed. */ -#define MDSMB_MASK (MDS_MASK | MB6_MASK) - -/* An SC form instruction. */ -#define SC(op, sa, lk) (OP (op) | ((((unsigned long)(sa)) & 1) << 1) | ((lk) & 1)) -#define SC_MASK (OP_MASK | (((unsigned long)0x3ff) << 16) | (((unsigned long)1) << 1) | 1) - -/* An VX form instruction. */ -#define VX(op, xop) (OP (op) | (((unsigned long)(xop)) & 0x7ff)) - -/* The mask for an VX form instruction. */ -#define VX_MASK VX(0x3f, 0x7ff) - -/* An VA form instruction. */ -#define VXA(op, xop) (OP (op) | (((unsigned long)(xop)) & 0x03f)) - -/* The mask for an VA form instruction. */ -#define VXA_MASK VXA(0x3f, 0x3f) - -/* An VXR form instruction. */ -#define VXR(op, xop, rc) (OP (op) | (((rc) & 1) << 10) | (((unsigned long)(xop)) & 0x3ff)) - -/* The mask for a VXR form instruction. */ -#define VXR_MASK VXR(0x3f, 0x3ff, 1) - -/* An X form instruction. */ -#define X(op, xop) (OP (op) | ((((unsigned long)(xop)) & 0x3ff) << 1)) - -/* A Z form instruction. */ -#define Z(op, xop) (OP (op) | ((((unsigned long)(xop)) & 0x1ff) << 1)) - -/* An X form instruction with the RC bit specified. */ -#define XRC(op, xop, rc) (X ((op), (xop)) | ((rc) & 1)) - -/* A Z form instruction with the RC bit specified. */ -#define ZRC(op, xop, rc) (Z ((op), (xop)) | ((rc) & 1)) - -/* The mask for an X form instruction. */ -#define X_MASK XRC (0x3f, 0x3ff, 1) - -/* The mask for a Z form instruction. */ -#define Z_MASK ZRC (0x3f, 0x1ff, 1) -#define Z2_MASK ZRC (0x3f, 0xff, 1) - -/* An X_MASK with the RA field fixed. */ -#define XRA_MASK (X_MASK | RA_MASK) - -/* An XRA_MASK with the W field clear. */ -#define XWRA_MASK (XRA_MASK & ~((unsigned long) 1 << 16)) - -/* An X_MASK with the RB field fixed. */ -#define XRB_MASK (X_MASK | RB_MASK) - -/* An X_MASK with the RT field fixed. */ -#define XRT_MASK (X_MASK | RT_MASK) - -/* An XRT_MASK mask with the L bits clear. */ -#define XLRT_MASK (XRT_MASK & ~((unsigned long) 0x3 << 21)) - -/* An X_MASK with the RA and RB fields fixed. */ -#define XRARB_MASK (X_MASK | RA_MASK | RB_MASK) - -/* An XRARB_MASK, but with the L bit clear. */ -#define XRLARB_MASK (XRARB_MASK & ~((unsigned long) 1 << 16)) - -/* An X_MASK with the RT and RA fields fixed. */ -#define XRTRA_MASK (X_MASK | RT_MASK | RA_MASK) - -/* An XRTRA_MASK, but with L bit clear. */ -#define XRTLRA_MASK (XRTRA_MASK & ~((unsigned long) 1 << 21)) - -/* An X form instruction with the L bit specified. */ -#define XOPL(op, xop, l) (X ((op), (xop)) | ((((unsigned long)(l)) & 1) << 21)) - -/* The mask for an X form comparison instruction. */ -#define XCMP_MASK (X_MASK | (((unsigned long)1) << 22)) - -/* The mask for an X form comparison instruction with the L field - fixed. */ -#define XCMPL_MASK (XCMP_MASK | (((unsigned long)1) << 21)) - -/* An X form trap instruction with the TO field specified. */ -#define XTO(op, xop, to) (X ((op), (xop)) | ((((unsigned long)(to)) & 0x1f) << 21)) -#define XTO_MASK (X_MASK | TO_MASK) - -/* An X form tlb instruction with the SH field specified. */ -#define XTLB(op, xop, sh) (X ((op), (xop)) | ((((unsigned long)(sh)) & 0x1f) << 11)) -#define XTLB_MASK (X_MASK | SH_MASK) - -/* An X form sync instruction. */ -#define XSYNC(op, xop, l) (X ((op), (xop)) | ((((unsigned long)(l)) & 3) << 21)) - -/* An X form sync instruction with everything filled in except the LS field. */ -#define XSYNC_MASK (0xff9fffff) - -/* An X_MASK, but with the EH bit clear. */ -#define XEH_MASK (X_MASK & ~((unsigned long )1)) - -/* An X form AltiVec dss instruction. */ -#define XDSS(op, xop, a) (X ((op), (xop)) | ((((unsigned long)(a)) & 1) << 25)) -#define XDSS_MASK XDSS(0x3f, 0x3ff, 1) - -/* An XFL form instruction. */ -#define XFL(op, xop, rc) (OP (op) | ((((unsigned long)(xop)) & 0x3ff) << 1) | (((unsigned long)(rc)) & 1)) -#define XFL_MASK XFL (0x3f, 0x3ff, 1) - -/* An X form isel instruction. */ -#define XISEL(op, xop) (OP (op) | ((((unsigned long)(xop)) & 0x1f) << 1)) -#define XISEL_MASK XISEL(0x3f, 0x1f) - -/* An XL form instruction with the LK field set to 0. */ -#define XL(op, xop) (OP (op) | ((((unsigned long)(xop)) & 0x3ff) << 1)) - -/* An XL form instruction which uses the LK field. */ -#define XLLK(op, xop, lk) (XL ((op), (xop)) | ((lk) & 1)) - -/* The mask for an XL form instruction. */ -#define XL_MASK XLLK (0x3f, 0x3ff, 1) - -/* An XL form instruction which explicitly sets the BO field. */ -#define XLO(op, bo, xop, lk) \ - (XLLK ((op), (xop), (lk)) | ((((unsigned long)(bo)) & 0x1f) << 21)) -#define XLO_MASK (XL_MASK | BO_MASK) - -/* An XL form instruction which explicitly sets the y bit of the BO - field. */ -#define XLYLK(op, xop, y, lk) (XLLK ((op), (xop), (lk)) | ((((unsigned long)(y)) & 1) << 21)) -#define XLYLK_MASK (XL_MASK | Y_MASK) - -/* An XL form instruction which sets the BO field and the condition - bits of the BI field. */ -#define XLOCB(op, bo, cb, xop, lk) \ - (XLO ((op), (bo), (xop), (lk)) | ((((unsigned long)(cb)) & 3) << 16)) -#define XLOCB_MASK XLOCB (0x3f, 0x1f, 0x3, 0x3ff, 1) - -/* An XL_MASK or XLYLK_MASK or XLOCB_MASK with the BB field fixed. */ -#define XLBB_MASK (XL_MASK | BB_MASK) -#define XLYBB_MASK (XLYLK_MASK | BB_MASK) -#define XLBOCBBB_MASK (XLOCB_MASK | BB_MASK) - -/* A mask for branch instructions using the BH field. */ -#define XLBH_MASK (XL_MASK | (0x1c << 11)) - -/* An XL_MASK with the BO and BB fields fixed. */ -#define XLBOBB_MASK (XL_MASK | BO_MASK | BB_MASK) - -/* An XL_MASK with the BO, BI and BB fields fixed. */ -#define XLBOBIBB_MASK (XL_MASK | BO_MASK | BI_MASK | BB_MASK) - -/* An XO form instruction. */ -#define XO(op, xop, oe, rc) \ - (OP (op) | ((((unsigned long)(xop)) & 0x1ff) << 1) | ((((unsigned long)(oe)) & 1) << 10) | (((unsigned long)(rc)) & 1)) -#define XO_MASK XO (0x3f, 0x1ff, 1, 1) - -/* An XO_MASK with the RB field fixed. */ -#define XORB_MASK (XO_MASK | RB_MASK) - -/* An XS form instruction. */ -#define XS(op, xop, rc) (OP (op) | ((((unsigned long)(xop)) & 0x1ff) << 2) | (((unsigned long)(rc)) & 1)) -#define XS_MASK XS (0x3f, 0x1ff, 1) - -/* A mask for the FXM version of an XFX form instruction. */ -#define XFXFXM_MASK (X_MASK | (1 << 11) | (1 << 20)) - -/* An XFX form instruction with the FXM field filled in. */ -#define XFXM(op, xop, fxm, p4) \ - (X ((op), (xop)) | ((((unsigned long)(fxm)) & 0xff) << 12) \ - | ((unsigned long)(p4) << 20)) - -/* An XFX form instruction with the SPR field filled in. */ -#define XSPR(op, xop, spr) \ - (X ((op), (xop)) | ((((unsigned long)(spr)) & 0x1f) << 16) | ((((unsigned long)(spr)) & 0x3e0) << 6)) -#define XSPR_MASK (X_MASK | SPR_MASK) - -/* An XFX form instruction with the SPR field filled in except for the - SPRBAT field. */ -#define XSPRBAT_MASK (XSPR_MASK &~ SPRBAT_MASK) - -/* An XFX form instruction with the SPR field filled in except for the - SPRG field. */ -#define XSPRG_MASK (XSPR_MASK & ~(0x1f << 16)) - -/* An X form instruction with everything filled in except the E field. */ -#define XE_MASK (0xffff7fff) - -/* An X form user context instruction. */ -#define XUC(op, xop) (OP (op) | (((unsigned long)(xop)) & 0x1f)) -#define XUC_MASK XUC(0x3f, 0x1f) - -/* The BO encodings used in extended conditional branch mnemonics. */ -#define BODNZF (0x0) -#define BODNZFP (0x1) -#define BODZF (0x2) -#define BODZFP (0x3) -#define BODNZT (0x8) -#define BODNZTP (0x9) -#define BODZT (0xa) -#define BODZTP (0xb) - -#define BOF (0x4) -#define BOFP (0x5) -#define BOFM4 (0x6) -#define BOFP4 (0x7) -#define BOT (0xc) -#define BOTP (0xd) -#define BOTM4 (0xe) -#define BOTP4 (0xf) - -#define BODNZ (0x10) -#define BODNZP (0x11) -#define BODZ (0x12) -#define BODZP (0x13) -#define BODNZM4 (0x18) -#define BODNZP4 (0x19) -#define BODZM4 (0x1a) -#define BODZP4 (0x1b) - -#define BOU (0x14) - -/* The BI condition bit encodings used in extended conditional branch - mnemonics. */ -#define CBLT (0) -#define CBGT (1) -#define CBEQ (2) -#define CBSO (3) - -/* The TO encodings used in extended trap mnemonics. */ -#define TOLGT (0x1) -#define TOLLT (0x2) -#define TOEQ (0x4) -#define TOLGE (0x5) -#define TOLNL (0x5) -#define TOLLE (0x6) -#define TOLNG (0x6) -#define TOGT (0x8) -#define TOGE (0xc) -#define TONL (0xc) -#define TOLT (0x10) -#define TOLE (0x14) -#define TONG (0x14) -#define TONE (0x18) -#define TOU (0x1f) - -/* Smaller names for the flags so each entry in the opcodes table will - fit on a single line. */ -#undef PPC -#define PPC PPC_OPCODE_PPC -#define PPCCOM PPC_OPCODE_PPC | PPC_OPCODE_COMMON -#define NOPOWER4 PPC_OPCODE_NOPOWER4 | PPCCOM -#define POWER4 PPC_OPCODE_POWER4 -#define POWER5 PPC_OPCODE_POWER5 -#define POWER6 PPC_OPCODE_POWER6 -#define CELL PPC_OPCODE_CELL -#define PPC32 PPC_OPCODE_32 | PPC_OPCODE_PPC -#define PPC64 PPC_OPCODE_64 | PPC_OPCODE_PPC -#define PPC403 PPC_OPCODE_403 -#define PPC405 PPC403 -#define PPC440 PPC_OPCODE_440 -#define PPC750 PPC -#define PPC860 PPC -#define PPCVEC PPC_OPCODE_ALTIVEC -#define POWER PPC_OPCODE_POWER -#define POWER2 PPC_OPCODE_POWER | PPC_OPCODE_POWER2 -#define PPCPWR2 PPC_OPCODE_PPC | PPC_OPCODE_POWER | PPC_OPCODE_POWER2 -#define POWER32 PPC_OPCODE_POWER | PPC_OPCODE_32 -#define COM PPC_OPCODE_POWER | PPC_OPCODE_PPC | PPC_OPCODE_COMMON -#define COM32 PPC_OPCODE_POWER | PPC_OPCODE_PPC | PPC_OPCODE_COMMON | PPC_OPCODE_32 -#define M601 PPC_OPCODE_POWER | PPC_OPCODE_601 -#define PWRCOM PPC_OPCODE_POWER | PPC_OPCODE_601 | PPC_OPCODE_COMMON -#define MFDEC1 PPC_OPCODE_POWER -#define MFDEC2 PPC_OPCODE_PPC | PPC_OPCODE_601 | PPC_OPCODE_BOOKE -#define BOOKE PPC_OPCODE_BOOKE -#define BOOKE64 PPC_OPCODE_BOOKE64 -#define CLASSIC PPC_OPCODE_CLASSIC -#define PPCE300 PPC_OPCODE_E300 -#define PPCSPE PPC_OPCODE_SPE -#define PPCISEL PPC_OPCODE_ISEL -#define PPCEFS PPC_OPCODE_EFS -#define PPCBRLK PPC_OPCODE_BRLOCK -#define PPCPMR PPC_OPCODE_PMR -#define PPCCHLK PPC_OPCODE_CACHELCK -#define PPCCHLK64 PPC_OPCODE_CACHELCK | PPC_OPCODE_BOOKE64 -#define PPCRFMCI PPC_OPCODE_RFMCI - -/* The opcode table. - - The format of the opcode table is: - - NAME OPCODE MASK FLAGS { OPERANDS } - - NAME is the name of the instruction. - OPCODE is the instruction opcode. - MASK is the opcode mask; this is used to tell the disassembler - which bits in the actual opcode must match OPCODE. - FLAGS are flags indicated what processors support the instruction. - OPERANDS is the list of operands. - - The disassembler reads the table in order and prints the first - instruction which matches, so this table is sorted to put more - specific instructions before more general instructions. It is also - sorted by major opcode. */ - -const struct powerpc_opcode powerpc_opcodes[] = { -{ "attn", X(0,256), X_MASK, POWER4, { 0 } }, -{ "tdlgti", OPTO(2,TOLGT), OPTO_MASK, PPC64, { RA, SI } }, -{ "tdllti", OPTO(2,TOLLT), OPTO_MASK, PPC64, { RA, SI } }, -{ "tdeqi", OPTO(2,TOEQ), OPTO_MASK, PPC64, { RA, SI } }, -{ "tdlgei", OPTO(2,TOLGE), OPTO_MASK, PPC64, { RA, SI } }, -{ "tdlnli", OPTO(2,TOLNL), OPTO_MASK, PPC64, { RA, SI } }, -{ "tdllei", OPTO(2,TOLLE), OPTO_MASK, PPC64, { RA, SI } }, -{ "tdlngi", OPTO(2,TOLNG), OPTO_MASK, PPC64, { RA, SI } }, -{ "tdgti", OPTO(2,TOGT), OPTO_MASK, PPC64, { RA, SI } }, -{ "tdgei", OPTO(2,TOGE), OPTO_MASK, PPC64, { RA, SI } }, -{ "tdnli", OPTO(2,TONL), OPTO_MASK, PPC64, { RA, SI } }, -{ "tdlti", OPTO(2,TOLT), OPTO_MASK, PPC64, { RA, SI } }, -{ "tdlei", OPTO(2,TOLE), OPTO_MASK, PPC64, { RA, SI } }, -{ "tdngi", OPTO(2,TONG), OPTO_MASK, PPC64, { RA, SI } }, -{ "tdnei", OPTO(2,TONE), OPTO_MASK, PPC64, { RA, SI } }, -{ "tdi", OP(2), OP_MASK, PPC64, { TO, RA, SI } }, - -{ "twlgti", OPTO(3,TOLGT), OPTO_MASK, PPCCOM, { RA, SI } }, -{ "tlgti", OPTO(3,TOLGT), OPTO_MASK, PWRCOM, { RA, SI } }, -{ "twllti", OPTO(3,TOLLT), OPTO_MASK, PPCCOM, { RA, SI } }, -{ "tllti", OPTO(3,TOLLT), OPTO_MASK, PWRCOM, { RA, SI } }, -{ "tweqi", OPTO(3,TOEQ), OPTO_MASK, PPCCOM, { RA, SI } }, -{ "teqi", OPTO(3,TOEQ), OPTO_MASK, PWRCOM, { RA, SI } }, -{ "twlgei", OPTO(3,TOLGE), OPTO_MASK, PPCCOM, { RA, SI } }, -{ "tlgei", OPTO(3,TOLGE), OPTO_MASK, PWRCOM, { RA, SI } }, -{ "twlnli", OPTO(3,TOLNL), OPTO_MASK, PPCCOM, { RA, SI } }, -{ "tlnli", OPTO(3,TOLNL), OPTO_MASK, PWRCOM, { RA, SI } }, -{ "twllei", OPTO(3,TOLLE), OPTO_MASK, PPCCOM, { RA, SI } }, -{ "tllei", OPTO(3,TOLLE), OPTO_MASK, PWRCOM, { RA, SI } }, -{ "twlngi", OPTO(3,TOLNG), OPTO_MASK, PPCCOM, { RA, SI } }, -{ "tlngi", OPTO(3,TOLNG), OPTO_MASK, PWRCOM, { RA, SI } }, -{ "twgti", OPTO(3,TOGT), OPTO_MASK, PPCCOM, { RA, SI } }, -{ "tgti", OPTO(3,TOGT), OPTO_MASK, PWRCOM, { RA, SI } }, -{ "twgei", OPTO(3,TOGE), OPTO_MASK, PPCCOM, { RA, SI } }, -{ "tgei", OPTO(3,TOGE), OPTO_MASK, PWRCOM, { RA, SI } }, -{ "twnli", OPTO(3,TONL), OPTO_MASK, PPCCOM, { RA, SI } }, -{ "tnli", OPTO(3,TONL), OPTO_MASK, PWRCOM, { RA, SI } }, -{ "twlti", OPTO(3,TOLT), OPTO_MASK, PPCCOM, { RA, SI } }, -{ "tlti", OPTO(3,TOLT), OPTO_MASK, PWRCOM, { RA, SI } }, -{ "twlei", OPTO(3,TOLE), OPTO_MASK, PPCCOM, { RA, SI } }, -{ "tlei", OPTO(3,TOLE), OPTO_MASK, PWRCOM, { RA, SI } }, -{ "twngi", OPTO(3,TONG), OPTO_MASK, PPCCOM, { RA, SI } }, -{ "tngi", OPTO(3,TONG), OPTO_MASK, PWRCOM, { RA, SI } }, -{ "twnei", OPTO(3,TONE), OPTO_MASK, PPCCOM, { RA, SI } }, -{ "tnei", OPTO(3,TONE), OPTO_MASK, PWRCOM, { RA, SI } }, -{ "twi", OP(3), OP_MASK, PPCCOM, { TO, RA, SI } }, -{ "ti", OP(3), OP_MASK, PWRCOM, { TO, RA, SI } }, - -{ "macchw", XO(4,172,0,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "macchw.", XO(4,172,0,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "macchwo", XO(4,172,1,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "macchwo.", XO(4,172,1,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "macchws", XO(4,236,0,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "macchws.", XO(4,236,0,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "macchwso", XO(4,236,1,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "macchwso.", XO(4,236,1,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "macchwsu", XO(4,204,0,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "macchwsu.", XO(4,204,0,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "macchwsuo", XO(4,204,1,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "macchwsuo.", XO(4,204,1,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "macchwu", XO(4,140,0,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "macchwu.", XO(4,140,0,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "macchwuo", XO(4,140,1,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "macchwuo.", XO(4,140,1,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "machhw", XO(4,44,0,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "machhw.", XO(4,44,0,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "machhwo", XO(4,44,1,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "machhwo.", XO(4,44,1,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "machhws", XO(4,108,0,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "machhws.", XO(4,108,0,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "machhwso", XO(4,108,1,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "machhwso.", XO(4,108,1,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "machhwsu", XO(4,76,0,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "machhwsu.", XO(4,76,0,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "machhwsuo", XO(4,76,1,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "machhwsuo.", XO(4,76,1,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "machhwu", XO(4,12,0,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "machhwu.", XO(4,12,0,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "machhwuo", XO(4,12,1,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "machhwuo.", XO(4,12,1,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "maclhw", XO(4,428,0,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "maclhw.", XO(4,428,0,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "maclhwo", XO(4,428,1,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "maclhwo.", XO(4,428,1,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "maclhws", XO(4,492,0,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "maclhws.", XO(4,492,0,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "maclhwso", XO(4,492,1,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "maclhwso.", XO(4,492,1,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "maclhwsu", XO(4,460,0,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "maclhwsu.", XO(4,460,0,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "maclhwsuo", XO(4,460,1,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "maclhwsuo.", XO(4,460,1,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "maclhwu", XO(4,396,0,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "maclhwu.", XO(4,396,0,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "maclhwuo", XO(4,396,1,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "maclhwuo.", XO(4,396,1,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "mulchw", XRC(4,168,0), X_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "mulchw.", XRC(4,168,1), X_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "mulchwu", XRC(4,136,0), X_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "mulchwu.", XRC(4,136,1), X_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "mulhhw", XRC(4,40,0), X_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "mulhhw.", XRC(4,40,1), X_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "mulhhwu", XRC(4,8,0), X_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "mulhhwu.", XRC(4,8,1), X_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "mullhw", XRC(4,424,0), X_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "mullhw.", XRC(4,424,1), X_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "mullhwu", XRC(4,392,0), X_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "mullhwu.", XRC(4,392,1), X_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "nmacchw", XO(4,174,0,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "nmacchw.", XO(4,174,0,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "nmacchwo", XO(4,174,1,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "nmacchwo.", XO(4,174,1,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "nmacchws", XO(4,238,0,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "nmacchws.", XO(4,238,0,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "nmacchwso", XO(4,238,1,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "nmacchwso.", XO(4,238,1,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "nmachhw", XO(4,46,0,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "nmachhw.", XO(4,46,0,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "nmachhwo", XO(4,46,1,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "nmachhwo.", XO(4,46,1,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "nmachhws", XO(4,110,0,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "nmachhws.", XO(4,110,0,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "nmachhwso", XO(4,110,1,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "nmachhwso.", XO(4,110,1,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "nmaclhw", XO(4,430,0,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "nmaclhw.", XO(4,430,0,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "nmaclhwo", XO(4,430,1,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "nmaclhwo.", XO(4,430,1,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "nmaclhws", XO(4,494,0,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "nmaclhws.", XO(4,494,0,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "nmaclhwso", XO(4,494,1,0), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "nmaclhwso.", XO(4,494,1,1), XO_MASK, PPC405|PPC440, { RT, RA, RB } }, -{ "mfvscr", VX(4, 1540), VX_MASK, PPCVEC, { VD } }, -{ "mtvscr", VX(4, 1604), VX_MASK, PPCVEC, { VB } }, - - /* Double-precision opcodes. */ - /* Some of these conflict with AltiVec, so move them before, since - PPCVEC includes the PPC_OPCODE_PPC set. */ -{ "efscfd", VX(4, 719), VX_MASK, PPCEFS, { RS, RB } }, -{ "efdabs", VX(4, 740), VX_MASK, PPCEFS, { RS, RA } }, -{ "efdnabs", VX(4, 741), VX_MASK, PPCEFS, { RS, RA } }, -{ "efdneg", VX(4, 742), VX_MASK, PPCEFS, { RS, RA } }, -{ "efdadd", VX(4, 736), VX_MASK, PPCEFS, { RS, RA, RB } }, -{ "efdsub", VX(4, 737), VX_MASK, PPCEFS, { RS, RA, RB } }, -{ "efdmul", VX(4, 744), VX_MASK, PPCEFS, { RS, RA, RB } }, -{ "efddiv", VX(4, 745), VX_MASK, PPCEFS, { RS, RA, RB } }, -{ "efdcmpgt", VX(4, 748), VX_MASK, PPCEFS, { CRFD, RA, RB } }, -{ "efdcmplt", VX(4, 749), VX_MASK, PPCEFS, { CRFD, RA, RB } }, -{ "efdcmpeq", VX(4, 750), VX_MASK, PPCEFS, { CRFD, RA, RB } }, -{ "efdtstgt", VX(4, 764), VX_MASK, PPCEFS, { CRFD, RA, RB } }, -{ "efdtstlt", VX(4, 765), VX_MASK, PPCEFS, { CRFD, RA, RB } }, -{ "efdtsteq", VX(4, 766), VX_MASK, PPCEFS, { CRFD, RA, RB } }, -{ "efdcfsi", VX(4, 753), VX_MASK, PPCEFS, { RS, RB } }, -{ "efdcfsid", VX(4, 739), VX_MASK, PPCEFS, { RS, RB } }, -{ "efdcfui", VX(4, 752), VX_MASK, PPCEFS, { RS, RB } }, -{ "efdcfuid", VX(4, 738), VX_MASK, PPCEFS, { RS, RB } }, -{ "efdcfsf", VX(4, 755), VX_MASK, PPCEFS, { RS, RB } }, -{ "efdcfuf", VX(4, 754), VX_MASK, PPCEFS, { RS, RB } }, -{ "efdctsi", VX(4, 757), VX_MASK, PPCEFS, { RS, RB } }, -{ "efdctsidz",VX(4, 747), VX_MASK, PPCEFS, { RS, RB } }, -{ "efdctsiz", VX(4, 762), VX_MASK, PPCEFS, { RS, RB } }, -{ "efdctui", VX(4, 756), VX_MASK, PPCEFS, { RS, RB } }, -{ "efdctuidz",VX(4, 746), VX_MASK, PPCEFS, { RS, RB } }, -{ "efdctuiz", VX(4, 760), VX_MASK, PPCEFS, { RS, RB } }, -{ "efdctsf", VX(4, 759), VX_MASK, PPCEFS, { RS, RB } }, -{ "efdctuf", VX(4, 758), VX_MASK, PPCEFS, { RS, RB } }, -{ "efdcfs", VX(4, 751), VX_MASK, PPCEFS, { RS, RB } }, - /* End of double-precision opcodes. */ - -{ "vaddcuw", VX(4, 384), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vaddfp", VX(4, 10), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vaddsbs", VX(4, 768), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vaddshs", VX(4, 832), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vaddsws", VX(4, 896), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vaddubm", VX(4, 0), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vaddubs", VX(4, 512), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vadduhm", VX(4, 64), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vadduhs", VX(4, 576), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vadduwm", VX(4, 128), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vadduws", VX(4, 640), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vand", VX(4, 1028), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vandc", VX(4, 1092), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vavgsb", VX(4, 1282), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vavgsh", VX(4, 1346), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vavgsw", VX(4, 1410), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vavgub", VX(4, 1026), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vavguh", VX(4, 1090), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vavguw", VX(4, 1154), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vcfsx", VX(4, 842), VX_MASK, PPCVEC, { VD, VB, UIMM } }, -{ "vcfux", VX(4, 778), VX_MASK, PPCVEC, { VD, VB, UIMM } }, -{ "vcmpbfp", VXR(4, 966, 0), VXR_MASK, PPCVEC, { VD, VA, VB } }, -{ "vcmpbfp.", VXR(4, 966, 1), VXR_MASK, PPCVEC, { VD, VA, VB } }, -{ "vcmpeqfp", VXR(4, 198, 0), VXR_MASK, PPCVEC, { VD, VA, VB } }, -{ "vcmpeqfp.", VXR(4, 198, 1), VXR_MASK, PPCVEC, { VD, VA, VB } }, -{ "vcmpequb", VXR(4, 6, 0), VXR_MASK, PPCVEC, { VD, VA, VB } }, -{ "vcmpequb.", VXR(4, 6, 1), VXR_MASK, PPCVEC, { VD, VA, VB } }, -{ "vcmpequh", VXR(4, 70, 0), VXR_MASK, PPCVEC, { VD, VA, VB } }, -{ "vcmpequh.", VXR(4, 70, 1), VXR_MASK, PPCVEC, { VD, VA, VB } }, -{ "vcmpequw", VXR(4, 134, 0), VXR_MASK, PPCVEC, { VD, VA, VB } }, -{ "vcmpequw.", VXR(4, 134, 1), VXR_MASK, PPCVEC, { VD, VA, VB } }, -{ "vcmpgefp", VXR(4, 454, 0), VXR_MASK, PPCVEC, { VD, VA, VB } }, -{ "vcmpgefp.", VXR(4, 454, 1), VXR_MASK, PPCVEC, { VD, VA, VB } }, -{ "vcmpgtfp", VXR(4, 710, 0), VXR_MASK, PPCVEC, { VD, VA, VB } }, -{ "vcmpgtfp.", VXR(4, 710, 1), VXR_MASK, PPCVEC, { VD, VA, VB } }, -{ "vcmpgtsb", VXR(4, 774, 0), VXR_MASK, PPCVEC, { VD, VA, VB } }, -{ "vcmpgtsb.", VXR(4, 774, 1), VXR_MASK, PPCVEC, { VD, VA, VB } }, -{ "vcmpgtsh", VXR(4, 838, 0), VXR_MASK, PPCVEC, { VD, VA, VB } }, -{ "vcmpgtsh.", VXR(4, 838, 1), VXR_MASK, PPCVEC, { VD, VA, VB } }, -{ "vcmpgtsw", VXR(4, 902, 0), VXR_MASK, PPCVEC, { VD, VA, VB } }, -{ "vcmpgtsw.", VXR(4, 902, 1), VXR_MASK, PPCVEC, { VD, VA, VB } }, -{ "vcmpgtub", VXR(4, 518, 0), VXR_MASK, PPCVEC, { VD, VA, VB } }, -{ "vcmpgtub.", VXR(4, 518, 1), VXR_MASK, PPCVEC, { VD, VA, VB } }, -{ "vcmpgtuh", VXR(4, 582, 0), VXR_MASK, PPCVEC, { VD, VA, VB } }, -{ "vcmpgtuh.", VXR(4, 582, 1), VXR_MASK, PPCVEC, { VD, VA, VB } }, -{ "vcmpgtuw", VXR(4, 646, 0), VXR_MASK, PPCVEC, { VD, VA, VB } }, -{ "vcmpgtuw.", VXR(4, 646, 1), VXR_MASK, PPCVEC, { VD, VA, VB } }, -{ "vctsxs", VX(4, 970), VX_MASK, PPCVEC, { VD, VB, UIMM } }, -{ "vctuxs", VX(4, 906), VX_MASK, PPCVEC, { VD, VB, UIMM } }, -{ "vexptefp", VX(4, 394), VX_MASK, PPCVEC, { VD, VB } }, -{ "vlogefp", VX(4, 458), VX_MASK, PPCVEC, { VD, VB } }, -{ "vmaddfp", VXA(4, 46), VXA_MASK, PPCVEC, { VD, VA, VC, VB } }, -{ "vmaxfp", VX(4, 1034), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vmaxsb", VX(4, 258), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vmaxsh", VX(4, 322), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vmaxsw", VX(4, 386), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vmaxub", VX(4, 2), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vmaxuh", VX(4, 66), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vmaxuw", VX(4, 130), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vmhaddshs", VXA(4, 32), VXA_MASK, PPCVEC, { VD, VA, VB, VC } }, -{ "vmhraddshs", VXA(4, 33), VXA_MASK, PPCVEC, { VD, VA, VB, VC } }, -{ "vminfp", VX(4, 1098), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vminsb", VX(4, 770), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vminsh", VX(4, 834), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vminsw", VX(4, 898), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vminub", VX(4, 514), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vminuh", VX(4, 578), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vminuw", VX(4, 642), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vmladduhm", VXA(4, 34), VXA_MASK, PPCVEC, { VD, VA, VB, VC } }, -{ "vmrghb", VX(4, 12), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vmrghh", VX(4, 76), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vmrghw", VX(4, 140), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vmrglb", VX(4, 268), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vmrglh", VX(4, 332), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vmrglw", VX(4, 396), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vmsummbm", VXA(4, 37), VXA_MASK, PPCVEC, { VD, VA, VB, VC } }, -{ "vmsumshm", VXA(4, 40), VXA_MASK, PPCVEC, { VD, VA, VB, VC } }, -{ "vmsumshs", VXA(4, 41), VXA_MASK, PPCVEC, { VD, VA, VB, VC } }, -{ "vmsumubm", VXA(4, 36), VXA_MASK, PPCVEC, { VD, VA, VB, VC } }, -{ "vmsumuhm", VXA(4, 38), VXA_MASK, PPCVEC, { VD, VA, VB, VC } }, -{ "vmsumuhs", VXA(4, 39), VXA_MASK, PPCVEC, { VD, VA, VB, VC } }, -{ "vmulesb", VX(4, 776), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vmulesh", VX(4, 840), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vmuleub", VX(4, 520), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vmuleuh", VX(4, 584), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vmulosb", VX(4, 264), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vmulosh", VX(4, 328), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vmuloub", VX(4, 8), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vmulouh", VX(4, 72), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vnmsubfp", VXA(4, 47), VXA_MASK, PPCVEC, { VD, VA, VC, VB } }, -{ "vnor", VX(4, 1284), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vor", VX(4, 1156), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vperm", VXA(4, 43), VXA_MASK, PPCVEC, { VD, VA, VB, VC } }, -{ "vpkpx", VX(4, 782), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vpkshss", VX(4, 398), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vpkshus", VX(4, 270), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vpkswss", VX(4, 462), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vpkswus", VX(4, 334), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vpkuhum", VX(4, 14), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vpkuhus", VX(4, 142), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vpkuwum", VX(4, 78), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vpkuwus", VX(4, 206), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vrefp", VX(4, 266), VX_MASK, PPCVEC, { VD, VB } }, -{ "vrfim", VX(4, 714), VX_MASK, PPCVEC, { VD, VB } }, -{ "vrfin", VX(4, 522), VX_MASK, PPCVEC, { VD, VB } }, -{ "vrfip", VX(4, 650), VX_MASK, PPCVEC, { VD, VB } }, -{ "vrfiz", VX(4, 586), VX_MASK, PPCVEC, { VD, VB } }, -{ "vrlb", VX(4, 4), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vrlh", VX(4, 68), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vrlw", VX(4, 132), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vrsqrtefp", VX(4, 330), VX_MASK, PPCVEC, { VD, VB } }, -{ "vsel", VXA(4, 42), VXA_MASK, PPCVEC, { VD, VA, VB, VC } }, -{ "vsl", VX(4, 452), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vslb", VX(4, 260), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vsldoi", VXA(4, 44), VXA_MASK, PPCVEC, { VD, VA, VB, SHB } }, -{ "vslh", VX(4, 324), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vslo", VX(4, 1036), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vslw", VX(4, 388), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vspltb", VX(4, 524), VX_MASK, PPCVEC, { VD, VB, UIMM } }, -{ "vsplth", VX(4, 588), VX_MASK, PPCVEC, { VD, VB, UIMM } }, -{ "vspltisb", VX(4, 780), VX_MASK, PPCVEC, { VD, SIMM } }, -{ "vspltish", VX(4, 844), VX_MASK, PPCVEC, { VD, SIMM } }, -{ "vspltisw", VX(4, 908), VX_MASK, PPCVEC, { VD, SIMM } }, -{ "vspltw", VX(4, 652), VX_MASK, PPCVEC, { VD, VB, UIMM } }, -{ "vsr", VX(4, 708), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vsrab", VX(4, 772), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vsrah", VX(4, 836), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vsraw", VX(4, 900), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vsrb", VX(4, 516), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vsrh", VX(4, 580), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vsro", VX(4, 1100), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vsrw", VX(4, 644), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vsubcuw", VX(4, 1408), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vsubfp", VX(4, 74), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vsubsbs", VX(4, 1792), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vsubshs", VX(4, 1856), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vsubsws", VX(4, 1920), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vsububm", VX(4, 1024), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vsububs", VX(4, 1536), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vsubuhm", VX(4, 1088), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vsubuhs", VX(4, 1600), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vsubuwm", VX(4, 1152), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vsubuws", VX(4, 1664), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vsumsws", VX(4, 1928), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vsum2sws", VX(4, 1672), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vsum4sbs", VX(4, 1800), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vsum4shs", VX(4, 1608), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vsum4ubs", VX(4, 1544), VX_MASK, PPCVEC, { VD, VA, VB } }, -{ "vupkhpx", VX(4, 846), VX_MASK, PPCVEC, { VD, VB } }, -{ "vupkhsb", VX(4, 526), VX_MASK, PPCVEC, { VD, VB } }, -{ "vupkhsh", VX(4, 590), VX_MASK, PPCVEC, { VD, VB } }, -{ "vupklpx", VX(4, 974), VX_MASK, PPCVEC, { VD, VB } }, -{ "vupklsb", VX(4, 654), VX_MASK, PPCVEC, { VD, VB } }, -{ "vupklsh", VX(4, 718), VX_MASK, PPCVEC, { VD, VB } }, -{ "vxor", VX(4, 1220), VX_MASK, PPCVEC, { VD, VA, VB } }, - -{ "evaddw", VX(4, 512), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evaddiw", VX(4, 514), VX_MASK, PPCSPE, { RS, RB, UIMM } }, -{ "evsubfw", VX(4, 516), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evsubw", VX(4, 516), VX_MASK, PPCSPE, { RS, RB, RA } }, -{ "evsubifw", VX(4, 518), VX_MASK, PPCSPE, { RS, UIMM, RB } }, -{ "evsubiw", VX(4, 518), VX_MASK, PPCSPE, { RS, RB, UIMM } }, -{ "evabs", VX(4, 520), VX_MASK, PPCSPE, { RS, RA } }, -{ "evneg", VX(4, 521), VX_MASK, PPCSPE, { RS, RA } }, -{ "evextsb", VX(4, 522), VX_MASK, PPCSPE, { RS, RA } }, -{ "evextsh", VX(4, 523), VX_MASK, PPCSPE, { RS, RA } }, -{ "evrndw", VX(4, 524), VX_MASK, PPCSPE, { RS, RA } }, -{ "evcntlzw", VX(4, 525), VX_MASK, PPCSPE, { RS, RA } }, -{ "evcntlsw", VX(4, 526), VX_MASK, PPCSPE, { RS, RA } }, - -{ "brinc", VX(4, 527), VX_MASK, PPCSPE, { RS, RA, RB } }, - -{ "evand", VX(4, 529), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evandc", VX(4, 530), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmr", VX(4, 535), VX_MASK, PPCSPE, { RS, RA, BBA } }, -{ "evor", VX(4, 535), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evorc", VX(4, 539), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evxor", VX(4, 534), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "eveqv", VX(4, 537), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evnand", VX(4, 542), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evnot", VX(4, 536), VX_MASK, PPCSPE, { RS, RA, BBA } }, -{ "evnor", VX(4, 536), VX_MASK, PPCSPE, { RS, RA, RB } }, - -{ "evrlw", VX(4, 552), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evrlwi", VX(4, 554), VX_MASK, PPCSPE, { RS, RA, EVUIMM } }, -{ "evslw", VX(4, 548), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evslwi", VX(4, 550), VX_MASK, PPCSPE, { RS, RA, EVUIMM } }, -{ "evsrws", VX(4, 545), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evsrwu", VX(4, 544), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evsrwis", VX(4, 547), VX_MASK, PPCSPE, { RS, RA, EVUIMM } }, -{ "evsrwiu", VX(4, 546), VX_MASK, PPCSPE, { RS, RA, EVUIMM } }, -{ "evsplati", VX(4, 553), VX_MASK, PPCSPE, { RS, SIMM } }, -{ "evsplatfi", VX(4, 555), VX_MASK, PPCSPE, { RS, SIMM } }, -{ "evmergehi", VX(4, 556), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmergelo", VX(4, 557), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmergehilo",VX(4,558), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmergelohi",VX(4,559), VX_MASK, PPCSPE, { RS, RA, RB } }, - -{ "evcmpgts", VX(4, 561), VX_MASK, PPCSPE, { CRFD, RA, RB } }, -{ "evcmpgtu", VX(4, 560), VX_MASK, PPCSPE, { CRFD, RA, RB } }, -{ "evcmplts", VX(4, 563), VX_MASK, PPCSPE, { CRFD, RA, RB } }, -{ "evcmpltu", VX(4, 562), VX_MASK, PPCSPE, { CRFD, RA, RB } }, -{ "evcmpeq", VX(4, 564), VX_MASK, PPCSPE, { CRFD, RA, RB } }, -{ "evsel", EVSEL(4,79),EVSEL_MASK, PPCSPE, { RS, RA, RB, CRFS } }, - -{ "evldd", VX(4, 769), VX_MASK, PPCSPE, { RS, EVUIMM_8, RA } }, -{ "evlddx", VX(4, 768), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evldw", VX(4, 771), VX_MASK, PPCSPE, { RS, EVUIMM_8, RA } }, -{ "evldwx", VX(4, 770), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evldh", VX(4, 773), VX_MASK, PPCSPE, { RS, EVUIMM_8, RA } }, -{ "evldhx", VX(4, 772), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evlwhe", VX(4, 785), VX_MASK, PPCSPE, { RS, EVUIMM_4, RA } }, -{ "evlwhex", VX(4, 784), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evlwhou", VX(4, 789), VX_MASK, PPCSPE, { RS, EVUIMM_4, RA } }, -{ "evlwhoux", VX(4, 788), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evlwhos", VX(4, 791), VX_MASK, PPCSPE, { RS, EVUIMM_4, RA } }, -{ "evlwhosx", VX(4, 790), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evlwwsplat",VX(4, 793), VX_MASK, PPCSPE, { RS, EVUIMM_4, RA } }, -{ "evlwwsplatx",VX(4, 792), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evlwhsplat",VX(4, 797), VX_MASK, PPCSPE, { RS, EVUIMM_4, RA } }, -{ "evlwhsplatx",VX(4, 796), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evlhhesplat",VX(4, 777), VX_MASK, PPCSPE, { RS, EVUIMM_2, RA } }, -{ "evlhhesplatx",VX(4, 776), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evlhhousplat",VX(4, 781), VX_MASK, PPCSPE, { RS, EVUIMM_2, RA } }, -{ "evlhhousplatx",VX(4, 780), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evlhhossplat",VX(4, 783), VX_MASK, PPCSPE, { RS, EVUIMM_2, RA } }, -{ "evlhhossplatx",VX(4, 782), VX_MASK, PPCSPE, { RS, RA, RB } }, - -{ "evstdd", VX(4, 801), VX_MASK, PPCSPE, { RS, EVUIMM_8, RA } }, -{ "evstddx", VX(4, 800), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evstdw", VX(4, 803), VX_MASK, PPCSPE, { RS, EVUIMM_8, RA } }, -{ "evstdwx", VX(4, 802), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evstdh", VX(4, 805), VX_MASK, PPCSPE, { RS, EVUIMM_8, RA } }, -{ "evstdhx", VX(4, 804), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evstwwe", VX(4, 825), VX_MASK, PPCSPE, { RS, EVUIMM_4, RA } }, -{ "evstwwex", VX(4, 824), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evstwwo", VX(4, 829), VX_MASK, PPCSPE, { RS, EVUIMM_4, RA } }, -{ "evstwwox", VX(4, 828), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evstwhe", VX(4, 817), VX_MASK, PPCSPE, { RS, EVUIMM_4, RA } }, -{ "evstwhex", VX(4, 816), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evstwho", VX(4, 821), VX_MASK, PPCSPE, { RS, EVUIMM_4, RA } }, -{ "evstwhox", VX(4, 820), VX_MASK, PPCSPE, { RS, RA, RB } }, - -{ "evfsabs", VX(4, 644), VX_MASK, PPCSPE, { RS, RA } }, -{ "evfsnabs", VX(4, 645), VX_MASK, PPCSPE, { RS, RA } }, -{ "evfsneg", VX(4, 646), VX_MASK, PPCSPE, { RS, RA } }, -{ "evfsadd", VX(4, 640), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evfssub", VX(4, 641), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evfsmul", VX(4, 648), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evfsdiv", VX(4, 649), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evfscmpgt", VX(4, 652), VX_MASK, PPCSPE, { CRFD, RA, RB } }, -{ "evfscmplt", VX(4, 653), VX_MASK, PPCSPE, { CRFD, RA, RB } }, -{ "evfscmpeq", VX(4, 654), VX_MASK, PPCSPE, { CRFD, RA, RB } }, -{ "evfststgt", VX(4, 668), VX_MASK, PPCSPE, { CRFD, RA, RB } }, -{ "evfststlt", VX(4, 669), VX_MASK, PPCSPE, { CRFD, RA, RB } }, -{ "evfststeq", VX(4, 670), VX_MASK, PPCSPE, { CRFD, RA, RB } }, -{ "evfscfui", VX(4, 656), VX_MASK, PPCSPE, { RS, RB } }, -{ "evfsctuiz", VX(4, 664), VX_MASK, PPCSPE, { RS, RB } }, -{ "evfscfsi", VX(4, 657), VX_MASK, PPCSPE, { RS, RB } }, -{ "evfscfuf", VX(4, 658), VX_MASK, PPCSPE, { RS, RB } }, -{ "evfscfsf", VX(4, 659), VX_MASK, PPCSPE, { RS, RB } }, -{ "evfsctui", VX(4, 660), VX_MASK, PPCSPE, { RS, RB } }, -{ "evfsctsi", VX(4, 661), VX_MASK, PPCSPE, { RS, RB } }, -{ "evfsctsiz", VX(4, 666), VX_MASK, PPCSPE, { RS, RB } }, -{ "evfsctuf", VX(4, 662), VX_MASK, PPCSPE, { RS, RB } }, -{ "evfsctsf", VX(4, 663), VX_MASK, PPCSPE, { RS, RB } }, - -{ "efsabs", VX(4, 708), VX_MASK, PPCEFS, { RS, RA } }, -{ "efsnabs", VX(4, 709), VX_MASK, PPCEFS, { RS, RA } }, -{ "efsneg", VX(4, 710), VX_MASK, PPCEFS, { RS, RA } }, -{ "efsadd", VX(4, 704), VX_MASK, PPCEFS, { RS, RA, RB } }, -{ "efssub", VX(4, 705), VX_MASK, PPCEFS, { RS, RA, RB } }, -{ "efsmul", VX(4, 712), VX_MASK, PPCEFS, { RS, RA, RB } }, -{ "efsdiv", VX(4, 713), VX_MASK, PPCEFS, { RS, RA, RB } }, -{ "efscmpgt", VX(4, 716), VX_MASK, PPCEFS, { CRFD, RA, RB } }, -{ "efscmplt", VX(4, 717), VX_MASK, PPCEFS, { CRFD, RA, RB } }, -{ "efscmpeq", VX(4, 718), VX_MASK, PPCEFS, { CRFD, RA, RB } }, -{ "efststgt", VX(4, 732), VX_MASK, PPCEFS, { CRFD, RA, RB } }, -{ "efststlt", VX(4, 733), VX_MASK, PPCEFS, { CRFD, RA, RB } }, -{ "efststeq", VX(4, 734), VX_MASK, PPCEFS, { CRFD, RA, RB } }, -{ "efscfui", VX(4, 720), VX_MASK, PPCEFS, { RS, RB } }, -{ "efsctuiz", VX(4, 728), VX_MASK, PPCEFS, { RS, RB } }, -{ "efscfsi", VX(4, 721), VX_MASK, PPCEFS, { RS, RB } }, -{ "efscfuf", VX(4, 722), VX_MASK, PPCEFS, { RS, RB } }, -{ "efscfsf", VX(4, 723), VX_MASK, PPCEFS, { RS, RB } }, -{ "efsctui", VX(4, 724), VX_MASK, PPCEFS, { RS, RB } }, -{ "efsctsi", VX(4, 725), VX_MASK, PPCEFS, { RS, RB } }, -{ "efsctsiz", VX(4, 730), VX_MASK, PPCEFS, { RS, RB } }, -{ "efsctuf", VX(4, 726), VX_MASK, PPCEFS, { RS, RB } }, -{ "efsctsf", VX(4, 727), VX_MASK, PPCEFS, { RS, RB } }, - -{ "evmhossf", VX(4, 1031), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhossfa", VX(4, 1063), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhosmf", VX(4, 1039), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhosmfa", VX(4, 1071), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhosmi", VX(4, 1037), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhosmia", VX(4, 1069), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhoumi", VX(4, 1036), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhoumia", VX(4, 1068), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhessf", VX(4, 1027), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhessfa", VX(4, 1059), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhesmf", VX(4, 1035), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhesmfa", VX(4, 1067), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhesmi", VX(4, 1033), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhesmia", VX(4, 1065), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmheumi", VX(4, 1032), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmheumia", VX(4, 1064), VX_MASK, PPCSPE, { RS, RA, RB } }, - -{ "evmhossfaaw",VX(4, 1287), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhossiaaw",VX(4, 1285), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhosmfaaw",VX(4, 1295), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhosmiaaw",VX(4, 1293), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhousiaaw",VX(4, 1284), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhoumiaaw",VX(4, 1292), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhessfaaw",VX(4, 1283), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhessiaaw",VX(4, 1281), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhesmfaaw",VX(4, 1291), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhesmiaaw",VX(4, 1289), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmheusiaaw",VX(4, 1280), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmheumiaaw",VX(4, 1288), VX_MASK, PPCSPE, { RS, RA, RB } }, - -{ "evmhossfanw",VX(4, 1415), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhossianw",VX(4, 1413), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhosmfanw",VX(4, 1423), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhosmianw",VX(4, 1421), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhousianw",VX(4, 1412), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhoumianw",VX(4, 1420), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhessfanw",VX(4, 1411), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhessianw",VX(4, 1409), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhesmfanw",VX(4, 1419), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhesmianw",VX(4, 1417), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmheusianw",VX(4, 1408), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmheumianw",VX(4, 1416), VX_MASK, PPCSPE, { RS, RA, RB } }, - -{ "evmhogsmfaa",VX(4, 1327), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhogsmiaa",VX(4, 1325), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhogumiaa",VX(4, 1324), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhegsmfaa",VX(4, 1323), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhegsmiaa",VX(4, 1321), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhegumiaa",VX(4, 1320), VX_MASK, PPCSPE, { RS, RA, RB } }, - -{ "evmhogsmfan",VX(4, 1455), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhogsmian",VX(4, 1453), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhogumian",VX(4, 1452), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhegsmfan",VX(4, 1451), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhegsmian",VX(4, 1449), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmhegumian",VX(4, 1448), VX_MASK, PPCSPE, { RS, RA, RB } }, - -{ "evmwhssf", VX(4, 1095), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwhssfa", VX(4, 1127), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwhsmf", VX(4, 1103), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwhsmfa", VX(4, 1135), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwhsmi", VX(4, 1101), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwhsmia", VX(4, 1133), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwhumi", VX(4, 1100), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwhumia", VX(4, 1132), VX_MASK, PPCSPE, { RS, RA, RB } }, - -{ "evmwlumi", VX(4, 1096), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwlumia", VX(4, 1128), VX_MASK, PPCSPE, { RS, RA, RB } }, - -{ "evmwlssiaaw",VX(4, 1345), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwlsmiaaw",VX(4, 1353), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwlusiaaw",VX(4, 1344), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwlumiaaw",VX(4, 1352), VX_MASK, PPCSPE, { RS, RA, RB } }, - -{ "evmwlssianw",VX(4, 1473), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwlsmianw",VX(4, 1481), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwlusianw",VX(4, 1472), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwlumianw",VX(4, 1480), VX_MASK, PPCSPE, { RS, RA, RB } }, - -{ "evmwssf", VX(4, 1107), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwssfa", VX(4, 1139), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwsmf", VX(4, 1115), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwsmfa", VX(4, 1147), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwsmi", VX(4, 1113), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwsmia", VX(4, 1145), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwumi", VX(4, 1112), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwumia", VX(4, 1144), VX_MASK, PPCSPE, { RS, RA, RB } }, - -{ "evmwssfaa", VX(4, 1363), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwsmfaa", VX(4, 1371), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwsmiaa", VX(4, 1369), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwumiaa", VX(4, 1368), VX_MASK, PPCSPE, { RS, RA, RB } }, - -{ "evmwssfan", VX(4, 1491), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwsmfan", VX(4, 1499), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwsmian", VX(4, 1497), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evmwumian", VX(4, 1496), VX_MASK, PPCSPE, { RS, RA, RB } }, - -{ "evaddssiaaw",VX(4, 1217), VX_MASK, PPCSPE, { RS, RA } }, -{ "evaddsmiaaw",VX(4, 1225), VX_MASK, PPCSPE, { RS, RA } }, -{ "evaddusiaaw",VX(4, 1216), VX_MASK, PPCSPE, { RS, RA } }, -{ "evaddumiaaw",VX(4, 1224), VX_MASK, PPCSPE, { RS, RA } }, - -{ "evsubfssiaaw",VX(4, 1219), VX_MASK, PPCSPE, { RS, RA } }, -{ "evsubfsmiaaw",VX(4, 1227), VX_MASK, PPCSPE, { RS, RA } }, -{ "evsubfusiaaw",VX(4, 1218), VX_MASK, PPCSPE, { RS, RA } }, -{ "evsubfumiaaw",VX(4, 1226), VX_MASK, PPCSPE, { RS, RA } }, - -{ "evmra", VX(4, 1220), VX_MASK, PPCSPE, { RS, RA } }, - -{ "evdivws", VX(4, 1222), VX_MASK, PPCSPE, { RS, RA, RB } }, -{ "evdivwu", VX(4, 1223), VX_MASK, PPCSPE, { RS, RA, RB } }, - -{ "mulli", OP(7), OP_MASK, PPCCOM, { RT, RA, SI } }, -{ "muli", OP(7), OP_MASK, PWRCOM, { RT, RA, SI } }, - -{ "subfic", OP(8), OP_MASK, PPCCOM, { RT, RA, SI } }, -{ "sfi", OP(8), OP_MASK, PWRCOM, { RT, RA, SI } }, - -{ "dozi", OP(9), OP_MASK, M601, { RT, RA, SI } }, - -{ "bce", B(9,0,0), B_MASK, BOOKE64, { BO, BI, BD } }, -{ "bcel", B(9,0,1), B_MASK, BOOKE64, { BO, BI, BD } }, -{ "bcea", B(9,1,0), B_MASK, BOOKE64, { BO, BI, BDA } }, -{ "bcela", B(9,1,1), B_MASK, BOOKE64, { BO, BI, BDA } }, - -{ "cmplwi", OPL(10,0), OPL_MASK, PPCCOM, { OBF, RA, UI } }, -{ "cmpldi", OPL(10,1), OPL_MASK, PPC64, { OBF, RA, UI } }, -{ "cmpli", OP(10), OP_MASK, PPC, { BF, L, RA, UI } }, -{ "cmpli", OP(10), OP_MASK, PWRCOM, { BF, RA, UI } }, - -{ "cmpwi", OPL(11,0), OPL_MASK, PPCCOM, { OBF, RA, SI } }, -{ "cmpdi", OPL(11,1), OPL_MASK, PPC64, { OBF, RA, SI } }, -{ "cmpi", OP(11), OP_MASK, PPC, { BF, L, RA, SI } }, -{ "cmpi", OP(11), OP_MASK, PWRCOM, { BF, RA, SI } }, - -{ "addic", OP(12), OP_MASK, PPCCOM, { RT, RA, SI } }, -{ "ai", OP(12), OP_MASK, PWRCOM, { RT, RA, SI } }, -{ "subic", OP(12), OP_MASK, PPCCOM, { RT, RA, NSI } }, - -{ "addic.", OP(13), OP_MASK, PPCCOM, { RT, RA, SI } }, -{ "ai.", OP(13), OP_MASK, PWRCOM, { RT, RA, SI } }, -{ "subic.", OP(13), OP_MASK, PPCCOM, { RT, RA, NSI } }, - -{ "li", OP(14), DRA_MASK, PPCCOM, { RT, SI } }, -{ "lil", OP(14), DRA_MASK, PWRCOM, { RT, SI } }, -{ "addi", OP(14), OP_MASK, PPCCOM, { RT, RA0, SI } }, -{ "cal", OP(14), OP_MASK, PWRCOM, { RT, D, RA0 } }, -{ "subi", OP(14), OP_MASK, PPCCOM, { RT, RA0, NSI } }, -{ "la", OP(14), OP_MASK, PPCCOM, { RT, D, RA0 } }, - -{ "lis", OP(15), DRA_MASK, PPCCOM, { RT, SISIGNOPT } }, -{ "liu", OP(15), DRA_MASK, PWRCOM, { RT, SISIGNOPT } }, -{ "addis", OP(15), OP_MASK, PPCCOM, { RT,RA0,SISIGNOPT } }, -{ "cau", OP(15), OP_MASK, PWRCOM, { RT,RA0,SISIGNOPT } }, -{ "subis", OP(15), OP_MASK, PPCCOM, { RT, RA0, NSI } }, - -{ "bdnz-", BBO(16,BODNZ,0,0), BBOATBI_MASK, PPCCOM, { BDM } }, -{ "bdnz+", BBO(16,BODNZ,0,0), BBOATBI_MASK, PPCCOM, { BDP } }, -{ "bdnz", BBO(16,BODNZ,0,0), BBOATBI_MASK, PPCCOM, { BD } }, -{ "bdn", BBO(16,BODNZ,0,0), BBOATBI_MASK, PWRCOM, { BD } }, -{ "bdnzl-", BBO(16,BODNZ,0,1), BBOATBI_MASK, PPCCOM, { BDM } }, -{ "bdnzl+", BBO(16,BODNZ,0,1), BBOATBI_MASK, PPCCOM, { BDP } }, -{ "bdnzl", BBO(16,BODNZ,0,1), BBOATBI_MASK, PPCCOM, { BD } }, -{ "bdnl", BBO(16,BODNZ,0,1), BBOATBI_MASK, PWRCOM, { BD } }, -{ "bdnza-", BBO(16,BODNZ,1,0), BBOATBI_MASK, PPCCOM, { BDMA } }, -{ "bdnza+", BBO(16,BODNZ,1,0), BBOATBI_MASK, PPCCOM, { BDPA } }, -{ "bdnza", BBO(16,BODNZ,1,0), BBOATBI_MASK, PPCCOM, { BDA } }, -{ "bdna", BBO(16,BODNZ,1,0), BBOATBI_MASK, PWRCOM, { BDA } }, -{ "bdnzla-", BBO(16,BODNZ,1,1), BBOATBI_MASK, PPCCOM, { BDMA } }, -{ "bdnzla+", BBO(16,BODNZ,1,1), BBOATBI_MASK, PPCCOM, { BDPA } }, -{ "bdnzla", BBO(16,BODNZ,1,1), BBOATBI_MASK, PPCCOM, { BDA } }, -{ "bdnla", BBO(16,BODNZ,1,1), BBOATBI_MASK, PWRCOM, { BDA } }, -{ "bdz-", BBO(16,BODZ,0,0), BBOATBI_MASK, PPCCOM, { BDM } }, -{ "bdz+", BBO(16,BODZ,0,0), BBOATBI_MASK, PPCCOM, { BDP } }, -{ "bdz", BBO(16,BODZ,0,0), BBOATBI_MASK, COM, { BD } }, -{ "bdzl-", BBO(16,BODZ,0,1), BBOATBI_MASK, PPCCOM, { BDM } }, -{ "bdzl+", BBO(16,BODZ,0,1), BBOATBI_MASK, PPCCOM, { BDP } }, -{ "bdzl", BBO(16,BODZ,0,1), BBOATBI_MASK, COM, { BD } }, -{ "bdza-", BBO(16,BODZ,1,0), BBOATBI_MASK, PPCCOM, { BDMA } }, -{ "bdza+", BBO(16,BODZ,1,0), BBOATBI_MASK, PPCCOM, { BDPA } }, -{ "bdza", BBO(16,BODZ,1,0), BBOATBI_MASK, COM, { BDA } }, -{ "bdzla-", BBO(16,BODZ,1,1), BBOATBI_MASK, PPCCOM, { BDMA } }, -{ "bdzla+", BBO(16,BODZ,1,1), BBOATBI_MASK, PPCCOM, { BDPA } }, -{ "bdzla", BBO(16,BODZ,1,1), BBOATBI_MASK, COM, { BDA } }, -{ "blt-", BBOCB(16,BOT,CBLT,0,0), BBOATCB_MASK, PPCCOM, { CR, BDM } }, -{ "blt+", BBOCB(16,BOT,CBLT,0,0), BBOATCB_MASK, PPCCOM, { CR, BDP } }, -{ "blt", BBOCB(16,BOT,CBLT,0,0), BBOATCB_MASK, COM, { CR, BD } }, -{ "bltl-", BBOCB(16,BOT,CBLT,0,1), BBOATCB_MASK, PPCCOM, { CR, BDM } }, -{ "bltl+", BBOCB(16,BOT,CBLT,0,1), BBOATCB_MASK, PPCCOM, { CR, BDP } }, -{ "bltl", BBOCB(16,BOT,CBLT,0,1), BBOATCB_MASK, COM, { CR, BD } }, -{ "blta-", BBOCB(16,BOT,CBLT,1,0), BBOATCB_MASK, PPCCOM, { CR, BDMA } }, -{ "blta+", BBOCB(16,BOT,CBLT,1,0), BBOATCB_MASK, PPCCOM, { CR, BDPA } }, -{ "blta", BBOCB(16,BOT,CBLT,1,0), BBOATCB_MASK, COM, { CR, BDA } }, -{ "bltla-", BBOCB(16,BOT,CBLT,1,1), BBOATCB_MASK, PPCCOM, { CR, BDMA } }, -{ "bltla+", BBOCB(16,BOT,CBLT,1,1), BBOATCB_MASK, PPCCOM, { CR, BDPA } }, -{ "bltla", BBOCB(16,BOT,CBLT,1,1), BBOATCB_MASK, COM, { CR, BDA } }, -{ "bgt-", BBOCB(16,BOT,CBGT,0,0), BBOATCB_MASK, PPCCOM, { CR, BDM } }, -{ "bgt+", BBOCB(16,BOT,CBGT,0,0), BBOATCB_MASK, PPCCOM, { CR, BDP } }, -{ "bgt", BBOCB(16,BOT,CBGT,0,0), BBOATCB_MASK, COM, { CR, BD } }, -{ "bgtl-", BBOCB(16,BOT,CBGT,0,1), BBOATCB_MASK, PPCCOM, { CR, BDM } }, -{ "bgtl+", BBOCB(16,BOT,CBGT,0,1), BBOATCB_MASK, PPCCOM, { CR, BDP } }, -{ "bgtl", BBOCB(16,BOT,CBGT,0,1), BBOATCB_MASK, COM, { CR, BD } }, -{ "bgta-", BBOCB(16,BOT,CBGT,1,0), BBOATCB_MASK, PPCCOM, { CR, BDMA } }, -{ "bgta+", BBOCB(16,BOT,CBGT,1,0), BBOATCB_MASK, PPCCOM, { CR, BDPA } }, -{ "bgta", BBOCB(16,BOT,CBGT,1,0), BBOATCB_MASK, COM, { CR, BDA } }, -{ "bgtla-", BBOCB(16,BOT,CBGT,1,1), BBOATCB_MASK, PPCCOM, { CR, BDMA } }, -{ "bgtla+", BBOCB(16,BOT,CBGT,1,1), BBOATCB_MASK, PPCCOM, { CR, BDPA } }, -{ "bgtla", BBOCB(16,BOT,CBGT,1,1), BBOATCB_MASK, COM, { CR, BDA } }, -{ "beq-", BBOCB(16,BOT,CBEQ,0,0), BBOATCB_MASK, PPCCOM, { CR, BDM } }, -{ "beq+", BBOCB(16,BOT,CBEQ,0,0), BBOATCB_MASK, PPCCOM, { CR, BDP } }, -{ "beq", BBOCB(16,BOT,CBEQ,0,0), BBOATCB_MASK, COM, { CR, BD } }, -{ "beql-", BBOCB(16,BOT,CBEQ,0,1), BBOATCB_MASK, PPCCOM, { CR, BDM } }, -{ "beql+", BBOCB(16,BOT,CBEQ,0,1), BBOATCB_MASK, PPCCOM, { CR, BDP } }, -{ "beql", BBOCB(16,BOT,CBEQ,0,1), BBOATCB_MASK, COM, { CR, BD } }, -{ "beqa-", BBOCB(16,BOT,CBEQ,1,0), BBOATCB_MASK, PPCCOM, { CR, BDMA } }, -{ "beqa+", BBOCB(16,BOT,CBEQ,1,0), BBOATCB_MASK, PPCCOM, { CR, BDPA } }, -{ "beqa", BBOCB(16,BOT,CBEQ,1,0), BBOATCB_MASK, COM, { CR, BDA } }, -{ "beqla-", BBOCB(16,BOT,CBEQ,1,1), BBOATCB_MASK, PPCCOM, { CR, BDMA } }, -{ "beqla+", BBOCB(16,BOT,CBEQ,1,1), BBOATCB_MASK, PPCCOM, { CR, BDPA } }, -{ "beqla", BBOCB(16,BOT,CBEQ,1,1), BBOATCB_MASK, COM, { CR, BDA } }, -{ "bso-", BBOCB(16,BOT,CBSO,0,0), BBOATCB_MASK, PPCCOM, { CR, BDM } }, -{ "bso+", BBOCB(16,BOT,CBSO,0,0), BBOATCB_MASK, PPCCOM, { CR, BDP } }, -{ "bso", BBOCB(16,BOT,CBSO,0,0), BBOATCB_MASK, COM, { CR, BD } }, -{ "bsol-", BBOCB(16,BOT,CBSO,0,1), BBOATCB_MASK, PPCCOM, { CR, BDM } }, -{ "bsol+", BBOCB(16,BOT,CBSO,0,1), BBOATCB_MASK, PPCCOM, { CR, BDP } }, -{ "bsol", BBOCB(16,BOT,CBSO,0,1), BBOATCB_MASK, COM, { CR, BD } }, -{ "bsoa-", BBOCB(16,BOT,CBSO,1,0), BBOATCB_MASK, PPCCOM, { CR, BDMA } }, -{ "bsoa+", BBOCB(16,BOT,CBSO,1,0), BBOATCB_MASK, PPCCOM, { CR, BDPA } }, -{ "bsoa", BBOCB(16,BOT,CBSO,1,0), BBOATCB_MASK, COM, { CR, BDA } }, -{ "bsola-", BBOCB(16,BOT,CBSO,1,1), BBOATCB_MASK, PPCCOM, { CR, BDMA } }, -{ "bsola+", BBOCB(16,BOT,CBSO,1,1), BBOATCB_MASK, PPCCOM, { CR, BDPA } }, -{ "bsola", BBOCB(16,BOT,CBSO,1,1), BBOATCB_MASK, COM, { CR, BDA } }, -{ "bun-", BBOCB(16,BOT,CBSO,0,0), BBOATCB_MASK, PPCCOM, { CR, BDM } }, -{ "bun+", BBOCB(16,BOT,CBSO,0,0), BBOATCB_MASK, PPCCOM, { CR, BDP } }, -{ "bun", BBOCB(16,BOT,CBSO,0,0), BBOATCB_MASK, PPCCOM, { CR, BD } }, -{ "bunl-", BBOCB(16,BOT,CBSO,0,1), BBOATCB_MASK, PPCCOM, { CR, BDM } }, -{ "bunl+", BBOCB(16,BOT,CBSO,0,1), BBOATCB_MASK, PPCCOM, { CR, BDP } }, -{ "bunl", BBOCB(16,BOT,CBSO,0,1), BBOATCB_MASK, PPCCOM, { CR, BD } }, -{ "buna-", BBOCB(16,BOT,CBSO,1,0), BBOATCB_MASK, PPCCOM, { CR, BDMA } }, -{ "buna+", BBOCB(16,BOT,CBSO,1,0), BBOATCB_MASK, PPCCOM, { CR, BDPA } }, -{ "buna", BBOCB(16,BOT,CBSO,1,0), BBOATCB_MASK, PPCCOM, { CR, BDA } }, -{ "bunla-", BBOCB(16,BOT,CBSO,1,1), BBOATCB_MASK, PPCCOM, { CR, BDMA } }, -{ "bunla+", BBOCB(16,BOT,CBSO,1,1), BBOATCB_MASK, PPCCOM, { CR, BDPA } }, -{ "bunla", BBOCB(16,BOT,CBSO,1,1), BBOATCB_MASK, PPCCOM, { CR, BDA } }, -{ "bge-", BBOCB(16,BOF,CBLT,0,0), BBOATCB_MASK, PPCCOM, { CR, BDM } }, -{ "bge+", BBOCB(16,BOF,CBLT,0,0), BBOATCB_MASK, PPCCOM, { CR, BDP } }, -{ "bge", BBOCB(16,BOF,CBLT,0,0), BBOATCB_MASK, COM, { CR, BD } }, -{ "bgel-", BBOCB(16,BOF,CBLT,0,1), BBOATCB_MASK, PPCCOM, { CR, BDM } }, -{ "bgel+", BBOCB(16,BOF,CBLT,0,1), BBOATCB_MASK, PPCCOM, { CR, BDP } }, -{ "bgel", BBOCB(16,BOF,CBLT,0,1), BBOATCB_MASK, COM, { CR, BD } }, -{ "bgea-", BBOCB(16,BOF,CBLT,1,0), BBOATCB_MASK, PPCCOM, { CR, BDMA } }, -{ "bgea+", BBOCB(16,BOF,CBLT,1,0), BBOATCB_MASK, PPCCOM, { CR, BDPA } }, -{ "bgea", BBOCB(16,BOF,CBLT,1,0), BBOATCB_MASK, COM, { CR, BDA } }, -{ "bgela-", BBOCB(16,BOF,CBLT,1,1), BBOATCB_MASK, PPCCOM, { CR, BDMA } }, -{ "bgela+", BBOCB(16,BOF,CBLT,1,1), BBOATCB_MASK, PPCCOM, { CR, BDPA } }, -{ "bgela", BBOCB(16,BOF,CBLT,1,1), BBOATCB_MASK, COM, { CR, BDA } }, -{ "bnl-", BBOCB(16,BOF,CBLT,0,0), BBOATCB_MASK, PPCCOM, { CR, BDM } }, -{ "bnl+", BBOCB(16,BOF,CBLT,0,0), BBOATCB_MASK, PPCCOM, { CR, BDP } }, -{ "bnl", BBOCB(16,BOF,CBLT,0,0), BBOATCB_MASK, COM, { CR, BD } }, -{ "bnll-", BBOCB(16,BOF,CBLT,0,1), BBOATCB_MASK, PPCCOM, { CR, BDM } }, -{ "bnll+", BBOCB(16,BOF,CBLT,0,1), BBOATCB_MASK, PPCCOM, { CR, BDP } }, -{ "bnll", BBOCB(16,BOF,CBLT,0,1), BBOATCB_MASK, COM, { CR, BD } }, -{ "bnla-", BBOCB(16,BOF,CBLT,1,0), BBOATCB_MASK, PPCCOM, { CR, BDMA } }, -{ "bnla+", BBOCB(16,BOF,CBLT,1,0), BBOATCB_MASK, PPCCOM, { CR, BDPA } }, -{ "bnla", BBOCB(16,BOF,CBLT,1,0), BBOATCB_MASK, COM, { CR, BDA } }, -{ "bnlla-", BBOCB(16,BOF,CBLT,1,1), BBOATCB_MASK, PPCCOM, { CR, BDMA } }, -{ "bnlla+", BBOCB(16,BOF,CBLT,1,1), BBOATCB_MASK, PPCCOM, { CR, BDPA } }, -{ "bnlla", BBOCB(16,BOF,CBLT,1,1), BBOATCB_MASK, COM, { CR, BDA } }, -{ "ble-", BBOCB(16,BOF,CBGT,0,0), BBOATCB_MASK, PPCCOM, { CR, BDM } }, -{ "ble+", BBOCB(16,BOF,CBGT,0,0), BBOATCB_MASK, PPCCOM, { CR, BDP } }, -{ "ble", BBOCB(16,BOF,CBGT,0,0), BBOATCB_MASK, COM, { CR, BD } }, -{ "blel-", BBOCB(16,BOF,CBGT,0,1), BBOATCB_MASK, PPCCOM, { CR, BDM } }, -{ "blel+", BBOCB(16,BOF,CBGT,0,1), BBOATCB_MASK, PPCCOM, { CR, BDP } }, -{ "blel", BBOCB(16,BOF,CBGT,0,1), BBOATCB_MASK, COM, { CR, BD } }, -{ "blea-", BBOCB(16,BOF,CBGT,1,0), BBOATCB_MASK, PPCCOM, { CR, BDMA } }, -{ "blea+", BBOCB(16,BOF,CBGT,1,0), BBOATCB_MASK, PPCCOM, { CR, BDPA } }, -{ "blea", BBOCB(16,BOF,CBGT,1,0), BBOATCB_MASK, COM, { CR, BDA } }, -{ "blela-", BBOCB(16,BOF,CBGT,1,1), BBOATCB_MASK, PPCCOM, { CR, BDMA } }, -{ "blela+", BBOCB(16,BOF,CBGT,1,1), BBOATCB_MASK, PPCCOM, { CR, BDPA } }, -{ "blela", BBOCB(16,BOF,CBGT,1,1), BBOATCB_MASK, COM, { CR, BDA } }, -{ "bng-", BBOCB(16,BOF,CBGT,0,0), BBOATCB_MASK, PPCCOM, { CR, BDM } }, -{ "bng+", BBOCB(16,BOF,CBGT,0,0), BBOATCB_MASK, PPCCOM, { CR, BDP } }, -{ "bng", BBOCB(16,BOF,CBGT,0,0), BBOATCB_MASK, COM, { CR, BD } }, -{ "bngl-", BBOCB(16,BOF,CBGT,0,1), BBOATCB_MASK, PPCCOM, { CR, BDM } }, -{ "bngl+", BBOCB(16,BOF,CBGT,0,1), BBOATCB_MASK, PPCCOM, { CR, BDP } }, -{ "bngl", BBOCB(16,BOF,CBGT,0,1), BBOATCB_MASK, COM, { CR, BD } }, -{ "bnga-", BBOCB(16,BOF,CBGT,1,0), BBOATCB_MASK, PPCCOM, { CR, BDMA } }, -{ "bnga+", BBOCB(16,BOF,CBGT,1,0), BBOATCB_MASK, PPCCOM, { CR, BDPA } }, -{ "bnga", BBOCB(16,BOF,CBGT,1,0), BBOATCB_MASK, COM, { CR, BDA } }, -{ "bngla-", BBOCB(16,BOF,CBGT,1,1), BBOATCB_MASK, PPCCOM, { CR, BDMA } }, -{ "bngla+", BBOCB(16,BOF,CBGT,1,1), BBOATCB_MASK, PPCCOM, { CR, BDPA } }, -{ "bngla", BBOCB(16,BOF,CBGT,1,1), BBOATCB_MASK, COM, { CR, BDA } }, -{ "bne-", BBOCB(16,BOF,CBEQ,0,0), BBOATCB_MASK, PPCCOM, { CR, BDM } }, -{ "bne+", BBOCB(16,BOF,CBEQ,0,0), BBOATCB_MASK, PPCCOM, { CR, BDP } }, -{ "bne", BBOCB(16,BOF,CBEQ,0,0), BBOATCB_MASK, COM, { CR, BD } }, -{ "bnel-", BBOCB(16,BOF,CBEQ,0,1), BBOATCB_MASK, PPCCOM, { CR, BDM } }, -{ "bnel+", BBOCB(16,BOF,CBEQ,0,1), BBOATCB_MASK, PPCCOM, { CR, BDP } }, -{ "bnel", BBOCB(16,BOF,CBEQ,0,1), BBOATCB_MASK, COM, { CR, BD } }, -{ "bnea-", BBOCB(16,BOF,CBEQ,1,0), BBOATCB_MASK, PPCCOM, { CR, BDMA } }, -{ "bnea+", BBOCB(16,BOF,CBEQ,1,0), BBOATCB_MASK, PPCCOM, { CR, BDPA } }, -{ "bnea", BBOCB(16,BOF,CBEQ,1,0), BBOATCB_MASK, COM, { CR, BDA } }, -{ "bnela-", BBOCB(16,BOF,CBEQ,1,1), BBOATCB_MASK, PPCCOM, { CR, BDMA } }, -{ "bnela+", BBOCB(16,BOF,CBEQ,1,1), BBOATCB_MASK, PPCCOM, { CR, BDPA } }, -{ "bnela", BBOCB(16,BOF,CBEQ,1,1), BBOATCB_MASK, COM, { CR, BDA } }, -{ "bns-", BBOCB(16,BOF,CBSO,0,0), BBOATCB_MASK, PPCCOM, { CR, BDM } }, -{ "bns+", BBOCB(16,BOF,CBSO,0,0), BBOATCB_MASK, PPCCOM, { CR, BDP } }, -{ "bns", BBOCB(16,BOF,CBSO,0,0), BBOATCB_MASK, COM, { CR, BD } }, -{ "bnsl-", BBOCB(16,BOF,CBSO,0,1), BBOATCB_MASK, PPCCOM, { CR, BDM } }, -{ "bnsl+", BBOCB(16,BOF,CBSO,0,1), BBOATCB_MASK, PPCCOM, { CR, BDP } }, -{ "bnsl", BBOCB(16,BOF,CBSO,0,1), BBOATCB_MASK, COM, { CR, BD } }, -{ "bnsa-", BBOCB(16,BOF,CBSO,1,0), BBOATCB_MASK, PPCCOM, { CR, BDMA } }, -{ "bnsa+", BBOCB(16,BOF,CBSO,1,0), BBOATCB_MASK, PPCCOM, { CR, BDPA } }, -{ "bnsa", BBOCB(16,BOF,CBSO,1,0), BBOATCB_MASK, COM, { CR, BDA } }, -{ "bnsla-", BBOCB(16,BOF,CBSO,1,1), BBOATCB_MASK, PPCCOM, { CR, BDMA } }, -{ "bnsla+", BBOCB(16,BOF,CBSO,1,1), BBOATCB_MASK, PPCCOM, { CR, BDPA } }, -{ "bnsla", BBOCB(16,BOF,CBSO,1,1), BBOATCB_MASK, COM, { CR, BDA } }, -{ "bnu-", BBOCB(16,BOF,CBSO,0,0), BBOATCB_MASK, PPCCOM, { CR, BDM } }, -{ "bnu+", BBOCB(16,BOF,CBSO,0,0), BBOATCB_MASK, PPCCOM, { CR, BDP } }, -{ "bnu", BBOCB(16,BOF,CBSO,0,0), BBOATCB_MASK, PPCCOM, { CR, BD } }, -{ "bnul-", BBOCB(16,BOF,CBSO,0,1), BBOATCB_MASK, PPCCOM, { CR, BDM } }, -{ "bnul+", BBOCB(16,BOF,CBSO,0,1), BBOATCB_MASK, PPCCOM, { CR, BDP } }, -{ "bnul", BBOCB(16,BOF,CBSO,0,1), BBOATCB_MASK, PPCCOM, { CR, BD } }, -{ "bnua-", BBOCB(16,BOF,CBSO,1,0), BBOATCB_MASK, PPCCOM, { CR, BDMA } }, -{ "bnua+", BBOCB(16,BOF,CBSO,1,0), BBOATCB_MASK, PPCCOM, { CR, BDPA } }, -{ "bnua", BBOCB(16,BOF,CBSO,1,0), BBOATCB_MASK, PPCCOM, { CR, BDA } }, -{ "bnula-", BBOCB(16,BOF,CBSO,1,1), BBOATCB_MASK, PPCCOM, { CR, BDMA } }, -{ "bnula+", BBOCB(16,BOF,CBSO,1,1), BBOATCB_MASK, PPCCOM, { CR, BDPA } }, -{ "bnula", BBOCB(16,BOF,CBSO,1,1), BBOATCB_MASK, PPCCOM, { CR, BDA } }, -{ "bdnzt-", BBO(16,BODNZT,0,0), BBOY_MASK, NOPOWER4, { BI, BDM } }, -{ "bdnzt+", BBO(16,BODNZT,0,0), BBOY_MASK, NOPOWER4, { BI, BDP } }, -{ "bdnzt", BBO(16,BODNZT,0,0), BBOY_MASK, PPCCOM, { BI, BD } }, -{ "bdnztl-", BBO(16,BODNZT,0,1), BBOY_MASK, NOPOWER4, { BI, BDM } }, -{ "bdnztl+", BBO(16,BODNZT,0,1), BBOY_MASK, NOPOWER4, { BI, BDP } }, -{ "bdnztl", BBO(16,BODNZT,0,1), BBOY_MASK, PPCCOM, { BI, BD } }, -{ "bdnzta-", BBO(16,BODNZT,1,0), BBOY_MASK, NOPOWER4, { BI, BDMA } }, -{ "bdnzta+", BBO(16,BODNZT,1,0), BBOY_MASK, NOPOWER4, { BI, BDPA } }, -{ "bdnzta", BBO(16,BODNZT,1,0), BBOY_MASK, PPCCOM, { BI, BDA } }, -{ "bdnztla-",BBO(16,BODNZT,1,1), BBOY_MASK, NOPOWER4, { BI, BDMA } }, -{ "bdnztla+",BBO(16,BODNZT,1,1), BBOY_MASK, NOPOWER4, { BI, BDPA } }, -{ "bdnztla", BBO(16,BODNZT,1,1), BBOY_MASK, PPCCOM, { BI, BDA } }, -{ "bdnzf-", BBO(16,BODNZF,0,0), BBOY_MASK, NOPOWER4, { BI, BDM } }, -{ "bdnzf+", BBO(16,BODNZF,0,0), BBOY_MASK, NOPOWER4, { BI, BDP } }, -{ "bdnzf", BBO(16,BODNZF,0,0), BBOY_MASK, PPCCOM, { BI, BD } }, -{ "bdnzfl-", BBO(16,BODNZF,0,1), BBOY_MASK, NOPOWER4, { BI, BDM } }, -{ "bdnzfl+", BBO(16,BODNZF,0,1), BBOY_MASK, NOPOWER4, { BI, BDP } }, -{ "bdnzfl", BBO(16,BODNZF,0,1), BBOY_MASK, PPCCOM, { BI, BD } }, -{ "bdnzfa-", BBO(16,BODNZF,1,0), BBOY_MASK, NOPOWER4, { BI, BDMA } }, -{ "bdnzfa+", BBO(16,BODNZF,1,0), BBOY_MASK, NOPOWER4, { BI, BDPA } }, -{ "bdnzfa", BBO(16,BODNZF,1,0), BBOY_MASK, PPCCOM, { BI, BDA } }, -{ "bdnzfla-",BBO(16,BODNZF,1,1), BBOY_MASK, NOPOWER4, { BI, BDMA } }, -{ "bdnzfla+",BBO(16,BODNZF,1,1), BBOY_MASK, NOPOWER4, { BI, BDPA } }, -{ "bdnzfla", BBO(16,BODNZF,1,1), BBOY_MASK, PPCCOM, { BI, BDA } }, -{ "bt-", BBO(16,BOT,0,0), BBOAT_MASK, PPCCOM, { BI, BDM } }, -{ "bt+", BBO(16,BOT,0,0), BBOAT_MASK, PPCCOM, { BI, BDP } }, -{ "bt", BBO(16,BOT,0,0), BBOAT_MASK, PPCCOM, { BI, BD } }, -{ "bbt", BBO(16,BOT,0,0), BBOAT_MASK, PWRCOM, { BI, BD } }, -{ "btl-", BBO(16,BOT,0,1), BBOAT_MASK, PPCCOM, { BI, BDM } }, -{ "btl+", BBO(16,BOT,0,1), BBOAT_MASK, PPCCOM, { BI, BDP } }, -{ "btl", BBO(16,BOT,0,1), BBOAT_MASK, PPCCOM, { BI, BD } }, -{ "bbtl", BBO(16,BOT,0,1), BBOAT_MASK, PWRCOM, { BI, BD } }, -{ "bta-", BBO(16,BOT,1,0), BBOAT_MASK, PPCCOM, { BI, BDMA } }, -{ "bta+", BBO(16,BOT,1,0), BBOAT_MASK, PPCCOM, { BI, BDPA } }, -{ "bta", BBO(16,BOT,1,0), BBOAT_MASK, PPCCOM, { BI, BDA } }, -{ "bbta", BBO(16,BOT,1,0), BBOAT_MASK, PWRCOM, { BI, BDA } }, -{ "btla-", BBO(16,BOT,1,1), BBOAT_MASK, PPCCOM, { BI, BDMA } }, -{ "btla+", BBO(16,BOT,1,1), BBOAT_MASK, PPCCOM, { BI, BDPA } }, -{ "btla", BBO(16,BOT,1,1), BBOAT_MASK, PPCCOM, { BI, BDA } }, -{ "bbtla", BBO(16,BOT,1,1), BBOAT_MASK, PWRCOM, { BI, BDA } }, -{ "bf-", BBO(16,BOF,0,0), BBOAT_MASK, PPCCOM, { BI, BDM } }, -{ "bf+", BBO(16,BOF,0,0), BBOAT_MASK, PPCCOM, { BI, BDP } }, -{ "bf", BBO(16,BOF,0,0), BBOAT_MASK, PPCCOM, { BI, BD } }, -{ "bbf", BBO(16,BOF,0,0), BBOAT_MASK, PWRCOM, { BI, BD } }, -{ "bfl-", BBO(16,BOF,0,1), BBOAT_MASK, PPCCOM, { BI, BDM } }, -{ "bfl+", BBO(16,BOF,0,1), BBOAT_MASK, PPCCOM, { BI, BDP } }, -{ "bfl", BBO(16,BOF,0,1), BBOAT_MASK, PPCCOM, { BI, BD } }, -{ "bbfl", BBO(16,BOF,0,1), BBOAT_MASK, PWRCOM, { BI, BD } }, -{ "bfa-", BBO(16,BOF,1,0), BBOAT_MASK, PPCCOM, { BI, BDMA } }, -{ "bfa+", BBO(16,BOF,1,0), BBOAT_MASK, PPCCOM, { BI, BDPA } }, -{ "bfa", BBO(16,BOF,1,0), BBOAT_MASK, PPCCOM, { BI, BDA } }, -{ "bbfa", BBO(16,BOF,1,0), BBOAT_MASK, PWRCOM, { BI, BDA } }, -{ "bfla-", BBO(16,BOF,1,1), BBOAT_MASK, PPCCOM, { BI, BDMA } }, -{ "bfla+", BBO(16,BOF,1,1), BBOAT_MASK, PPCCOM, { BI, BDPA } }, -{ "bfla", BBO(16,BOF,1,1), BBOAT_MASK, PPCCOM, { BI, BDA } }, -{ "bbfla", BBO(16,BOF,1,1), BBOAT_MASK, PWRCOM, { BI, BDA } }, -{ "bdzt-", BBO(16,BODZT,0,0), BBOY_MASK, NOPOWER4, { BI, BDM } }, -{ "bdzt+", BBO(16,BODZT,0,0), BBOY_MASK, NOPOWER4, { BI, BDP } }, -{ "bdzt", BBO(16,BODZT,0,0), BBOY_MASK, PPCCOM, { BI, BD } }, -{ "bdztl-", BBO(16,BODZT,0,1), BBOY_MASK, NOPOWER4, { BI, BDM } }, -{ "bdztl+", BBO(16,BODZT,0,1), BBOY_MASK, NOPOWER4, { BI, BDP } }, -{ "bdztl", BBO(16,BODZT,0,1), BBOY_MASK, PPCCOM, { BI, BD } }, -{ "bdzta-", BBO(16,BODZT,1,0), BBOY_MASK, NOPOWER4, { BI, BDMA } }, -{ "bdzta+", BBO(16,BODZT,1,0), BBOY_MASK, NOPOWER4, { BI, BDPA } }, -{ "bdzta", BBO(16,BODZT,1,0), BBOY_MASK, PPCCOM, { BI, BDA } }, -{ "bdztla-", BBO(16,BODZT,1,1), BBOY_MASK, NOPOWER4, { BI, BDMA } }, -{ "bdztla+", BBO(16,BODZT,1,1), BBOY_MASK, NOPOWER4, { BI, BDPA } }, -{ "bdztla", BBO(16,BODZT,1,1), BBOY_MASK, PPCCOM, { BI, BDA } }, -{ "bdzf-", BBO(16,BODZF,0,0), BBOY_MASK, NOPOWER4, { BI, BDM } }, -{ "bdzf+", BBO(16,BODZF,0,0), BBOY_MASK, NOPOWER4, { BI, BDP } }, -{ "bdzf", BBO(16,BODZF,0,0), BBOY_MASK, PPCCOM, { BI, BD } }, -{ "bdzfl-", BBO(16,BODZF,0,1), BBOY_MASK, NOPOWER4, { BI, BDM } }, -{ "bdzfl+", BBO(16,BODZF,0,1), BBOY_MASK, NOPOWER4, { BI, BDP } }, -{ "bdzfl", BBO(16,BODZF,0,1), BBOY_MASK, PPCCOM, { BI, BD } }, -{ "bdzfa-", BBO(16,BODZF,1,0), BBOY_MASK, NOPOWER4, { BI, BDMA } }, -{ "bdzfa+", BBO(16,BODZF,1,0), BBOY_MASK, NOPOWER4, { BI, BDPA } }, -{ "bdzfa", BBO(16,BODZF,1,0), BBOY_MASK, PPCCOM, { BI, BDA } }, -{ "bdzfla-", BBO(16,BODZF,1,1), BBOY_MASK, NOPOWER4, { BI, BDMA } }, -{ "bdzfla+", BBO(16,BODZF,1,1), BBOY_MASK, NOPOWER4, { BI, BDPA } }, -{ "bdzfla", BBO(16,BODZF,1,1), BBOY_MASK, PPCCOM, { BI, BDA } }, -{ "bc-", B(16,0,0), B_MASK, PPCCOM, { BOE, BI, BDM } }, -{ "bc+", B(16,0,0), B_MASK, PPCCOM, { BOE, BI, BDP } }, -{ "bc", B(16,0,0), B_MASK, COM, { BO, BI, BD } }, -{ "bcl-", B(16,0,1), B_MASK, PPCCOM, { BOE, BI, BDM } }, -{ "bcl+", B(16,0,1), B_MASK, PPCCOM, { BOE, BI, BDP } }, -{ "bcl", B(16,0,1), B_MASK, COM, { BO, BI, BD } }, -{ "bca-", B(16,1,0), B_MASK, PPCCOM, { BOE, BI, BDMA } }, -{ "bca+", B(16,1,0), B_MASK, PPCCOM, { BOE, BI, BDPA } }, -{ "bca", B(16,1,0), B_MASK, COM, { BO, BI, BDA } }, -{ "bcla-", B(16,1,1), B_MASK, PPCCOM, { BOE, BI, BDMA } }, -{ "bcla+", B(16,1,1), B_MASK, PPCCOM, { BOE, BI, BDPA } }, -{ "bcla", B(16,1,1), B_MASK, COM, { BO, BI, BDA } }, - -{ "sc", SC(17,1,0), SC_MASK, PPC, { LEV } }, -{ "svc", SC(17,0,0), SC_MASK, POWER, { SVC_LEV, FL1, FL2 } }, -{ "svcl", SC(17,0,1), SC_MASK, POWER, { SVC_LEV, FL1, FL2 } }, -{ "svca", SC(17,1,0), SC_MASK, PWRCOM, { SV } }, -{ "svcla", SC(17,1,1), SC_MASK, POWER, { SV } }, - -{ "b", B(18,0,0), B_MASK, COM, { LI } }, -{ "bl", B(18,0,1), B_MASK, COM, { LI } }, -{ "ba", B(18,1,0), B_MASK, COM, { LIA } }, -{ "bla", B(18,1,1), B_MASK, COM, { LIA } }, - -{ "mcrf", XL(19,0), XLBB_MASK|(3 << 21)|(3 << 16), COM, { BF, BFA } }, - -{ "blr", XLO(19,BOU,16,0), XLBOBIBB_MASK, PPCCOM, { 0 } }, -{ "br", XLO(19,BOU,16,0), XLBOBIBB_MASK, PWRCOM, { 0 } }, -{ "blrl", XLO(19,BOU,16,1), XLBOBIBB_MASK, PPCCOM, { 0 } }, -{ "brl", XLO(19,BOU,16,1), XLBOBIBB_MASK, PWRCOM, { 0 } }, -{ "bdnzlr", XLO(19,BODNZ,16,0), XLBOBIBB_MASK, PPCCOM, { 0 } }, -{ "bdnzlr-", XLO(19,BODNZ,16,0), XLBOBIBB_MASK, NOPOWER4, { 0 } }, -{ "bdnzlr-", XLO(19,BODNZM4,16,0), XLBOBIBB_MASK, POWER4, { 0 } }, -{ "bdnzlr+", XLO(19,BODNZP,16,0), XLBOBIBB_MASK, NOPOWER4, { 0 } }, -{ "bdnzlr+", XLO(19,BODNZP4,16,0), XLBOBIBB_MASK, POWER4, { 0 } }, -{ "bdnzlrl", XLO(19,BODNZ,16,1), XLBOBIBB_MASK, PPCCOM, { 0 } }, -{ "bdnzlrl-",XLO(19,BODNZ,16,1), XLBOBIBB_MASK, NOPOWER4, { 0 } }, -{ "bdnzlrl-",XLO(19,BODNZM4,16,1), XLBOBIBB_MASK, POWER4, { 0 } }, -{ "bdnzlrl+",XLO(19,BODNZP,16,1), XLBOBIBB_MASK, NOPOWER4, { 0 } }, -{ "bdnzlrl+",XLO(19,BODNZP4,16,1), XLBOBIBB_MASK, POWER4, { 0 } }, -{ "bdzlr", XLO(19,BODZ,16,0), XLBOBIBB_MASK, PPCCOM, { 0 } }, -{ "bdzlr-", XLO(19,BODZ,16,0), XLBOBIBB_MASK, NOPOWER4, { 0 } }, -{ "bdzlr-", XLO(19,BODZM4,16,0), XLBOBIBB_MASK, POWER4, { 0 } }, -{ "bdzlr+", XLO(19,BODZP,16,0), XLBOBIBB_MASK, NOPOWER4, { 0 } }, -{ "bdzlr+", XLO(19,BODZP4,16,0), XLBOBIBB_MASK, POWER4, { 0 } }, -{ "bdzlrl", XLO(19,BODZ,16,1), XLBOBIBB_MASK, PPCCOM, { 0 } }, -{ "bdzlrl-", XLO(19,BODZ,16,1), XLBOBIBB_MASK, NOPOWER4, { 0 } }, -{ "bdzlrl-", XLO(19,BODZM4,16,1), XLBOBIBB_MASK, POWER4, { 0 } }, -{ "bdzlrl+", XLO(19,BODZP,16,1), XLBOBIBB_MASK, NOPOWER4, { 0 } }, -{ "bdzlrl+", XLO(19,BODZP4,16,1), XLBOBIBB_MASK, POWER4, { 0 } }, -{ "bltlr", XLOCB(19,BOT,CBLT,16,0), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bltlr-", XLOCB(19,BOT,CBLT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bltlr-", XLOCB(19,BOTM4,CBLT,16,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bltlr+", XLOCB(19,BOTP,CBLT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bltlr+", XLOCB(19,BOTP4,CBLT,16,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bltr", XLOCB(19,BOT,CBLT,16,0), XLBOCBBB_MASK, PWRCOM, { CR } }, -{ "bltlrl", XLOCB(19,BOT,CBLT,16,1), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bltlrl-", XLOCB(19,BOT,CBLT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bltlrl-", XLOCB(19,BOTM4,CBLT,16,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bltlrl+", XLOCB(19,BOTP,CBLT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bltlrl+", XLOCB(19,BOTP4,CBLT,16,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bltrl", XLOCB(19,BOT,CBLT,16,1), XLBOCBBB_MASK, PWRCOM, { CR } }, -{ "bgtlr", XLOCB(19,BOT,CBGT,16,0), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bgtlr-", XLOCB(19,BOT,CBGT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bgtlr-", XLOCB(19,BOTM4,CBGT,16,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bgtlr+", XLOCB(19,BOTP,CBGT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bgtlr+", XLOCB(19,BOTP4,CBGT,16,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bgtr", XLOCB(19,BOT,CBGT,16,0), XLBOCBBB_MASK, PWRCOM, { CR } }, -{ "bgtlrl", XLOCB(19,BOT,CBGT,16,1), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bgtlrl-", XLOCB(19,BOT,CBGT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bgtlrl-", XLOCB(19,BOTM4,CBGT,16,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bgtlrl+", XLOCB(19,BOTP,CBGT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bgtlrl+", XLOCB(19,BOTP4,CBGT,16,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bgtrl", XLOCB(19,BOT,CBGT,16,1), XLBOCBBB_MASK, PWRCOM, { CR } }, -{ "beqlr", XLOCB(19,BOT,CBEQ,16,0), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "beqlr-", XLOCB(19,BOT,CBEQ,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "beqlr-", XLOCB(19,BOTM4,CBEQ,16,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "beqlr+", XLOCB(19,BOTP,CBEQ,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "beqlr+", XLOCB(19,BOTP4,CBEQ,16,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "beqr", XLOCB(19,BOT,CBEQ,16,0), XLBOCBBB_MASK, PWRCOM, { CR } }, -{ "beqlrl", XLOCB(19,BOT,CBEQ,16,1), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "beqlrl-", XLOCB(19,BOT,CBEQ,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "beqlrl-", XLOCB(19,BOTM4,CBEQ,16,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "beqlrl+", XLOCB(19,BOTP,CBEQ,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "beqlrl+", XLOCB(19,BOTP4,CBEQ,16,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "beqrl", XLOCB(19,BOT,CBEQ,16,1), XLBOCBBB_MASK, PWRCOM, { CR } }, -{ "bsolr", XLOCB(19,BOT,CBSO,16,0), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bsolr-", XLOCB(19,BOT,CBSO,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bsolr-", XLOCB(19,BOTM4,CBSO,16,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bsolr+", XLOCB(19,BOTP,CBSO,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bsolr+", XLOCB(19,BOTP4,CBSO,16,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bsor", XLOCB(19,BOT,CBSO,16,0), XLBOCBBB_MASK, PWRCOM, { CR } }, -{ "bsolrl", XLOCB(19,BOT,CBSO,16,1), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bsolrl-", XLOCB(19,BOT,CBSO,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bsolrl-", XLOCB(19,BOTM4,CBSO,16,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bsolrl+", XLOCB(19,BOTP,CBSO,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bsolrl+", XLOCB(19,BOTP4,CBSO,16,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bsorl", XLOCB(19,BOT,CBSO,16,1), XLBOCBBB_MASK, PWRCOM, { CR } }, -{ "bunlr", XLOCB(19,BOT,CBSO,16,0), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bunlr-", XLOCB(19,BOT,CBSO,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bunlr-", XLOCB(19,BOTM4,CBSO,16,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bunlr+", XLOCB(19,BOTP,CBSO,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bunlr+", XLOCB(19,BOTP4,CBSO,16,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bunlrl", XLOCB(19,BOT,CBSO,16,1), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bunlrl-", XLOCB(19,BOT,CBSO,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bunlrl-", XLOCB(19,BOTM4,CBSO,16,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bunlrl+", XLOCB(19,BOTP,CBSO,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bunlrl+", XLOCB(19,BOTP4,CBSO,16,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bgelr", XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bgelr-", XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bgelr-", XLOCB(19,BOFM4,CBLT,16,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bgelr+", XLOCB(19,BOFP,CBLT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bgelr+", XLOCB(19,BOFP4,CBLT,16,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bger", XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, PWRCOM, { CR } }, -{ "bgelrl", XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bgelrl-", XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bgelrl-", XLOCB(19,BOFM4,CBLT,16,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bgelrl+", XLOCB(19,BOFP,CBLT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bgelrl+", XLOCB(19,BOFP4,CBLT,16,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bgerl", XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, PWRCOM, { CR } }, -{ "bnllr", XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bnllr-", XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnllr-", XLOCB(19,BOFM4,CBLT,16,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnllr+", XLOCB(19,BOFP,CBLT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnllr+", XLOCB(19,BOFP4,CBLT,16,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnlr", XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, PWRCOM, { CR } }, -{ "bnllrl", XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bnllrl-", XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnllrl-", XLOCB(19,BOFM4,CBLT,16,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnllrl+", XLOCB(19,BOFP,CBLT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnllrl+", XLOCB(19,BOFP4,CBLT,16,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnlrl", XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, PWRCOM, { CR } }, -{ "blelr", XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "blelr-", XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "blelr-", XLOCB(19,BOFM4,CBGT,16,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "blelr+", XLOCB(19,BOFP,CBGT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "blelr+", XLOCB(19,BOFP4,CBGT,16,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bler", XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, PWRCOM, { CR } }, -{ "blelrl", XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "blelrl-", XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "blelrl-", XLOCB(19,BOFM4,CBGT,16,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "blelrl+", XLOCB(19,BOFP,CBGT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "blelrl+", XLOCB(19,BOFP4,CBGT,16,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "blerl", XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, PWRCOM, { CR } }, -{ "bnglr", XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bnglr-", XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnglr-", XLOCB(19,BOFM4,CBGT,16,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnglr+", XLOCB(19,BOFP,CBGT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnglr+", XLOCB(19,BOFP4,CBGT,16,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bngr", XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, PWRCOM, { CR } }, -{ "bnglrl", XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bnglrl-", XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnglrl-", XLOCB(19,BOFM4,CBGT,16,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnglrl+", XLOCB(19,BOFP,CBGT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnglrl+", XLOCB(19,BOFP4,CBGT,16,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bngrl", XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, PWRCOM, { CR } }, -{ "bnelr", XLOCB(19,BOF,CBEQ,16,0), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bnelr-", XLOCB(19,BOF,CBEQ,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnelr-", XLOCB(19,BOFM4,CBEQ,16,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnelr+", XLOCB(19,BOFP,CBEQ,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnelr+", XLOCB(19,BOFP4,CBEQ,16,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bner", XLOCB(19,BOF,CBEQ,16,0), XLBOCBBB_MASK, PWRCOM, { CR } }, -{ "bnelrl", XLOCB(19,BOF,CBEQ,16,1), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bnelrl-", XLOCB(19,BOF,CBEQ,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnelrl-", XLOCB(19,BOFM4,CBEQ,16,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnelrl+", XLOCB(19,BOFP,CBEQ,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnelrl+", XLOCB(19,BOFP4,CBEQ,16,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnerl", XLOCB(19,BOF,CBEQ,16,1), XLBOCBBB_MASK, PWRCOM, { CR } }, -{ "bnslr", XLOCB(19,BOF,CBSO,16,0), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bnslr-", XLOCB(19,BOF,CBSO,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnslr-", XLOCB(19,BOFM4,CBSO,16,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnslr+", XLOCB(19,BOFP,CBSO,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnslr+", XLOCB(19,BOFP4,CBSO,16,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnsr", XLOCB(19,BOF,CBSO,16,0), XLBOCBBB_MASK, PWRCOM, { CR } }, -{ "bnslrl", XLOCB(19,BOF,CBSO,16,1), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bnslrl-", XLOCB(19,BOF,CBSO,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnslrl-", XLOCB(19,BOFM4,CBSO,16,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnslrl+", XLOCB(19,BOFP,CBSO,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnslrl+", XLOCB(19,BOFP4,CBSO,16,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnsrl", XLOCB(19,BOF,CBSO,16,1), XLBOCBBB_MASK, PWRCOM, { CR } }, -{ "bnulr", XLOCB(19,BOF,CBSO,16,0), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bnulr-", XLOCB(19,BOF,CBSO,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnulr-", XLOCB(19,BOFM4,CBSO,16,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnulr+", XLOCB(19,BOFP,CBSO,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnulr+", XLOCB(19,BOFP4,CBSO,16,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnulrl", XLOCB(19,BOF,CBSO,16,1), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bnulrl-", XLOCB(19,BOF,CBSO,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnulrl-", XLOCB(19,BOFM4,CBSO,16,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnulrl+", XLOCB(19,BOFP,CBSO,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnulrl+", XLOCB(19,BOFP4,CBSO,16,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "btlr", XLO(19,BOT,16,0), XLBOBB_MASK, PPCCOM, { BI } }, -{ "btlr-", XLO(19,BOT,16,0), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "btlr-", XLO(19,BOTM4,16,0), XLBOBB_MASK, POWER4, { BI } }, -{ "btlr+", XLO(19,BOTP,16,0), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "btlr+", XLO(19,BOTP4,16,0), XLBOBB_MASK, POWER4, { BI } }, -{ "bbtr", XLO(19,BOT,16,0), XLBOBB_MASK, PWRCOM, { BI } }, -{ "btlrl", XLO(19,BOT,16,1), XLBOBB_MASK, PPCCOM, { BI } }, -{ "btlrl-", XLO(19,BOT,16,1), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "btlrl-", XLO(19,BOTM4,16,1), XLBOBB_MASK, POWER4, { BI } }, -{ "btlrl+", XLO(19,BOTP,16,1), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "btlrl+", XLO(19,BOTP4,16,1), XLBOBB_MASK, POWER4, { BI } }, -{ "bbtrl", XLO(19,BOT,16,1), XLBOBB_MASK, PWRCOM, { BI } }, -{ "bflr", XLO(19,BOF,16,0), XLBOBB_MASK, PPCCOM, { BI } }, -{ "bflr-", XLO(19,BOF,16,0), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "bflr-", XLO(19,BOFM4,16,0), XLBOBB_MASK, POWER4, { BI } }, -{ "bflr+", XLO(19,BOFP,16,0), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "bflr+", XLO(19,BOFP4,16,0), XLBOBB_MASK, POWER4, { BI } }, -{ "bbfr", XLO(19,BOF,16,0), XLBOBB_MASK, PWRCOM, { BI } }, -{ "bflrl", XLO(19,BOF,16,1), XLBOBB_MASK, PPCCOM, { BI } }, -{ "bflrl-", XLO(19,BOF,16,1), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "bflrl-", XLO(19,BOFM4,16,1), XLBOBB_MASK, POWER4, { BI } }, -{ "bflrl+", XLO(19,BOFP,16,1), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "bflrl+", XLO(19,BOFP4,16,1), XLBOBB_MASK, POWER4, { BI } }, -{ "bbfrl", XLO(19,BOF,16,1), XLBOBB_MASK, PWRCOM, { BI } }, -{ "bdnztlr", XLO(19,BODNZT,16,0), XLBOBB_MASK, PPCCOM, { BI } }, -{ "bdnztlr-",XLO(19,BODNZT,16,0), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "bdnztlr+",XLO(19,BODNZTP,16,0), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "bdnztlrl",XLO(19,BODNZT,16,1), XLBOBB_MASK, PPCCOM, { BI } }, -{ "bdnztlrl-",XLO(19,BODNZT,16,1), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "bdnztlrl+",XLO(19,BODNZTP,16,1), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "bdnzflr", XLO(19,BODNZF,16,0), XLBOBB_MASK, PPCCOM, { BI } }, -{ "bdnzflr-",XLO(19,BODNZF,16,0), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "bdnzflr+",XLO(19,BODNZFP,16,0), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "bdnzflrl",XLO(19,BODNZF,16,1), XLBOBB_MASK, PPCCOM, { BI } }, -{ "bdnzflrl-",XLO(19,BODNZF,16,1), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "bdnzflrl+",XLO(19,BODNZFP,16,1), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "bdztlr", XLO(19,BODZT,16,0), XLBOBB_MASK, PPCCOM, { BI } }, -{ "bdztlr-", XLO(19,BODZT,16,0), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "bdztlr+", XLO(19,BODZTP,16,0), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "bdztlrl", XLO(19,BODZT,16,1), XLBOBB_MASK, PPCCOM, { BI } }, -{ "bdztlrl-",XLO(19,BODZT,16,1), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "bdztlrl+",XLO(19,BODZTP,16,1), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "bdzflr", XLO(19,BODZF,16,0), XLBOBB_MASK, PPCCOM, { BI } }, -{ "bdzflr-", XLO(19,BODZF,16,0), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "bdzflr+", XLO(19,BODZFP,16,0), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "bdzflrl", XLO(19,BODZF,16,1), XLBOBB_MASK, PPCCOM, { BI } }, -{ "bdzflrl-",XLO(19,BODZF,16,1), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "bdzflrl+",XLO(19,BODZFP,16,1), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "bclr+", XLYLK(19,16,1,0), XLYBB_MASK, PPCCOM, { BOE, BI } }, -{ "bclrl+", XLYLK(19,16,1,1), XLYBB_MASK, PPCCOM, { BOE, BI } }, -{ "bclr-", XLYLK(19,16,0,0), XLYBB_MASK, PPCCOM, { BOE, BI } }, -{ "bclrl-", XLYLK(19,16,0,1), XLYBB_MASK, PPCCOM, { BOE, BI } }, -{ "bclr", XLLK(19,16,0), XLBH_MASK, PPCCOM, { BO, BI, BH } }, -{ "bclrl", XLLK(19,16,1), XLBH_MASK, PPCCOM, { BO, BI, BH } }, -{ "bcr", XLLK(19,16,0), XLBB_MASK, PWRCOM, { BO, BI } }, -{ "bcrl", XLLK(19,16,1), XLBB_MASK, PWRCOM, { BO, BI } }, -{ "bclre", XLLK(19,17,0), XLBB_MASK, BOOKE64, { BO, BI } }, -{ "bclrel", XLLK(19,17,1), XLBB_MASK, BOOKE64, { BO, BI } }, - -{ "rfid", XL(19,18), 0xffffffff, PPC64, { 0 } }, - -{ "crnot", XL(19,33), XL_MASK, PPCCOM, { BT, BA, BBA } }, -{ "crnor", XL(19,33), XL_MASK, COM, { BT, BA, BB } }, -{ "rfmci", X(19,38), 0xffffffff, PPCRFMCI, { 0 } }, - -{ "rfi", XL(19,50), 0xffffffff, COM, { 0 } }, -{ "rfci", XL(19,51), 0xffffffff, PPC403 | BOOKE, { 0 } }, - -{ "rfsvc", XL(19,82), 0xffffffff, POWER, { 0 } }, - -{ "crandc", XL(19,129), XL_MASK, COM, { BT, BA, BB } }, - -{ "isync", XL(19,150), 0xffffffff, PPCCOM, { 0 } }, -{ "ics", XL(19,150), 0xffffffff, PWRCOM, { 0 } }, - -{ "crclr", XL(19,193), XL_MASK, PPCCOM, { BT, BAT, BBA } }, -{ "crxor", XL(19,193), XL_MASK, COM, { BT, BA, BB } }, - -{ "crnand", XL(19,225), XL_MASK, COM, { BT, BA, BB } }, - -{ "crand", XL(19,257), XL_MASK, COM, { BT, BA, BB } }, - -{ "hrfid", XL(19,274), 0xffffffff, POWER5 | CELL, { 0 } }, - -{ "crset", XL(19,289), XL_MASK, PPCCOM, { BT, BAT, BBA } }, -{ "creqv", XL(19,289), XL_MASK, COM, { BT, BA, BB } }, - -{ "doze", XL(19,402), 0xffffffff, POWER6, { 0 } }, - -{ "crorc", XL(19,417), XL_MASK, COM, { BT, BA, BB } }, - -{ "nap", XL(19,434), 0xffffffff, POWER6, { 0 } }, - -{ "crmove", XL(19,449), XL_MASK, PPCCOM, { BT, BA, BBA } }, -{ "cror", XL(19,449), XL_MASK, COM, { BT, BA, BB } }, - -{ "sleep", XL(19,466), 0xffffffff, POWER6, { 0 } }, -{ "rvwinkle", XL(19,498), 0xffffffff, POWER6, { 0 } }, - -{ "bctr", XLO(19,BOU,528,0), XLBOBIBB_MASK, COM, { 0 } }, -{ "bctrl", XLO(19,BOU,528,1), XLBOBIBB_MASK, COM, { 0 } }, -{ "bltctr", XLOCB(19,BOT,CBLT,528,0), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bltctr-", XLOCB(19,BOT,CBLT,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bltctr-", XLOCB(19,BOTM4,CBLT,528,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bltctr+", XLOCB(19,BOTP,CBLT,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bltctr+", XLOCB(19,BOTP4,CBLT,528,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bltctrl", XLOCB(19,BOT,CBLT,528,1), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bltctrl-",XLOCB(19,BOT,CBLT,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bltctrl-",XLOCB(19,BOTM4,CBLT,528,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bltctrl+",XLOCB(19,BOTP,CBLT,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bltctrl+",XLOCB(19,BOTP4,CBLT,528,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bgtctr", XLOCB(19,BOT,CBGT,528,0), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bgtctr-", XLOCB(19,BOT,CBGT,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bgtctr-", XLOCB(19,BOTM4,CBGT,528,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bgtctr+", XLOCB(19,BOTP,CBGT,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bgtctr+", XLOCB(19,BOTP4,CBGT,528,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bgtctrl", XLOCB(19,BOT,CBGT,528,1), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bgtctrl-",XLOCB(19,BOT,CBGT,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bgtctrl-",XLOCB(19,BOTM4,CBGT,528,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bgtctrl+",XLOCB(19,BOTP,CBGT,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bgtctrl+",XLOCB(19,BOTP4,CBGT,528,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "beqctr", XLOCB(19,BOT,CBEQ,528,0), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "beqctr-", XLOCB(19,BOT,CBEQ,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "beqctr-", XLOCB(19,BOTM4,CBEQ,528,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "beqctr+", XLOCB(19,BOTP,CBEQ,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "beqctr+", XLOCB(19,BOTP4,CBEQ,528,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "beqctrl", XLOCB(19,BOT,CBEQ,528,1), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "beqctrl-",XLOCB(19,BOT,CBEQ,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "beqctrl-",XLOCB(19,BOTM4,CBEQ,528,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "beqctrl+",XLOCB(19,BOTP,CBEQ,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "beqctrl+",XLOCB(19,BOTP4,CBEQ,528,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bsoctr", XLOCB(19,BOT,CBSO,528,0), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bsoctr-", XLOCB(19,BOT,CBSO,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bsoctr-", XLOCB(19,BOTM4,CBSO,528,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bsoctr+", XLOCB(19,BOTP,CBSO,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bsoctr+", XLOCB(19,BOTP4,CBSO,528,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bsoctrl", XLOCB(19,BOT,CBSO,528,1), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bsoctrl-",XLOCB(19,BOT,CBSO,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bsoctrl-",XLOCB(19,BOTM4,CBSO,528,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bsoctrl+",XLOCB(19,BOTP,CBSO,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bsoctrl+",XLOCB(19,BOTP4,CBSO,528,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bunctr", XLOCB(19,BOT,CBSO,528,0), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bunctr-", XLOCB(19,BOT,CBSO,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bunctr-", XLOCB(19,BOTM4,CBSO,528,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bunctr+", XLOCB(19,BOTP,CBSO,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bunctr+", XLOCB(19,BOTP4,CBSO,528,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bunctrl", XLOCB(19,BOT,CBSO,528,1), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bunctrl-",XLOCB(19,BOT,CBSO,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bunctrl-",XLOCB(19,BOTM4,CBSO,528,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bunctrl+",XLOCB(19,BOTP,CBSO,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bunctrl+",XLOCB(19,BOTP4,CBSO,528,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bgectr", XLOCB(19,BOF,CBLT,528,0), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bgectr-", XLOCB(19,BOF,CBLT,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bgectr-", XLOCB(19,BOFM4,CBLT,528,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bgectr+", XLOCB(19,BOFP,CBLT,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bgectr+", XLOCB(19,BOFP4,CBLT,528,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bgectrl", XLOCB(19,BOF,CBLT,528,1), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bgectrl-",XLOCB(19,BOF,CBLT,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bgectrl-",XLOCB(19,BOFM4,CBLT,528,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bgectrl+",XLOCB(19,BOFP,CBLT,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bgectrl+",XLOCB(19,BOFP4,CBLT,528,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnlctr", XLOCB(19,BOF,CBLT,528,0), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bnlctr-", XLOCB(19,BOF,CBLT,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnlctr-", XLOCB(19,BOFM4,CBLT,528,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnlctr+", XLOCB(19,BOFP,CBLT,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnlctr+", XLOCB(19,BOFP4,CBLT,528,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnlctrl", XLOCB(19,BOF,CBLT,528,1), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bnlctrl-",XLOCB(19,BOF,CBLT,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnlctrl-",XLOCB(19,BOFM4,CBLT,528,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnlctrl+",XLOCB(19,BOFP,CBLT,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnlctrl+",XLOCB(19,BOFP4,CBLT,528,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "blectr", XLOCB(19,BOF,CBGT,528,0), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "blectr-", XLOCB(19,BOF,CBGT,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "blectr-", XLOCB(19,BOFM4,CBGT,528,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "blectr+", XLOCB(19,BOFP,CBGT,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "blectr+", XLOCB(19,BOFP4,CBGT,528,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "blectrl", XLOCB(19,BOF,CBGT,528,1), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "blectrl-",XLOCB(19,BOF,CBGT,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "blectrl-",XLOCB(19,BOFM4,CBGT,528,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "blectrl+",XLOCB(19,BOFP,CBGT,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "blectrl+",XLOCB(19,BOFP4,CBGT,528,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bngctr", XLOCB(19,BOF,CBGT,528,0), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bngctr-", XLOCB(19,BOF,CBGT,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bngctr-", XLOCB(19,BOFM4,CBGT,528,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bngctr+", XLOCB(19,BOFP,CBGT,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bngctr+", XLOCB(19,BOFP4,CBGT,528,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bngctrl", XLOCB(19,BOF,CBGT,528,1), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bngctrl-",XLOCB(19,BOF,CBGT,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bngctrl-",XLOCB(19,BOFM4,CBGT,528,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bngctrl+",XLOCB(19,BOFP,CBGT,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bngctrl+",XLOCB(19,BOFP4,CBGT,528,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnectr", XLOCB(19,BOF,CBEQ,528,0), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bnectr-", XLOCB(19,BOF,CBEQ,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnectr-", XLOCB(19,BOFM4,CBEQ,528,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnectr+", XLOCB(19,BOFP,CBEQ,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnectr+", XLOCB(19,BOFP4,CBEQ,528,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnectrl", XLOCB(19,BOF,CBEQ,528,1), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bnectrl-",XLOCB(19,BOF,CBEQ,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnectrl-",XLOCB(19,BOFM4,CBEQ,528,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnectrl+",XLOCB(19,BOFP,CBEQ,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnectrl+",XLOCB(19,BOFP4,CBEQ,528,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnsctr", XLOCB(19,BOF,CBSO,528,0), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bnsctr-", XLOCB(19,BOF,CBSO,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnsctr-", XLOCB(19,BOFM4,CBSO,528,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnsctr+", XLOCB(19,BOFP,CBSO,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnsctr+", XLOCB(19,BOFP4,CBSO,528,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnsctrl", XLOCB(19,BOF,CBSO,528,1), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bnsctrl-",XLOCB(19,BOF,CBSO,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnsctrl-",XLOCB(19,BOFM4,CBSO,528,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnsctrl+",XLOCB(19,BOFP,CBSO,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnsctrl+",XLOCB(19,BOFP4,CBSO,528,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnuctr", XLOCB(19,BOF,CBSO,528,0), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bnuctr-", XLOCB(19,BOF,CBSO,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnuctr-", XLOCB(19,BOFM4,CBSO,528,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnuctr+", XLOCB(19,BOFP,CBSO,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnuctr+", XLOCB(19,BOFP4,CBSO,528,0), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnuctrl", XLOCB(19,BOF,CBSO,528,1), XLBOCBBB_MASK, PPCCOM, { CR } }, -{ "bnuctrl-",XLOCB(19,BOF,CBSO,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnuctrl-",XLOCB(19,BOFM4,CBSO,528,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "bnuctrl+",XLOCB(19,BOFP,CBSO,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } }, -{ "bnuctrl+",XLOCB(19,BOFP4,CBSO,528,1), XLBOCBBB_MASK, POWER4, { CR } }, -{ "btctr", XLO(19,BOT,528,0), XLBOBB_MASK, PPCCOM, { BI } }, -{ "btctr-", XLO(19,BOT,528,0), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "btctr-", XLO(19,BOTM4,528,0), XLBOBB_MASK, POWER4, { BI } }, -{ "btctr+", XLO(19,BOTP,528,0), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "btctr+", XLO(19,BOTP4,528,0), XLBOBB_MASK, POWER4, { BI } }, -{ "btctrl", XLO(19,BOT,528,1), XLBOBB_MASK, PPCCOM, { BI } }, -{ "btctrl-", XLO(19,BOT,528,1), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "btctrl-", XLO(19,BOTM4,528,1), XLBOBB_MASK, POWER4, { BI } }, -{ "btctrl+", XLO(19,BOTP,528,1), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "btctrl+", XLO(19,BOTP4,528,1), XLBOBB_MASK, POWER4, { BI } }, -{ "bfctr", XLO(19,BOF,528,0), XLBOBB_MASK, PPCCOM, { BI } }, -{ "bfctr-", XLO(19,BOF,528,0), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "bfctr-", XLO(19,BOFM4,528,0), XLBOBB_MASK, POWER4, { BI } }, -{ "bfctr+", XLO(19,BOFP,528,0), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "bfctr+", XLO(19,BOFP4,528,0), XLBOBB_MASK, POWER4, { BI } }, -{ "bfctrl", XLO(19,BOF,528,1), XLBOBB_MASK, PPCCOM, { BI } }, -{ "bfctrl-", XLO(19,BOF,528,1), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "bfctrl-", XLO(19,BOFM4,528,1), XLBOBB_MASK, POWER4, { BI } }, -{ "bfctrl+", XLO(19,BOFP,528,1), XLBOBB_MASK, NOPOWER4, { BI } }, -{ "bfctrl+", XLO(19,BOFP4,528,1), XLBOBB_MASK, POWER4, { BI } }, -{ "bcctr-", XLYLK(19,528,0,0), XLYBB_MASK, PPCCOM, { BOE, BI } }, -{ "bcctr+", XLYLK(19,528,1,0), XLYBB_MASK, PPCCOM, { BOE, BI } }, -{ "bcctrl-", XLYLK(19,528,0,1), XLYBB_MASK, PPCCOM, { BOE, BI } }, -{ "bcctrl+", XLYLK(19,528,1,1), XLYBB_MASK, PPCCOM, { BOE, BI } }, -{ "bcctr", XLLK(19,528,0), XLBH_MASK, PPCCOM, { BO, BI, BH } }, -{ "bcctrl", XLLK(19,528,1), XLBH_MASK, PPCCOM, { BO, BI, BH } }, -{ "bcc", XLLK(19,528,0), XLBB_MASK, PWRCOM, { BO, BI } }, -{ "bccl", XLLK(19,528,1), XLBB_MASK, PWRCOM, { BO, BI } }, -{ "bcctre", XLLK(19,529,0), XLBB_MASK, BOOKE64, { BO, BI } }, -{ "bcctrel", XLLK(19,529,1), XLBB_MASK, BOOKE64, { BO, BI } }, - -{ "rlwimi", M(20,0), M_MASK, PPCCOM, { RA,RS,SH,MBE,ME } }, -{ "rlimi", M(20,0), M_MASK, PWRCOM, { RA,RS,SH,MBE,ME } }, - -{ "rlwimi.", M(20,1), M_MASK, PPCCOM, { RA,RS,SH,MBE,ME } }, -{ "rlimi.", M(20,1), M_MASK, PWRCOM, { RA,RS,SH,MBE,ME } }, - -{ "rotlwi", MME(21,31,0), MMBME_MASK, PPCCOM, { RA, RS, SH } }, -{ "clrlwi", MME(21,31,0), MSHME_MASK, PPCCOM, { RA, RS, MB } }, -{ "rlwinm", M(21,0), M_MASK, PPCCOM, { RA,RS,SH,MBE,ME } }, -{ "rlinm", M(21,0), M_MASK, PWRCOM, { RA,RS,SH,MBE,ME } }, -{ "rotlwi.", MME(21,31,1), MMBME_MASK, PPCCOM, { RA,RS,SH } }, -{ "clrlwi.", MME(21,31,1), MSHME_MASK, PPCCOM, { RA, RS, MB } }, -{ "rlwinm.", M(21,1), M_MASK, PPCCOM, { RA,RS,SH,MBE,ME } }, -{ "rlinm.", M(21,1), M_MASK, PWRCOM, { RA,RS,SH,MBE,ME } }, - -{ "rlmi", M(22,0), M_MASK, M601, { RA,RS,RB,MBE,ME } }, -{ "rlmi.", M(22,1), M_MASK, M601, { RA,RS,RB,MBE,ME } }, - -{ "be", B(22,0,0), B_MASK, BOOKE64, { LI } }, -{ "bel", B(22,0,1), B_MASK, BOOKE64, { LI } }, -{ "bea", B(22,1,0), B_MASK, BOOKE64, { LIA } }, -{ "bela", B(22,1,1), B_MASK, BOOKE64, { LIA } }, - -{ "rotlw", MME(23,31,0), MMBME_MASK, PPCCOM, { RA, RS, RB } }, -{ "rlwnm", M(23,0), M_MASK, PPCCOM, { RA,RS,RB,MBE,ME } }, -{ "rlnm", M(23,0), M_MASK, PWRCOM, { RA,RS,RB,MBE,ME } }, -{ "rotlw.", MME(23,31,1), MMBME_MASK, PPCCOM, { RA, RS, RB } }, -{ "rlwnm.", M(23,1), M_MASK, PPCCOM, { RA,RS,RB,MBE,ME } }, -{ "rlnm.", M(23,1), M_MASK, PWRCOM, { RA,RS,RB,MBE,ME } }, - -{ "nop", OP(24), 0xffffffff, PPCCOM, { 0 } }, -{ "ori", OP(24), OP_MASK, PPCCOM, { RA, RS, UI } }, -{ "oril", OP(24), OP_MASK, PWRCOM, { RA, RS, UI } }, - -{ "oris", OP(25), OP_MASK, PPCCOM, { RA, RS, UI } }, -{ "oriu", OP(25), OP_MASK, PWRCOM, { RA, RS, UI } }, - -{ "xori", OP(26), OP_MASK, PPCCOM, { RA, RS, UI } }, -{ "xoril", OP(26), OP_MASK, PWRCOM, { RA, RS, UI } }, - -{ "xoris", OP(27), OP_MASK, PPCCOM, { RA, RS, UI } }, -{ "xoriu", OP(27), OP_MASK, PWRCOM, { RA, RS, UI } }, - -{ "andi.", OP(28), OP_MASK, PPCCOM, { RA, RS, UI } }, -{ "andil.", OP(28), OP_MASK, PWRCOM, { RA, RS, UI } }, - -{ "andis.", OP(29), OP_MASK, PPCCOM, { RA, RS, UI } }, -{ "andiu.", OP(29), OP_MASK, PWRCOM, { RA, RS, UI } }, - -{ "rotldi", MD(30,0,0), MDMB_MASK, PPC64, { RA, RS, SH6 } }, -{ "clrldi", MD(30,0,0), MDSH_MASK, PPC64, { RA, RS, MB6 } }, -{ "rldicl", MD(30,0,0), MD_MASK, PPC64, { RA, RS, SH6, MB6 } }, -{ "rotldi.", MD(30,0,1), MDMB_MASK, PPC64, { RA, RS, SH6 } }, -{ "clrldi.", MD(30,0,1), MDSH_MASK, PPC64, { RA, RS, MB6 } }, -{ "rldicl.", MD(30,0,1), MD_MASK, PPC64, { RA, RS, SH6, MB6 } }, - -{ "rldicr", MD(30,1,0), MD_MASK, PPC64, { RA, RS, SH6, ME6 } }, -{ "rldicr.", MD(30,1,1), MD_MASK, PPC64, { RA, RS, SH6, ME6 } }, - -{ "rldic", MD(30,2,0), MD_MASK, PPC64, { RA, RS, SH6, MB6 } }, -{ "rldic.", MD(30,2,1), MD_MASK, PPC64, { RA, RS, SH6, MB6 } }, - -{ "rldimi", MD(30,3,0), MD_MASK, PPC64, { RA, RS, SH6, MB6 } }, -{ "rldimi.", MD(30,3,1), MD_MASK, PPC64, { RA, RS, SH6, MB6 } }, - -{ "rotld", MDS(30,8,0), MDSMB_MASK, PPC64, { RA, RS, RB } }, -{ "rldcl", MDS(30,8,0), MDS_MASK, PPC64, { RA, RS, RB, MB6 } }, -{ "rotld.", MDS(30,8,1), MDSMB_MASK, PPC64, { RA, RS, RB } }, -{ "rldcl.", MDS(30,8,1), MDS_MASK, PPC64, { RA, RS, RB, MB6 } }, - -{ "rldcr", MDS(30,9,0), MDS_MASK, PPC64, { RA, RS, RB, ME6 } }, -{ "rldcr.", MDS(30,9,1), MDS_MASK, PPC64, { RA, RS, RB, ME6 } }, - -{ "cmpw", XOPL(31,0,0), XCMPL_MASK, PPCCOM, { OBF, RA, RB } }, -{ "cmpd", XOPL(31,0,1), XCMPL_MASK, PPC64, { OBF, RA, RB } }, -{ "cmp", X(31,0), XCMP_MASK, PPC, { BF, L, RA, RB } }, -{ "cmp", X(31,0), XCMPL_MASK, PWRCOM, { BF, RA, RB } }, - -{ "twlgt", XTO(31,4,TOLGT), XTO_MASK, PPCCOM, { RA, RB } }, -{ "tlgt", XTO(31,4,TOLGT), XTO_MASK, PWRCOM, { RA, RB } }, -{ "twllt", XTO(31,4,TOLLT), XTO_MASK, PPCCOM, { RA, RB } }, -{ "tllt", XTO(31,4,TOLLT), XTO_MASK, PWRCOM, { RA, RB } }, -{ "tweq", XTO(31,4,TOEQ), XTO_MASK, PPCCOM, { RA, RB } }, -{ "teq", XTO(31,4,TOEQ), XTO_MASK, PWRCOM, { RA, RB } }, -{ "twlge", XTO(31,4,TOLGE), XTO_MASK, PPCCOM, { RA, RB } }, -{ "tlge", XTO(31,4,TOLGE), XTO_MASK, PWRCOM, { RA, RB } }, -{ "twlnl", XTO(31,4,TOLNL), XTO_MASK, PPCCOM, { RA, RB } }, -{ "tlnl", XTO(31,4,TOLNL), XTO_MASK, PWRCOM, { RA, RB } }, -{ "twlle", XTO(31,4,TOLLE), XTO_MASK, PPCCOM, { RA, RB } }, -{ "tlle", XTO(31,4,TOLLE), XTO_MASK, PWRCOM, { RA, RB } }, -{ "twlng", XTO(31,4,TOLNG), XTO_MASK, PPCCOM, { RA, RB } }, -{ "tlng", XTO(31,4,TOLNG), XTO_MASK, PWRCOM, { RA, RB } }, -{ "twgt", XTO(31,4,TOGT), XTO_MASK, PPCCOM, { RA, RB } }, -{ "tgt", XTO(31,4,TOGT), XTO_MASK, PWRCOM, { RA, RB } }, -{ "twge", XTO(31,4,TOGE), XTO_MASK, PPCCOM, { RA, RB } }, -{ "tge", XTO(31,4,TOGE), XTO_MASK, PWRCOM, { RA, RB } }, -{ "twnl", XTO(31,4,TONL), XTO_MASK, PPCCOM, { RA, RB } }, -{ "tnl", XTO(31,4,TONL), XTO_MASK, PWRCOM, { RA, RB } }, -{ "twlt", XTO(31,4,TOLT), XTO_MASK, PPCCOM, { RA, RB } }, -{ "tlt", XTO(31,4,TOLT), XTO_MASK, PWRCOM, { RA, RB } }, -{ "twle", XTO(31,4,TOLE), XTO_MASK, PPCCOM, { RA, RB } }, -{ "tle", XTO(31,4,TOLE), XTO_MASK, PWRCOM, { RA, RB } }, -{ "twng", XTO(31,4,TONG), XTO_MASK, PPCCOM, { RA, RB } }, -{ "tng", XTO(31,4,TONG), XTO_MASK, PWRCOM, { RA, RB } }, -{ "twne", XTO(31,4,TONE), XTO_MASK, PPCCOM, { RA, RB } }, -{ "tne", XTO(31,4,TONE), XTO_MASK, PWRCOM, { RA, RB } }, -{ "trap", XTO(31,4,TOU), 0xffffffff, PPCCOM, { 0 } }, -{ "tw", X(31,4), X_MASK, PPCCOM, { TO, RA, RB } }, -{ "t", X(31,4), X_MASK, PWRCOM, { TO, RA, RB } }, - -{ "subfc", XO(31,8,0,0), XO_MASK, PPCCOM, { RT, RA, RB } }, -{ "sf", XO(31,8,0,0), XO_MASK, PWRCOM, { RT, RA, RB } }, -{ "subc", XO(31,8,0,0), XO_MASK, PPC, { RT, RB, RA } }, -{ "subfc.", XO(31,8,0,1), XO_MASK, PPCCOM, { RT, RA, RB } }, -{ "sf.", XO(31,8,0,1), XO_MASK, PWRCOM, { RT, RA, RB } }, -{ "subc.", XO(31,8,0,1), XO_MASK, PPCCOM, { RT, RB, RA } }, -{ "subfco", XO(31,8,1,0), XO_MASK, PPCCOM, { RT, RA, RB } }, -{ "sfo", XO(31,8,1,0), XO_MASK, PWRCOM, { RT, RA, RB } }, -{ "subco", XO(31,8,1,0), XO_MASK, PPC, { RT, RB, RA } }, -{ "subfco.", XO(31,8,1,1), XO_MASK, PPCCOM, { RT, RA, RB } }, -{ "sfo.", XO(31,8,1,1), XO_MASK, PWRCOM, { RT, RA, RB } }, -{ "subco.", XO(31,8,1,1), XO_MASK, PPC, { RT, RB, RA } }, - -{ "mulhdu", XO(31,9,0,0), XO_MASK, PPC64, { RT, RA, RB } }, -{ "mulhdu.", XO(31,9,0,1), XO_MASK, PPC64, { RT, RA, RB } }, - -{ "addc", XO(31,10,0,0), XO_MASK, PPCCOM, { RT, RA, RB } }, -{ "a", XO(31,10,0,0), XO_MASK, PWRCOM, { RT, RA, RB } }, -{ "addc.", XO(31,10,0,1), XO_MASK, PPCCOM, { RT, RA, RB } }, -{ "a.", XO(31,10,0,1), XO_MASK, PWRCOM, { RT, RA, RB } }, -{ "addco", XO(31,10,1,0), XO_MASK, PPCCOM, { RT, RA, RB } }, -{ "ao", XO(31,10,1,0), XO_MASK, PWRCOM, { RT, RA, RB } }, -{ "addco.", XO(31,10,1,1), XO_MASK, PPCCOM, { RT, RA, RB } }, -{ "ao.", XO(31,10,1,1), XO_MASK, PWRCOM, { RT, RA, RB } }, - -{ "mulhwu", XO(31,11,0,0), XO_MASK, PPC, { RT, RA, RB } }, -{ "mulhwu.", XO(31,11,0,1), XO_MASK, PPC, { RT, RA, RB } }, - -{ "isellt", X(31,15), X_MASK, PPCISEL, { RT, RA, RB } }, -{ "iselgt", X(31,47), X_MASK, PPCISEL, { RT, RA, RB } }, -{ "iseleq", X(31,79), X_MASK, PPCISEL, { RT, RA, RB } }, -{ "isel", XISEL(31,15), XISEL_MASK, PPCISEL, { RT, RA, RB, CRB } }, - -{ "mfocrf", XFXM(31,19,0,1), XFXFXM_MASK, COM, { RT, FXM } }, -{ "mfcr", X(31,19), XRARB_MASK, NOPOWER4 | COM, { RT } }, -{ "mfcr", X(31,19), XFXFXM_MASK, POWER4, { RT, FXM4 } }, - -{ "lwarx", X(31,20), XEH_MASK, PPC, { RT, RA0, RB, EH } }, - -{ "ldx", X(31,21), X_MASK, PPC64, { RT, RA0, RB } }, - -{ "icbt", X(31,22), X_MASK, BOOKE|PPCE300, { CT, RA, RB } }, -{ "icbt", X(31,262), XRT_MASK, PPC403, { RA, RB } }, - -{ "lwzx", X(31,23), X_MASK, PPCCOM, { RT, RA0, RB } }, -{ "lx", X(31,23), X_MASK, PWRCOM, { RT, RA, RB } }, - -{ "slw", XRC(31,24,0), X_MASK, PPCCOM, { RA, RS, RB } }, -{ "sl", XRC(31,24,0), X_MASK, PWRCOM, { RA, RS, RB } }, -{ "slw.", XRC(31,24,1), X_MASK, PPCCOM, { RA, RS, RB } }, -{ "sl.", XRC(31,24,1), X_MASK, PWRCOM, { RA, RS, RB } }, - -{ "cntlzw", XRC(31,26,0), XRB_MASK, PPCCOM, { RA, RS } }, -{ "cntlz", XRC(31,26,0), XRB_MASK, PWRCOM, { RA, RS } }, -{ "cntlzw.", XRC(31,26,1), XRB_MASK, PPCCOM, { RA, RS } }, -{ "cntlz.", XRC(31,26,1), XRB_MASK, PWRCOM, { RA, RS } }, - -{ "sld", XRC(31,27,0), X_MASK, PPC64, { RA, RS, RB } }, -{ "sld.", XRC(31,27,1), X_MASK, PPC64, { RA, RS, RB } }, - -{ "and", XRC(31,28,0), X_MASK, COM, { RA, RS, RB } }, -{ "and.", XRC(31,28,1), X_MASK, COM, { RA, RS, RB } }, - -{ "maskg", XRC(31,29,0), X_MASK, M601, { RA, RS, RB } }, -{ "maskg.", XRC(31,29,1), X_MASK, M601, { RA, RS, RB } }, - -{ "icbte", X(31,30), X_MASK, BOOKE64, { CT, RA, RB } }, - -{ "lwzxe", X(31,31), X_MASK, BOOKE64, { RT, RA0, RB } }, - -{ "cmplw", XOPL(31,32,0), XCMPL_MASK, PPCCOM, { OBF, RA, RB } }, -{ "cmpld", XOPL(31,32,1), XCMPL_MASK, PPC64, { OBF, RA, RB } }, -{ "cmpl", X(31,32), XCMP_MASK, PPC, { BF, L, RA, RB } }, -{ "cmpl", X(31,32), XCMPL_MASK, PWRCOM, { BF, RA, RB } }, - -{ "subf", XO(31,40,0,0), XO_MASK, PPC, { RT, RA, RB } }, -{ "sub", XO(31,40,0,0), XO_MASK, PPC, { RT, RB, RA } }, -{ "subf.", XO(31,40,0,1), XO_MASK, PPC, { RT, RA, RB } }, -{ "sub.", XO(31,40,0,1), XO_MASK, PPC, { RT, RB, RA } }, -{ "subfo", XO(31,40,1,0), XO_MASK, PPC, { RT, RA, RB } }, -{ "subo", XO(31,40,1,0), XO_MASK, PPC, { RT, RB, RA } }, -{ "subfo.", XO(31,40,1,1), XO_MASK, PPC, { RT, RA, RB } }, -{ "subo.", XO(31,40,1,1), XO_MASK, PPC, { RT, RB, RA } }, - -{ "ldux", X(31,53), X_MASK, PPC64, { RT, RAL, RB } }, - -{ "dcbst", X(31,54), XRT_MASK, PPC, { RA, RB } }, - -{ "lwzux", X(31,55), X_MASK, PPCCOM, { RT, RAL, RB } }, -{ "lux", X(31,55), X_MASK, PWRCOM, { RT, RA, RB } }, - -{ "dcbste", X(31,62), XRT_MASK, BOOKE64, { RA, RB } }, - -{ "lwzuxe", X(31,63), X_MASK, BOOKE64, { RT, RAL, RB } }, - -{ "cntlzd", XRC(31,58,0), XRB_MASK, PPC64, { RA, RS } }, -{ "cntlzd.", XRC(31,58,1), XRB_MASK, PPC64, { RA, RS } }, - -{ "andc", XRC(31,60,0), X_MASK, COM, { RA, RS, RB } }, -{ "andc.", XRC(31,60,1), X_MASK, COM, { RA, RS, RB } }, - -{ "tdlgt", XTO(31,68,TOLGT), XTO_MASK, PPC64, { RA, RB } }, -{ "tdllt", XTO(31,68,TOLLT), XTO_MASK, PPC64, { RA, RB } }, -{ "tdeq", XTO(31,68,TOEQ), XTO_MASK, PPC64, { RA, RB } }, -{ "tdlge", XTO(31,68,TOLGE), XTO_MASK, PPC64, { RA, RB } }, -{ "tdlnl", XTO(31,68,TOLNL), XTO_MASK, PPC64, { RA, RB } }, -{ "tdlle", XTO(31,68,TOLLE), XTO_MASK, PPC64, { RA, RB } }, -{ "tdlng", XTO(31,68,TOLNG), XTO_MASK, PPC64, { RA, RB } }, -{ "tdgt", XTO(31,68,TOGT), XTO_MASK, PPC64, { RA, RB } }, -{ "tdge", XTO(31,68,TOGE), XTO_MASK, PPC64, { RA, RB } }, -{ "tdnl", XTO(31,68,TONL), XTO_MASK, PPC64, { RA, RB } }, -{ "tdlt", XTO(31,68,TOLT), XTO_MASK, PPC64, { RA, RB } }, -{ "tdle", XTO(31,68,TOLE), XTO_MASK, PPC64, { RA, RB } }, -{ "tdng", XTO(31,68,TONG), XTO_MASK, PPC64, { RA, RB } }, -{ "tdne", XTO(31,68,TONE), XTO_MASK, PPC64, { RA, RB } }, -{ "td", X(31,68), X_MASK, PPC64, { TO, RA, RB } }, - -{ "mulhd", XO(31,73,0,0), XO_MASK, PPC64, { RT, RA, RB } }, -{ "mulhd.", XO(31,73,0,1), XO_MASK, PPC64, { RT, RA, RB } }, - -{ "mulhw", XO(31,75,0,0), XO_MASK, PPC, { RT, RA, RB } }, -{ "mulhw.", XO(31,75,0,1), XO_MASK, PPC, { RT, RA, RB } }, - -{ "dlmzb", XRC(31,78,0), X_MASK, PPC403|PPC440, { RA, RS, RB } }, -{ "dlmzb.", XRC(31,78,1), X_MASK, PPC403|PPC440, { RA, RS, RB } }, - -{ "mtsrd", X(31,82), XRB_MASK|(1<<20), PPC64, { SR, RS } }, - -{ "mfmsr", X(31,83), XRARB_MASK, COM, { RT } }, - -{ "ldarx", X(31,84), XEH_MASK, PPC64, { RT, RA0, RB, EH } }, - -{ "dcbfl", XOPL(31,86,1), XRT_MASK, POWER5, { RA, RB } }, -{ "dcbf", X(31,86), XLRT_MASK, PPC, { RA, RB, L } }, - -{ "lbzx", X(31,87), X_MASK, COM, { RT, RA0, RB } }, - -{ "dcbfe", X(31,94), XRT_MASK, BOOKE64, { RA, RB } }, - -{ "lbzxe", X(31,95), X_MASK, BOOKE64, { RT, RA0, RB } }, - -{ "neg", XO(31,104,0,0), XORB_MASK, COM, { RT, RA } }, -{ "neg.", XO(31,104,0,1), XORB_MASK, COM, { RT, RA } }, -{ "nego", XO(31,104,1,0), XORB_MASK, COM, { RT, RA } }, -{ "nego.", XO(31,104,1,1), XORB_MASK, COM, { RT, RA } }, - -{ "mul", XO(31,107,0,0), XO_MASK, M601, { RT, RA, RB } }, -{ "mul.", XO(31,107,0,1), XO_MASK, M601, { RT, RA, RB } }, -{ "mulo", XO(31,107,1,0), XO_MASK, M601, { RT, RA, RB } }, -{ "mulo.", XO(31,107,1,1), XO_MASK, M601, { RT, RA, RB } }, - -{ "mtsrdin", X(31,114), XRA_MASK, PPC64, { RS, RB } }, - -{ "clf", X(31,118), XTO_MASK, POWER, { RA, RB } }, - -{ "lbzux", X(31,119), X_MASK, COM, { RT, RAL, RB } }, - -{ "popcntb", X(31,122), XRB_MASK, POWER5, { RA, RS } }, - -{ "not", XRC(31,124,0), X_MASK, COM, { RA, RS, RBS } }, -{ "nor", XRC(31,124,0), X_MASK, COM, { RA, RS, RB } }, -{ "not.", XRC(31,124,1), X_MASK, COM, { RA, RS, RBS } }, -{ "nor.", XRC(31,124,1), X_MASK, COM, { RA, RS, RB } }, - -{ "lwarxe", X(31,126), X_MASK, BOOKE64, { RT, RA0, RB } }, - -{ "lbzuxe", X(31,127), X_MASK, BOOKE64, { RT, RAL, RB } }, - -{ "wrtee", X(31,131), XRARB_MASK, PPC403 | BOOKE, { RS } }, - -{ "dcbtstls",X(31,134), X_MASK, PPCCHLK, { CT, RA, RB }}, - -{ "subfe", XO(31,136,0,0), XO_MASK, PPCCOM, { RT, RA, RB } }, -{ "sfe", XO(31,136,0,0), XO_MASK, PWRCOM, { RT, RA, RB } }, -{ "subfe.", XO(31,136,0,1), XO_MASK, PPCCOM, { RT, RA, RB } }, -{ "sfe.", XO(31,136,0,1), XO_MASK, PWRCOM, { RT, RA, RB } }, -{ "subfeo", XO(31,136,1,0), XO_MASK, PPCCOM, { RT, RA, RB } }, -{ "sfeo", XO(31,136,1,0), XO_MASK, PWRCOM, { RT, RA, RB } }, -{ "subfeo.", XO(31,136,1,1), XO_MASK, PPCCOM, { RT, RA, RB } }, -{ "sfeo.", XO(31,136,1,1), XO_MASK, PWRCOM, { RT, RA, RB } }, - -{ "adde", XO(31,138,0,0), XO_MASK, PPCCOM, { RT, RA, RB } }, -{ "ae", XO(31,138,0,0), XO_MASK, PWRCOM, { RT, RA, RB } }, -{ "adde.", XO(31,138,0,1), XO_MASK, PPCCOM, { RT, RA, RB } }, -{ "ae.", XO(31,138,0,1), XO_MASK, PWRCOM, { RT, RA, RB } }, -{ "addeo", XO(31,138,1,0), XO_MASK, PPCCOM, { RT, RA, RB } }, -{ "aeo", XO(31,138,1,0), XO_MASK, PWRCOM, { RT, RA, RB } }, -{ "addeo.", XO(31,138,1,1), XO_MASK, PPCCOM, { RT, RA, RB } }, -{ "aeo.", XO(31,138,1,1), XO_MASK, PWRCOM, { RT, RA, RB } }, - -{ "dcbtstlse",X(31,142),X_MASK, PPCCHLK64, { CT, RA, RB }}, - -{ "mtocrf", XFXM(31,144,0,1), XFXFXM_MASK, COM, { FXM, RS } }, -{ "mtcr", XFXM(31,144,0xff,0), XRARB_MASK, COM, { RS }}, -{ "mtcrf", X(31,144), XFXFXM_MASK, COM, { FXM, RS } }, - -{ "mtmsr", X(31,146), XRARB_MASK, COM, { RS } }, - -{ "stdx", X(31,149), X_MASK, PPC64, { RS, RA0, RB } }, - -{ "stwcx.", XRC(31,150,1), X_MASK, PPC, { RS, RA0, RB } }, - -{ "stwx", X(31,151), X_MASK, PPCCOM, { RS, RA0, RB } }, -{ "stx", X(31,151), X_MASK, PWRCOM, { RS, RA, RB } }, - -{ "stwcxe.", XRC(31,158,1), X_MASK, BOOKE64, { RS, RA0, RB } }, - -{ "stwxe", X(31,159), X_MASK, BOOKE64, { RS, RA0, RB } }, - -{ "slq", XRC(31,152,0), X_MASK, M601, { RA, RS, RB } }, -{ "slq.", XRC(31,152,1), X_MASK, M601, { RA, RS, RB } }, - -{ "sle", XRC(31,153,0), X_MASK, M601, { RA, RS, RB } }, -{ "sle.", XRC(31,153,1), X_MASK, M601, { RA, RS, RB } }, - -{ "prtyw", X(31,154), XRB_MASK, POWER6, { RA, RS } }, - -{ "wrteei", X(31,163), XE_MASK, PPC403 | BOOKE, { E } }, - -{ "dcbtls", X(31,166), X_MASK, PPCCHLK, { CT, RA, RB }}, -{ "dcbtlse", X(31,174), X_MASK, PPCCHLK64, { CT, RA, RB }}, - -{ "mtmsrd", X(31,178), XRLARB_MASK, PPC64, { RS, A_L } }, - -{ "stdux", X(31,181), X_MASK, PPC64, { RS, RAS, RB } }, - -{ "stwux", X(31,183), X_MASK, PPCCOM, { RS, RAS, RB } }, -{ "stux", X(31,183), X_MASK, PWRCOM, { RS, RA0, RB } }, - -{ "sliq", XRC(31,184,0), X_MASK, M601, { RA, RS, SH } }, -{ "sliq.", XRC(31,184,1), X_MASK, M601, { RA, RS, SH } }, - -{ "prtyd", X(31,186), XRB_MASK, POWER6, { RA, RS } }, - -{ "stwuxe", X(31,191), X_MASK, BOOKE64, { RS, RAS, RB } }, - -{ "subfze", XO(31,200,0,0), XORB_MASK, PPCCOM, { RT, RA } }, -{ "sfze", XO(31,200,0,0), XORB_MASK, PWRCOM, { RT, RA } }, -{ "subfze.", XO(31,200,0,1), XORB_MASK, PPCCOM, { RT, RA } }, -{ "sfze.", XO(31,200,0,1), XORB_MASK, PWRCOM, { RT, RA } }, -{ "subfzeo", XO(31,200,1,0), XORB_MASK, PPCCOM, { RT, RA } }, -{ "sfzeo", XO(31,200,1,0), XORB_MASK, PWRCOM, { RT, RA } }, -{ "subfzeo.",XO(31,200,1,1), XORB_MASK, PPCCOM, { RT, RA } }, -{ "sfzeo.", XO(31,200,1,1), XORB_MASK, PWRCOM, { RT, RA } }, - -{ "addze", XO(31,202,0,0), XORB_MASK, PPCCOM, { RT, RA } }, -{ "aze", XO(31,202,0,0), XORB_MASK, PWRCOM, { RT, RA } }, -{ "addze.", XO(31,202,0,1), XORB_MASK, PPCCOM, { RT, RA } }, -{ "aze.", XO(31,202,0,1), XORB_MASK, PWRCOM, { RT, RA } }, -{ "addzeo", XO(31,202,1,0), XORB_MASK, PPCCOM, { RT, RA } }, -{ "azeo", XO(31,202,1,0), XORB_MASK, PWRCOM, { RT, RA } }, -{ "addzeo.", XO(31,202,1,1), XORB_MASK, PPCCOM, { RT, RA } }, -{ "azeo.", XO(31,202,1,1), XORB_MASK, PWRCOM, { RT, RA } }, - -{ "mtsr", X(31,210), XRB_MASK|(1<<20), COM32, { SR, RS } }, - -{ "stdcx.", XRC(31,214,1), X_MASK, PPC64, { RS, RA0, RB } }, - -{ "stbx", X(31,215), X_MASK, COM, { RS, RA0, RB } }, - -{ "sllq", XRC(31,216,0), X_MASK, M601, { RA, RS, RB } }, -{ "sllq.", XRC(31,216,1), X_MASK, M601, { RA, RS, RB } }, - -{ "sleq", XRC(31,217,0), X_MASK, M601, { RA, RS, RB } }, -{ "sleq.", XRC(31,217,1), X_MASK, M601, { RA, RS, RB } }, - -{ "stbxe", X(31,223), X_MASK, BOOKE64, { RS, RA0, RB } }, - -{ "icblc", X(31,230), X_MASK, PPCCHLK, { CT, RA, RB }}, - -{ "subfme", XO(31,232,0,0), XORB_MASK, PPCCOM, { RT, RA } }, -{ "sfme", XO(31,232,0,0), XORB_MASK, PWRCOM, { RT, RA } }, -{ "subfme.", XO(31,232,0,1), XORB_MASK, PPCCOM, { RT, RA } }, -{ "sfme.", XO(31,232,0,1), XORB_MASK, PWRCOM, { RT, RA } }, -{ "subfmeo", XO(31,232,1,0), XORB_MASK, PPCCOM, { RT, RA } }, -{ "sfmeo", XO(31,232,1,0), XORB_MASK, PWRCOM, { RT, RA } }, -{ "subfmeo.",XO(31,232,1,1), XORB_MASK, PPCCOM, { RT, RA } }, -{ "sfmeo.", XO(31,232,1,1), XORB_MASK, PWRCOM, { RT, RA } }, - -{ "mulld", XO(31,233,0,0), XO_MASK, PPC64, { RT, RA, RB } }, -{ "mulld.", XO(31,233,0,1), XO_MASK, PPC64, { RT, RA, RB } }, -{ "mulldo", XO(31,233,1,0), XO_MASK, PPC64, { RT, RA, RB } }, -{ "mulldo.", XO(31,233,1,1), XO_MASK, PPC64, { RT, RA, RB } }, - -{ "addme", XO(31,234,0,0), XORB_MASK, PPCCOM, { RT, RA } }, -{ "ame", XO(31,234,0,0), XORB_MASK, PWRCOM, { RT, RA } }, -{ "addme.", XO(31,234,0,1), XORB_MASK, PPCCOM, { RT, RA } }, -{ "ame.", XO(31,234,0,1), XORB_MASK, PWRCOM, { RT, RA } }, -{ "addmeo", XO(31,234,1,0), XORB_MASK, PPCCOM, { RT, RA } }, -{ "ameo", XO(31,234,1,0), XORB_MASK, PWRCOM, { RT, RA } }, -{ "addmeo.", XO(31,234,1,1), XORB_MASK, PPCCOM, { RT, RA } }, -{ "ameo.", XO(31,234,1,1), XORB_MASK, PWRCOM, { RT, RA } }, - -{ "mullw", XO(31,235,0,0), XO_MASK, PPCCOM, { RT, RA, RB } }, -{ "muls", XO(31,235,0,0), XO_MASK, PWRCOM, { RT, RA, RB } }, -{ "mullw.", XO(31,235,0,1), XO_MASK, PPCCOM, { RT, RA, RB } }, -{ "muls.", XO(31,235,0,1), XO_MASK, PWRCOM, { RT, RA, RB } }, -{ "mullwo", XO(31,235,1,0), XO_MASK, PPCCOM, { RT, RA, RB } }, -{ "mulso", XO(31,235,1,0), XO_MASK, PWRCOM, { RT, RA, RB } }, -{ "mullwo.", XO(31,235,1,1), XO_MASK, PPCCOM, { RT, RA, RB } }, -{ "mulso.", XO(31,235,1,1), XO_MASK, PWRCOM, { RT, RA, RB } }, - -{ "icblce", X(31,238), X_MASK, PPCCHLK64, { CT, RA, RB }}, -{ "mtsrin", X(31,242), XRA_MASK, PPC32, { RS, RB } }, -{ "mtsri", X(31,242), XRA_MASK, POWER32, { RS, RB } }, - -{ "dcbtst", X(31,246), X_MASK, PPC, { CT, RA, RB } }, - -{ "stbux", X(31,247), X_MASK, COM, { RS, RAS, RB } }, - -{ "slliq", XRC(31,248,0), X_MASK, M601, { RA, RS, SH } }, -{ "slliq.", XRC(31,248,1), X_MASK, M601, { RA, RS, SH } }, - -{ "dcbtste", X(31,253), X_MASK, BOOKE64, { CT, RA, RB } }, - -{ "stbuxe", X(31,255), X_MASK, BOOKE64, { RS, RAS, RB } }, - -{ "mfdcrx", X(31,259), X_MASK, BOOKE, { RS, RA } }, - -{ "doz", XO(31,264,0,0), XO_MASK, M601, { RT, RA, RB } }, -{ "doz.", XO(31,264,0,1), XO_MASK, M601, { RT, RA, RB } }, -{ "dozo", XO(31,264,1,0), XO_MASK, M601, { RT, RA, RB } }, -{ "dozo.", XO(31,264,1,1), XO_MASK, M601, { RT, RA, RB } }, - -{ "add", XO(31,266,0,0), XO_MASK, PPCCOM, { RT, RA, RB } }, -{ "cax", XO(31,266,0,0), XO_MASK, PWRCOM, { RT, RA, RB } }, -{ "add.", XO(31,266,0,1), XO_MASK, PPCCOM, { RT, RA, RB } }, -{ "cax.", XO(31,266,0,1), XO_MASK, PWRCOM, { RT, RA, RB } }, -{ "addo", XO(31,266,1,0), XO_MASK, PPCCOM, { RT, RA, RB } }, -{ "caxo", XO(31,266,1,0), XO_MASK, PWRCOM, { RT, RA, RB } }, -{ "addo.", XO(31,266,1,1), XO_MASK, PPCCOM, { RT, RA, RB } }, -{ "caxo.", XO(31,266,1,1), XO_MASK, PWRCOM, { RT, RA, RB } }, - -{ "tlbiel", X(31,274), XRTLRA_MASK, POWER4, { RB, L } }, - -{ "mfapidi", X(31,275), X_MASK, BOOKE, { RT, RA } }, - -{ "lscbx", XRC(31,277,0), X_MASK, M601, { RT, RA, RB } }, -{ "lscbx.", XRC(31,277,1), X_MASK, M601, { RT, RA, RB } }, - -{ "dcbt", X(31,278), X_MASK, PPC, { CT, RA, RB } }, - -{ "lhzx", X(31,279), X_MASK, COM, { RT, RA0, RB } }, - -{ "eqv", XRC(31,284,0), X_MASK, COM, { RA, RS, RB } }, -{ "eqv.", XRC(31,284,1), X_MASK, COM, { RA, RS, RB } }, - -{ "dcbte", X(31,286), X_MASK, BOOKE64, { CT, RA, RB } }, - -{ "lhzxe", X(31,287), X_MASK, BOOKE64, { RT, RA0, RB } }, - -{ "tlbie", X(31,306), XRTLRA_MASK, PPC, { RB, L } }, -{ "tlbi", X(31,306), XRT_MASK, POWER, { RA0, RB } }, - -{ "eciwx", X(31,310), X_MASK, PPC, { RT, RA, RB } }, - -{ "lhzux", X(31,311), X_MASK, COM, { RT, RAL, RB } }, - -{ "xor", XRC(31,316,0), X_MASK, COM, { RA, RS, RB } }, -{ "xor.", XRC(31,316,1), X_MASK, COM, { RA, RS, RB } }, - -{ "lhzuxe", X(31,319), X_MASK, BOOKE64, { RT, RAL, RB } }, - -{ "mfexisr", XSPR(31,323,64), XSPR_MASK, PPC403, { RT } }, -{ "mfexier", XSPR(31,323,66), XSPR_MASK, PPC403, { RT } }, -{ "mfbr0", XSPR(31,323,128), XSPR_MASK, PPC403, { RT } }, -{ "mfbr1", XSPR(31,323,129), XSPR_MASK, PPC403, { RT } }, -{ "mfbr2", XSPR(31,323,130), XSPR_MASK, PPC403, { RT } }, -{ "mfbr3", XSPR(31,323,131), XSPR_MASK, PPC403, { RT } }, -{ "mfbr4", XSPR(31,323,132), XSPR_MASK, PPC403, { RT } }, -{ "mfbr5", XSPR(31,323,133), XSPR_MASK, PPC403, { RT } }, -{ "mfbr6", XSPR(31,323,134), XSPR_MASK, PPC403, { RT } }, -{ "mfbr7", XSPR(31,323,135), XSPR_MASK, PPC403, { RT } }, -{ "mfbear", XSPR(31,323,144), XSPR_MASK, PPC403, { RT } }, -{ "mfbesr", XSPR(31,323,145), XSPR_MASK, PPC403, { RT } }, -{ "mfiocr", XSPR(31,323,160), XSPR_MASK, PPC403, { RT } }, -{ "mfdmacr0", XSPR(31,323,192), XSPR_MASK, PPC403, { RT } }, -{ "mfdmact0", XSPR(31,323,193), XSPR_MASK, PPC403, { RT } }, -{ "mfdmada0", XSPR(31,323,194), XSPR_MASK, PPC403, { RT } }, -{ "mfdmasa0", XSPR(31,323,195), XSPR_MASK, PPC403, { RT } }, -{ "mfdmacc0", XSPR(31,323,196), XSPR_MASK, PPC403, { RT } }, -{ "mfdmacr1", XSPR(31,323,200), XSPR_MASK, PPC403, { RT } }, -{ "mfdmact1", XSPR(31,323,201), XSPR_MASK, PPC403, { RT } }, -{ "mfdmada1", XSPR(31,323,202), XSPR_MASK, PPC403, { RT } }, -{ "mfdmasa1", XSPR(31,323,203), XSPR_MASK, PPC403, { RT } }, -{ "mfdmacc1", XSPR(31,323,204), XSPR_MASK, PPC403, { RT } }, -{ "mfdmacr2", XSPR(31,323,208), XSPR_MASK, PPC403, { RT } }, -{ "mfdmact2", XSPR(31,323,209), XSPR_MASK, PPC403, { RT } }, -{ "mfdmada2", XSPR(31,323,210), XSPR_MASK, PPC403, { RT } }, -{ "mfdmasa2", XSPR(31,323,211), XSPR_MASK, PPC403, { RT } }, -{ "mfdmacc2", XSPR(31,323,212), XSPR_MASK, PPC403, { RT } }, -{ "mfdmacr3", XSPR(31,323,216), XSPR_MASK, PPC403, { RT } }, -{ "mfdmact3", XSPR(31,323,217), XSPR_MASK, PPC403, { RT } }, -{ "mfdmada3", XSPR(31,323,218), XSPR_MASK, PPC403, { RT } }, -{ "mfdmasa3", XSPR(31,323,219), XSPR_MASK, PPC403, { RT } }, -{ "mfdmacc3", XSPR(31,323,220), XSPR_MASK, PPC403, { RT } }, -{ "mfdmasr", XSPR(31,323,224), XSPR_MASK, PPC403, { RT } }, -{ "mfdcr", X(31,323), X_MASK, PPC403 | BOOKE, { RT, SPR } }, - -{ "div", XO(31,331,0,0), XO_MASK, M601, { RT, RA, RB } }, -{ "div.", XO(31,331,0,1), XO_MASK, M601, { RT, RA, RB } }, -{ "divo", XO(31,331,1,0), XO_MASK, M601, { RT, RA, RB } }, -{ "divo.", XO(31,331,1,1), XO_MASK, M601, { RT, RA, RB } }, - -{ "mfpmr", X(31,334), X_MASK, PPCPMR, { RT, PMR }}, - -{ "mfmq", XSPR(31,339,0), XSPR_MASK, M601, { RT } }, -{ "mfxer", XSPR(31,339,1), XSPR_MASK, COM, { RT } }, -{ "mfrtcu", XSPR(31,339,4), XSPR_MASK, COM, { RT } }, -{ "mfrtcl", XSPR(31,339,5), XSPR_MASK, COM, { RT } }, -{ "mfdec", XSPR(31,339,6), XSPR_MASK, MFDEC1, { RT } }, -{ "mfdec", XSPR(31,339,22), XSPR_MASK, MFDEC2, { RT } }, -{ "mflr", XSPR(31,339,8), XSPR_MASK, COM, { RT } }, -{ "mfctr", XSPR(31,339,9), XSPR_MASK, COM, { RT } }, -{ "mftid", XSPR(31,339,17), XSPR_MASK, POWER, { RT } }, -{ "mfdsisr", XSPR(31,339,18), XSPR_MASK, COM, { RT } }, -{ "mfdar", XSPR(31,339,19), XSPR_MASK, COM, { RT } }, -{ "mfsdr0", XSPR(31,339,24), XSPR_MASK, POWER, { RT } }, -{ "mfsdr1", XSPR(31,339,25), XSPR_MASK, COM, { RT } }, -{ "mfsrr0", XSPR(31,339,26), XSPR_MASK, COM, { RT } }, -{ "mfsrr1", XSPR(31,339,27), XSPR_MASK, COM, { RT } }, -{ "mfcfar", XSPR(31,339,28), XSPR_MASK, POWER6, { RT } }, -{ "mfpid", XSPR(31,339,48), XSPR_MASK, BOOKE, { RT } }, -{ "mfpid", XSPR(31,339,945), XSPR_MASK, PPC403, { RT } }, -{ "mfcsrr0", XSPR(31,339,58), XSPR_MASK, BOOKE, { RT } }, -{ "mfcsrr1", XSPR(31,339,59), XSPR_MASK, BOOKE, { RT } }, -{ "mfdear", XSPR(31,339,61), XSPR_MASK, BOOKE, { RT } }, -{ "mfdear", XSPR(31,339,981), XSPR_MASK, PPC403, { RT } }, -{ "mfesr", XSPR(31,339,62), XSPR_MASK, BOOKE, { RT } }, -{ "mfesr", XSPR(31,339,980), XSPR_MASK, PPC403, { RT } }, -{ "mfivpr", XSPR(31,339,63), XSPR_MASK, BOOKE, { RT } }, -{ "mfcmpa", XSPR(31,339,144), XSPR_MASK, PPC860, { RT } }, -{ "mfcmpb", XSPR(31,339,145), XSPR_MASK, PPC860, { RT } }, -{ "mfcmpc", XSPR(31,339,146), XSPR_MASK, PPC860, { RT } }, -{ "mfcmpd", XSPR(31,339,147), XSPR_MASK, PPC860, { RT } }, -{ "mficr", XSPR(31,339,148), XSPR_MASK, PPC860, { RT } }, -{ "mfder", XSPR(31,339,149), XSPR_MASK, PPC860, { RT } }, -{ "mfcounta", XSPR(31,339,150), XSPR_MASK, PPC860, { RT } }, -{ "mfcountb", XSPR(31,339,151), XSPR_MASK, PPC860, { RT } }, -{ "mfcmpe", XSPR(31,339,152), XSPR_MASK, PPC860, { RT } }, -{ "mfcmpf", XSPR(31,339,153), XSPR_MASK, PPC860, { RT } }, -{ "mfcmpg", XSPR(31,339,154), XSPR_MASK, PPC860, { RT } }, -{ "mfcmph", XSPR(31,339,155), XSPR_MASK, PPC860, { RT } }, -{ "mflctrl1", XSPR(31,339,156), XSPR_MASK, PPC860, { RT } }, -{ "mflctrl2", XSPR(31,339,157), XSPR_MASK, PPC860, { RT } }, -{ "mfictrl", XSPR(31,339,158), XSPR_MASK, PPC860, { RT } }, -{ "mfbar", XSPR(31,339,159), XSPR_MASK, PPC860, { RT } }, -{ "mfvrsave", XSPR(31,339,256), XSPR_MASK, PPCVEC, { RT } }, -{ "mfusprg0", XSPR(31,339,256), XSPR_MASK, BOOKE, { RT } }, -{ "mftb", X(31,371), X_MASK, CLASSIC, { RT, TBR } }, -{ "mftb", XSPR(31,339,268), XSPR_MASK, BOOKE, { RT } }, -{ "mftbl", XSPR(31,371,268), XSPR_MASK, CLASSIC, { RT } }, -{ "mftbl", XSPR(31,339,268), XSPR_MASK, BOOKE, { RT } }, -{ "mftbu", XSPR(31,371,269), XSPR_MASK, CLASSIC, { RT } }, -{ "mftbu", XSPR(31,339,269), XSPR_MASK, BOOKE, { RT } }, -{ "mfsprg", XSPR(31,339,256), XSPRG_MASK, PPC, { RT, SPRG } }, -{ "mfsprg0", XSPR(31,339,272), XSPR_MASK, PPC, { RT } }, -{ "mfsprg1", XSPR(31,339,273), XSPR_MASK, PPC, { RT } }, -{ "mfsprg2", XSPR(31,339,274), XSPR_MASK, PPC, { RT } }, -{ "mfsprg3", XSPR(31,339,275), XSPR_MASK, PPC, { RT } }, -{ "mfsprg4", XSPR(31,339,260), XSPR_MASK, PPC405 | BOOKE, { RT } }, -{ "mfsprg5", XSPR(31,339,261), XSPR_MASK, PPC405 | BOOKE, { RT } }, -{ "mfsprg6", XSPR(31,339,262), XSPR_MASK, PPC405 | BOOKE, { RT } }, -{ "mfsprg7", XSPR(31,339,263), XSPR_MASK, PPC405 | BOOKE, { RT } }, -{ "mfasr", XSPR(31,339,280), XSPR_MASK, PPC64, { RT } }, -{ "mfear", XSPR(31,339,282), XSPR_MASK, PPC, { RT } }, -{ "mfpir", XSPR(31,339,286), XSPR_MASK, BOOKE, { RT } }, -{ "mfpvr", XSPR(31,339,287), XSPR_MASK, PPC, { RT } }, -{ "mfdbsr", XSPR(31,339,304), XSPR_MASK, BOOKE, { RT } }, -{ "mfdbsr", XSPR(31,339,1008), XSPR_MASK, PPC403, { RT } }, -{ "mfdbcr0", XSPR(31,339,308), XSPR_MASK, BOOKE, { RT } }, -{ "mfdbcr0", XSPR(31,339,1010), XSPR_MASK, PPC405, { RT } }, -{ "mfdbcr1", XSPR(31,339,309), XSPR_MASK, BOOKE, { RT } }, -{ "mfdbcr1", XSPR(31,339,957), XSPR_MASK, PPC405, { RT } }, -{ "mfdbcr2", XSPR(31,339,310), XSPR_MASK, BOOKE, { RT } }, -{ "mfiac1", XSPR(31,339,312), XSPR_MASK, BOOKE, { RT } }, -{ "mfiac1", XSPR(31,339,1012), XSPR_MASK, PPC403, { RT } }, -{ "mfiac2", XSPR(31,339,313), XSPR_MASK, BOOKE, { RT } }, -{ "mfiac2", XSPR(31,339,1013), XSPR_MASK, PPC403, { RT } }, -{ "mfiac3", XSPR(31,339,314), XSPR_MASK, BOOKE, { RT } }, -{ "mfiac3", XSPR(31,339,948), XSPR_MASK, PPC405, { RT } }, -{ "mfiac4", XSPR(31,339,315), XSPR_MASK, BOOKE, { RT } }, -{ "mfiac4", XSPR(31,339,949), XSPR_MASK, PPC405, { RT } }, -{ "mfdac1", XSPR(31,339,316), XSPR_MASK, BOOKE, { RT } }, -{ "mfdac1", XSPR(31,339,1014), XSPR_MASK, PPC403, { RT } }, -{ "mfdac2", XSPR(31,339,317), XSPR_MASK, BOOKE, { RT } }, -{ "mfdac2", XSPR(31,339,1015), XSPR_MASK, PPC403, { RT } }, -{ "mfdvc1", XSPR(31,339,318), XSPR_MASK, BOOKE, { RT } }, -{ "mfdvc1", XSPR(31,339,950), XSPR_MASK, PPC405, { RT } }, -{ "mfdvc2", XSPR(31,339,319), XSPR_MASK, BOOKE, { RT } }, -{ "mfdvc2", XSPR(31,339,951), XSPR_MASK, PPC405, { RT } }, -{ "mftsr", XSPR(31,339,336), XSPR_MASK, BOOKE, { RT } }, -{ "mftsr", XSPR(31,339,984), XSPR_MASK, PPC403, { RT } }, -{ "mftcr", XSPR(31,339,340), XSPR_MASK, BOOKE, { RT } }, -{ "mftcr", XSPR(31,339,986), XSPR_MASK, PPC403, { RT } }, -{ "mfivor0", XSPR(31,339,400), XSPR_MASK, BOOKE, { RT } }, -{ "mfivor1", XSPR(31,339,401), XSPR_MASK, BOOKE, { RT } }, -{ "mfivor2", XSPR(31,339,402), XSPR_MASK, BOOKE, { RT } }, -{ "mfivor3", XSPR(31,339,403), XSPR_MASK, BOOKE, { RT } }, -{ "mfivor4", XSPR(31,339,404), XSPR_MASK, BOOKE, { RT } }, -{ "mfivor5", XSPR(31,339,405), XSPR_MASK, BOOKE, { RT } }, -{ "mfivor6", XSPR(31,339,406), XSPR_MASK, BOOKE, { RT } }, -{ "mfivor7", XSPR(31,339,407), XSPR_MASK, BOOKE, { RT } }, -{ "mfivor8", XSPR(31,339,408), XSPR_MASK, BOOKE, { RT } }, -{ "mfivor9", XSPR(31,339,409), XSPR_MASK, BOOKE, { RT } }, -{ "mfivor10", XSPR(31,339,410), XSPR_MASK, BOOKE, { RT } }, -{ "mfivor11", XSPR(31,339,411), XSPR_MASK, BOOKE, { RT } }, -{ "mfivor12", XSPR(31,339,412), XSPR_MASK, BOOKE, { RT } }, -{ "mfivor13", XSPR(31,339,413), XSPR_MASK, BOOKE, { RT } }, -{ "mfivor14", XSPR(31,339,414), XSPR_MASK, BOOKE, { RT } }, -{ "mfivor15", XSPR(31,339,415), XSPR_MASK, BOOKE, { RT } }, -{ "mfspefscr", XSPR(31,339,512), XSPR_MASK, PPCSPE, { RT } }, -{ "mfbbear", XSPR(31,339,513), XSPR_MASK, PPCBRLK, { RT } }, -{ "mfbbtar", XSPR(31,339,514), XSPR_MASK, PPCBRLK, { RT } }, -{ "mfivor32", XSPR(31,339,528), XSPR_MASK, PPCSPE, { RT } }, -{ "mfivor33", XSPR(31,339,529), XSPR_MASK, PPCSPE, { RT } }, -{ "mfivor34", XSPR(31,339,530), XSPR_MASK, PPCSPE, { RT } }, -{ "mfivor35", XSPR(31,339,531), XSPR_MASK, PPCPMR, { RT } }, -{ "mfibatu", XSPR(31,339,528), XSPRBAT_MASK, PPC, { RT, SPRBAT } }, -{ "mfibatl", XSPR(31,339,529), XSPRBAT_MASK, PPC, { RT, SPRBAT } }, -{ "mfdbatu", XSPR(31,339,536), XSPRBAT_MASK, PPC, { RT, SPRBAT } }, -{ "mfdbatl", XSPR(31,339,537), XSPRBAT_MASK, PPC, { RT, SPRBAT } }, -{ "mfic_cst", XSPR(31,339,560), XSPR_MASK, PPC860, { RT } }, -{ "mfic_adr", XSPR(31,339,561), XSPR_MASK, PPC860, { RT } }, -{ "mfic_dat", XSPR(31,339,562), XSPR_MASK, PPC860, { RT } }, -{ "mfdc_cst", XSPR(31,339,568), XSPR_MASK, PPC860, { RT } }, -{ "mfdc_adr", XSPR(31,339,569), XSPR_MASK, PPC860, { RT } }, -{ "mfmcsrr0", XSPR(31,339,570), XSPR_MASK, PPCRFMCI, { RT } }, -{ "mfdc_dat", XSPR(31,339,570), XSPR_MASK, PPC860, { RT } }, -{ "mfmcsrr1", XSPR(31,339,571), XSPR_MASK, PPCRFMCI, { RT } }, -{ "mfmcsr", XSPR(31,339,572), XSPR_MASK, PPCRFMCI, { RT } }, -{ "mfmcar", XSPR(31,339,573), XSPR_MASK, PPCRFMCI, { RT } }, -{ "mfdpdr", XSPR(31,339,630), XSPR_MASK, PPC860, { RT } }, -{ "mfdpir", XSPR(31,339,631), XSPR_MASK, PPC860, { RT } }, -{ "mfimmr", XSPR(31,339,638), XSPR_MASK, PPC860, { RT } }, -{ "mfmi_ctr", XSPR(31,339,784), XSPR_MASK, PPC860, { RT } }, -{ "mfmi_ap", XSPR(31,339,786), XSPR_MASK, PPC860, { RT } }, -{ "mfmi_epn", XSPR(31,339,787), XSPR_MASK, PPC860, { RT } }, -{ "mfmi_twc", XSPR(31,339,789), XSPR_MASK, PPC860, { RT } }, -{ "mfmi_rpn", XSPR(31,339,790), XSPR_MASK, PPC860, { RT } }, -{ "mfmd_ctr", XSPR(31,339,792), XSPR_MASK, PPC860, { RT } }, -{ "mfm_casid", XSPR(31,339,793), XSPR_MASK, PPC860, { RT } }, -{ "mfmd_ap", XSPR(31,339,794), XSPR_MASK, PPC860, { RT } }, -{ "mfmd_epn", XSPR(31,339,795), XSPR_MASK, PPC860, { RT } }, -{ "mfmd_twb", XSPR(31,339,796), XSPR_MASK, PPC860, { RT } }, -{ "mfmd_twc", XSPR(31,339,797), XSPR_MASK, PPC860, { RT } }, -{ "mfmd_rpn", XSPR(31,339,798), XSPR_MASK, PPC860, { RT } }, -{ "mfm_tw", XSPR(31,339,799), XSPR_MASK, PPC860, { RT } }, -{ "mfmi_dbcam", XSPR(31,339,816), XSPR_MASK, PPC860, { RT } }, -{ "mfmi_dbram0",XSPR(31,339,817), XSPR_MASK, PPC860, { RT } }, -{ "mfmi_dbram1",XSPR(31,339,818), XSPR_MASK, PPC860, { RT } }, -{ "mfmd_dbcam", XSPR(31,339,824), XSPR_MASK, PPC860, { RT } }, -{ "mfmd_dbram0",XSPR(31,339,825), XSPR_MASK, PPC860, { RT } }, -{ "mfmd_dbram1",XSPR(31,339,826), XSPR_MASK, PPC860, { RT } }, -{ "mfummcr0", XSPR(31,339,936), XSPR_MASK, PPC750, { RT } }, -{ "mfupmc1", XSPR(31,339,937), XSPR_MASK, PPC750, { RT } }, -{ "mfupmc2", XSPR(31,339,938), XSPR_MASK, PPC750, { RT } }, -{ "mfusia", XSPR(31,339,939), XSPR_MASK, PPC750, { RT } }, -{ "mfummcr1", XSPR(31,339,940), XSPR_MASK, PPC750, { RT } }, -{ "mfupmc3", XSPR(31,339,941), XSPR_MASK, PPC750, { RT } }, -{ "mfupmc4", XSPR(31,339,942), XSPR_MASK, PPC750, { RT } }, -{ "mfzpr", XSPR(31,339,944), XSPR_MASK, PPC403, { RT } }, -{ "mfccr0", XSPR(31,339,947), XSPR_MASK, PPC405, { RT } }, -{ "mfmmcr0", XSPR(31,339,952), XSPR_MASK, PPC750, { RT } }, -{ "mfpmc1", XSPR(31,339,953), XSPR_MASK, PPC750, { RT } }, -{ "mfsgr", XSPR(31,339,953), XSPR_MASK, PPC403, { RT } }, -{ "mfpmc2", XSPR(31,339,954), XSPR_MASK, PPC750, { RT } }, -{ "mfdcwr", XSPR(31,339,954), XSPR_MASK, PPC403, { RT } }, -{ "mfsia", XSPR(31,339,955), XSPR_MASK, PPC750, { RT } }, -{ "mfsler", XSPR(31,339,955), XSPR_MASK, PPC405, { RT } }, -{ "mfmmcr1", XSPR(31,339,956), XSPR_MASK, PPC750, { RT } }, -{ "mfsu0r", XSPR(31,339,956), XSPR_MASK, PPC405, { RT } }, -{ "mfpmc3", XSPR(31,339,957), XSPR_MASK, PPC750, { RT } }, -{ "mfpmc4", XSPR(31,339,958), XSPR_MASK, PPC750, { RT } }, -{ "mficdbdr", XSPR(31,339,979), XSPR_MASK, PPC403, { RT } }, -{ "mfevpr", XSPR(31,339,982), XSPR_MASK, PPC403, { RT } }, -{ "mfcdbcr", XSPR(31,339,983), XSPR_MASK, PPC403, { RT } }, -{ "mfpit", XSPR(31,339,987), XSPR_MASK, PPC403, { RT } }, -{ "mftbhi", XSPR(31,339,988), XSPR_MASK, PPC403, { RT } }, -{ "mftblo", XSPR(31,339,989), XSPR_MASK, PPC403, { RT } }, -{ "mfsrr2", XSPR(31,339,990), XSPR_MASK, PPC403, { RT } }, -{ "mfsrr3", XSPR(31,339,991), XSPR_MASK, PPC403, { RT } }, -{ "mfl2cr", XSPR(31,339,1017), XSPR_MASK, PPC750, { RT } }, -{ "mfdccr", XSPR(31,339,1018), XSPR_MASK, PPC403, { RT } }, -{ "mficcr", XSPR(31,339,1019), XSPR_MASK, PPC403, { RT } }, -{ "mfictc", XSPR(31,339,1019), XSPR_MASK, PPC750, { RT } }, -{ "mfpbl1", XSPR(31,339,1020), XSPR_MASK, PPC403, { RT } }, -{ "mfthrm1", XSPR(31,339,1020), XSPR_MASK, PPC750, { RT } }, -{ "mfpbu1", XSPR(31,339,1021), XSPR_MASK, PPC403, { RT } }, -{ "mfthrm2", XSPR(31,339,1021), XSPR_MASK, PPC750, { RT } }, -{ "mfpbl2", XSPR(31,339,1022), XSPR_MASK, PPC403, { RT } }, -{ "mfthrm3", XSPR(31,339,1022), XSPR_MASK, PPC750, { RT } }, -{ "mfpbu2", XSPR(31,339,1023), XSPR_MASK, PPC403, { RT } }, -{ "mfspr", X(31,339), X_MASK, COM, { RT, SPR } }, - -{ "lwax", X(31,341), X_MASK, PPC64, { RT, RA0, RB } }, - -{ "dst", XDSS(31,342,0), XDSS_MASK, PPCVEC, { RA, RB, STRM } }, -{ "dstt", XDSS(31,342,1), XDSS_MASK, PPCVEC, { RA, RB, STRM } }, - -{ "lhax", X(31,343), X_MASK, COM, { RT, RA0, RB } }, - -{ "lhaxe", X(31,351), X_MASK, BOOKE64, { RT, RA0, RB } }, - -{ "dstst", XDSS(31,374,0), XDSS_MASK, PPCVEC, { RA, RB, STRM } }, -{ "dststt", XDSS(31,374,1), XDSS_MASK, PPCVEC, { RA, RB, STRM } }, - -{ "dccci", X(31,454), XRT_MASK, PPC403|PPC440, { RA, RB } }, - -{ "abs", XO(31,360,0,0), XORB_MASK, M601, { RT, RA } }, -{ "abs.", XO(31,360,0,1), XORB_MASK, M601, { RT, RA } }, -{ "abso", XO(31,360,1,0), XORB_MASK, M601, { RT, RA } }, -{ "abso.", XO(31,360,1,1), XORB_MASK, M601, { RT, RA } }, - -{ "divs", XO(31,363,0,0), XO_MASK, M601, { RT, RA, RB } }, -{ "divs.", XO(31,363,0,1), XO_MASK, M601, { RT, RA, RB } }, -{ "divso", XO(31,363,1,0), XO_MASK, M601, { RT, RA, RB } }, -{ "divso.", XO(31,363,1,1), XO_MASK, M601, { RT, RA, RB } }, - -{ "tlbia", X(31,370), 0xffffffff, PPC, { 0 } }, - -{ "lwaux", X(31,373), X_MASK, PPC64, { RT, RAL, RB } }, - -{ "lhaux", X(31,375), X_MASK, COM, { RT, RAL, RB } }, - -{ "lhauxe", X(31,383), X_MASK, BOOKE64, { RT, RAL, RB } }, - -{ "mtdcrx", X(31,387), X_MASK, BOOKE, { RA, RS } }, - -{ "dcblc", X(31,390), X_MASK, PPCCHLK, { CT, RA, RB }}, - -{ "subfe64", XO(31,392,0,0), XO_MASK, BOOKE64, { RT, RA, RB } }, -{ "subfe64o",XO(31,392,1,0), XO_MASK, BOOKE64, { RT, RA, RB } }, - -{ "adde64", XO(31,394,0,0), XO_MASK, BOOKE64, { RT, RA, RB } }, -{ "adde64o", XO(31,394,1,0), XO_MASK, BOOKE64, { RT, RA, RB } }, - -{ "dcblce", X(31,398), X_MASK, PPCCHLK64, { CT, RA, RB }}, - -{ "slbmte", X(31,402), XRA_MASK, PPC64, { RS, RB } }, - -{ "sthx", X(31,407), X_MASK, COM, { RS, RA0, RB } }, - -{ "cmpb", X(31,508), X_MASK, POWER6, { RA, RS, RB } }, - -{ "lfqx", X(31,791), X_MASK, POWER2, { FRT, RA, RB } }, - -{ "lfdpx", X(31,791), X_MASK, POWER6, { FRT, RA, RB } }, - -{ "lfqux", X(31,823), X_MASK, POWER2, { FRT, RA, RB } }, - -{ "stfqx", X(31,919), X_MASK, POWER2, { FRS, RA, RB } }, - -{ "stfdpx", X(31,919), X_MASK, POWER6, { FRS, RA, RB } }, - -{ "stfqux", X(31,951), X_MASK, POWER2, { FRS, RA, RB } }, - -{ "orc", XRC(31,412,0), X_MASK, COM, { RA, RS, RB } }, -{ "orc.", XRC(31,412,1), X_MASK, COM, { RA, RS, RB } }, - -{ "sradi", XS(31,413,0), XS_MASK, PPC64, { RA, RS, SH6 } }, -{ "sradi.", XS(31,413,1), XS_MASK, PPC64, { RA, RS, SH6 } }, - -{ "sthxe", X(31,415), X_MASK, BOOKE64, { RS, RA0, RB } }, - -{ "slbie", X(31,434), XRTRA_MASK, PPC64, { RB } }, - -{ "ecowx", X(31,438), X_MASK, PPC, { RT, RA, RB } }, - -{ "sthux", X(31,439), X_MASK, COM, { RS, RAS, RB } }, - -{ "sthuxe", X(31,447), X_MASK, BOOKE64, { RS, RAS, RB } }, - -{ "cctpl", 0x7c210b78, 0xffffffff, CELL, { 0 }}, -{ "cctpm", 0x7c421378, 0xffffffff, CELL, { 0 }}, -{ "cctph", 0x7c631b78, 0xffffffff, CELL, { 0 }}, -{ "db8cyc", 0x7f9ce378, 0xffffffff, CELL, { 0 }}, -{ "db10cyc", 0x7fbdeb78, 0xffffffff, CELL, { 0 }}, -{ "db12cyc", 0x7fdef378, 0xffffffff, CELL, { 0 }}, -{ "db16cyc", 0x7ffffb78, 0xffffffff, CELL, { 0 }}, -{ "mr", XRC(31,444,0), X_MASK, COM, { RA, RS, RBS } }, -{ "or", XRC(31,444,0), X_MASK, COM, { RA, RS, RB } }, -{ "mr.", XRC(31,444,1), X_MASK, COM, { RA, RS, RBS } }, -{ "or.", XRC(31,444,1), X_MASK, COM, { RA, RS, RB } }, - -{ "mtexisr", XSPR(31,451,64), XSPR_MASK, PPC403, { RS } }, -{ "mtexier", XSPR(31,451,66), XSPR_MASK, PPC403, { RS } }, -{ "mtbr0", XSPR(31,451,128), XSPR_MASK, PPC403, { RS } }, -{ "mtbr1", XSPR(31,451,129), XSPR_MASK, PPC403, { RS } }, -{ "mtbr2", XSPR(31,451,130), XSPR_MASK, PPC403, { RS } }, -{ "mtbr3", XSPR(31,451,131), XSPR_MASK, PPC403, { RS } }, -{ "mtbr4", XSPR(31,451,132), XSPR_MASK, PPC403, { RS } }, -{ "mtbr5", XSPR(31,451,133), XSPR_MASK, PPC403, { RS } }, -{ "mtbr6", XSPR(31,451,134), XSPR_MASK, PPC403, { RS } }, -{ "mtbr7", XSPR(31,451,135), XSPR_MASK, PPC403, { RS } }, -{ "mtbear", XSPR(31,451,144), XSPR_MASK, PPC403, { RS } }, -{ "mtbesr", XSPR(31,451,145), XSPR_MASK, PPC403, { RS } }, -{ "mtiocr", XSPR(31,451,160), XSPR_MASK, PPC403, { RS } }, -{ "mtdmacr0", XSPR(31,451,192), XSPR_MASK, PPC403, { RS } }, -{ "mtdmact0", XSPR(31,451,193), XSPR_MASK, PPC403, { RS } }, -{ "mtdmada0", XSPR(31,451,194), XSPR_MASK, PPC403, { RS } }, -{ "mtdmasa0", XSPR(31,451,195), XSPR_MASK, PPC403, { RS } }, -{ "mtdmacc0", XSPR(31,451,196), XSPR_MASK, PPC403, { RS } }, -{ "mtdmacr1", XSPR(31,451,200), XSPR_MASK, PPC403, { RS } }, -{ "mtdmact1", XSPR(31,451,201), XSPR_MASK, PPC403, { RS } }, -{ "mtdmada1", XSPR(31,451,202), XSPR_MASK, PPC403, { RS } }, -{ "mtdmasa1", XSPR(31,451,203), XSPR_MASK, PPC403, { RS } }, -{ "mtdmacc1", XSPR(31,451,204), XSPR_MASK, PPC403, { RS } }, -{ "mtdmacr2", XSPR(31,451,208), XSPR_MASK, PPC403, { RS } }, -{ "mtdmact2", XSPR(31,451,209), XSPR_MASK, PPC403, { RS } }, -{ "mtdmada2", XSPR(31,451,210), XSPR_MASK, PPC403, { RS } }, -{ "mtdmasa2", XSPR(31,451,211), XSPR_MASK, PPC403, { RS } }, -{ "mtdmacc2", XSPR(31,451,212), XSPR_MASK, PPC403, { RS } }, -{ "mtdmacr3", XSPR(31,451,216), XSPR_MASK, PPC403, { RS } }, -{ "mtdmact3", XSPR(31,451,217), XSPR_MASK, PPC403, { RS } }, -{ "mtdmada3", XSPR(31,451,218), XSPR_MASK, PPC403, { RS } }, -{ "mtdmasa3", XSPR(31,451,219), XSPR_MASK, PPC403, { RS } }, -{ "mtdmacc3", XSPR(31,451,220), XSPR_MASK, PPC403, { RS } }, -{ "mtdmasr", XSPR(31,451,224), XSPR_MASK, PPC403, { RS } }, -{ "mtdcr", X(31,451), X_MASK, PPC403 | BOOKE, { SPR, RS } }, - -{ "subfze64",XO(31,456,0,0), XORB_MASK, BOOKE64, { RT, RA } }, -{ "subfze64o",XO(31,456,1,0), XORB_MASK, BOOKE64, { RT, RA } }, - -{ "divdu", XO(31,457,0,0), XO_MASK, PPC64, { RT, RA, RB } }, -{ "divdu.", XO(31,457,0,1), XO_MASK, PPC64, { RT, RA, RB } }, -{ "divduo", XO(31,457,1,0), XO_MASK, PPC64, { RT, RA, RB } }, -{ "divduo.", XO(31,457,1,1), XO_MASK, PPC64, { RT, RA, RB } }, - -{ "addze64", XO(31,458,0,0), XORB_MASK, BOOKE64, { RT, RA } }, -{ "addze64o",XO(31,458,1,0), XORB_MASK, BOOKE64, { RT, RA } }, - -{ "divwu", XO(31,459,0,0), XO_MASK, PPC, { RT, RA, RB } }, -{ "divwu.", XO(31,459,0,1), XO_MASK, PPC, { RT, RA, RB } }, -{ "divwuo", XO(31,459,1,0), XO_MASK, PPC, { RT, RA, RB } }, -{ "divwuo.", XO(31,459,1,1), XO_MASK, PPC, { RT, RA, RB } }, - -{ "mtmq", XSPR(31,467,0), XSPR_MASK, M601, { RS } }, -{ "mtxer", XSPR(31,467,1), XSPR_MASK, COM, { RS } }, -{ "mtlr", XSPR(31,467,8), XSPR_MASK, COM, { RS } }, -{ "mtctr", XSPR(31,467,9), XSPR_MASK, COM, { RS } }, -{ "mttid", XSPR(31,467,17), XSPR_MASK, POWER, { RS } }, -{ "mtdsisr", XSPR(31,467,18), XSPR_MASK, COM, { RS } }, -{ "mtdar", XSPR(31,467,19), XSPR_MASK, COM, { RS } }, -{ "mtrtcu", XSPR(31,467,20), XSPR_MASK, COM, { RS } }, -{ "mtrtcl", XSPR(31,467,21), XSPR_MASK, COM, { RS } }, -{ "mtdec", XSPR(31,467,22), XSPR_MASK, COM, { RS } }, -{ "mtsdr0", XSPR(31,467,24), XSPR_MASK, POWER, { RS } }, -{ "mtsdr1", XSPR(31,467,25), XSPR_MASK, COM, { RS } }, -{ "mtsrr0", XSPR(31,467,26), XSPR_MASK, COM, { RS } }, -{ "mtsrr1", XSPR(31,467,27), XSPR_MASK, COM, { RS } }, -{ "mtcfar", XSPR(31,467,28), XSPR_MASK, POWER6, { RS } }, -{ "mtpid", XSPR(31,467,48), XSPR_MASK, BOOKE, { RS } }, -{ "mtpid", XSPR(31,467,945), XSPR_MASK, PPC403, { RS } }, -{ "mtdecar", XSPR(31,467,54), XSPR_MASK, BOOKE, { RS } }, -{ "mtcsrr0", XSPR(31,467,58), XSPR_MASK, BOOKE, { RS } }, -{ "mtcsrr1", XSPR(31,467,59), XSPR_MASK, BOOKE, { RS } }, -{ "mtdear", XSPR(31,467,61), XSPR_MASK, BOOKE, { RS } }, -{ "mtdear", XSPR(31,467,981), XSPR_MASK, PPC403, { RS } }, -{ "mtesr", XSPR(31,467,62), XSPR_MASK, BOOKE, { RS } }, -{ "mtesr", XSPR(31,467,980), XSPR_MASK, PPC403, { RS } }, -{ "mtivpr", XSPR(31,467,63), XSPR_MASK, BOOKE, { RS } }, -{ "mtcmpa", XSPR(31,467,144), XSPR_MASK, PPC860, { RS } }, -{ "mtcmpb", XSPR(31,467,145), XSPR_MASK, PPC860, { RS } }, -{ "mtcmpc", XSPR(31,467,146), XSPR_MASK, PPC860, { RS } }, -{ "mtcmpd", XSPR(31,467,147), XSPR_MASK, PPC860, { RS } }, -{ "mticr", XSPR(31,467,148), XSPR_MASK, PPC860, { RS } }, -{ "mtder", XSPR(31,467,149), XSPR_MASK, PPC860, { RS } }, -{ "mtcounta", XSPR(31,467,150), XSPR_MASK, PPC860, { RS } }, -{ "mtcountb", XSPR(31,467,151), XSPR_MASK, PPC860, { RS } }, -{ "mtcmpe", XSPR(31,467,152), XSPR_MASK, PPC860, { RS } }, -{ "mtcmpf", XSPR(31,467,153), XSPR_MASK, PPC860, { RS } }, -{ "mtcmpg", XSPR(31,467,154), XSPR_MASK, PPC860, { RS } }, -{ "mtcmph", XSPR(31,467,155), XSPR_MASK, PPC860, { RS } }, -{ "mtlctrl1", XSPR(31,467,156), XSPR_MASK, PPC860, { RS } }, -{ "mtlctrl2", XSPR(31,467,157), XSPR_MASK, PPC860, { RS } }, -{ "mtictrl", XSPR(31,467,158), XSPR_MASK, PPC860, { RS } }, -{ "mtbar", XSPR(31,467,159), XSPR_MASK, PPC860, { RS } }, -{ "mtvrsave", XSPR(31,467,256), XSPR_MASK, PPCVEC, { RS } }, -{ "mtusprg0", XSPR(31,467,256), XSPR_MASK, BOOKE, { RS } }, -{ "mtsprg", XSPR(31,467,256), XSPRG_MASK,PPC, { SPRG, RS } }, -{ "mtsprg0", XSPR(31,467,272), XSPR_MASK, PPC, { RS } }, -{ "mtsprg1", XSPR(31,467,273), XSPR_MASK, PPC, { RS } }, -{ "mtsprg2", XSPR(31,467,274), XSPR_MASK, PPC, { RS } }, -{ "mtsprg3", XSPR(31,467,275), XSPR_MASK, PPC, { RS } }, -{ "mtsprg4", XSPR(31,467,276), XSPR_MASK, PPC405 | BOOKE, { RS } }, -{ "mtsprg5", XSPR(31,467,277), XSPR_MASK, PPC405 | BOOKE, { RS } }, -{ "mtsprg6", XSPR(31,467,278), XSPR_MASK, PPC405 | BOOKE, { RS } }, -{ "mtsprg7", XSPR(31,467,279), XSPR_MASK, PPC405 | BOOKE, { RS } }, -{ "mtasr", XSPR(31,467,280), XSPR_MASK, PPC64, { RS } }, -{ "mtear", XSPR(31,467,282), XSPR_MASK, PPC, { RS } }, -{ "mttbl", XSPR(31,467,284), XSPR_MASK, PPC, { RS } }, -{ "mttbu", XSPR(31,467,285), XSPR_MASK, PPC, { RS } }, -{ "mtdbsr", XSPR(31,467,304), XSPR_MASK, BOOKE, { RS } }, -{ "mtdbsr", XSPR(31,467,1008), XSPR_MASK, PPC403, { RS } }, -{ "mtdbcr0", XSPR(31,467,308), XSPR_MASK, BOOKE, { RS } }, -{ "mtdbcr0", XSPR(31,467,1010), XSPR_MASK, PPC405, { RS } }, -{ "mtdbcr1", XSPR(31,467,309), XSPR_MASK, BOOKE, { RS } }, -{ "mtdbcr1", XSPR(31,467,957), XSPR_MASK, PPC405, { RS } }, -{ "mtdbcr2", XSPR(31,467,310), XSPR_MASK, BOOKE, { RS } }, -{ "mtiac1", XSPR(31,467,312), XSPR_MASK, BOOKE, { RS } }, -{ "mtiac1", XSPR(31,467,1012), XSPR_MASK, PPC403, { RS } }, -{ "mtiac2", XSPR(31,467,313), XSPR_MASK, BOOKE, { RS } }, -{ "mtiac2", XSPR(31,467,1013), XSPR_MASK, PPC403, { RS } }, -{ "mtiac3", XSPR(31,467,314), XSPR_MASK, BOOKE, { RS } }, -{ "mtiac3", XSPR(31,467,948), XSPR_MASK, PPC405, { RS } }, -{ "mtiac4", XSPR(31,467,315), XSPR_MASK, BOOKE, { RS } }, -{ "mtiac4", XSPR(31,467,949), XSPR_MASK, PPC405, { RS } }, -{ "mtdac1", XSPR(31,467,316), XSPR_MASK, BOOKE, { RS } }, -{ "mtdac1", XSPR(31,467,1014), XSPR_MASK, PPC403, { RS } }, -{ "mtdac2", XSPR(31,467,317), XSPR_MASK, BOOKE, { RS } }, -{ "mtdac2", XSPR(31,467,1015), XSPR_MASK, PPC403, { RS } }, -{ "mtdvc1", XSPR(31,467,318), XSPR_MASK, BOOKE, { RS } }, -{ "mtdvc1", XSPR(31,467,950), XSPR_MASK, PPC405, { RS } }, -{ "mtdvc2", XSPR(31,467,319), XSPR_MASK, BOOKE, { RS } }, -{ "mtdvc2", XSPR(31,467,951), XSPR_MASK, PPC405, { RS } }, -{ "mttsr", XSPR(31,467,336), XSPR_MASK, BOOKE, { RS } }, -{ "mttsr", XSPR(31,467,984), XSPR_MASK, PPC403, { RS } }, -{ "mttcr", XSPR(31,467,340), XSPR_MASK, BOOKE, { RS } }, -{ "mttcr", XSPR(31,467,986), XSPR_MASK, PPC403, { RS } }, -{ "mtivor0", XSPR(31,467,400), XSPR_MASK, BOOKE, { RS } }, -{ "mtivor1", XSPR(31,467,401), XSPR_MASK, BOOKE, { RS } }, -{ "mtivor2", XSPR(31,467,402), XSPR_MASK, BOOKE, { RS } }, -{ "mtivor3", XSPR(31,467,403), XSPR_MASK, BOOKE, { RS } }, -{ "mtivor4", XSPR(31,467,404), XSPR_MASK, BOOKE, { RS } }, -{ "mtivor5", XSPR(31,467,405), XSPR_MASK, BOOKE, { RS } }, -{ "mtivor6", XSPR(31,467,406), XSPR_MASK, BOOKE, { RS } }, -{ "mtivor7", XSPR(31,467,407), XSPR_MASK, BOOKE, { RS } }, -{ "mtivor8", XSPR(31,467,408), XSPR_MASK, BOOKE, { RS } }, -{ "mtivor9", XSPR(31,467,409), XSPR_MASK, BOOKE, { RS } }, -{ "mtivor10", XSPR(31,467,410), XSPR_MASK, BOOKE, { RS } }, -{ "mtivor11", XSPR(31,467,411), XSPR_MASK, BOOKE, { RS } }, -{ "mtivor12", XSPR(31,467,412), XSPR_MASK, BOOKE, { RS } }, -{ "mtivor13", XSPR(31,467,413), XSPR_MASK, BOOKE, { RS } }, -{ "mtivor14", XSPR(31,467,414), XSPR_MASK, BOOKE, { RS } }, -{ "mtivor15", XSPR(31,467,415), XSPR_MASK, BOOKE, { RS } }, -{ "mtspefscr", XSPR(31,467,512), XSPR_MASK, PPCSPE, { RS } }, -{ "mtbbear", XSPR(31,467,513), XSPR_MASK, PPCBRLK, { RS } }, -{ "mtbbtar", XSPR(31,467,514), XSPR_MASK, PPCBRLK, { RS } }, -{ "mtivor32", XSPR(31,467,528), XSPR_MASK, PPCSPE, { RS } }, -{ "mtivor33", XSPR(31,467,529), XSPR_MASK, PPCSPE, { RS } }, -{ "mtivor34", XSPR(31,467,530), XSPR_MASK, PPCSPE, { RS } }, -{ "mtivor35", XSPR(31,467,531), XSPR_MASK, PPCPMR, { RS } }, -{ "mtibatu", XSPR(31,467,528), XSPRBAT_MASK, PPC, { SPRBAT, RS } }, -{ "mtibatl", XSPR(31,467,529), XSPRBAT_MASK, PPC, { SPRBAT, RS } }, -{ "mtdbatu", XSPR(31,467,536), XSPRBAT_MASK, PPC, { SPRBAT, RS } }, -{ "mtdbatl", XSPR(31,467,537), XSPRBAT_MASK, PPC, { SPRBAT, RS } }, -{ "mtmcsrr0", XSPR(31,467,570), XSPR_MASK, PPCRFMCI, { RS } }, -{ "mtmcsrr1", XSPR(31,467,571), XSPR_MASK, PPCRFMCI, { RS } }, -{ "mtmcsr", XSPR(31,467,572), XSPR_MASK, PPCRFMCI, { RS } }, -{ "mtummcr0", XSPR(31,467,936), XSPR_MASK, PPC750, { RS } }, -{ "mtupmc1", XSPR(31,467,937), XSPR_MASK, PPC750, { RS } }, -{ "mtupmc2", XSPR(31,467,938), XSPR_MASK, PPC750, { RS } }, -{ "mtusia", XSPR(31,467,939), XSPR_MASK, PPC750, { RS } }, -{ "mtummcr1", XSPR(31,467,940), XSPR_MASK, PPC750, { RS } }, -{ "mtupmc3", XSPR(31,467,941), XSPR_MASK, PPC750, { RS } }, -{ "mtupmc4", XSPR(31,467,942), XSPR_MASK, PPC750, { RS } }, -{ "mtzpr", XSPR(31,467,944), XSPR_MASK, PPC403, { RS } }, -{ "mtccr0", XSPR(31,467,947), XSPR_MASK, PPC405, { RS } }, -{ "mtmmcr0", XSPR(31,467,952), XSPR_MASK, PPC750, { RS } }, -{ "mtsgr", XSPR(31,467,953), XSPR_MASK, PPC403, { RS } }, -{ "mtpmc1", XSPR(31,467,953), XSPR_MASK, PPC750, { RS } }, -{ "mtdcwr", XSPR(31,467,954), XSPR_MASK, PPC403, { RS } }, -{ "mtpmc2", XSPR(31,467,954), XSPR_MASK, PPC750, { RS } }, -{ "mtsler", XSPR(31,467,955), XSPR_MASK, PPC405, { RS } }, -{ "mtsia", XSPR(31,467,955), XSPR_MASK, PPC750, { RS } }, -{ "mtsu0r", XSPR(31,467,956), XSPR_MASK, PPC405, { RS } }, -{ "mtmmcr1", XSPR(31,467,956), XSPR_MASK, PPC750, { RS } }, -{ "mtpmc3", XSPR(31,467,957), XSPR_MASK, PPC750, { RS } }, -{ "mtpmc4", XSPR(31,467,958), XSPR_MASK, PPC750, { RS } }, -{ "mticdbdr", XSPR(31,467,979), XSPR_MASK, PPC403, { RS } }, -{ "mtevpr", XSPR(31,467,982), XSPR_MASK, PPC403, { RS } }, -{ "mtcdbcr", XSPR(31,467,983), XSPR_MASK, PPC403, { RS } }, -{ "mtpit", XSPR(31,467,987), XSPR_MASK, PPC403, { RS } }, -{ "mttbhi", XSPR(31,467,988), XSPR_MASK, PPC403, { RS } }, -{ "mttblo", XSPR(31,467,989), XSPR_MASK, PPC403, { RS } }, -{ "mtsrr2", XSPR(31,467,990), XSPR_MASK, PPC403, { RS } }, -{ "mtsrr3", XSPR(31,467,991), XSPR_MASK, PPC403, { RS } }, -{ "mtl2cr", XSPR(31,467,1017), XSPR_MASK, PPC750, { RS } }, -{ "mtdccr", XSPR(31,467,1018), XSPR_MASK, PPC403, { RS } }, -{ "mticcr", XSPR(31,467,1019), XSPR_MASK, PPC403, { RS } }, -{ "mtictc", XSPR(31,467,1019), XSPR_MASK, PPC750, { RS } }, -{ "mtpbl1", XSPR(31,467,1020), XSPR_MASK, PPC403, { RS } }, -{ "mtthrm1", XSPR(31,467,1020), XSPR_MASK, PPC750, { RS } }, -{ "mtpbu1", XSPR(31,467,1021), XSPR_MASK, PPC403, { RS } }, -{ "mtthrm2", XSPR(31,467,1021), XSPR_MASK, PPC750, { RS } }, -{ "mtpbl2", XSPR(31,467,1022), XSPR_MASK, PPC403, { RS } }, -{ "mtthrm3", XSPR(31,467,1022), XSPR_MASK, PPC750, { RS } }, -{ "mtpbu2", XSPR(31,467,1023), XSPR_MASK, PPC403, { RS } }, -{ "mtspr", X(31,467), X_MASK, COM, { SPR, RS } }, - -{ "dcbi", X(31,470), XRT_MASK, PPC, { RA, RB } }, - -{ "nand", XRC(31,476,0), X_MASK, COM, { RA, RS, RB } }, -{ "nand.", XRC(31,476,1), X_MASK, COM, { RA, RS, RB } }, - -{ "dcbie", X(31,478), XRT_MASK, BOOKE64, { RA, RB } }, - -{ "dcread", X(31,486), X_MASK, PPC403|PPC440, { RT, RA, RB }}, - -{ "mtpmr", X(31,462), X_MASK, PPCPMR, { PMR, RS }}, - -{ "icbtls", X(31,486), X_MASK, PPCCHLK, { CT, RA, RB }}, - -{ "nabs", XO(31,488,0,0), XORB_MASK, M601, { RT, RA } }, -{ "subfme64",XO(31,488,0,0), XORB_MASK, BOOKE64, { RT, RA } }, -{ "nabs.", XO(31,488,0,1), XORB_MASK, M601, { RT, RA } }, -{ "nabso", XO(31,488,1,0), XORB_MASK, M601, { RT, RA } }, -{ "subfme64o",XO(31,488,1,0), XORB_MASK, BOOKE64, { RT, RA } }, -{ "nabso.", XO(31,488,1,1), XORB_MASK, M601, { RT, RA } }, - -{ "divd", XO(31,489,0,0), XO_MASK, PPC64, { RT, RA, RB } }, -{ "divd.", XO(31,489,0,1), XO_MASK, PPC64, { RT, RA, RB } }, -{ "divdo", XO(31,489,1,0), XO_MASK, PPC64, { RT, RA, RB } }, -{ "divdo.", XO(31,489,1,1), XO_MASK, PPC64, { RT, RA, RB } }, - -{ "addme64", XO(31,490,0,0), XORB_MASK, BOOKE64, { RT, RA } }, -{ "addme64o",XO(31,490,1,0), XORB_MASK, BOOKE64, { RT, RA } }, - -{ "divw", XO(31,491,0,0), XO_MASK, PPC, { RT, RA, RB } }, -{ "divw.", XO(31,491,0,1), XO_MASK, PPC, { RT, RA, RB } }, -{ "divwo", XO(31,491,1,0), XO_MASK, PPC, { RT, RA, RB } }, -{ "divwo.", XO(31,491,1,1), XO_MASK, PPC, { RT, RA, RB } }, - -{ "icbtlse", X(31,494), X_MASK, PPCCHLK64, { CT, RA, RB }}, - -{ "slbia", X(31,498), 0xffffffff, PPC64, { 0 } }, - -{ "cli", X(31,502), XRB_MASK, POWER, { RT, RA } }, - -{ "stdcxe.", XRC(31,511,1), X_MASK, BOOKE64, { RS, RA, RB } }, - -{ "mcrxr", X(31,512), XRARB_MASK|(3<<21), COM, { BF } }, - -{ "bblels", X(31,518), X_MASK, PPCBRLK, { 0 }}, -{ "mcrxr64", X(31,544), XRARB_MASK|(3<<21), BOOKE64, { BF } }, - -{ "clcs", X(31,531), XRB_MASK, M601, { RT, RA } }, - -{ "ldbrx", X(31,532), X_MASK, CELL, { RT, RA0, RB } }, - -{ "lswx", X(31,533), X_MASK, PPCCOM, { RT, RA0, RB } }, -{ "lsx", X(31,533), X_MASK, PWRCOM, { RT, RA, RB } }, - -{ "lwbrx", X(31,534), X_MASK, PPCCOM, { RT, RA0, RB } }, -{ "lbrx", X(31,534), X_MASK, PWRCOM, { RT, RA, RB } }, - -{ "lfsx", X(31,535), X_MASK, COM, { FRT, RA0, RB } }, - -{ "srw", XRC(31,536,0), X_MASK, PPCCOM, { RA, RS, RB } }, -{ "sr", XRC(31,536,0), X_MASK, PWRCOM, { RA, RS, RB } }, -{ "srw.", XRC(31,536,1), X_MASK, PPCCOM, { RA, RS, RB } }, -{ "sr.", XRC(31,536,1), X_MASK, PWRCOM, { RA, RS, RB } }, - -{ "rrib", XRC(31,537,0), X_MASK, M601, { RA, RS, RB } }, -{ "rrib.", XRC(31,537,1), X_MASK, M601, { RA, RS, RB } }, - -{ "srd", XRC(31,539,0), X_MASK, PPC64, { RA, RS, RB } }, -{ "srd.", XRC(31,539,1), X_MASK, PPC64, { RA, RS, RB } }, - -{ "maskir", XRC(31,541,0), X_MASK, M601, { RA, RS, RB } }, -{ "maskir.", XRC(31,541,1), X_MASK, M601, { RA, RS, RB } }, - -{ "lwbrxe", X(31,542), X_MASK, BOOKE64, { RT, RA0, RB } }, - -{ "lfsxe", X(31,543), X_MASK, BOOKE64, { FRT, RA0, RB } }, - -{ "bbelr", X(31,550), X_MASK, PPCBRLK, { 0 }}, - -{ "tlbsync", X(31,566), 0xffffffff, PPC, { 0 } }, - -{ "lfsux", X(31,567), X_MASK, COM, { FRT, RAS, RB } }, - -{ "lfsuxe", X(31,575), X_MASK, BOOKE64, { FRT, RAS, RB } }, - -{ "mfsr", X(31,595), XRB_MASK|(1<<20), COM32, { RT, SR } }, - -{ "lswi", X(31,597), X_MASK, PPCCOM, { RT, RA0, NB } }, -{ "lsi", X(31,597), X_MASK, PWRCOM, { RT, RA0, NB } }, - -{ "lwsync", XSYNC(31,598,1), 0xffffffff, PPC, { 0 } }, -{ "ptesync", XSYNC(31,598,2), 0xffffffff, PPC64, { 0 } }, -{ "msync", X(31,598), 0xffffffff, BOOKE, { 0 } }, -{ "sync", X(31,598), XSYNC_MASK, PPCCOM, { LS } }, -{ "dcs", X(31,598), 0xffffffff, PWRCOM, { 0 } }, - -{ "lfdx", X(31,599), X_MASK, COM, { FRT, RA0, RB } }, - -{ "lfdxe", X(31,607), X_MASK, BOOKE64, { FRT, RA0, RB } }, - -{ "mffgpr", XRC(31,607,0), XRA_MASK, POWER6, { FRT, RB } }, - -{ "mfsri", X(31,627), X_MASK, PWRCOM, { RT, RA, RB } }, - -{ "dclst", X(31,630), XRB_MASK, PWRCOM, { RS, RA } }, - -{ "lfdux", X(31,631), X_MASK, COM, { FRT, RAS, RB } }, - -{ "lfduxe", X(31,639), X_MASK, BOOKE64, { FRT, RAS, RB } }, - -{ "mfsrin", X(31,659), XRA_MASK, PPC32, { RT, RB } }, - -{ "stdbrx", X(31,660), X_MASK, CELL, { RS, RA0, RB } }, - -{ "stswx", X(31,661), X_MASK, PPCCOM, { RS, RA0, RB } }, -{ "stsx", X(31,661), X_MASK, PWRCOM, { RS, RA0, RB } }, - -{ "stwbrx", X(31,662), X_MASK, PPCCOM, { RS, RA0, RB } }, -{ "stbrx", X(31,662), X_MASK, PWRCOM, { RS, RA0, RB } }, - -{ "stfsx", X(31,663), X_MASK, COM, { FRS, RA0, RB } }, - -{ "srq", XRC(31,664,0), X_MASK, M601, { RA, RS, RB } }, -{ "srq.", XRC(31,664,1), X_MASK, M601, { RA, RS, RB } }, - -{ "sre", XRC(31,665,0), X_MASK, M601, { RA, RS, RB } }, -{ "sre.", XRC(31,665,1), X_MASK, M601, { RA, RS, RB } }, - -{ "stwbrxe", X(31,670), X_MASK, BOOKE64, { RS, RA0, RB } }, - -{ "stfsxe", X(31,671), X_MASK, BOOKE64, { FRS, RA0, RB } }, - -{ "stfsux", X(31,695), X_MASK, COM, { FRS, RAS, RB } }, - -{ "sriq", XRC(31,696,0), X_MASK, M601, { RA, RS, SH } }, -{ "sriq.", XRC(31,696,1), X_MASK, M601, { RA, RS, SH } }, - -{ "stfsuxe", X(31,703), X_MASK, BOOKE64, { FRS, RAS, RB } }, - -{ "stswi", X(31,725), X_MASK, PPCCOM, { RS, RA0, NB } }, -{ "stsi", X(31,725), X_MASK, PWRCOM, { RS, RA0, NB } }, - -{ "stfdx", X(31,727), X_MASK, COM, { FRS, RA0, RB } }, - -{ "srlq", XRC(31,728,0), X_MASK, M601, { RA, RS, RB } }, -{ "srlq.", XRC(31,728,1), X_MASK, M601, { RA, RS, RB } }, - -{ "sreq", XRC(31,729,0), X_MASK, M601, { RA, RS, RB } }, -{ "sreq.", XRC(31,729,1), X_MASK, M601, { RA, RS, RB } }, - -{ "stfdxe", X(31,735), X_MASK, BOOKE64, { FRS, RA0, RB } }, - -{ "mftgpr", XRC(31,735,0), XRA_MASK, POWER6, { RT, FRB } }, - -{ "dcba", X(31,758), XRT_MASK, PPC405 | BOOKE, { RA, RB } }, - -{ "stfdux", X(31,759), X_MASK, COM, { FRS, RAS, RB } }, - -{ "srliq", XRC(31,760,0), X_MASK, M601, { RA, RS, SH } }, -{ "srliq.", XRC(31,760,1), X_MASK, M601, { RA, RS, SH } }, - -{ "dcbae", X(31,766), XRT_MASK, BOOKE64, { RA, RB } }, - -{ "stfduxe", X(31,767), X_MASK, BOOKE64, { FRS, RAS, RB } }, - -{ "tlbivax", X(31,786), XRT_MASK, BOOKE, { RA, RB } }, -{ "tlbivaxe",X(31,787), XRT_MASK, BOOKE64, { RA, RB } }, - -{ "lwzcix", X(31,789), X_MASK, POWER6, { RT, RA0, RB } }, - -{ "lhbrx", X(31,790), X_MASK, COM, { RT, RA0, RB } }, - -{ "sraw", XRC(31,792,0), X_MASK, PPCCOM, { RA, RS, RB } }, -{ "sra", XRC(31,792,0), X_MASK, PWRCOM, { RA, RS, RB } }, -{ "sraw.", XRC(31,792,1), X_MASK, PPCCOM, { RA, RS, RB } }, -{ "sra.", XRC(31,792,1), X_MASK, PWRCOM, { RA, RS, RB } }, - -{ "srad", XRC(31,794,0), X_MASK, PPC64, { RA, RS, RB } }, -{ "srad.", XRC(31,794,1), X_MASK, PPC64, { RA, RS, RB } }, - -{ "lhbrxe", X(31,798), X_MASK, BOOKE64, { RT, RA0, RB } }, - -{ "ldxe", X(31,799), X_MASK, BOOKE64, { RT, RA0, RB } }, -{ "lduxe", X(31,831), X_MASK, BOOKE64, { RT, RA0, RB } }, - -{ "rac", X(31,818), X_MASK, PWRCOM, { RT, RA, RB } }, - -{ "lhzcix", X(31,821), X_MASK, POWER6, { RT, RA0, RB } }, - -{ "dss", XDSS(31,822,0), XDSS_MASK, PPCVEC, { STRM } }, -{ "dssall", XDSS(31,822,1), XDSS_MASK, PPCVEC, { 0 } }, - -{ "srawi", XRC(31,824,0), X_MASK, PPCCOM, { RA, RS, SH } }, -{ "srai", XRC(31,824,0), X_MASK, PWRCOM, { RA, RS, SH } }, -{ "srawi.", XRC(31,824,1), X_MASK, PPCCOM, { RA, RS, SH } }, -{ "srai.", XRC(31,824,1), X_MASK, PWRCOM, { RA, RS, SH } }, - -{ "slbmfev", X(31,851), XRA_MASK, PPC64, { RT, RB } }, - -{ "lbzcix", X(31,853), X_MASK, POWER6, { RT, RA0, RB } }, - -{ "mbar", X(31,854), X_MASK, BOOKE, { MO } }, -{ "eieio", X(31,854), 0xffffffff, PPC, { 0 } }, - -{ "lfiwax", X(31,855), X_MASK, POWER6, { FRT, RA0, RB } }, - -{ "ldcix", X(31,885), X_MASK, POWER6, { RT, RA0, RB } }, - -{ "tlbsx", XRC(31,914,0), X_MASK, PPC403|BOOKE, { RTO, RA, RB } }, -{ "tlbsx.", XRC(31,914,1), X_MASK, PPC403|BOOKE, { RTO, RA, RB } }, -{ "tlbsxe", XRC(31,915,0), X_MASK, BOOKE64, { RTO, RA, RB } }, -{ "tlbsxe.", XRC(31,915,1), X_MASK, BOOKE64, { RTO, RA, RB } }, - -{ "slbmfee", X(31,915), XRA_MASK, PPC64, { RT, RB } }, - -{ "stwcix", X(31,917), X_MASK, POWER6, { RS, RA0, RB } }, - -{ "sthbrx", X(31,918), X_MASK, COM, { RS, RA0, RB } }, - -{ "sraq", XRC(31,920,0), X_MASK, M601, { RA, RS, RB } }, -{ "sraq.", XRC(31,920,1), X_MASK, M601, { RA, RS, RB } }, - -{ "srea", XRC(31,921,0), X_MASK, M601, { RA, RS, RB } }, -{ "srea.", XRC(31,921,1), X_MASK, M601, { RA, RS, RB } }, - -{ "extsh", XRC(31,922,0), XRB_MASK, PPCCOM, { RA, RS } }, -{ "exts", XRC(31,922,0), XRB_MASK, PWRCOM, { RA, RS } }, -{ "extsh.", XRC(31,922,1), XRB_MASK, PPCCOM, { RA, RS } }, -{ "exts.", XRC(31,922,1), XRB_MASK, PWRCOM, { RA, RS } }, - -{ "sthbrxe", X(31,926), X_MASK, BOOKE64, { RS, RA0, RB } }, - -{ "stdxe", X(31,927), X_MASK, BOOKE64, { RS, RA0, RB } }, - -{ "tlbrehi", XTLB(31,946,0), XTLB_MASK, PPC403, { RT, RA } }, -{ "tlbrelo", XTLB(31,946,1), XTLB_MASK, PPC403, { RT, RA } }, -{ "tlbre", X(31,946), X_MASK, PPC403|BOOKE, { RSO, RAOPT, SHO } }, - -{ "sthcix", X(31,949), X_MASK, POWER6, { RS, RA0, RB } }, - -{ "sraiq", XRC(31,952,0), X_MASK, M601, { RA, RS, SH } }, -{ "sraiq.", XRC(31,952,1), X_MASK, M601, { RA, RS, SH } }, - -{ "extsb", XRC(31,954,0), XRB_MASK, PPC, { RA, RS} }, -{ "extsb.", XRC(31,954,1), XRB_MASK, PPC, { RA, RS} }, - -{ "stduxe", X(31,959), X_MASK, BOOKE64, { RS, RAS, RB } }, - -{ "iccci", X(31,966), XRT_MASK, PPC403|PPC440, { RA, RB } }, - -{ "tlbwehi", XTLB(31,978,0), XTLB_MASK, PPC403, { RT, RA } }, -{ "tlbwelo", XTLB(31,978,1), XTLB_MASK, PPC403, { RT, RA } }, -{ "tlbwe", X(31,978), X_MASK, PPC403|BOOKE, { RSO, RAOPT, SHO } }, -{ "tlbld", X(31,978), XRTRA_MASK, PPC, { RB } }, - -{ "stbcix", X(31,981), X_MASK, POWER6, { RS, RA0, RB } }, - -{ "icbi", X(31,982), XRT_MASK, PPC, { RA, RB } }, - -{ "stfiwx", X(31,983), X_MASK, PPC, { FRS, RA0, RB } }, - -{ "extsw", XRC(31,986,0), XRB_MASK, PPC64 | BOOKE64,{ RA, RS } }, -{ "extsw.", XRC(31,986,1), XRB_MASK, PPC64, { RA, RS } }, - -{ "icread", X(31,998), XRT_MASK, PPC403|PPC440, { RA, RB } }, - -{ "icbie", X(31,990), XRT_MASK, BOOKE64, { RA, RB } }, -{ "stfiwxe", X(31,991), X_MASK, BOOKE64, { FRS, RA0, RB } }, - -{ "tlbli", X(31,1010), XRTRA_MASK, PPC, { RB } }, - -{ "stdcix", X(31,1013), X_MASK, POWER6, { RS, RA0, RB } }, - -{ "dcbzl", XOPL(31,1014,1), XRT_MASK,POWER4, { RA, RB } }, -{ "dcbz", X(31,1014), XRT_MASK, PPC, { RA, RB } }, -{ "dclz", X(31,1014), XRT_MASK, PPC, { RA, RB } }, - -{ "dcbze", X(31,1022), XRT_MASK, BOOKE64, { RA, RB } }, - -{ "lvebx", X(31, 7), X_MASK, PPCVEC, { VD, RA, RB } }, -{ "lvehx", X(31, 39), X_MASK, PPCVEC, { VD, RA, RB } }, -{ "lvewx", X(31, 71), X_MASK, PPCVEC, { VD, RA, RB } }, -{ "lvsl", X(31, 6), X_MASK, PPCVEC, { VD, RA, RB } }, -{ "lvsr", X(31, 38), X_MASK, PPCVEC, { VD, RA, RB } }, -{ "lvx", X(31, 103), X_MASK, PPCVEC, { VD, RA, RB } }, -{ "lvxl", X(31, 359), X_MASK, PPCVEC, { VD, RA, RB } }, -{ "stvebx", X(31, 135), X_MASK, PPCVEC, { VS, RA, RB } }, -{ "stvehx", X(31, 167), X_MASK, PPCVEC, { VS, RA, RB } }, -{ "stvewx", X(31, 199), X_MASK, PPCVEC, { VS, RA, RB } }, -{ "stvx", X(31, 231), X_MASK, PPCVEC, { VS, RA, RB } }, -{ "stvxl", X(31, 487), X_MASK, PPCVEC, { VS, RA, RB } }, - -/* New load/store left/right index vector instructions that are in the Cell only. */ -{ "lvlx", X(31, 519), X_MASK, CELL, { VD, RA0, RB } }, -{ "lvlxl", X(31, 775), X_MASK, CELL, { VD, RA0, RB } }, -{ "lvrx", X(31, 551), X_MASK, CELL, { VD, RA0, RB } }, -{ "lvrxl", X(31, 807), X_MASK, CELL, { VD, RA0, RB } }, -{ "stvlx", X(31, 647), X_MASK, CELL, { VS, RA0, RB } }, -{ "stvlxl", X(31, 903), X_MASK, CELL, { VS, RA0, RB } }, -{ "stvrx", X(31, 679), X_MASK, CELL, { VS, RA0, RB } }, -{ "stvrxl", X(31, 935), X_MASK, CELL, { VS, RA0, RB } }, - -{ "lwz", OP(32), OP_MASK, PPCCOM, { RT, D, RA0 } }, -{ "l", OP(32), OP_MASK, PWRCOM, { RT, D, RA0 } }, - -{ "lwzu", OP(33), OP_MASK, PPCCOM, { RT, D, RAL } }, -{ "lu", OP(33), OP_MASK, PWRCOM, { RT, D, RA0 } }, - -{ "lbz", OP(34), OP_MASK, COM, { RT, D, RA0 } }, - -{ "lbzu", OP(35), OP_MASK, COM, { RT, D, RAL } }, - -{ "stw", OP(36), OP_MASK, PPCCOM, { RS, D, RA0 } }, -{ "st", OP(36), OP_MASK, PWRCOM, { RS, D, RA0 } }, - -{ "stwu", OP(37), OP_MASK, PPCCOM, { RS, D, RAS } }, -{ "stu", OP(37), OP_MASK, PWRCOM, { RS, D, RA0 } }, - -{ "stb", OP(38), OP_MASK, COM, { RS, D, RA0 } }, - -{ "stbu", OP(39), OP_MASK, COM, { RS, D, RAS } }, - -{ "lhz", OP(40), OP_MASK, COM, { RT, D, RA0 } }, - -{ "lhzu", OP(41), OP_MASK, COM, { RT, D, RAL } }, - -{ "lha", OP(42), OP_MASK, COM, { RT, D, RA0 } }, - -{ "lhau", OP(43), OP_MASK, COM, { RT, D, RAL } }, - -{ "sth", OP(44), OP_MASK, COM, { RS, D, RA0 } }, - -{ "sthu", OP(45), OP_MASK, COM, { RS, D, RAS } }, - -{ "lmw", OP(46), OP_MASK, PPCCOM, { RT, D, RAM } }, -{ "lm", OP(46), OP_MASK, PWRCOM, { RT, D, RA0 } }, - -{ "stmw", OP(47), OP_MASK, PPCCOM, { RS, D, RA0 } }, -{ "stm", OP(47), OP_MASK, PWRCOM, { RS, D, RA0 } }, - -{ "lfs", OP(48), OP_MASK, COM, { FRT, D, RA0 } }, - -{ "lfsu", OP(49), OP_MASK, COM, { FRT, D, RAS } }, - -{ "lfd", OP(50), OP_MASK, COM, { FRT, D, RA0 } }, - -{ "lfdu", OP(51), OP_MASK, COM, { FRT, D, RAS } }, - -{ "stfs", OP(52), OP_MASK, COM, { FRS, D, RA0 } }, - -{ "stfsu", OP(53), OP_MASK, COM, { FRS, D, RAS } }, - -{ "stfd", OP(54), OP_MASK, COM, { FRS, D, RA0 } }, - -{ "stfdu", OP(55), OP_MASK, COM, { FRS, D, RAS } }, - -{ "lq", OP(56), OP_MASK, POWER4, { RTQ, DQ, RAQ } }, - -{ "lfq", OP(56), OP_MASK, POWER2, { FRT, D, RA0 } }, - -{ "lfqu", OP(57), OP_MASK, POWER2, { FRT, D, RA0 } }, - -{ "lfdp", OP(57), OP_MASK, POWER6, { FRT, D, RA0 } }, - -{ "lbze", DEO(58,0), DE_MASK, BOOKE64, { RT, DE, RA0 } }, -{ "lbzue", DEO(58,1), DE_MASK, BOOKE64, { RT, DE, RAL } }, -{ "lhze", DEO(58,2), DE_MASK, BOOKE64, { RT, DE, RA0 } }, -{ "lhzue", DEO(58,3), DE_MASK, BOOKE64, { RT, DE, RAL } }, -{ "lhae", DEO(58,4), DE_MASK, BOOKE64, { RT, DE, RA0 } }, -{ "lhaue", DEO(58,5), DE_MASK, BOOKE64, { RT, DE, RAL } }, -{ "lwze", DEO(58,6), DE_MASK, BOOKE64, { RT, DE, RA0 } }, -{ "lwzue", DEO(58,7), DE_MASK, BOOKE64, { RT, DE, RAL } }, -{ "stbe", DEO(58,8), DE_MASK, BOOKE64, { RS, DE, RA0 } }, -{ "stbue", DEO(58,9), DE_MASK, BOOKE64, { RS, DE, RAS } }, -{ "sthe", DEO(58,10), DE_MASK, BOOKE64, { RS, DE, RA0 } }, -{ "sthue", DEO(58,11), DE_MASK, BOOKE64, { RS, DE, RAS } }, -{ "stwe", DEO(58,14), DE_MASK, BOOKE64, { RS, DE, RA0 } }, -{ "stwue", DEO(58,15), DE_MASK, BOOKE64, { RS, DE, RAS } }, - -{ "ld", DSO(58,0), DS_MASK, PPC64, { RT, DS, RA0 } }, - -{ "ldu", DSO(58,1), DS_MASK, PPC64, { RT, DS, RAL } }, - -{ "lwa", DSO(58,2), DS_MASK, PPC64, { RT, DS, RA0 } }, - -{ "dadd", XRC(59,2,0), X_MASK, POWER6, { FRT, FRA, FRB } }, -{ "dadd.", XRC(59,2,1), X_MASK, POWER6, { FRT, FRA, FRB } }, - -{ "dqua", ZRC(59,3,0), Z2_MASK, POWER6, { FRT, FRA, FRB, RMC } }, -{ "dqua.", ZRC(59,3,1), Z2_MASK, POWER6, { FRT, FRA, FRB, RMC } }, - -{ "fdivs", A(59,18,0), AFRC_MASK, PPC, { FRT, FRA, FRB } }, -{ "fdivs.", A(59,18,1), AFRC_MASK, PPC, { FRT, FRA, FRB } }, - -{ "fsubs", A(59,20,0), AFRC_MASK, PPC, { FRT, FRA, FRB } }, -{ "fsubs.", A(59,20,1), AFRC_MASK, PPC, { FRT, FRA, FRB } }, - -{ "fadds", A(59,21,0), AFRC_MASK, PPC, { FRT, FRA, FRB } }, -{ "fadds.", A(59,21,1), AFRC_MASK, PPC, { FRT, FRA, FRB } }, - -{ "fsqrts", A(59,22,0), AFRAFRC_MASK, PPC, { FRT, FRB } }, -{ "fsqrts.", A(59,22,1), AFRAFRC_MASK, PPC, { FRT, FRB } }, - -{ "fres", A(59,24,0), AFRALFRC_MASK, PPC, { FRT, FRB, A_L } }, -{ "fres.", A(59,24,1), AFRALFRC_MASK, PPC, { FRT, FRB, A_L } }, - -{ "fmuls", A(59,25,0), AFRB_MASK, PPC, { FRT, FRA, FRC } }, -{ "fmuls.", A(59,25,1), AFRB_MASK, PPC, { FRT, FRA, FRC } }, - -{ "frsqrtes", A(59,26,0), AFRALFRC_MASK,POWER5, { FRT, FRB, A_L } }, -{ "frsqrtes.",A(59,26,1), AFRALFRC_MASK,POWER5, { FRT, FRB, A_L } }, - -{ "fmsubs", A(59,28,0), A_MASK, PPC, { FRT,FRA,FRC,FRB } }, -{ "fmsubs.", A(59,28,1), A_MASK, PPC, { FRT,FRA,FRC,FRB } }, - -{ "fmadds", A(59,29,0), A_MASK, PPC, { FRT,FRA,FRC,FRB } }, -{ "fmadds.", A(59,29,1), A_MASK, PPC, { FRT,FRA,FRC,FRB } }, - -{ "fnmsubs", A(59,30,0), A_MASK, PPC, { FRT,FRA,FRC,FRB } }, -{ "fnmsubs.",A(59,30,1), A_MASK, PPC, { FRT,FRA,FRC,FRB } }, - -{ "fnmadds", A(59,31,0), A_MASK, PPC, { FRT,FRA,FRC,FRB } }, -{ "fnmadds.",A(59,31,1), A_MASK, PPC, { FRT,FRA,FRC,FRB } }, - -{ "dmul", XRC(59,34,0), X_MASK, POWER6, { FRT, FRA, FRB } }, -{ "dmul.", XRC(59,34,1), X_MASK, POWER6, { FRT, FRA, FRB } }, - -{ "drrnd", ZRC(59,35,0), Z2_MASK, POWER6, { FRT, FRA, FRB, RMC } }, -{ "drrnd.", ZRC(59,35,1), Z2_MASK, POWER6, { FRT, FRA, FRB, RMC } }, - -{ "dscli", ZRC(59,66,0), Z_MASK, POWER6, { FRT, FRA, SH16 } }, -{ "dscli.", ZRC(59,66,1), Z_MASK, POWER6, { FRT, FRA, SH16 } }, - -{ "dquai", ZRC(59,67,0), Z2_MASK, POWER6, { TE, FRT, FRB, RMC } }, -{ "dquai.", ZRC(59,67,1), Z2_MASK, POWER6, { TE, FRT, FRB, RMC } }, - -{ "dscri", ZRC(59,98,0), Z_MASK, POWER6, { FRT, FRA, SH16 } }, -{ "dscri.", ZRC(59,98,1), Z_MASK, POWER6, { FRT, FRA, SH16 } }, - -{ "drintx", ZRC(59,99,0), Z2_MASK, POWER6, { R, FRT, FRB, RMC } }, -{ "drintx.", ZRC(59,99,1), Z2_MASK, POWER6, { R, FRT, FRB, RMC } }, - -{ "dcmpo", X(59,130), X_MASK, POWER6, { BF, FRA, FRB } }, - -{ "dtstex", X(59,162), X_MASK, POWER6, { BF, FRA, FRB } }, -{ "dtstdc", Z(59,194), Z_MASK, POWER6, { BF, FRA, DCM } }, -{ "dtstdg", Z(59,226), Z_MASK, POWER6, { BF, FRA, DGM } }, - -{ "drintn", ZRC(59,227,0), Z2_MASK, POWER6, { R, FRT, FRB, RMC } }, -{ "drintn.", ZRC(59,227,1), Z2_MASK, POWER6, { R, FRT, FRB, RMC } }, - -{ "dctdp", XRC(59,258,0), X_MASK, POWER6, { FRT, FRB } }, -{ "dctdp.", XRC(59,258,1), X_MASK, POWER6, { FRT, FRB } }, - -{ "dctfix", XRC(59,290,0), X_MASK, POWER6, { FRT, FRB } }, -{ "dctfix.", XRC(59,290,1), X_MASK, POWER6, { FRT, FRB } }, - -{ "ddedpd", XRC(59,322,0), X_MASK, POWER6, { SP, FRT, FRB } }, -{ "ddedpd.", XRC(59,322,1), X_MASK, POWER6, { SP, FRT, FRB } }, - -{ "dxex", XRC(59,354,0), X_MASK, POWER6, { FRT, FRB } }, -{ "dxex.", XRC(59,354,1), X_MASK, POWER6, { FRT, FRB } }, - -{ "dsub", XRC(59,514,0), X_MASK, POWER6, { FRT, FRA, FRB } }, -{ "dsub.", XRC(59,514,1), X_MASK, POWER6, { FRT, FRA, FRB } }, - -{ "ddiv", XRC(59,546,0), X_MASK, POWER6, { FRT, FRA, FRB } }, -{ "ddiv.", XRC(59,546,1), X_MASK, POWER6, { FRT, FRA, FRB } }, - -{ "dcmpu", X(59,642), X_MASK, POWER6, { BF, FRA, FRB } }, - -{ "dtstsf", X(59,674), X_MASK, POWER6, { BF, FRA, FRB } }, - -{ "drsp", XRC(59,770,0), X_MASK, POWER6, { FRT, FRB } }, -{ "drsp.", XRC(59,770,1), X_MASK, POWER6, { FRT, FRB } }, - -{ "dcffix", XRC(59,802,0), X_MASK, POWER6, { FRT, FRB } }, -{ "dcffix.", XRC(59,802,1), X_MASK, POWER6, { FRT, FRB } }, - -{ "denbcd", XRC(59,834,0), X_MASK, POWER6, { S, FRT, FRB } }, -{ "denbcd.", XRC(59,834,1), X_MASK, POWER6, { S, FRT, FRB } }, - -{ "diex", XRC(59,866,0), X_MASK, POWER6, { FRT, FRA, FRB } }, -{ "diex.", XRC(59,866,1), X_MASK, POWER6, { FRT, FRA, FRB } }, - -{ "stfq", OP(60), OP_MASK, POWER2, { FRS, D, RA } }, - -{ "stfqu", OP(61), OP_MASK, POWER2, { FRS, D, RA } }, - -{ "stfdp", OP(61), OP_MASK, POWER6, { FRT, D, RA0 } }, - -{ "lde", DEO(62,0), DE_MASK, BOOKE64, { RT, DES, RA0 } }, -{ "ldue", DEO(62,1), DE_MASK, BOOKE64, { RT, DES, RA0 } }, -{ "lfse", DEO(62,4), DE_MASK, BOOKE64, { FRT, DES, RA0 } }, -{ "lfsue", DEO(62,5), DE_MASK, BOOKE64, { FRT, DES, RAS } }, -{ "lfde", DEO(62,6), DE_MASK, BOOKE64, { FRT, DES, RA0 } }, -{ "lfdue", DEO(62,7), DE_MASK, BOOKE64, { FRT, DES, RAS } }, -{ "stde", DEO(62,8), DE_MASK, BOOKE64, { RS, DES, RA0 } }, -{ "stdue", DEO(62,9), DE_MASK, BOOKE64, { RS, DES, RAS } }, -{ "stfse", DEO(62,12), DE_MASK, BOOKE64, { FRS, DES, RA0 } }, -{ "stfsue", DEO(62,13), DE_MASK, BOOKE64, { FRS, DES, RAS } }, -{ "stfde", DEO(62,14), DE_MASK, BOOKE64, { FRS, DES, RA0 } }, -{ "stfdue", DEO(62,15), DE_MASK, BOOKE64, { FRS, DES, RAS } }, - -{ "std", DSO(62,0), DS_MASK, PPC64, { RS, DS, RA0 } }, - -{ "stdu", DSO(62,1), DS_MASK, PPC64, { RS, DS, RAS } }, - -{ "stq", DSO(62,2), DS_MASK, POWER4, { RSQ, DS, RA0 } }, - -{ "fcmpu", X(63,0), X_MASK|(3<<21), COM, { BF, FRA, FRB } }, - -{ "daddq", XRC(63,2,0), X_MASK, POWER6, { FRT, FRA, FRB } }, -{ "daddq.", XRC(63,2,1), X_MASK, POWER6, { FRT, FRA, FRB } }, - -{ "dquaq", ZRC(63,3,0), Z2_MASK, POWER6, { FRT, FRA, FRB, RMC } }, -{ "dquaq.", ZRC(63,3,1), Z2_MASK, POWER6, { FRT, FRA, FRB, RMC } }, - -{ "fcpsgn", XRC(63,8,0), X_MASK, POWER6, { FRT, FRA, FRB } }, -{ "fcpsgn.", XRC(63,8,1), X_MASK, POWER6, { FRT, FRA, FRB } }, - -{ "frsp", XRC(63,12,0), XRA_MASK, COM, { FRT, FRB } }, -{ "frsp.", XRC(63,12,1), XRA_MASK, COM, { FRT, FRB } }, - -{ "fctiw", XRC(63,14,0), XRA_MASK, PPCCOM, { FRT, FRB } }, -{ "fcir", XRC(63,14,0), XRA_MASK, POWER2, { FRT, FRB } }, -{ "fctiw.", XRC(63,14,1), XRA_MASK, PPCCOM, { FRT, FRB } }, -{ "fcir.", XRC(63,14,1), XRA_MASK, POWER2, { FRT, FRB } }, - -{ "fctiwz", XRC(63,15,0), XRA_MASK, PPCCOM, { FRT, FRB } }, -{ "fcirz", XRC(63,15,0), XRA_MASK, POWER2, { FRT, FRB } }, -{ "fctiwz.", XRC(63,15,1), XRA_MASK, PPCCOM, { FRT, FRB } }, -{ "fcirz.", XRC(63,15,1), XRA_MASK, POWER2, { FRT, FRB } }, - -{ "fdiv", A(63,18,0), AFRC_MASK, PPCCOM, { FRT, FRA, FRB } }, -{ "fd", A(63,18,0), AFRC_MASK, PWRCOM, { FRT, FRA, FRB } }, -{ "fdiv.", A(63,18,1), AFRC_MASK, PPCCOM, { FRT, FRA, FRB } }, -{ "fd.", A(63,18,1), AFRC_MASK, PWRCOM, { FRT, FRA, FRB } }, - -{ "fsub", A(63,20,0), AFRC_MASK, PPCCOM, { FRT, FRA, FRB } }, -{ "fs", A(63,20,0), AFRC_MASK, PWRCOM, { FRT, FRA, FRB } }, -{ "fsub.", A(63,20,1), AFRC_MASK, PPCCOM, { FRT, FRA, FRB } }, -{ "fs.", A(63,20,1), AFRC_MASK, PWRCOM, { FRT, FRA, FRB } }, - -{ "fadd", A(63,21,0), AFRC_MASK, PPCCOM, { FRT, FRA, FRB } }, -{ "fa", A(63,21,0), AFRC_MASK, PWRCOM, { FRT, FRA, FRB } }, -{ "fadd.", A(63,21,1), AFRC_MASK, PPCCOM, { FRT, FRA, FRB } }, -{ "fa.", A(63,21,1), AFRC_MASK, PWRCOM, { FRT, FRA, FRB } }, - -{ "fsqrt", A(63,22,0), AFRAFRC_MASK, PPCPWR2, { FRT, FRB } }, -{ "fsqrt.", A(63,22,1), AFRAFRC_MASK, PPCPWR2, { FRT, FRB } }, - -{ "fsel", A(63,23,0), A_MASK, PPC, { FRT,FRA,FRC,FRB } }, -{ "fsel.", A(63,23,1), A_MASK, PPC, { FRT,FRA,FRC,FRB } }, - -{ "fre", A(63,24,0), AFRALFRC_MASK, POWER5, { FRT, FRB, A_L } }, -{ "fre.", A(63,24,1), AFRALFRC_MASK, POWER5, { FRT, FRB, A_L } }, - -{ "fmul", A(63,25,0), AFRB_MASK, PPCCOM, { FRT, FRA, FRC } }, -{ "fm", A(63,25,0), AFRB_MASK, PWRCOM, { FRT, FRA, FRC } }, -{ "fmul.", A(63,25,1), AFRB_MASK, PPCCOM, { FRT, FRA, FRC } }, -{ "fm.", A(63,25,1), AFRB_MASK, PWRCOM, { FRT, FRA, FRC } }, - -{ "frsqrte", A(63,26,0), AFRALFRC_MASK, PPC, { FRT, FRB, A_L } }, -{ "frsqrte.",A(63,26,1), AFRALFRC_MASK, PPC, { FRT, FRB, A_L } }, - -{ "fmsub", A(63,28,0), A_MASK, PPCCOM, { FRT,FRA,FRC,FRB } }, -{ "fms", A(63,28,0), A_MASK, PWRCOM, { FRT,FRA,FRC,FRB } }, -{ "fmsub.", A(63,28,1), A_MASK, PPCCOM, { FRT,FRA,FRC,FRB } }, -{ "fms.", A(63,28,1), A_MASK, PWRCOM, { FRT,FRA,FRC,FRB } }, - -{ "fmadd", A(63,29,0), A_MASK, PPCCOM, { FRT,FRA,FRC,FRB } }, -{ "fma", A(63,29,0), A_MASK, PWRCOM, { FRT,FRA,FRC,FRB } }, -{ "fmadd.", A(63,29,1), A_MASK, PPCCOM, { FRT,FRA,FRC,FRB } }, -{ "fma.", A(63,29,1), A_MASK, PWRCOM, { FRT,FRA,FRC,FRB } }, - -{ "fnmsub", A(63,30,0), A_MASK, PPCCOM, { FRT,FRA,FRC,FRB } }, -{ "fnms", A(63,30,0), A_MASK, PWRCOM, { FRT,FRA,FRC,FRB } }, -{ "fnmsub.", A(63,30,1), A_MASK, PPCCOM, { FRT,FRA,FRC,FRB } }, -{ "fnms.", A(63,30,1), A_MASK, PWRCOM, { FRT,FRA,FRC,FRB } }, - -{ "fnmadd", A(63,31,0), A_MASK, PPCCOM, { FRT,FRA,FRC,FRB } }, -{ "fnma", A(63,31,0), A_MASK, PWRCOM, { FRT,FRA,FRC,FRB } }, -{ "fnmadd.", A(63,31,1), A_MASK, PPCCOM, { FRT,FRA,FRC,FRB } }, -{ "fnma.", A(63,31,1), A_MASK, PWRCOM, { FRT,FRA,FRC,FRB } }, - -{ "fcmpo", X(63,32), X_MASK|(3<<21), COM, { BF, FRA, FRB } }, - -{ "dmulq", XRC(63,34,0), X_MASK, POWER6, { FRT, FRA, FRB } }, -{ "dmulq.", XRC(63,34,1), X_MASK, POWER6, { FRT, FRA, FRB } }, - -{ "drrndq", ZRC(63,35,0), Z2_MASK, POWER6, { FRT, FRA, FRB, RMC } }, -{ "drrndq.", ZRC(63,35,1), Z2_MASK, POWER6, { FRT, FRA, FRB, RMC } }, - -{ "mtfsb1", XRC(63,38,0), XRARB_MASK, COM, { BT } }, -{ "mtfsb1.", XRC(63,38,1), XRARB_MASK, COM, { BT } }, - -{ "fneg", XRC(63,40,0), XRA_MASK, COM, { FRT, FRB } }, -{ "fneg.", XRC(63,40,1), XRA_MASK, COM, { FRT, FRB } }, - -{ "mcrfs", X(63,64), XRB_MASK|(3<<21)|(3<<16), COM, { BF, BFA } }, - -{ "dscliq", ZRC(63,66,0), Z_MASK, POWER6, { FRT, FRA, SH16 } }, -{ "dscliq.", ZRC(63,66,1), Z_MASK, POWER6, { FRT, FRA, SH16 } }, - -{ "dquaiq", ZRC(63,67,0), Z2_MASK, POWER6, { TE, FRT, FRB, RMC } }, -{ "dquaiq.", ZRC(63,67,1), Z2_MASK, POWER6, { FRT, FRA, FRB, RMC } }, - -{ "mtfsb0", XRC(63,70,0), XRARB_MASK, COM, { BT } }, -{ "mtfsb0.", XRC(63,70,1), XRARB_MASK, COM, { BT } }, - -{ "fmr", XRC(63,72,0), XRA_MASK, COM, { FRT, FRB } }, -{ "fmr.", XRC(63,72,1), XRA_MASK, COM, { FRT, FRB } }, - -{ "dscriq", ZRC(63,98,0), Z_MASK, POWER6, { FRT, FRA, SH16 } }, -{ "dscriq.", ZRC(63,98,1), Z_MASK, POWER6, { FRT, FRA, SH16 } }, - -{ "drintxq", ZRC(63,99,0), Z2_MASK, POWER6, { R, FRT, FRB, RMC } }, -{ "drintxq.",ZRC(63,99,1), Z2_MASK, POWER6, { R, FRT, FRB, RMC } }, - -{ "dcmpoq", X(63,130), X_MASK, POWER6, { BF, FRA, FRB } }, - -{ "mtfsfi", XRC(63,134,0), XWRA_MASK|(3<<21)|(1<<11), COM, { BFF, U, W } }, -{ "mtfsfi.", XRC(63,134,1), XWRA_MASK|(3<<21)|(1<<11), COM, { BFF, U, W } }, - -{ "fnabs", XRC(63,136,0), XRA_MASK, COM, { FRT, FRB } }, -{ "fnabs.", XRC(63,136,1), XRA_MASK, COM, { FRT, FRB } }, - -{ "dtstexq", X(63,162), X_MASK, POWER6, { BF, FRA, FRB } }, -{ "dtstdcq", Z(63,194), Z_MASK, POWER6, { BF, FRA, DCM } }, -{ "dtstdgq", Z(63,226), Z_MASK, POWER6, { BF, FRA, DGM } }, - -{ "drintnq", ZRC(63,227,0), Z2_MASK, POWER6, { R, FRT, FRB, RMC } }, -{ "drintnq.",ZRC(63,227,1), Z2_MASK, POWER6, { R, FRT, FRB, RMC } }, - -{ "dctqpq", XRC(63,258,0), X_MASK, POWER6, { FRT, FRB } }, -{ "dctqpq.", XRC(63,258,1), X_MASK, POWER6, { FRT, FRB } }, - -{ "fabs", XRC(63,264,0), XRA_MASK, COM, { FRT, FRB } }, -{ "fabs.", XRC(63,264,1), XRA_MASK, COM, { FRT, FRB } }, - -{ "dctfixq", XRC(63,290,0), X_MASK, POWER6, { FRT, FRB } }, -{ "dctfixq.",XRC(63,290,1), X_MASK, POWER6, { FRT, FRB } }, - -{ "ddedpdq", XRC(63,322,0), X_MASK, POWER6, { SP, FRT, FRB } }, -{ "ddedpdq.",XRC(63,322,1), X_MASK, POWER6, { SP, FRT, FRB } }, - -{ "dxexq", XRC(63,354,0), X_MASK, POWER6, { FRT, FRB } }, -{ "dxexq.", XRC(63,354,1), X_MASK, POWER6, { FRT, FRB } }, - -{ "frin", XRC(63,392,0), XRA_MASK, POWER5, { FRT, FRB } }, -{ "frin.", XRC(63,392,1), XRA_MASK, POWER5, { FRT, FRB } }, -{ "friz", XRC(63,424,0), XRA_MASK, POWER5, { FRT, FRB } }, -{ "friz.", XRC(63,424,1), XRA_MASK, POWER5, { FRT, FRB } }, -{ "frip", XRC(63,456,0), XRA_MASK, POWER5, { FRT, FRB } }, -{ "frip.", XRC(63,456,1), XRA_MASK, POWER5, { FRT, FRB } }, -{ "frim", XRC(63,488,0), XRA_MASK, POWER5, { FRT, FRB } }, -{ "frim.", XRC(63,488,1), XRA_MASK, POWER5, { FRT, FRB } }, - -{ "dsubq", XRC(63,514,0), X_MASK, POWER6, { FRT, FRA, FRB } }, -{ "dsubq.", XRC(63,514,1), X_MASK, POWER6, { FRT, FRA, FRB } }, - -{ "ddivq", XRC(63,546,0), X_MASK, POWER6, { FRT, FRA, FRB } }, -{ "ddivq.", XRC(63,546,1), X_MASK, POWER6, { FRT, FRA, FRB } }, - -{ "mffs", XRC(63,583,0), XRARB_MASK, COM, { FRT } }, -{ "mffs.", XRC(63,583,1), XRARB_MASK, COM, { FRT } }, - -{ "dcmpuq", X(63,642), X_MASK, POWER6, { BF, FRA, FRB } }, - -{ "dtstsfq", X(63,674), X_MASK, POWER6, { BF, FRA, FRB } }, - -{ "mtfsf", XFL(63,711,0), XFL_MASK, COM, { FLM, FRB, XFL_L, W } }, -{ "mtfsf.", XFL(63,711,1), XFL_MASK, COM, { FLM, FRB, XFL_L, W } }, - -{ "drdpq", XRC(63,770,0), X_MASK, POWER6, { FRT, FRB } }, -{ "drdpq.", XRC(63,770,1), X_MASK, POWER6, { FRT, FRB } }, - -{ "dcffixq", XRC(63,802,0), X_MASK, POWER6, { FRT, FRB } }, -{ "dcffixq.",XRC(63,802,1), X_MASK, POWER6, { FRT, FRB } }, - -{ "fctid", XRC(63,814,0), XRA_MASK, PPC64, { FRT, FRB } }, -{ "fctid.", XRC(63,814,1), XRA_MASK, PPC64, { FRT, FRB } }, - -{ "fctidz", XRC(63,815,0), XRA_MASK, PPC64, { FRT, FRB } }, -{ "fctidz.", XRC(63,815,1), XRA_MASK, PPC64, { FRT, FRB } }, - -{ "denbcdq", XRC(63,834,0), X_MASK, POWER6, { S, FRT, FRB } }, -{ "denbcdq.",XRC(63,834,1), X_MASK, POWER6, { S, FRT, FRB } }, - -{ "fcfid", XRC(63,846,0), XRA_MASK, PPC64, { FRT, FRB } }, -{ "fcfid.", XRC(63,846,1), XRA_MASK, PPC64, { FRT, FRB } }, - -{ "diexq", XRC(63,866,0), X_MASK, POWER6, { FRT, FRA, FRB } }, -{ "diexq.", XRC(63,866,1), X_MASK, POWER6, { FRT, FRA, FRB } }, - -}; - -const int powerpc_num_opcodes = - sizeof (powerpc_opcodes) / sizeof (powerpc_opcodes[0]); - -/* The macro table. This is only used by the assembler. */ - -/* The expressions of the form (-x ! 31) & (x | 31) have the value 0 - when x=0; 32-x when x is between 1 and 31; are negative if x is - negative; and are 32 or more otherwise. This is what you want - when, for instance, you are emulating a right shift by a - rotate-left-and-mask, because the underlying instructions support - shifts of size 0 but not shifts of size 32. By comparison, when - extracting x bits from some word you want to use just 32-x, because - the underlying instructions don't support extracting 0 bits but do - support extracting the whole word (32 bits in this case). */ - -const struct powerpc_macro powerpc_macros[] = { -{ "extldi", 4, PPC64, "rldicr %0,%1,%3,(%2)-1" }, -{ "extldi.", 4, PPC64, "rldicr. %0,%1,%3,(%2)-1" }, -{ "extrdi", 4, PPC64, "rldicl %0,%1,(%2)+(%3),64-(%2)" }, -{ "extrdi.", 4, PPC64, "rldicl. %0,%1,(%2)+(%3),64-(%2)" }, -{ "insrdi", 4, PPC64, "rldimi %0,%1,64-((%2)+(%3)),%3" }, -{ "insrdi.", 4, PPC64, "rldimi. %0,%1,64-((%2)+(%3)),%3" }, -{ "rotrdi", 3, PPC64, "rldicl %0,%1,(-(%2)!63)&((%2)|63),0" }, -{ "rotrdi.", 3, PPC64, "rldicl. %0,%1,(-(%2)!63)&((%2)|63),0" }, -{ "sldi", 3, PPC64, "rldicr %0,%1,%2,63-(%2)" }, -{ "sldi.", 3, PPC64, "rldicr. %0,%1,%2,63-(%2)" }, -{ "srdi", 3, PPC64, "rldicl %0,%1,(-(%2)!63)&((%2)|63),%2" }, -{ "srdi.", 3, PPC64, "rldicl. %0,%1,(-(%2)!63)&((%2)|63),%2" }, -{ "clrrdi", 3, PPC64, "rldicr %0,%1,0,63-(%2)" }, -{ "clrrdi.", 3, PPC64, "rldicr. %0,%1,0,63-(%2)" }, -{ "clrlsldi",4, PPC64, "rldic %0,%1,%3,(%2)-(%3)" }, -{ "clrlsldi.",4, PPC64, "rldic. %0,%1,%3,(%2)-(%3)" }, - -{ "extlwi", 4, PPCCOM, "rlwinm %0,%1,%3,0,(%2)-1" }, -{ "extlwi.", 4, PPCCOM, "rlwinm. %0,%1,%3,0,(%2)-1" }, -{ "extrwi", 4, PPCCOM, "rlwinm %0,%1,((%2)+(%3))&((%2)+(%3)<>32),32-(%2),31" }, -{ "extrwi.", 4, PPCCOM, "rlwinm. %0,%1,((%2)+(%3))&((%2)+(%3)<>32),32-(%2),31" }, -{ "inslwi", 4, PPCCOM, "rlwimi %0,%1,(-(%3)!31)&((%3)|31),%3,(%2)+(%3)-1" }, -{ "inslwi.", 4, PPCCOM, "rlwimi. %0,%1,(-(%3)!31)&((%3)|31),%3,(%2)+(%3)-1"}, -{ "insrwi", 4, PPCCOM, "rlwimi %0,%1,32-((%2)+(%3)),%3,(%2)+(%3)-1" }, -{ "insrwi.", 4, PPCCOM, "rlwimi. %0,%1,32-((%2)+(%3)),%3,(%2)+(%3)-1"}, -{ "rotrwi", 3, PPCCOM, "rlwinm %0,%1,(-(%2)!31)&((%2)|31),0,31" }, -{ "rotrwi.", 3, PPCCOM, "rlwinm. %0,%1,(-(%2)!31)&((%2)|31),0,31" }, -{ "slwi", 3, PPCCOM, "rlwinm %0,%1,%2,0,31-(%2)" }, -{ "sli", 3, PWRCOM, "rlinm %0,%1,%2,0,31-(%2)" }, -{ "slwi.", 3, PPCCOM, "rlwinm. %0,%1,%2,0,31-(%2)" }, -{ "sli.", 3, PWRCOM, "rlinm. %0,%1,%2,0,31-(%2)" }, -{ "srwi", 3, PPCCOM, "rlwinm %0,%1,(-(%2)!31)&((%2)|31),%2,31" }, -{ "sri", 3, PWRCOM, "rlinm %0,%1,(-(%2)!31)&((%2)|31),%2,31" }, -{ "srwi.", 3, PPCCOM, "rlwinm. %0,%1,(-(%2)!31)&((%2)|31),%2,31" }, -{ "sri.", 3, PWRCOM, "rlinm. %0,%1,(-(%2)!31)&((%2)|31),%2,31" }, -{ "clrrwi", 3, PPCCOM, "rlwinm %0,%1,0,0,31-(%2)" }, -{ "clrrwi.", 3, PPCCOM, "rlwinm. %0,%1,0,0,31-(%2)" }, -{ "clrlslwi",4, PPCCOM, "rlwinm %0,%1,%3,(%2)-(%3),31-(%3)" }, -{ "clrlslwi.",4, PPCCOM, "rlwinm. %0,%1,%3,(%2)-(%3),31-(%3)" }, -}; - -const int powerpc_num_macros = - sizeof (powerpc_macros) / sizeof (powerpc_macros[0]); - - -/* This file provides several disassembler functions, all of which use - the disassembler interface defined in dis-asm.h. Several functions - are provided because this file handles disassembly for the PowerPC - in both big and little endian mode and also for the POWER (RS/6000) - chip. */ - -static int print_insn_powerpc (bfd_vma, struct disassemble_info *, int, int); - -/* Determine which set of machines to disassemble for. PPC403/601 or - BookE. For convenience, also disassemble instructions supported - by the AltiVec vector unit. */ - -static int -powerpc_dialect (struct disassemble_info *info) -{ - int dialect = PPC_OPCODE_PPC; - - if (BFD_DEFAULT_TARGET_SIZE == 64) - dialect |= PPC_OPCODE_64; - - if (info->disassembler_options - && strstr (info->disassembler_options, "booke") != NULL) - dialect |= PPC_OPCODE_BOOKE | PPC_OPCODE_BOOKE64; - else if ((info->mach == bfd_mach_ppc_e500) - || (info->disassembler_options - && strstr (info->disassembler_options, "e500") != NULL)) - dialect |= (PPC_OPCODE_BOOKE - | PPC_OPCODE_SPE | PPC_OPCODE_ISEL - | PPC_OPCODE_EFS | PPC_OPCODE_BRLOCK - | PPC_OPCODE_PMR | PPC_OPCODE_CACHELCK - | PPC_OPCODE_RFMCI); - else if (info->disassembler_options - && strstr (info->disassembler_options, "efs") != NULL) - dialect |= PPC_OPCODE_EFS; - else if (info->disassembler_options - && strstr (info->disassembler_options, "e300") != NULL) - dialect |= PPC_OPCODE_E300 | PPC_OPCODE_CLASSIC | PPC_OPCODE_COMMON; - else if (info->disassembler_options - && strstr (info->disassembler_options, "440") != NULL) - dialect |= PPC_OPCODE_BOOKE | PPC_OPCODE_32 - | PPC_OPCODE_440 | PPC_OPCODE_ISEL | PPC_OPCODE_RFMCI; - else - dialect |= (PPC_OPCODE_403 | PPC_OPCODE_601 | PPC_OPCODE_CLASSIC - | PPC_OPCODE_COMMON | PPC_OPCODE_ALTIVEC); - - if (info->disassembler_options - && strstr (info->disassembler_options, "power4") != NULL) - dialect |= PPC_OPCODE_POWER4; - - if (info->disassembler_options - && strstr (info->disassembler_options, "power5") != NULL) - dialect |= PPC_OPCODE_POWER4 | PPC_OPCODE_POWER5; - - if (info->disassembler_options - && strstr (info->disassembler_options, "cell") != NULL) - dialect |= PPC_OPCODE_POWER4 | PPC_OPCODE_CELL | PPC_OPCODE_ALTIVEC; - - if (info->disassembler_options - && strstr (info->disassembler_options, "power6") != NULL) - dialect |= PPC_OPCODE_POWER4 | PPC_OPCODE_POWER5 | PPC_OPCODE_POWER6 | PPC_OPCODE_ALTIVEC; - - if (info->disassembler_options - && strstr (info->disassembler_options, "any") != NULL) - dialect |= PPC_OPCODE_ANY; - - if (info->disassembler_options) - { - if (strstr (info->disassembler_options, "32") != NULL) - dialect &= ~PPC_OPCODE_64; - else if (strstr (info->disassembler_options, "64") != NULL) - dialect |= PPC_OPCODE_64; - } - - info->private_data = (char *) 0 + dialect; - return dialect; -} - -/* Qemu default */ -int -print_insn_ppc (bfd_vma memaddr, struct disassemble_info *info) -{ - int dialect = (char *) info->private_data - (char *) 0; - return print_insn_powerpc (memaddr, info, 1, dialect); -} - -/* Print a big endian PowerPC instruction. */ - -int -print_insn_big_powerpc (bfd_vma memaddr, struct disassemble_info *info) -{ - int dialect = (char *) info->private_data - (char *) 0; - return print_insn_powerpc (memaddr, info, 1, dialect); -} - -/* Print a little endian PowerPC instruction. */ - -int -print_insn_little_powerpc (bfd_vma memaddr, struct disassemble_info *info) -{ - int dialect = (char *) info->private_data - (char *) 0; - return print_insn_powerpc (memaddr, info, 0, dialect); -} - -/* Print a POWER (RS/6000) instruction. */ - -int -print_insn_rs6000 (bfd_vma memaddr, struct disassemble_info *info) -{ - return print_insn_powerpc (memaddr, info, 1, PPC_OPCODE_POWER); -} - -/* Extract the operand value from the PowerPC or POWER instruction. */ - -static long -operand_value_powerpc (const struct powerpc_operand *operand, - unsigned long insn, int dialect) -{ - long value; - int invalid; - /* Extract the value from the instruction. */ - if (operand->extract) - value = (*operand->extract) (insn, dialect, &invalid); - else - { - value = (insn >> operand->shift) & operand->bitm; - if ((operand->flags & PPC_OPERAND_SIGNED) != 0) - { - /* BITM is always some number of zeros followed by some - number of ones, followed by some numer of zeros. */ - unsigned long top = operand->bitm; - /* top & -top gives the rightmost 1 bit, so this - fills in any trailing zeros. */ - top |= (top & -top) - 1; - top &= ~(top >> 1); - value = (value ^ top) - top; - } - } - - return value; -} - -/* Determine whether the optional operand(s) should be printed. */ - -static int -skip_optional_operands (const unsigned char *opindex, - unsigned long insn, int dialect) -{ - const struct powerpc_operand *operand; - - for (; *opindex != 0; opindex++) - { - operand = &powerpc_operands[*opindex]; - if ((operand->flags & PPC_OPERAND_NEXT) != 0 - || ((operand->flags & PPC_OPERAND_OPTIONAL) != 0 - && operand_value_powerpc (operand, insn, dialect) != 0)) - return 0; - } - - return 1; -} - -bfd_vma bfd_getl32 (const bfd_byte *addr) -{ - unsigned long v; - - v = (unsigned long) addr[0]; - v |= (unsigned long) addr[1] << 8; - v |= (unsigned long) addr[2] << 16; - v |= (unsigned long) addr[3] << 24; - return (bfd_vma) v; -} - -bfd_vma bfd_getb32 (const bfd_byte *addr) -{ - unsigned long v; - - v = (unsigned long) addr[0] << 24; - v |= (unsigned long) addr[1] << 16; - v |= (unsigned long) addr[2] << 8; - v |= (unsigned long) addr[3]; - return (bfd_vma) v; -} - -/* Get LENGTH bytes from info's buffer, at target address memaddr. - Transfer them to myaddr. */ -int -buffer_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length, - struct disassemble_info *info) -{ - if (memaddr < info->buffer_vma - || memaddr + length > info->buffer_vma + info->buffer_length) - /* Out of bounds. Use EIO because GDB uses it. */ - return EIO; - memcpy (myaddr, info->buffer + (memaddr - info->buffer_vma), length); - return 0; -} - -/* Print an error message. We can assume that this is in response to - an error return from buffer_read_memory. */ -void -perror_memory (int status, bfd_vma memaddr, struct disassemble_info *info) -{ - if (status != EIO) - /* Can't happen. */ - (*info->fprintf_func) (info->stream, "Unknown error %d\n", status); - else - /* Actually, address between memaddr and memaddr + len was - out of bounds. */ - (*info->fprintf_func) (info->stream, - "Address 0x%" PRIx64 " is out of bounds.\n", memaddr); -} - -/* This could be in a separate file, to save miniscule amounts of space - in statically linked executables. */ - -/* Just print the address is hex. This is included for completeness even - though both GDB and objdump provide their own (to print symbolic - addresses). */ - -void -generic_print_address (bfd_vma addr, struct disassemble_info *info) -{ - (*info->fprintf_func) (info->stream, "0x%" PRIx64, addr); -} - -/* Just return the given address. */ - -int -generic_symbol_at_address (bfd_vma addr, struct disassemble_info *info) -{ - return 1; -} - -/* Print a PowerPC or POWER instruction. */ - -static int -print_insn_powerpc (bfd_vma memaddr, - struct disassemble_info *info, - int bigendian, - int dialect) -{ - bfd_byte buffer[4]; - int status; - unsigned long insn; - const struct powerpc_opcode *opcode; - const struct powerpc_opcode *opcode_end; - unsigned long op; - - if (dialect == 0) - dialect = powerpc_dialect (info); - - status = (*info->read_memory_func) (memaddr, buffer, 4, info); - if (status != 0) - { - (*info->memory_error_func) (status, memaddr, info); - return -1; - } - - if (bigendian) - insn = bfd_getb32 (buffer); - else - insn = bfd_getl32 (buffer); - - /* Get the major opcode of the instruction. */ - op = PPC_OP (insn); - - /* Find the first match in the opcode table. We could speed this up - a bit by doing a binary search on the major opcode. */ - opcode_end = powerpc_opcodes + powerpc_num_opcodes; - again: - for (opcode = powerpc_opcodes; opcode < opcode_end; opcode++) - { - unsigned long table_op; - const unsigned char *opindex; - const struct powerpc_operand *operand; - int invalid; - int need_comma; - int need_paren; - int skip_optional; - - table_op = PPC_OP (opcode->opcode); - if (op < table_op) - break; - if (op > table_op) - continue; - - if ((insn & opcode->mask) != opcode->opcode - || (opcode->flags & dialect) == 0) - continue; - - /* Make two passes over the operands. First see if any of them - have extraction functions, and, if they do, make sure the - instruction is valid. */ - invalid = 0; - for (opindex = opcode->operands; *opindex != 0; opindex++) - { - operand = powerpc_operands + *opindex; - if (operand->extract) - (*operand->extract) (insn, dialect, &invalid); - } - if (invalid) - continue; - - /* The instruction is valid. */ - if (opcode->operands[0] != 0) - (*info->fprintf_func) (info->stream, "%-7s ", opcode->name); - else - (*info->fprintf_func) (info->stream, "%s", opcode->name); - - /* Now extract and print the operands. */ - need_comma = 0; - need_paren = 0; - skip_optional = -1; - for (opindex = opcode->operands; *opindex != 0; opindex++) - { - long value; - - operand = powerpc_operands + *opindex; - - /* Operands that are marked FAKE are simply ignored. We - already made sure that the extract function considered - the instruction to be valid. */ - if ((operand->flags & PPC_OPERAND_FAKE) != 0) - continue; - - /* If all of the optional operands have the value zero, - then don't print any of them. */ - if ((operand->flags & PPC_OPERAND_OPTIONAL) != 0) - { - if (skip_optional < 0) - skip_optional = skip_optional_operands (opindex, insn, - dialect); - if (skip_optional) - continue; - } - - value = operand_value_powerpc (operand, insn, dialect); - - if (need_comma) - { - (*info->fprintf_func) (info->stream, ","); - need_comma = 0; - } - - /* Print the operand as directed by the flags. */ - if ((operand->flags & PPC_OPERAND_GPR) != 0 - || ((operand->flags & PPC_OPERAND_GPR_0) != 0 && value != 0)) - (*info->fprintf_func) (info->stream, "r%ld", value); - else if ((operand->flags & PPC_OPERAND_FPR) != 0) - (*info->fprintf_func) (info->stream, "f%ld", value); - else if ((operand->flags & PPC_OPERAND_VR) != 0) - (*info->fprintf_func) (info->stream, "v%ld", value); - else if ((operand->flags & PPC_OPERAND_RELATIVE) != 0) - (*info->print_address_func) (memaddr + value, info); - else if ((operand->flags & PPC_OPERAND_ABSOLUTE) != 0) - (*info->print_address_func) ((bfd_vma) value & 0xffffffff, info); - else if ((operand->flags & PPC_OPERAND_CR) == 0 - || (dialect & PPC_OPCODE_PPC) == 0) - (*info->fprintf_func) (info->stream, "%ld", value); - else - { - if (operand->bitm == 7) - (*info->fprintf_func) (info->stream, "cr%ld", value); - else - { - static const char *cbnames[4] = { "lt", "gt", "eq", "so" }; - int cr; - int cc; - - cr = value >> 2; - if (cr != 0) - (*info->fprintf_func) (info->stream, "4*cr%d+", cr); - cc = value & 3; - (*info->fprintf_func) (info->stream, "%s", cbnames[cc]); - } - } - - if (need_paren) - { - (*info->fprintf_func) (info->stream, ")"); - need_paren = 0; - } - - if ((operand->flags & PPC_OPERAND_PARENS) == 0) - need_comma = 1; - else - { - (*info->fprintf_func) (info->stream, "("); - need_paren = 1; - } - } - - /* We have found and printed an instruction; return. */ - return 4; - } - - if ((dialect & PPC_OPCODE_ANY) != 0) - { - dialect = ~PPC_OPCODE_ANY; - goto again; - } - - /* We could not find a match. */ - (*info->fprintf_func) (info->stream, ".long 0x%lx", insn); - - return 4; -} diff --git a/SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp b/SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp deleted file mode 100644 index 7d6a599c..00000000 --- a/SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp +++ /dev/null @@ -1,1235 +0,0 @@ -/* - * sheepshaver_glue.cpp - Glue Kheperix CPU to SheepShaver CPU engine interface - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" -#include "cpu_emulation.h" -#include "main.h" -#include "prefs.h" -#include "xlowmem.h" -#include "emul_op.h" -#include "rom_patches.h" -#include "macos_util.h" -#include "block-alloc.hpp" -#include "sigsegv.h" -#include "cpu/ppc/ppc-cpu.hpp" -#include "cpu/ppc/ppc-operations.hpp" -#include "cpu/ppc/ppc-instructions.hpp" -#include "thunks.h" - -// Used for NativeOp trampolines -#include "video.h" -#include "name_registry.h" -#include "serial.h" -#include "ether.h" -#include "timer.h" - -#include -#include -#ifdef HAVE_MALLOC_H -#include -#endif - -#ifdef USE_SDL_VIDEO -#include -#endif - -#if ENABLE_MON -#include "mon.h" -#include "mon_disass.h" -#endif - -#define DEBUG 0 -#include "debug.h" - -extern "C" { -#include "dis-asm.h" -} - -// Emulation time statistics -#ifndef EMUL_TIME_STATS -#define EMUL_TIME_STATS 0 -#endif - -#if EMUL_TIME_STATS -static clock_t emul_start_time; -static uint32 interrupt_count = 0, ppc_interrupt_count = 0; -static clock_t interrupt_time = 0; -static uint32 exec68k_count = 0; -static clock_t exec68k_time = 0; -static uint32 native_exec_count = 0; -static clock_t native_exec_time = 0; -static uint32 macos_exec_count = 0; -static clock_t macos_exec_time = 0; -#endif - -static void enter_mon(void) -{ - // Start up mon in real-mode -#if ENABLE_MON - char *arg[4] = {"mon", "-m", "-r", NULL}; - mon(3, arg); -#endif -} - -// From main_*.cpp -extern uintptr SignalStackBase(); - -// From rsrc_patches.cpp -extern "C" void check_load_invoc(uint32 type, int16 id, uint32 h); -extern "C" void named_check_load_invoc(uint32 type, uint32 name, uint32 h); - -// PowerPC EmulOp to exit from emulation looop -const uint32 POWERPC_EXEC_RETURN = POWERPC_EMUL_OP | 1; - -// Enable Execute68k() safety checks? -#define SAFE_EXEC_68K 1 - -// Save FP state in Execute68k()? -#define SAVE_FP_EXEC_68K 1 - -// Interrupts in EMUL_OP mode? -#define INTERRUPTS_IN_EMUL_OP_MODE 1 - -// Interrupts in native mode? -#define INTERRUPTS_IN_NATIVE_MODE 1 - -// Pointer to Kernel Data -static KernelData * kernel_data; - -// SIGSEGV handler -sigsegv_return_t sigsegv_handler(sigsegv_address_t, sigsegv_address_t); - -#if PPC_ENABLE_JIT && PPC_REENTRANT_JIT -// Special trampolines for EmulOp and NativeOp -static uint8 *emul_op_trampoline; -static uint8 *native_op_trampoline; -#endif - - -/** - * PowerPC emulator glue with special 'sheep' opcodes - **/ - -enum { - PPC_I(SHEEP) = PPC_I(MAX), - PPC_I(SHEEP_MAX) -}; - -class sheepshaver_cpu - : public powerpc_cpu -{ - void init_decoder(); - void execute_sheep(uint32 opcode); - -public: - - // Constructor - sheepshaver_cpu(); - - // CR & XER accessors - uint32 get_cr() const { return cr().get(); } - void set_cr(uint32 v) { cr().set(v); } - uint32 get_xer() const { return xer().get(); } - void set_xer(uint32 v) { xer().set(v); } - - // Execute NATIVE_OP routine - void execute_native_op(uint32 native_op); - - // Execute EMUL_OP routine - void execute_emul_op(uint32 emul_op); - - // Execute 68k routine - void execute_68k(uint32 entry, M68kRegisters *r); - - // Execute ppc routine - void execute_ppc(uint32 entry); - - // Execute MacOS/PPC code - uint32 execute_macos_code(uint32 tvect, int nargs, uint32 const *args); - -#if PPC_ENABLE_JIT - // Compile one instruction - virtual int compile1(codegen_context_t & cg_context); -#endif - // Resource manager thunk - void get_resource(uint32 old_get_resource); - - // Handle MacOS interrupt - void interrupt(uint32 entry); - - // Make sure the SIGSEGV handler can access CPU registers - friend sigsegv_return_t sigsegv_handler(sigsegv_info_t *sip); -}; - -sheepshaver_cpu::sheepshaver_cpu() -{ - init_decoder(); - -#if PPC_ENABLE_JIT - if (PrefsFindBool("jit")) - enable_jit(); -#endif -} - -void sheepshaver_cpu::init_decoder() -{ - static const instr_info_t sheep_ii_table[] = { - { "sheep", - (execute_pmf)&sheepshaver_cpu::execute_sheep, - PPC_I(SHEEP), - D_form, 6, 0, CFLOW_JUMP | CFLOW_TRAP - } - }; - - const int ii_count = sizeof(sheep_ii_table)/sizeof(sheep_ii_table[0]); - D(bug("SheepShaver extra decode table has %d entries\n", ii_count)); - - for (int i = 0; i < ii_count; i++) { - const instr_info_t * ii = &sheep_ii_table[i]; - init_decoder_entry(ii); - } -} - -/* NativeOp instruction format: - +------------+-------------------------+--+-----------+------------+ - | 6 | |FN| OP | 2 | - +------------+-------------------------+--+-----------+------------+ - 0 5 |6 18 19 20 25 26 31 -*/ - -typedef bit_field< 19, 19 > FN_field; -typedef bit_field< 20, 25 > NATIVE_OP_field; -typedef bit_field< 26, 31 > EMUL_OP_field; - -// Execute EMUL_OP routine -void sheepshaver_cpu::execute_emul_op(uint32 emul_op) -{ - M68kRegisters r68; - WriteMacInt32(XLM_68K_R25, gpr(25)); - WriteMacInt32(XLM_RUN_MODE, MODE_EMUL_OP); - for (int i = 0; i < 8; i++) - r68.d[i] = gpr(8 + i); - for (int i = 0; i < 7; i++) - r68.a[i] = gpr(16 + i); - r68.a[7] = gpr(1); - uint32 saved_cr = get_cr() & 0xff9fffff; // mask_operand::compute(11, 8) - uint32 saved_xer = get_xer(); - EmulOp(&r68, gpr(24), emul_op); - set_cr(saved_cr); - set_xer(saved_xer); - for (int i = 0; i < 8; i++) - gpr(8 + i) = r68.d[i]; - for (int i = 0; i < 7; i++) - gpr(16 + i) = r68.a[i]; - gpr(1) = r68.a[7]; - WriteMacInt32(XLM_RUN_MODE, MODE_68K); -} - -// Execute SheepShaver instruction -void sheepshaver_cpu::execute_sheep(uint32 opcode) -{ -// D(bug("Extended opcode %08x at %08x (68k pc %08x)\n", opcode, pc(), gpr(24))); - assert((((opcode >> 26) & 0x3f) == 6) && OP_MAX <= 64 + 3); - - switch (opcode & 0x3f) { - case 0: // EMUL_RETURN - QuitEmulator(); - break; - - case 1: // EXEC_RETURN - spcflags().set(SPCFLAG_CPU_EXEC_RETURN); - break; - - case 2: // EXEC_NATIVE - execute_native_op(NATIVE_OP_field::extract(opcode)); - if (FN_field::test(opcode)) - pc() = lr(); - else - pc() += 4; - break; - - default: // EMUL_OP - execute_emul_op(EMUL_OP_field::extract(opcode) - 3); - pc() += 4; - break; - } -} - -// Compile one instruction -#if PPC_ENABLE_JIT -int sheepshaver_cpu::compile1(codegen_context_t & cg_context) -{ - const instr_info_t *ii = cg_context.instr_info; - if (ii->mnemo != PPC_I(SHEEP)) - return COMPILE_FAILURE; - - int status = COMPILE_FAILURE; - powerpc_dyngen & dg = cg_context.codegen; - uint32 opcode = cg_context.opcode; - - switch (opcode & 0x3f) { - case 0: // EMUL_RETURN - dg.gen_invoke(QuitEmulator); - status = COMPILE_CODE_OK; - break; - - case 1: // EXEC_RETURN - dg.gen_spcflags_set(SPCFLAG_CPU_EXEC_RETURN); - // Don't check for pending interrupts, we do know we have to - // get out of this block ASAP - dg.gen_exec_return(); - status = COMPILE_EPILOGUE_OK; - break; - - case 2: { // EXEC_NATIVE - uint32 selector = NATIVE_OP_field::extract(opcode); - switch (selector) { -#if !PPC_REENTRANT_JIT - // Filter out functions that may invoke Execute68k() or - // CallMacOS(), this would break reentrancy as they could - // invalidate the translation cache and even overwrite - // continuation code when we are done with them. - case NATIVE_PATCH_NAME_REGISTRY: - dg.gen_invoke(DoPatchNameRegistry); - status = COMPILE_CODE_OK; - break; - case NATIVE_VIDEO_INSTALL_ACCEL: - dg.gen_invoke(VideoInstallAccel); - status = COMPILE_CODE_OK; - break; - case NATIVE_VIDEO_VBL: - dg.gen_invoke(VideoVBL); - status = COMPILE_CODE_OK; - break; - case NATIVE_GET_RESOURCE: - case NATIVE_GET_1_RESOURCE: - case NATIVE_GET_IND_RESOURCE: - case NATIVE_GET_1_IND_RESOURCE: - case NATIVE_R_GET_RESOURCE: { - static const uint32 get_resource_ptr[] = { - XLM_GET_RESOURCE, - XLM_GET_1_RESOURCE, - XLM_GET_IND_RESOURCE, - XLM_GET_1_IND_RESOURCE, - XLM_R_GET_RESOURCE - }; - uint32 old_get_resource = ReadMacInt32(get_resource_ptr[selector - NATIVE_GET_RESOURCE]); - typedef void (*func_t)(dyngen_cpu_base, uint32); - func_t func = (func_t)nv_mem_fun(&sheepshaver_cpu::get_resource).ptr(); - dg.gen_invoke_CPU_im(func, old_get_resource); - status = COMPILE_CODE_OK; - break; - } -#endif - case NATIVE_CHECK_LOAD_INVOC: - dg.gen_load_T0_GPR(3); - dg.gen_load_T1_GPR(4); - dg.gen_se_16_32_T1(); - dg.gen_load_T2_GPR(5); - dg.gen_invoke_T0_T1_T2((void (*)(uint32, uint32, uint32))check_load_invoc); - status = COMPILE_CODE_OK; - break; - case NATIVE_NAMED_CHECK_LOAD_INVOC: - dg.gen_load_T0_GPR(3); - dg.gen_load_T1_GPR(4); - dg.gen_load_T2_GPR(5); - dg.gen_invoke_T0_T1_T2((void (*)(uint32, uint32, uint32))named_check_load_invoc); - status = COMPILE_CODE_OK; - break; - case NATIVE_NQD_SYNC_HOOK: - dg.gen_load_T0_GPR(3); - dg.gen_invoke_T0_ret_T0((uint32 (*)(uint32))NQD_sync_hook); - dg.gen_store_T0_GPR(3); - status = COMPILE_CODE_OK; - break; - case NATIVE_NQD_BITBLT_HOOK: - dg.gen_load_T0_GPR(3); - dg.gen_invoke_T0_ret_T0((uint32 (*)(uint32))NQD_bitblt_hook); - dg.gen_store_T0_GPR(3); - status = COMPILE_CODE_OK; - break; - case NATIVE_NQD_FILLRECT_HOOK: - dg.gen_load_T0_GPR(3); - dg.gen_invoke_T0_ret_T0((uint32 (*)(uint32))NQD_fillrect_hook); - dg.gen_store_T0_GPR(3); - status = COMPILE_CODE_OK; - break; - case NATIVE_NQD_UNKNOWN_HOOK: - dg.gen_load_T0_GPR(3); - dg.gen_invoke_T0_ret_T0((uint32 (*)(uint32))NQD_unknown_hook); - dg.gen_store_T0_GPR(3); - status = COMPILE_CODE_OK; - break; - case NATIVE_NQD_BITBLT: - dg.gen_load_T0_GPR(3); - dg.gen_invoke_T0((void (*)(uint32))NQD_bitblt); - status = COMPILE_CODE_OK; - break; - case NATIVE_NQD_INVRECT: - dg.gen_load_T0_GPR(3); - dg.gen_invoke_T0((void (*)(uint32))NQD_invrect); - status = COMPILE_CODE_OK; - break; - case NATIVE_NQD_FILLRECT: - dg.gen_load_T0_GPR(3); - dg.gen_invoke_T0((void (*)(uint32))NQD_fillrect); - status = COMPILE_CODE_OK; - break; - } - // Could we fully translate this NativeOp? - if (status == COMPILE_CODE_OK) { - if (!FN_field::test(opcode)) - cg_context.done_compile = false; - else { - dg.gen_load_T0_LR_aligned(); - dg.gen_set_PC_T0(); - cg_context.done_compile = true; - } - break; - } -#if PPC_REENTRANT_JIT - // Try to execute NativeOp trampoline - if (!FN_field::test(opcode)) - dg.gen_set_PC_im(cg_context.pc + 4); - else { - dg.gen_load_T0_LR_aligned(); - dg.gen_set_PC_T0(); - } - dg.gen_mov_32_T0_im(selector); - dg.gen_jmp(native_op_trampoline); - cg_context.done_compile = true; - status = COMPILE_EPILOGUE_OK; - break; -#endif - // Invoke NativeOp handler - if (!FN_field::test(opcode)) { - typedef void (*func_t)(dyngen_cpu_base, uint32); - func_t func = (func_t)nv_mem_fun(&sheepshaver_cpu::execute_native_op).ptr(); - dg.gen_invoke_CPU_im(func, selector); - cg_context.done_compile = false; - status = COMPILE_CODE_OK; - } - // Otherwise, let it generate a call to execute_sheep() which - // will cause necessary updates to the program counter - break; - } - - default: { // EMUL_OP - uint32 emul_op = EMUL_OP_field::extract(opcode) - 3; -#if PPC_REENTRANT_JIT - // Try to execute EmulOp trampoline - dg.gen_set_PC_im(cg_context.pc + 4); - dg.gen_mov_32_T0_im(emul_op); - dg.gen_jmp(emul_op_trampoline); - cg_context.done_compile = true; - status = COMPILE_EPILOGUE_OK; - break; -#endif - // Invoke EmulOp handler - typedef void (*func_t)(dyngen_cpu_base, uint32); - func_t func = (func_t)nv_mem_fun(&sheepshaver_cpu::execute_emul_op).ptr(); - dg.gen_invoke_CPU_im(func, emul_op); - cg_context.done_compile = false; - status = COMPILE_CODE_OK; - break; - } - } - return status; -} -#endif - -// Handle MacOS interrupt -void sheepshaver_cpu::interrupt(uint32 entry) -{ -#if EMUL_TIME_STATS - ppc_interrupt_count++; - const clock_t interrupt_start = clock(); -#endif - - // Save program counters and branch registers - uint32 saved_pc = pc(); - uint32 saved_lr = lr(); - uint32 saved_ctr= ctr(); - uint32 saved_sp = gpr(1); - - // Initialize stack pointer to SheepShaver alternate stack base - gpr(1) = SignalStackBase() - 64; - - // Build trampoline to return from interrupt - SheepVar32 trampoline = POWERPC_EXEC_RETURN; - - // Prepare registers for nanokernel interrupt routine - kernel_data->v[0x004 >> 2] = htonl(gpr(1)); - kernel_data->v[0x018 >> 2] = htonl(gpr(6)); - - gpr(6) = ntohl(kernel_data->v[0x65c >> 2]); - assert(gpr(6) != 0); - WriteMacInt32(gpr(6) + 0x13c, gpr(7)); - WriteMacInt32(gpr(6) + 0x144, gpr(8)); - WriteMacInt32(gpr(6) + 0x14c, gpr(9)); - WriteMacInt32(gpr(6) + 0x154, gpr(10)); - WriteMacInt32(gpr(6) + 0x15c, gpr(11)); - WriteMacInt32(gpr(6) + 0x164, gpr(12)); - WriteMacInt32(gpr(6) + 0x16c, gpr(13)); - - gpr(1) = KernelDataAddr; - gpr(7) = ntohl(kernel_data->v[0x660 >> 2]); - gpr(8) = 0; - gpr(10) = trampoline.addr(); - gpr(12) = trampoline.addr(); - gpr(13) = get_cr(); - - // rlwimi. r7,r7,8,0,0 - uint32 result = op_ppc_rlwimi::apply(gpr(7), 8, 0x80000000, gpr(7)); - record_cr0(result); - gpr(7) = result; - - gpr(11) = 0xf072; // MSR (SRR1) - cr().set((gpr(11) & 0x0fff0000) | (get_cr() & ~0x0fff0000)); - - // Enter nanokernel - execute(entry); - - // Restore program counters and branch registers - pc() = saved_pc; - lr() = saved_lr; - ctr()= saved_ctr; - gpr(1) = saved_sp; - -#if EMUL_TIME_STATS - interrupt_time += (clock() - interrupt_start); -#endif -} - -// Execute 68k routine -void sheepshaver_cpu::execute_68k(uint32 entry, M68kRegisters *r) -{ -#if EMUL_TIME_STATS - exec68k_count++; - const clock_t exec68k_start = clock(); -#endif - -#if SAFE_EXEC_68K - if (ReadMacInt32(XLM_RUN_MODE) != MODE_EMUL_OP) - printf("FATAL: Execute68k() not called from EMUL_OP mode\n"); -#endif - - // Save program counters and branch registers - uint32 saved_pc = pc(); - uint32 saved_lr = lr(); - uint32 saved_ctr= ctr(); - uint32 saved_cr = get_cr(); - - // Create MacOS stack frame - // FIXME: make sure MacOS doesn't expect PPC registers to live on top - uint32 sp = gpr(1); - gpr(1) -= 56; - WriteMacInt32(gpr(1), sp); - - // Save PowerPC registers - uint32 saved_GPRs[19]; - memcpy(&saved_GPRs[0], &gpr(13), sizeof(uint32)*(32-13)); -#if SAVE_FP_EXEC_68K - double saved_FPRs[18]; - memcpy(&saved_FPRs[0], &fpr(14), sizeof(double)*(32-14)); -#endif - - // Setup registers for 68k emulator - cr().set(CR_SO_field<2>::mask()); // Supervisor mode - for (int i = 0; i < 8; i++) // d[0]..d[7] - gpr(8 + i) = r->d[i]; - for (int i = 0; i < 7; i++) // a[0]..a[6] - gpr(16 + i) = r->a[i]; - gpr(23) = 0; - gpr(24) = entry; - gpr(25) = ReadMacInt32(XLM_68K_R25); // MSB of SR - gpr(26) = 0; - gpr(28) = 0; // VBR - gpr(29) = ntohl(kernel_data->ed.v[0x74 >> 2]); // Pointer to opcode table - gpr(30) = ntohl(kernel_data->ed.v[0x78 >> 2]); // Address of emulator - gpr(31) = KernelDataAddr + 0x1000; - - // Push return address (points to EXEC_RETURN opcode) on stack - gpr(1) -= 4; - WriteMacInt32(gpr(1), XLM_EXEC_RETURN_OPCODE); - - // Rentering 68k emulator - WriteMacInt32(XLM_RUN_MODE, MODE_68K); - - // Set r0 to 0 for 68k emulator - gpr(0) = 0; - - // Execute 68k opcode - uint32 opcode = ReadMacInt16(gpr(24)); - gpr(27) = (int32)(int16)ReadMacInt16(gpr(24) += 2); - gpr(29) += opcode * 8; - execute(gpr(29)); - - // Save r25 (contains current 68k interrupt level) - WriteMacInt32(XLM_68K_R25, gpr(25)); - - // Reentering EMUL_OP mode - WriteMacInt32(XLM_RUN_MODE, MODE_EMUL_OP); - - // Save 68k registers - for (int i = 0; i < 8; i++) // d[0]..d[7] - r->d[i] = gpr(8 + i); - for (int i = 0; i < 7; i++) // a[0]..a[6] - r->a[i] = gpr(16 + i); - - // Restore PowerPC registers - memcpy(&gpr(13), &saved_GPRs[0], sizeof(uint32)*(32-13)); -#if SAVE_FP_EXEC_68K - memcpy(&fpr(14), &saved_FPRs[0], sizeof(double)*(32-14)); -#endif - - // Cleanup stack - gpr(1) += 56; - - // Restore program counters and branch registers - pc() = saved_pc; - lr() = saved_lr; - ctr()= saved_ctr; - set_cr(saved_cr); - -#if EMUL_TIME_STATS - exec68k_time += (clock() - exec68k_start); -#endif -} - -// Call MacOS PPC code -uint32 sheepshaver_cpu::execute_macos_code(uint32 tvect, int nargs, uint32 const *args) -{ -#if EMUL_TIME_STATS - macos_exec_count++; - const clock_t macos_exec_start = clock(); -#endif - - // Save program counters and branch registers - uint32 saved_pc = pc(); - uint32 saved_lr = lr(); - uint32 saved_ctr= ctr(); - - // Build trampoline with EXEC_RETURN - SheepVar32 trampoline = POWERPC_EXEC_RETURN; - lr() = trampoline.addr(); - - gpr(1) -= 64; // Create stack frame - uint32 proc = ReadMacInt32(tvect); // Get routine address - uint32 toc = ReadMacInt32(tvect + 4); // Get TOC pointer - - // Save PowerPC registers - uint32 regs[8]; - regs[0] = gpr(2); - for (int i = 0; i < nargs; i++) - regs[i + 1] = gpr(i + 3); - - // Prepare and call MacOS routine - gpr(2) = toc; - for (int i = 0; i < nargs; i++) - gpr(i + 3) = args[i]; - execute(proc); - uint32 retval = gpr(3); - - // Restore PowerPC registers - for (int i = 0; i <= nargs; i++) - gpr(i + 2) = regs[i]; - - // Cleanup stack - gpr(1) += 64; - - // Restore program counters and branch registers - pc() = saved_pc; - lr() = saved_lr; - ctr()= saved_ctr; - -#if EMUL_TIME_STATS - macos_exec_time += (clock() - macos_exec_start); -#endif - - return retval; -} - -// Execute ppc routine -inline void sheepshaver_cpu::execute_ppc(uint32 entry) -{ - // Save branch registers - uint32 saved_lr = lr(); - - SheepVar32 trampoline = POWERPC_EXEC_RETURN; - WriteMacInt32(trampoline.addr(), POWERPC_EXEC_RETURN); - lr() = trampoline.addr(); - - execute(entry); - - // Restore branch registers - lr() = saved_lr; -} - -// Resource Manager thunk -inline void sheepshaver_cpu::get_resource(uint32 old_get_resource) -{ - uint32 type = gpr(3); - int16 id = gpr(4); - - // Create stack frame - gpr(1) -= 56; - - // Call old routine - execute_ppc(old_get_resource); - - // Call CheckLoad() - uint32 handle = gpr(3); - check_load_invoc(type, id, handle); - gpr(3) = handle; - - // Cleanup stack - gpr(1) += 56; -} - - -/** - * SheepShaver CPU engine interface - **/ - -// PowerPC CPU emulator -static sheepshaver_cpu *ppc_cpu = NULL; - -void FlushCodeCache(uintptr start, uintptr end) -{ - D(bug("FlushCodeCache(%08x, %08x)\n", start, end)); - ppc_cpu->invalidate_cache_range(start, end); -} - -// Dump PPC registers -static void dump_registers(void) -{ - ppc_cpu->dump_registers(); -} - -// Dump log -static void dump_log(void) -{ - ppc_cpu->dump_log(); -} - -static int read_mem(bfd_vma memaddr, bfd_byte *myaddr, int length, struct disassemble_info *info) -{ - Mac2Host_memcpy(myaddr, memaddr, length); - return 0; -} - -static void dump_disassembly(const uint32 pc, const int prefix_count, const int suffix_count) -{ - struct disassemble_info info; - INIT_DISASSEMBLE_INFO(info, stderr, fprintf); - info.read_memory_func = read_mem; - - const int count = prefix_count + suffix_count + 1; - const uint32 base_addr = pc - prefix_count * 4; - for (int i = 0; i < count; i++) { - const bfd_vma addr = base_addr + i * 4; - fprintf(stderr, "%s0x%8llx: ", addr == pc ? " >" : " ", addr); - print_insn_ppc(addr, &info); - fprintf(stderr, "\n"); - } -} - -sigsegv_return_t sigsegv_handler(sigsegv_info_t *sip) -{ -#if ENABLE_VOSF - // Handle screen fault - extern bool Screen_fault_handler(sigsegv_info_t *sip); - if (Screen_fault_handler(sip)) - return SIGSEGV_RETURN_SUCCESS; -#endif - - const uintptr addr = (uintptr)sigsegv_get_fault_address(sip); -#if HAVE_SIGSEGV_SKIP_INSTRUCTION - // Ignore writes to ROM - if ((addr - (uintptr)ROMBaseHost) < ROM_SIZE) - return SIGSEGV_RETURN_SKIP_INSTRUCTION; - - // Get program counter of target CPU - sheepshaver_cpu * const cpu = ppc_cpu; - const uint32 pc = cpu->pc(); - - // Fault in Mac ROM or RAM? - bool mac_fault = (pc >= ROMBase) && (pc < (ROMBase + ROM_AREA_SIZE)) || (pc >= RAMBase) && (pc < (RAMBase + RAMSize)) || (pc >= DR_CACHE_BASE && pc < (DR_CACHE_BASE + DR_CACHE_SIZE)); - if (mac_fault) { - - // "VM settings" during MacOS 8 installation - if (pc == ROMBase + 0x488160 && cpu->gpr(20) == 0xf8000000) - return SIGSEGV_RETURN_SKIP_INSTRUCTION; - - // MacOS 8.5 installation - else if (pc == ROMBase + 0x488140 && cpu->gpr(16) == 0xf8000000) - return SIGSEGV_RETURN_SKIP_INSTRUCTION; - - // MacOS 8 serial drivers on startup - else if (pc == ROMBase + 0x48e080 && (cpu->gpr(8) == 0xf3012002 || cpu->gpr(8) == 0xf3012000)) - return SIGSEGV_RETURN_SKIP_INSTRUCTION; - - // MacOS 8.1 serial drivers on startup - else if (pc == ROMBase + 0x48c5e0 && (cpu->gpr(20) == 0xf3012002 || cpu->gpr(20) == 0xf3012000)) - return SIGSEGV_RETURN_SKIP_INSTRUCTION; - else if (pc == ROMBase + 0x4a10a0 && (cpu->gpr(20) == 0xf3012002 || cpu->gpr(20) == 0xf3012000)) - return SIGSEGV_RETURN_SKIP_INSTRUCTION; - - // MacOS 8.6 serial drivers on startup (with DR Cache and OldWorld ROM) - else if ((pc - DR_CACHE_BASE) < DR_CACHE_SIZE && (cpu->gpr(16) == 0xf3012002 || cpu->gpr(16) == 0xf3012000)) - return SIGSEGV_RETURN_SKIP_INSTRUCTION; - else if ((pc - DR_CACHE_BASE) < DR_CACHE_SIZE && (cpu->gpr(20) == 0xf3012002 || cpu->gpr(20) == 0xf3012000)) - return SIGSEGV_RETURN_SKIP_INSTRUCTION; - - // Ignore writes to the zero page - else if ((uint32)(addr - SheepMem::ZeroPage()) < (uint32)SheepMem::PageSize()) - return SIGSEGV_RETURN_SKIP_INSTRUCTION; - - // Ignore all other faults, if requested - if (PrefsFindBool("ignoresegv")) - return SIGSEGV_RETURN_SKIP_INSTRUCTION; - } -#else -#error "FIXME: You don't have the capability to skip instruction within signal handlers" -#endif - - fprintf(stderr, "SIGSEGV\n"); - fprintf(stderr, " pc %p\n", sigsegv_get_fault_instruction_address(sip)); - fprintf(stderr, " ea %p\n", sigsegv_get_fault_address(sip)); - dump_registers(); - ppc_cpu->dump_log(); - dump_disassembly(pc, 8, 8); - - enter_mon(); - QuitEmulator(); - - return SIGSEGV_RETURN_FAILURE; -} - -/* - * Initialize CPU emulation - */ - -void init_emul_ppc(void) -{ - // Get pointer to KernelData in host address space - kernel_data = (KernelData *)Mac2HostAddr(KERNEL_DATA_BASE); - - // Initialize main CPU emulator - ppc_cpu = new sheepshaver_cpu(); - ppc_cpu->set_register(powerpc_registers::GPR(3), any_register((uint32)ROMBase + 0x30d000)); - ppc_cpu->set_register(powerpc_registers::GPR(4), any_register(KernelDataAddr + 0x1000)); - WriteMacInt32(XLM_RUN_MODE, MODE_68K); - -#if ENABLE_MON - // Install "regs" command in cxmon - mon_add_command("regs", dump_registers, "regs Dump PowerPC registers\n"); - mon_add_command("log", dump_log, "log Dump PowerPC emulation log\n"); -#endif - -#if EMUL_TIME_STATS - emul_start_time = clock(); -#endif -} - -/* - * Deinitialize emulation - */ - -void exit_emul_ppc(void) -{ -#if EMUL_TIME_STATS - clock_t emul_end_time = clock(); - - printf("### Statistics for SheepShaver emulation parts\n"); - const clock_t emul_time = emul_end_time - emul_start_time; - printf("Total emulation time : %.1f sec\n", double(emul_time) / double(CLOCKS_PER_SEC)); - printf("Total interrupt count: %d (%2.1f Hz)\n", interrupt_count, - (double(interrupt_count) * CLOCKS_PER_SEC) / double(emul_time)); - printf("Total ppc interrupt count: %d (%2.1f %%)\n", ppc_interrupt_count, - (double(ppc_interrupt_count) * 100.0) / double(interrupt_count)); - -#define PRINT_STATS(LABEL, VAR_PREFIX) do { \ - printf("Total " LABEL " count : %d\n", VAR_PREFIX##_count); \ - printf("Total " LABEL " time : %.1f sec (%.1f%%)\n", \ - double(VAR_PREFIX##_time) / double(CLOCKS_PER_SEC), \ - 100.0 * double(VAR_PREFIX##_time) / double(emul_time)); \ - } while (0) - - PRINT_STATS("Execute68k[Trap] execution", exec68k); - PRINT_STATS("NativeOp execution", native_exec); - PRINT_STATS("MacOS routine execution", macos_exec); - -#undef PRINT_STATS - printf("\n"); -#endif - - delete ppc_cpu; - ppc_cpu = NULL; -} - -#if PPC_ENABLE_JIT && PPC_REENTRANT_JIT -// Initialize EmulOp trampolines -void init_emul_op_trampolines(basic_dyngen & dg) -{ - typedef void (*func_t)(dyngen_cpu_base, uint32); - func_t func; - - // EmulOp - emul_op_trampoline = dg.gen_start(); - func = (func_t)nv_mem_fun(&sheepshaver_cpu::execute_emul_op).ptr(); - dg.gen_invoke_CPU_T0(func); - dg.gen_exec_return(); - dg.gen_end(); - - // NativeOp - native_op_trampoline = dg.gen_start(); - func = (func_t)nv_mem_fun(&sheepshaver_cpu::execute_native_op).ptr(); - dg.gen_invoke_CPU_T0(func); - dg.gen_exec_return(); - dg.gen_end(); - - D(bug("EmulOp trampoline: %p\n", emul_op_trampoline)); - D(bug("NativeOp trampoline: %p\n", native_op_trampoline)); -} -#endif - -/* - * Emulation loop - */ - -void emul_ppc(uint32 entry) -{ -#if 0 - ppc_cpu->start_log(); -#endif - // start emulation loop and enable code translation or caching - ppc_cpu->execute(entry); -} - -/* - * Handle PowerPC interrupt - */ - -void TriggerInterrupt(void) -{ - idle_resume(); -#if 0 - WriteMacInt32(0x16a, ReadMacInt32(0x16a) + 1); -#else - // Trigger interrupt to main cpu only - if (ppc_cpu) - ppc_cpu->trigger_interrupt(); -#endif -} - -void HandleInterrupt(powerpc_registers *r) -{ -#ifdef USE_SDL_VIDEO - // We must fill in the events queue in the same thread that did call SDL_SetVideoMode() - SDL_PumpEvents(); -#endif - - // Do nothing if interrupts are disabled - if (int32(ReadMacInt32(XLM_IRQ_NEST)) > 0) - return; - - // Update interrupt count -#if EMUL_TIME_STATS - interrupt_count++; -#endif - - // Interrupt action depends on current run mode - switch (ReadMacInt32(XLM_RUN_MODE)) { - case MODE_68K: - // 68k emulator active, trigger 68k interrupt level 1 - WriteMacInt16(tswap32(kernel_data->v[0x67c >> 2]), 1); - r->cr.set(r->cr.get() | tswap32(kernel_data->v[0x674 >> 2])); - break; - -#if INTERRUPTS_IN_NATIVE_MODE - case MODE_NATIVE: - // 68k emulator inactive, in nanokernel? - if (r->gpr[1] != KernelDataAddr) { - - // Prepare for 68k interrupt level 1 - WriteMacInt16(tswap32(kernel_data->v[0x67c >> 2]), 1); - WriteMacInt32(tswap32(kernel_data->v[0x658 >> 2]) + 0xdc, - ReadMacInt32(tswap32(kernel_data->v[0x658 >> 2]) + 0xdc) - | tswap32(kernel_data->v[0x674 >> 2])); - - // Execute nanokernel interrupt routine (this will activate the 68k emulator) - DisableInterrupt(); - if (ROMType == ROMTYPE_NEWWORLD) - ppc_cpu->interrupt(ROMBase + 0x312b1c); - else - ppc_cpu->interrupt(ROMBase + 0x312a3c); - } - break; -#endif - -#if INTERRUPTS_IN_EMUL_OP_MODE - case MODE_EMUL_OP: - // 68k emulator active, within EMUL_OP routine, execute 68k interrupt routine directly when interrupt level is 0 - if ((ReadMacInt32(XLM_68K_R25) & 7) == 0) { -#if EMUL_TIME_STATS - const clock_t interrupt_start = clock(); -#endif -#if 1 - // Execute full 68k interrupt routine - M68kRegisters r; - uint32 old_r25 = ReadMacInt32(XLM_68K_R25); // Save interrupt level - WriteMacInt32(XLM_68K_R25, 0x21); // Execute with interrupt level 1 - static const uint8 proc_template[] = { - 0x3f, 0x3c, 0x00, 0x00, // move.w #$0000,-(sp) (fake format word) - 0x48, 0x7a, 0x00, 0x0a, // pea @1(pc) (return address) - 0x40, 0xe7, // move sr,-(sp) (saved SR) - 0x20, 0x78, 0x00, 0x064, // move.l $64,a0 - 0x4e, 0xd0, // jmp (a0) - M68K_RTS >> 8, M68K_RTS & 0xff // @1 - }; - BUILD_SHEEPSHAVER_PROCEDURE(proc); - Execute68k(proc, &r); - WriteMacInt32(XLM_68K_R25, old_r25); // Restore interrupt level -#else - // Only update cursor - if (HasMacStarted()) { - if (InterruptFlags & INTFLAG_VIA) { - ClearInterruptFlag(INTFLAG_VIA); - ADBInterrupt(); - ExecuteNative(NATIVE_VIDEO_VBL); - } - } -#endif -#if EMUL_TIME_STATS - interrupt_time += (clock() - interrupt_start); -#endif - } - break; -#endif - } -} - -// Execute NATIVE_OP routine -void sheepshaver_cpu::execute_native_op(uint32 selector) -{ -#if EMUL_TIME_STATS - native_exec_count++; - const clock_t native_exec_start = clock(); -#endif - - switch (selector) { - case NATIVE_PATCH_NAME_REGISTRY: - DoPatchNameRegistry(); - break; - case NATIVE_VIDEO_INSTALL_ACCEL: - VideoInstallAccel(); - break; - case NATIVE_VIDEO_VBL: - VideoVBL(); - break; - case NATIVE_VIDEO_DO_DRIVER_IO: - gpr(3) = (int32)(int16)VideoDoDriverIO(gpr(3), gpr(4), gpr(5), gpr(6), gpr(7)); - break; - case NATIVE_ETHER_AO_GET_HWADDR: - AO_get_ethernet_address(gpr(3)); - break; - case NATIVE_ETHER_AO_ADD_MULTI: - AO_enable_multicast(gpr(3)); - break; - case NATIVE_ETHER_AO_DEL_MULTI: - AO_disable_multicast(gpr(3)); - break; - case NATIVE_ETHER_AO_SEND_PACKET: - AO_transmit_packet(gpr(3)); - break; - case NATIVE_ETHER_IRQ: - EtherIRQ(); - break; - case NATIVE_ETHER_INIT: - gpr(3) = InitStreamModule((void *)gpr(3)); - break; - case NATIVE_ETHER_TERM: - TerminateStreamModule(); - break; - case NATIVE_ETHER_OPEN: - gpr(3) = ether_open((queue_t *)gpr(3), (void *)gpr(4), gpr(5), gpr(6), (void*)gpr(7)); - break; - case NATIVE_ETHER_CLOSE: - gpr(3) = ether_close((queue_t *)gpr(3), gpr(4), (void *)gpr(5)); - break; - case NATIVE_ETHER_WPUT: - gpr(3) = ether_wput((queue_t *)gpr(3), (mblk_t *)gpr(4)); - break; - case NATIVE_ETHER_RSRV: - gpr(3) = ether_rsrv((queue_t *)gpr(3)); - break; - case NATIVE_NQD_SYNC_HOOK: - gpr(3) = NQD_sync_hook(gpr(3)); - break; - case NATIVE_NQD_UNKNOWN_HOOK: - gpr(3) = NQD_unknown_hook(gpr(3)); - break; - case NATIVE_NQD_BITBLT_HOOK: - gpr(3) = NQD_bitblt_hook(gpr(3)); - break; - case NATIVE_NQD_BITBLT: - NQD_bitblt(gpr(3)); - break; - case NATIVE_NQD_FILLRECT_HOOK: - gpr(3) = NQD_fillrect_hook(gpr(3)); - break; - case NATIVE_NQD_INVRECT: - NQD_invrect(gpr(3)); - break; - case NATIVE_NQD_FILLRECT: - NQD_fillrect(gpr(3)); - break; - case NATIVE_SERIAL_NOTHING: - case NATIVE_SERIAL_OPEN: - case NATIVE_SERIAL_PRIME_IN: - case NATIVE_SERIAL_PRIME_OUT: - case NATIVE_SERIAL_CONTROL: - case NATIVE_SERIAL_STATUS: - case NATIVE_SERIAL_CLOSE: { - typedef int16 (*SerialCallback)(uint32, uint32); - static const SerialCallback serial_callbacks[] = { - SerialNothing, - SerialOpen, - SerialPrimeIn, - SerialPrimeOut, - SerialControl, - SerialStatus, - SerialClose - }; - gpr(3) = serial_callbacks[selector - NATIVE_SERIAL_NOTHING](gpr(3), gpr(4)); - break; - } - case NATIVE_GET_RESOURCE: - get_resource(ReadMacInt32(XLM_GET_RESOURCE)); - break; - case NATIVE_GET_1_RESOURCE: - get_resource(ReadMacInt32(XLM_GET_1_RESOURCE)); - break; - case NATIVE_GET_IND_RESOURCE: - get_resource(ReadMacInt32(XLM_GET_IND_RESOURCE)); - break; - case NATIVE_GET_1_IND_RESOURCE: - get_resource(ReadMacInt32(XLM_GET_1_IND_RESOURCE)); - break; - case NATIVE_R_GET_RESOURCE: - get_resource(ReadMacInt32(XLM_R_GET_RESOURCE)); - break; - case NATIVE_MAKE_EXECUTABLE: - MakeExecutable(0, gpr(4), gpr(5)); - break; - case NATIVE_CHECK_LOAD_INVOC: - check_load_invoc(gpr(3), gpr(4), gpr(5)); - break; - case NATIVE_NAMED_CHECK_LOAD_INVOC: - named_check_load_invoc(gpr(3), gpr(4), gpr(5)); - break; - default: - printf("FATAL: NATIVE_OP called with bogus selector %d\n", selector); - QuitEmulator(); - break; - } - -#if EMUL_TIME_STATS - native_exec_time += (clock() - native_exec_start); -#endif -} - -/* - * Execute 68k subroutine (must be ended with EXEC_RETURN) - * This must only be called by the emul_thread when in EMUL_OP mode - * r->a[7] is unused, the routine runs on the caller's stack - */ - -void Execute68k(uint32 pc, M68kRegisters *r) -{ - ppc_cpu->execute_68k(pc, r); -} - -/* - * Execute 68k A-Trap from EMUL_OP routine - * r->a[7] is unused, the routine runs on the caller's stack - */ - -void Execute68kTrap(uint16 trap, M68kRegisters *r) -{ - SheepVar proc_var(4); - uint32 proc = proc_var.addr(); - WriteMacInt16(proc, trap); - WriteMacInt16(proc + 2, M68K_RTS); - Execute68k(proc, r); -} - -/* - * Call MacOS PPC code - */ - -uint32 call_macos(uint32 tvect) -{ - return ppc_cpu->execute_macos_code(tvect, 0, NULL); -} - -uint32 call_macos1(uint32 tvect, uint32 arg1) -{ - const uint32 args[] = { arg1 }; - return ppc_cpu->execute_macos_code(tvect, sizeof(args)/sizeof(args[0]), args); -} - -uint32 call_macos2(uint32 tvect, uint32 arg1, uint32 arg2) -{ - const uint32 args[] = { arg1, arg2 }; - return ppc_cpu->execute_macos_code(tvect, sizeof(args)/sizeof(args[0]), args); -} - -uint32 call_macos3(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3) -{ - const uint32 args[] = { arg1, arg2, arg3 }; - return ppc_cpu->execute_macos_code(tvect, sizeof(args)/sizeof(args[0]), args); -} - -uint32 call_macos4(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4) -{ - const uint32 args[] = { arg1, arg2, arg3, arg4 }; - return ppc_cpu->execute_macos_code(tvect, sizeof(args)/sizeof(args[0]), args); -} - -uint32 call_macos5(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5) -{ - const uint32 args[] = { arg1, arg2, arg3, arg4, arg5 }; - return ppc_cpu->execute_macos_code(tvect, sizeof(args)/sizeof(args[0]), args); -} - -uint32 call_macos6(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5, uint32 arg6) -{ - const uint32 args[] = { arg1, arg2, arg3, arg4, arg5, arg6 }; - return ppc_cpu->execute_macos_code(tvect, sizeof(args)/sizeof(args[0]), args); -} - -uint32 call_macos7(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5, uint32 arg6, uint32 arg7) -{ - const uint32 args[] = { arg1, arg2, arg3, arg4, arg5, arg6, arg7 }; - return ppc_cpu->execute_macos_code(tvect, sizeof(args)/sizeof(args[0]), args); -} diff --git a/SheepShaver/src/kpx_cpu/src/cpu/block-cache.hpp b/SheepShaver/src/kpx_cpu/src/cpu/block-cache.hpp deleted file mode 100644 index 3ba2b635..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/block-cache.hpp +++ /dev/null @@ -1,277 +0,0 @@ -/* - * block-cache.hpp - Basic block cache management - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef BLOCK_CACHE_H -#define BLOCK_CACHE_H - -#include "block-alloc.hpp" - -template< class block_info, template class block_allocator = slow_allocator > -class block_cache -{ -private: - static const uint32 HASH_BITS = 15; - static const uint32 HASH_SIZE = 1 << HASH_BITS; - static const uint32 HASH_MASK = HASH_SIZE - 1; - - struct entry - : public block_info - { - entry * next_same_cl; - entry ** prev_same_cl_p; - entry * next; - entry ** prev_p; - }; - - block_allocator allocator; - entry * cache_tags[HASH_SIZE]; - entry * active; - entry * dormant; - - uint32 cacheline(uintptr addr) const { - return (addr >> 2) & HASH_MASK; - } - -public: - - block_cache(); - ~block_cache(); - - block_info *new_blockinfo(); - void delete_blockinfo(block_info *bi); - - void initialize(); - void clear(); - void clear_range(uintptr start, uintptr end); - block_info *fast_find(uintptr pc); - block_info *find(uintptr pc); - - void remove_from_cl_list(block_info *bi); - void remove_from_list(block_info *bi); - void remove_from_lists(block_info *bi); - - void add_to_cl_list(block_info *bi); - void raise_in_cl_list(block_info *bi); - - void add_to_active_list(block_info *bi); - void add_to_dormant_list(block_info *bi); -}; - -template< class block_info, template class block_allocator > -block_cache< block_info, block_allocator >::block_cache() - : active(NULL), dormant(NULL) -{ - initialize(); -} - -template< class block_info, template class block_allocator > -block_cache< block_info, block_allocator >::~block_cache() -{ - clear(); -} - -template< class block_info, template class block_allocator > -void block_cache< block_info, block_allocator >::initialize() -{ - for (int i = 0; i < HASH_SIZE; i++) - cache_tags[i] = NULL; -} - -template< class block_info, template class block_allocator > -void block_cache< block_info, block_allocator >::clear() -{ - entry *p; - - p = active; - while (p) { - entry *d = p; - p = p->next; - delete_blockinfo(d); - } - active = NULL; - - p = dormant; - while (p) { - entry *d = p; - p = p->next; - delete_blockinfo(d); - } - dormant = NULL; -} - -template< class block_info, template class block_allocator > -void block_cache< block_info, block_allocator >::clear_range(uintptr start, uintptr end) -{ - if (!active) - return; - - entry *p, *q; - if (cacheline(start) < cacheline(end - 1)) { - // Optimize for short ranges flush - const int end_cl = cacheline(end - 1); - for (int cl = cacheline(start); cl <= end_cl; cl++) { - p = cache_tags[cl]; - while (p) { - q = p; - p = p->next_same_cl; - if (q->intersect(start, end)) { - q->invalidate(); - remove_from_cl_list(q); - remove_from_list(q); - delete_blockinfo(q); - } - } - } - } - else { - p = active; - while (p) { - q = p; - p = p->next; - if (q->intersect(start, end)) { - q->invalidate(); - remove_from_cl_list(q); - remove_from_list(q); - delete_blockinfo(q); - } - } - } -} - -template< class block_info, template class block_allocator > -inline block_info *block_cache< block_info, block_allocator >::new_blockinfo() -{ - entry * bce = allocator.acquire(); - return bce; -} - -template< class block_info, template class block_allocator > -inline void block_cache< block_info, block_allocator >::delete_blockinfo(block_info *bi) -{ - entry * bce = (entry *)bi; - allocator.release(bce); -} - -template< class block_info, template class block_allocator > -inline block_info *block_cache< block_info, block_allocator >::fast_find(uintptr pc) -{ - // Hit: return immediately (that covers more than 95% of the cases) - entry * bce = cache_tags[cacheline(pc)]; - if (bce && bce->pc == pc) - return bce; - - return NULL; -} - -template< class block_info, template class block_allocator > -block_info *block_cache< block_info, block_allocator >::find(uintptr pc) -{ - // Hit: return immediately - entry * bce = cache_tags[cacheline(pc)]; - if (bce && bce->pc == pc) - return bce; - - // Miss: perform full list search and move block to front if found - while (bce) { - bce = bce->next_same_cl; - if (bce && bce->pc == pc) { - raise_in_cl_list(bce); - return bce; - } - } - - // Found none, will have to create a new block - return NULL; -} - -template< class block_info, template class block_allocator > -void block_cache< block_info, block_allocator >::remove_from_cl_list(block_info *bi) -{ - entry * bce = (entry *)bi; - if (bce->prev_same_cl_p) - *bce->prev_same_cl_p = bce->next_same_cl; - if (bce->next_same_cl) - bce->next_same_cl->prev_same_cl_p = bce->prev_same_cl_p; -} - -template< class block_info, template class block_allocator > -void block_cache< block_info, block_allocator >::add_to_cl_list(block_info *bi) -{ - entry * bce = (entry *)bi; - const uint32 cl = cacheline(bi->pc); - if (cache_tags[cl]) - cache_tags[cl]->prev_same_cl_p = &bce->next_same_cl; - bce->next_same_cl = cache_tags[cl]; - - cache_tags[cl] = bce; - bce->prev_same_cl_p = &cache_tags[cl]; -} - -template< class block_info, template class block_allocator > -inline void block_cache< block_info, block_allocator >::raise_in_cl_list(block_info *bi) -{ - remove_from_cl_list(bi); - add_to_cl_list(bi); -} - -template< class block_info, template class block_allocator > -void block_cache< block_info, block_allocator >::remove_from_list(block_info *bi) -{ - entry * bce = (entry *)bi; - if (bce->prev_p) - *bce->prev_p = bce->next; - if (bce->next) - bce->next->prev_p = bce->prev_p; -} - -template< class block_info, template class block_allocator > -void block_cache< block_info, block_allocator >::add_to_active_list(block_info *bi) -{ - entry * bce = (entry *)bi; - - if (active) - active->prev_p = &bce->next; - bce->next = active; - - active = bce; - bce->prev_p = &active; -} - -template< class block_info, template class block_allocator > -void block_cache< block_info, block_allocator >::add_to_dormant_list(block_info *bi) -{ - entry * bce = (entry *)bi; - - if (dormant) - dormant->prev_p = &bce->next; - bce->next = dormant; - - dormant = bce; - bce->prev_p = &dormant; -} - -template< class block_info, template class block_allocator > -inline void block_cache< block_info, block_allocator >::remove_from_lists(block_info *bi) -{ - remove_from_cl_list(bi); - remove_from_list(bi); -} - -#endif /* BLOCK_CACHE_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/jit/amd64/dyngen-target-exec.h b/SheepShaver/src/kpx_cpu/src/cpu/jit/amd64/dyngen-target-exec.h deleted file mode 100644 index 14b070d0..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/jit/amd64/dyngen-target-exec.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * dyngen defines for micro operation code - * - * Copyright (c) 2003-2004-2004 Fabrice Bellard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef DYNGEN_TARGET_EXEC_H -#define DYNGEN_TARGET_EXEC_H - -enum { - /* callee save registers */ -#define AREG0 "rbp" - AREG0_ID = 5, - -/* - * Use of rbx register with gcc 4.2 on Mac OS 10.6 - * does not produce usable code. Just use r12 to r15. - */ -#if (defined(__APPLE__) && defined(__MACH__)) - -#define AREG1 "r12" - AREG1_ID = 12, - -#define AREG2 "r13" - AREG2_ID = 13, - -#define AREG3 "r14" - AREG3_ID = 14, - -#define AREG4 "r15" - AREG4_ID = 15, - -#else - -#define AREG1 "rbx" - AREG1_ID = 3, - -#define AREG2 "r12" - AREG2_ID = 12, - -#define AREG3 "r13" - AREG3_ID = 13, - -#define AREG4 "r14" - AREG4_ID = 14, - -#define AREG5 "r15" - AREG5_ID = 15, - -#endif - - - // NOTE: the following XMM registers definitions require to build - // *-dyngen-ops.cpp with -ffixed-xmmN - - /* floating-point registers */ -#define FREG0 "xmm4" - FREG0_ID = 4, - -#define FREG1 "xmm5" - FREG1_ID = 5, - -#define FREG2 "xmm6" - FREG2_ID = 6, - -#define FREG3 "xmm7" - FREG3_ID = 7, - - /* vector registers -- aliased to FP registers, not intermixed */ -#define VREG0 FREG0 -#define VREG0_ID FREG0_ID -#define VREG1 FREG1 -#define VREG1_ID FREG1_ID -#define VREG2 FREG2 -#define VREG2_ID FREG2_ID -#define VREG3 FREG3 -#define VREG3_ID FREG3_ID -}; - -#endif /* DYNGEN_TARGET_EXEC_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/jit/amd64/jit-target-cache.hpp b/SheepShaver/src/kpx_cpu/src/cpu/jit/amd64/jit-target-cache.hpp deleted file mode 100644 index f411d3bb..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/jit/amd64/jit-target-cache.hpp +++ /dev/null @@ -1 +0,0 @@ -#include "cpu/jit/dummy/jit-target-cache.hpp" diff --git a/SheepShaver/src/kpx_cpu/src/cpu/jit/amd64/jit-target-codegen.hpp b/SheepShaver/src/kpx_cpu/src/cpu/jit/amd64/jit-target-codegen.hpp deleted file mode 100644 index e4611d69..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/jit/amd64/jit-target-codegen.hpp +++ /dev/null @@ -1,108 +0,0 @@ -/* - * jit-target-codegen.hpp - Target specific code generator - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef JIT_AMD64_CODEGEN_H -#define JIT_AMD64_CODEGEN_H - -#define X86_TARGET_64BIT 1 -#include "cpu/jit/x86/jit-target-codegen.hpp" - -class amd64_codegen - : public x86_codegen -{ -public: - -#define DEFINE_OP(NAME, OP) \ - void gen_##NAME(int s, int d) \ - { GEN_CODE(OP##rr(s, d)); } \ - void gen_##NAME(x86_memory_operand const & mem, int d) \ - { GEN_CODE(OP##mr(mem.MD, mem.MB, mem.MI, mem.MS, d)); } - - DEFINE_OP(sx_8_64, MOVSBQ); - DEFINE_OP(zx_8_64, MOVZBQ); - DEFINE_OP(sx_16_64, MOVSWQ); - DEFINE_OP(zx_16_64, MOVZWQ); - DEFINE_OP(sx_32_64, MOVSLQ); - -#undef DEFINE_OP - -public: - - void gen_push(int r) - { GEN_CODE(PUSHQr(r)); } - void gen_push(x86_memory_operand const & mem) - { GEN_CODE(PUSHQm(mem.MD, mem.MB, mem.MI, mem.MS)); } - void gen_pop(int r) - { GEN_CODE(POPQr(r)); } - void gen_pop(x86_memory_operand const & mem) - { GEN_CODE(POPQm(mem.MD, mem.MB, mem.MI, mem.MS)); } - void gen_bswap_64(int r) - { GEN_CODE(BSWAPQr(r)); } - void gen_lea_64(x86_memory_operand const & mem, int d) - { GEN_CODE(LEAQmr(mem.MD, mem.MB, mem.MI, mem.MS, d)); } - -public: - - void gen_mov_64(int s, int d) - { GEN_CODE(MOVQrr(s, d)); } - void gen_mov_64(x86_memory_operand const & mem, int d) - { GEN_CODE(MOVQmr(mem.MD, mem.MB, mem.MI, mem.MS, d)); } - void gen_mov_64(int s, x86_memory_operand const & mem) - { GEN_CODE(MOVQrm(s, mem.MD, mem.MB, mem.MI, mem.MS)); } - void gen_mov_64(x86_immediate_operand const & imm, int d) - { GEN_CODE(MOVQir(imm.value, d)); } - void gen_mov_64(x86_immediate_operand const & imm, x86_memory_operand const & mem) - { GEN_CODE(MOVQim(imm.value, mem.MD, mem.MB, mem.MI, mem.MS)); } - -private: - - void gen_rotshi_64(int op, int s, int d) - { GEN_CODE(_ROTSHIQrr(op, s, d)); } - void gen_rotshi_64(int op, int s, x86_memory_operand const & mem) - { GEN_CODE(_ROTSHIQrm(op, s, mem.MD, mem.MB, mem.MI, mem.MS)); } - void gen_rotshi_64(int op, x86_immediate_operand const & imm, int d) - { GEN_CODE(_ROTSHIQir(op, imm.value, d)); } - void gen_rotshi_64(int op, x86_immediate_operand const & imm, x86_memory_operand const & mem) - { GEN_CODE(_ROTSHIQim(op, imm.value, mem.MD, mem.MB, mem.MI, mem.MS)); } - -public: - -#define DEFINE_OP(NAME, OP) \ - void gen_##NAME##_64(int s, int d) \ - { gen_rotshi_64(X86_##OP, s, d); } \ - void gen_##NAME##_64(int s, x86_memory_operand const & mem) \ - { gen_rotshi_64(X86_##OP, s, mem); } \ - void gen_##NAME##_64(x86_immediate_operand const & imm, int d) \ - { gen_rotshi_64(X86_##OP, imm, d); } \ - void gen_##NAME##_64(x86_immediate_operand const & imm, x86_memory_operand const & mem) \ - { gen_rotshi_64(X86_##OP, imm, mem); } - - DEFINE_OP(rol, ROL); - DEFINE_OP(ror, ROR); - DEFINE_OP(rcl, RCL); - DEFINE_OP(rcr, RCR); - DEFINE_OP(shl, SHL); - DEFINE_OP(shr, SHR); - DEFINE_OP(sar, SAR); - -#undef DEFINE_OP -}; - -#endif /* JIT_AMD64_CODEGEN_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/jit/basic-dyngen-ops.cpp b/SheepShaver/src/kpx_cpu/src/cpu/jit/basic-dyngen-ops.cpp deleted file mode 100644 index 7b9feebc..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/jit/basic-dyngen-ops.cpp +++ /dev/null @@ -1,481 +0,0 @@ -/* - * dyngen-ops.hpp - Synthetic opcodes - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" -#include "cpu/vm.hpp" -#include "cpu/jit/dyngen-exec.h" - -#include - -// We need at least 5 general purpose registers -struct basic_cpu; -register basic_cpu *CPU asm(REG_CPU); -#define DYNGEN_DEFINE_GLOBAL_REGISTER(REG) \ -register uintptr A##REG asm(REG_T##REG); \ -register uint32 T##REG asm(REG_T##REG) -DYNGEN_DEFINE_GLOBAL_REGISTER(0); -DYNGEN_DEFINE_GLOBAL_REGISTER(1); -DYNGEN_DEFINE_GLOBAL_REGISTER(2); - - -/** - * Native ALU operations optimization - **/ - -#if defined(__i386__) || defined(__x86_64__) -#define do_xchg_32(x, y) asm volatile ("xchg %0,%1" : "+r" (x), "+r" (y)) -#endif -#ifndef do_udiv_32 -#define do_udiv_32(x, y) ((uint32)x / (uint32)y) -#endif -#ifndef do_sdiv_32 -#define do_sdiv_32(x, y) ((int32)x / (int32)y) -#endif -#ifndef do_rol_32 -#define do_rol_32(x, y) ((x << y) | (x >> (32 - y))) -#endif -#ifndef do_ror_32 -#define do_ror_32(x, y) ((x >> y) | (x << (32 - y))) -#endif -#ifndef do_xchg_32 -#define do_xchg_32(x, y) do { uint32 t = x; x = y; y = t; } while (0) -#endif - - -/** - * ALU operations - **/ - -// XXX update for new 64-bit arches -#if defined __x86_64__ -#define MOV_AD_REG(PARAM, REG) asm volatile ("movabsq $__op_" #PARAM ",%0" : "=r" (REG)) -#else -#define MOV_AD_REG(PARAM, REG) REG = PARAM -#endif - -#define DEFINE_OP(REG) \ -void OPPROTO op_mov_ad_##REG##_im(void) \ -{ \ - MOV_AD_REG(PARAM1, REG); \ -} - -DEFINE_OP(A0); -DEFINE_OP(A1); -DEFINE_OP(A2); - -#undef DEFINE_OP - -#define DEFINE_OP(NAME, CODE) \ -void OPPROTO op_##NAME(void) \ -{ \ - CODE; \ -} - -// Register moves -DEFINE_OP(mov_32_T0_im, T0 = PARAM1); -DEFINE_OP(mov_32_T0_T1, T0 = T1); -DEFINE_OP(mov_32_T0_T2, T0 = T2); -DEFINE_OP(mov_32_T1_im, T1 = PARAM1); -DEFINE_OP(mov_32_T1_T0, T1 = T0); -DEFINE_OP(mov_32_T1_T2, T1 = T2); -DEFINE_OP(mov_32_T2_im, T2 = PARAM1); -DEFINE_OP(mov_32_T2_T1, T2 = T1); -DEFINE_OP(mov_32_T2_T0, T2 = T0); -DEFINE_OP(mov_32_T0_0, T0 = 0); -DEFINE_OP(mov_32_T1_0, T1 = 0); -DEFINE_OP(mov_32_T2_0, T2 = 0); - -// Arithmetic operations -DEFINE_OP(add_32_T0_T2, T0 += T2); -DEFINE_OP(add_32_T0_T1, T0 += T1); -DEFINE_OP(add_32_T0_im, T0 += PARAM1); -DEFINE_OP(add_32_T0_1, T0 += 1); -DEFINE_OP(add_32_T0_2, T0 += 2); -DEFINE_OP(add_32_T0_4, T0 += 4); -DEFINE_OP(add_32_T0_8, T0 += 8); -DEFINE_OP(sub_32_T0_T2, T0 -= T2); -DEFINE_OP(sub_32_T0_T1, T0 -= T1); -DEFINE_OP(sub_32_T0_im, T0 -= PARAM1); -DEFINE_OP(sub_32_T0_1, T0 -= 1); -DEFINE_OP(sub_32_T0_2, T0 -= 2); -DEFINE_OP(sub_32_T0_4, T0 -= 4); -DEFINE_OP(sub_32_T0_8, T0 -= 8); -DEFINE_OP(add_32_T1_T2, T1 += T2); -DEFINE_OP(add_32_T1_T0, T1 += T0); -DEFINE_OP(add_32_T1_im, T1 += PARAM1); -DEFINE_OP(add_32_T1_1, T1 += 1); -DEFINE_OP(add_32_T1_2, T1 += 2); -DEFINE_OP(add_32_T1_4, T1 += 4); -DEFINE_OP(add_32_T1_8, T1 += 8); -DEFINE_OP(sub_32_T1_T2, T1 -= T2); -DEFINE_OP(sub_32_T1_T0, T1 -= T0); -DEFINE_OP(sub_32_T1_im, T1 -= PARAM1); -DEFINE_OP(sub_32_T1_1, T1 -= 1); -DEFINE_OP(sub_32_T1_2, T1 -= 2); -DEFINE_OP(sub_32_T1_4, T1 -= 4); -DEFINE_OP(sub_32_T1_8, T1 -= 8); -DEFINE_OP(umul_32_T0_T1, T0 = (uint32)T0 * (uint32)T1); -DEFINE_OP(smul_32_T0_T1, T0 = (int32)T0 * (int32)T1); -DEFINE_OP(udiv_32_T0_T1, T0 = do_udiv_32(T0, T1)); -DEFINE_OP(sdiv_32_T0_T1, T0 = do_sdiv_32(T0, T1)); -DEFINE_OP(xchg_32_T0_T1, do_xchg_32(T0, T1)); -DEFINE_OP(bswap_16_T0, T0 = bswap_16(T0)); -DEFINE_OP(bswap_32_T0, T0 = bswap_32(T0)); - -// Logical operations -DEFINE_OP(neg_32_T0, T0 = -T0); -DEFINE_OP(not_32_T0, T0 = !T0); -DEFINE_OP(not_32_T1, T1 = !T1); -DEFINE_OP(and_32_T0_T1, T0 &= T1); -DEFINE_OP(and_32_T0_im, T0 &= PARAM1); -DEFINE_OP(or_32_T0_T1, T0 |= T1); -DEFINE_OP(or_32_T0_im, T0 |= PARAM1); -DEFINE_OP(xor_32_T0_T1, T0 ^= T1); -DEFINE_OP(xor_32_T0_im, T0 ^= PARAM1); -DEFINE_OP(orc_32_T0_T1, T0 |= ~T1); -DEFINE_OP(andc_32_T0_T1, T0 &= ~T1); -DEFINE_OP(nand_32_T0_T1, T0 = ~(T0 & T1)); -DEFINE_OP(nor_32_T0_T1, T0 = ~(T0 | T1)); -DEFINE_OP(eqv_32_T0_T1, T0 = ~(T0 ^ T1)); - -// Shift/Rotate operations -DEFINE_OP(lsl_32_T0_T1, T0 = T0 << T1); -DEFINE_OP(lsl_32_T0_im, T0 = T0 << PARAM1); -DEFINE_OP(lsr_32_T0_T1, T0 = T0 >> T1); -DEFINE_OP(lsr_32_T0_im, T0 = T0 >> PARAM1); -DEFINE_OP(asr_32_T0_T1, T0 = ((int32)T0) >> T1); -DEFINE_OP(asr_32_T0_im, T0 = ((int32)T0) >> PARAM1); -DEFINE_OP(rol_32_T0_T1, T0 = do_rol_32(T0, T1)); -DEFINE_OP(rol_32_T0_im, T0 = do_rol_32(T0, PARAM1)); -DEFINE_OP(ror_32_T0_T1, T0 = do_ror_32(T0, T1)); -DEFINE_OP(ror_32_T0_im, T0 = do_ror_32(T0, PARAM1)); - -// Sign-/Zero-extension -DEFINE_OP(se_16_32_T0, T0 = (int32)(int16)T0); -DEFINE_OP(se_16_32_T1, T1 = (int32)(int16)T1); -DEFINE_OP(ze_16_32_T0, T0 = (uint32)(uint16)T0); -DEFINE_OP(se_8_32_T0, T0 = (int32)(int8)T0); -DEFINE_OP(ze_8_32_T0, T0 = (uint32)(uint8)T0); - -#undef DEFINE_OP - - -/** - * Load/Store instructions - **/ - -#define im PARAM1 -#define DEFINE_OP(BITS,REG,SIZE,OFFSET) \ -void OPPROTO op_load_u##BITS##_##REG##_T1_##OFFSET(void) \ -{ \ - REG = (uint32)(uint##BITS)vm_read_memory_##SIZE(T1 + OFFSET); \ -} \ -void OPPROTO op_load_s##BITS##_##REG##_T1_##OFFSET(void) \ -{ \ - REG = (int32)(int##BITS)vm_read_memory_##SIZE(T1 + OFFSET); \ -} \ -void OPPROTO op_store_##BITS##_##REG##_T1_##OFFSET(void) \ -{ \ - vm_write_memory_##SIZE(T1 + OFFSET, REG); \ -} - -DEFINE_OP(32,T0,4,0); -DEFINE_OP(32,T0,4,im); -DEFINE_OP(32,T0,4,T2); -DEFINE_OP(16,T0,2,0); -DEFINE_OP(16,T0,2,im); -DEFINE_OP(16,T0,2,T2); -DEFINE_OP(8,T0,1,0); -DEFINE_OP(8,T0,1,im); -DEFINE_OP(8,T0,1,T2); - -#undef im -#undef DEFINE_OP - - -/** - * Control flow - **/ - -#ifdef __i386__ -#define FORCE_RET() asm volatile ("ret") -#endif -#ifdef __x86_64__ -#define FORCE_RET() asm volatile ("ret") -#endif -#ifdef __powerpc__ -#define FORCE_RET() asm volatile ("blr") -#endif -#ifdef __ppc__ -#define FORCE_RET() asm volatile ("blr") -#endif -#ifdef __s390__ -#define FORCE_RET() asm volatile ("br %r14") -#endif -#ifdef __alpha__ -#define FORCE_RET() asm volatile ("ret") -#endif -#ifdef __ia64__ -#define FORCE_RET() asm volatile ("br.ret.sptk.many b0;;") -#endif -#ifdef __sparc__ -#define FORCE_RET() asm volatile ("jmpl %i0 + 8, %g0\n" \ - "nop") -#endif -#ifdef __arm__ -#define FORCE_RET() asm volatile ("b exec_loop") -#endif -#ifdef __mc68000 -#define FORCE_RET() asm volatile ("rts") -#endif - -extern "C" void OPPROTO op_execute(uint8 *entry_point, basic_cpu *this_cpu); -void OPPROTO op_execute(uint8 *entry_point, basic_cpu *this_cpu) -{ - typedef void (*func_t)(void); - func_t func = (func_t)entry_point; - const int n_slots = 16 + 4; /* 16 stack slots + 4 VCPU registers */ - volatile uintptr stk[n_slots]; - stk[n_slots - 1] = (uintptr)CPU; - stk[n_slots - 2] = A0; - stk[n_slots - 3] = A1; - stk[n_slots - 4] = A2; - CPU = this_cpu; - DYNGEN_SLOW_DISPATCH(entry_point); - func(); // NOTE: never called, fake to make compiler save return point -#ifdef ASM_OP_EXEC_RETURN_INSN - asm volatile ("1: .byte " ASM_OP_EXEC_RETURN_INSN); -#else - asm volatile (ASM_DATA_SECTION); - asm volatile (ASM_GLOBAL " " ASM_NAME(op_exec_return_offset)); - asm volatile (ASM_NAME(op_exec_return_offset) ":"); - asm volatile (ASM_LONG " 1f-" ASM_NAME(op_execute)); - asm volatile (ASM_SIZE(op_exec_return_offset)); - asm volatile (ASM_PREVIOUS_SECTION); - asm volatile ("1:"); -#endif - A2 = stk[n_slots - 4]; - A1 = stk[n_slots - 3]; - A0 = stk[n_slots - 2]; - CPU = (basic_cpu *)stk[n_slots - 1]; -} - -void OPPROTO op_jmp_slow(void) -{ - DYNGEN_SLOW_DISPATCH(PARAM1); -} - -void OPPROTO op_jmp_fast(void) -{ -#ifdef DYNGEN_FAST_DISPATCH - DYNGEN_FAST_DISPATCH(__op_PARAM1); -#else - DYNGEN_SLOW_DISPATCH(PARAM1); -#endif -} - -void OPPROTO op_jmp_A0(void) -{ - DYNGEN_SLOW_DISPATCH(A0); -} - -// Register calling conventions based arches don't need a stack frame -// XXX enable on x86 too because we allocated a frame in op_execute() -#if (defined __APPLE__ && defined __MACH__) -#define DEFINE_OP(NAME, CODE) \ -static void OPPROTO impl_##NAME(void) __attribute__((used)); \ -void OPPROTO impl_##NAME(void) \ -{ \ - asm volatile (#NAME ":"); \ - CODE; \ - FORCE_RET(); \ - asm volatile ("." #NAME ":"); \ - asm volatile (ASM_SIZE(NAME)); \ -} \ -extern void OPPROTO NAME(void) __attribute__((weak_import)); \ -asm(".set helper_" #NAME "," #NAME); -#elif defined(__powerpc__) || ((defined(__x86_64__) || defined(__i386__)) && !defined(_WIN32)) -// XXX there is a problem on Windows: coff_text_shndx != text_shndx -// The latter is found by searching for ".text" in all symbols and -// assigning its e_scnum. -#define DEFINE_OP(NAME, CODE) \ -static void OPPROTO impl_##NAME(void) __attribute__((used)); \ -void OPPROTO impl_##NAME(void) \ -{ \ - asm volatile (#NAME ":"); \ - CODE; \ - FORCE_RET(); \ - asm volatile ("." #NAME ":"); \ - asm volatile (ASM_SIZE(NAME)); \ -} \ -asm(".weak " #NAME); \ -asm(".set helper_" #NAME "," #NAME); -#else -#define DEFINE_OP(NAME, CODE) \ -extern "C" void OPPROTO NAME(void); \ -void OPPROTO NAME(void) \ -{ \ - CODE; \ -} -#endif - -#if defined __mips__ -#define CALL(FUNC, ARGS) ({ \ - register uintptr func asm("t9"); \ - asm volatile ("move %0,%1" : "=r" (func) : "r" (FUNC)); \ - ((func_t)func) ARGS; \ -}) -#else -#define CALL(FUNC, ARGS) ((func_t)FUNC) ARGS -#endif - -DEFINE_OP(op_invoke, { - typedef void (*func_t)(void); - uintptr func; - MOV_AD_REG(PARAM1, func); - CALL(func, ()); -}); - -DEFINE_OP(op_invoke_T0, { - typedef void (*func_t)(uint32); - uintptr func; - MOV_AD_REG(PARAM1, func); - CALL(func, (T0)); -}); - -DEFINE_OP(op_invoke_T0_T1, { - typedef void (*func_t)(uint32, uint32); - uintptr func; - MOV_AD_REG(PARAM1, func); - CALL(func, (T0, T1)); -}); - -DEFINE_OP(op_invoke_T0_T1_T2, { - typedef void (*func_t)(uint32, uint32, uint32); - uintptr func; - MOV_AD_REG(PARAM1, func); - CALL(func, (T0, T1, T2)); -}); - -DEFINE_OP(op_invoke_T0_ret_T0, { - typedef uint32 (*func_t)(uint32); - uintptr func; - MOV_AD_REG(PARAM1, func); - T0 = CALL(func, (T0)); -}); - -DEFINE_OP(op_invoke_im, { - typedef void (*func_t)(uint32); - uintptr func; - MOV_AD_REG(PARAM1, func); - CALL(func, (PARAM2)); -}); - -DEFINE_OP(op_invoke_CPU, { - typedef void (*func_t)(void *); - uintptr func; - MOV_AD_REG(PARAM1, func); - CALL(func, (CPU)); -}); - -DEFINE_OP(op_invoke_CPU_T0, { - typedef void (*func_t)(void *, uint32); - uintptr func; - MOV_AD_REG(PARAM1, func); - CALL(func, (CPU, T0)); -}); - -DEFINE_OP(op_invoke_CPU_im, { - typedef void (*func_t)(void *, uint32); - uintptr func; - MOV_AD_REG(PARAM1, func); - CALL(func, (CPU, PARAM2)); -}); - -DEFINE_OP(op_invoke_CPU_im_im, { - typedef void (*func_t)(void *, uint32, uint32); - uintptr func; - MOV_AD_REG(PARAM1, func); - CALL(func, (CPU, PARAM2, PARAM3)); -}); - -DEFINE_OP(op_invoke_CPU_A0_ret_A0, { - typedef void *(*func_t)(void *, uintptr); - uintptr func; - MOV_AD_REG(PARAM1, func); - A0 = (uintptr)CALL(func, (CPU, A0)); -}); - -DEFINE_OP(op_invoke_direct, { - typedef void (*func_t)(void); - CALL(PARAM1, ()); -}); - -DEFINE_OP(op_invoke_direct_T0, { - typedef void (*func_t)(uint32); - CALL(PARAM1, (T0)); -}); - -DEFINE_OP(op_invoke_direct_T0_T1, { - typedef void (*func_t)(uint32, uint32); - CALL(PARAM1, (T0, T1)); -}); - -DEFINE_OP(op_invoke_direct_T0_T1_T2, { - typedef void (*func_t)(uint32, uint32, uint32); - CALL(PARAM1, (T0, T1, T2)); -}); - -DEFINE_OP(op_invoke_direct_T0_ret_T0, { - typedef uint32 (*func_t)(uint32); - T0 = CALL(PARAM1, (T0)); -}); - -DEFINE_OP(op_invoke_direct_im, { - typedef void (*func_t)(uint32); - CALL(PARAM1, (PARAM2)); -}); - -DEFINE_OP(op_invoke_direct_CPU, { - typedef void (*func_t)(void *); - CALL(PARAM1, (CPU)); -}); - -DEFINE_OP(op_invoke_direct_CPU_T0, { - typedef void (*func_t)(void *, uint32); - CALL(PARAM1, (CPU, T0)); -}); - -DEFINE_OP(op_invoke_direct_CPU_im, { - typedef void (*func_t)(void *, uint32); - CALL(PARAM1, (CPU, PARAM2)); -}); - -DEFINE_OP(op_invoke_direct_CPU_im_im, { - typedef void (*func_t)(void *, uint32, uint32); - CALL(PARAM1, (CPU, PARAM2, PARAM3)); -}); - -DEFINE_OP(op_invoke_direct_CPU_A0_ret_A0, { - typedef void *(*func_t)(void *, uintptr); - A0 = (uintptr)CALL(PARAM1, (CPU, A0)); -}); - -#undef DEFINE_OP diff --git a/SheepShaver/src/kpx_cpu/src/cpu/jit/basic-dyngen.cpp b/SheepShaver/src/kpx_cpu/src/cpu/jit/basic-dyngen.cpp deleted file mode 100644 index 4d214b73..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/jit/basic-dyngen.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/* - * dyngen-glue.hpp - Glue to QEMU dyngen infrastructure - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" -#include "basic-dyngen.hpp" - -int __op_param1, __op_param2, __op_param3; -int __op_jmp0, __op_jmp1; - -#define DYNGEN_IMPL 1 -#define DEFINE_GEN(NAME,RET,ARGS) RET basic_dyngen::NAME ARGS -#include "basic-dyngen-ops.hpp" - -basic_dyngen::basic_dyngen(dyngen_cpu_base cpu) - : parent_cpu(cpu) -{ -} - -bool -basic_dyngen::initialize(void) -{ - if (!jit_codegen::initialize()) - return false; - - execute_func = gen_start(); - gen_op_execute(); - gen_end(); - set_code_start(code_ptr()); - -#if PPC_REENTRANT_JIT -#ifdef SHEEPSHAVER - extern void init_emul_op_trampolines(basic_dyngen & dg); - init_emul_op_trampolines(*this); - set_code_start(code_ptr()); -#endif -#endif - - return true; -} - -void -basic_dyngen::gen_invoke(void (*func)()) -{ - uintptr funcptr = (uintptr)func; - if (direct_call_possible(funcptr)) - gen_op_invoke_direct(funcptr); - else - gen_op_invoke(funcptr); -} - -#define DEFINE_INVOKE(NAME, ARGS, IARGS) \ -void \ -basic_dyngen::gen_invoke_##NAME ARGS \ -{ \ - uintptr funcptr = (uintptr)func; \ - if (direct_call_possible(funcptr)) \ - gen_op_invoke_direct_##NAME IARGS; \ - else \ - gen_op_invoke_##NAME IARGS; \ -} - -DEFINE_INVOKE(T0, (void (*func)(uint32)), (funcptr)); -DEFINE_INVOKE(T0_T1, (void (*func)(uint32, uint32)), (funcptr)); -DEFINE_INVOKE(T0_T1_T2, (void (*func)(uint32, uint32, uint32)), (funcptr)); -DEFINE_INVOKE(T0_ret_T0, (uint32 (*func)(uint32)), (funcptr)); -DEFINE_INVOKE(im, (void (*func)(uint32), uint32 value), (funcptr, value)); -DEFINE_INVOKE(CPU, (void (*func)(dyngen_cpu_base)), (funcptr)); -DEFINE_INVOKE(CPU_T0, (void (*func)(dyngen_cpu_base, uint32)), (funcptr)); -DEFINE_INVOKE(CPU_im, (void (*func)(dyngen_cpu_base, uint32), uint32 value), (funcptr, value)); -DEFINE_INVOKE(CPU_im_im, (void (*func)(dyngen_cpu_base, uint32, uint32), uint32 param1, uint32 param2), (funcptr, param1, param2)); -DEFINE_INVOKE(CPU_A0_ret_A0, (void *(*func)(dyngen_cpu_base)), (funcptr)); - -#undef DEFINE_INVOKE - -uint8 * -basic_dyngen::gen_align(int align) -{ - int nbytes = align - (((uintptr)code_ptr()) % align); - if (nbytes == 0) - return code_ptr(); - -#if defined(__i386__) || defined(__x86_64__) - /* Source: GNU Binutils 2.12.90.0.15 */ - /* Various efficient no-op patterns for aligning code labels. - Note: Don't try to assemble the instructions in the comments. - 0L and 0w are not legal. */ - static const uint8 f32_1[] = - {0x90}; /* nop */ - static const uint8 f32_2[] = - {0x89,0xf6}; /* movl %esi,%esi */ - static const uint8 f32_3[] = - {0x8d,0x76,0x00}; /* leal 0(%esi),%esi */ - static const uint8 f32_4[] = - {0x8d,0x74,0x26,0x00}; /* leal 0(%esi,1),%esi */ - static const uint8 f32_5[] = - {0x90, /* nop */ - 0x8d,0x74,0x26,0x00}; /* leal 0(%esi,1),%esi */ - static const uint8 f32_6[] = - {0x8d,0xb6,0x00,0x00,0x00,0x00}; /* leal 0L(%esi),%esi */ - static const uint8 f32_7[] = - {0x8d,0xb4,0x26,0x00,0x00,0x00,0x00}; /* leal 0L(%esi,1),%esi */ - static const uint8 f32_8[] = - {0x90, /* nop */ - 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00}; /* leal 0L(%esi,1),%esi */ - static const uint8 f32_9[] = - {0x89,0xf6, /* movl %esi,%esi */ - 0x8d,0xbc,0x27,0x00,0x00,0x00,0x00}; /* leal 0L(%edi,1),%edi */ - static const uint8 f32_10[] = - {0x8d,0x76,0x00, /* leal 0(%esi),%esi */ - 0x8d,0xbc,0x27,0x00,0x00,0x00,0x00}; /* leal 0L(%edi,1),%edi */ - static const uint8 f32_11[] = - {0x8d,0x74,0x26,0x00, /* leal 0(%esi,1),%esi */ - 0x8d,0xbc,0x27,0x00,0x00,0x00,0x00}; /* leal 0L(%edi,1),%edi */ - static const uint8 f32_12[] = - {0x8d,0xb6,0x00,0x00,0x00,0x00, /* leal 0L(%esi),%esi */ - 0x8d,0xbf,0x00,0x00,0x00,0x00}; /* leal 0L(%edi),%edi */ - static const uint8 f32_13[] = - {0x8d,0xb6,0x00,0x00,0x00,0x00, /* leal 0L(%esi),%esi */ - 0x8d,0xbc,0x27,0x00,0x00,0x00,0x00}; /* leal 0L(%edi,1),%edi */ - static const uint8 f32_14[] = - {0x8d,0xb4,0x26,0x00,0x00,0x00,0x00, /* leal 0L(%esi,1),%esi */ - 0x8d,0xbc,0x27,0x00,0x00,0x00,0x00}; /* leal 0L(%edi,1),%edi */ - static const uint8 f32_15[] = - {0xeb,0x0d,0x90,0x90,0x90,0x90,0x90, /* jmp .+15; lotsa nops */ - 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90}; - static const uint8 f32_16[] = - {0xeb,0x0d,0x90,0x90,0x90,0x90,0x90, /* jmp .+15; lotsa nops */ - 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90}; - static const uint8 *const f32_patt[] = { - f32_1, f32_2, f32_3, f32_4, f32_5, f32_6, f32_7, f32_8, - f32_9, f32_10, f32_11, f32_12, f32_13, f32_14, f32_15 - }; - static const uint8 prefixes[4] = { 0x66, 0x66, 0x66, 0x66 }; - -#if defined(__x86_64__) - /* The recommended way to pad 64bit code is to use NOPs preceded by - maximally four 0x66 prefixes. Balance the size of nops. */ - int i; - int nnops = (nbytes + 3) / 4; - int len = nbytes / nnops; - int remains = nbytes - nnops * len; - - for (i = 0; i < remains; i++) { - emit_block(prefixes, len); - emit_8(0x90); // NOP - } - for (; i < nnops; i++) { - emit_block(prefixes, len - 1); - emit_8(0x90); // NOP - } -#else - int nloops = nbytes / 16; - while (nloops-- > 0) - emit_block(f32_16, sizeof(f32_16)); - - nbytes %= 16; - if (nbytes) - emit_block(f32_patt[nbytes - 1], nbytes); -#endif -#else -#warning "FIXME: tune for your target" - for (int i = 0; i < nbytes; i++) - emit_8(0); -#endif - return code_ptr(); -} diff --git a/SheepShaver/src/kpx_cpu/src/cpu/jit/basic-dyngen.hpp b/SheepShaver/src/kpx_cpu/src/cpu/jit/basic-dyngen.hpp deleted file mode 100644 index f04cd5ef..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/jit/basic-dyngen.hpp +++ /dev/null @@ -1,374 +0,0 @@ -/* - * basic-dyngen.hpp - Basic code generator - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef BASIC_DYNGEN_H -#define BASIC_DYNGEN_H - -#include "cpu/jit/jit-config.hpp" -#include "cpu/jit/jit-codegen.hpp" - -// Set jump target address -static inline void dg_set_jmp_target_noflush(uint8 *jmp_addr, uint8 *addr) -{ -#if defined(__powerpc__) || defined(__ppc__) - // patch the branch destination - uint32 *ptr = (uint32 *)jmp_addr; - uint32 val = *ptr; - val = (val & ~0x03fffffc) | ((addr - jmp_addr) & 0x03fffffc); - *ptr = val; -#endif -#if defined(__i386__) || defined(__x86_64__) - // patch the branch destination - *(uint32 *)jmp_addr = addr - (jmp_addr + 4); -#endif -} - -static inline void dg_set_jmp_target(uint8 *jmp_addr, uint8 *addr) -{ - dg_set_jmp_target_noflush(jmp_addr, addr); -#if defined(__powerpc__) || defined(__ppc__) - // flush icache - asm volatile ("dcbst 0,%0" : : "r"(ptr) : "memory"); - asm volatile ("sync" : : : "memory"); - asm volatile ("icbi 0,%0" : : "r"(ptr) : "memory"); - asm volatile ("sync" : : : "memory"); - asm volatile ("isync" : : : "memory"); -#endif -} - -#ifdef SHEEPSHAVER -class powerpc_cpu; -typedef powerpc_cpu *dyngen_cpu_base; -#else -class basic_cpu; -typedef basic_cpu *dyngen_cpu_base; -#endif - -class basic_dyngen - : public jit_codegen -{ - uint8 *execute_func; - uint8 *gen_code_start; - dyngen_cpu_base parent_cpu; - - // Can we generate a direct call to target function? - bool direct_jump_possible(uintptr target) const; - bool direct_call_possible(uintptr target) const; - - // Generic code generators -# define DEFINE_CST(NAME,VALUE) static const unsigned long NAME = VALUE; -# define DEFINE_GEN(NAME,RET,ARGS) RET NAME ARGS; -# include "basic-dyngen-ops.hpp" - -public: - - // Constructor, parent CPU required - basic_dyngen(dyngen_cpu_base cpu); - - // Initialization - bool initialize(void); - - // Return CPU context associated to this code generator - dyngen_cpu_base cpu() const - { return parent_cpu; } - - // Align on ALIGN byte boundaries, ALIGN must be a power of 2 - uint8 *gen_align(int align = 16); - - // Start code generation of a new block - // Align on 16-byte boundaries - // Returns pointer to entry point - uint8 *gen_start(); - - // Stop code generation of the block - // Returns FALSE if translation cache is full - bool gen_end() const; - - // Execute compiled function at ENTRY_POINT - void execute(uint8 *entry_point); - - // Return from compiled code - void gen_exec_return(); - - // Function calls - void gen_jmp(const uint8 *target); - void gen_invoke(void (*func)(void)); - void gen_invoke_T0(void (*func)(uint32)); - void gen_invoke_T0_T1(void (*func)(uint32, uint32)); - void gen_invoke_T0_T1_T2(void (*func)(uint32, uint32, uint32)); - void gen_invoke_T0_ret_T0(uint32 (*func)(uint32)); - void gen_invoke_im(void (*func)(uint32), uint32 value); - void gen_invoke_CPU(void (*func)(dyngen_cpu_base)); - void gen_invoke_CPU_T0(void (*func)(dyngen_cpu_base, uint32)); - void gen_invoke_CPU_im(void (*func)(dyngen_cpu_base, uint32), uint32 value); - void gen_invoke_CPU_im_im(void (*func)(dyngen_cpu_base, uint32, uint32), uint32 param1, uint32 param2); - void gen_invoke_CPU_A0_ret_A0(void *(*func)(dyngen_cpu_base)); - - // Raw aliases -#define DEFINE_ALIAS_RAW(NAME, ARGLIST, ARGS) \ - void gen_##NAME ARGLIST { gen_op_##NAME ARGS; } - -#define DEFINE_ALIAS_0(NAME) DEFINE_ALIAS_RAW(NAME,(),()) -#define DEFINE_ALIAS_1(NAME) DEFINE_ALIAS_RAW(NAME,(long p1),(p1)) -#define DEFINE_ALIAS_2(NAME) DEFINE_ALIAS_RAW(NAME,(long p1,long p2),(p1,p2)) -#define DEFINE_ALIAS_3(NAME) DEFINE_ALIAS_RAW(NAME,(long p1,long p2,long p3),(p1,p2,p3)) -#define DEFINE_ALIAS(NAME, N) DEFINE_ALIAS_##N(NAME) - - // Register moves - void gen_mov_32_T0_im(int32 value); - DEFINE_ALIAS(mov_32_T0_T1,0); - DEFINE_ALIAS(mov_32_T0_T2,0); - void gen_mov_32_T1_im(int32 value); - DEFINE_ALIAS(mov_32_T1_T0,0); - DEFINE_ALIAS(mov_32_T1_T2,0); - void gen_mov_32_T2_im(int32 value); - DEFINE_ALIAS(mov_32_T2_T0,0); - DEFINE_ALIAS(mov_32_T2_T1,0); - DEFINE_ALIAS(mov_ad_A0_im,1); - DEFINE_ALIAS(mov_ad_A1_im,1); - DEFINE_ALIAS(mov_ad_A2_im,1); - - // Arithmetic operations - DEFINE_ALIAS(add_32_T0_T1,0); - DEFINE_ALIAS(add_32_T0_T2,0); - void gen_add_32_T0_im(int32 value); - DEFINE_ALIAS(sub_32_T0_T1,0); - DEFINE_ALIAS(sub_32_T0_T2,0); - void gen_sub_32_T0_im(int32 value); - DEFINE_ALIAS(add_32_T1_T0,0); - DEFINE_ALIAS(add_32_T1_T2,0); - void gen_add_32_T1_im(int32 value); - DEFINE_ALIAS(sub_32_T1_T0,0); - DEFINE_ALIAS(sub_32_T1_T2,0); - void gen_sub_32_T1_im(int32 value); - DEFINE_ALIAS(umul_32_T0_T1,0); - DEFINE_ALIAS(smul_32_T0_T1,0); - DEFINE_ALIAS(udiv_32_T0_T1,0); - DEFINE_ALIAS(sdiv_32_T0_T1,0); - DEFINE_ALIAS(xchg_32_T0_T1,0); - DEFINE_ALIAS(bswap_16_T0,0); - DEFINE_ALIAS(bswap_32_T0,0); - - // Logical operations - DEFINE_ALIAS(neg_32_T0,0); - DEFINE_ALIAS(not_32_T0,0); - DEFINE_ALIAS(not_32_T1,0); - DEFINE_ALIAS(and_32_T0_T1,0); - DEFINE_ALIAS(and_32_T0_im,1); - DEFINE_ALIAS(or_32_T0_T1,0); - DEFINE_ALIAS(or_32_T0_im,1); - DEFINE_ALIAS(xor_32_T0_T1,0); - DEFINE_ALIAS(xor_32_T0_im,1); - DEFINE_ALIAS(orc_32_T0_T1,0); - DEFINE_ALIAS(andc_32_T0_T1,0); - DEFINE_ALIAS(nand_32_T0_T1,0); - DEFINE_ALIAS(nor_32_T0_T1,0); - DEFINE_ALIAS(eqv_32_T0_T1,0); - - // Shift/Rotate operations - DEFINE_ALIAS(lsl_32_T0_T1,0); - DEFINE_ALIAS(lsl_32_T0_im,1); - DEFINE_ALIAS(lsr_32_T0_T1,0); - DEFINE_ALIAS(lsr_32_T0_im,1); - DEFINE_ALIAS(asr_32_T0_T1,0); - DEFINE_ALIAS(asr_32_T0_im,1); - DEFINE_ALIAS(rol_32_T0_T1,0); - DEFINE_ALIAS(rol_32_T0_im,1); - DEFINE_ALIAS(ror_32_T0_T1,0); - DEFINE_ALIAS(ror_32_T0_im,1); - - // Sign-/Zero-extension - DEFINE_ALIAS(se_16_32_T0,0); - DEFINE_ALIAS(se_16_32_T1,0); - DEFINE_ALIAS(ze_16_32_T0,0); - DEFINE_ALIAS(se_8_32_T0,0); - DEFINE_ALIAS(ze_8_32_T0,0); - - // Jump instructions - DEFINE_ALIAS(jmp_slow,1); - DEFINE_ALIAS(jmp_fast,1); - DEFINE_ALIAS(jmp_A0,0); - - // Load/Store instructions - DEFINE_ALIAS(load_u32_T0_T1_T2,0); - void gen_load_u32_T0_T1_im(int32 offset); - DEFINE_ALIAS(load_s32_T0_T1_T2,0); - void gen_load_s32_T0_T1_im(int32 offset); - DEFINE_ALIAS(load_u16_T0_T1_T2,0); - void gen_load_u16_T0_T1_im(int32 offset); - DEFINE_ALIAS(load_s16_T0_T1_T2,0); - void gen_load_s16_T0_T1_im(int32 offset); - DEFINE_ALIAS(load_u8_T0_T1_T2,0); - void gen_load_u8_T0_T1_im(int32 offset); - DEFINE_ALIAS(load_s8_T0_T1_T2,0); - void gen_load_s8_T0_T1_im(int32 offset); - DEFINE_ALIAS(store_32_T0_T1_T2,0); - void gen_store_32_T0_T1_im(int32 offset); - DEFINE_ALIAS(store_16_T0_T1_T2,0); - void gen_store_16_T0_T1_im(int32 offset); - DEFINE_ALIAS(store_8_T0_T1_T2,0); - void gen_store_8_T0_T1_im(int32 offset); - -#undef DEFINE_ALIAS -#undef DEFINE_ALIAS_0 -#undef DEFINE_ALIAS_1 -#undef DEFINE_ALIAS_2 -#undef DEFINE_ALIAS_3 -#undef DEFINE_ALIAS_RAW - - // Address of jump offset to patch for direct chaining - static const int MAX_JUMPS = 2; - uint8 *jmp_addr[MAX_JUMPS]; -}; - -inline bool -basic_dyngen::direct_jump_possible(uintptr target) const -{ -#if defined(__powerpc__) || defined(__ppc__) - const uintptr LI_OFFSET_MAX = 1 << 26; - return (((target - (uintptr)code_ptr()) < LI_OFFSET_MAX) || - (((uintptr)code_ptr() - target) < LI_OFFSET_MAX)); -#endif -#if defined(__i386__) - return true; -#endif -#if defined(__x86_64__) - const intptr offset = (intptr)target - (intptr)code_ptr() - sizeof(void *); - return offset <= 0xffffffff; -#endif - return false; -} - -inline void -basic_dyngen::gen_jmp(const uint8 *target_p) -{ - const uintptr target = (uintptr)target_p; - if (direct_jump_possible(target)) - gen_op_jmp_fast(target); - else - gen_op_jmp_slow(target); -} - -inline void -basic_dyngen::execute(uint8 *entry_point) -{ - typedef void (*func_t)(uint8 *, dyngen_cpu_base); - func_t func = (func_t)execute_func; - func(entry_point, parent_cpu); -} - -inline void -basic_dyngen::gen_exec_return() -{ - gen_jmp(execute_func + op_exec_return_offset); -} - -inline bool -basic_dyngen::direct_call_possible(uintptr target) const -{ -#if defined(__powerpc__) || defined(__ppc__) - const uintptr LI_OFFSET_MAX = 1 << 26; - return (((target - (uintptr)code_ptr()) < LI_OFFSET_MAX) || - (((uintptr)code_ptr() - target) < LI_OFFSET_MAX)); -#endif -#if defined(__i386__) - return true; -#endif -#if defined(__x86_64__) - const intptr offset = (intptr)target - (intptr)code_ptr() - sizeof(void *); - return offset <= 0xffffffff; -#endif - return false; -} - -inline uint8 * -basic_dyngen::gen_start() -{ - for (int i = 0; i < MAX_JUMPS; i++) - jmp_addr[i] = NULL; - gen_code_start = gen_align(); - return gen_code_start; -} - -inline bool -basic_dyngen::gen_end() const -{ - flush_icache_range((unsigned long)gen_code_start, (unsigned long)code_ptr()); - return !full_translation_cache(); -} - -#define DEFINE_OP(REG) \ -inline void \ -basic_dyngen::gen_mov_32_##REG##_im(int32 value) \ -{ \ - if (value == 0) \ - gen_op_mov_32_##REG##_0(); \ - else \ - gen_op_mov_32_##REG##_im(value); \ -} - -DEFINE_OP(T0); -DEFINE_OP(T1); -DEFINE_OP(T2); - -#undef DEFINE_OP - -#define DEFINE_OP(OP,REG) \ -inline void \ -basic_dyngen::gen_##OP##_32_##REG##_im(int32 value) \ -{ \ - if (value == 0) return; \ - else if (value == 1) gen_op_##OP##_32_##REG##_1(); \ - else if (value == 2) gen_op_##OP##_32_##REG##_2(); \ - else if (value == 4) gen_op_##OP##_32_##REG##_4(); \ - else if (value == 8) gen_op_##OP##_32_##REG##_8(); \ - else gen_op_##OP##_32_##REG##_im(value); \ -} - -DEFINE_OP(add,T0); -DEFINE_OP(add,T1); -DEFINE_OP(sub,T0); -DEFINE_OP(sub,T1); - -#undef DEFINE_OP - -#define DEFINE_OP(NAME,REG,SIZE) \ -inline void \ -basic_dyngen::gen_##NAME##_##SIZE##_##REG##_T1_im(int32 offset) \ -{ \ - if (offset == 0) \ - gen_op_##NAME##_##SIZE##_##REG##_T1_0(); \ - else \ - gen_op_##NAME##_##SIZE##_##REG##_T1_im(offset); \ -} - -DEFINE_OP(load,T0,u32); -DEFINE_OP(load,T0,s32); -DEFINE_OP(store,T0,32); -DEFINE_OP(load,T0,u16); -DEFINE_OP(load,T0,s16); -DEFINE_OP(store,T0,16); -DEFINE_OP(load,T0,u8); -DEFINE_OP(load,T0,s8); -DEFINE_OP(store,T0,8); - -#undef DEFINE_OP - -#endif /* BASIC_DYNGEN_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/jit/cxxdemangle.cpp b/SheepShaver/src/kpx_cpu/src/cpu/jit/cxxdemangle.cpp deleted file mode 100644 index e54c0f64..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/jit/cxxdemangle.cpp +++ /dev/null @@ -1,4495 +0,0 @@ -/* - * cxxdemangle.cpp - C++ demangler - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include - -#include "cxxdemangle.h" - -#if defined(__GNUC__) && (__GXX_ABI_VERSION > 0) -#include - -char * -cxx_demangle(const char *mangled_name, char *buf, size_t *n, int *status) -{ - return abi::__cxa_demangle(mangled_name, buf, n, status); -} -#else -/* Use demangler from libiberty */ -char *cplus_demangle (const char *mangled, int options); - -/* Options passed to cplus_demangle (in 2nd parameter). */ -#define DMGL_NO_OPTS 0 /* For readability... */ -#define DMGL_PARAMS (1 << 0) /* Include function args */ -#define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */ -#define DMGL_AUTO (1 << 8) -#define DMGL_GNU (1 << 9) -#define DMGL_LUCID (1 << 10) -#define DMGL_ARM (1 << 11) -#define DMGL_HP (1 << 12) -#define DMGL_EDG (1 << 13) - -#ifdef __GNUC__ -#define DMGL_COMPILER DMGL_GNU -#endif - -char * -cxx_demangle(const char *mangled_name, char *buf, size_t *n, int *status) -{ - if (mangled_name == NULL || (buf != NULL && n == NULL)) { - if (status) - *status = -3; - return NULL; - } - - char *demangled = cplus_demangle(mangled_name, DMGL_COMPILER | DMGL_PARAMS | DMGL_ANSI); - if (demangled == NULL) { - if (status) - *status = -2; - return NULL; - } - else { - int len = strlen(demangled) + 1; - if (buf && n) { - if (len <= *n) - strcpy(buf, demangled); - else { - if (status) - *status = -1; - return NULL; - } - } - } - - if (status) - *status = 0; - return demangled; -} - -#include -#define xmalloc(size) malloc(size) -#define xrealloc(ptr, size) realloc(ptr, size) - -#include -#define ISDIGIT(c) isdigit(c) -#define ISLOWER(c) islower(c) - -/* ANSI and traditional C compatability macros - Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. - This file is part of the GNU C Library. */ - -#define PARAMS(ARGS) ARGS - -/* Define macros for some gcc attributes. This permits us to use the - macros freely, and know that they will come into play for the - version of gcc in which they are supported. */ - -#ifndef ATTRIBUTE_UNUSED -#define ATTRIBUTE_UNUSED -#endif /* ATTRIBUTE_UNUSED */ - -#ifndef ATTRIBUTE_NORETURN -#define ATTRIBUTE_NORETURN -#endif /* ATTRIBUTE_NORETURN */ - -/* Demangler for GNU C++ - Copyright 1989, 1991, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001 Free Software Foundation, Inc. - Written by James Clark (jjc@jclark.uucp) - Rewritten by Fred Fish (fnf@cygnus.com) for ARM and Lucid demangling - Modified by Satish Pai (pai@apollo.hp.com) for HP demangling - -This file is part of the libiberty library. */ - -/* This file exports two functions; cplus_mangle_opname and cplus_demangle. - - This file imports xmalloc and xrealloc, which are like malloc and - realloc except that they generate a fatal error if there is no - available memory. */ - -/* This file lives in both GCC and libiberty. When making changes, please - try not to break either. */ - -#undef CURRENT_DEMANGLING_STYLE -#define CURRENT_DEMANGLING_STYLE work->options - -#define AUTO_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_AUTO) -#define GNU_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU) -#define LUCID_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_LUCID) -#define ARM_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_ARM) -#define HP_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_HP) -#define EDG_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_EDG) -#define GNU_V3_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU_V3) - -#define min(X,Y) (((X) < (Y)) ? (X) : (Y)) - -/* A value at least one greater than the maximum number of characters - that will be output when using the `%d' format with `printf'. */ -#define INTBUF_SIZE 32 - -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) -#endif - -extern void fancy_abort PARAMS ((void)) ATTRIBUTE_NORETURN; - -/* In order to allow a single demangler executable to demangle strings - using various common values of CPLUS_MARKER, as well as any specific - one set at compile time, we maintain a string containing all the - commonly used ones, and check to see if the marker we are looking for - is in that string. CPLUS_MARKER is usually '$' on systems where the - assembler can deal with that. Where the assembler can't, it's usually - '.' (but on many systems '.' is used for other things). We put the - current defined CPLUS_MARKER first (which defaults to '$'), followed - by the next most common value, followed by an explicit '$' in case - the value of CPLUS_MARKER is not '$'. - - We could avoid this if we could just get g++ to tell us what the actual - cplus marker character is as part of the debug information, perhaps by - ensuring that it is the character that terminates the gcc_compiled - marker symbol (FIXME). */ - -#if !defined (CPLUS_MARKER) -#define CPLUS_MARKER '$' -#endif - -static char cplus_markers[] = { CPLUS_MARKER, '.', '$', '\0' }; - -static char char_str[2] = { '\000', '\000' }; - -typedef struct string /* Beware: these aren't required to be */ -{ /* '\0' terminated. */ - char *b; /* pointer to start of string */ - char *p; /* pointer after last character */ - char *e; /* pointer after end of allocated space */ -} string; - -/* Stuff that is shared between sub-routines. - Using a shared structure allows cplus_demangle to be reentrant. */ - -struct work_stuff -{ - int options; - char **typevec; - char **ktypevec; - char **btypevec; - int numk; - int numb; - int ksize; - int bsize; - int ntypes; - int typevec_size; - int constructor; - int destructor; - int static_type; /* A static member function */ - int temp_start; /* index in demangled to start of template args */ - int type_quals; /* The type qualifiers. */ - int dllimported; /* Symbol imported from a PE DLL */ - char **tmpl_argvec; /* Template function arguments. */ - int ntmpl_args; /* The number of template function arguments. */ - int forgetting_types; /* Nonzero if we are not remembering the types - we see. */ - string* previous_argument; /* The last function argument demangled. */ - int nrepeats; /* The number of times to repeat the previous - argument. */ -}; - -#define PRINT_ANSI_QUALIFIERS (work -> options & DMGL_ANSI) -#define PRINT_ARG_TYPES (work -> options & DMGL_PARAMS) - -static const struct optable -{ - const char *const in; - const char *const out; - const int flags; -} optable[] = { - {"nw", " new", DMGL_ANSI}, /* new (1.92, ansi) */ - {"dl", " delete", DMGL_ANSI}, /* new (1.92, ansi) */ - {"new", " new", 0}, /* old (1.91, and 1.x) */ - {"delete", " delete", 0}, /* old (1.91, and 1.x) */ - {"vn", " new []", DMGL_ANSI}, /* GNU, pending ansi */ - {"vd", " delete []", DMGL_ANSI}, /* GNU, pending ansi */ - {"as", "=", DMGL_ANSI}, /* ansi */ - {"ne", "!=", DMGL_ANSI}, /* old, ansi */ - {"eq", "==", DMGL_ANSI}, /* old, ansi */ - {"ge", ">=", DMGL_ANSI}, /* old, ansi */ - {"gt", ">", DMGL_ANSI}, /* old, ansi */ - {"le", "<=", DMGL_ANSI}, /* old, ansi */ - {"lt", "<", DMGL_ANSI}, /* old, ansi */ - {"plus", "+", 0}, /* old */ - {"pl", "+", DMGL_ANSI}, /* ansi */ - {"apl", "+=", DMGL_ANSI}, /* ansi */ - {"minus", "-", 0}, /* old */ - {"mi", "-", DMGL_ANSI}, /* ansi */ - {"ami", "-=", DMGL_ANSI}, /* ansi */ - {"mult", "*", 0}, /* old */ - {"ml", "*", DMGL_ANSI}, /* ansi */ - {"amu", "*=", DMGL_ANSI}, /* ansi (ARM/Lucid) */ - {"aml", "*=", DMGL_ANSI}, /* ansi (GNU/g++) */ - {"convert", "+", 0}, /* old (unary +) */ - {"negate", "-", 0}, /* old (unary -) */ - {"trunc_mod", "%", 0}, /* old */ - {"md", "%", DMGL_ANSI}, /* ansi */ - {"amd", "%=", DMGL_ANSI}, /* ansi */ - {"trunc_div", "/", 0}, /* old */ - {"dv", "/", DMGL_ANSI}, /* ansi */ - {"adv", "/=", DMGL_ANSI}, /* ansi */ - {"truth_andif", "&&", 0}, /* old */ - {"aa", "&&", DMGL_ANSI}, /* ansi */ - {"truth_orif", "||", 0}, /* old */ - {"oo", "||", DMGL_ANSI}, /* ansi */ - {"truth_not", "!", 0}, /* old */ - {"nt", "!", DMGL_ANSI}, /* ansi */ - {"postincrement","++", 0}, /* old */ - {"pp", "++", DMGL_ANSI}, /* ansi */ - {"postdecrement","--", 0}, /* old */ - {"mm", "--", DMGL_ANSI}, /* ansi */ - {"bit_ior", "|", 0}, /* old */ - {"or", "|", DMGL_ANSI}, /* ansi */ - {"aor", "|=", DMGL_ANSI}, /* ansi */ - {"bit_xor", "^", 0}, /* old */ - {"er", "^", DMGL_ANSI}, /* ansi */ - {"aer", "^=", DMGL_ANSI}, /* ansi */ - {"bit_and", "&", 0}, /* old */ - {"ad", "&", DMGL_ANSI}, /* ansi */ - {"aad", "&=", DMGL_ANSI}, /* ansi */ - {"bit_not", "~", 0}, /* old */ - {"co", "~", DMGL_ANSI}, /* ansi */ - {"call", "()", 0}, /* old */ - {"cl", "()", DMGL_ANSI}, /* ansi */ - {"alshift", "<<", 0}, /* old */ - {"ls", "<<", DMGL_ANSI}, /* ansi */ - {"als", "<<=", DMGL_ANSI}, /* ansi */ - {"arshift", ">>", 0}, /* old */ - {"rs", ">>", DMGL_ANSI}, /* ansi */ - {"ars", ">>=", DMGL_ANSI}, /* ansi */ - {"component", "->", 0}, /* old */ - {"pt", "->", DMGL_ANSI}, /* ansi; Lucid C++ form */ - {"rf", "->", DMGL_ANSI}, /* ansi; ARM/GNU form */ - {"indirect", "*", 0}, /* old */ - {"method_call", "->()", 0}, /* old */ - {"addr", "&", 0}, /* old (unary &) */ - {"array", "[]", 0}, /* old */ - {"vc", "[]", DMGL_ANSI}, /* ansi */ - {"compound", ", ", 0}, /* old */ - {"cm", ", ", DMGL_ANSI}, /* ansi */ - {"cond", "?:", 0}, /* old */ - {"cn", "?:", DMGL_ANSI}, /* pseudo-ansi */ - {"max", ">?", 0}, /* old */ - {"mx", ">?", DMGL_ANSI}, /* pseudo-ansi */ - {"min", "*", DMGL_ANSI}, /* ansi */ - {"sz", "sizeof ", DMGL_ANSI} /* pseudo-ansi */ -}; - -/* These values are used to indicate the various type varieties. - They are all non-zero so that they can be used as `success' - values. */ -typedef enum type_kind_t -{ - tk_none, - tk_pointer, - tk_reference, - tk_integral, - tk_bool, - tk_char, - tk_real -} type_kind_t; - -#define STRING_EMPTY(str) ((str) -> b == (str) -> p) -#define PREPEND_BLANK(str) {if (!STRING_EMPTY(str)) \ - string_prepend(str, " ");} -#define APPEND_BLANK(str) {if (!STRING_EMPTY(str)) \ - string_append(str, " ");} -#define LEN_STRING(str) ( (STRING_EMPTY(str))?0:((str)->p - (str)->b)) - -/* The scope separator appropriate for the language being demangled. */ - -#define SCOPE_STRING(work) "::" - -#define ARM_VTABLE_STRING "__vtbl__" /* Lucid/ARM virtual table prefix */ -#define ARM_VTABLE_STRLEN 8 /* strlen (ARM_VTABLE_STRING) */ - -/* Prototypes for local functions */ - -static void -delete_work_stuff PARAMS ((work_stuff *)); - -static void -delete_non_B_K_work_stuff PARAMS ((work_stuff *)); - -static char * -mop_up PARAMS ((work_stuff *, string *, int)); - -static void -squangle_mop_up PARAMS ((work_stuff *)); - -static void -work_stuff_copy_to_from PARAMS ((work_stuff *, work_stuff *)); - -static char * -internal_cplus_demangle PARAMS ((work_stuff *, const char *)); - -static int -demangle_template_template_parm PARAMS ((work_stuff *work, - const char **, string *)); - -static int -demangle_template PARAMS ((work_stuff *work, const char **, string *, - string *, int, int)); - -static int -arm_pt PARAMS ((work_stuff *, const char *, int, const char **, - const char **)); - -static int -demangle_class_name PARAMS ((work_stuff *, const char **, string *)); - -static int -demangle_qualified PARAMS ((work_stuff *, const char **, string *, - int, int)); - -static int -demangle_class PARAMS ((work_stuff *, const char **, string *)); - -static int -demangle_fund_type PARAMS ((work_stuff *, const char **, string *)); - -static int -demangle_signature PARAMS ((work_stuff *, const char **, string *)); - -static int -demangle_prefix PARAMS ((work_stuff *, const char **, string *)); - -static int -gnu_special PARAMS ((work_stuff *, const char **, string *)); - -static int -arm_special PARAMS ((const char **, string *)); - -static void -string_need PARAMS ((string *, int)); - -static void -string_delete PARAMS ((string *)); - -static void -string_init PARAMS ((string *)); - -static void -string_clear PARAMS ((string *)); - -static void -string_append PARAMS ((string *, const char *)); - -static void -string_appends PARAMS ((string *, string *)); - -static void -string_appendn PARAMS ((string *, const char *, int)); - -static void -string_prepend PARAMS ((string *, const char *)); - -static void -string_prependn PARAMS ((string *, const char *, int)); - -static void -string_append_template_idx PARAMS ((string *, int)); - -static int -get_count PARAMS ((const char **, int *)); - -static int -consume_count PARAMS ((const char **)); - -static int -consume_count_with_underscores PARAMS ((const char**)); - -static int -demangle_args PARAMS ((work_stuff *, const char **, string *)); - -static int -demangle_nested_args PARAMS ((work_stuff*, const char**, string*)); - -static int -do_type PARAMS ((work_stuff *, const char **, string *)); - -static int -do_arg PARAMS ((work_stuff *, const char **, string *)); - -static void -demangle_function_name PARAMS ((work_stuff *, const char **, string *, - const char *)); - -static int -iterate_demangle_function PARAMS ((work_stuff *, - const char **, string *, const char *)); - -static void -remember_type PARAMS ((work_stuff *, const char *, int)); - -static void -remember_Btype PARAMS ((work_stuff *, const char *, int, int)); - -static int -register_Btype PARAMS ((work_stuff *)); - -static void -remember_Ktype PARAMS ((work_stuff *, const char *, int)); - -static void -forget_types PARAMS ((work_stuff *)); - -static void -forget_B_and_K_types PARAMS ((work_stuff *)); - -static void -string_prepends PARAMS ((string *, string *)); - -static int -demangle_template_value_parm PARAMS ((work_stuff*, const char**, - string*, type_kind_t)); - -static int -do_hpacc_template_const_value PARAMS ((work_stuff *, const char **, string *)); - -static int -do_hpacc_template_literal PARAMS ((work_stuff *, const char **, string *)); - -static int -snarf_numeric_literal PARAMS ((const char **, string *)); - -/* There is a TYPE_QUAL value for each type qualifier. They can be - combined by bitwise-or to form the complete set of qualifiers for a - type. */ - -#define TYPE_UNQUALIFIED 0x0 -#define TYPE_QUAL_CONST 0x1 -#define TYPE_QUAL_VOLATILE 0x2 -#define TYPE_QUAL_RESTRICT 0x4 - -static int -code_for_qualifier PARAMS ((int)); - -static const char* -qualifier_string PARAMS ((int)); - -static const char* -demangle_qualifier PARAMS ((int)); - -static int -demangle_expression PARAMS ((work_stuff *, const char **, string *, - type_kind_t)); - -static int -demangle_integral_value PARAMS ((work_stuff *, const char **, - string *)); - -static int -demangle_real_value PARAMS ((work_stuff *, const char **, string *)); - -static void -demangle_arm_hp_template PARAMS ((work_stuff *, const char **, int, - string *)); - -static void -recursively_demangle PARAMS ((work_stuff *, const char **, string *, - int)); - -static void -grow_vect PARAMS ((void **, size_t *, size_t, int)); - -/* Translate count to integer, consuming tokens in the process. - Conversion terminates on the first non-digit character. - - Trying to consume something that isn't a count results in no - consumption of input and a return of -1. - - Overflow consumes the rest of the digits, and returns -1. */ - -static int -consume_count (const char **type) -{ - int count = 0; - - if (! ISDIGIT ((unsigned char)**type)) - return -1; - - while (ISDIGIT ((unsigned char)**type)) - { - count *= 10; - - /* Check for overflow. - We assume that count is represented using two's-complement; - no power of two is divisible by ten, so if an overflow occurs - when multiplying by ten, the result will not be a multiple of - ten. */ - if ((count % 10) != 0) - { - while (ISDIGIT ((unsigned char) **type)) - (*type)++; - return -1; - } - - count += **type - '0'; - (*type)++; - } - - if (count < 0) - count = -1; - - return (count); -} - - -/* Like consume_count, but for counts that are preceded and followed - by '_' if they are greater than 10. Also, -1 is returned for - failure, since 0 can be a valid value. */ - -static int -consume_count_with_underscores (const char **mangled) -{ - int idx; - - if (**mangled == '_') - { - (*mangled)++; - if (!ISDIGIT ((unsigned char)**mangled)) - return -1; - - idx = consume_count (mangled); - if (**mangled != '_') - /* The trailing underscore was missing. */ - return -1; - - (*mangled)++; - } - else - { - if (**mangled < '0' || **mangled > '9') - return -1; - - idx = **mangled - '0'; - (*mangled)++; - } - - return idx; -} - -/* C is the code for a type-qualifier. Return the TYPE_QUAL - corresponding to this qualifier. */ - -static int -code_for_qualifier (int c) -{ - switch (c) - { - case 'C': - return TYPE_QUAL_CONST; - - case 'V': - return TYPE_QUAL_VOLATILE; - - case 'u': - return TYPE_QUAL_RESTRICT; - - default: - break; - } - - /* C was an invalid qualifier. */ - abort (); -} - -/* Return the string corresponding to the qualifiers given by - TYPE_QUALS. */ - -static const char* -qualifier_string (int type_quals) -{ - switch (type_quals) - { - case TYPE_UNQUALIFIED: - return ""; - - case TYPE_QUAL_CONST: - return "const"; - - case TYPE_QUAL_VOLATILE: - return "volatile"; - - case TYPE_QUAL_RESTRICT: - return "__restrict"; - - case TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE: - return "const volatile"; - - case TYPE_QUAL_CONST | TYPE_QUAL_RESTRICT: - return "const __restrict"; - - case TYPE_QUAL_VOLATILE | TYPE_QUAL_RESTRICT: - return "volatile __restrict"; - - case TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE | TYPE_QUAL_RESTRICT: - return "const volatile __restrict"; - - default: - break; - } - - /* TYPE_QUALS was an invalid qualifier set. */ - abort (); -} - -/* C is the code for a type-qualifier. Return the string - corresponding to this qualifier. This function should only be - called with a valid qualifier code. */ - -static const char* -demangle_qualifier (int c) -{ - return qualifier_string (code_for_qualifier (c)); -} - - -/* char *cplus_demangle (const char *mangled, int options) - - If MANGLED is a mangled function name produced by GNU C++, then - a pointer to a @code{malloc}ed string giving a C++ representation - of the name will be returned; otherwise NULL will be returned. - It is the caller's responsibility to free the string which - is returned. - - The OPTIONS arg may contain one or more of the following bits: - - DMGL_ANSI ANSI qualifiers such as `const' and `void' are - included. - DMGL_PARAMS Function parameters are included. - - For example, - - cplus_demangle ("foo__1Ai", DMGL_PARAMS) => "A::foo(int)" - cplus_demangle ("foo__1Ai", DMGL_PARAMS | DMGL_ANSI) => "A::foo(int)" - cplus_demangle ("foo__1Ai", 0) => "A::foo" - - cplus_demangle ("foo__1Afe", DMGL_PARAMS) => "A::foo(float,...)" - cplus_demangle ("foo__1Afe", DMGL_PARAMS | DMGL_ANSI)=> "A::foo(float,...)" - cplus_demangle ("foo__1Afe", 0) => "A::foo" - - Note that any leading underscores, or other such characters prepended by - the compilation system, are presumed to have already been stripped from - MANGLED. */ - -char * -cplus_demangle (const char *mangled, int options) -{ - char *ret; - work_stuff work[1]; - - memset ((char *) work, 0, sizeof (work)); - work->options = options; - ret = internal_cplus_demangle (work, mangled); - squangle_mop_up (work); - return (ret); -} - - -/* Assuming *OLD_VECT points to an array of *SIZE objects of size - ELEMENT_SIZE, grow it to contain at least MIN_SIZE objects, - updating *OLD_VECT and *SIZE as necessary. */ - -static void -grow_vect (void **old_vect, size_t *size, size_t min_size, int element_size) -{ - if (*size < min_size) - { - *size *= 2; - if (*size < min_size) - *size = min_size; - *old_vect = (char *) xrealloc (*old_vect, *size * element_size); - } -} - -/* This function performs most of what cplus_demangle use to do, but - to be able to demangle a name with a B, K or n code, we need to - have a longer term memory of what types have been seen. The original - now initializes and cleans up the squangle code info, while internal - calls go directly to this routine to avoid resetting that info. */ - -static char * -internal_cplus_demangle (work_stuff *work, const char *mangled) -{ - - string decl; - int success = 0; - char *demangled = NULL; - int s1, s2, s3, s4; - s1 = work->constructor; - s2 = work->destructor; - s3 = work->static_type; - s4 = work->type_quals; - work->constructor = work->destructor = 0; - work->type_quals = TYPE_UNQUALIFIED; - work->dllimported = 0; - - if ((mangled != NULL) && (*mangled != '\0')) - { - string_init (&decl); - - /* First check to see if gnu style demangling is active and if the - string to be demangled contains a CPLUS_MARKER. If so, attempt to - recognize one of the gnu special forms rather than looking for a - standard prefix. In particular, don't worry about whether there - is a "__" string in the mangled string. Consider "_$_5__foo" for - example. */ - - if ((AUTO_DEMANGLING || GNU_DEMANGLING)) - { - success = gnu_special (work, &mangled, &decl); - } - if (!success) - { - success = demangle_prefix (work, &mangled, &decl); - } - if (success && (*mangled != '\0')) - { - success = demangle_signature (work, &mangled, &decl); - } - if (work->constructor == 2) - { - string_prepend (&decl, "global constructors keyed to "); - work->constructor = 0; - } - else if (work->destructor == 2) - { - string_prepend (&decl, "global destructors keyed to "); - work->destructor = 0; - } - else if (work->dllimported == 1) - { - string_prepend (&decl, "import stub for "); - work->dllimported = 0; - } - demangled = mop_up (work, &decl, success); - } - work->constructor = s1; - work->destructor = s2; - work->static_type = s3; - work->type_quals = s4; - return demangled; -} - - -/* Clear out and squangling related storage */ -static void -squangle_mop_up (work_stuff *work) -{ - /* clean up the B and K type mangling types. */ - forget_B_and_K_types (work); - if (work -> btypevec != NULL) - { - free ((char *) work -> btypevec); - } - if (work -> ktypevec != NULL) - { - free ((char *) work -> ktypevec); - } -} - - -/* Copy the work state and storage. */ - -static void -work_stuff_copy_to_from (work_stuff *to, work_stuff *from) -{ - int i; - - delete_work_stuff (to); - - /* Shallow-copy scalars. */ - memcpy (to, from, sizeof (*to)); - - /* Deep-copy dynamic storage. */ - if (from->typevec_size) - to->typevec - = (char **) xmalloc (from->typevec_size * sizeof (to->typevec[0])); - - for (i = 0; i < from->ntypes; i++) - { - int len = strlen (from->typevec[i]) + 1; - - to->typevec[i] = (char *) xmalloc (len); - memcpy (to->typevec[i], from->typevec[i], len); - } - - if (from->ksize) - to->ktypevec - = (char **) xmalloc (from->ksize * sizeof (to->ktypevec[0])); - - for (i = 0; i < from->numk; i++) - { - int len = strlen (from->ktypevec[i]) + 1; - - to->ktypevec[i] = (char *) xmalloc (len); - memcpy (to->ktypevec[i], from->ktypevec[i], len); - } - - if (from->bsize) - to->btypevec - = (char **) xmalloc (from->bsize * sizeof (to->btypevec[0])); - - for (i = 0; i < from->numb; i++) - { - int len = strlen (from->btypevec[i]) + 1; - - to->btypevec[i] = (char *) xmalloc (len); - memcpy (to->btypevec[i], from->btypevec[i], len); - } - - if (from->ntmpl_args) - to->tmpl_argvec - = (char **) xmalloc (from->ntmpl_args * sizeof (to->tmpl_argvec[0])); - - for (i = 0; i < from->ntmpl_args; i++) - { - int len = strlen (from->tmpl_argvec[i]) + 1; - - to->tmpl_argvec[i] = (char *) xmalloc (len); - memcpy (to->tmpl_argvec[i], from->tmpl_argvec[i], len); - } - - if (from->previous_argument) - { - to->previous_argument = (string*) xmalloc (sizeof (string)); - string_init (to->previous_argument); - string_appends (to->previous_argument, from->previous_argument); - } -} - - -/* Delete dynamic stuff in work_stuff that is not to be re-used. */ - -static void -delete_non_B_K_work_stuff (work_stuff *work) -{ - /* Discard the remembered types, if any. */ - - forget_types (work); - if (work -> typevec != NULL) - { - free ((char *) work -> typevec); - work -> typevec = NULL; - work -> typevec_size = 0; - } - if (work->tmpl_argvec) - { - int i; - - for (i = 0; i < work->ntmpl_args; i++) - if (work->tmpl_argvec[i]) - free ((char*) work->tmpl_argvec[i]); - - free ((char*) work->tmpl_argvec); - work->tmpl_argvec = NULL; - } - if (work->previous_argument) - { - string_delete (work->previous_argument); - free ((char*) work->previous_argument); - work->previous_argument = NULL; - } -} - - -/* Delete all dynamic storage in work_stuff. */ -static void -delete_work_stuff (work_stuff *work) -{ - delete_non_B_K_work_stuff (work); - squangle_mop_up (work); -} - - -/* Clear out any mangled storage */ - -static char * -mop_up (work_stuff *work, string *declp, int success) -{ - char *demangled = NULL; - - delete_non_B_K_work_stuff (work); - - /* If demangling was successful, ensure that the demangled string is null - terminated and return it. Otherwise, free the demangling decl. */ - - if (!success) - { - string_delete (declp); - } - else - { - string_appendn (declp, "", 1); - demangled = declp->b; - } - return (demangled); -} - -/* - -LOCAL FUNCTION - - demangle_signature -- demangle the signature part of a mangled name - -SYNOPSIS - - static int - demangle_signature (work_stuff *work, const char **mangled, - string *declp); - -DESCRIPTION - - Consume and demangle the signature portion of the mangled name. - - DECLP is the string where demangled output is being built. At - entry it contains the demangled root name from the mangled name - prefix. I.E. either a demangled operator name or the root function - name. In some special cases, it may contain nothing. - - *MANGLED points to the current unconsumed location in the mangled - name. As tokens are consumed and demangling is performed, the - pointer is updated to continuously point at the next token to - be consumed. - - Demangling GNU style mangled names is nasty because there is no - explicit token that marks the start of the outermost function - argument list. */ - -static int -demangle_signature (work_stuff *work, const char **mangled, string *declp) -{ - int success = 1; - int func_done = 0; - int expect_func = 0; - int expect_return_type = 0; - const char *oldmangled = NULL; - string trawname; - string tname; - - while (success && (**mangled != '\0')) - { - switch (**mangled) - { - case 'Q': - oldmangled = *mangled; - success = demangle_qualified (work, mangled, declp, 1, 0); - if (success) - remember_type (work, oldmangled, *mangled - oldmangled); - if (AUTO_DEMANGLING || GNU_DEMANGLING) - expect_func = 1; - oldmangled = NULL; - break; - - case 'K': - oldmangled = *mangled; - success = demangle_qualified (work, mangled, declp, 1, 0); - if (AUTO_DEMANGLING || GNU_DEMANGLING) - { - expect_func = 1; - } - oldmangled = NULL; - break; - - case 'S': - /* Static member function */ - if (oldmangled == NULL) - { - oldmangled = *mangled; - } - (*mangled)++; - work -> static_type = 1; - break; - - case 'C': - case 'V': - case 'u': - work->type_quals |= code_for_qualifier (**mangled); - - /* a qualified member function */ - if (oldmangled == NULL) - oldmangled = *mangled; - (*mangled)++; - break; - - case 'L': - /* Local class name follows after "Lnnn_" */ - if (HP_DEMANGLING) - { - while (**mangled && (**mangled != '_')) - (*mangled)++; - if (!**mangled) - success = 0; - else - (*mangled)++; - } - else - success = 0; - break; - - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - if (oldmangled == NULL) - { - oldmangled = *mangled; - } - work->temp_start = -1; /* uppermost call to demangle_class */ - success = demangle_class (work, mangled, declp); - if (success) - { - remember_type (work, oldmangled, *mangled - oldmangled); - } - if (AUTO_DEMANGLING || GNU_DEMANGLING || EDG_DEMANGLING) - { - /* EDG and others will have the "F", so we let the loop cycle - if we are looking at one. */ - if (**mangled != 'F') - expect_func = 1; - } - oldmangled = NULL; - break; - - case 'B': - { - string s; - success = do_type (work, mangled, &s); - if (success) - { - string_append (&s, SCOPE_STRING (work)); - string_prepends (declp, &s); - } - oldmangled = NULL; - expect_func = 1; - } - break; - - case 'F': - /* Function */ - /* ARM/HP style demangling includes a specific 'F' character after - the class name. For GNU style, it is just implied. So we can - safely just consume any 'F' at this point and be compatible - with either style. */ - - oldmangled = NULL; - func_done = 1; - (*mangled)++; - - /* For lucid/ARM/HP style we have to forget any types we might - have remembered up to this point, since they were not argument - types. GNU style considers all types seen as available for - back references. See comment in demangle_args() */ - - if (LUCID_DEMANGLING || ARM_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING) - { - forget_types (work); - } - success = demangle_args (work, mangled, declp); - /* After picking off the function args, we expect to either - find the function return type (preceded by an '_') or the - end of the string. */ - if (success && (AUTO_DEMANGLING || EDG_DEMANGLING) && **mangled == '_') - { - ++(*mangled); - /* At this level, we do not care about the return type. */ - success = do_type (work, mangled, &tname); - string_delete (&tname); - } - - break; - - case 't': - /* G++ Template */ - string_init(&trawname); - string_init(&tname); - if (oldmangled == NULL) - { - oldmangled = *mangled; - } - success = demangle_template (work, mangled, &tname, - &trawname, 1, 1); - if (success) - { - remember_type (work, oldmangled, *mangled - oldmangled); - } - string_append (&tname, SCOPE_STRING (work)); - - string_prepends(declp, &tname); - if (work -> destructor & 1) - { - string_prepend (&trawname, "~"); - string_appends (declp, &trawname); - work->destructor -= 1; - } - if ((work->constructor & 1) || (work->destructor & 1)) - { - string_appends (declp, &trawname); - work->constructor -= 1; - } - string_delete(&trawname); - string_delete(&tname); - oldmangled = NULL; - expect_func = 1; - break; - - case '_': - if ((AUTO_DEMANGLING || GNU_DEMANGLING) && expect_return_type) - { - /* Read the return type. */ - string return_type; - string_init (&return_type); - - (*mangled)++; - success = do_type (work, mangled, &return_type); - APPEND_BLANK (&return_type); - - string_prepends (declp, &return_type); - string_delete (&return_type); - break; - } - else - /* At the outermost level, we cannot have a return type specified, - so if we run into another '_' at this point we are dealing with - a mangled name that is either bogus, or has been mangled by - some algorithm we don't know how to deal with. So just - reject the entire demangling. */ - /* However, "_nnn" is an expected suffix for alternate entry point - numbered nnn for a function, with HP aCC, so skip over that - without reporting failure. pai/1997-09-04 */ - if (HP_DEMANGLING) - { - (*mangled)++; - while (**mangled && ISDIGIT ((unsigned char)**mangled)) - (*mangled)++; - } - else - success = 0; - break; - - case 'H': - if (AUTO_DEMANGLING || GNU_DEMANGLING) - { - /* A G++ template function. Read the template arguments. */ - success = demangle_template (work, mangled, declp, 0, 0, - 0); - if (!(work->constructor & 1)) - expect_return_type = 1; - (*mangled)++; - break; - } - else - /* fall through */ - {;} - - default: - if (AUTO_DEMANGLING || GNU_DEMANGLING) - { - /* Assume we have stumbled onto the first outermost function - argument token, and start processing args. */ - func_done = 1; - success = demangle_args (work, mangled, declp); - } - else - { - /* Non-GNU demanglers use a specific token to mark the start - of the outermost function argument tokens. Typically 'F', - for ARM/HP-demangling, for example. So if we find something - we are not prepared for, it must be an error. */ - success = 0; - } - break; - } - /* - if (AUTO_DEMANGLING || GNU_DEMANGLING) - */ - { - if (success && expect_func) - { - func_done = 1; - if (LUCID_DEMANGLING || ARM_DEMANGLING || EDG_DEMANGLING) - { - forget_types (work); - } - success = demangle_args (work, mangled, declp); - /* Since template include the mangling of their return types, - we must set expect_func to 0 so that we don't try do - demangle more arguments the next time we get here. */ - expect_func = 0; - } - } - } - if (success && !func_done) - { - if (AUTO_DEMANGLING || GNU_DEMANGLING) - { - /* With GNU style demangling, bar__3foo is 'foo::bar(void)', and - bar__3fooi is 'foo::bar(int)'. We get here when we find the - first case, and need to ensure that the '(void)' gets added to - the current declp. Note that with ARM/HP, the first case - represents the name of a static data member 'foo::bar', - which is in the current declp, so we leave it alone. */ - success = demangle_args (work, mangled, declp); - } - } - if (success && PRINT_ARG_TYPES) - { - if (work->static_type) - string_append (declp, " static"); - if (work->type_quals != TYPE_UNQUALIFIED) - { - APPEND_BLANK (declp); - string_append (declp, qualifier_string (work->type_quals)); - } - } - - return (success); -} - -static int -demangle_template_template_parm (work_stuff *work, - const char **mangled, - string *tname) -{ - int i; - int r; - int need_comma = 0; - int success = 1; - string temp; - - string_append (tname, "template <"); - /* get size of template parameter list */ - if (get_count (mangled, &r)) - { - for (i = 0; i < r; i++) - { - if (need_comma) - { - string_append (tname, ", "); - } - - /* Z for type parameters */ - if (**mangled == 'Z') - { - (*mangled)++; - string_append (tname, "class"); - } - /* z for template parameters */ - else if (**mangled == 'z') - { - (*mangled)++; - success = - demangle_template_template_parm (work, mangled, tname); - if (!success) - { - break; - } - } - else - { - /* temp is initialized in do_type */ - success = do_type (work, mangled, &temp); - if (success) - { - string_appends (tname, &temp); - } - string_delete(&temp); - if (!success) - { - break; - } - } - need_comma = 1; - } - - } - if (tname->p[-1] == '>') - string_append (tname, " "); - string_append (tname, "> class"); - return (success); -} - -static int -demangle_expression ( - work_stuff *work, - const char** mangled, - string* s, - type_kind_t tk) -{ - int need_operator = 0; - int success; - - success = 1; - string_appendn (s, "(", 1); - (*mangled)++; - while (success && **mangled != 'W' && **mangled != '\0') - { - if (need_operator) - { - size_t i; - size_t len; - - success = 0; - - len = strlen (*mangled); - - for (i = 0; i < (size_t)ARRAY_SIZE (optable); ++i) - { - size_t l = strlen (optable[i].in); - - if (l <= len - && memcmp (optable[i].in, *mangled, l) == 0) - { - string_appendn (s, " ", 1); - string_append (s, optable[i].out); - string_appendn (s, " ", 1); - success = 1; - (*mangled) += l; - break; - } - } - - if (!success) - break; - } - else - need_operator = 1; - - success = demangle_template_value_parm (work, mangled, s, tk); - } - - if (**mangled != 'W') - success = 0; - else - { - string_appendn (s, ")", 1); - (*mangled)++; - } - - return success; -} - -static int -demangle_integral_value ( - work_stuff *work, - const char** mangled, - string* s) -{ - int success; - - if (**mangled == 'E') - success = demangle_expression (work, mangled, s, tk_integral); - else if (**mangled == 'Q' || **mangled == 'K') - success = demangle_qualified (work, mangled, s, 0, 1); - else - { - int value; - - /* By default, we let the number decide whether we shall consume an - underscore. */ - int consume_following_underscore = 0; - int leave_following_underscore = 0; - - success = 0; - - /* Negative numbers are indicated with a leading `m'. */ - if (**mangled == 'm') - { - string_appendn (s, "-", 1); - (*mangled)++; - } - else if (mangled[0][0] == '_' && mangled[0][1] == 'm') - { - /* Since consume_count_with_underscores does not handle the - `m'-prefix we must do it here, using consume_count and - adjusting underscores: we have to consume the underscore - matching the prepended one. */ - consume_following_underscore = 1; - string_appendn (s, "-", 1); - (*mangled) += 2; - } - else if (**mangled == '_') - { - /* Do not consume a following underscore; - consume_following_underscore will consume what should be - consumed. */ - leave_following_underscore = 1; - } - - /* We must call consume_count if we expect to remove a trailing - underscore, since consume_count_with_underscores expects - the leading underscore (that we consumed) if it is to handle - multi-digit numbers. */ - if (consume_following_underscore) - value = consume_count (mangled); - else - value = consume_count_with_underscores (mangled); - - if (value != -1) - { - char buf[INTBUF_SIZE]; - sprintf (buf, "%d", value); - string_append (s, buf); - - /* Numbers not otherwise delimited, might have an underscore - appended as a delimeter, which we should skip. - - ??? This used to always remove a following underscore, which - is wrong. If other (arbitrary) cases are followed by an - underscore, we need to do something more radical. */ - - if ((value > 9 || consume_following_underscore) - && ! leave_following_underscore - && **mangled == '_') - (*mangled)++; - - /* All is well. */ - success = 1; - } - } - - return success; -} - -/* Demangle the real value in MANGLED. */ - -static int -demangle_real_value ( - work_stuff *work, - const char **mangled, - string* s) -{ - if (**mangled == 'E') - return demangle_expression (work, mangled, s, tk_real); - - if (**mangled == 'm') - { - string_appendn (s, "-", 1); - (*mangled)++; - } - while (ISDIGIT ((unsigned char)**mangled)) - { - string_appendn (s, *mangled, 1); - (*mangled)++; - } - if (**mangled == '.') /* fraction */ - { - string_appendn (s, ".", 1); - (*mangled)++; - while (ISDIGIT ((unsigned char)**mangled)) - { - string_appendn (s, *mangled, 1); - (*mangled)++; - } - } - if (**mangled == 'e') /* exponent */ - { - string_appendn (s, "e", 1); - (*mangled)++; - while (ISDIGIT ((unsigned char)**mangled)) - { - string_appendn (s, *mangled, 1); - (*mangled)++; - } - } - - return 1; -} - -static int -demangle_template_value_parm ( - work_stuff *work, - const char **mangled, - string* s, - type_kind_t tk) -{ - int success = 1; - - if (**mangled == 'Y') - { - /* The next argument is a template parameter. */ - int idx; - - (*mangled)++; - idx = consume_count_with_underscores (mangled); - if (idx == -1 - || (work->tmpl_argvec && idx >= work->ntmpl_args) - || consume_count_with_underscores (mangled) == -1) - return -1; - if (work->tmpl_argvec) - string_append (s, work->tmpl_argvec[idx]); - else - string_append_template_idx (s, idx); - } - else if (tk == tk_integral) - success = demangle_integral_value (work, mangled, s); - else if (tk == tk_char) - { - char tmp[2]; - int val; - if (**mangled == 'm') - { - string_appendn (s, "-", 1); - (*mangled)++; - } - string_appendn (s, "'", 1); - val = consume_count(mangled); - if (val <= 0) - success = 0; - else - { - tmp[0] = (char)val; - tmp[1] = '\0'; - string_appendn (s, &tmp[0], 1); - string_appendn (s, "'", 1); - } - } - else if (tk == tk_bool) - { - int val = consume_count (mangled); - if (val == 0) - string_appendn (s, "false", 5); - else if (val == 1) - string_appendn (s, "true", 4); - else - success = 0; - } - else if (tk == tk_real) - success = demangle_real_value (work, mangled, s); - else if (tk == tk_pointer || tk == tk_reference) - { - if (**mangled == 'Q') - success = demangle_qualified (work, mangled, s, - /*isfuncname=*/0, - /*append=*/1); - else - { - int symbol_len = consume_count (mangled); - if (symbol_len == -1) - return -1; - if (symbol_len == 0) - string_appendn (s, "0", 1); - else - { - char *p = (char *) xmalloc (symbol_len + 1), *q; - strncpy (p, *mangled, symbol_len); - p [symbol_len] = '\0'; - /* We use cplus_demangle here, rather than - internal_cplus_demangle, because the name of the entity - mangled here does not make use of any of the squangling - or type-code information we have built up thus far; it is - mangled independently. */ - q = cplus_demangle (p, work->options); - if (tk == tk_pointer) - string_appendn (s, "&", 1); - /* FIXME: Pointer-to-member constants should get a - qualifying class name here. */ - if (q) - { - string_append (s, q); - free (q); - } - else - string_append (s, p); - free (p); - } - *mangled += symbol_len; - } - } - - return success; -} - -/* Demangle the template name in MANGLED. The full name of the - template (e.g., S) is placed in TNAME. The name without the - template parameters (e.g. S) is placed in TRAWNAME if TRAWNAME is - non-NULL. If IS_TYPE is nonzero, this template is a type template, - not a function template. If both IS_TYPE and REMEMBER are nonzero, - the template is remembered in the list of back-referenceable - types. */ - -static int -demangle_template ( - work_stuff *work, - const char **mangled, - string *tname, - string *trawname, - int is_type, - int remember) -{ - int i; - int r; - int need_comma = 0; - int success = 0; - const char *start; - int is_java_array = 0; - string temp; - int bindex = 0; - - (*mangled)++; - if (is_type) - { - if (remember) - bindex = register_Btype (work); - start = *mangled; - /* get template name */ - if (**mangled == 'z') - { - int idx; - (*mangled)++; - (*mangled)++; - - idx = consume_count_with_underscores (mangled); - if (idx == -1 - || (work->tmpl_argvec && idx >= work->ntmpl_args) - || consume_count_with_underscores (mangled) == -1) - return (0); - - if (work->tmpl_argvec) - { - string_append (tname, work->tmpl_argvec[idx]); - if (trawname) - string_append (trawname, work->tmpl_argvec[idx]); - } - else - { - string_append_template_idx (tname, idx); - if (trawname) - string_append_template_idx (trawname, idx); - } - } - else - { - if ((r = consume_count (mangled)) <= 0 - || (int) strlen (*mangled) < r) - { - return (0); - } - string_appendn (tname, *mangled, r); - if (trawname) - string_appendn (trawname, *mangled, r); - *mangled += r; - } - } - if (!is_java_array) - string_append (tname, "<"); - /* get size of template parameter list */ - if (!get_count (mangled, &r)) - { - return (0); - } - if (!is_type) - { - /* Create an array for saving the template argument values. */ - work->tmpl_argvec = (char**) xmalloc (r * sizeof (char *)); - work->ntmpl_args = r; - for (i = 0; i < r; i++) - work->tmpl_argvec[i] = 0; - } - for (i = 0; i < r; i++) - { - if (need_comma) - { - string_append (tname, ", "); - } - /* Z for type parameters */ - if (**mangled == 'Z') - { - (*mangled)++; - /* temp is initialized in do_type */ - success = do_type (work, mangled, &temp); - if (success) - { - string_appends (tname, &temp); - - if (!is_type) - { - /* Save the template argument. */ - int len = temp.p - temp.b; - work->tmpl_argvec[i] = (char *) xmalloc (len + 1); - memcpy (work->tmpl_argvec[i], temp.b, len); - work->tmpl_argvec[i][len] = '\0'; - } - } - string_delete(&temp); - if (!success) - { - break; - } - } - /* z for template parameters */ - else if (**mangled == 'z') - { - int r2; - (*mangled)++; - success = demangle_template_template_parm (work, mangled, tname); - - if (success - && (r2 = consume_count (mangled)) > 0 - && (int) strlen (*mangled) >= r2) - { - string_append (tname, " "); - string_appendn (tname, *mangled, r2); - if (!is_type) - { - /* Save the template argument. */ - int len = r2; - work->tmpl_argvec[i] = (char *) xmalloc (len + 1); - memcpy (work->tmpl_argvec[i], *mangled, len); - work->tmpl_argvec[i][len] = '\0'; - } - *mangled += r2; - } - if (!success) - { - break; - } - } - else - { - string param; - string* s; - - /* otherwise, value parameter */ - - /* temp is initialized in do_type */ - success = do_type (work, mangled, &temp); - string_delete(&temp); - if (!success) - break; - - if (!is_type) - { - s = ¶m; - string_init (s); - } - else - s = tname; - - success = demangle_template_value_parm (work, mangled, s, - (type_kind_t) success); - - if (!success) - { - if (!is_type) - string_delete (s); - success = 0; - break; - } - - if (!is_type) - { - int len = s->p - s->b; - work->tmpl_argvec[i] = (char *) xmalloc (len + 1); - memcpy (work->tmpl_argvec[i], s->b, len); - work->tmpl_argvec[i][len] = '\0'; - - string_appends (tname, s); - string_delete (s); - } - } - need_comma = 1; - } - if (is_java_array) - { - string_append (tname, "[]"); - } - else - { - if (tname->p[-1] == '>') - string_append (tname, " "); - string_append (tname, ">"); - } - - if (is_type && remember) - remember_Btype (work, tname->b, LEN_STRING (tname), bindex); - - /* - if (work -> static_type) - { - string_append (declp, *mangled + 1); - *mangled += strlen (*mangled); - success = 1; - } - else - { - success = demangle_args (work, mangled, declp); - } - } - */ - return (success); -} - -static int -arm_pt ( - work_stuff *work, - const char *mangled, - int n, - const char **anchor, - const char **args) -{ - /* Check if ARM template with "__pt__" in it ("parameterized type") */ - /* Allow HP also here, because HP's cfront compiler follows ARM to some extent */ - if ((ARM_DEMANGLING || HP_DEMANGLING) && (*anchor = strstr (mangled, "__pt__"))) - { - int len; - *args = *anchor + 6; - len = consume_count (args); - if (len == -1) - return 0; - if (*args + len == mangled + n && **args == '_') - { - ++*args; - return 1; - } - } - if (AUTO_DEMANGLING || EDG_DEMANGLING) - { - if ((*anchor = strstr (mangled, "__tm__")) - || (*anchor = strstr (mangled, "__ps__")) - || (*anchor = strstr (mangled, "__pt__"))) - { - int len; - *args = *anchor + 6; - len = consume_count (args); - if (len == -1) - return 0; - if (*args + len == mangled + n && **args == '_') - { - ++*args; - return 1; - } - } - else if ((*anchor = strstr (mangled, "__S"))) - { - int len; - *args = *anchor + 3; - len = consume_count (args); - if (len == -1) - return 0; - if (*args + len == mangled + n && **args == '_') - { - ++*args; - return 1; - } - } - } - - return 0; -} - -static void -demangle_arm_hp_template ( - work_stuff *work, - const char **mangled, - int n, - string *declp) -{ - const char *p; - const char *args; - const char *e = *mangled + n; - string arg; - - /* Check for HP aCC template spec: classXt1t2 where t1, t2 are - template args */ - if (HP_DEMANGLING && ((*mangled)[n] == 'X')) - { - char *start_spec_args = NULL; - - /* First check for and omit template specialization pseudo-arguments, - such as in "Spec<#1,#1.*>" */ - start_spec_args = strchr (*mangled, '<'); - if (start_spec_args && (start_spec_args - *mangled < n)) - string_appendn (declp, *mangled, start_spec_args - *mangled); - else - string_appendn (declp, *mangled, n); - (*mangled) += n + 1; - string_init (&arg); - if (work->temp_start == -1) /* non-recursive call */ - work->temp_start = declp->p - declp->b; - string_append (declp, "<"); - while (1) - { - string_clear (&arg); - switch (**mangled) - { - case 'T': - /* 'T' signals a type parameter */ - (*mangled)++; - if (!do_type (work, mangled, &arg)) - goto hpacc_template_args_done; - break; - - case 'U': - case 'S': - /* 'U' or 'S' signals an integral value */ - if (!do_hpacc_template_const_value (work, mangled, &arg)) - goto hpacc_template_args_done; - break; - - case 'A': - /* 'A' signals a named constant expression (literal) */ - if (!do_hpacc_template_literal (work, mangled, &arg)) - goto hpacc_template_args_done; - break; - - default: - /* Today, 1997-09-03, we have only the above types - of template parameters */ - /* FIXME: maybe this should fail and return null */ - goto hpacc_template_args_done; - } - string_appends (declp, &arg); - /* Check if we're at the end of template args. - 0 if at end of static member of template class, - _ if done with template args for a function */ - if ((**mangled == '\000') || (**mangled == '_')) - break; - else - string_append (declp, ","); - } - hpacc_template_args_done: - string_append (declp, ">"); - string_delete (&arg); - if (**mangled == '_') - (*mangled)++; - return; - } - /* ARM template? (Also handles HP cfront extensions) */ - else if (arm_pt (work, *mangled, n, &p, &args)) - { - string type_str; - - string_init (&arg); - string_appendn (declp, *mangled, p - *mangled); - if (work->temp_start == -1) /* non-recursive call */ - work->temp_start = declp->p - declp->b; - string_append (declp, "<"); - /* should do error checking here */ - while (args < e) { - string_clear (&arg); - - /* Check for type or literal here */ - switch (*args) - { - /* HP cfront extensions to ARM for template args */ - /* spec: Xt1Lv1 where t1 is a type, v1 is a literal value */ - /* FIXME: We handle only numeric literals for HP cfront */ - case 'X': - /* A typed constant value follows */ - args++; - if (!do_type (work, &args, &type_str)) - goto cfront_template_args_done; - string_append (&arg, "("); - string_appends (&arg, &type_str); - string_append (&arg, ")"); - if (*args != 'L') - goto cfront_template_args_done; - args++; - /* Now snarf a literal value following 'L' */ - if (!snarf_numeric_literal (&args, &arg)) - goto cfront_template_args_done; - break; - - case 'L': - /* Snarf a literal following 'L' */ - args++; - if (!snarf_numeric_literal (&args, &arg)) - goto cfront_template_args_done; - break; - default: - /* Not handling other HP cfront stuff */ - if (!do_type (work, &args, &arg)) - goto cfront_template_args_done; - } - string_appends (declp, &arg); - string_append (declp, ","); - } - cfront_template_args_done: - string_delete (&arg); - if (args >= e) - --declp->p; /* remove extra comma */ - string_append (declp, ">"); - } - else if (n>10 && strncmp (*mangled, "_GLOBAL_", 8) == 0 - && (*mangled)[9] == 'N' - && (*mangled)[8] == (*mangled)[10] - && strchr (cplus_markers, (*mangled)[8])) - { - /* A member of the anonymous namespace. */ - string_append (declp, "{anonymous}"); - } - else - { - if (work->temp_start == -1) /* non-recursive call only */ - work->temp_start = 0; /* disable in recursive calls */ - string_appendn (declp, *mangled, n); - } - *mangled += n; -} - -/* Extract a class name, possibly a template with arguments, from the - mangled string; qualifiers, local class indicators, etc. have - already been dealt with */ - -static int -demangle_class_name ( - work_stuff *work, - const char **mangled, - string *declp) -{ - int n; - int success = 0; - - n = consume_count (mangled); - if (n == -1) - return 0; - if ((int) strlen (*mangled) >= n) - { - demangle_arm_hp_template (work, mangled, n, declp); - success = 1; - } - - return (success); -} - -/* - -LOCAL FUNCTION - - demangle_class -- demangle a mangled class sequence - -SYNOPSIS - - static int - demangle_class (work_stuff *work, const char **mangled, - strint *declp) - -DESCRIPTION - - DECLP points to the buffer into which demangling is being done. - - *MANGLED points to the current token to be demangled. On input, - it points to a mangled class (I.E. "3foo", "13verylongclass", etc.) - On exit, it points to the next token after the mangled class on - success, or the first unconsumed token on failure. - - If the CONSTRUCTOR or DESTRUCTOR flags are set in WORK, then - we are demangling a constructor or destructor. In this case - we prepend "class::class" or "class::~class" to DECLP. - - Otherwise, we prepend "class::" to the current DECLP. - - Reset the constructor/destructor flags once they have been - "consumed". This allows demangle_class to be called later during - the same demangling, to do normal class demangling. - - Returns 1 if demangling is successful, 0 otherwise. - -*/ - -static int -demangle_class ( - work_stuff *work, - const char **mangled, - string *declp) -{ - int success = 0; - int btype; - string class_name; - char *save_class_name_end = 0; - - string_init (&class_name); - btype = register_Btype (work); - if (demangle_class_name (work, mangled, &class_name)) - { - save_class_name_end = class_name.p; - if ((work->constructor & 1) || (work->destructor & 1)) - { - /* adjust so we don't include template args */ - if (work->temp_start && (work->temp_start != -1)) - { - class_name.p = class_name.b + work->temp_start; - } - string_prepends (declp, &class_name); - if (work -> destructor & 1) - { - string_prepend (declp, "~"); - work -> destructor -= 1; - } - else - { - work -> constructor -= 1; - } - } - class_name.p = save_class_name_end; - remember_Ktype (work, class_name.b, LEN_STRING(&class_name)); - remember_Btype (work, class_name.b, LEN_STRING(&class_name), btype); - string_prepend (declp, SCOPE_STRING (work)); - string_prepends (declp, &class_name); - success = 1; - } - string_delete (&class_name); - return (success); -} - - -/* Called when there's a "__" in the mangled name, with `scan' pointing to - the rightmost guess. - - Find the correct "__"-sequence where the function name ends and the - signature starts, which is ambiguous with GNU mangling. - Call demangle_signature here, so we can make sure we found the right - one; *mangled will be consumed so caller will not make further calls to - demangle_signature. */ - -static int -iterate_demangle_function ( - work_stuff *work, - const char **mangled, - string *declp, - const char *scan) -{ - const char *mangle_init = *mangled; - int success = 0; - string decl_init; - work_stuff work_init; - - if (*(scan + 2) == '\0') - return 0; - - /* Do not iterate for some demangling modes, or if there's only one - "__"-sequence. This is the normal case. */ - if (ARM_DEMANGLING || LUCID_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING - || strstr (scan + 2, "__") == NULL) - { - demangle_function_name (work, mangled, declp, scan); - return 1; - } - - /* Save state so we can restart if the guess at the correct "__" was - wrong. */ - string_init (&decl_init); - string_appends (&decl_init, declp); - memset (&work_init, 0, sizeof work_init); - work_stuff_copy_to_from (&work_init, work); - - /* Iterate over occurrences of __, allowing names and types to have a - "__" sequence in them. We must start with the first (not the last) - occurrence, since "__" most often occur between independent mangled - parts, hence starting at the last occurrence inside a signature - might get us a "successful" demangling of the signature. */ - - while (scan[2]) - { - demangle_function_name (work, mangled, declp, scan); - success = demangle_signature (work, mangled, declp); - if (success) - break; - - /* Reset demangle state for the next round. */ - *mangled = mangle_init; - string_clear (declp); - string_appends (declp, &decl_init); - work_stuff_copy_to_from (work, &work_init); - - /* Leave this underscore-sequence. */ - scan += 2; - - /* Scan for the next "__" sequence. */ - while (*scan && (scan[0] != '_' || scan[1] != '_')) - scan++; - - /* Move to last "__" in this sequence. */ - while (*scan && *scan == '_') - scan++; - scan -= 2; - } - - /* Delete saved state. */ - delete_work_stuff (&work_init); - string_delete (&decl_init); - - return success; -} - -/* - -LOCAL FUNCTION - - demangle_prefix -- consume the mangled name prefix and find signature - -SYNOPSIS - - static int - demangle_prefix (work_stuff *work, const char **mangled, - string *declp); - -DESCRIPTION - - Consume and demangle the prefix of the mangled name. - While processing the function name root, arrange to call - demangle_signature if the root is ambiguous. - - DECLP points to the string buffer into which demangled output is - placed. On entry, the buffer is empty. On exit it contains - the root function name, the demangled operator name, or in some - special cases either nothing or the completely demangled result. - - MANGLED points to the current pointer into the mangled name. As each - token of the mangled name is consumed, it is updated. Upon entry - the current mangled name pointer points to the first character of - the mangled name. Upon exit, it should point to the first character - of the signature if demangling was successful, or to the first - unconsumed character if demangling of the prefix was unsuccessful. - - Returns 1 on success, 0 otherwise. - */ - -static int -demangle_prefix ( - work_stuff *work, - const char **mangled, - string *declp) -{ - int success = 1; - const char *scan; - int i; - - if (strlen(*mangled) > 6 - && (strncmp(*mangled, "_imp__", 6) == 0 - || strncmp(*mangled, "__imp_", 6) == 0)) - { - /* it's a symbol imported from a PE dynamic library. Check for both - new style prefix _imp__ and legacy __imp_ used by older versions - of dlltool. */ - (*mangled) += 6; - work->dllimported = 1; - } - else if (strlen(*mangled) >= 11 && strncmp(*mangled, "_GLOBAL_", 8) == 0) - { - char *marker = strchr (cplus_markers, (*mangled)[8]); - if (marker != NULL && *marker == (*mangled)[10]) - { - if ((*mangled)[9] == 'D') - { - /* it's a GNU global destructor to be executed at program exit */ - (*mangled) += 11; - work->destructor = 2; - if (gnu_special (work, mangled, declp)) - return success; - } - else if ((*mangled)[9] == 'I') - { - /* it's a GNU global constructor to be executed at program init */ - (*mangled) += 11; - work->constructor = 2; - if (gnu_special (work, mangled, declp)) - return success; - } - } - } - else if ((ARM_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING) && strncmp(*mangled, "__std__", 7) == 0) - { - /* it's a ARM global destructor to be executed at program exit */ - (*mangled) += 7; - work->destructor = 2; - } - else if ((ARM_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING) && strncmp(*mangled, "__sti__", 7) == 0) - { - /* it's a ARM global constructor to be executed at program initial */ - (*mangled) += 7; - work->constructor = 2; - } - - /* This block of code is a reduction in strength time optimization - of: - scan = strstr (*mangled, "__"); */ - - { - scan = *mangled; - - do { - scan = strchr (scan, '_'); - } while (scan != NULL && *++scan != '_'); - - if (scan != NULL) --scan; - } - - if (scan != NULL) - { - /* We found a sequence of two or more '_', ensure that we start at - the last pair in the sequence. */ - /* i = strspn (scan, "_"); */ - i = 0; - while (scan[i] == '_') i++; - if (i > 2) - { - scan += (i - 2); - } - } - - if (scan == NULL) - { - success = 0; - } - else if (work -> static_type) - { - if (!ISDIGIT ((unsigned char)scan[0]) && (scan[0] != 't')) - { - success = 0; - } - } - else if ((scan == *mangled) - && (ISDIGIT ((unsigned char)scan[2]) || (scan[2] == 'Q') - || (scan[2] == 't') || (scan[2] == 'K') || (scan[2] == 'H'))) - { - /* The ARM says nothing about the mangling of local variables. - But cfront mangles local variables by prepending __ - to them. As an extension to ARM demangling we handle this case. */ - if ((LUCID_DEMANGLING || ARM_DEMANGLING || HP_DEMANGLING) - && ISDIGIT ((unsigned char)scan[2])) - { - *mangled = scan + 2; - consume_count (mangled); - string_append (declp, *mangled); - *mangled += strlen (*mangled); - success = 1; - } - else - { - /* A GNU style constructor starts with __[0-9Qt]. But cfront uses - names like __Q2_3foo3bar for nested type names. So don't accept - this style of constructor for cfront demangling. A GNU - style member-template constructor starts with 'H'. */ - if (!(LUCID_DEMANGLING || ARM_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING)) - work -> constructor += 1; - *mangled = scan + 2; - } - } - else if (ARM_DEMANGLING && scan[2] == 'p' && scan[3] == 't') - { - /* Cfront-style parameterized type. Handled later as a signature. */ - success = 1; - - /* ARM template? */ - demangle_arm_hp_template (work, mangled, strlen (*mangled), declp); - } - else if (EDG_DEMANGLING && ((scan[2] == 't' && scan[3] == 'm') - || (scan[2] == 'p' && scan[3] == 's') - || (scan[2] == 'p' && scan[3] == 't'))) - { - /* EDG-style parameterized type. Handled later as a signature. */ - success = 1; - - /* EDG template? */ - demangle_arm_hp_template (work, mangled, strlen (*mangled), declp); - } - else if ((scan == *mangled) && !ISDIGIT ((unsigned char)scan[2]) - && (scan[2] != 't')) - { - /* Mangled name starts with "__". Skip over any leading '_' characters, - then find the next "__" that separates the prefix from the signature. - */ - if (!(ARM_DEMANGLING || LUCID_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING) - || (arm_special (mangled, declp) == 0)) - { - while (*scan == '_') - { - scan++; - } - if ((scan = strstr (scan, "__")) == NULL || (*(scan + 2) == '\0')) - { - /* No separator (I.E. "__not_mangled"), or empty signature - (I.E. "__not_mangled_either__") */ - success = 0; - } - else - return iterate_demangle_function (work, mangled, declp, scan); - } - } - else if (*(scan + 2) != '\0') - { - /* Mangled name does not start with "__" but does have one somewhere - in there with non empty stuff after it. Looks like a global - function name. Iterate over all "__":s until the right - one is found. */ - return iterate_demangle_function (work, mangled, declp, scan); - } - else - { - /* Doesn't look like a mangled name */ - success = 0; - } - - if (!success && (work->constructor == 2 || work->destructor == 2)) - { - string_append (declp, *mangled); - *mangled += strlen (*mangled); - success = 1; - } - return (success); -} - -/* - -LOCAL FUNCTION - - gnu_special -- special handling of gnu mangled strings - -SYNOPSIS - - static int - gnu_special (work_stuff *work, const char **mangled, - string *declp); - - -DESCRIPTION - - Process some special GNU style mangling forms that don't fit - the normal pattern. For example: - - _$_3foo (destructor for class foo) - _vt$foo (foo virtual table) - _vt$foo$bar (foo::bar virtual table) - __vt_foo (foo virtual table, new style with thunks) - _3foo$varname (static data member) - _Q22rs2tu$vw (static data member) - __t6vector1Zii (constructor with template) - __thunk_4__$_7ostream (virtual function thunk) - */ - -static int -gnu_special ( - work_stuff *work, - const char **mangled, - string *declp) -{ - int n; - int success = 1; - const char *p; - - if ((*mangled)[0] == '_' - && strchr (cplus_markers, (*mangled)[1]) != NULL - && (*mangled)[2] == '_') - { - /* Found a GNU style destructor, get past "__" */ - (*mangled) += 3; - work -> destructor += 1; - } - else if ((*mangled)[0] == '_' - && (((*mangled)[1] == '_' - && (*mangled)[2] == 'v' - && (*mangled)[3] == 't' - && (*mangled)[4] == '_') - || ((*mangled)[1] == 'v' - && (*mangled)[2] == 't' - && strchr (cplus_markers, (*mangled)[3]) != NULL))) - { - /* Found a GNU style virtual table, get past "_vt" - and create the decl. Note that we consume the entire mangled - input string, which means that demangle_signature has no work - to do. */ - if ((*mangled)[2] == 'v') - (*mangled) += 5; /* New style, with thunks: "__vt_" */ - else - (*mangled) += 4; /* Old style, no thunks: "_vt" */ - while (**mangled != '\0') - { - switch (**mangled) - { - case 'Q': - case 'K': - success = demangle_qualified (work, mangled, declp, 0, 1); - break; - case 't': - success = demangle_template (work, mangled, declp, 0, 1, - 1); - break; - default: - if (ISDIGIT((unsigned char)*mangled[0])) - { - n = consume_count(mangled); - /* We may be seeing a too-large size, or else a - "." indicating a static local symbol. In - any case, declare victory and move on; *don't* try - to use n to allocate. */ - if (n > (int) strlen (*mangled)) - { - success = 1; - break; - } - } - else - { - /*n = strcspn (*mangled, cplus_markers);*/ - const char *check = *mangled; - n = 0; - while (*check) - if (strchr (cplus_markers, *check++) == NULL) - n++; - else - break; - } - string_appendn (declp, *mangled, n); - (*mangled) += n; - } - - p = strpbrk (*mangled, cplus_markers); - if (success && ((p == NULL) || (p == *mangled))) - { - if (p != NULL) - { - string_append (declp, SCOPE_STRING (work)); - (*mangled)++; - } - } - else - { - success = 0; - break; - } - } - if (success) - string_append (declp, " virtual table"); - } - else if ((*mangled)[0] == '_' - && (strchr("0123456789Qt", (*mangled)[1]) != NULL) - && (p = strpbrk (*mangled, cplus_markers)) != NULL) - { - /* static data member, "_3foo$varname" for example */ - (*mangled)++; - switch (**mangled) - { - case 'Q': - case 'K': - success = demangle_qualified (work, mangled, declp, 0, 1); - break; - case 't': - success = demangle_template (work, mangled, declp, 0, 1, 1); - break; - default: - n = consume_count (mangled); - if (n < 0 || n > (long) strlen (*mangled)) - { - success = 0; - break; - } - - if (n > 10 && strncmp (*mangled, "_GLOBAL_", 8) == 0 - && (*mangled)[9] == 'N' - && (*mangled)[8] == (*mangled)[10] - && strchr (cplus_markers, (*mangled)[8])) - { - /* A member of the anonymous namespace. There's information - about what identifier or filename it was keyed to, but - it's just there to make the mangled name unique; we just - step over it. */ - string_append (declp, "{anonymous}"); - (*mangled) += n; - - /* Now p points to the marker before the N, so we need to - update it to the first marker after what we consumed. */ - p = strpbrk (*mangled, cplus_markers); - break; - } - - string_appendn (declp, *mangled, n); - (*mangled) += n; - } - if (success && (p == *mangled)) - { - /* Consumed everything up to the cplus_marker, append the - variable name. */ - (*mangled)++; - string_append (declp, SCOPE_STRING (work)); - n = strlen (*mangled); - string_appendn (declp, *mangled, n); - (*mangled) += n; - } - else - { - success = 0; - } - } - else if (strncmp (*mangled, "__thunk_", 8) == 0) - { - int delta; - - (*mangled) += 8; - delta = consume_count (mangled); - if (delta == -1) - success = 0; - else - { - char *method = internal_cplus_demangle (work, ++*mangled); - - if (method) - { - char buf[50]; - sprintf (buf, "virtual function thunk (delta:%d) for ", -delta); - string_append (declp, buf); - string_append (declp, method); - free (method); - n = strlen (*mangled); - (*mangled) += n; - } - else - { - success = 0; - } - } - } - else if (strncmp (*mangled, "__t", 3) == 0 - && ((*mangled)[3] == 'i' || (*mangled)[3] == 'f')) - { - p = (*mangled)[3] == 'i' ? " type_info node" : " type_info function"; - (*mangled) += 4; - switch (**mangled) - { - case 'Q': - case 'K': - success = demangle_qualified (work, mangled, declp, 0, 1); - break; - case 't': - success = demangle_template (work, mangled, declp, 0, 1, 1); - break; - default: - success = do_type (work, mangled, declp); - break; - } - if (success && **mangled != '\0') - success = 0; - if (success) - string_append (declp, p); - } - else - { - success = 0; - } - return (success); -} - -static void -recursively_demangle ( - work_stuff *work, - const char **mangled, - string *result, - int namelength) -{ - char * recurse = (char *)NULL; - char * recurse_dem = (char *)NULL; - - recurse = (char *) xmalloc (namelength + 1); - memcpy (recurse, *mangled, namelength); - recurse[namelength] = '\000'; - - recurse_dem = cplus_demangle (recurse, work->options); - - if (recurse_dem) - { - string_append (result, recurse_dem); - free (recurse_dem); - } - else - { - string_appendn (result, *mangled, namelength); - } - free (recurse); - *mangled += namelength; -} - -/* - -LOCAL FUNCTION - - arm_special -- special handling of ARM/lucid mangled strings - -SYNOPSIS - - static int - arm_special (const char **mangled, - string *declp); - - -DESCRIPTION - - Process some special ARM style mangling forms that don't fit - the normal pattern. For example: - - __vtbl__3foo (foo virtual table) - __vtbl__3foo__3bar (bar::foo virtual table) - - */ - -static int -arm_special (const char **mangled, string *declp) -{ - int n; - int success = 1; - const char *scan; - - if (strncmp (*mangled, ARM_VTABLE_STRING, ARM_VTABLE_STRLEN) == 0) - { - /* Found a ARM style virtual table, get past ARM_VTABLE_STRING - and create the decl. Note that we consume the entire mangled - input string, which means that demangle_signature has no work - to do. */ - scan = *mangled + ARM_VTABLE_STRLEN; - while (*scan != '\0') /* first check it can be demangled */ - { - n = consume_count (&scan); - if (n == -1) - { - return (0); /* no good */ - } - scan += n; - if (scan[0] == '_' && scan[1] == '_') - { - scan += 2; - } - } - (*mangled) += ARM_VTABLE_STRLEN; - while (**mangled != '\0') - { - n = consume_count (mangled); - if (n == -1 - || n > (long) strlen (*mangled)) - return 0; - string_prependn (declp, *mangled, n); - (*mangled) += n; - if ((*mangled)[0] == '_' && (*mangled)[1] == '_') - { - string_prepend (declp, "::"); - (*mangled) += 2; - } - } - string_append (declp, " virtual table"); - } - else - { - success = 0; - } - return (success); -} - -/* - -LOCAL FUNCTION - - demangle_qualified -- demangle 'Q' qualified name strings - -SYNOPSIS - - static int - demangle_qualified (work_stuff *, const char *mangled, - string *result, int isfuncname, int append); - -DESCRIPTION - - Demangle a qualified name, such as "Q25Outer5Inner" which is - the mangled form of "Outer::Inner". The demangled output is - prepended or appended to the result string according to the - state of the append flag. - - If isfuncname is nonzero, then the qualified name we are building - is going to be used as a member function name, so if it is a - constructor or destructor function, append an appropriate - constructor or destructor name. I.E. for the above example, - the result for use as a constructor is "Outer::Inner::Inner" - and the result for use as a destructor is "Outer::Inner::~Inner". - -BUGS - - Numeric conversion is ASCII dependent (FIXME). - - */ - -static int -demangle_qualified ( - work_stuff *work, - const char **mangled, - string *result, - int isfuncname, - int append) -{ - int qualifiers = 0; - int success = 1; - string temp; - string last_name; - int bindex = register_Btype (work); - - /* We only make use of ISFUNCNAME if the entity is a constructor or - destructor. */ - isfuncname = (isfuncname - && ((work->constructor & 1) || (work->destructor & 1))); - - string_init (&temp); - string_init (&last_name); - - if ((*mangled)[0] == 'K') - { - /* Squangling qualified name reuse */ - int idx; - (*mangled)++; - idx = consume_count_with_underscores (mangled); - if (idx == -1 || idx >= work -> numk) - success = 0; - else - string_append (&temp, work -> ktypevec[idx]); - } - else - switch ((*mangled)[1]) - { - case '_': - /* GNU mangled name with more than 9 classes. The count is preceded - by an underscore (to distinguish it from the <= 9 case) and followed - by an underscore. */ - (*mangled)++; - qualifiers = consume_count_with_underscores (mangled); - if (qualifiers == -1) - success = 0; - break; - - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - /* The count is in a single digit. */ - qualifiers = (*mangled)[1] - '0'; - - /* If there is an underscore after the digit, skip it. This is - said to be for ARM-qualified names, but the ARM makes no - mention of such an underscore. Perhaps cfront uses one. */ - if ((*mangled)[2] == '_') - { - (*mangled)++; - } - (*mangled) += 2; - break; - - case '0': - default: - success = 0; - } - - if (!success) - { - string_delete (&last_name); - string_delete (&temp); - return success; - } - - /* Pick off the names and collect them in the temp buffer in the order - in which they are found, separated by '::'. */ - - while (qualifiers-- > 0) - { - int remember_K = 1; - string_clear (&last_name); - - if (*mangled[0] == '_') - (*mangled)++; - - if (*mangled[0] == 't') - { - /* Here we always append to TEMP since we will want to use - the template name without the template parameters as a - constructor or destructor name. The appropriate - (parameter-less) value is returned by demangle_template - in LAST_NAME. We do not remember the template type here, - in order to match the G++ mangling algorithm. */ - success = demangle_template(work, mangled, &temp, - &last_name, 1, 0); - if (!success) - break; - } - else if (*mangled[0] == 'K') - { - int idx; - (*mangled)++; - idx = consume_count_with_underscores (mangled); - if (idx == -1 || idx >= work->numk) - success = 0; - else - string_append (&temp, work->ktypevec[idx]); - remember_K = 0; - - if (!success) break; - } - else - { - if (EDG_DEMANGLING) - { - int namelength; - /* Now recursively demangle the qualifier - * This is necessary to deal with templates in - * mangling styles like EDG */ - namelength = consume_count (mangled); - if (namelength == -1) - { - success = 0; - break; - } - recursively_demangle(work, mangled, &temp, namelength); - } - else - { - string temp_last_name; - string_init (&temp_last_name); - success = do_type (work, mangled, &temp_last_name); - if (!success) - { - string_delete (&temp_last_name); - break; - } - string_appends (&temp, &temp_last_name); - string_appends (&last_name, &temp_last_name); - string_delete (&temp_last_name); - } - } - - if (remember_K) - remember_Ktype (work, temp.b, LEN_STRING (&temp)); - - if (qualifiers > 0) - string_append (&temp, SCOPE_STRING (work)); - } - - remember_Btype (work, temp.b, LEN_STRING (&temp), bindex); - - /* If we are using the result as a function name, we need to append - the appropriate '::' separated constructor or destructor name. - We do this here because this is the most convenient place, where - we already have a pointer to the name and the length of the name. */ - - if (isfuncname) - { - string_append (&temp, SCOPE_STRING (work)); - if (work -> destructor & 1) - string_append (&temp, "~"); - string_appends (&temp, &last_name); - } - - /* Now either prepend the temp buffer to the result, or append it, - depending upon the state of the append flag. */ - - if (append) - string_appends (result, &temp); - else - { - if (!STRING_EMPTY (result)) - string_append (&temp, SCOPE_STRING (work)); - string_prepends (result, &temp); - } - - string_delete (&last_name); - string_delete (&temp); - return (success); -} - -/* - -LOCAL FUNCTION - - get_count -- convert an ascii count to integer, consuming tokens - -SYNOPSIS - - static int - get_count (const char **type, int *count) - -DESCRIPTION - - Assume that *type points at a count in a mangled name; set - *count to its value, and set *type to the next character after - the count. There are some weird rules in effect here. - - If *type does not point at a string of digits, return zero. - - If *type points at a string of digits followed by an - underscore, set *count to their value as an integer, advance - *type to point *after the underscore, and return 1. - - If *type points at a string of digits not followed by an - underscore, consume only the first digit. Set *count to its - value as an integer, leave *type pointing after that digit, - and return 1. - - The excuse for this odd behavior: in the ARM and HP demangling - styles, a type can be followed by a repeat count of the form - `Nxy', where: - - `x' is a single digit specifying how many additional copies - of the type to append to the argument list, and - - `y' is one or more digits, specifying the zero-based index of - the first repeated argument in the list. Yes, as you're - unmangling the name you can figure this out yourself, but - it's there anyway. - - So, for example, in `bar__3fooFPiN51', the first argument is a - pointer to an integer (`Pi'), and then the next five arguments - are the same (`N5'), and the first repeat is the function's - second argument (`1'). -*/ - -static int -get_count (const char **type, int *count) -{ - const char *p; - int n; - - if (!ISDIGIT ((unsigned char)**type)) - return (0); - else - { - *count = **type - '0'; - (*type)++; - if (ISDIGIT ((unsigned char)**type)) - { - p = *type; - n = *count; - do - { - n *= 10; - n += *p - '0'; - p++; - } - while (ISDIGIT ((unsigned char)*p)); - if (*p == '_') - { - *type = p + 1; - *count = n; - } - } - } - return (1); -} - -/* RESULT will be initialised here; it will be freed on failure. The - value returned is really a type_kind_t. */ - -static int -do_type (work_stuff *work, const char **mangled, string *result) -{ - int n; - int done; - int success; - string decl; - const char *remembered_type; - int type_quals; - string btype; - type_kind_t tk = tk_none; - - string_init (&btype); - string_init (&decl); - string_init (result); - - done = 0; - success = 1; - while (success && !done) - { - int member; - switch (**mangled) - { - - /* A pointer type */ - case 'P': - case 'p': - (*mangled)++; - string_prepend (&decl, "*"); - if (tk == tk_none) - tk = tk_pointer; - break; - - /* A reference type */ - case 'R': - (*mangled)++; - string_prepend (&decl, "&"); - if (tk == tk_none) - tk = tk_reference; - break; - - /* An array */ - case 'A': - { - ++(*mangled); - if (!STRING_EMPTY (&decl) - && (decl.b[0] == '*' || decl.b[0] == '&')) - { - string_prepend (&decl, "("); - string_append (&decl, ")"); - } - string_append (&decl, "["); - if (**mangled != '_') - success = demangle_template_value_parm (work, mangled, &decl, - tk_integral); - if (**mangled == '_') - ++(*mangled); - string_append (&decl, "]"); - break; - } - - /* A back reference to a previously seen type */ - case 'T': - (*mangled)++; - if (!get_count (mangled, &n) || n >= work -> ntypes) - { - success = 0; - } - else - { - remembered_type = work -> typevec[n]; - mangled = &remembered_type; - } - break; - - /* A function */ - case 'F': - (*mangled)++; - if (!STRING_EMPTY (&decl) - && (decl.b[0] == '*' || decl.b[0] == '&')) - { - string_prepend (&decl, "("); - string_append (&decl, ")"); - } - /* After picking off the function args, we expect to either find the - function return type (preceded by an '_') or the end of the - string. */ - if (!demangle_nested_args (work, mangled, &decl) - || (**mangled != '_' && **mangled != '\0')) - { - success = 0; - break; - } - if (success && (**mangled == '_')) - (*mangled)++; - break; - - case 'M': - case 'O': - { - type_quals = TYPE_UNQUALIFIED; - - member = **mangled == 'M'; - (*mangled)++; - - string_append (&decl, ")"); - - /* We don't need to prepend `::' for a qualified name; - demangle_qualified will do that for us. */ - if (**mangled != 'Q') - string_prepend (&decl, SCOPE_STRING (work)); - - if (ISDIGIT ((unsigned char)**mangled)) - { - n = consume_count (mangled); - if (n == -1 - || (int) strlen (*mangled) < n) - { - success = 0; - break; - } - string_prependn (&decl, *mangled, n); - *mangled += n; - } - else if (**mangled == 'X' || **mangled == 'Y') - { - string temp; - do_type (work, mangled, &temp); - string_prepends (&decl, &temp); - } - else if (**mangled == 't') - { - string temp; - string_init (&temp); - success = demangle_template (work, mangled, &temp, - NULL, 1, 1); - if (success) - { - string_prependn (&decl, temp.b, temp.p - temp.b); - string_clear (&temp); - } - else - break; - } - else if (**mangled == 'Q') - { - success = demangle_qualified (work, mangled, &decl, - /*isfuncnam=*/0, - /*append=*/0); - if (!success) - break; - } - else - { - success = 0; - break; - } - - string_prepend (&decl, "("); - if (member) - { - switch (**mangled) - { - case 'C': - case 'V': - case 'u': - type_quals |= code_for_qualifier (**mangled); - (*mangled)++; - break; - - default: - break; - } - - if (*(*mangled)++ != 'F') - { - success = 0; - break; - } - } - if ((member && !demangle_nested_args (work, mangled, &decl)) - || **mangled != '_') - { - success = 0; - break; - } - (*mangled)++; - if (! PRINT_ANSI_QUALIFIERS) - { - break; - } - if (type_quals != TYPE_UNQUALIFIED) - { - APPEND_BLANK (&decl); - string_append (&decl, qualifier_string (type_quals)); - } - break; - } - case 'G': - (*mangled)++; - break; - - case 'C': - case 'V': - case 'u': - if (PRINT_ANSI_QUALIFIERS) - { - if (!STRING_EMPTY (&decl)) - string_prepend (&decl, " "); - - string_prepend (&decl, demangle_qualifier (**mangled)); - } - (*mangled)++; - break; - /* - } - */ - - /* fall through */ - default: - done = 1; - break; - } - } - - if (success) switch (**mangled) - { - /* A qualified name, such as "Outer::Inner". */ - case 'Q': - case 'K': - { - success = demangle_qualified (work, mangled, result, 0, 1); - break; - } - - /* A back reference to a previously seen squangled type */ - case 'B': - (*mangled)++; - if (!get_count (mangled, &n) || n >= work -> numb) - success = 0; - else - string_append (result, work->btypevec[n]); - break; - - case 'X': - case 'Y': - /* A template parm. We substitute the corresponding argument. */ - { - int idx; - - (*mangled)++; - idx = consume_count_with_underscores (mangled); - - if (idx == -1 - || (work->tmpl_argvec && idx >= work->ntmpl_args) - || consume_count_with_underscores (mangled) == -1) - { - success = 0; - break; - } - - if (work->tmpl_argvec) - string_append (result, work->tmpl_argvec[idx]); - else - string_append_template_idx (result, idx); - - success = 1; - } - break; - - default: - success = demangle_fund_type (work, mangled, result); - if (tk == tk_none) - tk = (type_kind_t) success; - break; - } - - if (success) - { - if (!STRING_EMPTY (&decl)) - { - string_append (result, " "); - string_appends (result, &decl); - } - } - else - string_delete (result); - string_delete (&decl); - - if (success) - /* Assume an integral type, if we're not sure. */ - return (int) ((tk == tk_none) ? tk_integral : tk); - else - return 0; -} - -/* Given a pointer to a type string that represents a fundamental type - argument (int, long, unsigned int, etc) in TYPE, a pointer to the - string in which the demangled output is being built in RESULT, and - the WORK structure, decode the types and add them to the result. - - For example: - - "Ci" => "const int" - "Sl" => "signed long" - "CUs" => "const unsigned short" - - The value returned is really a type_kind_t. */ - -static int -demangle_fund_type (work_stuff *work, const char **mangled, string *result) -{ - int done = 0; - int success = 1; - char buf[10]; - unsigned int dec = 0; - string btype; - type_kind_t tk = tk_integral; - - string_init (&btype); - - /* First pick off any type qualifiers. There can be more than one. */ - - while (!done) - { - switch (**mangled) - { - case 'C': - case 'V': - case 'u': - if (PRINT_ANSI_QUALIFIERS) - { - if (!STRING_EMPTY (result)) - string_prepend (result, " "); - string_prepend (result, demangle_qualifier (**mangled)); - } - (*mangled)++; - break; - case 'U': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "unsigned"); - break; - case 'S': /* signed char only */ - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "signed"); - break; - case 'J': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "__complex"); - break; - default: - done = 1; - break; - } - } - - /* Now pick off the fundamental type. There can be only one. */ - - switch (**mangled) - { - case '\0': - case '_': - break; - case 'v': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "void"); - break; - case 'x': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "long long"); - break; - case 'l': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "long"); - break; - case 'i': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "int"); - break; - case 's': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "short"); - break; - case 'b': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "bool"); - tk = tk_bool; - break; - case 'c': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "char"); - tk = tk_char; - break; - case 'w': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "wchar_t"); - tk = tk_char; - break; - case 'r': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "long double"); - tk = tk_real; - break; - case 'd': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "double"); - tk = tk_real; - break; - case 'f': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "float"); - tk = tk_real; - break; - case 'G': - (*mangled)++; - if (!ISDIGIT ((unsigned char)**mangled)) - { - success = 0; - break; - } - case 'I': - (*mangled)++; - if (**mangled == '_') - { - int i; - (*mangled)++; - for (i = 0; - i < (long) sizeof (buf) - 1 && **mangled && **mangled != '_'; - (*mangled)++, i++) - buf[i] = **mangled; - if (**mangled != '_') - { - success = 0; - break; - } - buf[i] = '\0'; - (*mangled)++; - } - else - { - strncpy (buf, *mangled, 2); - buf[2] = '\0'; - *mangled += min (strlen (*mangled), 2); - } - /*sscanf (buf, "%x", &dec); - sprintf (buf, "int%u_t", dec);*/ - sprintf (buf, "i_xx_t"); - APPEND_BLANK (result); - string_append (result, buf); - break; - - /* fall through */ - /* An explicit type, such as "6mytype" or "7integer" */ - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - { - int bindex = register_Btype (work); - string loc_btype; - string_init (&loc_btype); - if (demangle_class_name (work, mangled, &loc_btype)) { - remember_Btype (work, loc_btype.b, LEN_STRING (&loc_btype), bindex); - APPEND_BLANK (result); - string_appends (result, &loc_btype); - } - else - success = 0; - string_delete (&loc_btype); - break; - } - case 't': - { - success = demangle_template (work, mangled, &btype, 0, 1, 1); - string_appends (result, &btype); - break; - } - default: - success = 0; - break; - } - - string_delete (&btype); - - return success ? ((int) tk) : 0; -} - - -/* Handle a template's value parameter for HP aCC (extension from ARM) - **mangled points to 'S' or 'U' */ - -static int -do_hpacc_template_const_value ( - work_stuff *work ATTRIBUTE_UNUSED, - const char **mangled, - string *result) -{ - int unsigned_const; - - if (**mangled != 'U' && **mangled != 'S') - return 0; - - unsigned_const = (**mangled == 'U'); - - (*mangled)++; - - switch (**mangled) - { - case 'N': - string_append (result, "-"); - /* fall through */ - case 'P': - (*mangled)++; - break; - case 'M': - /* special case for -2^31 */ - string_append (result, "-2147483648"); - (*mangled)++; - return 1; - default: - return 0; - } - - /* We have to be looking at an integer now */ - if (!(ISDIGIT ((unsigned char)**mangled))) - return 0; - - /* We only deal with integral values for template - parameters -- so it's OK to look only for digits */ - while (ISDIGIT ((unsigned char)**mangled)) - { - char_str[0] = **mangled; - string_append (result, char_str); - (*mangled)++; - } - - if (unsigned_const) - string_append (result, "U"); - - /* FIXME? Some day we may have 64-bit (or larger :-) ) constants - with L or LL suffixes. pai/1997-09-03 */ - - return 1; /* success */ -} - -/* Handle a template's literal parameter for HP aCC (extension from ARM) - **mangled is pointing to the 'A' */ - -static int -do_hpacc_template_literal ( - work_stuff *work, - const char **mangled, - string *result) -{ - int literal_len = 0; - char * recurse; - char * recurse_dem; - - if (**mangled != 'A') - return 0; - - (*mangled)++; - - literal_len = consume_count (mangled); - - if (literal_len <= 0) - return 0; - - /* Literal parameters are names of arrays, functions, etc. and the - canonical representation uses the address operator */ - string_append (result, "&"); - - /* Now recursively demangle the literal name */ - recurse = (char *) xmalloc (literal_len + 1); - memcpy (recurse, *mangled, literal_len); - recurse[literal_len] = '\000'; - - recurse_dem = cplus_demangle (recurse, work->options); - - if (recurse_dem) - { - string_append (result, recurse_dem); - free (recurse_dem); - } - else - { - string_appendn (result, *mangled, literal_len); - } - (*mangled) += literal_len; - free (recurse); - - return 1; -} - -static int -snarf_numeric_literal (const char **args, string *arg) -{ - if (**args == '-') - { - char_str[0] = '-'; - string_append (arg, char_str); - (*args)++; - } - else if (**args == '+') - (*args)++; - - if (!ISDIGIT ((unsigned char)**args)) - return 0; - - while (ISDIGIT ((unsigned char)**args)) - { - char_str[0] = **args; - string_append (arg, char_str); - (*args)++; - } - - return 1; -} - -/* Demangle the next argument, given by MANGLED into RESULT, which - *should be an uninitialized* string. It will be initialized here, - and free'd should anything go wrong. */ - -static int -do_arg ( - work_stuff *work, - const char **mangled, - string *result) -{ - /* Remember where we started so that we can record the type, for - non-squangling type remembering. */ - const char *start = *mangled; - string temp_result; - - string_init (result); - string_init (&temp_result); - - if (work->nrepeats > 0) - { - --work->nrepeats; - - if (work->previous_argument == 0) - return 0; - - /* We want to reissue the previous type in this argument list. */ - string_appends (result, work->previous_argument); - return 1; - } - - if (**mangled == 'n') - { - /* A squangling-style repeat. */ - (*mangled)++; - work->nrepeats = consume_count(mangled); - - if (work->nrepeats <= 0) - /* This was not a repeat count after all. */ - return 0; - - if (work->nrepeats > 9) - { - if (**mangled != '_') - /* The repeat count should be followed by an '_' in this - case. */ - return 0; - else - (*mangled)++; - } - - /* Now, the repeat is all set up. */ - return do_arg (work, mangled, result); - } - - /* Save the result in WORK->previous_argument so that we can find it - if it's repeated. Note that saving START is not good enough: we - do not want to add additional types to the back-referenceable - type vector when processing a repeated type. */ - if (work->previous_argument) - string_clear (work->previous_argument); - else - { - work->previous_argument = (string*) xmalloc (sizeof (string)); - string_init (work->previous_argument); - } - - if (!do_type (work, mangled, &temp_result)) - { - string_delete (&temp_result); - return 0; - } - string_appends (work->previous_argument, &temp_result); - string_delete (&temp_result); - - string_appends (result, work->previous_argument); - - remember_type (work, start, *mangled - start); - return 1; -} - -static void -remember_type ( - work_stuff *work, - const char *start, - int len) -{ - char *tem; - - if (work->forgetting_types) - return; - - if (work -> ntypes >= work -> typevec_size) - { - if (work -> typevec_size == 0) - { - work -> typevec_size = 3; - work -> typevec - = (char **) xmalloc (sizeof (char *) * work -> typevec_size); - } - else - { - work -> typevec_size *= 2; - work -> typevec - = (char **) xrealloc ((char *)work -> typevec, - sizeof (char *) * work -> typevec_size); - } - } - tem = (char *) xmalloc (len + 1); - memcpy (tem, start, len); - tem[len] = '\0'; - work -> typevec[work -> ntypes++] = tem; -} - - -/* Remember a K type class qualifier. */ -static void -remember_Ktype ( - work_stuff *work, - const char *start, - int len) -{ - char *tem; - - if (work -> numk >= work -> ksize) - { - if (work -> ksize == 0) - { - work -> ksize = 5; - work -> ktypevec - = (char **) xmalloc (sizeof (char *) * work -> ksize); - } - else - { - work -> ksize *= 2; - work -> ktypevec - = (char **) xrealloc ((char *)work -> ktypevec, - sizeof (char *) * work -> ksize); - } - } - tem = (char *) xmalloc (len + 1); - memcpy (tem, start, len); - tem[len] = '\0'; - work -> ktypevec[work -> numk++] = tem; -} - -/* Register a B code, and get an index for it. B codes are registered - as they are seen, rather than as they are completed, so map > - registers map > as B0, and temp as B1 */ - -static int -register_Btype (work_stuff *work) -{ - int ret; - - if (work -> numb >= work -> bsize) - { - if (work -> bsize == 0) - { - work -> bsize = 5; - work -> btypevec - = (char **) xmalloc (sizeof (char *) * work -> bsize); - } - else - { - work -> bsize *= 2; - work -> btypevec - = (char **) xrealloc ((char *)work -> btypevec, - sizeof (char *) * work -> bsize); - } - } - ret = work -> numb++; - work -> btypevec[ret] = NULL; - return(ret); -} - -/* Store a value into a previously registered B code type. */ - -static void -remember_Btype ( - work_stuff *work, - const char *start, - int len, int ind) -{ - char *tem; - - tem = (char *) xmalloc (len + 1); - memcpy (tem, start, len); - tem[len] = '\0'; - work -> btypevec[ind] = tem; -} - -/* Lose all the info related to B and K type codes. */ -static void -forget_B_and_K_types (work_stuff *work) -{ - int i; - - while (work -> numk > 0) - { - i = --(work -> numk); - if (work -> ktypevec[i] != NULL) - { - free (work -> ktypevec[i]); - work -> ktypevec[i] = NULL; - } - } - - while (work -> numb > 0) - { - i = --(work -> numb); - if (work -> btypevec[i] != NULL) - { - free (work -> btypevec[i]); - work -> btypevec[i] = NULL; - } - } -} -/* Forget the remembered types, but not the type vector itself. */ - -static void -forget_types (work_stuff *work) -{ - int i; - - while (work -> ntypes > 0) - { - i = --(work -> ntypes); - if (work -> typevec[i] != NULL) - { - free (work -> typevec[i]); - work -> typevec[i] = NULL; - } - } -} - -/* Process the argument list part of the signature, after any class spec - has been consumed, as well as the first 'F' character (if any). For - example: - - "__als__3fooRT0" => process "RT0" - "complexfunc5__FPFPc_PFl_i" => process "PFPc_PFl_i" - - DECLP must be already initialised, usually non-empty. It won't be freed - on failure. - - Note that g++ differs significantly from ARM and lucid style mangling - with regards to references to previously seen types. For example, given - the source fragment: - - class foo { - public: - foo::foo (int, foo &ia, int, foo &ib, int, foo &ic); - }; - - foo::foo (int, foo &ia, int, foo &ib, int, foo &ic) { ia = ib = ic; } - void foo (int, foo &ia, int, foo &ib, int, foo &ic) { ia = ib = ic; } - - g++ produces the names: - - __3fooiRT0iT2iT2 - foo__FiR3fooiT1iT1 - - while lcc (and presumably other ARM style compilers as well) produces: - - foo__FiR3fooT1T2T1T2 - __ct__3fooFiR3fooT1T2T1T2 - - Note that g++ bases its type numbers starting at zero and counts all - previously seen types, while lucid/ARM bases its type numbers starting - at one and only considers types after it has seen the 'F' character - indicating the start of the function args. For lucid/ARM style, we - account for this difference by discarding any previously seen types when - we see the 'F' character, and subtracting one from the type number - reference. - - */ - -static int -demangle_args ( - work_stuff *work, - const char **mangled, - string *declp) -{ - string arg; - int need_comma = 0; - int r; - int t; - const char *tem; - char temptype; - - if (PRINT_ARG_TYPES) - { - string_append (declp, "("); - if (**mangled == '\0') - { - string_append (declp, "void"); - } - } - - while ((**mangled != '_' && **mangled != '\0' && **mangled != 'e') - || work->nrepeats > 0) - { - if ((**mangled == 'N') || (**mangled == 'T')) - { - temptype = *(*mangled)++; - - if (temptype == 'N') - { - if (!get_count (mangled, &r)) - { - return (0); - } - } - else - { - r = 1; - } - if ((HP_DEMANGLING || ARM_DEMANGLING || EDG_DEMANGLING) && work -> ntypes >= 10) - { - /* If we have 10 or more types we might have more than a 1 digit - index so we'll have to consume the whole count here. This - will lose if the next thing is a type name preceded by a - count but it's impossible to demangle that case properly - anyway. Eg if we already have 12 types is T12Pc "(..., type1, - Pc, ...)" or "(..., type12, char *, ...)" */ - if ((t = consume_count(mangled)) <= 0) - { - return (0); - } - } - else - { - if (!get_count (mangled, &t)) - { - return (0); - } - } - if (LUCID_DEMANGLING || ARM_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING) - { - t--; - } - /* Validate the type index. Protect against illegal indices from - malformed type strings. */ - if ((t < 0) || (t >= work -> ntypes)) - { - return (0); - } - while (work->nrepeats > 0 || --r >= 0) - { - tem = work -> typevec[t]; - if (need_comma && PRINT_ARG_TYPES) - { - string_append (declp, ", "); - } - if (!do_arg (work, &tem, &arg)) - { - return (0); - } - if (PRINT_ARG_TYPES) - { - string_appends (declp, &arg); - } - string_delete (&arg); - need_comma = 1; - } - } - else - { - if (need_comma && PRINT_ARG_TYPES) - string_append (declp, ", "); - if (!do_arg (work, mangled, &arg)) - { - string_delete (&arg); - return (0); - } - if (PRINT_ARG_TYPES) - string_appends (declp, &arg); - string_delete (&arg); - need_comma = 1; - } - } - - if (**mangled == 'e') - { - (*mangled)++; - if (PRINT_ARG_TYPES) - { - if (need_comma) - { - string_append (declp, ","); - } - string_append (declp, "..."); - } - } - - if (PRINT_ARG_TYPES) - { - string_append (declp, ")"); - } - return (1); -} - -/* Like demangle_args, but for demangling the argument lists of function - and method pointers or references, not top-level declarations. */ - -static int -demangle_nested_args ( - work_stuff *work, - const char **mangled, - string *declp) -{ - string* saved_previous_argument; - int result; - int saved_nrepeats; - - /* The G++ name-mangling algorithm does not remember types on nested - argument lists, unless -fsquangling is used, and in that case the - type vector updated by remember_type is not used. So, we turn - off remembering of types here. */ - ++work->forgetting_types; - - /* For the repeat codes used with -fsquangling, we must keep track of - the last argument. */ - saved_previous_argument = work->previous_argument; - saved_nrepeats = work->nrepeats; - work->previous_argument = 0; - work->nrepeats = 0; - - /* Actually demangle the arguments. */ - result = demangle_args (work, mangled, declp); - - /* Restore the previous_argument field. */ - if (work->previous_argument) - { - string_delete (work->previous_argument); - free ((char*) work->previous_argument); - } - work->previous_argument = saved_previous_argument; - --work->forgetting_types; - work->nrepeats = saved_nrepeats; - - return result; -} - -static void -demangle_function_name ( - work_stuff *work, - const char **mangled, - string *declp, - const char *scan) -{ - size_t i; - string type; - const char *tem; - - string_appendn (declp, (*mangled), scan - (*mangled)); - string_need (declp, 1); - *(declp -> p) = '\0'; - - /* Consume the function name, including the "__" separating the name - from the signature. We are guaranteed that SCAN points to the - separator. */ - - (*mangled) = scan + 2; - /* We may be looking at an instantiation of a template function: - foo__Xt1t2_Ft3t4, where t1, t2, ... are template arguments and a - following _F marks the start of the function arguments. Handle - the template arguments first. */ - - if (HP_DEMANGLING && (**mangled == 'X')) - { - demangle_arm_hp_template (work, mangled, 0, declp); - /* This leaves MANGLED pointing to the 'F' marking func args */ - } - - if (LUCID_DEMANGLING || ARM_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING) - { - - /* See if we have an ARM style constructor or destructor operator. - If so, then just record it, clear the decl, and return. - We can't build the actual constructor/destructor decl until later, - when we recover the class name from the signature. */ - - if (strcmp (declp -> b, "__ct") == 0) - { - work -> constructor += 1; - string_clear (declp); - return; - } - else if (strcmp (declp -> b, "__dt") == 0) - { - work -> destructor += 1; - string_clear (declp); - return; - } - } - - if (declp->p - declp->b >= 3 - && declp->b[0] == 'o' - && declp->b[1] == 'p' - && strchr (cplus_markers, declp->b[2]) != NULL) - { - /* see if it's an assignment expression */ - if (declp->p - declp->b >= 10 /* op$assign_ */ - && memcmp (declp->b + 3, "assign_", 7) == 0) - { - for (i = 0; i < (size_t)ARRAY_SIZE (optable); i++) - { - int len = declp->p - declp->b - 10; - if ((int) strlen (optable[i].in) == len - && memcmp (optable[i].in, declp->b + 10, len) == 0) - { - string_clear (declp); - string_append (declp, "operator"); - string_append (declp, optable[i].out); - string_append (declp, "="); - break; - } - } - } - else - { - for (i = 0; i < (size_t)ARRAY_SIZE (optable); i++) - { - int len = declp->p - declp->b - 3; - if ((int) strlen (optable[i].in) == len - && memcmp (optable[i].in, declp->b + 3, len) == 0) - { - string_clear (declp); - string_append (declp, "operator"); - string_append (declp, optable[i].out); - break; - } - } - } - } - else if (declp->p - declp->b >= 5 && memcmp (declp->b, "type", 4) == 0 - && strchr (cplus_markers, declp->b[4]) != NULL) - { - /* type conversion operator */ - tem = declp->b + 5; - if (do_type (work, &tem, &type)) - { - string_clear (declp); - string_append (declp, "operator "); - string_appends (declp, &type); - string_delete (&type); - } - } - else if (declp->b[0] == '_' && declp->b[1] == '_' - && declp->b[2] == 'o' && declp->b[3] == 'p') - { - /* ANSI. */ - /* type conversion operator. */ - tem = declp->b + 4; - if (do_type (work, &tem, &type)) - { - string_clear (declp); - string_append (declp, "operator "); - string_appends (declp, &type); - string_delete (&type); - } - } - else if (declp->b[0] == '_' && declp->b[1] == '_' - && ISLOWER((unsigned char)declp->b[2]) - && ISLOWER((unsigned char)declp->b[3])) - { - if (declp->b[4] == '\0') - { - /* Operator. */ - for (i = 0; i < (size_t)ARRAY_SIZE (optable); i++) - { - if (strlen (optable[i].in) == 2 - && memcmp (optable[i].in, declp->b + 2, 2) == 0) - { - string_clear (declp); - string_append (declp, "operator"); - string_append (declp, optable[i].out); - break; - } - } - } - else - { - if (declp->b[2] == 'a' && declp->b[5] == '\0') - { - /* Assignment. */ - for (i = 0; i < (size_t)ARRAY_SIZE (optable); i++) - { - if (strlen (optable[i].in) == 3 - && memcmp (optable[i].in, declp->b + 2, 3) == 0) - { - string_clear (declp); - string_append (declp, "operator"); - string_append (declp, optable[i].out); - break; - } - } - } - } - } -} - -/* a mini string-handling package */ - -static void -string_need (string *s, int n) -{ - int tem; - - if (s->b == NULL) - { - if (n < 32) - { - n = 32; - } - s->p = s->b = (char *) xmalloc (n); - s->e = s->b + n; - } - else if (s->e - s->p < n) - { - tem = s->p - s->b; - n += tem; - n *= 2; - s->b = (char *) xrealloc (s->b, n); - s->p = s->b + tem; - s->e = s->b + n; - } -} - -static void -string_delete (string *s) -{ - if (s->b != NULL) - { - free (s->b); - s->b = s->e = s->p = NULL; - } -} - -static void -string_init (string *s) -{ - s->b = s->p = s->e = NULL; -} - -static void -string_clear (string *s) -{ - s->p = s->b; -} - -static void -string_append (string *p, const char *s) -{ - int n; - if (s == NULL || *s == '\0') - return; - n = strlen (s); - string_need (p, n); - memcpy (p->p, s, n); - p->p += n; -} - -static void -string_appends (string *p, string *s) -{ - int n; - - if (s->b != s->p) - { - n = s->p - s->b; - string_need (p, n); - memcpy (p->p, s->b, n); - p->p += n; - } -} - -static void -string_appendn (string *p, const char *s, int n) -{ - if (n != 0) - { - string_need (p, n); - memcpy (p->p, s, n); - p->p += n; - } -} - -static void -string_prepend (string *p, const char *s) -{ - if (s != NULL && *s != '\0') - { - string_prependn (p, s, strlen (s)); - } -} - -static void -string_prepends (string *p, string *s) -{ - if (s->b != s->p) - { - string_prependn (p, s->b, s->p - s->b); - } -} - -static void -string_prependn (string *p, const char *s, int n) -{ - char *q; - - if (n != 0) - { - string_need (p, n); - for (q = p->p - 1; q >= p->b; q--) - { - q[n] = q[0]; - } - memcpy (p->b, s, n); - p->p += n; - } -} - -static void -string_append_template_idx (string *s, int idx) -{ - char buf[INTBUF_SIZE + 1 /* 'T' */]; - sprintf(buf, "T%d", idx); - string_append (s, buf); -} -#endif - -#ifdef STANDALONE_DEMANGLER -#include -#include - -int main(int argc, char *argv[]) -{ - for (int i = 1; i < argc; i++) { - const char *mangled_name = argv[i]; - char *demangled_name = cxx_demangle(mangled_name, NULL, NULL, NULL); - if (demangled_name == NULL) - printf("Could not demangle string '%s'\n", mangled_name); - else { - printf("'%s'\n -> '%s'\n\n", mangled_name, demangled_name); - free(demangled_name); - } - } -} -#endif diff --git a/SheepShaver/src/kpx_cpu/src/cpu/jit/cxxdemangle.h b/SheepShaver/src/kpx_cpu/src/cpu/jit/cxxdemangle.h deleted file mode 100644 index 6b634f4b..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/jit/cxxdemangle.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * cxxdemangle.h - C++ demangler - * - * Kheperix (C) 2003-2005-2004 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef CXX_DEMANGLE_H -#define CXX_DEMANGLE_H - -/** - * cxx_demangle - * - * Following GCC 3.0 ABI: - * - * - * - MANGLED-NAME is a pointer to a null-terminated array of - * characters - * - * - BUF may be null. If it is non-null, then N must also be - * nonnull, and BUF is a pointer to an array, of at least *N - * characters, that was allocated using malloc(). - * - * - STATUS points to an int that is used as an error indicator. It - * is permitted to be null, in which case the user just doesn't - * get any detailed error information. - * - * Codes: 0: success - * -1: memory allocation failure - * -2: invalid mangled name - * -3: invalid arguments (e.g. BUG nonnull and N null) - **/ - -#ifdef __cplusplus -extern "C" -#endif -char *cxx_demangle(const char *mangled_name, - char *buf, - size_t *n, - int *status); - -#endif /* CXX_DEMANGLE_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/jit/dummy/jit-target-cache.hpp b/SheepShaver/src/kpx_cpu/src/cpu/jit/dummy/jit-target-cache.hpp deleted file mode 100644 index 8bed86af..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/jit/dummy/jit-target-cache.hpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * jit-target-cache.hpp - Target specific code to invalidate cache - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef JIT_TARGET_CACHE_H -#define JIT_TARGET_CACHE_H - -static inline void flush_icache_range(unsigned long, unsigned long) -{ -} - -#endif /* JIT_TARGET_CACHE_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/jit/dyngen-exec.h b/SheepShaver/src/kpx_cpu/src/cpu/jit/dyngen-exec.h deleted file mode 100644 index 8c12fe6b..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/jit/dyngen-exec.h +++ /dev/null @@ -1,182 +0,0 @@ -/* - * dyngen defines for micro operation code - * - * Copyright (c) 2003-2004-2004 Fabrice Bellard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef DYNGEN_EXEC_H -#define DYNGEN_EXEC_H - -#include "cpu/jit/jit-config.hpp" - -#define _JIT_HEADER dyngen-target-exec.h -#include "cpu/jit/jit-target-dispatch.h" - -/* define virtual register set */ -#define REG_CPU AREG0 -#define REG_CPU_ID AREG0_ID -#define REG_T0 AREG1 -#define REG_T0_ID AREG1_ID -#define REG_T1 AREG2 -#define REG_T1_ID AREG2_ID -#define REG_T2 AREG3 -#define REG_T2_ID AREG3_ID -#ifdef AREG4 -#define REG_T3 AREG4 -#define REG_T3_ID AREG4_ID -#endif -#ifdef FREG3 -#define REG_F0 FREG0 -#define REG_F0_ID FREG0_ID -#define REG_F1 FREG1 -#define REG_F1_ID FREG1_ID -#define REG_F2 FREG2 -#define REG_F2_ID FREG2_ID -#define REG_F3 FREG3 -#define REG_F3_ID FREG3_ID -#endif -#ifdef VREG3 -#define REG_V0 VREG0 -#define REG_V0_ID VREG0_ID -#define REG_V1 VREG1 -#define REG_V1_ID VREG1_ID -#define REG_V2 VREG2 -#define REG_V2_ID VREG2_ID -#define REG_V3 VREG3 -#define REG_V3_ID VREG3_ID -#endif - -// Force only one return point -#define dyngen_barrier() asm volatile ("") - -#ifndef OPPROTO -#define OPPROTO -#endif - -#ifdef __alpha__ -/* the symbols are considered non exported so a br immediate is generated */ -#define __hidden __attribute__((visibility("hidden"))) -#else -#define __hidden -#endif - -#ifdef __alpha__ -/* Suggested by Richard Henderson. This will result in code like - ldah $0,__op_PARAM1($29) !gprelhigh - lda $0,__op_PARAM1($0) !gprellow - We can then conveniently change $29 to $31 and adapt the offsets to - emit the appropriate constant. */ -#define PARAM1 ({ int _r; asm("" : "=r"(_r) : "0" (&__op_PARAM1)); _r; }) -#define PARAM2 ({ int _r; asm("" : "=r"(_r) : "0" (&__op_PARAM2)); _r; }) -#define PARAM3 ({ int _r; asm("" : "=r"(_r) : "0" (&__op_PARAM3)); _r; }) -extern int __op_PARAM1 __hidden; -extern int __op_PARAM2 __hidden; -extern int __op_PARAM3 __hidden; -#elif defined __mips__ -/* On MIPS, parameters to a C expression are passed via the global pointer. - * We don't want that. */ -#define PARAMN(index) ({ register int _r; \ - asm("lui %0,%%hi(__op_PARAM" #index ")\n\t" \ - "ori %0,%0,%%lo(__op_PARAM" #index ")" \ - : "=r"(_r)); _r; }) -#define PARAM1 PARAMN(1) -#define PARAM2 PARAMN(2) -#define PARAM3 PARAMN(3) -#else -#if defined(__APPLE__) && defined(__MACH__) -static int __op_PARAM1, __op_PARAM2, __op_PARAM3; -#else -extern int __op_PARAM1, __op_PARAM2, __op_PARAM3; -#endif -#define PARAM1 ((long)(&__op_PARAM1)) -#define PARAM2 ((long)(&__op_PARAM2)) -#define PARAM3 ((long)(&__op_PARAM3)) -#endif - -// Direct block chaining support -#if defined(__powerpc__) || defined(__ppc__) -#define DYNGEN_FAST_DISPATCH(TARGET) asm volatile ("b " ASM_NAME(TARGET)) -#endif -#if defined(__i386__) || defined(__x86_64__) -#define DYNGEN_FAST_DISPATCH(TARGET) asm volatile ("jmp " ASM_NAME(TARGET)) -#endif - -#define DYNGEN_SLOW_DISPATCH(TARGET) do { \ - static const void __attribute__((unused)) *label1 = &&dummy_label1; \ - static const void __attribute__((unused)) *label2 = &&dummy_label2; \ - goto *((void *)TARGET); \ - dummy_label1: \ - dummy_label2: \ - dyngen_barrier(); \ -} while (0) - -extern int __op_jmp0, __op_jmp1; - -// Sections handling -#if defined(__CYGWIN__) || defined(_WIN32) -#define ASM_DATA_SECTION ".section .data\n" -#define ASM_PREVIOUS_SECTION ".section .text\n" -#define ASM_GLOBAL ".global" -#define ASM_NAME(NAME) "_" #NAME -#define ASM_SIZE(NAME) "" -#elif defined(__APPLE__) && defined(__MACH__) -#define ASM_DATA_SECTION ".data\n" -#define ASM_PREVIOUS_SECTION ".text\n" -#define ASM_GLOBAL ".globl" -#define ASM_NAME(NAME) "_" #NAME -#define ASM_SIZE(NAME) "" -#if defined(__ppc__) -#define ASM_OP_EXEC_RETURN_INSN "0x18,0xde,0xad,0xff" -#endif -#if defined(__i386__) -#define ASM_OP_EXEC_RETURN_INSN "0x0f,0xa6,0xf0" -#endif -#elif defined __sgi && defined __mips -#define ASM_DATA_SECTION ".data\n" -#define ASM_PREVIOUS_SECTION ".text\n" -#define ASM_GLOBAL ".globl" -#define ASM_NAME(NAME) #NAME -#define ASM_SIZE(NAME) "" -#define ASM_LONG ".word" -#else -#define ASM_DATA_SECTION ".section \".data\"\n" -#define ASM_PREVIOUS_SECTION ".previous\n" -#define ASM_GLOBAL ".global" -#define ASM_NAME(NAME) #NAME -#define ASM_SIZE(NAME) ".size " ASM_NAME(NAME) ",.-" ASM_NAME(NAME) -#endif -#ifndef ASM_LONG -#define ASM_LONG ".long" -#endif - -// Helper macros to annotate likely branch directions -#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -#ifndef likely -#define likely(x) __builtin_expect((x),1) -#endif -#ifndef unlikely -#define unlikely(x) __builtin_expect((x),0) -#endif -#endif -#ifndef likely -#define likely(x) (x) -#endif -#ifndef unlikely -#define unlikely(x) (x) -#endif - -#endif /* DYNGEN_EXEC_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/jit/dyngen.c b/SheepShaver/src/kpx_cpu/src/cpu/jit/dyngen.c deleted file mode 100644 index b6ead792..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/jit/dyngen.c +++ /dev/null @@ -1,3027 +0,0 @@ -/* - * Generic Dynamic compiler generator - * - * Copyright (c) 2003-2004 Fabrice Bellard - * - * The COFF object format support was extracted from Kazu's QEMU port - * to Win32. - * - * Mach-O Support by Matt Reda and Pierre d'Herbemont - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -#include -#include -#include -#include -#include -#include -#include - -#include "sysdeps.h" -#include "cxxdemangle.h" - -/* object file format defs */ -#ifndef CONFIG_WIN32 -#if defined(__CYGWIN__) || defined(_WIN32) -#define CONFIG_WIN32 1 -#endif -#endif -#ifndef CONFIG_DARWIN -#if defined(__APPLE__) && defined(__MACH__) -#define CONFIG_DARWIN 1 -#endif -#endif - -/* host cpu defs */ -#if CONFIG_WIN32 -#define HOST_I386 1 -#elif defined(__i386__) -#define HOST_I386 1 -#elif defined(__powerpc__) || defined(__ppc__) -#define HOST_PPC 1 -#elif defined(__s390__) -#define HOST_S390 1 -#elif defined(__alpha__) -#define HOST_ALPHA 1 -#elif defined(__ia64__) -#define HOST_IA64 1 -#elif defined(__sparc__) -#define HOST_SPARC 1 -#elif defined(__x86_64__) -#define HOST_X86_64 1 -#elif defined(__m68k__) -#define HOST_M68K 1 -#elif defined(__mips__) -#define HOST_MIPS 1 -#endif - -/* Debug generated code */ -#if ENABLE_MON && (defined(HOST_I386) || defined(HOST_X86_64)) && 0 -#define DYNGEN_PRETTY_PRINT 1 - -#include "disass/dis-asm.h" - -static inline bfd_byte bfd_read_byte(bfd_vma from) -{ - bfd_byte *p = (bfd_byte *)(uintptr_t)from; - return *p; -} - -int buffer_read_memory(bfd_vma from, bfd_byte *to, unsigned int length, struct disassemble_info *info) -{ - while (length--) - *to++ = bfd_read_byte(from++); - return 0; -} - -void perror_memory(int status, bfd_vma memaddr, struct disassemble_info *info) -{ - info->fprintf_func(info->stream, "Unknown error %d\n", status); -} - -static uintptr_t print_address_base; - -void generic_print_address(bfd_vma addr, struct disassemble_info *info) -{ - addr -= print_address_base; - if (addr >= UVAL64(0x100000000)) - info->fprintf_func(info->stream, "$%08x%08x", (uint32)(addr >> 32), (uint32)addr); - else - info->fprintf_func(info->stream, "$%08x", (uint32)addr); -} - -int generic_symbol_at_address(bfd_vma addr, struct disassemble_info *info) -{ - return 0; -} - -struct SFILE { - char *buffer; - char *current; -}; - -static int dyngen_sprintf(struct SFILE *f, const char *format, ...) -{ - int n; - va_list args; - va_start(args, format); - vsprintf(f->current, format, args); - f->current += n = strlen(f->current); - va_end(args); - return n; -} - -#if defined(HOST_I386) || defined(HOST_X86_64) -static int pretty_print(char *buf, uintptr_t addr, uintptr_t base) -{ - disassemble_info info; - struct SFILE sfile = {buf, buf}; - sfile.buffer = buf; - sfile.current = buf; - INIT_DISASSEMBLE_INFO(info, (FILE *)&sfile, (fprintf_ftype)dyngen_sprintf); -#if defined(HOST_X86_64) - info.mach = bfd_mach_x86_64; -#endif - print_address_base = base; - return print_insn_i386_att(addr, &info); -} -#endif -#endif - -/* NOTE: we test CONFIG_WIN32 instead of _WIN32 to enabled cross - compilation */ -#if defined(CONFIG_WIN32) -#define CONFIG_FORMAT_COFF -#elif defined(CONFIG_DARWIN) -#define CONFIG_FORMAT_MACH -#else -#define CONFIG_FORMAT_ELF -#endif - -#ifdef CONFIG_FORMAT_ELF - -/* elf format definitions. We use these macros to test the CPU to - allow cross compilation (this tool must be ran on the build - platform) */ -#if defined(HOST_I386) - -#define ELF_CLASS ELFCLASS32 -#define ELF_ARCH EM_386 -#define elf_check_arch(x) ( ((x) == EM_386) || ((x) == EM_486) ) -#undef ELF_USES_RELOCA - -#elif defined(HOST_X86_64) - -#define ELF_CLASS ELFCLASS64 -#define ELF_ARCH EM_X86_64 -#define elf_check_arch(x) ((x) == EM_X86_64) -#define ELF_USES_RELOCA - -#elif defined(HOST_PPC) - -#define ELF_CLASS ELFCLASS32 -#define ELF_ARCH EM_PPC -#define elf_check_arch(x) ((x) == EM_PPC) -#define ELF_USES_RELOCA - -#elif defined(HOST_S390) - -#define ELF_CLASS ELFCLASS32 -#define ELF_ARCH EM_S390 -#define elf_check_arch(x) ((x) == EM_S390) -#define ELF_USES_RELOCA - -#elif defined(HOST_ALPHA) - -#define ELF_CLASS ELFCLASS64 -#define ELF_ARCH EM_ALPHA -#define elf_check_arch(x) ((x) == EM_ALPHA) -#define ELF_USES_RELOCA - -#elif defined(HOST_IA64) - -#define ELF_CLASS ELFCLASS64 -#define ELF_ARCH EM_IA_64 -#define elf_check_arch(x) ((x) == EM_IA_64) -#define ELF_USES_RELOCA - -#elif defined(HOST_SPARC) - -#define ELF_CLASS ELFCLASS32 -#define ELF_ARCH EM_SPARC -#define elf_check_arch(x) ((x) == EM_SPARC || (x) == EM_SPARC32PLUS) -#define ELF_USES_RELOCA - -#elif defined(HOST_SPARC64) - -#define ELF_CLASS ELFCLASS64 -#define ELF_ARCH EM_SPARCV9 -#define elf_check_arch(x) ((x) == EM_SPARCV9) -#define ELF_USES_RELOCA - -#elif defined(HOST_ARM) - -#define ELF_CLASS ELFCLASS32 -#define ELF_ARCH EM_ARM -#define elf_check_arch(x) ((x) == EM_ARM) -#define ELF_USES_RELOC - -#elif defined(HOST_M68K) - -#define ELF_CLASS ELFCLASS32 -#define ELF_ARCH EM_68K -#define elf_check_arch(x) ((x) == EM_68K) -#define ELF_USES_RELOCA - -#elif defined(HOST_MIPS) - -#define ELF_CLASS ELFCLASS32 -#define ELF_ARCH EM_MIPS -#define elf_check_arch(x) ((x) == EM_MIPS) -#define ELF_USES_RELOCA -#define ELF_USES_ALSO_RELOC - -#else -#error unsupported CPU - please update the code -#endif - -#include "elf-defs.h" - -#ifndef ElfW -# if ELF_CLASS == ELFCLASS32 -# define ElfW(x) Elf32_ ## x -# define ELFW(x) ELF32_ ## x -# else -# define ElfW(x) Elf64_ ## x -# define ELFW(x) ELF64_ ## x -# endif -#endif - -#if ELF_CLASS == ELFCLASS32 -typedef uint32_t host_ulong; -#define swabls(x) swab32s(x) -#else -typedef uint64_t host_ulong; -#define swabls(x) swab64s(x) -#endif - -typedef ElfW(Ehdr) elfhdr; -typedef ElfW(Shdr) elf_shdr; -typedef ElfW(Phdr) elf_phdr; -typedef ElfW(Rel) elf_rel; -typedef ElfW(Rela) elf_rela; - -#ifdef ELF_USES_RELOCA -#define ELF_RELOC elf_rela -#define SHT_RELOC SHT_RELA -#else -#define ELF_RELOC elf_rel -#define SHT_RELOC SHT_REL -#endif - -#define EXE_RELOC ELF_RELOC -#define EXE_SYM ElfW(Sym) - -#endif /* CONFIG_FORMAT_ELF */ - -#ifdef CONFIG_FORMAT_COFF - -#include "a.out-defs.h" - -typedef uint32_t host_ulong; - -#define FILENAMELEN 256 - -typedef struct coff_sym { - struct external_syment *st_syment; - char st_name[FILENAMELEN]; - uint32_t st_value; - int st_size; - uint8_t st_type; - uint8_t st_shndx; -} coff_Sym; - -typedef struct coff_rel { - struct external_reloc *r_reloc; - int r_offset; - uint8_t r_type; -} coff_Rel; - -#define EXE_RELOC struct coff_rel -#define EXE_SYM struct coff_sym - -#endif /* CONFIG_FORMAT_COFF */ - -#ifdef CONFIG_FORMAT_MACH - -#include -#include -#include -#include - -#if defined(HOST_PPC) || defined(HOST_I386) - -# if defined(HOST_I386) - -# define mach_check_cputype(x) ((x) == CPU_TYPE_I386) -# else -# define mach_check_cputype(x) ((x) == CPU_TYPE_POWERPC) -# endif -# define check_mach_header(x) (x.magic == MH_MAGIC) -# define SEGMENT_COMMAND segment_command -# define MACH_HEADER mach_header -# define SECTION section -# define NLIST nlist -typedef uint32_t host_ulong; - -#elif defined(HOST_X86_64) - -# include -# define mach_check_cputype(x) ((x) == CPU_TYPE_X86_64) -# define check_mach_header(x) (x.magic == MH_MAGIC_64) -# define SEGMENT_COMMAND segment_command_64 -# define MACH_HEADER mach_header_64 -# define SECTION section_64 -# define NLIST nlist_64 -typedef uint64_t host_ulong; - -#else -#error unsupported CPU - please update the code -#endif - -struct nlist_extended -{ - union { -#ifdef HOST_X86_64 - unsigned int n_strx; -#else - char *n_name; - long n_strx; -#endif - } n_un; - unsigned char n_type; - unsigned char n_sect; - short st_desc; - unsigned long st_value; - unsigned long st_size; -}; - -#define EXE_RELOC struct relocation_info -#define EXE_SYM struct nlist_extended - -#endif /* CONFIG_FORMAT_MACH */ - -enum { - OUT_GEN_OP_ALL, -}; - -/* all dynamically generated functions begin with this code */ -#define OP_PREFIX "op_" - -int do_swap; - -void __attribute__((noreturn)) __attribute__((format (printf, 1, 2))) error(const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - fprintf(stderr, "dyngen: "); - vfprintf(stderr, fmt, ap); - fprintf(stderr, "\n"); - va_end(ap); - exit(1); -} - -void *load_data(int fd, long offset, unsigned int size) -{ - char *data; - - data = malloc(size); - if (!data) - return NULL; - lseek(fd, offset, SEEK_SET); - if (read(fd, data, size) != size) { - free(data); - return NULL; - } - return data; -} - -int strstart(const char *str, const char *val, const char **ptr) -{ - const char *p, *q; - p = str; - q = val; - while (*q != '\0') { - if (*p != *q) - return 0; - p++; - q++; - } - if (ptr) - *ptr = p; - return 1; -} - -void pstrcpy(char *buf, int buf_size, const char *str) -{ - int c; - char *q = buf; - - if (buf_size <= 0) - return; - - for(;;) { - c = *str++; - if (c == 0 || q >= buf + buf_size - 1) - break; - *q++ = c; - } - *q = '\0'; -} - -void swab16s(uint16_t *p) -{ - *p = bswap_16(*p); -} - -void swab32s(uint32_t *p) -{ - *p = bswap_32(*p); -} - -void swab64s(uint64_t *p) -{ - *p = bswap_64(*p); -} - -uint16_t get16(uint16_t *p) -{ - uint16_t val; - val = *p; - if (do_swap) - val = bswap_16(val); - return val; -} - -uint32_t get32(uint32_t *p) -{ - uint32_t val; - val = *p; - if (do_swap) - val = bswap_32(val); - return val; -} - -void put16(uint16_t *p, uint16_t val) -{ - if (do_swap) - val = bswap_16(val); - *p = val; -} - -void put32(uint32_t *p, uint32_t val) -{ - if (do_swap) - val = bswap_32(val); - *p = val; -} - -static int is_op_param(const char *sym_name, const char **ptr) -{ - return - strstart(sym_name, "__op_param", ptr) || strstart(sym_name, "_op_param", ptr) || - strstart(sym_name, "__op_PARAM", ptr) || strstart(sym_name, "_op_PARAM", ptr); -} - -static int is_op_jmp(const char *sym_name, const char **ptr) -{ - return strstart(sym_name, "__op_jmp", ptr) || strstart(sym_name, "_op_jmp", ptr); -} - -static int is_op_gen_label(const char *sym_name, const char **ptr) -{ - return strstart(sym_name, "__op_gen_label", ptr) || strstart(sym_name, "_op_gen_label", ptr); -} - -/* generate op code */ -void gen_code(const char *name, const char *demangled_name, - host_ulong offset, host_ulong size, - FILE *outfile, int gen_switch, const char *prefix); -void patch_relocations(FILE *outfile, const char *name, host_ulong size, host_ulong start_offset, int copy_size); - -static void do_print_code(FILE *outfile, const char *name, const uint8_t *code_p, int code_size, int is_code) -{ - int i, b; - fprintf(outfile, " static const uint8 %s[] = {", name); -#ifdef DYNGEN_PRETTY_PRINT - if (is_code) { - const int BYTES_PER_LINE = 5; - uint8_t out[1024]; - int outindex = 0; - char buf[1024]; - uintptr_t addr = (uintptr_t)code_p; - uintptr_t end_addr = addr + code_size; - int ip = 0; - fprintf(outfile, "\n"); - while (addr < end_addr) { - int num = pretty_print(buf, (uintptr_t)addr, (uintptr_t)code_p); - int max_num = num > BYTES_PER_LINE ? num : BYTES_PER_LINE; - for (i = 0; i < max_num; i++) { - if ((i % BYTES_PER_LINE) == 0) - fprintf(outfile, "/* %04x */ ", ip); - if (i < num) { - fprintf(outfile, "0x%02x", (out[outindex++] = code_p[ip++])); - if (ip != code_size) - fprintf(outfile, ", "); - else - fprintf(outfile, " "); - } - else - fprintf(outfile, " "); - if (i == BYTES_PER_LINE - 1) - fprintf(outfile, "/* %s */", buf); - if ((i + 1) % BYTES_PER_LINE == 0 || i == max_num - 1) - fprintf(outfile, "\n"); - } - addr += num; - } - fprintf(outfile, " };\n"); - - /* sanity check we have not forgotten any byte */ - assert(outindex == code_size); - assert(memcmp(code_p, out, code_size) == 0); - return; - } -#endif - for (i = 0; i < code_size; i++) { - if ((i % 12) == 0) { - if (i != 0) - fprintf(outfile, ","); - fprintf(outfile, "\n "); - } - else - fprintf(outfile, ", "); - fprintf(outfile, "0x%02x", code_p[i]); - } - fprintf(outfile, "\n };\n"); -} - -static void print_code(FILE *outfile, const char *name, const uint8_t *code_p, int code_size) -{ - char *code_name; - code_name = alloca(strlen(name) + 5); - strcpy(code_name, name); - strcat(code_name, "_code"); - do_print_code(outfile, code_name, code_p, code_size, 1); -} - -static void print_data(FILE *outfile, const char *name, const uint8_t *data, int data_size) -{ - do_print_code(outfile, name, data, data_size, 0); -} - -static char *gen_dot_prefix(const char *sym_name) -{ - static char name[256]; - assert(sym_name[0] == '.'); - snprintf(name, sizeof(name), "dot_%s", sym_name + 1); - return name; -} - - -/* executable information */ -EXE_SYM *symtab; -int nb_syms; -int text_shndx; -int data_shndx; -uint8_t *text; -uint8_t *data; -uint8_t *literal16; -EXE_RELOC *relocs; -int nb_relocs; - -#ifdef CONFIG_FORMAT_ELF - -/* ELF file info */ -elf_shdr *shdr; -uint8_t **sdata; -elfhdr ehdr; -char *strtab; - -int elf_must_swap(elfhdr *h) -{ - union { - uint32_t i; - uint8_t b[4]; - } swaptest; - - swaptest.i = 1; - return (h->e_ident[EI_DATA] == ELFDATA2MSB) != - (swaptest.b[0] == 0); -} - -void elf_swap_ehdr(elfhdr *h) -{ - swab16s(&h->e_type); /* Object file type */ - swab16s(&h-> e_machine); /* Architecture */ - swab32s(&h-> e_version); /* Object file version */ - swabls(&h-> e_entry); /* Entry point virtual address */ - swabls(&h-> e_phoff); /* Program header table file offset */ - swabls(&h-> e_shoff); /* Section header table file offset */ - swab32s(&h-> e_flags); /* Processor-specific flags */ - swab16s(&h-> e_ehsize); /* ELF header size in bytes */ - swab16s(&h-> e_phentsize); /* Program header table entry size */ - swab16s(&h-> e_phnum); /* Program header table entry count */ - swab16s(&h-> e_shentsize); /* Section header table entry size */ - swab16s(&h-> e_shnum); /* Section header table entry count */ - swab16s(&h-> e_shstrndx); /* Section header string table index */ -} - -void elf_swap_shdr(elf_shdr *h) -{ - swab32s(&h-> sh_name); /* Section name (string tbl index) */ - swab32s(&h-> sh_type); /* Section type */ - swabls(&h-> sh_flags); /* Section flags */ - swabls(&h-> sh_addr); /* Section virtual addr at execution */ - swabls(&h-> sh_offset); /* Section file offset */ - swabls(&h-> sh_size); /* Section size in bytes */ - swab32s(&h-> sh_link); /* Link to another section */ - swab32s(&h-> sh_info); /* Additional section information */ - swabls(&h-> sh_addralign); /* Section alignment */ - swabls(&h-> sh_entsize); /* Entry size if section holds table */ -} - -void elf_swap_phdr(elf_phdr *h) -{ - swab32s(&h->p_type); /* Segment type */ - swabls(&h->p_offset); /* Segment file offset */ - swabls(&h->p_vaddr); /* Segment virtual address */ - swabls(&h->p_paddr); /* Segment physical address */ - swabls(&h->p_filesz); /* Segment size in file */ - swabls(&h->p_memsz); /* Segment size in memory */ - swab32s(&h->p_flags); /* Segment flags */ - swabls(&h->p_align); /* Segment alignment */ -} - -void elf_swap_rel(ELF_RELOC *rel) -{ - swabls(&rel->r_offset); - swabls(&rel->r_info); -#ifdef ELF_USES_RELOCA - swabls(&rel->r_addend); -#endif -} - -elf_shdr *find_elf_section(elf_shdr *shdr, int shnum, const char *shstr, - const char *name) -{ - int i; - const char *shname; - elf_shdr *sec; - - for(i = 0; i < shnum; i++) { - sec = &shdr[i]; - if (!sec->sh_name) - continue; - shname = shstr + sec->sh_name; - if (!strcmp(shname, name)) - return sec; - } - return NULL; -} - -static int do_find_reloc(int sh_index, ElfW(Word) type) -{ - elf_shdr *sec; - int i; - - for(i = 0; i < ehdr.e_shnum; i++) { - sec = &shdr[i]; - if (sec->sh_type == type && sec->sh_info == sh_index) - return i; - } - return 0; -} - -static int find_reloc(int sh_index) -{ - return do_find_reloc(sh_index, SHT_RELOC); -} - -static host_ulong get_rel_offset(EXE_RELOC *rel) -{ - return rel->r_offset; -} - -static char *get_rel_sym_name(EXE_RELOC *rel) -{ - return strtab + symtab[ELFW(R_SYM)(rel->r_info)].st_name; -} - -static char *get_sym_name(EXE_SYM *sym) -{ - return strtab + sym->st_name; -} - -/* load an elf object file */ -int load_object(const char *filename, FILE *outfile) -{ - int fd; - elf_shdr *sec, *symtab_sec, *strtab_sec, *text_sec; - int i, j; - ElfW(Sym) *sym; - char *shstr; - ELF_RELOC *rel; - elf_shdr *data_sec; - elf_shdr *rodata_cst4_sec; - uint8_t *rodata_cst4 = NULL; - int rodata_cst4_shndx; - elf_shdr *rodata_cst8_sec; - uint8_t *rodata_cst8 = NULL; - int rodata_cst8_shndx; - elf_shdr *rodata_cst16_sec; - uint8_t *rodata_cst16 = NULL; - int rodata_cst16_shndx; - - fd = open(filename, O_RDONLY); - if (fd < 0) - error("can't open file '%s'", filename); - - /* Read ELF header. */ - if (read(fd, &ehdr, sizeof (ehdr)) != sizeof (ehdr)) - error("unable to read file header"); - - /* Check ELF identification. */ - if (ehdr.e_ident[EI_MAG0] != ELFMAG0 - || ehdr.e_ident[EI_MAG1] != ELFMAG1 - || ehdr.e_ident[EI_MAG2] != ELFMAG2 - || ehdr.e_ident[EI_MAG3] != ELFMAG3 - || ehdr.e_ident[EI_VERSION] != EV_CURRENT) { - error("bad ELF header"); - } - - do_swap = elf_must_swap(&ehdr); - if (do_swap) - elf_swap_ehdr(&ehdr); - if (ehdr.e_ident[EI_CLASS] != ELF_CLASS) - error("Unsupported ELF class"); - if (ehdr.e_type != ET_REL) - error("ELF object file expected"); - if (ehdr.e_version != EV_CURRENT) - error("Invalid ELF version"); - if (!elf_check_arch(ehdr.e_machine)) - error("Unsupported CPU (e_machine=%d)", ehdr.e_machine); - - /* read section headers */ - shdr = load_data(fd, ehdr.e_shoff, ehdr.e_shnum * sizeof(elf_shdr)); - if (do_swap) { - for(i = 0; i < ehdr.e_shnum; i++) { - elf_swap_shdr(&shdr[i]); - } - } - - /* read all section data */ - sdata = malloc(sizeof(void *) * ehdr.e_shnum); - memset(sdata, 0, sizeof(void *) * ehdr.e_shnum); - - for(i = 0;i < ehdr.e_shnum; i++) { - sec = &shdr[i]; - if (sec->sh_type != SHT_NOBITS) - sdata[i] = load_data(fd, sec->sh_offset, sec->sh_size); - } - - sec = &shdr[ehdr.e_shstrndx]; - shstr = sdata[ehdr.e_shstrndx]; - - /* swap relocations */ - for(i = 0; i < ehdr.e_shnum; i++) { - sec = &shdr[i]; - if (sec->sh_type == SHT_REL || sec->sh_type == SHT_RELA) { - nb_relocs = sec->sh_size / sec->sh_entsize; - if (do_swap) { - for(j = 0, rel = (ELF_RELOC *)sdata[i]; j < nb_relocs; j++, rel++) - elf_swap_rel(rel); - } - } - } - - /* data section */ - data_sec = find_elf_section(shdr, ehdr.e_shnum, shstr, ".data"); - if (data_sec) { - data_shndx = data_sec - shdr; - data = sdata[data_shndx]; - } - else { - data_shndx = -1; - data = NULL; - } - - /* rodata sections */ - rodata_cst4_sec = find_elf_section(shdr, ehdr.e_shnum, shstr, ".rodata.cst4"); - if (rodata_cst4_sec) { - rodata_cst4_shndx = rodata_cst4_sec - shdr; - rodata_cst4 = sdata[rodata_cst4_shndx]; - } - rodata_cst8_sec = find_elf_section(shdr, ehdr.e_shnum, shstr, ".rodata.cst8"); - if (rodata_cst8_sec) { - rodata_cst8_shndx = rodata_cst8_sec - shdr; - rodata_cst8 = sdata[rodata_cst8_shndx]; - } - rodata_cst16_sec = find_elf_section(shdr, ehdr.e_shnum, shstr, ".rodata.cst16"); - if (rodata_cst16_sec) { - rodata_cst16_shndx = rodata_cst16_sec - shdr; - rodata_cst16 = sdata[rodata_cst16_shndx]; - } - - /* text section */ - text_sec = find_elf_section(shdr, ehdr.e_shnum, shstr, ".text"); - if (!text_sec) - error("could not find .text section"); - text_shndx = text_sec - shdr; - text = sdata[text_shndx]; - - /* find text relocations, if any */ - relocs = NULL; - nb_relocs = 0; - i = find_reloc(text_shndx); - if (i != 0) { - relocs = (ELF_RELOC *)sdata[i]; - nb_relocs = shdr[i].sh_size / shdr[i].sh_entsize; - } -#ifdef ELF_USES_ALSO_RELOC - i = do_find_reloc(text_shndx, SHT_REL); - if (i != 0) { - if (relocs) { - int j, nb_rels = shdr[i].sh_size / shdr[i].sh_entsize; - ElfW(Rel) *rels = (ElfW(Rel) *)sdata[i]; - ELF_RELOC *new_relocs = (ELF_RELOC *)malloc(sizeof(ELF_RELOC) * (nb_relocs + nb_rels)); - memcpy(new_relocs, relocs, sizeof(ELF_RELOC) * nb_relocs); - for (j = 0; j < nb_rels; j++) { - new_relocs[j + nb_relocs].r_offset = rels[j].r_offset; - new_relocs[j + nb_relocs].r_info = rels[j].r_info; - new_relocs[j + nb_relocs].r_addend = 0; - } - nb_relocs += nb_rels; - relocs = new_relocs; - } - } -#endif - - symtab_sec = find_elf_section(shdr, ehdr.e_shnum, shstr, ".symtab"); - if (!symtab_sec) - error("could not find .symtab section"); - strtab_sec = &shdr[symtab_sec->sh_link]; - - symtab = (ElfW(Sym) *)sdata[symtab_sec - shdr]; - strtab = sdata[symtab_sec->sh_link]; - - nb_syms = symtab_sec->sh_size / sizeof(ElfW(Sym)); - if (do_swap) { - for(i = 0, sym = symtab; i < nb_syms; i++, sym++) { - swab32s(&sym->st_name); - swabls(&sym->st_value); - swabls(&sym->st_size); - swab16s(&sym->st_shndx); - } - } - close(fd); - - { - int status; - size_t nf, nd = 256; - char *demangled_name, *func_name; - if ((demangled_name = malloc(nd)) == NULL) - return -1; - if ((func_name = malloc(nf = nd)) == NULL) { - free(demangled_name); - return -1; - } - - for(i = 0, sym = symtab; i < nb_syms; i++, sym++) { - const char *name; - name = get_sym_name(sym); - /* emit local symbols */ - if (strstart(name, ".LC", NULL)) { - const char *dot_name = gen_dot_prefix(name); - fprintf(outfile, "DEFINE_GEN(gen_const_%s,uint8 *,(void))\n", dot_name); - fprintf(outfile, "#ifdef DYNGEN_IMPL\n"); - fprintf(outfile, "{\n"); - int dot_size = 0; - if (sym->st_shndx == (rodata_cst16_sec - shdr)) - print_data(outfile, dot_name, rodata_cst16 + sym->st_value, (dot_size = 16)); - else if (sym->st_shndx == (rodata_cst8_sec - shdr)) - print_data(outfile, dot_name, rodata_cst8 + sym->st_value, (dot_size = 8)); - else if (sym->st_shndx == (rodata_cst4_sec - shdr)) - print_data(outfile, dot_name, rodata_cst4 + sym->st_value, (dot_size = 4)); - else - error("invalid section for local data %s (%x)\n", name, sym->st_shndx); - fprintf(outfile, " static uint8 *data_p = NULL;\n"); - fprintf(outfile, " if (data_p == NULL)\n"); - fprintf(outfile, " data_p = copy_data(%s, %d);\n", dot_name, dot_size); - fprintf(outfile, " return data_p;\n"); - fprintf(outfile, "}\n"); - fprintf(outfile, "#endif\n"); - } - } - - free(func_name); - free(demangled_name); - } - return 0; -} - -#endif /* CONFIG_FORMAT_ELF */ - -#ifdef CONFIG_FORMAT_COFF - -/* COFF file info */ -struct external_scnhdr *shdr; -uint8_t **sdata; -struct external_filehdr fhdr; -struct external_syment *coff_symtab; -char *strtab; -int coff_text_shndx, coff_data_shndx; - -#define STRTAB_SIZE 4 - -#define DIR32 0x06 -#define DISP32 0x14 - -#define T_FUNCTION 0x20 -#define C_EXTERNAL 2 - -void sym_ent_name(struct external_syment *ext_sym, EXE_SYM *sym) -{ - char *q; - int c, i, len; - - if (ext_sym->e.e.e_zeroes != 0) { - q = sym->st_name; - for(i = 0; i < 8; i++) { - c = ext_sym->e.e_name[i]; - if (c == '\0') - break; - *q++ = c; - } - *q = '\0'; - } else { - pstrcpy(sym->st_name, sizeof(sym->st_name), strtab + ext_sym->e.e.e_offset); - } - - /* now convert the name to a C name (suppress the leading '_') */ - if (sym->st_name[0] == '_') { - len = strlen(sym->st_name); - memmove(sym->st_name, sym->st_name + 1, len - 1); - sym->st_name[len - 1] = '\0'; - } -} - -char *name_for_dotdata(struct coff_rel *rel) -{ - int i; - struct coff_sym *sym; - uint32_t text_data; - - text_data = *(uint32_t *)(text + rel->r_offset); - - for (i = 0, sym = symtab; i < nb_syms; i++, sym++) { - if (sym->st_syment->e_scnum == data_shndx && - text_data >= sym->st_value && - text_data < sym->st_value + sym->st_size) { - - return sym->st_name; - - } - } - return NULL; -} - -static char *get_sym_name(EXE_SYM *sym) -{ - return sym->st_name; -} - -static char *get_rel_sym_name(EXE_RELOC *rel) -{ - char *name; - name = get_sym_name(symtab + *(uint32_t *)(rel->r_reloc->r_symndx)); - if (!strcmp(name, ".data")) - name = name_for_dotdata(rel); - return name; -} - -static host_ulong get_rel_offset(EXE_RELOC *rel) -{ - return rel->r_offset; -} - -struct external_scnhdr *find_coff_section(struct external_scnhdr *shdr, int shnum, const char *name) -{ - int i; - const char *shname; - struct external_scnhdr *sec; - - for(i = 0; i < shnum; i++) { - sec = &shdr[i]; - if (!sec->s_name) - continue; - shname = sec->s_name; - if (!strcmp(shname, name)) - return sec; - } - return NULL; -} - -/* load a coff object file */ -int load_object(const char *filename, FILE *outfile) -{ - int fd; - struct external_scnhdr *sec, *text_sec, *data_sec; - int i, j; - struct external_syment *ext_sym; - struct external_reloc *coff_relocs; - struct external_reloc *ext_rel; - uint32_t *n_strtab; - EXE_SYM *sym; - EXE_RELOC *rel; - - fd = open(filename, O_RDONLY -#ifdef _WIN32 - | O_BINARY -#endif - ); - if (fd < 0) - error("can't open file '%s'", filename); - - /* Read COFF header. */ - if (read(fd, &fhdr, sizeof (fhdr)) != sizeof (fhdr)) - error("unable to read file header"); - - /* Check COFF identification. */ - if (fhdr.f_magic != I386MAGIC) { - error("bad COFF header"); - } - do_swap = 0; - - /* read section headers */ - shdr = load_data(fd, sizeof(struct external_filehdr) + fhdr.f_opthdr, fhdr.f_nscns * sizeof(struct external_scnhdr)); - - /* read all section data */ - sdata = malloc(sizeof(void *) * fhdr.f_nscns); - memset(sdata, 0, sizeof(void *) * fhdr.f_nscns); - - const char *p; - for(i = 0;i < fhdr.f_nscns; i++) { - sec = &shdr[i]; - if (!strstart(sec->s_name, ".bss", &p)) - sdata[i] = load_data(fd, sec->s_scnptr, sec->s_size); - } - - - /* text section */ - text_sec = find_coff_section(shdr, fhdr.f_nscns, ".text"); - if (!text_sec) - error("could not find .text section"); - coff_text_shndx = text_sec - shdr; - text = sdata[coff_text_shndx]; - - /* data section */ - data_sec = find_coff_section(shdr, fhdr.f_nscns, ".data"); - if (!data_sec) - error("could not find .data section"); - coff_data_shndx = data_sec - shdr; - data = sdata[coff_data_shndx]; - - coff_symtab = load_data(fd, fhdr.f_symptr, fhdr.f_nsyms*SYMESZ); - for (i = 0, ext_sym = coff_symtab; i < nb_syms; i++, ext_sym++) { - for(j=0;j<8;j++) - printf(" %02x", ((uint8_t *)ext_sym->e.e_name)[j]); - printf("\n"); - } - - nb_syms = fhdr.f_nsyms; - n_strtab = load_data(fd, (fhdr.f_symptr + fhdr.f_nsyms*SYMESZ), STRTAB_SIZE); - strtab = load_data(fd, (fhdr.f_symptr + fhdr.f_nsyms*SYMESZ), *n_strtab); - - for (i = 0, ext_sym = coff_symtab; i < nb_syms; i++, ext_sym++) { - if (strstart(ext_sym->e.e_name, ".text", NULL)) - text_shndx = ext_sym->e_scnum; - if (strstart(ext_sym->e.e_name, ".data", NULL)) - data_shndx = ext_sym->e_scnum; - } - - /* set coff symbol */ - symtab = malloc(sizeof(struct coff_sym) * nb_syms); - - int aux_size; - for (i = 0, ext_sym = coff_symtab, sym = symtab; i < nb_syms; i++, ext_sym++, sym++) { - memset(sym, 0, sizeof(*sym)); - sym->st_syment = ext_sym; - sym_ent_name(ext_sym, sym); - sym->st_value = ext_sym->e_value; - - aux_size = *(int8_t *)ext_sym->e_numaux; - if (ext_sym->e_scnum == text_shndx && ext_sym->e_type == T_FUNCTION) { - for (j = aux_size + 1; j < nb_syms - i; j++) { - if ((ext_sym + j)->e_scnum == text_shndx && - (ext_sym + j)->e_type == T_FUNCTION ){ - sym->st_size = (ext_sym + j)->e_value - ext_sym->e_value; - break; - } else if (j == nb_syms - i - 1) { - sec = &shdr[coff_text_shndx]; - sym->st_size = sec->s_size - ext_sym->e_value; - break; - } - } - } else if (ext_sym->e_scnum == data_shndx && *(uint8_t *)ext_sym->e_sclass == C_EXTERNAL) { - for (j = aux_size + 1; j < nb_syms - i; j++) { - if ((ext_sym + j)->e_scnum == data_shndx) { - sym->st_size = (ext_sym + j)->e_value - ext_sym->e_value; - break; - } else if (j == nb_syms - i - 1) { - sec = &shdr[coff_data_shndx]; - sym->st_size = sec->s_size - ext_sym->e_value; - break; - } - } - } else { - sym->st_size = 0; - } - - sym->st_type = ext_sym->e_type; - sym->st_shndx = ext_sym->e_scnum; - } - - - /* find text relocations, if any */ - sec = &shdr[coff_text_shndx]; - coff_relocs = load_data(fd, sec->s_relptr, sec->s_nreloc*RELSZ); - nb_relocs = sec->s_nreloc; - - /* set coff relocation */ - relocs = malloc(sizeof(struct coff_rel) * nb_relocs); - for (i = 0, ext_rel = coff_relocs, rel = relocs; i < nb_relocs; - i++, ext_rel++, rel++) { - memset(rel, 0, sizeof(*rel)); - rel->r_reloc = ext_rel; - rel->r_offset = *(uint32_t *)ext_rel->r_vaddr; - rel->r_type = *(uint16_t *)ext_rel->r_type; - } - return 0; -} - -#endif /* CONFIG_FORMAT_COFF */ - -#ifdef CONFIG_FORMAT_MACH - -/* File Header */ -struct MACH_HEADER mach_hdr; - -/* commands */ -struct SEGMENT_COMMAND *segment = 0; -struct dysymtab_command *dysymtabcmd = 0; -struct symtab_command *symtabcmd = 0; - -/* section */ -struct SECTION *section_hdr; -struct SECTION *text_sec_hdr; -struct SECTION *data_sec_hdr; -struct SECTION *literal16_sec_hdr; -uint8_t **sdata; - -/* relocs */ -struct relocation_info *relocs; - -/* symbols */ -EXE_SYM *symtab; -struct NLIST *symtab_std; -char *strtab; - -/* indirect symbols */ -uint32_t *tocdylib; - -/* Utility functions */ - -static inline char *find_str_by_index(int index) -{ - return strtab+index; -} - -/* Used by dyngen common code */ -static char *get_sym_name(EXE_SYM *sym) -{ - char *name = find_str_by_index(sym->n_un.n_strx); - - if ( sym->n_type & N_STAB ) /* Debug symbols are ignored */ - return "debug"; - - if(!name) - return name; - if(name[0]=='_') - return name + 1; - else - return name; -} - -/* find a section index given its segname, sectname */ -static int find_mach_sec_index(struct SECTION *section_hdr, int shnum, const char *segname, - const char *sectname) -{ - int i; - struct SECTION *sec = section_hdr; - - for(i = 0; i < shnum; i++, sec++) { - if (!sec->segname || !sec->sectname) - continue; - if (!strcmp(sec->sectname, sectname) && !strcmp(sec->segname, segname)) - return i; - } - return -1; -} - -/* find a section header given its segname, sectname */ -struct SECTION *find_mach_sec_hdr(struct SECTION *section_hdr, int shnum, const char *segname, - const char *sectname) -{ - int index = find_mach_sec_index(section_hdr, shnum, segname, sectname); - if(index == -1) - return NULL; - return section_hdr+index; -} - - -static inline void fetch_next_pair_value(struct relocation_info * rel, unsigned int *value) -{ - struct scattered_relocation_info * scarel; - - if(R_SCATTERED & rel->r_address) { - scarel = (struct scattered_relocation_info*)rel; - if(scarel->r_type != PPC_RELOC_PAIR) - error("fetch_next_pair_value: looking for a pair which was not found (1)"); - *value = scarel->r_value; - } else { - if(rel->r_type != PPC_RELOC_PAIR) - error("fetch_next_pair_value: looking for a pair which was not found (2)"); - *value = rel->r_address; - } -} - -/* find a sym name given its value, in a section number */ -static const char * find_sym_with_value_and_sec_number( int value, int sectnum, int * offset ) -{ - int i, ret = -1; - - for( i = 0 ; i < nb_syms; i++ ) - { - if( !(symtab[i].n_type & N_STAB) && (symtab[i].n_type & N_SECT) && - (symtab[i].n_sect == sectnum) && (symtab[i].st_value <= value) ) - { - if( (ret<0) || (symtab[i].st_value >= symtab[ret].st_value) ) - ret = i; - } - } - if( ret < 0 ) { - *offset = 0; - return 0; - } else { - *offset = value - symtab[ret].st_value; - return get_sym_name(&symtab[ret]); - } -} - -/* - * Find symbol name given a (virtual) address, and a section which is of type - * S_NON_LAZY_SYMBOL_POINTERS or S_LAZY_SYMBOL_POINTERS or S_SYMBOL_STUBS - */ -static const char * find_reloc_name_in_sec_ptr(int address, struct SECTION * sec_hdr) -{ - unsigned int tocindex, symindex, size; - const char *name = 0; - - /* Sanity check */ - if(!( address >= sec_hdr->addr && address < (sec_hdr->addr + sec_hdr->size) ) ) - return (char*)0; - - if( sec_hdr->flags & S_SYMBOL_STUBS ){ - size = sec_hdr->reserved2; - if(size == 0) - error("size = 0"); - - } - else if( (sec_hdr->flags & S_LAZY_SYMBOL_POINTERS) || - (sec_hdr->flags & S_NON_LAZY_SYMBOL_POINTERS) ) - size = sizeof(unsigned long); - else - return 0; - - /* Compute our index in toc */ - tocindex = (address - sec_hdr->addr)/size; - symindex = tocdylib[sec_hdr->reserved1 + tocindex]; - - name = get_sym_name(&symtab[symindex]); - - return name; -} - -static const char * find_reloc_name_given_its_address(int address) -{ - unsigned int i; - for(i = 0; i < segment->nsects ; i++) - { - const char * name = find_reloc_name_in_sec_ptr(address, §ion_hdr[i]); - if((long)name != -1) - return name; - } - return 0; -} - -static const char * get_reloc_name(EXE_RELOC * rel, int * sslide) -{ - char * name = 0; - struct scattered_relocation_info * sca_rel = (struct scattered_relocation_info*)rel; - int sectnum = rel->r_symbolnum; - int sectoffset; - unsigned int other_half=0; - - /* init the slide value */ -#ifdef HOST_X86_64 /* no scattered on x86_64 */ - switch(rel->r_length) - { - case 0: *sslide = *(uint8_t *)(text + rel->r_address); break; - case 1: *sslide = *(uint16_t *)(text + rel->r_address); break; - case 2: *sslide = *(uint32_t *)(text + rel->r_address); break; - case 3: *sslide = *(uint64_t *)(text + rel->r_address); break; - } -#else - *sslide = 0; - - if (R_SCATTERED & rel->r_address) { - char *name = (char *)find_reloc_name_given_its_address(sca_rel->r_value); - - /* search it in the full symbol list, if not found */ - if (!name) { - int i; - for (i = 0; i < nb_syms; i++) { - EXE_SYM *sym = &symtab[i]; - if (sym->st_value == sca_rel->r_value) { - name = get_sym_name(sym); - switch (sca_rel->r_type) { - case GENERIC_RELOC_VANILLA: - *sslide = *(uint32_t *)(text + sca_rel->r_address) - sca_rel->r_value; - break; - } - break; - } - } - } - return name; - } -#endif - - if(rel->r_extern) - { - /* ignore debug sym */ - if ( symtab[rel->r_symbolnum].n_type & N_STAB ) - return 0; - return get_sym_name(&symtab[rel->r_symbolnum]); - } - -#ifdef HOST_X86_64 - return 0; -#else - - /* Intruction contains an offset to the symbols pointed to, in the rel->r_symbolnum section */ - sectoffset = *(uint32_t *)(text + rel->r_address) & 0xffff; - - if(sectnum==0xffffff) - return 0; - - /* Sanity Check */ - if(sectnum > segment->nsects) - error("sectnum > segment->nsects"); - - switch(rel->r_type) - { - case PPC_RELOC_PAIR: // The second relocation entry of a pair. A PPC_RELOC_PAIR entry must follow each of the other relocation entry types, except for PPC_RELOC_VANILLA, PPC_RELOC_BR14, PPC_RELOC_BR24, and PPC_RELOC_PB_LA_PTR. - break; - case PPC_RELOC_LO16: fetch_next_pair_value(rel+1, &other_half); sectoffset |= (other_half << 16); - break; - case PPC_RELOC_HI16: fetch_next_pair_value(rel+1, &other_half); sectoffset = (sectoffset << 16) | (uint16_t)(other_half & 0xffff); - break; - case PPC_RELOC_HA16: fetch_next_pair_value(rel+1, &other_half); sectoffset = (sectoffset << 16) + (int16_t)(other_half & 0xffff); - break; - case PPC_RELOC_BR24: - sectoffset = ( *(uint32_t *)(text + rel->r_address) & 0x03fffffc ); - if (sectoffset & 0x02000000) sectoffset |= 0xfc000000; - break; - case GENERIC_RELOC_VANILLA: - sectoffset = *(uint32_t *)(text + rel->r_address); - break; - default: - error("switch(rel->type=%d) not found", rel->r_type); - } - - if(rel->r_pcrel) { - sectoffset += rel->r_address; -#ifdef HOST_I386 - sectoffset += (1 << rel->r_length); -#endif - } - - if (rel->r_type == PPC_RELOC_BR24) - name = (char *)find_reloc_name_in_sec_ptr((int)sectoffset, §ion_hdr[sectnum-1]); - - /* search it in the full symbol list, if not found */ - if(!name) - name = (char *)find_sym_with_value_and_sec_number(sectoffset, sectnum, sslide); - - return name; -#endif -} - -/* Used by dyngen common code */ -static const char * get_rel_sym_name(EXE_RELOC * rel) -{ - int sslide; - return get_reloc_name( rel, &sslide); -} - -/* Used by dyngen common code */ -static host_ulong get_rel_offset(EXE_RELOC *rel) -{ - struct scattered_relocation_info * sca_rel = (struct scattered_relocation_info*)rel; - if(R_SCATTERED & rel->r_address) - return sca_rel->r_address; - else - return rel->r_address; -} - -/* load a mach-o object file */ -int load_object(const char *filename, FILE *outfile) -{ - int fd; - unsigned int offset_to_segment = 0; - unsigned int offset_to_dysymtab = 0; - unsigned int offset_to_symtab = 0; - struct load_command lc; - unsigned int i, j; - EXE_SYM *sym; - struct NLIST *syment; - - fd = open(filename, O_RDONLY); - if (fd < 0) - error("can't open file '%s'", filename); - - /* Read Mach header. */ - if (read(fd, &mach_hdr, sizeof (mach_hdr)) != sizeof (mach_hdr)) - error("unable to read file header"); - - /* Check Mach identification. */ - if (!check_mach_header(mach_hdr)) { - error("bad Mach header"); - } - - if (!mach_check_cputype(mach_hdr.cputype)) - error("Unsupported CPU"); - - if (mach_hdr.filetype != MH_OBJECT) - error("Unsupported Mach Object"); - - /* read segment headers */ - for(i=0, j=sizeof(mach_hdr); insects * sizeof(struct SECTION)); - - /* read all section data */ - sdata = (uint8_t **)malloc(sizeof(void *) * segment->nsects); - memset(sdata, 0, sizeof(void *) * segment->nsects); - - /* Load the data in section data */ - for(i = 0; i < segment->nsects; i++) - sdata[i] = load_data(fd, section_hdr[i].offset, section_hdr[i].size); - - /* .data section */ - data_sec_hdr = find_mach_sec_hdr(section_hdr, segment->nsects, SEG_DATA, SECT_DATA); - i = find_mach_sec_index(section_hdr, segment->nsects, SEG_DATA, SECT_DATA); - data = (i == -1) ? NULL : sdata[i]; - - /* const section TODO: __cstring __literal4 __literal8 */ - literal16_sec_hdr = find_mach_sec_hdr(section_hdr, segment->nsects, SEG_TEXT, "__literal16"); - i = find_mach_sec_index(section_hdr, segment->nsects, SEG_TEXT, "__literal16"); - literal16 = (i == -1) ? NULL : sdata[i]; - - /* .text section */ - text_sec_hdr = find_mach_sec_hdr(section_hdr, segment->nsects, SEG_TEXT, SECT_TEXT); - i = find_mach_sec_index(section_hdr, segment->nsects, SEG_TEXT, SECT_TEXT); - if (i == -1 || !text_sec_hdr) - error("could not find __TEXT,__text section"); - text = sdata[i]; - - /* Make sure dysym was loaded */ - if(dysymtabcmd == NULL) - error("could not find __DYSYMTAB segment"); - - /* read the table of content of the indirect sym */ - tocdylib = load_data( fd, dysymtabcmd->indirectsymoff, dysymtabcmd->nindirectsyms * sizeof(uint32_t) ); - - /* Make sure symtab was loaded */ - if(symtabcmd == NULL) - error("could not find __SYMTAB segment"); - nb_syms = symtabcmd->nsyms; - - symtab_std = load_data(fd, symtabcmd->symoff, symtabcmd->nsyms * sizeof(struct NLIST)); - strtab = load_data(fd, symtabcmd->stroff, symtabcmd->strsize); - - symtab = malloc(sizeof(EXE_SYM) * nb_syms); - - /* Now transform the symtab, to an extended version, with the sym size, and the C name */ - for(i = 0, sym = symtab, syment = symtab_std; i < nb_syms; i++, sym++, syment++) { - struct NLIST *sym_follow, *sym_next = 0; - unsigned int j; - memset(sym, 0, sizeof(*sym)); - - if ( syment->n_type & N_STAB ) /* Debug symbols are skipped */ - continue; - - if ( strchr((char*)(strtab + syment->n_un.n_strx), '.') ) /* no Exception handlers */ - continue; - - memcpy(sym, syment, sizeof(*syment)); - - /* Find the following symbol in order to get the current symbol size */ - for(j = 0, sym_follow = symtab_std; j < nb_syms; j++, sym_follow++) { - if ( sym_follow->n_sect != 1 || (sym_follow->n_type & N_STAB) || !(sym_follow->n_value > sym->st_value) ) - continue; - if(!sym_next) { - sym_next = sym_follow; - continue; - } - if(!(sym_next->n_value > sym_follow->n_value)) - continue; - sym_next = sym_follow; - } - if(sym_next) - sym->st_size = sym_next->n_value - sym->st_value; - else - sym->st_size = text_sec_hdr->size - sym->st_value; - } - - /* Find Reloc */ - relocs = load_data(fd, text_sec_hdr->reloff, text_sec_hdr->nreloc * sizeof(struct relocation_info)); - nb_relocs = text_sec_hdr->nreloc; - - close(fd); - return 0; -} - -#endif /* CONFIG_FORMAT_MACH */ - -void get_reloc_expr(char *name, int name_size, const char *sym_name) -{ - const char *p; - char *demangled; - char demangled_buf[256]; - size_t nd = sizeof(demangled_buf); - int status; - - demangled = cxx_demangle(sym_name, demangled_buf, &nd, &status); - if (!status && demangled) - sym_name = demangled; - if (is_op_param(sym_name, &p)) { - snprintf(name, name_size, "param%s", p); - } else if (is_op_gen_label(sym_name, &p)) { - snprintf(name, name_size, "gen_labels[param%s]", p); - } else if (strstart(sym_name, ".LC", NULL)) { - snprintf(name, name_size, "(long)(gen_const_%s())", gen_dot_prefix(sym_name)); - } else { -#ifdef HOST_SPARC - if (sym_name[0] == '.') - snprintf(name, name_size, - "(long)(&__dot_%s)", - sym_name + 1); - else -#endif - snprintf(name, name_size, "(long)(&%s)", sym_name); - } -} - -#ifdef HOST_ARM - -int arm_emit_ldr_info(const char *name, unsigned long start_offset, - FILE *outfile, uint8_t *p_start, uint8_t *p_end, - ELF_RELOC *relocs, int nb_relocs) -{ - uint8_t *p; - uint32_t insn; - int offset, min_offset, pc_offset, data_size; - uint8_t data_allocated[1024]; - unsigned int data_index; - - memset(data_allocated, 0, sizeof(data_allocated)); - - p = p_start; - min_offset = p_end - p_start; - while (p < p_start + min_offset) { - insn = get32((uint32_t *)p); - if ((insn & 0x0d5f0000) == 0x051f0000) { - /* ldr reg, [pc, #im] */ - offset = insn & 0xfff; - if (!(insn & 0x00800000)) - offset = -offset; - if ((offset & 3) !=0) - error("%s:%04x: ldr pc offset must be 32 bit aligned", - name, start_offset + p - p_start); - pc_offset = p - p_start + offset + 8; - if (pc_offset <= (p - p_start) || - pc_offset >= (p_end - p_start)) - error("%s:%04x: ldr pc offset must point inside the function code", - name, start_offset + p - p_start); - if (pc_offset < min_offset) - min_offset = pc_offset; - if (outfile) { - /* ldr position */ - fprintf(outfile, " arm_ldr_ptr->ptr = ptr() + %d;\n", - p - p_start); - /* ldr data index */ - data_index = ((p_end - p_start) - pc_offset - 4) >> 2; - fprintf(outfile, " arm_ldr_ptr->data_ptr = arm_data_ptr + %d;\n", - data_index); - fprintf(outfile, " arm_ldr_ptr++;\n"); - if (data_index >= sizeof(data_allocated)) - error("%s: too many data", name); - if (!data_allocated[data_index]) { - ELF_RELOC *rel; - int i, addend, type; - const char *sym_name, *p; - char relname[1024]; - - data_allocated[data_index] = 1; - - /* data value */ - addend = get32((uint32_t *)(p_start + pc_offset)); - relname[0] = '\0'; - for(i = 0, rel = relocs;i < nb_relocs; i++, rel++) { - if (rel->r_offset == (pc_offset + start_offset)) { - sym_name = get_rel_sym_name(rel); - /* the compiler leave some unnecessary references to the code */ - get_reloc_expr(relname, sizeof(relname), sym_name); - type = ELF32_R_TYPE(rel->r_info); - if (type != R_ARM_ABS32) - error("%s: unsupported data relocation", name); - break; - } - } - fprintf(outfile, " arm_data_ptr[%d] = 0x%x", - data_index, addend); - if (relname[0] != '\0') - fprintf(outfile, " + %s", relname); - fprintf(outfile, ";\n"); - } - } - } - p += 4; - } - data_size = (p_end - p_start) - min_offset; - if (data_size > 0 && outfile) { - fprintf(outfile, " arm_data_ptr += %d;\n", data_size >> 2); - } - - /* the last instruction must be a mov pc, lr */ - if (p == p_start) - goto arm_ret_error; - p -= 4; - insn = get32((uint32_t *)p); - if ((insn & 0xffff0000) != 0xe91b0000) { - arm_ret_error: - if (!outfile) - printf("%s: invalid epilog\n", name); - } - return p - p_start; -} -#endif - - -#define MAX_ARGS 3 - -/* generate op code */ -void gen_code(const char *name, const char *demangled_name, - host_ulong offset, host_ulong size, - FILE *outfile, int gen_switch, const char *prefix) -{ - int copy_size = 0; - uint8_t *p_start, *p_end; - host_ulong start_offset; - int nb_args, i, n; - uint8_t args_present[MAX_ARGS]; - const char *sym_name, *p; - EXE_RELOC *rel; - int op_execute = 0; - char demangled_buf[256]; - size_t nd; - char *demangled; - int status; - - if (strncmp(name, "op_execute", 10) == 0) - op_execute = 1; - - /* Compute exact size excluding prologue and epilogue instructions. - * Increment start_offset to skip epilogue instructions, then compute - * copy_size the indicate the size of the remaining instructions (in - * bytes). - */ - p_start = text + offset; - p_end = p_start + size; - start_offset = offset; - if (op_execute) { - uint8_t *p; - copy_size = p_end - p_start; -#ifdef CONFIG_FORMAT_MACH -#if defined(HOST_PPC) - for (p = p_start; p < p_end; p += 4) { - if (get32((uint32_t *)p) == 0x18deadff) - fprintf(outfile, "DEFINE_CST(op_exec_return_offset,0x%xL)\n\n", (p + 4) - p_start); - } -#elif defined(HOST_I386) - static const uint8_t return_insn[] = {0x0f,0xa6,0xf0}; - for (p = p_start; p < p_end; p++) { - if (memcmp(p, return_insn, sizeof(return_insn)) == 0) - fprintf(outfile, "DEFINE_CST(op_exec_return_offset,0x%xL)\n\n", (p + sizeof(return_insn)) - p_start); - } -#endif -#endif - } - else -#if defined(HOST_I386) || defined(HOST_X86_64) - { - uint8_t *p; - p = p_end - 1; - if (p == p_start) - error("empty code for %s", name); - while (*p != 0xc3) { - p--; - if (p <= p_start) - error("ret or jmp expected at the end of %s", name); - } - copy_size = p - p_start; - } -#elif defined(HOST_PPC) - { - uint8_t *p; - p = (void *)(p_end - 4); - if (p == p_start) - error("empty code for %s", name); - if (get32((uint32_t *)p) != 0x4e800020) - error("blr expected at the end of %s", name); - copy_size = p - p_start; - } -#elif defined(HOST_S390) - { - uint8_t *p; - p = (void *)(p_end - 2); - if (p == p_start) - error("empty code for %s", name); - if (get16((uint16_t *)p) != 0x07fe && get16((uint16_t *)p) != 0x07f4) - error("br %%r14 expected at the end of %s", name); - copy_size = p - p_start; - } -#elif defined(HOST_ALPHA) - { - uint8_t *p; - p = p_end - 4; -#if 0 - /* XXX: check why it occurs */ - if (p == p_start) - error("empty code for %s", name); -#endif - if (get32((uint32_t *)p) != 0x6bfa8001) - error("ret expected at the end of %s", name); - copy_size = p - p_start; - } -#elif defined(HOST_IA64) - { - uint8_t *p; - p = (void *)(p_end - 4); - if (p == p_start) - error("empty code for %s", name); - /* br.ret.sptk.many b0;; */ - /* 08 00 84 00 */ - if (get32((uint32_t *)p) != 0x00840008) - error("br.ret.sptk.many b0;; expected at the end of %s", name); - copy_size = p - p_start; - } -#elif defined(HOST_SPARC) - { - uint32_t start_insn, end_insn1, end_insn2; - uint8_t *p; - p = (void *)(p_end - 8); - if (p <= p_start) - error("empty code for %s", name); - start_insn = get32((uint32_t *)(p_start + 0x0)); - end_insn1 = get32((uint32_t *)(p + 0x0)); - end_insn2 = get32((uint32_t *)(p + 0x4)); - if ((start_insn & ~0x1fff) == 0x9de3a000) { - p_start += 0x4; - start_offset += 0x4; - if ((int)(start_insn | ~0x1fff) < -128) - error("Found bogus save at the start of %s", name); - if (end_insn1 != 0x81c7e008 || end_insn2 != 0x81e80000) - error("ret; restore; not found at end of %s", name); - } else { - error("No save at the beginning of %s", name); - } -#if 0 - /* Skip a preceeding nop, if present. */ - if (p > p_start) { - skip_insn = get32((uint32_t *)(p - 0x4)); - if (skip_insn == 0x01000000) - p -= 4; - } -#endif - copy_size = p - p_start; - } -#elif defined(HOST_SPARC64) - { - uint32_t start_insn, end_insn1, end_insn2, skip_insn; - uint8_t *p; - p = (void *)(p_end - 8); - if (p <= p_start) - error("empty code for %s", name); - start_insn = get32((uint32_t *)(p_start + 0x0)); - end_insn1 = get32((uint32_t *)(p + 0x0)); - end_insn2 = get32((uint32_t *)(p + 0x4)); - if ((start_insn & ~0x1fff) == 0x9de3a000) { - p_start += 0x4; - start_offset += 0x4; - if ((int)(start_insn | ~0x1fff) < -256) - error("Found bogus save at the start of %s", name); - if (end_insn1 != 0x81c7e008 || end_insn2 != 0x81e80000) - error("ret; restore; not found at end of %s", name); - } else { - error("No save at the beginning of %s", name); - } - - /* Skip a preceeding nop, if present. */ - if (p > p_start) { - skip_insn = get32((uint32_t *)(p - 0x4)); - if (skip_insn == 0x01000000) - p -= 4; - } - - copy_size = p - p_start; - } -#elif defined(HOST_ARM) - { - if ((p_end - p_start) <= 16) - error("%s: function too small", name); - if (get32((uint32_t *)p_start) != 0xe1a0c00d || - (get32((uint32_t *)(p_start + 4)) & 0xffff0000) != 0xe92d0000 || - get32((uint32_t *)(p_start + 8)) != 0xe24cb004) - error("%s: invalid prolog", name); - p_start += 12; - start_offset += 12; - copy_size = arm_emit_ldr_info(name, start_offset, NULL, p_start, p_end, - relocs, nb_relocs); - } -#elif defined(HOST_M68K) - { - uint8_t *p; - p = (void *)(p_end - 2); - if (p == p_start) - error("empty code for %s", name); - // remove NOP's, probably added for alignment - while ((get16((uint16_t *)p) == 0x4e71) && - (p>p_start)) - p -= 2; - if (get16((uint16_t *)p) != 0x4e75) - error("rts expected at the end of %s", name); - copy_size = p - p_start; - } -#elif defined(HOST_MIPS) - { - uint8_t *p; - p = (void *)(p_end - 4); - if (p == p_start) - error("empty code for %s", name); - while (p > p_start && get32((uint32_t *)p) != 0x03e00008) - p -= 4; - if (get32((uint32_t *)p) != 0x03e00008) - error("jr ra expected at the end of %s", name); - copy_size = p - p_start; - } -#else -#error unsupported CPU -#endif - - - - /* compute the number of arguments by looking at the relocations */ - for(i = 0;i < MAX_ARGS; i++) - args_present[i] = 0; - - for(i = 0, rel = relocs;i < nb_relocs; i++, rel++) { - host_ulong offset = get_rel_offset(rel); - if (offset >= start_offset && - offset < start_offset + (p_end - p_start)) { - sym_name = get_rel_sym_name(rel); - if(!sym_name) - continue; - nd = sizeof(demangled_buf); - demangled = cxx_demangle(sym_name, demangled_buf, &nd, &status); - if (!status && demangled) - sym_name = demangled; - if (is_op_param(sym_name, &p)) { - n = strtoul(p, NULL, 10); - if (n > MAX_ARGS) - error("too many arguments in %s", name); - args_present[n - 1] = 1; - } - } - } - - nb_args = 0; - while (nb_args < MAX_ARGS && args_present[nb_args]) - nb_args++; - for(i = nb_args; i < MAX_ARGS; i++) { - if (args_present[i]) - error("inconsistent argument numbering in %s", name); - } - - assert(gen_switch == 3); - if (gen_switch == 3) { - const char *func_name = name; - if (prefix && strstr(func_name, prefix) == func_name) - func_name += strlen(prefix); - - fprintf(outfile, "DEFINE_GEN(gen_%s,void,(", func_name); - if (nb_args == 0) { - fprintf(outfile, "void"); - } else { - for(i = 0; i < nb_args; i++) { - if (i != 0) - fprintf(outfile, ", "); - fprintf(outfile, "long param%d", i + 1); - } - } - fprintf(outfile, "))\n"); - fprintf(outfile, "#ifdef DYNGEN_IMPL\n"); - fprintf(outfile, "#define HAVE_gen_%s\n", func_name); - fprintf(outfile, "{\n"); - print_code(outfile, name, p_start + start_offset - offset, copy_size); - - for(i = 0, rel = relocs;i < nb_relocs; i++, rel++) { - host_ulong offset = get_rel_offset(rel); - if (offset >= start_offset && - offset < start_offset + (p_end - p_start)) { - sym_name = get_rel_sym_name(rel); - if(!sym_name) - continue; - nd = sizeof(demangled_buf); - demangled = cxx_demangle(sym_name, demangled_buf, &nd, &status); - if (!status && demangled) - sym_name = demangled; - if (*sym_name && - !is_op_param(sym_name, NULL) && - !is_op_jmp(sym_name, NULL) && - !strstart(sym_name, ".LC", NULL)) - error("unexpected external symbol %s", sym_name); - } - } - - fprintf(outfile, " copy_block(%s_code, %d);\n", name, copy_size); - - /* emit code offset information */ - { - EXE_SYM *sym; - const char *sym_name, *p; - unsigned long val; - int n; - - for(i = 0, sym = symtab; i < nb_syms; i++, sym++) { - sym_name = get_sym_name(sym); - if (strstart(sym_name, "__op_label", &p)) { - uint8_t *ptr; - unsigned long offset; - - /* test if the variable refers to a label inside - the code we are generating */ -#ifdef CONFIG_FORMAT_COFF - if (sym->st_shndx == text_shndx) { - ptr = sdata[coff_text_shndx]; - } else if (sym->st_shndx == data_shndx) { - ptr = sdata[coff_data_shndx]; - } else { - ptr = NULL; - } -#elif defined(CONFIG_FORMAT_MACH) - if(!sym->n_sect) - continue; - ptr = sdata[sym->n_sect-1]; -#else - ptr = sdata[sym->st_shndx]; -#endif - if (!ptr) - error("__op_labelN in invalid section"); - offset = sym->st_value; -#ifdef CONFIG_FORMAT_MACH - offset -= section_hdr[sym->n_sect-1].addr; -#endif - val = *(unsigned long *)(ptr + offset); -#ifdef ELF_USES_RELOCA - { - int reloc_shndx, nb_relocs1, j; - - /* try to find a matching relocation */ - reloc_shndx = find_reloc(sym->st_shndx); - if (reloc_shndx) { - nb_relocs1 = shdr[reloc_shndx].sh_size / - shdr[reloc_shndx].sh_entsize; - rel = (ELF_RELOC *)sdata[reloc_shndx]; - for(j = 0; j < nb_relocs1; j++) { - if (rel->r_offset == offset) { - val = rel->r_addend; - break; - } - rel++; - } - } - } -#endif - - if (val >= start_offset && val < start_offset + copy_size) { - n = strtol(p, NULL, 10); - fprintf(outfile, " label_offsets[%d] = %d + (code_ptr() - gen_code_buf);\n", n, val - start_offset); - } - } - } - } - - /* patch relocations */ - patch_relocations(outfile, name, size, start_offset, copy_size); - fprintf(outfile, " inc_code_ptr(%d);\n", copy_size); - fprintf(outfile, "}\n"); - fprintf(outfile, "#endif\n"); - fprintf(outfile, "\n"); - } -} - -void patch_relocations(FILE *outfile, const char *name, host_ulong size, host_ulong start_offset, int copy_size) -{ - EXE_RELOC *rel; - int i; -#if defined(HOST_I386) -#ifdef CONFIG_FORMAT_MACH - struct scattered_relocation_info *scarel; - char final_sym_name[256]; - const char *sym_name; - const char *p; - int slide, sslide; - - for (i = 0, rel = relocs; i < nb_relocs; i++, rel++) { - unsigned int offset, length, value = 0; - unsigned int type, pcrel, isym = 0; - unsigned int usesym = 0; - - if (R_SCATTERED & rel->r_address) { - scarel = (struct scattered_relocation_info*)rel; - offset = (unsigned int)scarel->r_address; - length = scarel->r_length; - pcrel = scarel->r_pcrel; - type = scarel->r_type; - value = scarel->r_value; - } - else { - value = isym = rel->r_symbolnum; - usesym = (rel->r_extern); - offset = rel->r_address; - length = rel->r_length; - pcrel = rel->r_pcrel; - type = rel->r_type; - } - - slide = offset - start_offset; - - if (!(offset >= start_offset && offset < start_offset + size)) - continue; /* not in our range */ - - sym_name = get_reloc_name(rel, &sslide); - - if (usesym && (symtab[isym].n_type & N_STAB)) - continue; /* don't handle STAB (debug sym) */ - - if (sym_name && is_op_jmp(sym_name, &p)) { - int n; - n = strtol(p, NULL, 10); - fprintf(outfile, " jmp_addr[%d] = code_ptr() + %d;\n", n, slide); - continue; /* Nothing more to do */ - } - - if (!sym_name) { - fprintf(outfile, "/* #warning relocation not handled in %s (value 0x%x, %s, offset 0x%x, length 0x%x, %s, type 0x%x) */\n", - name, value, usesym ? "use sym" : "don't use sym", offset, length, pcrel ? "pcrel":"", type); - continue; /* dunno how to handle without final_sym_name */ - } - - get_reloc_expr(final_sym_name, sizeof(final_sym_name), sym_name); - - if (length != 2) - error("unsupported %d-bit relocation", 8 * (1 << length)); - - switch (type) { - case GENERIC_RELOC_VANILLA: - if (pcrel) { - fprintf(outfile, " *(uint32_t *)(code_ptr() + %d) = %s - (long)(code_ptr() + %d) - 4;\n", - slide, final_sym_name, slide); - } - else { - fprintf(outfile, " *(uint32_t *)(code_ptr() + %d) = (%s + %d);\n", - slide, final_sym_name, sslide); - } - break; - default: - error("unsupported i386 relocation (%d)", type); - } - } -#else - char final_sym_name[256]; - const char *sym_name; - const char *p; - int type; - int addend; - for(i = 0, rel = relocs;i < nb_relocs; i++, rel++) { - if (rel->r_offset >= start_offset && - rel->r_offset < start_offset + copy_size) { - sym_name = get_rel_sym_name(rel); - if (is_op_jmp(sym_name, &p)) { - int n; - n = strtol(p, NULL, 10); - /* __op_jmp relocations are done at - runtime to do translated block - chaining: the offset of the instruction - needs to be stored */ - fprintf(outfile, " jmp_addr[%d] = code_ptr() + %d;\n", - n, rel->r_offset - start_offset); - continue; - } - - get_reloc_expr(final_sym_name, sizeof(final_sym_name), sym_name); - addend = get32((uint32_t *)(text + rel->r_offset)); -#ifdef CONFIG_FORMAT_ELF - type = ELF32_R_TYPE(rel->r_info); - switch(type) { - case R_386_32: - fprintf(outfile, " *(uint32_t *)(code_ptr() + %d) = %s + %d;\n", - rel->r_offset - start_offset, final_sym_name, addend); - break; - case R_386_PC32: - fprintf(outfile, " *(uint32_t *)(code_ptr() + %d) = %s - (long)(code_ptr() + %d) + %d;\n", - rel->r_offset - start_offset, final_sym_name, rel->r_offset - start_offset, addend); - break; - default: - error("unsupported i386 relocation (%d)", type); - } -#elif defined(CONFIG_FORMAT_COFF) - { - char *temp_name; - int j; - EXE_SYM *sym; - temp_name = get_sym_name(symtab + *(uint32_t *)(rel->r_reloc->r_symndx)); - if (!strcmp(temp_name, ".data")) { - for (j = 0, sym = symtab; j < nb_syms; j++, sym++) { - if (strstart(sym->st_name, sym_name, NULL)) { - addend -= sym->st_value; - } - } - } - } - type = rel->r_type; - switch(type) { - case DIR32: - fprintf(outfile, " *(uint32_t *)(code_ptr() + %d) = %s + %d;\n", - rel->r_offset - start_offset, final_sym_name, addend); - break; - case DISP32: - fprintf(outfile, " *(uint32_t *)(code_ptr() + %d) = %s - (long)(code_ptr() + %d) + %d -4;\n", - rel->r_offset - start_offset, final_sym_name, rel->r_offset - start_offset, addend); - break; - default: - error("unsupported i386 relocation (%d)", type); - } -#else -#error unsupport object format for HOST_I386 -#endif - } - } -#endif -#elif defined(HOST_X86_64) -#if defined(CONFIG_FORMAT_MACH) - char final_sym_name[256]; - const char *sym_name; - const char *p; - int slide, sslide; - int bytecount, bitlength; - int local16; - - for (i = 0, rel = relocs, local16 = 0; i < nb_relocs; i++, rel++) { - unsigned int isym, usesym, offset, length, pcrel, type; - int adjustment = 0; - - isym = rel->r_symbolnum; - usesym = rel->r_extern; - offset = rel->r_address; - length = rel->r_length; - pcrel = rel->r_pcrel; - type = rel->r_type; - - if (usesym && (symtab[isym].n_type & N_STAB)) - continue; /* don't handle STAB (debug sym) */ - - if (!(offset >= start_offset && offset < start_offset + size)) - continue; /* not in our range */ - - if (length > 3) - error("unsupported %d-bit relocation", 8 * (1 << length)); - - bytecount = (1 << length); - bitlength = 8 * bytecount; - slide = offset - start_offset; - - if (!usesym) { - // local reloc - sslide = get32((uint32_t *)(text + offset)) + rel->r_address + 4; - if ( literal16_sec_hdr - && sslide >= literal16_sec_hdr->addr - && sslide + 16 <= literal16_sec_hdr->addr + literal16_sec_hdr->size ) { - sprintf(final_sym_name, "literal16_%d", ++local16); - print_data(outfile, final_sym_name, literal16 + sslide - literal16_sec_hdr->addr, 16); - fprintf(outfile, " static uint8 *data_p_%d = NULL;\n", local16); - fprintf(outfile, " if (data_p_%d == NULL)\n", local16); - fprintf(outfile, " data_p_%d = copy_data(%s, %d);\n", local16, final_sym_name, 16); - fprintf(outfile, " *(uint32_t *)(code_ptr() + %d) = (int32_t)((long)data_p_%d - (long)(code_ptr() + %d + %d));\n", - slide, local16, slide, bytecount); - } else { - fprintf(outfile, "/* #warning relocation not handled in %s (section %d, offset 0x%x, length 0x%x, %s, type 0x%x) */\n", - name, isym, offset, length, pcrel ? "pcrel":"", type); - } - continue; - } - - sym_name = get_reloc_name(rel, &sslide); - if (!sym_name) { - error("external symbol not found in %s (section %d, offset 0x%x, length 0x%x, %s, type 0x%x\n", - name, isym, offset, length, pcrel ? "pcrel":"", type); - } - - if (is_op_jmp(sym_name, &p)) { - int n; - n = strtol(p, NULL, 10); - fprintf(outfile, " jmp_addr[%d] = code_ptr() + %d;\n", n, slide); - fprintf(outfile, " *(uint32_t *)(code_ptr() + %d) = 0;\n", slide); - continue; /* Nothing more to do */ - } - - get_reloc_expr(final_sym_name, sizeof(final_sym_name), sym_name); - - switch (type) { - case X86_64_RELOC_SIGNED_1: // Signed displacement with a -1 added. - adjustment = -1; - type = X86_64_RELOC_SIGNED; - break; - case X86_64_RELOC_SIGNED_2: // Signed displacement with a -2 added. - adjustment = -2; - type = X86_64_RELOC_SIGNED; - break; - case X86_64_RELOC_SIGNED_4: // Signed displacement with a -4 added. - adjustment = -4; - type = X86_64_RELOC_SIGNED; - break; - } - - if (pcrel || is_op_gen_label(sym_name, &p)) { - switch (type) { - case X86_64_RELOC_UNSIGNED: // for absolute addresses - case X86_64_RELOC_SIGNED: // for signed 32-bit displacement - case X86_64_RELOC_BRANCH: // a CALL/JMP instruction with 32-bit displacement - fprintf(outfile, " *(uint%d_t *)(code_ptr() + %d) = (int%d_t)((long)%s - (long)(code_ptr() + %d + %d)) + %d;\n", - bitlength, slide, bitlength, final_sym_name, slide, bytecount, sslide + adjustment); - break; - default: - error("unsupported x86_64 relocation (%d) in %s\n", type, sym_name); - } - } else { - switch (type) { - case X86_64_RELOC_UNSIGNED: // for absolute addresses - fprintf(outfile, " *(uint%d_t *)(code_ptr() + %d) = (uint%d_t)%s + %d;\n", - bitlength, slide, bitlength, final_sym_name, sslide); - break; - case X86_64_RELOC_SIGNED: // for signed 32-bit displacement - fprintf(outfile, " *(uint%d_t *)(code_ptr() + %d) = (int%d_t)%s + %d;\n", - bitlength, slide, bitlength, final_sym_name, sslide + adjustment); - break; - default: - error("unsupported x86_64 relocation (%d) in %s\n", type, sym_name); - } - } - } -#elif defined (CONFIG_FORMAT_ELF) - char final_sym_name[256]; - const char *sym_name; - const char *p; - int type; - int addend; - for(i = 0, rel = relocs;i < nb_relocs; i++, rel++) { - if (rel->r_offset >= start_offset && - rel->r_offset < start_offset + copy_size) { - int slide; - sym_name = strtab + symtab[ELFW(R_SYM)(rel->r_info)].st_name; - if (is_op_jmp(sym_name, &p)) { - int n; - n = strtol(p, NULL, 10); - /* __op_jmp relocations are done at - runtime to do translated block - chaining: the offset of the instruction - needs to be stored */ - fprintf(outfile, " jmp_addr[%d] = code_ptr() + %d;\n", - n, rel->r_offset - start_offset); - continue; - } - - slide = rel->r_offset - start_offset; - get_reloc_expr(final_sym_name, sizeof(final_sym_name), sym_name); - type = ELF32_R_TYPE(rel->r_info); - addend = rel->r_addend; - switch(type) { - case R_X86_64_64: - fprintf(outfile, " *(uintptr *)(code_ptr() + %d) = (uintptr)%s + %d;\n", slide, final_sym_name, addend); - break; - case R_X86_64_32: - fprintf(outfile, " *(uint32_t *)(code_ptr() + %d) = (uint32_t)%s + %d;\n", slide, final_sym_name, addend); - break; - case R_X86_64_32S: - fprintf(outfile, " *(uint32_t *)(code_ptr() + %d) = (int32_t)%s + %d;\n", slide, final_sym_name, addend); - break; - case R_X86_64_PC32: - fprintf(outfile, " *(uint32_t *)(code_ptr() + %d) = %s - (long)(code_ptr() + %d) + %d;\n", - slide, final_sym_name, slide, addend); - break; - default: - error("unsupported AMD64 relocation (%d)", type); - } - } - } -#else -#error unsupport object format for HOST_X86_64 -#endif -#elif defined(HOST_PPC) -#ifdef CONFIG_FORMAT_ELF - for(i = 0, rel = relocs;i < nb_relocs; i++, rel++) { - if (rel->r_offset >= start_offset && - rel->r_offset < start_offset + copy_size) { - int slide; - sym_name = strtab + symtab[ELFW(R_SYM)(rel->r_info)].st_name; - if (is_op_jmp(sym_name, &p)) { - int n; - n = strtol(p, NULL, 10); - /* __op_jmp relocations are done at - runtime to do translated block - chaining: the offset of the instruction - needs to be stored */ - fprintf(outfile, " jmp_addr[%d] = code_ptr() + %d;\n", - n, rel->r_offset - start_offset); - continue; - } - - slide = rel->r_offset - start_offset; - get_reloc_expr(final_sym_name, sizeof(final_sym_name), sym_name); - type = ELF32_R_TYPE(rel->r_info); - addend = rel->r_addend; - switch(type) { - case R_PPC_ADDR32: - fprintf(outfile, " *(uint32_t *)(code_ptr() + %d) = %s + %d;\n", - slide, final_sym_name, addend); - break; - case R_PPC_ADDR16_LO: - fprintf(outfile, " *(uint16_t *)(code_ptr() + %d) = (%s + %d);\n", - slide, final_sym_name, addend); - break; - case R_PPC_ADDR16_HI: - fprintf(outfile, " *(uint16_t *)(code_ptr() + %d) = (%s + %d) >> 16;\n", - slide, final_sym_name, addend); - break; - case R_PPC_ADDR16_HA: - fprintf(outfile, " *(uint16_t *)(code_ptr() + %d) = (%s + %d + 0x8000) >> 16;\n", - slide, final_sym_name, addend); - break; - case R_PPC_REL24: - /* warning: must be at 32 MB distancy */ - fprintf(outfile, " *(uint32_t *)(code_ptr() + %d) = (*(uint32_t *)(code_ptr() + %d) & ~0x03fffffc) | ((%s - (long)(code_ptr() + %d) + %d) & 0x03fffffc);\n", - slide, slide, final_sym_name, slide, addend); - break; - default: - error("unsupported powerpc relocation (%d)", type); - } - } - } -#elif defined(CONFIG_FORMAT_MACH) - struct scattered_relocation_info *scarel; - char final_sym_name[256]; - const char *sym_name; - const char *p; - int slide, sslide; - - for(i = 0, rel = relocs; i < nb_relocs; i++, rel++) { - unsigned int offset, length, value = 0; - unsigned int type, pcrel, isym = 0; - unsigned int usesym = 0; - - if(R_SCATTERED & rel->r_address) { - scarel = (struct scattered_relocation_info*)rel; - offset = (unsigned int)scarel->r_address; - length = scarel->r_length; - pcrel = scarel->r_pcrel; - type = scarel->r_type; - value = scarel->r_value; - } else { - value = isym = rel->r_symbolnum; - usesym = (rel->r_extern); - offset = rel->r_address; - length = rel->r_length; - pcrel = rel->r_pcrel; - type = rel->r_type; - } - - slide = offset - start_offset; - - if (!(offset >= start_offset && offset < start_offset + size)) - continue; /* not in our range */ - - sym_name = get_reloc_name(rel, &sslide); - - if(usesym && (symtab[isym].n_type & N_STAB)) - continue; /* don't handle STAB (debug sym) */ - - if (sym_name && is_op_jmp(sym_name, &p)) { - int n; - n = strtol(p, NULL, 10); - fprintf(outfile, " jmp_addr[%d] = code_ptr() + %d;\n", - n, slide); - continue; /* Nothing more to do */ - } - - if(!sym_name) - { - fprintf(outfile, "/* #warning relocation not handled in %s (value 0x%x, %s, offset 0x%x, length 0x%x, %s, type 0x%x) */\n", - name, value, usesym ? "use sym" : "don't use sym", offset, length, pcrel ? "pcrel":"", type); - continue; /* dunno how to handle without final_sym_name */ - } - - get_reloc_expr(final_sym_name, sizeof(final_sym_name), sym_name); - - switch(type) { - case PPC_RELOC_BR24: - if (!is_op_param(sym_name, &p)) { - fprintf(outfile, "{\n"); - fprintf(outfile, " uint32_t imm = *(uint32_t *)(code_ptr() + %d) & 0x3fffffc;\n", slide); - fprintf(outfile, " *(uint32_t *)(code_ptr() + %d) = (*(uint32_t *)(code_ptr() + %d) & ~0x03fffffc) | ((imm + ((long)%s - (long)code_ptr()) + %d) & 0x03fffffc);\n", - slide, slide, final_sym_name, sslide ); - fprintf(outfile, "}\n"); - } else { - fprintf(outfile, " *(uint32_t *)(code_ptr() + %d) = (*(uint32_t *)(code_ptr() + %d) & ~0x03fffffc) | (((long)%s - (long)code_ptr() - %d) & 0x03fffffc);\n", - slide, slide, final_sym_name, slide); - } - break; - case PPC_RELOC_HI16: - fprintf(outfile, " *(uint16_t *)(code_ptr() + %d + 2) = (%s + %d) >> 16;\n", - slide, final_sym_name, sslide); - break; - case PPC_RELOC_LO16: - fprintf(outfile, " *(uint16_t *)(code_ptr() + %d + 2) = (%s + %d);\n", - slide, final_sym_name, sslide); - break; - case PPC_RELOC_HA16: - fprintf(outfile, " *(uint16_t *)(code_ptr() + %d + 2) = (%s + %d + 0x8000) >> 16;\n", - slide, final_sym_name, sslide); - break; - default: - error("unsupported powerpc relocation (%d)", type); - } - } -#else -#error unsupport object format -#endif -#elif defined(HOST_S390) - char final_sym_name[256]; - const char *sym_name; - int type; - int addend; - for(i = 0, rel = relocs;i < nb_relocs; i++, rel++) { - if (rel->r_offset >= start_offset && - rel->r_offset < start_offset + copy_size) { - int slide; - sym_name = strtab + symtab[ELFW(R_SYM)(rel->r_info)].st_name; - get_reloc_expr(final_sym_name, sizeof(final_sym_name), sym_name); - type = ELF32_R_TYPE(rel->r_info); - slide = rel->r_offset - start_offset; - addend = rel->r_addend; - switch(type) { - case R_390_32: - fprintf(outfile, " *(uint32_t *)(code_ptr() + %d) = %s + %d;\n", - slide, final_sym_name, addend); - break; - case R_390_16: - fprintf(outfile, " *(uint16_t *)(code_ptr() + %d) = %s + %d;\n", - slide, final_sym_name, addend); - break; - case R_390_8: - fprintf(outfile, " *(uint8_t *)(code_ptr() + %d) = %s + %d;\n", - slide, final_sym_name, addend); - break; - default: - error("unsupported s390 relocation (%d)", type); - } - } - } -#elif defined(HOST_ALPHA) - for (i = 0, rel = relocs; i < nb_relocs; i++, rel++) { - if (rel->r_offset >= start_offset && rel->r_offset < start_offset + copy_size) { - int type; - - type = ELF64_R_TYPE(rel->r_info); - sym_name = strtab + symtab[ELF64_R_SYM(rel->r_info)].st_name; - switch (type) { - case R_ALPHA_GPDISP: - /* The gp is just 32 bit, and never changes, so it's easiest to emit it - as an immediate instead of constructing it from the pv or ra. */ - fprintf(outfile, " immediate_ldah(code_ptr() + %ld, gp);\n", - rel->r_offset - start_offset); - fprintf(outfile, " immediate_lda(code_ptr() + %ld, gp);\n", - rel->r_offset - start_offset + rel->r_addend); - break; - case R_ALPHA_LITUSE: - /* jsr to literal hint. Could be used to optimize to bsr. Ignore for - now, since some called functions (libc) need pv to be set up. */ - break; - case R_ALPHA_HINT: - /* Branch target prediction hint. Ignore for now. Should be already - correct for in-function jumps. */ - break; - case R_ALPHA_LITERAL: - /* Load a literal from the GOT relative to the gp. Since there's only a - single gp, nothing is to be done. */ - break; - case R_ALPHA_GPRELHIGH: - /* Handle fake relocations against __op_PARAM symbol. Need to emit the - high part of the immediate value instead. Other symbols need no - special treatment. */ - if (is_op_param(sym_name, &p)) - fprintf(outfile, " immediate_ldah(code_ptr() + %ld, param%s);\n", - rel->r_offset - start_offset, p); - break; - case R_ALPHA_GPRELLOW: - if (is_op_param(sym_name, &p)) - fprintf(outfile, " immediate_lda(code_ptr() + %ld, param%s);\n", - rel->r_offset - start_offset, p); - break; - case R_ALPHA_BRSGP: - /* PC-relative jump. Tweak offset to skip the two instructions that try to - set up the gp from the pv. */ - fprintf(outfile, " fix_bsr(code_ptr() + %ld, (uint8_t *) &%s - (code_ptr() + %ld + 4) + 8);\n", - rel->r_offset - start_offset, sym_name, rel->r_offset - start_offset); - break; - default: - error("unsupported Alpha relocation (%d)", type); - } - } - } -#elif defined(HOST_IA64) - char final_sym_name[256]; - const char *sym_name; - int type; - int addend; - for(i = 0, rel = relocs;i < nb_relocs; i++, rel++) { - if (rel->r_offset >= start_offset && rel->r_offset < start_offset + copy_size) { - sym_name = strtab + symtab[ELF64_R_SYM(rel->r_info)].st_name; - get_reloc_expr(final_sym_name, sizeof(final_sym_name), sym_name); - type = ELF64_R_TYPE(rel->r_info); - addend = rel->r_addend; - switch(type) { - case R_IA64_LTOFF22: - error("must implement R_IA64_LTOFF22 relocation"); - case R_IA64_PCREL21B: - error("must implement R_IA64_PCREL21B relocation"); - default: - error("unsupported ia64 relocation (%d)", type); - } - } - } -#elif defined(HOST_SPARC) - char final_sym_name[256]; - const char *sym_name; - const char *p; - int type; - int addend; - for(i = 0, rel = relocs;i < nb_relocs; i++, rel++) { - if (rel->r_offset >= start_offset && - rel->r_offset < start_offset + copy_size) { - sym_name = strtab + symtab[ELF32_R_SYM(rel->r_info)].st_name; - if (is_op_param(sym_name, &p)) { - snprintf(final_sym_name, sizeof(final_sym_name), "param%s", p); - } else { - if (sym_name[0] == '.') - snprintf(final_sym_name, sizeof(final_sym_name), - "(long)(&__dot_%s)", - sym_name + 1); - else - snprintf(final_sym_name, sizeof(final_sym_name), - "(long)(&%s)", sym_name); - } - type = ELF32_R_TYPE(rel->r_info); - addend = rel->r_addend; - switch(type) { - case R_SPARC_32: - fprintf(outfile, " *(uint32_t *)(code_ptr() + %d) = %s + %d;\n", - rel->r_offset - start_offset, final_sym_name, addend); - break; - case R_SPARC_HI22: - fprintf(outfile, - " *(uint32_t *)(code_ptr() + %d) = " - "((*(uint32_t *)(code_ptr() + %d)) " - " & ~0x3fffff) " - " | (((%s + %d) >> 10) & 0x3fffff);\n", - rel->r_offset - start_offset, - rel->r_offset - start_offset, - final_sym_name, addend); - break; - case R_SPARC_LO10: - fprintf(outfile, - " *(uint32_t *)(code_ptr() + %d) = " - "((*(uint32_t *)(code_ptr() + %d)) " - " & ~0x3ff) " - " | ((%s + %d) & 0x3ff);\n", - rel->r_offset - start_offset, - rel->r_offset - start_offset, - final_sym_name, addend); - break; - case R_SPARC_WDISP30: - fprintf(outfile, - " *(uint32_t *)(code_ptr() + %d) = " - "((*(uint32_t *)(code_ptr() + %d)) " - " & ~0x3fffffff) " - " | ((((%s + %d) - (long)(code_ptr() + %d))>>2) " - " & 0x3fffffff);\n", - rel->r_offset - start_offset, - rel->r_offset - start_offset, - final_sym_name, addend, - rel->r_offset - start_offset); - break; - default: - error("unsupported sparc relocation (%d)", type); - } - } - } -#elif defined(HOST_SPARC64) - char final_sym_name[256]; - const char *sym_name; - int type; - int addend; - for(i = 0, rel = relocs;i < nb_relocs; i++, rel++) { - if (rel->r_offset >= start_offset && - rel->r_offset < start_offset + copy_size) { - sym_name = strtab + symtab[ELF64_R_SYM(rel->r_info)].st_name; - get_reloc_expr(final_sym_name, sizeof(final_sym_name), sym_name); - type = ELF64_R_TYPE(rel->r_info); - addend = rel->r_addend; - switch(type) { - case R_SPARC_32: - fprintf(outfile, " *(uint32_t *)(code_ptr() + %d) = %s + %d;\n", - rel->r_offset - start_offset, final_sym_name, addend); - break; - case R_SPARC_HI22: - fprintf(outfile, - " *(uint32_t *)(code_ptr() + %d) = " - "((*(uint32_t *)(code_ptr() + %d)) " - " & ~0x3fffff) " - " | (((%s + %d) >> 10) & 0x3fffff);\n", - rel->r_offset - start_offset, - rel->r_offset - start_offset, - final_sym_name, addend); - break; - case R_SPARC_LO10: - fprintf(outfile, - " *(uint32_t *)(code_ptr() + %d) = " - "((*(uint32_t *)(code_ptr() + %d)) " - " & ~0x3ff) " - " | ((%s + %d) & 0x3ff);\n", - rel->r_offset - start_offset, - rel->r_offset - start_offset, - final_sym_name, addend); - break; - case R_SPARC_WDISP30: - fprintf(outfile, - " *(uint32_t *)(code_ptr() + %d) = " - "((*(uint32_t *)(code_ptr() + %d)) " - " & ~0x3fffffff) " - " | ((((%s + %d) - (long)(code_ptr() + %d))>>2) " - " & 0x3fffffff);\n", - rel->r_offset - start_offset, - rel->r_offset - start_offset, - final_sym_name, addend, - rel->r_offset - start_offset); - break; - default: - error("unsupported sparc64 relocation (%d)", type); - } - } - } -#elif defined(HOST_ARM) - char final_sym_name[256]; - const char *sym_name; - int type; - int addend; - - arm_emit_ldr_info(final_sym_name, start_offset, outfile, p_start, p_end, - relocs, nb_relocs); - - for(i = 0, rel = relocs;i < nb_relocs; i++, rel++) { - if (rel->r_offset >= start_offset && - rel->r_offset < start_offset + copy_size) { - sym_name = strtab + symtab[ELFW(R_SYM)(rel->r_info)].st_name; - /* the compiler leave some unnecessary references to the code */ - if (sym_name[0] == '\0') - continue; - get_reloc_expr(final_sym_name, sizeof(final_sym_name), sym_name); - type = ELF32_R_TYPE(rel->r_info); - addend = get32((uint32_t *)(text + rel->r_offset)); - switch(type) { - case R_ARM_ABS32: - fprintf(outfile, " *(uint32_t *)(code_ptr() + %d) = %s + %d;\n", - rel->r_offset - start_offset, final_sym_name, addend); - break; - case R_ARM_PC24: - fprintf(outfile, " arm_reloc_pc24((uint32_t *)(code_ptr() + %d), 0x%x, %s);\n", - rel->r_offset - start_offset, addend, final_sym_name); - break; - default: - error("unsupported arm relocation (%d)", type); - } - } - } -#elif defined(HOST_M68K) - char final_sym_name[256]; - const char *sym_name; - int type; - int addend; - Elf32_Sym *sym; - for(i = 0, rel = relocs;i < nb_relocs; i++, rel++) { - if (rel->r_offset >= start_offset && - rel->r_offset < start_offset + copy_size) { - sym = &(symtab[ELFW(R_SYM)(rel->r_info)]); - sym_name = strtab + symtab[ELFW(R_SYM)(rel->r_info)].st_name; - get_reloc_expr(final_sym_name, sizeof(final_sym_name), sym_name); - type = ELF32_R_TYPE(rel->r_info); - addend = get32((uint32_t *)(text + rel->r_offset)) + rel->r_addend; - switch(type) { - case R_68K_32: - fprintf(outfile, " /* R_68K_32 RELOC, offset %x */\n", rel->r_offset) ; - fprintf(outfile, " *(uint32_t *)(code_ptr() + %d) = %s + %#x;\n", - rel->r_offset - start_offset, final_sym_name, addend ); - break; - case R_68K_PC32: - fprintf(outfile, " /* R_68K_PC32 RELOC, offset %x */\n", rel->r_offset); - fprintf(outfile, " *(uint32_t *)(code_ptr() + %d) = %s - (long)(code_ptr() + %#x) + %#x;\n", - rel->r_offset - start_offset, final_sym_name, rel->r_offset - start_offset, /*sym->st_value+*/ addend); - break; - default: - error("unsupported m68k relocation (%d)", type); - } - } - } -#elif defined(HOST_MIPS) - char final_sym_name[256]; - const char *sym_name; - int type; - int addend; - for (i = 0, rel = relocs; i < nb_relocs; i++, rel++) { - if (rel->r_offset >= start_offset && - rel->r_offset < start_offset + copy_size) { - sym_name = strtab + symtab[ELFW(R_SYM)(rel->r_info)].st_name; - if (is_op_jmp(sym_name, &p)) { - int n; - n = strtol(p, NULL, 10); - /* __op_jmp relocations are done at - runtime to do translated block - chaining: the offset of the instruction - needs to be stored */ - fprintf(outfile, " jmp_addr[%d] = code_ptr() + %d;\n", - n, rel->r_offset - start_offset); - continue; - } - - get_reloc_expr(final_sym_name, sizeof(final_sym_name), sym_name); - type = ELFW(R_TYPE)(rel->r_info); - addend = rel->r_addend; - if (addend) - error("non zero addend (%d), deal with this", addend); - switch (type) { - case R_MIPS_HI16: - fprintf(outfile, " /* R_MIPS_HI16 reloc, offset %x */\n", rel->r_offset); - fprintf(outfile, " *(uint16_t *)(code_ptr() + %d) = (uint16_t)((uint32_t)(%s)>>16);\n", - rel->r_offset - start_offset + 2, final_sym_name); - break; - case R_MIPS_LO16: - fprintf(outfile, " /* R_MIPS_LO16 reloc, offset %x */\n", rel->r_offset); - fprintf(outfile, " *(uint16_t *)(code_ptr() + %d) = (uint16_t)((uint32_t)(%s)&0xffff);\n", - rel->r_offset - start_offset + 2, final_sym_name); - break; - default: - error("unsupported MIPS relocation (%d)", type); - } - } - } -#else -#error unsupported CPU -#endif -} - -int gen_file(FILE *outfile, int out_type) -{ - int i; - EXE_SYM *sym; - - assert(out_type == OUT_GEN_OP_ALL); - if (out_type == OUT_GEN_OP_ALL) { - int status; - size_t nf, nd = 256; - char *demangled_name, *func_name; - if ((demangled_name = malloc(nd)) == NULL) - return -1; - if ((func_name = malloc(nf = nd)) == NULL) { - free(demangled_name); - return -1; - } - - fprintf(outfile, "#ifndef DEFINE_CST\n"); - fprintf(outfile, "#define DEFINE_CST(NAME, VALUE)\n"); - fprintf(outfile, "#endif\n"); - for(i = 0, sym = symtab; i < nb_syms; i++, sym++) { - const char *name; - name = get_sym_name(sym); - if (strstart(name, OP_PREFIX "execute", NULL)) { - /* skip Exception handlers */ - if (strchr(name, '.')) - continue; - strcpy(func_name, name); -#if defined(CONFIG_FORMAT_ELF) || defined(CONFIG_FORMAT_COFF) - if (sym->st_shndx != text_shndx) - error("invalid section for opcode (0x%x)", sym->st_shndx); -#endif - gen_code(func_name, NULL, sym->st_value, sym->st_size, outfile, 3, NULL); - } - else if (strstart(name, OP_PREFIX "exec_return_offset", NULL)) { - host_ulong *long_p; -#if defined(CONFIG_FORMAT_ELF) || defined(CONFIG_FORMAT_COFF) - if (sym->st_shndx != data_shndx) - error("invalid section for data (0x%x)", sym->st_shndx); -#endif - if (data == NULL) - error("no .data section found"); -#ifdef CONFIG_FORMAT_MACH - fprintf(outfile, "DEFINE_CST(%s,0x%xL)\n\n", name, *((host_ulong *)(data + sym->st_value - data_sec_hdr->addr))); -#else - fprintf(outfile, "DEFINE_CST(%s,0x%xL)\n\n", name, *((host_ulong *)(data + sym->st_value))); -#endif - } - else if (strstart(name, OP_PREFIX "invoke", NULL)) { - const char *prefix = "helper_"; - strcpy(func_name, prefix); - strcat(func_name, name); -#if defined(CONFIG_FORMAT_ELF) || defined(CONFIG_FORMAT_COFF) - if (sym->st_shndx != text_shndx) - error("invalid section for opcode (0x%x)", sym->st_shndx); -#endif - gen_code(func_name, NULL, sym->st_value, sym->st_size, outfile, 3, prefix); - } - else { - /* demangle C++ symbols */ - nd = 256; - demangled_name = cxx_demangle(name, demangled_name, &nd, &status); - if (status == 0 && strstart(demangled_name, OP_PREFIX, NULL)) { - /* get real function name */ - char *p = strchr(demangled_name, '('); - if (p && !strstart(p, "()::label", NULL)) { - int func_name_length = p - demangled_name; - if (nd > nf) { - char *new_func_name; - nf = nd; - if ((new_func_name = realloc(func_name, nf)) == NULL) { - free(func_name); - return -1; - } - func_name = new_func_name; - } - strncpy(func_name, demangled_name, func_name_length); - func_name[func_name_length] = '\0'; - /* emit code generator */ -#if defined(CONFIG_FORMAT_ELF) || defined(CONFIG_FORMAT_COFF) - if (sym->st_shndx != text_shndx) - error("invalid section for opcode (%s:0x%x)", name, sym->st_shndx); -#endif - gen_code(func_name, demangled_name, sym->st_value, sym->st_size, outfile, 3, NULL); - } - } - } - } - fprintf(outfile, "#undef DEFINE_CST\n"); - fprintf(outfile, "#undef DEFINE_GEN\n"); - - free(func_name); - free(demangled_name); - } - - return 0; -} - -void usage(void) -{ - printf("dyngen (c) 2003-2004 Fabrice Bellard\n" - "usage: dyngen [-o outfile] objfile\n" - "Generate a dynamic code generator from an object file\n" - ); - exit(1); -} - -int main(int argc, char **argv) -{ - int c, out_type; - const char *filename, *outfilename; - FILE *outfile; - - outfilename = "out.c"; - out_type = OUT_GEN_OP_ALL; - for(;;) { - c = getopt(argc, argv, "ho:"); - if (c == -1) - break; - switch(c) { - case 'h': - usage(); - break; - case 'o': - outfilename = optarg; - break; - } - } - if (optind >= argc) - usage(); - filename = argv[optind]; - outfile = fopen(outfilename, "w"); - if (!outfile) - error("could not open '%s'", outfilename); - - load_object(filename, outfile); - gen_file(outfile, out_type); - fclose(outfile); - return 0; -} - -/* - Local variables: - tab-width: 4 - indent-tabs-mode: nil - End: - */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/jit/jit-cache.cpp b/SheepShaver/src/kpx_cpu/src/cpu/jit/jit-cache.cpp deleted file mode 100644 index e99e5963..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/jit/jit-cache.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/* - * jit-cache.cpp - Translation cache management - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" -#include "vm_alloc.h" -#include "cpu/jit/jit-cache.hpp" - -#define DEBUG 0 -#include "debug.h" - -// Default cache size in KB -#if defined(__alpha__) -const int JIT_CACHE_SIZE = 2 * 1024; -#elif defined(__powerpc__) || defined(__ppc__) -const int JIT_CACHE_SIZE = 4 * 1024; -#else -const int JIT_CACHE_SIZE = 8 * 1024; -#endif -const int JIT_CACHE_SIZE_GUARD = 4096; - -basic_jit_cache::basic_jit_cache() - : cache_size(0), tcode_start(NULL), code_start(NULL), code_p(NULL), code_end(NULL), data(NULL) -{ -} - -basic_jit_cache::~basic_jit_cache() -{ - kill_translation_cache(); - - // Release data pool - data_chunk_t *p = data; - while (p) { - data_chunk_t *d = p; - p = p->next; - D(bug("basic_jit_cache: Release data pool %p (%d KB)\n", d, d->size / 1024)); - vm_release(d, d->size); - } -} - -bool -basic_jit_cache::init_translation_cache(uint32 size) -{ - size *= 1024; - - // Round up translation cache size to 16 KB boundaries - const uint32 roundup = 16 * 1024; - cache_size = (size + JIT_CACHE_SIZE_GUARD + roundup - 1) & -roundup; - assert(cache_size > 0); - - tcode_start = (uint8 *)vm_acquire(cache_size, VM_MAP_PRIVATE | VM_MAP_32BIT); - if (tcode_start == VM_MAP_FAILED) { - tcode_start = NULL; - return false; - } - - if (vm_protect(tcode_start, cache_size, - VM_PAGE_READ | VM_PAGE_WRITE | VM_PAGE_EXECUTE) < 0) { - vm_release(tcode_start, cache_size); - tcode_start = NULL; - return false; - } - - done: - D(bug("basic_jit_cache: Translation cache: %d KB at %p\n", cache_size / 1024, tcode_start)); - code_start = tcode_start; - code_p = code_start; - code_end = code_p + size; - return true; -} - -void -basic_jit_cache::kill_translation_cache() -{ - if (tcode_start) { - D(bug("basic_jit_cache: Release translation cache\n")); - vm_release(tcode_start, cache_size); - cache_size = 0; - tcode_start = NULL; - } -} - -bool -basic_jit_cache::initialize(void) -{ - if (cache_size == 0) - set_cache_size(JIT_CACHE_SIZE); - return tcode_start && cache_size; -} - -void -basic_jit_cache::set_cache_size(uint32 size) -{ - kill_translation_cache(); - if (size) - init_translation_cache(size); -} - -uint8 * -basic_jit_cache::copy_data(const uint8 *block, uint32 size) -{ - const int ALIGN = 16; - uint8 *ptr; - - if (data && (data->offs + size) < data->size) - ptr = (uint8 *)data + data->offs; - else { - // No free space left, allocate a new chunk - uint32 to_alloc = sizeof(*data) + size + ALIGN; - uint32 page_size = vm_get_page_size(); - to_alloc = (to_alloc + page_size - 1) & -page_size; - - D(bug("basic_jit_cache: Allocate data pool (%d KB)\n", to_alloc / 1024)); - ptr = (uint8 *)vm_acquire(to_alloc, VM_MAP_PRIVATE | VM_MAP_32BIT); - if (ptr == VM_MAP_FAILED) { - fprintf(stderr, "FATAL: Could not allocate data pool!\n"); - abort(); - } - - data_chunk_t *dcp = (data_chunk_t *)ptr; - dcp->size = to_alloc; - dcp->offs = (sizeof(*data) + ALIGN - 1) & -ALIGN; - dcp->next = data; - data = dcp; - - ptr += dcp->offs; - } - - memcpy(ptr, block, size); - data->offs += (size + ALIGN - 1) & -ALIGN; - D(bug("basic_jit_cache: DATA %p, %d bytes [data=%p, offs=%u]\n", ptr, size, data, data->offs)); - return ptr; -} diff --git a/SheepShaver/src/kpx_cpu/src/cpu/jit/jit-cache.hpp b/SheepShaver/src/kpx_cpu/src/cpu/jit/jit-cache.hpp deleted file mode 100644 index 201841d8..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/jit/jit-cache.hpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - * jit-cache.hpp - Translation cache management - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef JIT_CACHE_H -#define JIT_CACHE_H - -#define _JIT_HEADER jit-target-cache.hpp -#include "cpu/jit/jit-target-dispatch.h" - -/** - * Basic translation cache - **/ - -class basic_jit_cache -{ - // Translation cache (allocated base, current pointer, end pointer) - uint32 cache_size; - uint8 *tcode_start; - uint8 *code_start; - uint8 *code_p; - uint8 *code_end; - - // Data pool (32-bit addressable) - struct data_chunk_t { - uint32 size; - uint32 offs; - data_chunk_t *next; - }; - data_chunk_t *data; - -protected: - - // Initialize translation cache - bool init_translation_cache(uint32 size); - void kill_translation_cache(); - - // Initialize user code start - void set_code_start(uint8 *ptr); - - // Increase/set/get current position - void inc_code_ptr(int offset) { code_p += offset; } - void set_code_ptr(uint8 *ptr) { code_p = ptr; } -public: - uint8 *code_ptr() const { return code_p; } - -public: - - // Default constructor & destructor (use default JIT_CACHE_SIZE) - basic_jit_cache(); - ~basic_jit_cache(); - - bool initialize(void); - void set_cache_size(uint32 size); - - // Invalidate translation cache - void invalidate_cache(); - bool full_translation_cache() const - { return code_p >= code_end; } - - // Emit code to translation cache - template< typename T > - void emit_generic(T v); - void emit_8(uint8 v) { emit_generic(v); } - void emit_16(uint16 v) { emit_generic(v); } - void emit_32(uint32 v) { emit_generic(v); } - void emit_64(uint64 v) { emit_generic(v); } - void emit_ptr(uintptr v) { emit_generic(v); } - void copy_block(const uint8 *block, uint32 size); - void emit_block(const uint8 *block, uint32 size); - - // Emit data to constant pool - uint8 *copy_data(const uint8 *block, uint32 size); -}; - -inline void -basic_jit_cache::set_code_start(uint8 *ptr) -{ - assert(ptr >= tcode_start && ptr < code_end); - code_start = ptr; -} - -inline void -basic_jit_cache::invalidate_cache() -{ - code_p = code_start; -} - -template< class T > -inline void -basic_jit_cache::emit_generic(T v) -{ - *((T *)code_ptr()) = v; - inc_code_ptr(sizeof(T)); -} - -inline void -basic_jit_cache::copy_block(const uint8 *block, uint32 size) -{ - memcpy(code_ptr(), block, size); -} - -inline void -basic_jit_cache::emit_block(const uint8 *block, uint32 size) -{ - copy_block(block, size); - inc_code_ptr(size); -} - -#endif /* JIT_CACHE_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/jit/jit-codegen.hpp b/SheepShaver/src/kpx_cpu/src/cpu/jit/jit-codegen.hpp deleted file mode 100644 index 7d428a4c..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/jit/jit-codegen.hpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * jit-codegen.hpp - Generic code generator - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef JIT_CODEGEN_H -#define JIT_CODEGEN_H - -#include "cpu/jit/jit-cache.hpp" - -#if defined(__i386__) -#include "cpu/jit/x86/jit-target-codegen.hpp" -typedef x86_codegen jit_codegen; -#elif defined(__x86_64__) -#include "cpu/jit/amd64/jit-target-codegen.hpp" -typedef amd64_codegen jit_codegen; -#else -struct jit_codegen - : public basic_jit_cache -{ -}; -#endif - -#endif /* JIT_CODEGEN_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/jit/jit-config.hpp b/SheepShaver/src/kpx_cpu/src/cpu/jit/jit-config.hpp deleted file mode 100644 index 44fd2458..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/jit/jit-config.hpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * jit-config.hpp - JIT config utils - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef JIT_CONFIG_H -#define JIT_CONFIG_H - -/** - * ENABLE_DYNGEN - * - * Define to enable the portable "JIT1" engine based on code - * inlining technique as implemented in QEMU. - **/ - -#ifndef ENABLE_DYNGEN -#define ENABLE_DYNGEN 0 -#endif - -/** - * DYNGEN_ASM_OPTS - * - * Define to permit host inline asm optimizations. This is - * particularly useful to compute emulated condition code - * registers. - **/ - -#if ENABLE_DYNGEN -#ifndef DYNGEN_ASM_OPTS -#define DYNGEN_ASM_OPTS 0 -#endif -#endif - -/** - * DYNGEN_DIRECT_BLOCK_CHAINING - * - * Define to enable direct block chaining on platforms supporting - * that feature. e.g. PowerPC. - **/ - -#if ENABLE_DYNGEN -#ifndef DYNGEN_DIRECT_BLOCK_CHAINING -#define DYNGEN_DIRECT_BLOCK_CHAINING 1 -#endif -#endif - -#endif /* JIT_CONFIG_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/jit/jit-target-dispatch.h b/SheepShaver/src/kpx_cpu/src/cpu/jit/jit-target-dispatch.h deleted file mode 100644 index f1ece399..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/jit/jit-target-dispatch.h +++ /dev/null @@ -1,70 +0,0 @@ - -/* - * jit-target-dispatch.h - JIT headers dispatcher - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* Undefine some built-ins */ -#ifdef i386 -#undef i386 -#define _jit_defined_i386 -#endif -#ifdef amd64 -#undef amd64 -#define _jit_defined_amd64 -#endif -#ifdef mips -#undef mips -#define _jit_defined_mips -#endif - -/* Dispatch arch dependent header */ -#define _JIT_CONCAT4(a,b,c,d) a##b##c##d -#if defined(__GNUC__) -#define _JIT_MAKE_HEADER(arch,header) -#else -#define _JIT_MAKE_HEADER(arch,header) _JIT_CONCAT4() -#endif -#if defined(__x86_64__) -#include _JIT_MAKE_HEADER(amd64,_JIT_HEADER) -#elif defined(__i386__) -#include _JIT_MAKE_HEADER(x86,_JIT_HEADER) -#elif defined(__powerpc__) || defined(__ppc__) -#include _JIT_MAKE_HEADER(ppc,_JIT_HEADER) -#elif defined(__mips__) || (defined __sgi && defined __mips) -#include _JIT_MAKE_HEADER(mips,_JIT_HEADER) -#else -#error "Unknown architecture, please submit bug report" -#endif -#undef _JIT_CONCAT4 -#undef _JIT_MAKE_HEADER -#undef _JIT_HEADER - -/* Redefine built-ins */ -#ifdef _jit_defined_i386 -#undef _jit_defined_i386 -#define i386 1 -#endif -#ifdef _jit_defined_amd64 -#undef _jit_defined_amd64 -#define amd64 1 -#endif -#ifdef _jit_defined_mips -#undef _jit_defined_mips -#define mips 1 -#endif diff --git a/SheepShaver/src/kpx_cpu/src/cpu/jit/mips/dyngen-target-exec.h b/SheepShaver/src/kpx_cpu/src/cpu/jit/mips/dyngen-target-exec.h deleted file mode 100644 index 2c2140de..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/jit/mips/dyngen-target-exec.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * dyngen defines for micro operation code - * - * Copyright (c) 2003-2004-2004 Fabrice Bellard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef DYNGEN_TARGET_EXEC_H -#define DYNGEN_TARGET_EXEC_H - -enum { - /* callee save registers */ -#define AREG0 "s0" - AREG0_ID = 16, - -#define AREG1 "s1" - AREG1_ID = 17, - -#define AREG2 "s2" - AREG2_ID = 18, - -#define AREG3 "s3" - AREG3_ID = 19, - -#define AREG4 "s4" - AREG4_ID = 20, - -#define AREG5 "s5" - AREG5_ID = 21, -}; - -#endif /* DYNGEN_TARGET_EXEC_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/jit/mips/jit-target-cache.hpp b/SheepShaver/src/kpx_cpu/src/cpu/jit/mips/jit-target-cache.hpp deleted file mode 100644 index 8e8ca3b8..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/jit/mips/jit-target-cache.hpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - * jit-target-cache.hpp - Target specific code to invalidate cache - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef JIT_TARGET_CACHE_H -#define JIT_TARGET_CACHE_H - -#if defined __sgi -#include -static inline void flush_icache_range(unsigned long start, unsigned long stop) -{ - cacheflush((void *)start, stop - start, BCACHE); -} -#elif defined __GNUC__ -#error "FIXME: implement assembly code for code cache invalidation" -#endif - -#endif /* JIT_TARGET_CACHE_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/jit/ppc/dyngen-target-exec.h b/SheepShaver/src/kpx_cpu/src/cpu/jit/ppc/dyngen-target-exec.h deleted file mode 100644 index e139e4c9..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/jit/ppc/dyngen-target-exec.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * dyngen defines for micro operation code - * - * Copyright (c) 2003-2004-2004 Fabrice Bellard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef DYNGEN_TARGET_EXEC_H -#define DYNGEN_TARGET_EXEC_H - -enum { -#define AREG0 "r27" - AREG0_ID = 27, - -#define AREG1 "r24" - AREG1_ID = 24, - -#define AREG2 "r25" - AREG2_ID = 25, - -#define AREG3 "r26" - AREG3_ID = 26, - -#define AREG4 "r16" - AREG4_ID = 16, - -#define AREG5 "r17" - AREG5_ID = 17, - -#define AREG6 "r18" - AREG6_ID = 18, - -#define AREG7 "r19" - AREG7_ID = 19, - -#define AREG8 "r20" - AREG8_ID = 20, - -#define AREG9 "r21" - AREG9_ID = 21, - -#define AREG10 "r22" - AREG10_ID = 22, - -#define AREG11 "r23" - AREG11_ID = 23, - -#define FREG0 "f1" - FREG0_ID = 1, - -#define FREG1 "f2" - FREG1_ID = 2, - -#define FREG2 "f3" - FREG2_ID = 3, -}; - -#endif /* DYNGEN_TARGET_EXEC_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/jit/ppc/jit-target-cache.hpp b/SheepShaver/src/kpx_cpu/src/cpu/jit/ppc/jit-target-cache.hpp deleted file mode 100644 index 8a83eb3d..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/jit/ppc/jit-target-cache.hpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * jit-target-cache.hpp - Target specific code to invalidate cache - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef JIT_TARGET_CACHE_H -#define JIT_TARGET_CACHE_H - -static inline void flush_icache_range(unsigned long start, unsigned long stop) -{ - const int MIN_CACHE_LINE_SIZE = 8; /* conservative value */ - - unsigned long p; - - p = start & ~(MIN_CACHE_LINE_SIZE - 1); - stop = (stop + MIN_CACHE_LINE_SIZE - 1) & ~(MIN_CACHE_LINE_SIZE - 1); - - for (p = start; p < stop; p += MIN_CACHE_LINE_SIZE) { - asm volatile ("dcbst 0,%0" : : "r"(p) : "memory"); - } - asm volatile ("sync" : : : "memory"); - for (p = start; p < stop; p += MIN_CACHE_LINE_SIZE) { - asm volatile ("icbi 0,%0" : : "r"(p) : "memory"); - } - asm volatile ("sync" : : : "memory"); - asm volatile ("isync" : : : "memory"); -} - -#endif /* JIT_TARGET_CACHE_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/jit/x86/codegen_x86.h b/SheepShaver/src/kpx_cpu/src/cpu/jit/x86/codegen_x86.h deleted file mode 120000 index 110f4bd0..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/jit/x86/codegen_x86.h +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../BasiliskII/src/uae_cpu/compiler/codegen_x86.h \ No newline at end of file diff --git a/SheepShaver/src/kpx_cpu/src/cpu/jit/x86/dyngen-target-exec.h b/SheepShaver/src/kpx_cpu/src/cpu/jit/x86/dyngen-target-exec.h deleted file mode 100644 index 4480345e..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/jit/x86/dyngen-target-exec.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * dyngen defines for micro operation code - * - * Copyright (c) 2003-2004-2004 Fabrice Bellard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef DYNGEN_TARGET_EXEC_H -#define DYNGEN_TARGET_EXEC_H - -enum { - /* callee save registers */ -#define AREG0 "ebp" - AREG0_ID = 5, - -#define AREG1 "ebx" - AREG1_ID = 3, - -#define AREG2 "esi" - AREG2_ID = 6, - -#define AREG3 "edi" - AREG3_ID = 7, - - // NOTE: the following XMM registers definitions require to build - // *-dyngen-ops.cpp with -ffixed-xmmN - - /* vector registers */ -#define VREG0 "xmm4" - VREG0_ID = 4, - -#define VREG1 "xmm5" - VREG1_ID = 5, - -#define VREG2 "xmm6" - VREG2_ID = 6, - -#define VREG3 "xmm7" - VREG3_ID = 7, -}; - -#endif /* DYNGEN_TARGET_EXEC_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/jit/x86/jit-target-cache.hpp b/SheepShaver/src/kpx_cpu/src/cpu/jit/x86/jit-target-cache.hpp deleted file mode 100644 index f411d3bb..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/jit/x86/jit-target-cache.hpp +++ /dev/null @@ -1 +0,0 @@ -#include "cpu/jit/dummy/jit-target-cache.hpp" diff --git a/SheepShaver/src/kpx_cpu/src/cpu/jit/x86/jit-target-codegen.hpp b/SheepShaver/src/kpx_cpu/src/cpu/jit/x86/jit-target-codegen.hpp deleted file mode 100644 index 0643de90..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/jit/x86/jit-target-codegen.hpp +++ /dev/null @@ -1,760 +0,0 @@ -/* - * jit-target-codegen.hpp - Target specific code generator - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef JIT_X86_CODEGEN_H -#define JIT_X86_CODEGEN_H - -// XXX drop (Basilisk II, lightning) => merge into here -#define X86_FLAT_REGISTERS 0 -#define X86_OPTIMIZE_ALU 1 -#define X86_OPTIMIZE_ROTSHI 1 -#include "cpu/jit/x86/codegen_x86.h" - -#if defined(__GNUC__) -#define x86_emit_failure(MSG) gen_failure(MSG, __FILE__, __LINE__, __FUNCTION__) -#else -#define x86_emit_failure(MSG) gen_failure(MSG, __FILE__, __LINE__) -#endif -#define x86_code_pointer __my_cached_code_ptr -#define x86_get_target() x86_code_pointer -#define x86_emit_byte(v) (void)(*x86_code_pointer++ = (v)) -#define x86_emit_word(v) (*((uint16 *)x86_code_pointer) = (v), (void)(x86_code_pointer += 2)) -#define x86_emit_long(v) (*((uint32 *)x86_code_pointer) = (v), (void)(x86_code_pointer += 4)) -#define x86_emit_quad(v) (*((uint64 *)x86_code_pointer) = (v), (void)(x86_code_pointer += 8)) - -struct x86_immediate_operand { - const int32 value; - - explicit x86_immediate_operand(int32 imm) - : value(imm) - { } -}; - -struct x86_memory_operand { - const int32 MD; - const int8 MB; - const int8 MI; - const int8 MS; - - x86_memory_operand(int32 d, int b, int i = X86_NOREG, int s = 1) - : MD(d), MB(b), MI(i), MS(s) - { } -}; - -class x86_codegen - : public basic_jit_cache -{ -protected: - - void gen_failure(const char *msg, const char *file, int line, const char *fn = NULL); - -public: - - /* XXX this avoids emit_XXX() functions because GCC cannot - optimize out intermediate code_ptr() updates */ -#define GEN_CODE(CODE) do { \ - uint8 *x86_code_pointer = code_ptr(); \ - CODE; \ - set_code_ptr(x86_code_pointer); \ -} while (0) - -public: - - void gen_insn(int type, int op, int s, int d); - void gen_insn(int type, int op, x86_memory_operand const & mem, int d); - -private: - -#define DEFINE_OP(SZ, SFX) \ - void gen_arith_##SZ(int op, int s, int d) \ - { GEN_CODE(_ALU##SFX##rr(op, s, d)); } \ - void gen_arith_##SZ(int op, x86_memory_operand const & mem, int d) \ - { GEN_CODE(_ALU##SFX##mr(op, mem.MD, mem.MB, mem.MI, mem.MS, d)); } \ - void gen_arith_##SZ(int op, int s, x86_memory_operand const & mem) \ - { GEN_CODE(_ALU##SFX##rm(op, s, mem.MD, mem.MB, mem.MI, mem.MS)); } \ - void gen_arith_##SZ(int op, x86_immediate_operand const & imm, int d) \ - { GEN_CODE(_ALU##SFX##ir(op, imm.value, d)); } \ - void gen_arith_##SZ(int op, x86_immediate_operand const & imm, x86_memory_operand const & mem) \ - { GEN_CODE(_ALU##SFX##im(op, imm.value, mem.MD, mem.MB, mem.MI, mem.MS)); } - - DEFINE_OP(8, B); - DEFINE_OP(16, W); - DEFINE_OP(32, L); - -#undef DEFINE_OP - -public: - -#define DEFINE_OP_SZ(SZ, NAME, OP) \ - void gen_##NAME##_##SZ(int s, int d) \ - { gen_arith_##SZ(X86_##OP, s, d); } \ - void gen_##NAME##_##SZ(x86_memory_operand const & mem, int d) \ - { gen_arith_##SZ(X86_##OP, mem, d); } \ - void gen_##NAME##_##SZ(int s, x86_memory_operand const & mem) \ - { gen_arith_##SZ(X86_##OP, s, mem); } \ - void gen_##NAME##_##SZ(x86_immediate_operand const & imm, int d) \ - { gen_arith_##SZ(X86_##OP, imm, d); } \ - void gen_##NAME##_##SZ(x86_immediate_operand const & imm, x86_memory_operand const & mem) \ - { gen_arith_##SZ(X86_##OP, imm, mem); } - -#define DEFINE_OP(NAME, OP) \ - DEFINE_OP_SZ(8, NAME, OP) \ - DEFINE_OP_SZ(16, NAME, OP) \ - DEFINE_OP_SZ(32, NAME, OP) - - DEFINE_OP(add, ADD); - DEFINE_OP(sub, SUB); - DEFINE_OP(adc, ADC); - DEFINE_OP(sbb, SBB); - DEFINE_OP(cmp, CMP); - DEFINE_OP(or, OR); - DEFINE_OP(xor, XOR); - DEFINE_OP(and, AND); - -#undef DEFINE_OP -#undef DEFINE_OP_SZ - -private: - -#define DEFINE_OP(SZ, SFX) \ - void gen_rotshi_##SZ(int op, int s, int d) \ - { GEN_CODE(_ROTSHI##SFX##rr(op, s, d)); } \ - void gen_rotshi_##SZ(int op, int s, x86_memory_operand const & mem) \ - { GEN_CODE(_ROTSHI##SFX##rm(op, s, mem.MD, mem.MB, mem.MI, mem.MS)); } \ - void gen_rotshi_##SZ(int op, x86_immediate_operand const & imm, int d) \ - { GEN_CODE(_ROTSHI##SFX##ir(op, imm.value, d)); } \ - void gen_rotshi_##SZ(int op, x86_immediate_operand const & imm, x86_memory_operand const & mem) \ - { GEN_CODE(_ROTSHI##SFX##im(op, imm.value, mem.MD, mem.MB, mem.MI, mem.MS)); } - - DEFINE_OP(8, B); - DEFINE_OP(16, W); - DEFINE_OP(32, L); - -#undef DEFINE_OP - -public: - -#define DEFINE_OP_SZ(SZ, NAME, OP) \ - void gen_##NAME##_##SZ(int s, int d) \ - { gen_rotshi_##SZ(X86_##OP, s, d); } \ - void gen_##NAME##_##SZ(int s, x86_memory_operand const & mem) \ - { gen_rotshi_##SZ(X86_##OP, s, mem); } \ - void gen_##NAME##_##SZ(x86_immediate_operand const & imm, int d) \ - { gen_rotshi_##SZ(X86_##OP, imm, d); } \ - void gen_##NAME##_##SZ(x86_immediate_operand const & imm, x86_memory_operand const & mem) \ - { gen_rotshi_##SZ(X86_##OP, imm, mem); } - -#define DEFINE_OP(NAME, OP) \ - DEFINE_OP_SZ(8, NAME, OP) \ - DEFINE_OP_SZ(16, NAME, OP) \ - DEFINE_OP_SZ(32, NAME, OP) - - DEFINE_OP(rol, ROL); - DEFINE_OP(ror, ROR); - DEFINE_OP(rcl, RCL); - DEFINE_OP(rcr, RCR); - DEFINE_OP(shl, SHL); - DEFINE_OP(shr, SHR); - DEFINE_OP(sar, SAR); - -#undef DEFINE_OP -#undef DEFINE_OP_SZ - -private: - -#define DEFINE_OP(SZ, SFX) \ - void gen_bitop_##SZ(int op, int s, int d) \ - { GEN_CODE(_BT##SFX##rr(op, s, d)); } \ - void gen_bitop_##SZ(int op, int s, x86_memory_operand const & mem) \ - { GEN_CODE(_BT##SFX##rm(op, s, mem.MD, mem.MB, mem.MI, mem.MS)); } \ - void gen_bitop_##SZ(int op, x86_immediate_operand const & imm, int d) \ - { GEN_CODE(_BT##SFX##ir(op, imm.value, d)); } \ - void gen_bitop_##SZ(int op, x86_immediate_operand const & imm, x86_memory_operand const & mem) \ - { GEN_CODE(_BT##SFX##im(op, imm.value, mem.MD, mem.MB, mem.MI, mem.MS)); } - - DEFINE_OP(16, W); - DEFINE_OP(32, L); - -#undef DEFINE_OP - -public: - -#define DEFINE_OP_SZ(SZ, NAME, OP) \ - void gen_##NAME##_##SZ(int s, int d) \ - { gen_bitop_##SZ(X86_##OP, s, d); } \ - void gen_##NAME##_##SZ(int s, x86_memory_operand const & mem) \ - { gen_bitop_##SZ(X86_##OP, s, mem); } \ - void gen_##NAME##_##SZ(x86_immediate_operand const & imm, int d) \ - { gen_bitop_##SZ(X86_##OP, imm, d); } \ - void gen_##NAME##_##SZ(x86_immediate_operand const & imm, x86_memory_operand const & mem) \ - { gen_bitop_##SZ(X86_##OP, imm, mem); } - -#define DEFINE_OP(NAME, OP) \ - DEFINE_OP_SZ(16, NAME, OP) \ - DEFINE_OP_SZ(32, NAME, OP) - - DEFINE_OP(bt, BT); - DEFINE_OP(btc, BTC); - DEFINE_OP(bts, BTS); - DEFINE_OP(btr, BTR); - -#undef DEFINE_OP -#undef DEFINE_OP_SZ - -public: - -#define DEFINE_OP(SZ, SFX) \ - void gen_mov_##SZ(int s, int d) \ - { GEN_CODE(MOV##SFX##rr(s, d)); } \ - void gen_mov_##SZ(x86_memory_operand const & mem, int d) \ - { GEN_CODE(MOV##SFX##mr(mem.MD, mem.MB, mem.MI, mem.MS, d)); } \ - void gen_mov_##SZ(int s, x86_memory_operand const & mem) \ - { GEN_CODE(MOV##SFX##rm(s, mem.MD, mem.MB, mem.MI, mem.MS)); } \ - void gen_mov_##SZ(x86_immediate_operand const & imm, int d) \ - { GEN_CODE(MOV##SFX##ir(imm.value, d)); } \ - void gen_mov_##SZ(x86_immediate_operand const & imm, x86_memory_operand const & mem) \ - { GEN_CODE(MOV##SFX##im(imm.value, mem.MD, mem.MB, mem.MI, mem.MS)); } \ - void gen_test_##SZ(int s, int d) \ - { GEN_CODE(TEST##SFX##rr(s, d)); } \ - void gen_test_##SZ(int s, x86_memory_operand const & mem) \ - { GEN_CODE(TEST##SFX##rm(s, mem.MD, mem.MB, mem.MI, mem.MS)); } \ - void gen_test_##SZ(x86_immediate_operand const & imm, int d) \ - { GEN_CODE(TEST##SFX##ir(imm.value, d)); } \ - void gen_test_##SZ(x86_immediate_operand const & imm, x86_memory_operand const & mem) \ - { GEN_CODE(TEST##SFX##im(imm.value, mem.MD, mem.MB, mem.MI, mem.MS)); } - - DEFINE_OP(8, B); - DEFINE_OP(16, W); - DEFINE_OP(32, L); - -#undef DEFINE_OP - -private: - - void gen_unary_8(int op, int r) - { GEN_CODE(_UNARYBr(op, r)); } - void gen_unary_8(int op, x86_memory_operand const & mem) - { GEN_CODE(_UNARYBm(op, mem.MD, mem.MB, mem.MI, mem.MS)); } - void gen_unary_16(int op, int r) - { GEN_CODE(_UNARYWr(op, r)); } - void gen_unary_16(int op, x86_memory_operand const & mem) - { GEN_CODE(_UNARYWm(op, mem.MD, mem.MB, mem.MI, mem.MS)); } - void gen_unary_32(int op, int r) - { GEN_CODE(_UNARYLr(op, r)); } - void gen_unary_32(int op, x86_memory_operand const & mem) - { GEN_CODE(_UNARYLm(op, mem.MD, mem.MB, mem.MI, mem.MS)); } - -public: - -#define DEFINE_OP_SZ(SZ, NAME, OP) \ - void gen_##NAME##_##SZ(int r) \ - { gen_unary_##SZ(X86_##OP, r); } \ - void gen_##NAME##_##SZ(x86_memory_operand const & mem) \ - { gen_unary_##SZ(X86_##OP, mem); } - -#define DEFINE_OP(NAME, OP) \ - DEFINE_OP_SZ(8, NAME, OP) \ - DEFINE_OP_SZ(16, NAME, OP) \ - DEFINE_OP_SZ(32, NAME, OP) - - DEFINE_OP(not, NOT); - DEFINE_OP(neg, NEG); - DEFINE_OP(mul, MUL); - DEFINE_OP(div, DIV); - DEFINE_OP(imul, IMUL); - DEFINE_OP(idiv, IDIV); - -#undef DEFINE_OP -#undef DEFINE_OP_SZ - - void gen_imul_16(int s, int d) - { GEN_CODE(IMULWrr(s, d)); } - void gen_imul_16(x86_memory_operand const & mem, int d) - { GEN_CODE(IMULWmr(mem.MD, mem.MB, mem.MI, mem.MS, d)); } - void gen_imul_16(int s, x86_immediate_operand const & imm, int d) - { GEN_CODE(IMULWirr(imm.value, s, d)); } - void gen_imul_16(x86_memory_operand const & mem, x86_immediate_operand const & imm, int d) - { GEN_CODE(IMULWimr(imm.value, mem.MD, mem.MB, mem.MI, mem.MS, d)); } - void gen_imul_32(int s, int d) - { GEN_CODE(IMULLrr(s, d)); } - void gen_imul_32(x86_memory_operand const & mem, int d) - { GEN_CODE(IMULLmr(mem.MD, mem.MB, mem.MI, mem.MS, d)); } - void gen_imul_32(x86_immediate_operand const & imm, int d) - { GEN_CODE(IMULLir(imm.value, d)); } - void gen_imul_32(x86_immediate_operand const & imm, int s, int d) - { GEN_CODE(IMULLirr(imm.value, s, d)); } - void gen_imul_32(x86_memory_operand const & mem, x86_immediate_operand const & imm, int d) - { GEN_CODE(IMULLimr(imm.value, mem.MD, mem.MB, mem.MI, mem.MS, d)); } - -public: - - void gen_call(x86_immediate_operand const & target) - { GEN_CODE(CALLm(target.value)); } - void gen_call(int r) - { GEN_CODE(CALLsr(r)); } - void gen_call(x86_memory_operand const & mem) - { GEN_CODE(CALLsm(mem.MD, mem.MB, mem.MI, mem.MS)); } - void gen_jmp(x86_immediate_operand const & target) - { GEN_CODE(JMPm(target.value)); } - void gen_jmp(int r) - { GEN_CODE(JMPsr(r)); } - void gen_jmp(x86_memory_operand const & mem) - { GEN_CODE(JMPsm(mem.MD, mem.MB, mem.MI, mem.MS)); } - void gen_jcc(int cc, x86_immediate_operand const & target) - { GEN_CODE(JCCim(cc, target.value)); } - void gen_jcc_offset(int cc, x86_immediate_operand const & offset) - { GEN_CODE(JCCii(cc, offset.value)); } - void gen_setcc(int cc, int r) - { GEN_CODE(SETCCir(cc, r)); } - void gen_setcc(int cc, x86_memory_operand const & mem) - { GEN_CODE(SETCCim(cc, mem.MD, mem.MB, mem.MI, mem.MS)); } - void gen_cmov_16(int cc, int r, int d) - { GEN_CODE(CMOVWrr(cc, r, d)); } - void gen_cmov_16(int cc, x86_memory_operand const & mem, int d) - { GEN_CODE(CMOVWmr(cc, mem.MD, mem.MB, mem.MI, mem.MS, d)); } - void gen_cmov_32(int cc, int r, int d) - { GEN_CODE(CMOVLrr(cc, r, d)); } - void gen_cmov_32(int cc, x86_memory_operand const & mem, int d) - { GEN_CODE(CMOVLmr(cc, mem.MD, mem.MB, mem.MI, mem.MS, d)); } - -public: - - void gen_push(int r) - { GEN_CODE(PUSHLr(r)); } - void gen_push(x86_memory_operand const & mem) - { GEN_CODE(PUSHLm(mem.MD, mem.MB, mem.MI, mem.MS)); } - void gen_pop(int r) - { GEN_CODE(POPLr(r)); } - void gen_pop(x86_memory_operand const & mem) - { GEN_CODE(POPLm(mem.MD, mem.MB, mem.MI, mem.MS)); } - void gen_pusha(void) - { GEN_CODE(PUSHA()); } - void gen_popa(void) - { GEN_CODE(POPA()); } - void gen_pushf(void) - { GEN_CODE(PUSHF()); } - void gen_popf(void) - { GEN_CODE(POPF()); } - -public: - -#define DEFINE_OP_SZ(SZ, SFX, NAME, OP) \ - void gen_##NAME##_##SZ(int s, int d) \ - { GEN_CODE(OP##SFX##rr(s, d)); } \ - void gen_##NAME##_##SZ(int s, x86_memory_operand const & mem) \ - { GEN_CODE(OP##SFX##rm(s, mem.MD, mem.MB, mem.MI, mem.MS)); } - -#define DEFINE_OP(NAME, OP) \ - DEFINE_OP_SZ(8, B, NAME, OP) \ - DEFINE_OP_SZ(16, W, NAME, OP) \ - DEFINE_OP_SZ(32, L, NAME, OP) - - DEFINE_OP(cmpxchg, CMPXCHG); - DEFINE_OP(xadd, XADD); - DEFINE_OP(xchg, XCHG); - -#undef DEFINE_OP -#undef DEFINE_OP_SZ - -public: - -#define DEFINE_OP(NAME, OP) \ - void gen_##NAME(int s, int d) \ - { GEN_CODE(OP##rr(s, d)); } \ - void gen_##NAME(x86_memory_operand const & mem, int d) \ - { GEN_CODE(OP##mr(mem.MD, mem.MB, mem.MI, mem.MS, d)); } - - DEFINE_OP(bsf_16, BSFW); - DEFINE_OP(bsr_16, BSRW); - DEFINE_OP(bsf_32, BSFL); - DEFINE_OP(bsr_32, BSRL); - DEFINE_OP(mov_sx_8_16, MOVSBW); - DEFINE_OP(mov_zx_8_16, MOVZBW); - DEFINE_OP(mov_sx_8_32, MOVSBL); - DEFINE_OP(mov_zx_8_32, MOVZBL); - DEFINE_OP(mov_sx_16_32, MOVSWL); - DEFINE_OP(mov_zx_16_32, MOVZWL); - -#undef DEFINE_OP - -public: - - void gen_bswap_32(int r) - { GEN_CODE(BSWAPLr(r)); } - void gen_lea_32(x86_memory_operand const & mem, int d) - { GEN_CODE(LEALmr(mem.MD, mem.MB, mem.MI, mem.MS, d)); } - void gen_clc(void) - { GEN_CODE(CLC()); } - void gen_stc(void) - { GEN_CODE(STC()); } - void gen_cmc(void) - { GEN_CODE(CMC()); } - void gen_lahf(void) - { GEN_CODE(LAHF()); } - void gen_sahf(void) - { GEN_CODE(SAHF()); } - -private: - - void gen_sse_arith_ss(int op, int s, int d) - { GEN_CODE(_SSESSrr(op, s, d)); } - void gen_sse_arith_ss(int op, x86_memory_operand const & mem, int d) - { GEN_CODE(_SSESSmr(op, mem.MD, mem.MB, mem.MI, mem.MS, d)); } - void gen_sse_arith_sd(int op, int s, int d) - { GEN_CODE(_SSESDrr(op, s, d)); } - void gen_sse_arith_sd(int op, x86_memory_operand const & mem, int d) - { GEN_CODE(_SSESDmr(op, mem.MD, mem.MB, mem.MI, mem.MS, d)); } - void gen_sse_arith_ps(int op, int s, int d) - { GEN_CODE(_SSEPSrr(op, s, d)); } - void gen_sse_arith_ps(int op, x86_memory_operand const & mem, int d) - { GEN_CODE(_SSEPSmr(op, mem.MD, mem.MB, mem.MI, mem.MS, d)); } - void gen_sse_arith_pd(int op, int s, int d) - { GEN_CODE(_SSEPDrr(op, s, d)); } - void gen_sse_arith_pd(int op, x86_memory_operand const & mem, int d) - { GEN_CODE(_SSEPDmr(op, mem.MD, mem.MB, mem.MI, mem.MS, d)); } - -public: - - void gen_cmpps(int cc, int s, int d) - { GEN_CODE(CMPPSrr(cc, s, d)); } - void gen_cmpps(int cc, x86_memory_operand const & mem, int d) - { GEN_CODE(CMPPSmr(cc, mem.MD, mem.MB, mem.MI, mem.MS, d)); } - void gen_cmppd(int cc, int s, int d) - { GEN_CODE(CMPPDrr(cc, s, d)); } - void gen_cmppd(int cc, x86_memory_operand const & mem, int d) - { GEN_CODE(CMPPDmr(cc, mem.MD, mem.MB, mem.MI, mem.MS, d)); } - void gen_cmpss(int cc, int s, int d) - { GEN_CODE(CMPSSrr(cc, s, d)); } - void gen_cmpss(int cc, x86_memory_operand const & mem, int d) - { GEN_CODE(CMPSSmr(cc, mem.MD, mem.MB, mem.MI, mem.MS, d)); } - void gen_cmpsd(int cc, int s, int d) - { GEN_CODE(CMPSDrr(cc, s, d)); } - void gen_cmpsd(int cc, x86_memory_operand const & mem, int d) - { GEN_CODE(CMPSDmr(cc, mem.MD, mem.MB, mem.MI, mem.MS, d)); } - -public: - -#define DEFINE_OP_SS(NAME, OP) \ - void gen_##NAME##ss(x86_memory_operand const & mem, int d) \ - { gen_sse_arith_ss(X86_SSE_##OP, mem, d); } \ - void gen_##NAME##ss(int s, int d) \ - { gen_sse_arith_ss(X86_SSE_##OP, s, d); } -#define DEFINE_OP_SD(NAME, OP) \ - void gen_##NAME##sd(x86_memory_operand const & mem, int d) \ - { gen_sse_arith_sd(X86_SSE_##OP, mem, d); } \ - void gen_##NAME##sd(int s, int d) \ - { gen_sse_arith_sd(X86_SSE_##OP, s, d); } -#define DEFINE_OP_PS(NAME, OP) \ - void gen_##NAME##ps(x86_memory_operand const & mem, int d) \ - { gen_sse_arith_ps(X86_SSE_##OP, mem, d); } \ - void gen_##NAME##ps(int s, int d) \ - { gen_sse_arith_ps(X86_SSE_##OP, s, d); } -#define DEFINE_OP_PD(NAME, OP) \ - void gen_##NAME##pd(x86_memory_operand const & mem, int d) \ - { gen_sse_arith_pd(X86_SSE_##OP, mem, d); } \ - void gen_##NAME##pd(int s, int d) \ - { gen_sse_arith_pd(X86_SSE_##OP, s, d); } - -#define DEFINE_OP_S(NAME, OP) \ - DEFINE_OP_SS(NAME, OP) \ - DEFINE_OP_SD(NAME, OP) -#define DEFINE_OP_P(NAME, OP) \ - DEFINE_OP_PS(NAME, OP) \ - DEFINE_OP_PD(NAME, OP) -#define DEFINE_OP(NAME, OP) \ - DEFINE_OP_S(NAME, OP) \ - DEFINE_OP_P(NAME, OP) - - DEFINE_OP(add, ADD); - DEFINE_OP(sub, SUB); - DEFINE_OP(mul, MUL); - DEFINE_OP(div, DIV); - DEFINE_OP(min, MIN); - DEFINE_OP(max, MAX); - DEFINE_OP_P(and, AND); - DEFINE_OP_P(andn, ANDN); - DEFINE_OP_P(or, OR); - DEFINE_OP_P(xor, XOR); - DEFINE_OP_SS(rcp, RCP); - DEFINE_OP_PS(rcp, RCP); - DEFINE_OP_SS(rsqrt, RSQRT); - DEFINE_OP_PS(rsqrt, RSQRT); - DEFINE_OP_SS(sqrt, SQRT); - DEFINE_OP_PS(sqrt, SQRT); - DEFINE_OP_SS(comi, COMI); - DEFINE_OP_SD(comi, COMI); - DEFINE_OP_SS(ucomi, UCOMI); - DEFINE_OP_SD(ucomi, UCOMI); - -#undef DEFINE_OP -#undef DEFINE_OP_S -#undef DEFINE_OP_P -#undef DEFINE_OP_SS -#undef DEFINE_OP_SD -#undef DEFINE_OP_PS -#undef DEFINE_OP_PD - -public: - -#define DEFINE_OP(NAME, OP) \ - void gen_##NAME(int s, int d) \ - { GEN_CODE(OP##rr(s, d)); } \ - void gen_##NAME(x86_memory_operand const & mem, int d) \ - { GEN_CODE(OP##mr(mem.MD, mem.MB, mem.MI, mem.MS, d)); } \ - void gen_##NAME(int s, x86_memory_operand const & mem) \ - { GEN_CODE(OP##rm(s, mem.MD, mem.MB, mem.MI, mem.MS)); } - - DEFINE_OP(movaps, MOVAPS); - DEFINE_OP(movapd, MOVAPD); - DEFINE_OP(movdqa, MOVDQA); - DEFINE_OP(movdqu, MOVDQU); - -#undef DEFINE_OP - -public: - -#define DEFINE_OP(NAME, OP) \ - void gen_##NAME(int s, int d) \ - { GEN_CODE(OP##rr(s, d)); } \ - void gen_##NAME(x86_memory_operand const & mem, int d) \ - { GEN_CODE(OP##mr(mem.MD, mem.MB, mem.MI, mem.MS, d)); } - - DEFINE_OP(movd_lx, MOVDXD); - -#undef DEFINE_OP - -public: - -#define DEFINE_OP(NAME, OP) \ - void gen_##NAME(int s, int d) \ - { GEN_CODE(OP##rr(s, d)); } \ - void gen_##NAME(int s, x86_memory_operand const & mem) \ - { GEN_CODE(OP##rm(s, mem.MD, mem.MB, mem.MI, mem.MS)); } - - DEFINE_OP(movd_xl, MOVDXS); - -#undef DEFINE_OP - -private: - - void gen_sse_arith(int op1, int op2, int s, int d) - { GEN_CODE(_SSELrr(op1, op2, s, _rX, d, _rX)); } - void gen_sse_arith(int op1, int op2, x86_memory_operand const & mem, int d) - { GEN_CODE(_SSELmr(op1, op2, mem.MD, mem.MB, mem.MI, mem.MS, d, _rX)); } - void gen_sse_arith(int op1, int op2, x86_immediate_operand const & imm, int s, int d) - { GEN_CODE(_SSELirr(op1, op2, imm.value, s, d)); } - void gen_sse_arith(int op1, int op2, x86_immediate_operand const & imm, x86_memory_operand const & mem, int d) - { GEN_CODE(_SSELimr(op1, op2, imm.value, mem.MD, mem.MB, mem.MI, mem.MS, d)); } - void gen_sse_arith(int op1, int op2, int mri, x86_immediate_operand const & imm, int d) - { GEN_CODE(_SSELir(op1, op2, mri, imm.value, d)); } - -public: - -#define DEFINE_OP(NAME, OP1, OP2) \ - void gen_##NAME(int s, int d) \ - { gen_sse_arith(OP1, OP2, s, d); } \ - void gen_##NAME(x86_memory_operand const & mem, int d) \ - { gen_sse_arith(OP1, OP2, mem, d); } - -#define DEFINE_OP_IRR(NAME, OP1, OP2) \ - void gen_##NAME(x86_immediate_operand const & imm, int s, int d) \ - { gen_sse_arith(OP1, OP2, imm, s, d); } - -#define DEFINE_OP_IXR(NAME, OP1, OP2) \ - DEFINE_OP_IRR(NAME, OP1, OP2) \ - void gen_##NAME(x86_immediate_operand const & imm, x86_memory_operand const & mem, int d) \ - { gen_sse_arith(OP1, OP2, imm, mem, d); } - -#define DEFINE_OP_IR(NAME, OP1, OP2, MRI) \ - void gen_##NAME(x86_immediate_operand const & imm, int d) \ - { gen_sse_arith(OP1, OP2, MRI, imm, d); } - - DEFINE_OP(packssdw, 0x66, 0x6b); - DEFINE_OP(packsswb, 0x66, 0x63); - DEFINE_OP(packuswb, 0x66, 0x67); - DEFINE_OP(paddb, 0x66, 0xfc); - DEFINE_OP(paddd, 0x66, 0xfe); - DEFINE_OP(paddq, 0x66, 0xd4); - DEFINE_OP(paddsb, 0x66, 0xec); - DEFINE_OP(paddsw, 0x66, 0xed); - DEFINE_OP(paddusb, 0x66, 0xdc); - DEFINE_OP(paddusw, 0x66, 0xdd); - DEFINE_OP(paddw, 0x66, 0xfd); - DEFINE_OP(pand, 0x66, 0xdb); - DEFINE_OP(pandn, 0x66, 0xdf); - DEFINE_OP(pavgb, 0x66, 0xe0); - DEFINE_OP(pavgw, 0x66, 0xe3); - DEFINE_OP(pcmpeqb, 0x66, 0x74); - DEFINE_OP(pcmpeqd, 0x66, 0x76); - DEFINE_OP(pcmpeqw, 0x66, 0x75); - DEFINE_OP(pcmpgtb, 0x66, 0x64); - DEFINE_OP(pcmpgtd, 0x66, 0x66); - DEFINE_OP(pcmpgtw, 0x66, 0x65); - DEFINE_OP_IRR(pextrw, 0x66, 0xc5); - DEFINE_OP_IRR(pinsrw, 0x66, 0xc4); - DEFINE_OP(pmaddwd, 0x66, 0xf5); - DEFINE_OP(pmaxsw, 0x66, 0xee); - DEFINE_OP(pmaxub, 0x66, 0xde); - DEFINE_OP(pminsw, 0x66, 0xea); - DEFINE_OP(pminub, 0x66, 0xda); - DEFINE_OP(pmovmskb, 0x66, 0xd7); - DEFINE_OP(pmulhuw, 0x66, 0xe4); - DEFINE_OP(pmulhw, 0x66, 0xe5); - DEFINE_OP(pmullw, 0x66, 0xd5); - DEFINE_OP(pmuludq, 0x66, 0xf4); - DEFINE_OP(por, 0x66, 0xeb); - DEFINE_OP(psadbw, 0x66, 0xf6); - DEFINE_OP_IXR(pshufd, 0x66, 0x70); - DEFINE_OP_IXR(pshufhw, 0xf3, 0x70); - DEFINE_OP_IXR(pshuflhw, 0xf2, 0x70); - DEFINE_OP(pslld, 0x66, 0xf2); - DEFINE_OP_IR(pslld, 0x66, 0x72, 6); - DEFINE_OP_IR(pslldq, 0x66, 0x73, 7); - DEFINE_OP(psllq, 0x66, 0xf3); - DEFINE_OP_IR(psllq, 0x66, 0x73, 6); - DEFINE_OP(psllw, 0x66, 0xf1); - DEFINE_OP_IR(psllw, 0x66, 0x71, 6); - DEFINE_OP(psrad, 0x66, 0xe2); - DEFINE_OP_IR(psrad, 0x66, 0x72, 4); - DEFINE_OP(psraw, 0x66, 0xe1); - DEFINE_OP_IR(psraw, 0x66, 0x71, 4); - DEFINE_OP(psrld, 0x66, 0xd2); - DEFINE_OP_IR(psrld, 0x66, 0x72, 2); - DEFINE_OP_IR(psrldq, 0x66, 0x73, 3); - DEFINE_OP(psrlq, 0x66, 0xd3); - DEFINE_OP_IR(psrlq, 0x66, 0x73, 2); - DEFINE_OP(psrlw, 0x66, 0xd1); - DEFINE_OP_IR(psrlw, 0x66, 0x71, 2); - DEFINE_OP(psubb, 0x66, 0xf8); - DEFINE_OP(psubd, 0x66, 0xfa); - DEFINE_OP(psubq, 0x66, 0xfb); - DEFINE_OP(psubsb, 0x66, 0xe8); - DEFINE_OP(psubsw, 0x66, 0xe9); - DEFINE_OP(psubusb, 0x66, 0xd8); - DEFINE_OP(psubusw, 0x66, 0xd9); - DEFINE_OP(psubw, 0x66, 0xf9); - DEFINE_OP(punpckhbw, 0x66, 0x68); - DEFINE_OP(punpckhdq, 0x66, 0x6a); - DEFINE_OP(punpckhqdq, 0x66, 0x6d); - DEFINE_OP(punpckhwd, 0x66, 0x69); - DEFINE_OP(punpcklbw, 0x66, 0x60); - DEFINE_OP(punpckldq, 0x66, 0x62); - DEFINE_OP(punpcklqdq, 0x66, 0x6c); - DEFINE_OP(punpcklwd, 0x66, 0x61); - DEFINE_OP(pxor, 0x66, 0xef); - -#undef DEFINE_OP -#undef DEFINE_OP_IR -#undef DEFINE_OP_IRR -#undef DEFINE_OP_IXR - -private: - - void gen_ssse3_arith(int op1, int op2, int s, int d) - { GEN_CODE(_SSSE3Lrr(op1, op2, s, _rX, d, _rX)); } - void gen_ssse3_arith(int op1, int op2, x86_memory_operand const & mem, int d) - { GEN_CODE(_SSSE3Lmr(op1, op2, mem.MD, mem.MB, mem.MI, mem.MS, d, _rX)); } - void gen_ssse3_arith(int op1, int op2, x86_immediate_operand const & imm, int s, int d) - { GEN_CODE(_SSSE3Lirr(op1, op2, imm.value, s, d)); } - void gen_ssse3_arith(int op1, int op2, x86_immediate_operand const & imm, x86_memory_operand const & mem, int d) - { GEN_CODE(_SSSE3Limr(op1, op2, imm.value, mem.MD, mem.MB, mem.MI, mem.MS, d)); } - -}; - -enum { - X86_INSN_ALU_8, - X86_INSN_ALU_16, - X86_INSN_ALU_32, - X86_INSN_BIT_16, - X86_INSN_BIT_32, - X86_INSN_ROT_8, - X86_INSN_ROT_16, - X86_INSN_ROT_32, - X86_INSN_SSE_SS, - X86_INSN_SSE_SD, - X86_INSN_SSE_PS, - X86_INSN_SSE_PD, - X86_INSN_SSE_PI, - X86_INSN_SSE_3P, /* 3-byte prefix (SSSE3) */ -}; - -inline void -x86_codegen::gen_insn(int type, int op, int s, int d) -{ - switch (type) { - case X86_INSN_SSE_SS: - gen_sse_arith_ss(op, s, d); - break; - case X86_INSN_SSE_SD: - gen_sse_arith_sd(op, s, d); - break; - case X86_INSN_SSE_PS: - gen_sse_arith_ps(op, s, d); - break; - case X86_INSN_SSE_PD: - gen_sse_arith_pd(op, s, d); - break; - case X86_INSN_SSE_PI: - gen_sse_arith(0x66, op, s, d); - break; - case X86_INSN_SSE_3P: - gen_ssse3_arith(0x38, op, s, d); - break; - default: - abort(); - } -} - -inline void -x86_codegen::gen_insn(int type, int op, x86_memory_operand const & mem, int d) -{ - switch (type) { - case X86_INSN_SSE_SS: - gen_sse_arith_ss(op, mem, d); - break; - case X86_INSN_SSE_SD: - gen_sse_arith_sd(op, mem, d); - break; - case X86_INSN_SSE_PS: - gen_sse_arith_ps(op, mem, d); - break; - case X86_INSN_SSE_PD: - gen_sse_arith_pd(op, mem, d); - break; - case X86_INSN_SSE_PI: - gen_sse_arith(0x66, op, mem, d); - break; - case X86_INSN_SSE_3P: - gen_ssse3_arith(0x38, op, mem, d); - break; - default: - abort(); - } -} - -inline void -x86_codegen::gen_failure(const char *msg, const char *file, int line, const char *fn) -{ - fprintf(stderr, "JIT failure in function %s from file %s at line %d: %s\n", - fn ? fn : "", file, line, msg); - abort(); -} - -#endif /* JIT_X86_CODEGEN_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/ppc/genexec.pl b/SheepShaver/src/kpx_cpu/src/cpu/ppc/genexec.pl deleted file mode 100755 index 5a6841f2..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/ppc/genexec.pl +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/perl -use strict; - -my (@handlers, @extra_handlers, %templates); - -sub split_arglist($) { - (map { $_ =~ s/\s//g; $_ } split ",", $_[0]); -} - -my @lines = map { split ";", $_ } (); - -my $is_template = 0; -my $e; -foreach (@lines) { - $_ =~ s/;/&\n/g; - if (/^DEFINE_TEMPLATE\((\w+),.+,.+\((.+)\)\)/) { - $is_template = 1; - $e = { name => $1 }; - push @{$e->{args}}, split_arglist $2; - } - elsif ($is_template && /^\}/) { - $is_template = 0; - $templates{$e->{name}} = $e; - } - elsif (/(powerpc_cpu::execute_\w+)<(.+)>/) { - my $h = { name => $1, args => $2 }; - if ($is_template) { - push @{$e->{handlers}}, $h; - } - else { - push @handlers, $h; - } - } - elsif (/template.+decode_(\w+)<(.+)>/) { - my $template = $templates{$1}; - my @template_args = @{$template->{args}}; - my @args = split_arglist $2; - my %vars; - $vars{$template_args[$_]} = $args[$_] foreach (0 .. $#template_args); - foreach my $h (@{$template->{handlers}}) { - my @new_args = map { $vars{$_} || $_ } split_arglist $h->{args}; - push @extra_handlers, { name => $h->{name}, args => join(", ", @new_args) }; - } - } -} - -my %output_handlers; -foreach (@handlers, @extra_handlers) { - my $line = "template void $_->{name}<".join(", ", $_->{args}).">(uint32);"; - print "$line\n" if (!$output_handlers{$line}); - $output_handlers{$line} = 1; -} diff --git a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-bitfields.hpp b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-bitfields.hpp deleted file mode 100644 index 78eba468..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-bitfields.hpp +++ /dev/null @@ -1,229 +0,0 @@ -/* - * ppc-bitfields.hpp - Instruction fields - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PPC_BITFIELDS_H -#define PPC_BITFIELDS_H - -#include "cpu/ppc/ppc-operations.hpp" - -/// -/// Bitfield management -/// - -template< int FB, int FE > -struct static_mask { - enum { value = (0xffffffff >> FB) ^ (0xffffffff >> (FE + 1)) }; -}; - -template< int FB > -struct static_mask { - enum { value = 0xffffffff >> FB }; -}; - -template< int FB, int FE > -struct bit_field { - static inline uint32 mask() { - return static_mask::value; - } - static inline bool test(uint32 value) { - return value & mask(); - } - static inline uint32 extract(uint32 value) { - const uint32 m = mask() >> (31 - FE); - return (value >> (31 - FE)) & m; - } - static inline void insert(uint32 & data, uint32 value) { - const uint32 m = mask(); - data = (data & ~m) | ((value << (31 - FE)) & m); - } -}; - -template< class type, type value > -struct fake_bit_field { - static inline bool test(uint32) { - return value; - } - static inline type extract(uint32) { - return value; - } -}; - -/// -/// Instruction Fields -/// - -// Primary and extended opcode fields -typedef bit_field< 0, 5 > OPCD_field; -typedef bit_field< 21, 30 > XO_10_field; -typedef bit_field< 22, 30 > XO_9_field; -typedef bit_field< 26, 30 > XO_5_field; - -// General purpose registers -typedef bit_field< 11, 15 > rA_field; -typedef bit_field< 16, 20 > rB_field; -typedef bit_field< 6, 10 > rD_field; -typedef bit_field< 6, 10 > rS_field; - -// Floating-point registers -typedef bit_field< 11, 15 > frA_field; -typedef bit_field< 16, 20 > frB_field; -typedef bit_field< 21, 25 > frC_field; -typedef bit_field< 6, 10 > frD_field; -typedef bit_field< 6, 10 > frS_field; - -// Vector registers -typedef bit_field< 11, 15 > vA_field; -typedef bit_field< 16, 20 > vB_field; -typedef bit_field< 21, 25 > vC_field; -typedef bit_field< 6, 10 > vD_field; -typedef bit_field< 6, 10 > vS_field; - -typedef bit_field< 21, 21 > vRc_field; -typedef bit_field< 11, 15 > vUIMM_field; -typedef bit_field< 22, 25 > vSH_field; - -// Condition registers -typedef bit_field< 11, 15 > crbA_field; -typedef bit_field< 16, 20 > crbB_field; -typedef bit_field< 6, 10 > crbD_field; -typedef bit_field< 6, 8 > crfD_field; -typedef bit_field< 11, 13 > crfS_field; -typedef bit_field< 12, 19 > CRM_field; -typedef bit_field< 7, 14 > FM_field; - -// CR register fields -template< int CRn > struct CR_field : bit_field< 4*CRn+0, 4*CRn+3 > { }; -template< int CRn > struct CR_LT_field : bit_field< 4*CRn+0, 4*CRn+0 > { }; -template< int CRn > struct CR_GT_field : bit_field< 4*CRn+1, 4*CRn+1 > { }; -template< int CRn > struct CR_EQ_field : bit_field< 4*CRn+2, 4*CRn+2 > { }; -template< int CRn > struct CR_SO_field : bit_field< 4*CRn+3, 4*CRn+3 > { }; -template< int CRn > struct CR_UN_field : bit_field< 4*CRn+3, 4*CRn+3 > { }; - -// Aliases used for CR storage optimization -typedef CR_LT_field<7> standalone_CR_LT_field; -typedef CR_GT_field<7> standalone_CR_GT_field; -typedef CR_EQ_field<7> standalone_CR_EQ_field; -typedef CR_SO_field<7> standalone_CR_SO_field; - -// XER register fields -typedef bit_field< 0, 0 > XER_SO_field; -typedef bit_field< 1, 1 > XER_OV_field; -typedef bit_field< 2, 2 > XER_CA_field; -typedef bit_field< 25, 31 > XER_COUNT_field; - -// FPSCR register fields -typedef bit_field< 0, 0 > FPSCR_FX_field; -typedef bit_field< 1, 1 > FPSCR_FEX_field; -typedef bit_field< 2, 2 > FPSCR_VX_field; -typedef bit_field< 3, 3 > FPSCR_OX_field; -typedef bit_field< 4, 4 > FPSCR_UX_field; -typedef bit_field< 5, 5 > FPSCR_ZX_field; -typedef bit_field< 6, 6 > FPSCR_XX_field; -typedef bit_field< 7, 7 > FPSCR_VXSNAN_field; -typedef bit_field< 8, 8 > FPSCR_VXISI_field; -typedef bit_field< 9, 9 > FPSCR_VXIDI_field; -typedef bit_field< 10, 10 > FPSCR_VXZDZ_field; -typedef bit_field< 11, 11 > FPSCR_VXIMZ_field; -typedef bit_field< 12, 12 > FPSCR_VXVC_field; -typedef bit_field< 13, 13 > FPSCR_FR_field; -typedef bit_field< 14, 14 > FPSCR_FI_field; -typedef bit_field< 15, 19 > FPSCR_FPRF_field; -typedef bit_field< 21, 21 > FPSCR_VXSOFT_field; -typedef bit_field< 22, 22 > FPSCR_VXSQRT_field; -typedef bit_field< 23, 23 > FPSCR_VXCVI_field; -typedef bit_field< 24, 24 > FPSCR_VE_field; -typedef bit_field< 25, 25 > FPSCR_OE_field; -typedef bit_field< 26, 26 > FPSCR_UE_field; -typedef bit_field< 27, 27 > FPSCR_ZE_field; -typedef bit_field< 28, 28 > FPSCR_XE_field; -typedef bit_field< 29, 29 > FPSCR_NI_field; -typedef bit_field< 30, 31 > FPSCR_RN_field; -typedef bit_field< 16, 19 > FPSCR_FPCC_field; -typedef bit_field< 15, 15 > FPSCR_FPRF_C_field; // C -typedef bit_field< 16, 16 > FPSCR_FPRF_FL_field; // < -typedef bit_field< 17, 17 > FPSCR_FPRF_FG_field; // > -typedef bit_field< 18, 18 > FPSCR_FPRF_FE_field; // = -typedef bit_field< 19, 19 > FPSCR_FPRF_FU_field; // ? - -// Vector Status and Control Register -typedef bit_field< 15, 15 > VSCR_NJ_field; -typedef bit_field< 31, 31 > VSCR_SAT_field; - -// Define variations for branch instructions -typedef bit_field< 30, 30 > AA_field; -typedef bit_field< 31, 31 > LK_field; -typedef bit_field< 16, 29 > BD_field; -typedef bit_field< 11, 15 > BI_field; -typedef bit_field< 6, 10 > BO_field; - -// Helper macros to deal with BO field -#define BO_MAKE(COND, TRUE, DCTR, CTR0) (((COND) ? 0 : 16) | ((TRUE) ? 8 : 0) | ((DCTR) ? 0 : 4) | ((CTR0) ? 2 : 0)) -#define BO_DECREMENT_CTR(BO) (((BO) & 0x04) == 0) -#define BO_BRANCH_IF_CTR_ZERO(BO) (((BO) & 0x02) != 0) -#define BO_CONDITIONAL_BRANCH(BO) (((BO) & 0x10) == 0) -#define BO_BRANCH_IF_TRUE(BO) (((BO) & 0x08) != 0) - -// Define variations for ALU instructions -typedef bit_field< 31, 31 > Rc_field; -typedef bit_field< 21, 21 > OE_field; -typedef bit_field< 21, 25 > MB_field; -typedef bit_field< 26, 30 > ME_field; -typedef bit_field< 16, 20 > NB_field; -typedef bit_field< 16, 20 > SH_field; - -// Immediates -typedef bit_field< 16, 19 > IMM_field; -typedef bit_field< 16, 31 > d_field; -typedef bit_field< 6, 29 > LI_field; -typedef bit_field< 16, 31 > SIMM_field; -typedef bit_field< 16, 31 > UIMM_field; - -// Misc -typedef bit_field< 12, 15 > SR_field; -typedef bit_field< 6, 10 > TO_field; -typedef bit_field< 11, 20 > SPR_field; -typedef bit_field< 11, 20 > TBR_field; - -// Aliases to ease filling in decode table -#define DEFINE_FAKE_FIELD_ALIAS(NAME) \ -typedef fake_bit_field NAME##_0; \ -typedef fake_bit_field NAME##_1 - -#define DEFINE_FIELD_ALIAS(NAME, FIELD) \ -typedef FIELD##_field NAME##_G; \ -DEFINE_FAKE_FIELD_ALIAS(NAME) - -DEFINE_FAKE_FIELD_ALIAS(CA_BIT); -DEFINE_FIELD_ALIAS(RC_BIT, Rc); -DEFINE_FIELD_ALIAS(OE_BIT, OE); -DEFINE_FIELD_ALIAS(AA_BIT, AA); -DEFINE_FIELD_ALIAS(LK_BIT, LK); -DEFINE_FIELD_ALIAS(BO_BIT, BO); -DEFINE_FIELD_ALIAS(BI_BIT, BI); -DEFINE_FIELD_ALIAS(vRC_BIT, vRc); - -#undef DEFINE_FIELD_ALIAS -#undef DEFINE_FAKE_FIELD_ALIAS - -typedef fake_bit_field RA_FIELD_A; // GPR(RA) -typedef rA_field RA_FIELD_G; // RA ? GPR(RA) : 0 -typedef fake_bit_field RA_FIELD_0; // R0 -> 0 - -#endif /* PPC_BITFIELDS_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-blockinfo.hpp b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-blockinfo.hpp deleted file mode 100644 index 7cea7d27..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-blockinfo.hpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * ppc-blockinfo.hpp - PowerPC basic block information - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PPC_BLOCKINFO_H -#define PPC_BLOCKINFO_H - -#include "cpu/jit/jit-config.hpp" -#include "nvmemfun.hpp" -#include "basic-blockinfo.hpp" - -class powerpc_cpu; - -struct powerpc_block_info - : public basic_block_info -{ - typedef nv_mem_fun1_t< void, powerpc_cpu, uint32 > execute_fn; - - struct decode_info - { - execute_fn execute; - uint32 opcode; - }; - -#if PPC_DECODE_CACHE - decode_info * di; -#endif -#if PPC_ENABLE_JIT - uint8 * entry_point; -#if DYNGEN_DIRECT_BLOCK_CHAINING - struct link_info { - uint8 * jmp_resolve_addr; // Address of default code to resolve target addr - uint8 * jmp_addr; // Address of target native branch offset to patch - uint32 jmp_pc; // Target jump addresses in emulated address space - }; - static const uint32 INVALID_PC = 0xffffffff; // An invalid PC address to mark jmp_pc[] as stale - link_info li[MAX_TARGETS]; -#endif -#endif - uintptr min_pc, max_pc; - - void init(uintptr start_pc); - bool intersect(uintptr start, uintptr end); - void invalidate(); -}; - -inline void -powerpc_block_info::init(uintptr start_pc) -{ - basic_block_info::init(start_pc); -#if PPC_DECODE_CACHE - di = NULL; -#endif -#if PPC_ENABLE_JIT -#if DYNGEN_DIRECT_BLOCK_CHAINING - for (int i = 0; i < MAX_TARGETS; i++) - li[i].jmp_pc = INVALID_PC; -#endif -#endif -} - -inline bool -powerpc_block_info::intersect(uintptr start, uintptr end) -{ - return (min_pc >= start && min_pc < end) || (max_pc >= start && max_pc < end); -} - -#endif /* PPC_BLOCKINFO_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-config.hpp b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-config.hpp deleted file mode 100644 index 7563fd02..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-config.hpp +++ /dev/null @@ -1,150 +0,0 @@ -/* - * ppc-config.hpp - PowerPC core emulator config - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PPC_CONFIG_H -#define PPC_CONFIG_H - -/** - * PPC_CHECK_INTERRUPTS - * - * Define if interrupts need to be check after each instruction, - * in interpreted mode, or at the end of each block, in compiled - * mode. - * - * NOTE: this only checks for user defined interrupts that are - * triggered by the program. This is not about OEA interrupts. - */ - -#ifndef PPC_CHECK_INTERRUPTS -#define PPC_CHECK_INTERRUPTS 0 -#endif - - -/** - * PPC_ENABLE_FPU_EXCEPTIONS - * - * Define to enable a more precise FPU emulation with support for - * exception bits. This is slower and not fully correct yet. - **/ - -#ifndef PPC_ENABLE_FPU_EXCEPTIONS -#define PPC_ENABLE_FPU_EXCEPTIONS 0 -#endif - - -/** - * PPC_DECODE_CACHE - * - * Define to 0 to disable the decode cache. This is only useful - * for debugging purposes and side-by-side comparison with other - * PowerPC emulators. - **/ - -#ifndef PPC_DECODE_CACHE -#define PPC_DECODE_CACHE 1 -#endif - - -/** - * PPC_ENABLE_JIT - * - * Define to 1 if dynamic translation is used. This requires - * dyngen to be enabled first. - **/ - -#ifndef PPC_ENABLE_JIT -#define PPC_ENABLE_JIT ENABLE_DYNGEN -#endif - - -/** - * PPC_REENTRANT_JIT - * - * Define to 1 if we are guaranteed to be able to invoke the JIT - * compiler, and the generated code, recursively. Enable this - * only if you have necessary provisions to recover from possible - * cache invalidatation within inner calls. - **/ - -#ifndef PPC_REENTRANT_JIT -#define PPC_REENTRANT_JIT 0 -#endif - - -/** - * PPC_EXECUTE_DUMP_STATE - * - * Define to dump state after each instruction. This also - * disables the decode cache. - **/ - -#ifndef PPC_EXECUTE_DUMP_STATE -#define PPC_EXECUTE_DUMP_STATE 0 -#endif - - -/** - * PPC_FLIGHT_RECORDER - * - * Define to enable the flight recorder. If set to 2, the - * complete register state will be recorder after each - * instruction execution. - **/ - -#ifndef PPC_FLIGHT_RECORDER -#define PPC_FLIGHT_RECORDER 0 -#endif - - -/** - * PPC_PROFILE_COMPILE_TIME - * - * Define to enable some compile time statistics. This concerns - * time spent into the decoder (PPC_DECODE_CACHE case) or total - * time spent into the dynamic translator (PPC_ENABLE_JIT case). - **/ - -#ifndef PPC_PROFILE_COMPILE_TIME -#define PPC_PROFILE_COMPILE_TIME 0 -#endif - - -/** - * PPC_PROFILE_GENERIC_CALLS - * - * Define to enable some generic handler invocation statistics. - **/ - -#ifndef PPC_PROFILE_GENERIC_CALLS -#define PPC_PROFILE_GENERIC_CALLS 0 -#endif - - -/** - * PPC_PROFILE_REGS_USE - * - * Define to enable some statistics about registers use. - **/ - -#ifndef PPC_PROFILE_REGS_USE -#define PPC_PROFILE_REGS_USE 0 -#endif - -#endif /* PPC_CONFIG_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-cpu.cpp b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-cpu.cpp deleted file mode 100644 index 1fb8f856..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-cpu.cpp +++ /dev/null @@ -1,825 +0,0 @@ -/* - * ppc-cpu.cpp - PowerPC CPU definition - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" -#include -#include -#include "vm_alloc.h" -#include "cpu/vm.hpp" -#include "cpu/ppc/ppc-cpu.hpp" -#ifndef SHEEPSHAVER -#include "basic-kernel.hpp" -#endif - -#if PPC_ENABLE_JIT -#include "cpu/jit/dyngen-exec.h" -#endif - -#if ENABLE_MON -#include "mon.h" -#include "mon_disass.h" -#endif - -#define DEBUG 0 -#include "debug.h" - -#if PPC_PROFILE_GENERIC_CALLS -uint32 powerpc_cpu::generic_calls_count[PPC_I(MAX)]; -static int generic_calls_ids[PPC_I(MAX)]; -const int generic_calls_top_ten = 20; - -int generic_calls_compare(const void *e1, const void *e2) -{ - const int id1 = *(const int *)e1; - const int id2 = *(const int *)e2; - return powerpc_cpu::generic_calls_count[id2] - powerpc_cpu::generic_calls_count[id1]; -} -#endif - -#if PPC_PROFILE_REGS_USE -int register_info_compare(const void *e1, const void *e2) -{ - const powerpc_cpu::register_info *ri1 = (powerpc_cpu::register_info *)e1; - const powerpc_cpu::register_info *ri2 = (powerpc_cpu::register_info *)e2; - return ri2->count - ri1->count; -} -#endif - -static int ppc_refcount = 0; - -void powerpc_cpu::set_register(int id, any_register const & value) -{ - if (id >= powerpc_registers::GPR(0) && id <= powerpc_registers::GPR(31)) { - gpr(id - powerpc_registers::GPR_BASE) = value.i; - return; - } - if (id >= powerpc_registers::FPR(0) && id <= powerpc_registers::FPR(31)) { - fpr(id - powerpc_registers::FPR_BASE) = value.d; - return; - } - switch (id) { - case powerpc_registers::CR: cr().set(value.i); break; - case powerpc_registers::FPSCR: fpscr() = value.i; break; - case powerpc_registers::XER: xer().set(value.i); break; - case powerpc_registers::LR: lr() = value.i; break; - case powerpc_registers::CTR: ctr() = value.i; break; - case basic_registers::PC: - case powerpc_registers::PC: pc() = value.i; break; - case basic_registers::SP: - case powerpc_registers::SP: gpr(1)= value.i; break; - default: abort(); break; - } -} - -any_register powerpc_cpu::get_register(int id) -{ - any_register value; - if (id >= powerpc_registers::GPR(0) && id <= powerpc_registers::GPR(31)) { - value.i = gpr(id - powerpc_registers::GPR_BASE); - return value; - } - if (id >= powerpc_registers::FPR(0) && id <= powerpc_registers::FPR(31)) { - value.d = fpr(id - powerpc_registers::FPR_BASE); - return value; - } - switch (id) { - case powerpc_registers::CR: value.i = cr().get(); break; - case powerpc_registers::FPSCR: value.i = fpscr(); break; - case powerpc_registers::XER: value.i = xer().get(); break; - case powerpc_registers::LR: value.i = lr(); break; - case powerpc_registers::CTR: value.i = ctr(); break; - case basic_registers::PC: - case powerpc_registers::PC: value.i = pc(); break; - case basic_registers::SP: - case powerpc_registers::SP: value.i = gpr(1); break; - default: abort(); break; - } - return value; -} - -#if KPX_MAX_CPUS != 1 -uint32 powerpc_registers::reserve_valid = 0; -uint32 powerpc_registers::reserve_addr = 0; -uint32 powerpc_registers::reserve_data = 0; -#endif - -void powerpc_cpu::init_registers() -{ - assert((((uintptr)&vr(0)) % 16) == 0); - for (int i = 0; i < 32; i++) { - gpr(i) = 0; - fpr(i) = 0; - } - cr().set(0); - fpscr() = 0; - xer().set(0); - lr() = 0; - ctr() = 0; - pc() = 0; -} - -void powerpc_cpu::init_flight_recorder() -{ -#if PPC_FLIGHT_RECORDER - log_ptr = 0; - log_ptr_wrapped = false; -#endif -} - -void powerpc_cpu::do_record_step(uint32 pc, uint32 opcode) -{ -#if PPC_FLIGHT_RECORDER - log[log_ptr].pc = pc; - log[log_ptr].opcode = opcode; -#ifdef SHEEPSHAVER - log[log_ptr].sp = gpr(1); - log[log_ptr].r24 = gpr(24); -#endif -#if PPC_FLIGHT_RECORDER >= 2 - for (int i = 0; i < 32; i++) { - log[log_ptr].r[i] = gpr(i); - log[log_ptr].fr[i] = fpr(i); - } - log[log_ptr].lr = lr(); - log[log_ptr].ctr = ctr(); - log[log_ptr].cr = cr().get(); - log[log_ptr].xer = xer().get(); - log[log_ptr].fpscr = fpscr(); -#endif - log_ptr++; - if (log_ptr == LOG_SIZE) { - log_ptr = 0; - log_ptr_wrapped = true; - } -#endif -} - -#if PPC_FLIGHT_RECORDER -void powerpc_cpu::start_log() -{ - logging = true; - invalidate_cache(); -} - -void powerpc_cpu::stop_log() -{ - logging = false; - invalidate_cache(); -} - -void powerpc_cpu::dump_log(const char *filename) -{ - if (filename == NULL) - filename = "ppc.log"; - - FILE *f = fopen(filename, "w"); - if (f == NULL) - return; - - int start_ptr = 0; - int log_size = log_ptr; - if (log_ptr_wrapped) { - start_ptr = log_ptr; - log_size = LOG_SIZE; - } - - for (int i = 0; i < log_size; i++) { - int j = (i + start_ptr) % LOG_SIZE; -#if PPC_FLIGHT_RECORDER >= 2 - fprintf(f, " pc %08x lr %08x ctr %08x cr %08x xer %08x ", log[j].pc, log[j].lr, log[j].ctr, log[j].cr, log[j].xer); - fprintf(f, " r0 %08x r1 %08x r2 %08x r3 %08x ", log[j].r[0], log[j].r[1], log[j].r[2], log[j].r[3]); - fprintf(f, " r4 %08x r5 %08x r6 %08x r7 %08x ", log[j].r[4], log[j].r[5], log[j].r[6], log[j].r[7]); - fprintf(f, " r8 %08x r9 %08x r10 %08x r11 %08x ", log[j].r[8], log[j].r[9], log[j].r[10], log[j].r[11]); - fprintf(f, "r12 %08x r13 %08x r14 %08x r15 %08x ", log[j].r[12], log[j].r[13], log[j].r[14], log[j].r[15]); - fprintf(f, "r16 %08x r17 %08x r18 %08x r19 %08x ", log[j].r[16], log[j].r[17], log[j].r[18], log[j].r[19]); - fprintf(f, "r20 %08x r21 %08x r22 %08x r23 %08x ", log[j].r[20], log[j].r[21], log[j].r[22], log[j].r[23]); - fprintf(f, "r24 %08x r25 %08x r26 %08x r27 %08x ", log[j].r[24], log[j].r[25], log[j].r[26], log[j].r[27]); - fprintf(f, "r28 %08x r29 %08x r30 %08x r31 %08x\n", log[j].r[28], log[j].r[29], log[j].r[30], log[j].r[31]); - fprintf(f, "opcode %08x\n", log[j].opcode); -#else - fprintf(f, " pc %08x opc %08x", log[j].pc, log[j].opcode); -#ifdef SHEEPSHAVER - fprintf(f, " sp %08x r24 %08x", log[j].sp, log[j].r24); -#endif - fprintf(f, "| "); -#if !ENABLE_MON - fprintf(f, "\n"); -#endif -#endif -#if ENABLE_MON - disass_ppc(f, log[j].pc, log[j].opcode); -#endif - } - fclose(f); -} -#endif - -#if ENABLE_MON -static uint32 mon_read_byte_ppc(uintptr addr) -{ - return *((uint8 *)addr); -} - -static void mon_write_byte_ppc(uintptr addr, uint32 b) -{ - uint8 *m = (uint8 *)addr; - *m = b; -} -#endif - -void powerpc_cpu::initialize() -{ -#ifdef SHEEPSHAVER - printf("PowerPC CPU emulator by Gwenole Beauchesne\n"); -#endif - -#if PPC_PROFILE_REGS_USE - reginfo = new register_info[32]; - for (int i = 0; i < 32; i++) { - reginfo[i].id = i; - reginfo[i].count = 0; - } -#endif - - init_flight_recorder(); - init_decoder(); - init_registers(); - init_decode_cache(); - execute_depth = 0; - - // Initialize block lookup table -#if PPC_DECODE_CACHE || PPC_ENABLE_JIT - my_block_cache.initialize(); -#endif - - // Init cache range invalidate recorder - cache_range.start = cache_range.end = 0; - - // Init syscalls handler - execute_do_syscall = NULL; - - // Init field2mask - for (int i = 0; i < 256; i++) { - uint32 mask = 0; - if (i & 0x01) mask |= 0x0000000f; - if (i & 0x02) mask |= 0x000000f0; - if (i & 0x04) mask |= 0x00000f00; - if (i & 0x08) mask |= 0x0000f000; - if (i & 0x10) mask |= 0x000f0000; - if (i & 0x20) mask |= 0x00f00000; - if (i & 0x40) mask |= 0x0f000000; - if (i & 0x80) mask |= 0xf0000000; - field2mask[i] = mask; - } - -#if ENABLE_MON - mon_init(); - mon_read_byte = mon_read_byte_ppc; - mon_write_byte = mon_write_byte_ppc; -#endif - -#if PPC_PROFILE_COMPILE_TIME - compile_count = 0; - compile_time = 0; - emul_start_time = clock(); -#endif -} - -#if PPC_ENABLE_JIT -void powerpc_cpu::enable_jit(uint32 cache_size) -{ - use_jit = true; - if (cache_size) - codegen.set_cache_size(cache_size); - codegen.initialize(); -} -#endif - -// Memory allocator returning powerpc_cpu objects aligned on 16-byte boundaries -// FORMAT: [ alignment ] magic identifier, offset to malloc'ed data, powerpc_cpu data -void *powerpc_cpu::operator new(size_t size) -{ - const int ALIGN = 16; - - // Allocate enough space for powerpc_cpu data + signature + align pad - uint8 *ptr = (uint8 *)malloc(size + ALIGN * 2); - if (ptr == NULL) - throw std::bad_alloc(); - - // Align memory - int ofs = 0; - while ((((uintptr)ptr) % ALIGN) != 0) - ofs++, ptr++; - - // Insert signature and offset - struct aligned_block_t { - uint32 pad[(ALIGN - 8) / 4]; - uint32 signature; - uint32 offset; - uint8 data[sizeof(powerpc_cpu)]; - }; - aligned_block_t *blk = (aligned_block_t *)ptr; - blk->signature = 0x53435055; /* 'SCPU' */ - blk->offset = ofs + (&blk->data[0] - (uint8 *)blk); - assert((((uintptr)&blk->data) % ALIGN) == 0); - return &blk->data[0]; -} - -void powerpc_cpu::operator delete(void *p) -{ - uint32 *blk = (uint32 *)p; - assert(blk[-2] == 0x53435055); /* 'SCPU' */ - void *ptr = (void *)(((uintptr)p) - blk[-1]); - free(ptr); -} - -#ifdef SHEEPSHAVER -powerpc_cpu::powerpc_cpu() -#if PPC_ENABLE_JIT - : codegen(this) -#endif -#else -powerpc_cpu::powerpc_cpu(task_struct *parent_task) - : basic_cpu(parent_task) -#if PPC_ENABLE_JIT - , codegen(this) -#endif -#endif -{ -#if PPC_ENABLE_JIT - use_jit = false; -#endif - ++ppc_refcount; - initialize(); -} - -powerpc_cpu::~powerpc_cpu() -{ - --ppc_refcount; -#if PPC_PROFILE_COMPILE_TIME - clock_t emul_end_time = clock(); - - const char *type = NULL; -#if PPC_ENABLE_JIT - if (use_jit) - type = "compile"; -#endif -#if PPC_DECODE_CACHE - if (!type) - type = "predecode"; -#endif - if (type) { - printf("### Statistics for block %s\n", type); - printf("Total block %s count : %d\n", type, compile_count); - uint32 emul_time = emul_end_time - emul_start_time; - printf("Total emulation time : %.1f sec\n", - double(emul_time) / double(CLOCKS_PER_SEC)); - printf("Total %s time : %.1f sec (%.1f%%)\n", type, - double(compile_time) / double(CLOCKS_PER_SEC), - 100.0 * double(compile_time) / double(emul_time)); - printf("\n"); - } -#endif - -#if PPC_PROFILE_GENERIC_CALLS - if (use_jit && ppc_refcount == 0) { - uint64 total_generic_calls_count = 0; - for (int i = 0; i < PPC_I(MAX); i++) { - generic_calls_ids[i] = i; - total_generic_calls_count += generic_calls_count[i]; - } - qsort(generic_calls_ids, PPC_I(MAX), sizeof(int), generic_calls_compare); - printf("Rank Count Ratio Name\n"); - for (int i = 0; i < generic_calls_top_ten; i++) { - uint32 mnemo = generic_calls_ids[i]; - uint32 count = generic_calls_count[mnemo]; - const instr_info_t *ii = powerpc_ii_table; - while (ii->mnemo != mnemo) - ii++; - printf("%03d: %10lu %2.1f%% %s\n", i, count, 100.0*double(count)/double(total_generic_calls_count), ii->name); - } - } -#endif - -#if PPC_PROFILE_REGS_USE - printf("\n### Statistics for register usage\n"); - uint64 tot_reg_count = 0; - for (int i = 0; i < 32; i++) - tot_reg_count += reginfo[i].count; - qsort(reginfo, 32, sizeof(register_info), register_info_compare); - uint64 cum_reg_count = 0; - for (int i = 0; i < 32; i++) { - cum_reg_count += reginfo[i].count; - printf("r%-2d : %16llu %2.1f%% [%3.1f%%]\n", - reginfo[i].id, reginfo[i].count, - 100.0*double(reginfo[i].count)/double(tot_reg_count), - 100.0*double(cum_reg_count)/double(tot_reg_count)); - } - delete[] reginfo; -#endif - - kill_decode_cache(); - -#if ENABLE_MON - mon_exit(); -#endif -} - -void powerpc_cpu::dump_registers() -{ - fprintf(stderr, " r0 %08x r1 %08x r2 %08x r3 %08x\n", gpr(0), gpr(1), gpr(2), gpr(3)); - fprintf(stderr, " r4 %08x r5 %08x r6 %08x r7 %08x\n", gpr(4), gpr(5), gpr(6), gpr(7)); - fprintf(stderr, " r8 %08x r9 %08x r10 %08x r11 %08x\n", gpr(8), gpr(9), gpr(10), gpr(11)); - fprintf(stderr, "r12 %08x r13 %08x r14 %08x r15 %08x\n", gpr(12), gpr(13), gpr(14), gpr(15)); - fprintf(stderr, "r16 %08x r17 %08x r18 %08x r19 %08x\n", gpr(16), gpr(17), gpr(18), gpr(19)); - fprintf(stderr, "r20 %08x r21 %08x r22 %08x r23 %08x\n", gpr(20), gpr(21), gpr(22), gpr(23)); - fprintf(stderr, "r24 %08x r25 %08x r26 %08x r27 %08x\n", gpr(24), gpr(25), gpr(26), gpr(27)); - fprintf(stderr, "r28 %08x r29 %08x r30 %08x r31 %08x\n", gpr(28), gpr(29), gpr(30), gpr(31)); - fprintf(stderr, " f0 %02.5f f1 %02.5f f2 %02.5f f3 %02.5f\n", fpr(0), fpr(1), fpr(2), fpr(3)); - fprintf(stderr, " f4 %02.5f f5 %02.5f f6 %02.5f f7 %02.5f\n", fpr(4), fpr(5), fpr(6), fpr(7)); - fprintf(stderr, " f8 %02.5f f9 %02.5f f10 %02.5f f11 %02.5f\n", fpr(8), fpr(9), fpr(10), fpr(11)); - fprintf(stderr, "f12 %02.5f f13 %02.5f f14 %02.5f f15 %02.5f\n", fpr(12), fpr(13), fpr(14), fpr(15)); - fprintf(stderr, "f16 %02.5f f17 %02.5f f18 %02.5f f19 %02.5f\n", fpr(16), fpr(17), fpr(18), fpr(19)); - fprintf(stderr, "f20 %02.5f f21 %02.5f f22 %02.5f f23 %02.5f\n", fpr(20), fpr(21), fpr(22), fpr(23)); - fprintf(stderr, "f24 %02.5f f25 %02.5f f26 %02.5f f27 %02.5f\n", fpr(24), fpr(25), fpr(26), fpr(27)); - fprintf(stderr, "f28 %02.5f f29 %02.5f f30 %02.5f f31 %02.5f\n", fpr(28), fpr(29), fpr(30), fpr(31)); - fprintf(stderr, " lr %08x ctr %08x cr %08x xer %08x\n", lr(), ctr(), cr().get(), xer().get()); - fprintf(stderr, " pc %08x fpscr %08x\n", pc(), fpscr()); - fflush(stderr); -} - -void powerpc_cpu::dump_instruction(uint32 opcode) -{ - fprintf(stderr, "[%08x]-> %08x\n", pc(), opcode); -} - -void powerpc_cpu::fake_dump_registers(uint32) -{ - dump_registers(); -} - -void powerpc_registers::interrupt_copy(powerpc_registers &oregs, powerpc_registers const &iregs) -{ - for (int i = 0; i < 32; i++) { - oregs.gpr[i] = iregs.gpr[i]; - oregs.fpr[i] = iregs.fpr[i]; - } - oregs.cr = iregs.cr; - oregs.fpscr = iregs.fpscr; - oregs.xer = iregs.xer; - oregs.lr = iregs.lr; - oregs.ctr = iregs.ctr; - oregs.pc = iregs.pc; - - uint32 vrsave = iregs.vrsave; - oregs.vrsave = vrsave; - if (vrsave) { - for (int i = 31; i >= 0; i--) { - if (vrsave & 1) - oregs.vr[i] = iregs.vr[i]; - vrsave >>= 1; - } - } -} - -bool powerpc_cpu::check_spcflags() -{ - if (spcflags().test(SPCFLAG_CPU_EXEC_RETURN)) { - spcflags().clear(SPCFLAG_CPU_EXEC_RETURN); - return false; - } -#ifdef SHEEPSHAVER - if (spcflags().test(SPCFLAG_CPU_HANDLE_INTERRUPT)) { - spcflags().clear(SPCFLAG_CPU_HANDLE_INTERRUPT); - static bool processing_interrupt = false; - if (!processing_interrupt) { - processing_interrupt = true; - powerpc_registers r; - powerpc_registers::interrupt_copy(r, regs()); - HandleInterrupt(&r); - powerpc_registers::interrupt_copy(regs(), r); - processing_interrupt = false; - } - } - if (spcflags().test(SPCFLAG_CPU_TRIGGER_INTERRUPT)) { - spcflags().clear(SPCFLAG_CPU_TRIGGER_INTERRUPT); - spcflags().set(SPCFLAG_CPU_HANDLE_INTERRUPT); - } -#endif - if (spcflags().test(SPCFLAG_CPU_ENTER_MON)) { - spcflags().clear(SPCFLAG_CPU_ENTER_MON); -#if ENABLE_MON - // Start up mon in real-mode - char *arg[] = { - "mon", -#ifdef SHEEPSHAVER - "-m", -#endif - "-r", - NULL - }; - mon(sizeof(arg)/sizeof(arg[0]) - 1, arg); -#endif - } - return true; -} - -#if DYNGEN_DIRECT_BLOCK_CHAINING -void *powerpc_cpu::compile_chain_block(block_info *sbi) -{ - // Block index is stuffed into the source basic block pointer, - // which is aligned at least on 4-byte boundaries - const int n = ((uintptr)sbi) & 3; - sbi = (block_info *)(((uintptr)sbi) & ~3L); - const uint32 bpc = sbi->pc; - - const uint32 tpc = sbi->li[n].jmp_pc; - block_info *tbi = my_block_cache.find(tpc); - if (tbi == NULL) - tbi = compile_block(tpc); - assert(tbi && tbi->pc == tpc); - - dg_set_jmp_target(sbi->li[n].jmp_addr, tbi->entry_point); - return tbi->entry_point; -} -#endif - -void powerpc_cpu::execute(uint32 entry) -{ - bool invalidated_cache = false; - pc() = entry; -#if PPC_EXECUTE_DUMP_STATE - const bool dump_state = true; -#endif - execute_depth++; -#if PPC_DECODE_CACHE || PPC_ENABLE_JIT - if (execute_depth == 1 || (PPC_ENABLE_JIT && PPC_REENTRANT_JIT)) { -#if PPC_ENABLE_JIT - if (use_jit) { - block_info *bi = my_block_cache.find(pc()); - if (bi == NULL) - bi = compile_block(pc()); - for (;;) { - // Execute all cached blocks - for (;;) { - codegen.execute(bi->entry_point); - - if (!spcflags().empty()) { - if (!check_spcflags()) - goto return_site; - - // Force redecoding if cache was invalidated - if (spcflags().test(SPCFLAG_JIT_EXEC_RETURN)) { - spcflags().clear(SPCFLAG_JIT_EXEC_RETURN); - invalidated_cache = true; - break; - } - } - - // Don't check for backward branches here as this - // is now done by generated code. Besides, we will - // get here if the fast cache lookup failed too. - if ((bi = my_block_cache.find(pc())) == NULL) - break; - } - - // Compile new block - bi = compile_block(pc()); - } - goto return_site; - } -#endif -#if PPC_DECODE_CACHE - block_info *bi = my_block_cache.find(pc()); - if (bi != NULL) - goto pdi_execute; - for (;;) { -#if PPC_PROFILE_COMPILE_TIME - compile_count++; - clock_t start_time; - start_time = clock(); -#endif - bi = my_block_cache.new_blockinfo(); - bi->init(pc()); - - // Predecode a new block - block_info::decode_info *di; - const instr_info_t *ii; - uint32 dpc; - di = bi->di = decode_cache_p; - dpc = pc() - 4; - do { - uint32 opcode = vm_read_memory_4(dpc += 4); - ii = decode(opcode); -#if PPC_EXECUTE_DUMP_STATE - if (dump_state) { - di->opcode = opcode; - di->execute = nv_mem_fun(&powerpc_cpu::dump_instruction); - di++; - } -#endif -#if PPC_FLIGHT_RECORDER - if (is_logging()) { - di->opcode = opcode; - di->execute = nv_mem_fun(&powerpc_cpu::record_step); - di++; - } -#endif - di->opcode = opcode; - di->execute = ii->execute; - di++; -#if PPC_EXECUTE_DUMP_STATE - if (dump_state) { - di->opcode = 0; - di->execute = nv_mem_fun(&powerpc_cpu::fake_dump_registers); - di++; - } -#endif - if (di >= decode_cache_end_p) { - // Invalidate cache and move current code to start - invalidate_cache(); - const int blocklen = di - bi->di; - memmove(decode_cache_p, bi->di, blocklen * sizeof(*di)); - bi->di = decode_cache_p; - di = bi->di + blocklen; - } - } while ((ii->cflow & CFLOW_END_BLOCK) == 0); - bi->end_pc = dpc; - bi->min_pc = dpc; - bi->max_pc = entry; - bi->size = di - bi->di; - my_block_cache.add_to_cl_list(bi); - my_block_cache.add_to_active_list(bi); - decode_cache_p += bi->size; -#if PPC_PROFILE_COMPILE_TIME - compile_time += (clock() - start_time); -#endif - - // Execute all cached blocks - pdi_execute: - for (;;) { - const int r = bi->size % 4; - di = bi->di + r; - int n = (bi->size + 3) / 4; - switch (r) { - case 0: do { - di += 4; - di[-4].execute(this, di[-4].opcode); - case 3: di[-3].execute(this, di[-3].opcode); - case 2: di[-2].execute(this, di[-2].opcode); - case 1: di[-1].execute(this, di[-1].opcode); - } while (--n > 0); - } - - if (!spcflags().empty()) { - if (!check_spcflags()) - goto return_site; - - // Force redecoding if cache was invalidated - if (spcflags().test(SPCFLAG_JIT_EXEC_RETURN)) { - spcflags().clear(SPCFLAG_JIT_EXEC_RETURN); - invalidated_cache = true; - break; - } - } - - if ((bi->pc != pc()) && ((bi = my_block_cache.find(pc())) == NULL)) - break; - } - } - goto return_site; -#endif - goto do_interpret; - } -#endif - do_interpret: - for (;;) { - uint32 opcode = vm_read_memory_4(pc()); - const instr_info_t *ii = decode(opcode); -#if PPC_EXECUTE_DUMP_STATE - if (dump_state) - dump_instruction(opcode); -#endif -#if PPC_FLIGHT_RECORDER - if (is_logging()) - record_step(opcode); -#endif - assert(ii->execute.ptr() != 0); - ii->execute(this, opcode); -#if PPC_EXECUTE_DUMP_STATE - if (dump_state) - dump_registers(); -#endif - if (!spcflags().empty() && !check_spcflags()) - goto return_site; - } - return_site: - // Tell upper level we invalidated cache? - if (invalidated_cache) - spcflags().set(SPCFLAG_JIT_EXEC_RETURN); - --execute_depth; -} - -void powerpc_cpu::execute() -{ - execute(pc()); -} - -void powerpc_cpu::init_decode_cache() -{ -#if PPC_DECODE_CACHE - decode_cache = (block_info::decode_info *)vm_acquire(DECODE_CACHE_SIZE); - if (decode_cache == VM_MAP_FAILED) { - fprintf(stderr, "powerpc_cpu: Could not allocate decode cache\n"); - abort(); - } - - D(bug("powerpc_cpu: Allocated decode cache: %d KB at %p\n", DECODE_CACHE_SIZE / 1024, decode_cache)); - decode_cache_p = decode_cache; - decode_cache_end_p = decode_cache + DECODE_CACHE_MAX_ENTRIES; -#if FLIGHT_RECORDER - // Leave enough room to last call to record_step() - decode_cache_end_p -= 2; -#endif -#if PPC_EXECUTE_DUMP_STATE - // Leave enough room to last calls to dump state functions - decode_cache_end_p -= 2; -#endif -#endif -} - -void powerpc_cpu::kill_decode_cache() -{ -#if PPC_DECODE_CACHE - vm_release(decode_cache, DECODE_CACHE_SIZE); -#endif -} - -void powerpc_cpu::invalidate_cache() -{ - D(bug("Invalidate all cache blocks\n")); -#if PPC_DECODE_CACHE || PPC_ENABLE_JIT - my_block_cache.clear(); - my_block_cache.initialize(); - spcflags().set(SPCFLAG_JIT_EXEC_RETURN); -#endif -#if PPC_ENABLE_JIT - codegen.invalidate_cache(); -#endif -#if PPC_DECODE_CACHE - decode_cache_p = decode_cache; -#endif -} - -void powerpc_block_info::invalidate() -{ -#if PPC_DECODE_CACHE - // Don't do anything if this is a predecoded block - if (di) - return; -#endif -#if DYNGEN_DIRECT_BLOCK_CHAINING - for (int i = 0; i < MAX_TARGETS; i++) { - link_info * const tli = &li[i]; - uint32 tpc = tli->jmp_pc; - // For any jump within page boundaries, reset the jump address - // to the target block resolver (trampoline) - if (tpc != INVALID_PC && ((tpc ^ pc) >> 12) == 0) - dg_set_jmp_target(tli->jmp_addr, tli->jmp_resolve_addr); - } -#endif -} - -void powerpc_cpu::invalidate_cache_range(uintptr start, uintptr end) -{ - D(bug("Invalidate cache block [%08x - %08x]\n", start, end)); -#if PPC_DECODE_CACHE || PPC_ENABLE_JIT -#if DYNGEN_DIRECT_BLOCK_CHAINING - if (use_jit) { - // Invalidate on page boundaries - start &= -4096; - end = (end + 4095) & -4096; - D(bug(" at page boundaries [%08x - %08x]\n", start, end)); - } -#endif - spcflags().set(SPCFLAG_JIT_EXEC_RETURN); - my_block_cache.clear_range(start, end); -#endif -} diff --git a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-cpu.hpp b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-cpu.hpp deleted file mode 100644 index c418386e..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-cpu.hpp +++ /dev/null @@ -1,514 +0,0 @@ -/* - * ppc-cpu.hpp - PowerPC CPU definition - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PPC_CPU_H -#define PPC_CPU_H - -#include "basic-cpu.hpp" -#include "nvmemfun.hpp" -#include "cpu/vm.hpp" -#include "cpu/block-cache.hpp" -#include "cpu/ppc/ppc-config.hpp" -#include "cpu/ppc/ppc-bitfields.hpp" -#include "cpu/ppc/ppc-blockinfo.hpp" -#include "cpu/ppc/ppc-registers.hpp" -#if PPC_ENABLE_JIT -#include "cpu/ppc/ppc-jit.hpp" -#endif -#include "cpu/ppc/ppc-instructions.hpp" -#include - -class powerpc_cpu -#ifndef SHEEPSHAVER - : public basic_cpu -#endif -{ - // NOTE: PowerPC registers structure shall be aligned on 16-byte - // boundaries for the AltiVec registers to be used in native code - // with aligned load/stores. - // - // We can't assume (offsetof(powerpc_cpu, regs) % 16) == 0 since - // extra data could be inserted prior regs, e.g. pointer to vtable - struct { - powerpc_registers regs; - uint8 pad[16]; - } _regs; - - // Make sure the calculation of the current offset makes use of - // 'this' as this could make it simplified at compile-time - powerpc_registers *regs_ptr() const { return (powerpc_registers *)((char *)&_regs.regs + (16 - (((char *)&_regs.regs - (char *)this) % 16))); } - powerpc_registers const & regs() const { return *regs_ptr(); } - powerpc_registers & regs() { return *regs_ptr(); } - -#if PPC_PROFILE_REGS_USE - // Registers use statistics - // NOTE: the emulator is designed to access registers only through - // the gpr() accessors. The number of calls to gpr() matches exactly - // the number of register operands for an instruction. -public: - struct register_info { - int id; - uint64 count; - }; -private: - register_info *reginfo; - void log_reg(int r) const { reginfo[r].count++; } -#else - void log_reg(int r) const { } -#endif - -protected: - - powerpc_spcflags & spcflags() { return regs().spcflags; } - powerpc_spcflags const & spcflags() const { return regs().spcflags; } - powerpc_cr_register & cr() { return regs().cr; } - powerpc_cr_register const & cr() const { return regs().cr; } - powerpc_xer_register & xer() { return regs().xer; } - powerpc_xer_register const & xer() const { return regs().xer; } - powerpc_vscr & vscr() { return regs().vscr; } - powerpc_vscr const & vscr() const { return regs().vscr; } - - uint32 vrsave() const { return regs().vrsave; } - uint32 & vrsave() { return regs().vrsave; } - - uint32 & fpscr() { return regs().fpscr; } - uint32 fpscr() const { return regs().fpscr; } - uint32 & lr() { return regs().lr; } - uint32 lr() const { return regs().lr; } - uint32 & ctr() { return regs().ctr; } - uint32 ctr() const { return regs().ctr; } - uint32 & pc() { return regs().pc; } - uint32 pc() const { return regs().pc; } - void increment_pc(int o) { pc() += o; } - - friend class pc_operand; - friend class lr_operand; - friend class ctr_operand; - friend class cr_operand; - template< class field > friend class xer_operand; - template< class field > friend class fpscr_operand; - -public: - - uint32 & gpr(int i) { log_reg(i); return regs().gpr[i]; } - uint32 gpr(int i) const { log_reg(i); return regs().gpr[i]; } - double & fpr(int i) { return regs().fpr[i].d; } - double fpr(int i) const { return regs().fpr[i].d; } - uint64 & fpr_dw(int i) { return regs().fpr[i].j; } - uint64 fpr_dw(int i) const { return regs().fpr[i].j; } - powerpc_vr & vr(int i) { return regs().vr[i]; } - powerpc_vr const & vr(int i) const { return regs().vr[i]; } - -protected: - - // Condition codes management - void record_cr(int crfd, int32 value) - { cr().compute(crfd, value); cr().set_so(crfd, xer().get_so()); } - void record_cr0(int32 value) - { record_cr(0, value); } - void record_cr1() - { cr().set((cr().get() & ~CR_field<1>::mask()) | ((fpscr() >> 4) & 0x0f000000)); } - void record_fpscr(int exceptions); - void record_cr6(powerpc_vr const & vS, bool check_one) { - if (check_one && (vS.j[0] == UVAL64(0xffffffffffffffff) && - vS.j[1] == UVAL64(0xffffffffffffffff))) - cr().set(6, 8); - else if (vS.j[0] == UVAL64(0) && vS.j[1] == UVAL64(0)) - cr().set(6, 2); - else - cr().set(6, 0); - } - - template< class FP > - void fp_classify(FP x); - -protected: - - // Flight recorder - struct rec_step { -#if PPC_FLIGHT_RECORDER >= 2 - uint32 r[32]; - double fr[32]; - uint32 lr, ctr; - uint32 cr, xer; - uint32 fpscr; -#endif - uint32 pc; - uint32 opcode; -#ifdef SHEEPSHAVER - uint32 sp; - uint32 r24; -#endif - }; - - // Instruction formats - enum instr_format_t { - INVALID_form = 0, - A_form, - B_form, - D_form, DS_form, - I_form, - M_form, - MD_form, MDS_form, - SC_form, - X_form, - XFL_form, XFX_form, XL_form, XO_form, XS_form, - VX_form, VXR_form, VA_form, - }; - - // Control flow types - enum control_flow_t { - CFLOW_NORMAL = 0, - CFLOW_BRANCH = 1, - CFLOW_JUMP = 2, - CFLOW_TRAP = 4, - CFLOW_CONST_JUMP = 8, - CFLOW_END_BLOCK = CFLOW_BRANCH | CFLOW_JUMP | CFLOW_TRAP - }; - - // Callbacks associated with each instruction - typedef void (powerpc_cpu::*execute_pmf)(uint32 opcode); - typedef nv_mem_fun1_t< void, powerpc_cpu, uint32 > execute_fn; - - // Instruction information structure - struct instr_info_t { - char name[12]; // Instruction name - execute_fn execute; // Semantic routine for this instruction - uint16 mnemo; // Mnemonic - uint16 format; // Instruction format (XO-form, D-form, etc.) - uint16 opcode; // Primary opcode - uint16 xo; // Extended opcode - uint16 cflow; // Mask of control flow information - }; - -private: - - // Compile time statistics -#if PPC_PROFILE_COMPILE_TIME - uint32 compile_count; - clock_t compile_time; - clock_t emul_start_time; -#endif - - // Compile blocks statistics -#if PPC_PROFILE_GENERIC_CALLS - friend int generic_calls_compare(const void *, const void *); - static uint32 generic_calls_count[]; -#endif - - // Flight recorder data - static const int LOG_SIZE = 32768; -#if PPC_FLIGHT_RECORDER - rec_step log[LOG_SIZE]; - bool logging; - int log_ptr; - bool log_ptr_wrapped; -#else - static const bool logging = false; -#endif - void do_record_step(uint32 pc, uint32 opcode); - void record_step(uint32 opcode) { do_record_step(pc(), opcode); } - - // Syscall callback must return TRUE if no error occurred - typedef bool (*syscall_fn)(powerpc_cpu *cpu); - syscall_fn execute_do_syscall; - - static const instr_info_t powerpc_ii_table[]; - std::vector ii_table; - typedef uint16 ii_index_t; - static const int II_INDEX_TABLE_SIZE = 0x20000; - ii_index_t ii_index_table[II_INDEX_TABLE_SIZE]; - - // Pack/unpack index into decode table - uint32 make_ii_index(uint32 opcode, uint32 xo) { return opcode | (xo << 6); } - uint32 get_ii_index(uint32 opcode) { return (opcode >> 26) | ((opcode & 0x7ff) << 6); } - - // Convert 8-bit field mask (e.g. mtcrf) to bit mask - uint32 field2mask[256]; - - // Check special CPU flags - bool check_spcflags(); - - // Current execute() nested level - int execute_depth; - -public: - - // Initialization & finalization - void initialize(); -#ifdef SHEEPSHAVER - powerpc_cpu(); -#else - powerpc_cpu(task_struct *parent_task); -#endif - ~powerpc_cpu(); - - // Specialised memory allocation (needs to be 16-byte aligned) - void *operator new(size_t size); - void operator delete(void *p); - - // Handle flight recorder -#if PPC_FLIGHT_RECORDER - bool is_logging() const { return logging; } - void start_log(); - void stop_log(); - void dump_log(const char *filename = NULL); -#else - bool is_logging() const { return false; } - void start_log() { } - void stop_log() { } - void dump_log(const char *filename = NULL) { } -#endif - - // Dump registers - void dump_registers(); - void dump_instruction(uint32 opcode); - void fake_dump_registers(uint32); - - // Start emulation loop - void execute(uint32 entry); - void execute(); - - // Interrupts handling - void trigger_interrupt(); - - // Set VALUE to register ID - void set_register(int id, any_register const & value); - - // Get register ID - any_register get_register(int id); - - // Set syscall callback - void set_syscall_callback(syscall_fn fn) { execute_do_syscall = fn; } - - // Caches invalidation - void invalidate_cache(); - void invalidate_cache_range(uintptr start, uintptr end); -private: - struct { uintptr start, end; } cache_range; - -protected: - - // Init decoder with one instruction info - void init_decoder_entry(const instr_info_t * ii); - -#if PPC_ENABLE_JIT - // Dynamic translation engine - struct codegen_context_t { - powerpc_dyngen & codegen; - uint32 entry_point; - uint32 pc; - uint32 opcode; - const instr_info_t *instr_info; - bool done_compile; - - codegen_context_t(powerpc_dyngen & codegen_init) - : codegen(codegen_init) - { } - }; - - // Compile one opcode, returns any of the following status - enum { - COMPILE_FAILURE, // no translation available, call interpreter - COMPILE_CODE_OK, // generated code, control flow fall through - COMPILE_EPILOGUE_OK // generated code, including basic block epilogue - }; - virtual int compile1(codegen_context_t & cg_context) { return COMPILE_FAILURE; } - - bool use_jit; -public: - void enable_jit(uint32 cache_size = 0); -#endif - -private: - - // Initializers & destructors - void init_flight_recorder(); - void init_registers(); - void init_decoder(); - void init_decode_cache(); - void kill_decode_cache(); - - // Get instruction info for opcode - const instr_info_t *decode(uint32 opcode) { - return &ii_table[ii_index_table[get_ii_index(opcode)]]; - } - - // Block lookup table - typedef powerpc_block_info block_info; - block_cache< block_info, lazy_allocator > my_block_cache; - -#if PPC_DECODE_CACHE - // Decode Cache - static const uint32 DECODE_CACHE_MAX_ENTRIES = 32768; - static const uint32 DECODE_CACHE_SIZE = DECODE_CACHE_MAX_ENTRIES * sizeof(block_info::decode_info); - block_info::decode_info * decode_cache; - block_info::decode_info * decode_cache_p; - block_info::decode_info * decode_cache_end_p; -#endif - -#if PPC_ENABLE_JIT - // Dynamic translation engine - friend class powerpc_dyngen_helper; - friend class powerpc_dyngen; - friend class powerpc_jit; - powerpc_jit codegen; - block_info *compile_block(uint32 entry); -#if DYNGEN_DIRECT_BLOCK_CHAINING - void *compile_chain_block(block_info *sbi); -#endif -#endif - - // Semantic action templates - template< bool SB, bool OE > - uint32 do_execute_divide(uint32, uint32); - template< bool EX, bool CA, bool OE > - uint32 do_execute_addition(uint32, uint32); - template< bool CA, bool OE > - uint32 do_execute_subtract(uint32, uint32); - template< bool OE > - uint32 do_execute_subtract_extended(uint32, uint32); - - // Instruction handlers - void execute_nop(uint32 opcode); - void execute_illegal(uint32 opcode); - template< class RA, class RB, class RC, class CA, class OE, class Rc > - void execute_addition(uint32 opcode); - template< class OP, class RD, class RA, class RB, class RC, class OE, class Rc > - void execute_generic_arith(uint32 opcode); - template< class PC, class BO, class DP, class AA, class LK > - void execute_branch(uint32 opcode); - template< class RB, typename CT > - void execute_compare(uint32 opcode); - template< class OP > - void execute_cr_op(uint32 opcode); - template< bool SB, class OE, class Rc > - void execute_divide(uint32 opcode); - template< class FP, class OP, class RD, class RA, class RB, class RC, class Rc, bool FPSCR > - void execute_fp_arith(uint32 opcode); - template< class OP, class RA, class RB, bool LD, int SZ, bool UP, bool RX > - void execute_loadstore(uint32 opcode); - template< class RA, class DP, bool LD > - void execute_loadstore_multiple(uint32 opcode); - template< class RA, bool IM, class NB > - void execute_load_string(uint32 opcode); - template< class RA, bool IM, class NB > - void execute_store_string(uint32 opcode); - template< class RA > - void execute_lwarx(uint32 opcode); - template< class RA > - void execute_stwcx(uint32 opcode); - void execute_mcrf(uint32 opcode); - void execute_mcrfs(uint32 opcode); - void execute_mcrxr(uint32 opcode); - void execute_mtcrf(uint32 opcode); - template< class FM, class RB, class Rc > - void execute_mtfsf(uint32 opcode); - template< class RB, class Rc > - void execute_mtfsfi(uint32 opcode); - template< class RB, class Rc > - void execute_mtfsb(uint32 opcode); - template< bool HI, bool SB, class OE, class Rc > - void execute_multiply(uint32 opcode); - template< class Rc > - void execute_mffs(uint32 opcode); - void execute_mfmsr(uint32 opcode); - template< class SPR > - void execute_mfspr(uint32 opcode); - template< class TBR > - void execute_mftbr(uint32 opcode); - template< class SPR > - void execute_mtspr(uint32 opcode); - template< class SH, class MA, class Rc > - void execute_rlwimi(uint32 opcode); - template< class OP, class RD, class RA, class SH, class SO, class CA, class Rc > - void execute_shift(uint32 opcode); - void execute_syscall(uint32 opcode); - template< bool OC > - void execute_fp_compare(uint32 opcode); - template< class RA, class RB, bool LD, bool DB, bool UP > - void execute_fp_loadstore(uint32 opcode); - template< class RN, class Rc > - void execute_fp_int_convert(uint32 opcode); - template< class Rc > - void execute_fp_round(uint32 opcode); - template< class RA, class RB > - void execute_icbi(uint32 opcode); - void execute_isync(uint32 opcode); - void execute_invalidate_cache_range(); - template< class RA, class RB > - void execute_dcbz(uint32 opcode); - template< bool SL > - void execute_vector_load_for_shift(uint32 opcode); - template< class VD, class RA, class RB > - void execute_vector_load(uint32 opcode); - template< class VS, class RA, class RB > - void execute_vector_store(uint32 opcode); - void execute_mfvscr(uint32 opcode); - void execute_mtvscr(uint32 opcode); - template< class OP, class VD, class VA, class VB, class VC, class Rc, int C1 > - void execute_vector_arith(uint32 opcode); - template< class OP, class VD, class VA, class VB, class VC > - void execute_vector_arith_mixed(uint32 opcode); - template< int ODD, class OP, class VD, class VA, class VB, class VC > - void execute_vector_arith_odd(uint32 opcode); - template< class VD, class VA, class VB, int LO > - void execute_vector_merge(uint32 opcode); - template< class VD, class VA, class VB > - void execute_vector_pack(uint32 opcode); - void execute_vector_pack_pixel(uint32 opcode); - template< int LO > - void execute_vector_unpack_pixel(uint32 opcode); - template< int LO, class VD, class VA > - void execute_vector_unpack(uint32 opcode); - void execute_vector_permute(uint32 opcode); - template< int SD > - void execute_vector_shift(uint32 opcode); - template< int SD, class VD, class VA, class VB, class SH > - void execute_vector_shift_octet(uint32 opcode); - template< class OP, class VD, class VB, bool IM > - void execute_vector_splat(uint32 opcode); - template< int SZ, class VD, class VA, class VB > - void execute_vector_sum(uint32 opcode); - - // Specialized instruction decoders - template< class RA, class RB, class RC, class CA > - execute_fn decode_addition(uint32 opcode); - template< class RA, class RS > - execute_fn decode_rlwinm(uint32 opcode); -}; - - -/** - * Interrupts handling - **/ - -inline void powerpc_cpu::trigger_interrupt() -{ -#if PPC_CHECK_INTERRUPTS - spcflags().set(SPCFLAG_CPU_TRIGGER_INTERRUPT); -#endif -} - -#ifdef SHEEPSHAVER -extern void HandleInterrupt(powerpc_registers *r); -#endif - -#endif /* PPC_CPU_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-decode.cpp b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-decode.cpp deleted file mode 100644 index 972f26ec..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-decode.cpp +++ /dev/null @@ -1,1869 +0,0 @@ -/* - * ppc-decode.cpp - PowerPC instructions decoder - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "cpu/ppc/ppc-cpu.hpp" -#include "cpu/ppc/ppc-bitfields.hpp" -#include "cpu/ppc/ppc-operands.hpp" -#include "cpu/ppc/ppc-operations.hpp" -#include "cpu/ppc/ppc-instructions.hpp" - -#define DEBUG 0 -#include "debug.h" - -#define EXECUTE_0(HANDLER) \ -&powerpc_cpu::execute_##HANDLER - -#define EXECUTE_1(HANDLER, ARG1) \ -&powerpc_cpu::execute_##HANDLER - -#define EXECUTE_2(HANDLER, ARG1, ARG2) \ -&powerpc_cpu::execute_##HANDLER - -#define EXECUTE_3(HANDLER, ARG1, ARG2, ARG3) \ -&powerpc_cpu::execute_##HANDLER - -#define EXECUTE_4(HANDLER, ARG1, ARG2, ARG3, ARG4) \ -&powerpc_cpu::execute_##HANDLER - -#define EXECUTE_7(HANDLER, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \ -&powerpc_cpu::execute_##HANDLER - -#define EXECUTE_ADDITION(RA, RB, RC, CA, OE, Rc) \ -&powerpc_cpu::execute_addition - -#define EXECUTE_GENERIC_ARITH(OP, RD, RA, RB, RC, OE, Rc) \ -&powerpc_cpu::execute_generic_arith - -#define EXECUTE_BRANCH(PC, BO, DP, AA, LK) \ -&powerpc_cpu::execute_branch - -#define EXECUTE_COMPARE(RB, CT) \ -&powerpc_cpu::execute_compare - -#define EXECUTE_CR_OP(OP) \ -&powerpc_cpu::execute_cr_op - -#define EXECUTE_FP_ARITH(FP, OP, RD, RA, RB, RC, Rc, FPSCR) \ -&powerpc_cpu::execute_fp_arith - -#define EXECUTE_LOADSTORE(OP, RA, RB, LD, SZ, UP, RX) \ -&powerpc_cpu::execute_loadstore - -#define EXECUTE_LOADSTORE_MULTIPLE(RA, DP, LD) \ -&powerpc_cpu::execute_loadstore_multiple - -#define EXECUTE_LOAD_STRING(RA, IM, NB) \ -&powerpc_cpu::execute_load_string - -#define EXECUTE_STORE_STRING(RA, IM, NB) \ -&powerpc_cpu::execute_store_string - -#define EXECUTE_SHIFT(OP, RD, RA, SH, SO, CA, Rc) \ -&powerpc_cpu::execute_shift - -#define EXECUTE_FP_LOADSTORE(RA, RB, LD, DB, UP) \ -&powerpc_cpu::execute_fp_loadstore - -#define EXECUTE_VECTOR_LOADSTORE(OP, VD, RA, RB) \ -&powerpc_cpu::execute_vector_##OP - -#define EXECUTE_VECTOR_ARITH(OP, VD, VA, VB, VC) \ -&powerpc_cpu::execute_vector_arith, 0 > - -#define EXECUTE_VECTOR_ARITH_MIXED(OP, VD, VA, VB, VC) \ -&powerpc_cpu::execute_vector_arith_mixed - -#define EXECUTE_VECTOR_ARITH_ODD(ODD, OP, VD, VA, VB, VC) \ -&powerpc_cpu::execute_vector_arith_odd - -#define EXECUTE_VECTOR_MERGE(VD, VA, VB, LO) \ -&powerpc_cpu::execute_vector_merge - -#define EXECUTE_VECTOR_COMPARE(OP, VD, VA, VB, C1) \ -&powerpc_cpu::execute_vector_arith - -#define EXECUTE_VECTOR_PACK(VD, VA, VB) \ -&powerpc_cpu::execute_vector_pack - -#define EXECUTE_VECTOR_UNPACK(LO, VD, VB) \ -&powerpc_cpu::execute_vector_unpack - -#define EXECUTE_VECTOR_SHIFT_OCTET(SD, VD, VA, VB, SH) \ -&powerpc_cpu::execute_vector_shift_octet - -#define EXECUTE_VECTOR_SPLAT(OP, VD, VB, IM) \ -&powerpc_cpu::execute_vector_splat - -#define EXECUTE_VECTOR_SUM(SZ, VD, VA, VB) \ -&powerpc_cpu::execute_vector_sum - -const powerpc_cpu::instr_info_t powerpc_cpu::powerpc_ii_table[] = { - { "invalid", - EXECUTE_0(illegal), - PPC_I(INVALID), - INVALID_form, 0, 0, CFLOW_TRAP - }, - { "add", - EXECUTE_ADDITION(RA, RB, NONE, CA_BIT_0, OE_BIT_G, RC_BIT_G), - PPC_I(ADD), - XO_form, 31, 266, CFLOW_NORMAL - }, - { "addc", - EXECUTE_ADDITION(RA, RB, NONE, CA_BIT_1, OE_BIT_G, RC_BIT_G), - PPC_I(ADDC), - XO_form, 31, 10, CFLOW_NORMAL - }, - { "adde", - EXECUTE_ADDITION(RA, RB, XER_CA, CA_BIT_1, OE_BIT_G, RC_BIT_G), - PPC_I(ADDE), - XO_form, 31, 138, CFLOW_NORMAL - }, - { "addi", - EXECUTE_ADDITION(RA_or_0, SIMM, NONE, CA_BIT_0, OE_BIT_0, RC_BIT_0), - PPC_I(ADDI), - D_form, 14, 0, CFLOW_NORMAL - }, - { "addic", - EXECUTE_ADDITION(RA, SIMM, NONE, CA_BIT_1, OE_BIT_0, RC_BIT_0), - PPC_I(ADDIC), - D_form, 12, 0, CFLOW_NORMAL - }, - { "addic.", - EXECUTE_ADDITION(RA, SIMM, NONE, CA_BIT_1, OE_BIT_0, RC_BIT_1), - PPC_I(ADDIC_), - D_form, 13, 0, CFLOW_NORMAL - }, - { "addis", - EXECUTE_ADDITION(RA_or_0, SIMM_shifted, NONE, CA_BIT_0, OE_BIT_0, RC_BIT_0), - PPC_I(ADDIS), - D_form, 15, 0, CFLOW_NORMAL - }, - { "addme", - EXECUTE_ADDITION(RA, MINUS_ONE, XER_CA, CA_BIT_1, OE_BIT_G, RC_BIT_G), - PPC_I(ADDME), - XO_form, 31, 234, CFLOW_NORMAL - }, - { "addze", - EXECUTE_ADDITION(RA, ZERO, XER_CA, CA_BIT_1, OE_BIT_G, RC_BIT_G), - PPC_I(ADDZE), - XO_form, 31, 202, CFLOW_NORMAL - }, - { "and", - EXECUTE_GENERIC_ARITH(and, RA, RS, RB, NONE, OE_BIT_0, RC_BIT_G), - PPC_I(AND), - X_form, 31, 28, CFLOW_NORMAL - }, - { "andc", - EXECUTE_GENERIC_ARITH(andc, RA, RS, RB, NONE, OE_BIT_0, RC_BIT_G), - PPC_I(ANDC), - X_form, 31, 60, CFLOW_NORMAL - }, - { "andi.", - EXECUTE_GENERIC_ARITH(and, RA, RS, UIMM, NONE, OE_BIT_0, RC_BIT_1), - PPC_I(ANDI), - D_form, 28, 0, CFLOW_NORMAL - }, - { "andis.", - EXECUTE_GENERIC_ARITH(and, RA, RS, UIMM_shifted, NONE, OE_BIT_0, RC_BIT_1), - PPC_I(ANDIS), - D_form, 29, 0, CFLOW_NORMAL - }, - { "b", - EXECUTE_BRANCH(PC, immediate_value, LI, AA_BIT_G, LK_BIT_G), - PPC_I(B), - I_form, 18, 0, CFLOW_BRANCH - }, - { "bc", - EXECUTE_BRANCH(PC, operand_BO, BD, AA_BIT_G, LK_BIT_G), - PPC_I(BC), - B_form, 16, 0, CFLOW_BRANCH - }, - { "bcctr", - EXECUTE_BRANCH(CTR, operand_BO, ZERO, AA_BIT_0, LK_BIT_G), - PPC_I(BCCTR), - XL_form, 19, 528, CFLOW_BRANCH - }, - { "bclr", - EXECUTE_BRANCH(LR, operand_BO, ZERO, AA_BIT_0, LK_BIT_G), - PPC_I(BCLR), - XL_form, 19, 16, CFLOW_BRANCH - }, - { "cmp", - EXECUTE_COMPARE(RB, int32), - PPC_I(CMP), - X_form, 31, 0, CFLOW_NORMAL - }, - { "cmpi", - EXECUTE_COMPARE(SIMM, int32), - PPC_I(CMPI), - D_form, 11, 0, CFLOW_NORMAL - }, - { "cmpl", - EXECUTE_COMPARE(RB, uint32), - PPC_I(CMPL), - X_form, 31, 32, CFLOW_NORMAL - }, - { "cmpli", - EXECUTE_COMPARE(UIMM, uint32), - PPC_I(CMPLI), - D_form, 10, 0, CFLOW_NORMAL - }, - { "cntlzw", - EXECUTE_GENERIC_ARITH(cntlzw, RA, RS, NONE, NONE, OE_BIT_0, RC_BIT_G), - PPC_I(CNTLZW), - X_form, 31, 26, CFLOW_NORMAL - }, - { "crand", - EXECUTE_CR_OP(and), - PPC_I(CRAND), - XL_form, 19, 257, CFLOW_NORMAL - }, - { "crandc", - EXECUTE_CR_OP(andc), - PPC_I(CRANDC), - XL_form, 19, 129, CFLOW_NORMAL - }, - { "creqv", - EXECUTE_CR_OP(eqv), - PPC_I(CREQV), - XL_form, 19, 289, CFLOW_NORMAL - }, - { "crnand", - EXECUTE_CR_OP(nand), - PPC_I(CRNAND), - XL_form, 19, 225, CFLOW_NORMAL - }, - { "crnor", - EXECUTE_CR_OP(nor), - PPC_I(CRNOR), - XL_form, 19, 33, CFLOW_NORMAL - }, - { "cror", - EXECUTE_CR_OP(or), - PPC_I(CROR), - XL_form, 19, 449, CFLOW_NORMAL - }, - { "crorc", - EXECUTE_CR_OP(orc), - PPC_I(CRORC), - XL_form, 19, 417, CFLOW_NORMAL - }, - { "crxor", - EXECUTE_CR_OP(xor), - PPC_I(CRXOR), - XL_form, 19, 193, CFLOW_NORMAL - }, - { "dcba", - EXECUTE_0(nop), - PPC_I(DCBA), - X_form, 31, 758, CFLOW_NORMAL - }, - { "dcbf", - EXECUTE_0(nop), - PPC_I(DCBF), - X_form, 31, 86, CFLOW_NORMAL - }, - { "dcbi", - EXECUTE_0(nop), - PPC_I(DCBI), - X_form, 31, 470, CFLOW_NORMAL - }, - { "dcbst", - EXECUTE_0(nop), - PPC_I(DCBST), - X_form, 31, 54, CFLOW_NORMAL - }, - { "dcbt", - EXECUTE_0(nop), - PPC_I(DCBT), - X_form, 31, 278, CFLOW_NORMAL - }, - { "dcbtst", - EXECUTE_0(nop), - PPC_I(DCBTST), - X_form, 31, 246, CFLOW_NORMAL - }, - { "dcbz", - EXECUTE_2(dcbz, operand_RA_or_0, operand_RB), - PPC_I(DCBZ), - X_form, 31, 1014, CFLOW_NORMAL - }, - { "divw", - EXECUTE_3(divide, true, OE_BIT_G, RC_BIT_G), - PPC_I(DIVW), - XO_form, 31, 491, CFLOW_NORMAL - }, - { "divwu", - EXECUTE_3(divide, false, OE_BIT_G, RC_BIT_G), - PPC_I(DIVWU), - XO_form, 31, 459, CFLOW_NORMAL - }, - { "dss", - EXECUTE_0(nop), - PPC_I(DSS), - X_form, 31, 822, CFLOW_NORMAL - }, - { "dst", - EXECUTE_0(nop), - PPC_I(DST), - X_form, 31, 342, CFLOW_NORMAL - }, - { "dstst", - EXECUTE_0(nop), - PPC_I(DST), - X_form, 31, 374, CFLOW_NORMAL - }, - { "eciwx", - EXECUTE_0(nop), - PPC_I(ECIWX), - X_form, 31, 310, CFLOW_NORMAL - }, - { "ecowx", - EXECUTE_0(nop), - PPC_I(ECOWX), - X_form, 31, 438, CFLOW_NORMAL - }, - { "eieio", - EXECUTE_0(nop), - PPC_I(EIEIO), - X_form, 31, 854, CFLOW_NORMAL - }, - { "eqv", - EXECUTE_GENERIC_ARITH(eqv, RA, RS, RB, NONE, OE_BIT_0, RC_BIT_G), - PPC_I(EQV), - X_form, 31, 284, CFLOW_NORMAL - }, - { "extsb", - EXECUTE_GENERIC_ARITH(sign_extend_8_32, RA, RS, NONE, NONE, OE_BIT_0, RC_BIT_G), - PPC_I(EXTSB), - X_form, 31, 954, CFLOW_NORMAL - }, - { "extsh", - EXECUTE_GENERIC_ARITH(sign_extend_16_32, RA, RS, NONE, NONE, OE_BIT_0, RC_BIT_G), - PPC_I(EXTSH), - X_form, 31, 922, CFLOW_NORMAL - }, - { "fabs", - EXECUTE_FP_ARITH(double, fabs, RD, RB, NONE, NONE, RC_BIT_G, false), - PPC_I(FABS), - X_form, 63, 264, CFLOW_NORMAL - }, - { "fadd", - EXECUTE_FP_ARITH(double, fadd, RD, RA, RB, NONE, RC_BIT_G, true), - PPC_I(FADD), - A_form, 63, 21, CFLOW_NORMAL - }, - { "fadds", - EXECUTE_FP_ARITH(float, fadd, RD, RA, RB, NONE, RC_BIT_G, true), - PPC_I(FADDS), - A_form, 59, 21, CFLOW_NORMAL - }, - { "fcmpo", - EXECUTE_1(fp_compare, true), - PPC_I(FCMPO), - X_form, 63, 32, CFLOW_NORMAL - }, - { "fcmpu", - EXECUTE_1(fp_compare, false), - PPC_I(FCMPU), - X_form, 63, 0, CFLOW_NORMAL - }, - { "fctiw", - EXECUTE_2(fp_int_convert, operand_FPSCR_RN, RC_BIT_G), - PPC_I(FCTIW), - X_form, 63, 14, CFLOW_NORMAL - }, - { "fctiwz", - EXECUTE_2(fp_int_convert, operand_ONE, RC_BIT_G), - PPC_I(FCTIWZ), - X_form, 63, 15, CFLOW_NORMAL - }, - { "fdiv", - EXECUTE_FP_ARITH(double, fdiv, RD, RA, RB, NONE, RC_BIT_G, true), - PPC_I(FDIV), - A_form, 63, 18, CFLOW_NORMAL - }, - { "fdivs", - EXECUTE_FP_ARITH(float, fdiv, RD, RA, RB, NONE, RC_BIT_G, true), - PPC_I(FDIVS), - A_form, 59, 18, CFLOW_NORMAL - }, - { "fmadd", - EXECUTE_FP_ARITH(double, fmadd, RD, RA, RC, RB, RC_BIT_G, true), - PPC_I(FMADD), - A_form, 63, 29, CFLOW_NORMAL - }, - { "fmadds", - EXECUTE_FP_ARITH(float, fmadd, RD, RA, RC, RB, RC_BIT_G, true), - PPC_I(FMADDS), - A_form, 59, 29, CFLOW_NORMAL - }, - { "fmr", - EXECUTE_FP_ARITH(double, fnop, RD, RB, NONE, NONE, RC_BIT_G, false), - PPC_I(FMR), - X_form, 63, 72, CFLOW_NORMAL - }, - { "fmsub", - EXECUTE_FP_ARITH(double, fmsub, RD, RA, RC, RB, RC_BIT_G, true), - PPC_I(FMSUB), - A_form, 63, 28, CFLOW_NORMAL - }, - { "fmsubs", - EXECUTE_FP_ARITH(float, fmsub, RD, RA, RC, RB, RC_BIT_G, true), - PPC_I(FMSUBS), - A_form, 59, 28, CFLOW_NORMAL - }, - { "fmul", - EXECUTE_FP_ARITH(double, fmul, RD, RA, RC, NONE, RC_BIT_G, true), - PPC_I(FMUL), - A_form, 63, 25, CFLOW_NORMAL - }, - { "fmuls", - EXECUTE_FP_ARITH(float, fmul, RD, RA, RC, NONE, RC_BIT_G, true), - PPC_I(FMULS), - A_form, 59, 25, CFLOW_NORMAL - }, - { "fnabs", - EXECUTE_FP_ARITH(double, fnabs, RD, RB, NONE, NONE, RC_BIT_G, false), - PPC_I(FNABS), - X_form, 63, 136, CFLOW_NORMAL - }, - { "fneg", - EXECUTE_FP_ARITH(double, fneg, RD, RB, NONE, NONE, RC_BIT_G, false), - PPC_I(FNEG), - X_form, 63, 40, CFLOW_NORMAL - }, - { "fnmadd", - EXECUTE_FP_ARITH(double, fnmadd, RD, RA, RC, RB, RC_BIT_G, true), - PPC_I(FNMADD), - A_form, 63, 31, CFLOW_NORMAL - }, - { "fnmadds", - EXECUTE_FP_ARITH(double, fnmadds, RD, RA, RC, RB, RC_BIT_G, true), - PPC_I(FNMADDS), - A_form, 59, 31, CFLOW_NORMAL - }, - { "fnmsub", - EXECUTE_FP_ARITH(double, fnmsub, RD, RA, RC, RB, RC_BIT_G, true), - PPC_I(FNMSUB), - A_form, 63, 30, CFLOW_NORMAL - }, - { "fnmsubs", - EXECUTE_FP_ARITH(double, fnmsubs, RD, RA, RC, RB, RC_BIT_G, true), - PPC_I(FNMSUBS), - A_form, 59, 30, CFLOW_NORMAL - }, - { "frsp", - EXECUTE_1(fp_round, RC_BIT_G), - PPC_I(FRSP), - X_form, 63, 12, CFLOW_NORMAL - }, - { "fsel", - EXECUTE_FP_ARITH(double, fsel, RD, RA, RC, RB, RC_BIT_G, false), - PPC_I(FSEL), - A_form, 63, 23, CFLOW_NORMAL - }, - { "fsub", - EXECUTE_FP_ARITH(double, fsub, RD, RA, RB, NONE, RC_BIT_G, true), - PPC_I(FSUB), - A_form, 63, 20, CFLOW_NORMAL - }, - { "fsubs", - EXECUTE_FP_ARITH(float, fsub, RD, RA, RB, NONE, RC_BIT_G, true), - PPC_I(FSUBS), - A_form, 59, 20, CFLOW_NORMAL - }, - { "icbi", - EXECUTE_2(icbi, operand_RA_or_0, operand_RB), - PPC_I(ICBI), - X_form, 31, 982, CFLOW_NORMAL - }, - { "isync", - EXECUTE_0(isync), - PPC_I(ISYNC), - X_form, 19, 150, CFLOW_NORMAL - }, - { "lbz", - EXECUTE_LOADSTORE(nop, RA_or_0, D, true, 1, false, false), - PPC_I(LBZ), - D_form, 34, 0, CFLOW_NORMAL - }, - { "lbzu", - EXECUTE_LOADSTORE(nop, RA, D, true, 1, true, false), - PPC_I(LBZU), - D_form, 35, 0, CFLOW_NORMAL - }, - { "lbzux", - EXECUTE_LOADSTORE(nop, RA, RB, true, 1, true, false), - PPC_I(LBZUX), - X_form, 31, 119, CFLOW_NORMAL - }, - { "lbzx", - EXECUTE_LOADSTORE(nop, RA_or_0, RB, true, 1, false, false), - PPC_I(LBZX), - X_form, 31, 87, CFLOW_NORMAL - }, - { "lfd", - EXECUTE_FP_LOADSTORE(RA_or_0, D, true, true, false), - PPC_I(LFD), - D_form, 50, 0, CFLOW_NORMAL - }, - { "lfdu", - EXECUTE_FP_LOADSTORE(RA, D, true, true, true), - PPC_I(LFDU), - D_form, 51, 0, CFLOW_NORMAL - }, - { "lfdux", - EXECUTE_FP_LOADSTORE(RA, RB, true, true, true), - PPC_I(LFDUX), - X_form, 31, 631, CFLOW_NORMAL - }, - { "lfdx", - EXECUTE_FP_LOADSTORE(RA_or_0, RB, true, true, false), - PPC_I(LFDX), - X_form, 31, 599, CFLOW_NORMAL - }, - { "lfs", - EXECUTE_FP_LOADSTORE(RA_or_0, D, true, false, false), - PPC_I(LFS), - D_form, 48, 0, CFLOW_NORMAL - }, - { "lfsu", - EXECUTE_FP_LOADSTORE(RA, D, true, false, true), - PPC_I(LFSU), - D_form, 49, 0, CFLOW_NORMAL - }, - { "lfsux", - EXECUTE_FP_LOADSTORE(RA, RB, true, false, true), - PPC_I(LFSUX), - X_form, 31, 567, CFLOW_NORMAL - }, - { "lfsx", - EXECUTE_FP_LOADSTORE(RA_or_0, RB, true, false, false), - PPC_I(LFSX), - X_form, 31, 535, CFLOW_NORMAL - }, - { "lha", - EXECUTE_LOADSTORE(sign_extend_16_32, RA_or_0, D, true, 2, false, false), - PPC_I(LHA), - D_form, 42, 0, CFLOW_NORMAL - }, - { "lhau", - EXECUTE_LOADSTORE(sign_extend_16_32, RA, D, true, 2, true, false), - PPC_I(LHAU), - D_form, 43, 0, CFLOW_NORMAL - }, - { "lhaux", - EXECUTE_LOADSTORE(sign_extend_16_32, RA, RB, true, 2, true, false), - PPC_I(LHAUX), - X_form, 31, 375, CFLOW_NORMAL - }, - { "lhax", - EXECUTE_LOADSTORE(sign_extend_16_32, RA_or_0, RB, true, 2, false, false), - PPC_I(LHAX), - X_form, 31, 343, CFLOW_NORMAL - }, - { "lhbrx", - EXECUTE_LOADSTORE(nop, RA_or_0, RB, true, 2, false, true), - PPC_I(LHBRX), - X_form, 31, 790, CFLOW_NORMAL - }, - { "lhz", - EXECUTE_LOADSTORE(nop, RA_or_0, D, true, 2, false, false), - PPC_I(LHZ), - D_form, 40, 0, CFLOW_NORMAL - }, - { "lhzu", - EXECUTE_LOADSTORE(nop, RA, D, true, 2, true, false), - PPC_I(LHZU), - D_form, 41, 0, CFLOW_NORMAL - }, - { "lhzux", - EXECUTE_LOADSTORE(nop, RA, RB, true, 2, true, false), - PPC_I(LHZUX), - X_form, 31, 311, CFLOW_NORMAL - }, - { "lhzx", - EXECUTE_LOADSTORE(nop, RA_or_0, RB, true, 2, false, false), - PPC_I(LHZX), - X_form, 31, 279, CFLOW_NORMAL - }, - { "lmw", - EXECUTE_LOADSTORE_MULTIPLE(RA_or_0, D, true), - PPC_I(LMW), - D_form, 46, 0, CFLOW_NORMAL - }, - { "lswi", - EXECUTE_LOAD_STRING(RA_or_0, true, NB), - PPC_I(LSWI), - X_form, 31, 597, CFLOW_NORMAL - }, - { "lswx", - EXECUTE_LOAD_STRING(RA_or_0, false, XER_COUNT), - PPC_I(LSWX), - X_form, 31, 533, CFLOW_NORMAL - }, - { "lvebx", - EXECUTE_VECTOR_LOADSTORE(load, V16QIm, RA_or_0, RB), - PPC_I(LVEBX), - X_form, 31, 7, CFLOW_NORMAL - }, - { "lvehx", - EXECUTE_VECTOR_LOADSTORE(load, V8HIm, RA_or_0, RB), - PPC_I(LVEHX), - X_form, 31, 39, CFLOW_NORMAL - }, - { "lvewx", - EXECUTE_VECTOR_LOADSTORE(load, V4SI, RA_or_0, RB), - PPC_I(LVEWX), - X_form, 31, 71, CFLOW_NORMAL - }, - { "lvsl", - EXECUTE_1(vector_load_for_shift, 1), - PPC_I(LVSL), - X_form, 31, 6, CFLOW_NORMAL - }, - { "lvsr", - EXECUTE_1(vector_load_for_shift, 0), - PPC_I(LVSR), - X_form, 31, 38, CFLOW_NORMAL - }, - { "lvx", - EXECUTE_VECTOR_LOADSTORE(load, V2DI, RA_or_0, RB), - PPC_I(LVX), - X_form, 31, 103, CFLOW_NORMAL - }, - { "lvxl", - EXECUTE_VECTOR_LOADSTORE(load, V2DI, RA_or_0, RB), - PPC_I(LVXL), - X_form, 31, 359, CFLOW_NORMAL - }, - { "lwarx", - EXECUTE_1(lwarx, operand_RA_or_0), - PPC_I(LWARX), - X_form, 31, 20, CFLOW_NORMAL - }, - { "lwbrx", - EXECUTE_LOADSTORE(nop, RA_or_0, RB, true, 4, false, true), - PPC_I(LWBRX), - X_form, 31, 534, CFLOW_NORMAL - }, - { "lwz", - EXECUTE_LOADSTORE(nop, RA_or_0, D, true, 4, false, false), - PPC_I(LWZ), - D_form, 32, 0, CFLOW_NORMAL - }, - { "lwzu", - EXECUTE_LOADSTORE(nop, RA, D, true, 4, true, false), - PPC_I(LWZU), - D_form, 33, 0, CFLOW_NORMAL - }, - { "lwzux", - EXECUTE_LOADSTORE(nop, RA, RB, true, 4, true, false), - PPC_I(LWZUX), - X_form, 31, 55, CFLOW_NORMAL - }, - { "lwzx", - EXECUTE_LOADSTORE(nop, RA_or_0, RB, true, 4, false, false), - PPC_I(LWZX), - X_form, 31, 23, CFLOW_NORMAL - }, - { "mcrf", - EXECUTE_0(mcrf), - PPC_I(MCRF), - XL_form, 19, 0, CFLOW_NORMAL - }, - { "mcrfs", - EXECUTE_0(mcrfs), - PPC_I(MCRFS), - X_form, 63, 64, CFLOW_NORMAL - }, - { "mcrxr", - EXECUTE_0(mcrxr), - PPC_I(MCRXR), - X_form, 31, 512, CFLOW_NORMAL - }, - { "mfcr", - EXECUTE_GENERIC_ARITH(nop, RD, CR, NONE, NONE, OE_BIT_0, RC_BIT_0), - PPC_I(MFCR), - X_form, 31, 19, CFLOW_NORMAL - }, - { "mffs", - EXECUTE_1(mffs, RC_BIT_G), - PPC_I(MFFS), - X_form, 63, 583, CFLOW_NORMAL - }, - { "mfmsr", - EXECUTE_0(mfmsr), - PPC_I(MFMSR), - X_form, 31, 83, CFLOW_NORMAL - }, - { "mfspr", - EXECUTE_1(mfspr, operand_SPR), - PPC_I(MFSPR), - XFX_form, 31, 339, CFLOW_NORMAL - }, - { "mftb", - EXECUTE_1(mftbr, operand_TBR), - PPC_I(MFTB), - XFX_form, 31, 371, CFLOW_NORMAL - }, - { "mfvscr", - EXECUTE_0(mfvscr), - PPC_I(MFVSCR), - VX_form, 4, 1540, CFLOW_NORMAL - }, - { "mtcrf", - EXECUTE_0(mtcrf), - PPC_I(MTCRF), - XFX_form, 31, 144, CFLOW_NORMAL - }, - { "mtfsb0", - EXECUTE_2(mtfsb, immediate_value<0>, RC_BIT_G), - PPC_I(MTFSB0), - X_form, 63, 70, CFLOW_NORMAL - }, - { "mtfsb1", - EXECUTE_2(mtfsb, immediate_value<1>, RC_BIT_G), - PPC_I(MTFSB1), - X_form, 63, 38, CFLOW_NORMAL - }, - { "mtfsf", - EXECUTE_3(mtfsf, operand_FM, operand_fp_dw_RB, RC_BIT_G), - PPC_I(MTFSF), - XFL_form, 63, 711, CFLOW_NORMAL - }, - { "mtfsfi", - EXECUTE_2(mtfsfi, operand_IMM, RC_BIT_G), - PPC_I(MTFSFI), - X_form, 63, 134, CFLOW_NORMAL - }, - { "mtspr", - EXECUTE_1(mtspr, operand_SPR), - PPC_I(MTSPR), - XFX_form, 31, 467, CFLOW_NORMAL - }, - { "mtvscr", - EXECUTE_0(mtvscr), - PPC_I(MTVSCR), - VX_form, 4, 1604, CFLOW_NORMAL - }, - { "mulhw", - EXECUTE_4(multiply, true, true, OE_BIT_0, RC_BIT_G), - PPC_I(MULHW), - XO_form, 31, 75, CFLOW_NORMAL - }, - { "mulhwu", - EXECUTE_4(multiply, true, false, OE_BIT_0, RC_BIT_G), - PPC_I(MULHWU), - XO_form, 31, 11, CFLOW_NORMAL - }, - { "mulli", - EXECUTE_GENERIC_ARITH(smul, RD, RA, SIMM, NONE, OE_BIT_0, RC_BIT_0), - PPC_I(MULLI), - D_form, 7, 0, CFLOW_NORMAL - }, - { "mullw", - EXECUTE_4(multiply, false, true, OE_BIT_G, RC_BIT_G), - PPC_I(MULLW), - XO_form, 31, 235, CFLOW_NORMAL - }, - { "nand", - EXECUTE_GENERIC_ARITH(nand, RA, RS, RB, NONE, OE_BIT_0, RC_BIT_G), - PPC_I(NAND), - X_form, 31, 476, CFLOW_NORMAL - }, - { "neg", - EXECUTE_GENERIC_ARITH(neg, RD, RA, NONE, NONE, OE_BIT_G, RC_BIT_G), - PPC_I(NEG), - XO_form, 31, 104, CFLOW_NORMAL - }, - { "nor", - EXECUTE_GENERIC_ARITH(nor, RA, RS, RB, NONE, OE_BIT_0, RC_BIT_G), - PPC_I(NOR), - XO_form, 31, 124, CFLOW_NORMAL - }, - { "or", - EXECUTE_GENERIC_ARITH(or, RA, RS, RB, NONE, OE_BIT_0, RC_BIT_G), - PPC_I(OR), - XO_form, 31, 444, CFLOW_NORMAL - }, - { "orc", - EXECUTE_GENERIC_ARITH(orc, RA, RS, RB, NONE, OE_BIT_0, RC_BIT_G), - PPC_I(ORC), - XO_form, 31, 412, CFLOW_NORMAL - }, - { "ori", - EXECUTE_GENERIC_ARITH(or, RA, RS, UIMM, NONE, OE_BIT_0, RC_BIT_0), - PPC_I(ORI), - D_form, 24, 0, CFLOW_NORMAL - }, - { "oris", - EXECUTE_GENERIC_ARITH(or, RA, RS, UIMM_shifted, NONE, OE_BIT_0, RC_BIT_0), - PPC_I(ORIS), - D_form, 25, 0, CFLOW_NORMAL - }, - { "rlwimi", - EXECUTE_3(rlwimi, operand_SH, operand_MASK, RC_BIT_G), - PPC_I(RLWIMI), - M_form, 20, 0, CFLOW_NORMAL - }, - { "rlwinm", - EXECUTE_GENERIC_ARITH(ppc_rlwinm, RA, RS, SH, MASK, OE_BIT_0, RC_BIT_G), - PPC_I(RLWINM), - M_form, 21, 0, CFLOW_NORMAL - }, - { "rlwnm", - EXECUTE_GENERIC_ARITH(ppc_rlwnm, RA, RS, RB, MASK, OE_BIT_0, RC_BIT_G), - PPC_I(RLWNM), - M_form, 23, 0, CFLOW_NORMAL - }, - { "sc", - EXECUTE_0(syscall), - PPC_I(SC), - SC_form, 17, 0, CFLOW_NORMAL - }, - { "slw", - EXECUTE_SHIFT(shll, RA, RS, RB, andi<0x3f>, CA_BIT_0, RC_BIT_G), - PPC_I(SLW), - X_form, 31, 24, CFLOW_NORMAL - }, - { "sraw", - EXECUTE_SHIFT(shra, RA, RS, RB, andi<0x3f>, CA_BIT_1, RC_BIT_G), - PPC_I(SRAW), - X_form, 31, 792, CFLOW_NORMAL - }, - { "srawi", - EXECUTE_SHIFT(shra, RA, RS, SH, andi<0x1f>, CA_BIT_1, RC_BIT_G), - PPC_I(SRAWI), - X_form, 31, 824, CFLOW_NORMAL - }, - { "srw", - EXECUTE_SHIFT(shrl, RA, RS, RB, andi<0x3f>, CA_BIT_0, RC_BIT_G), - PPC_I(SRW), - X_form, 31, 536, CFLOW_NORMAL - }, - { "stb", - EXECUTE_LOADSTORE(nop, RA_or_0, D, false, 1, false, false), - PPC_I(STB), - D_form, 38, 0, CFLOW_NORMAL - }, - { "stbu", - EXECUTE_LOADSTORE(nop, RA, D, false, 1, true, false), - PPC_I(STBU), - D_form, 39, 0, CFLOW_NORMAL - }, - { "stbux", - EXECUTE_LOADSTORE(nop, RA, RB, false, 1, true, false), - PPC_I(STBUX), - X_form, 31, 247, CFLOW_NORMAL - }, - { "stbx", - EXECUTE_LOADSTORE(nop, RA_or_0, RB, false, 1, false, false), - PPC_I(STBX), - X_form, 31, 215, CFLOW_NORMAL - }, - { "stfd", - EXECUTE_FP_LOADSTORE(RA_or_0, D, false, true, false), - PPC_I(STFD), - D_form, 54, 0, CFLOW_NORMAL - }, - { "stfdu", - EXECUTE_FP_LOADSTORE(RA, D, false, true, true), - PPC_I(STFDU), - D_form, 55, 0, CFLOW_NORMAL - }, - { "stfdux", - EXECUTE_FP_LOADSTORE(RA, RB, false, true, true), - PPC_I(STFDUX), - X_form, 31, 759, CFLOW_NORMAL - }, - { "stfdx", - EXECUTE_FP_LOADSTORE(RA_or_0, RB, false, true, false), - PPC_I(STFDX), - X_form, 31, 727, CFLOW_NORMAL - }, - { "stfs", - EXECUTE_FP_LOADSTORE(RA_or_0, D, false, false, false), - PPC_I(STFS), - D_form, 52, 0, CFLOW_NORMAL - }, - { "stfsu", - EXECUTE_FP_LOADSTORE(RA, D, false, false, true), - PPC_I(STFSU), - D_form, 53, 0, CFLOW_NORMAL - }, - { "stfsux", - EXECUTE_FP_LOADSTORE(RA, RB, false, false, true), - PPC_I(STFSUX), - X_form, 31, 695, CFLOW_NORMAL - }, - { "stfsx", - EXECUTE_FP_LOADSTORE(RA_or_0, RB, false, false, false), - PPC_I(STFSX), - X_form, 31, 663, CFLOW_NORMAL - }, - { "sth", - EXECUTE_LOADSTORE(nop, RA_or_0, D, false, 2, false, false), - PPC_I(STH), - D_form, 44, 0, CFLOW_NORMAL - }, - { "sthbrx", - EXECUTE_LOADSTORE(nop, RA_or_0, RB, false, 2, false, true), - PPC_I(STHBRX), - X_form, 31, 918, CFLOW_NORMAL - }, - { "sthu", - EXECUTE_LOADSTORE(nop, RA, D, false, 2, true, false), - PPC_I(STHU), - D_form, 45, 0, CFLOW_NORMAL - }, - { "sthux", - EXECUTE_LOADSTORE(nop, RA, RB, false, 2, true, false), - PPC_I(STHUX), - X_form, 31, 439, CFLOW_NORMAL - }, - { "sthx", - EXECUTE_LOADSTORE(nop, RA_or_0, RB, false, 2, false, false), - PPC_I(STHX), - X_form, 31, 407, CFLOW_NORMAL - }, - { "stmw", - EXECUTE_LOADSTORE_MULTIPLE(RA_or_0, D, false), - PPC_I(STMW), - D_form, 47, 0, CFLOW_NORMAL - }, - { "stswi", - EXECUTE_STORE_STRING(RA_or_0, true, NB), - PPC_I(STSWI), - X_form, 31, 725, CFLOW_NORMAL - }, - { "stswx", - EXECUTE_STORE_STRING(RA_or_0, false, XER_COUNT), - PPC_I(STSWX), - X_form, 31, 661, CFLOW_NORMAL - }, - { "stvebx", - EXECUTE_VECTOR_LOADSTORE(store, V16QIm, RA_or_0, RB), - PPC_I(STVEBX), - X_form, 31, 135, CFLOW_NORMAL - }, - { "stvehx", - EXECUTE_VECTOR_LOADSTORE(store, V8HIm, RA_or_0, RB), - PPC_I(STVEHX), - X_form, 31, 167, CFLOW_NORMAL - }, - { "stvewx", - EXECUTE_VECTOR_LOADSTORE(store, V4SI, RA_or_0, RB), - PPC_I(STVEWX), - X_form, 31, 199, CFLOW_NORMAL - }, - { "stvx", - EXECUTE_VECTOR_LOADSTORE(store, V2DI, RA_or_0, RB), - PPC_I(STVX), - X_form, 31, 231, CFLOW_NORMAL - }, - { "stvxl", - EXECUTE_VECTOR_LOADSTORE(store, V2DI, RA_or_0, RB), - PPC_I(STVXL), - X_form, 31, 487, CFLOW_NORMAL - }, - { "stw", - EXECUTE_LOADSTORE(nop, RA_or_0, D, false, 4, false, false), - PPC_I(STW), - D_form, 36, 0, CFLOW_NORMAL - }, - { "stwbrx", - EXECUTE_LOADSTORE(nop, RA_or_0, RB, false, 4, false, true), - PPC_I(STWBRX), - X_form, 31, 662, CFLOW_NORMAL - }, - { "stwcx.", - EXECUTE_1(stwcx, operand_RA_or_0), - PPC_I(STWCX), - X_form, 31, 150, CFLOW_NORMAL - }, - { "stwu", - EXECUTE_LOADSTORE(nop, RA, D, false, 4, true, false), - PPC_I(STWU), - D_form, 37, 0, CFLOW_NORMAL - }, - { "stwux", - EXECUTE_LOADSTORE(nop, RA, RB, false, 4, true, false), - PPC_I(STWUX), - X_form, 31, 183, CFLOW_NORMAL - }, - { "stwx", - EXECUTE_LOADSTORE(nop, RA_or_0, RB, false, 4, false, false), - PPC_I(STWX), - X_form, 31, 151, CFLOW_NORMAL - }, - { "subf", - EXECUTE_ADDITION(RA_compl, RB, ONE, CA_BIT_0, OE_BIT_G, RC_BIT_G), - PPC_I(SUBF), - XO_form, 31, 40, CFLOW_NORMAL - }, - { "subfc", - EXECUTE_ADDITION(RA_compl, RB, ONE, CA_BIT_1, OE_BIT_G, RC_BIT_G), - PPC_I(SUBFC), - XO_form, 31, 8, CFLOW_NORMAL - }, - { "subfe", - EXECUTE_ADDITION(RA_compl, RB, XER_CA, CA_BIT_1, OE_BIT_G, RC_BIT_G), - PPC_I(SUBFE), - XO_form, 31, 136, CFLOW_NORMAL - }, - { "subfic", - EXECUTE_ADDITION(RA_compl, SIMM, ONE, CA_BIT_1, OE_BIT_0, RC_BIT_0), - PPC_I(SUBFIC), - D_form, 8, 0, CFLOW_NORMAL - }, - { "subfme", - EXECUTE_ADDITION(RA_compl, XER_CA, MINUS_ONE, CA_BIT_1, OE_BIT_G, RC_BIT_G), - PPC_I(SUBFME), - XO_form, 31, 232, CFLOW_NORMAL - }, - { "subfze", - EXECUTE_ADDITION(RA_compl, XER_CA, ZERO, CA_BIT_1, OE_BIT_G, RC_BIT_G), - PPC_I(SUBFZE), - XO_form, 31, 200, CFLOW_NORMAL - }, - { "sync", - EXECUTE_0(nop), - PPC_I(SYNC), - X_form, 31, 598, CFLOW_NORMAL - }, - { "xor", - EXECUTE_GENERIC_ARITH(xor, RA, RS, RB, NONE, OE_BIT_0, RC_BIT_G), - PPC_I(XOR), - X_form, 31, 316, CFLOW_NORMAL - }, - { "xori", - EXECUTE_GENERIC_ARITH(xor, RA, RS, UIMM, NONE, OE_BIT_0, RC_BIT_0), - PPC_I(XORI), - D_form, 26, 0, CFLOW_NORMAL - }, - { "xoris", - EXECUTE_GENERIC_ARITH(xor, RA, RS, UIMM_shifted, NONE, OE_BIT_0, RC_BIT_0), - PPC_I(XORIS), - D_form, 27, 0, CFLOW_NORMAL - }, - { "vaddcuw", - EXECUTE_VECTOR_ARITH(addcuw, V4SI, V4SI, V4SI, NONE), - PPC_I(VADDCUW), - VX_form, 4, 384, CFLOW_NORMAL - }, - { "vaddfp", - EXECUTE_VECTOR_ARITH(fadds, V4SF, V4SF, V4SF, NONE), - PPC_I(VADDFP), - VX_form, 4, 10, CFLOW_NORMAL - }, - { "vaddsbs", - EXECUTE_VECTOR_ARITH(add, V16QI_SAT, V16QI_SAT, V16QI_SAT, NONE), - PPC_I(VADDSBS), - VX_form, 4, 768, CFLOW_NORMAL - }, - { "vaddshs", - EXECUTE_VECTOR_ARITH(add, V8HI_SAT, V8HI_SAT, V8HI_SAT, NONE), - PPC_I(VADDSHS), - VX_form, 4, 832, CFLOW_NORMAL - }, - { "vaddsws", - EXECUTE_VECTOR_ARITH(add_64, V4SI_SAT, V4SI_SAT, V4SI_SAT, NONE), - PPC_I(VADDSWS), - VX_form, 4, 896, CFLOW_NORMAL - }, - { "vaddubm", - EXECUTE_VECTOR_ARITH(add, V16QI, V16QI, V16QI, NONE), - PPC_I(VADDUBM), - VX_form, 4, 0, CFLOW_NORMAL - }, - { "vaddubs", - EXECUTE_VECTOR_ARITH(add, V16QI_SAT, V16QI_SAT, V16QI_SAT, NONE), - PPC_I(VADDUBS), - VX_form, 4, 512, CFLOW_NORMAL - }, - { "vadduhm", - EXECUTE_VECTOR_ARITH(add, V8HI, V8HI, V8HI, NONE), - PPC_I(VADDUHM), - VX_form, 4, 64, CFLOW_NORMAL - }, - { "vadduhs", - EXECUTE_VECTOR_ARITH(add, V8HI_SAT, V8HI_SAT, V8HI_SAT, NONE), - PPC_I(VADDUHS), - VX_form, 4, 576, CFLOW_NORMAL - }, - { "vadduwm", - EXECUTE_VECTOR_ARITH(add, V4SI, V4SI, V4SI, NONE), - PPC_I(VADDUWM), - VX_form, 4, 128, CFLOW_NORMAL - }, - { "vadduws", - EXECUTE_VECTOR_ARITH(add_64, V4SI_SAT, V4SI_SAT, V4SI_SAT, NONE), - PPC_I(VADDUWS), - VX_form, 4, 640, CFLOW_NORMAL - }, - { "vand", - EXECUTE_VECTOR_ARITH(and_64, V2DI, V2DI, V2DI, NONE), - PPC_I(VAND), - VX_form, 4, 1028, CFLOW_NORMAL - }, - { "vandc", - EXECUTE_VECTOR_ARITH(andc_64, V2DI, V2DI, V2DI, NONE), - PPC_I(VANDC), - VX_form, 4, 1092, CFLOW_NORMAL - }, - { "vavgsb", - EXECUTE_VECTOR_ARITH(avgsb, V16QI, V16QI, V16QI, NONE), - PPC_I(VAVGSB), - VX_form, 4, 1282, CFLOW_NORMAL - }, - { "vavgsh", - EXECUTE_VECTOR_ARITH(avgsh, V8HI, V8HI, V8HI, NONE), - PPC_I(VAVGSH), - VX_form, 4, 1346, CFLOW_NORMAL - }, - { "vavgsw", - EXECUTE_VECTOR_ARITH(avgsw, V4SI, V4SI, V4SI, NONE), - PPC_I(VAVGSW), - VX_form, 4, 1410, CFLOW_NORMAL - }, - { "vavgub", - EXECUTE_VECTOR_ARITH(avgub, V16QI, V16QI, V16QI, NONE), - PPC_I(VAVGUB), - VX_form, 4, 1026, CFLOW_NORMAL - }, - { "vavguh", - EXECUTE_VECTOR_ARITH(avguh, V8HI, V8HI, V8HI, NONE), - PPC_I(VAVGUH), - VX_form, 4, 1090, CFLOW_NORMAL - }, - { "vavguw", - EXECUTE_VECTOR_ARITH(avguw, V4SI, V4SI, V4SI, NONE), - PPC_I(VAVGUW), - VX_form, 4, 1154, CFLOW_NORMAL - }, - { "vcfsx", - EXECUTE_VECTOR_ARITH(cvt_si2fp, V4SF, UIMM, V4SIs, NONE), - PPC_I(VCFSX), - VX_form, 4, 842, CFLOW_NORMAL - }, - { "vcfux", - EXECUTE_VECTOR_ARITH(cvt_si2fp, V4SF, UIMM, V4SI, NONE), - PPC_I(VCFUX), - VX_form, 4, 778, CFLOW_NORMAL - }, - { "vcmpbfp", - EXECUTE_VECTOR_COMPARE(cmpbfp, V4SI, V4SF, V4SF, 0), - PPC_I(VCMPBFP), - VXR_form, 4, 966, CFLOW_NORMAL - }, - { "vcmpeqfp", - EXECUTE_VECTOR_COMPARE(cmp_eq, V4SI, V4SF, V4SF, 1), - PPC_I(VCMPEQFP), - VXR_form, 4, 198, CFLOW_NORMAL - }, - { "vcmpequb", - EXECUTE_VECTOR_COMPARE(cmp_eq, V16QI, V16QI, V16QI, 1), - PPC_I(VCMPEQUB), - VXR_form, 4, 6, CFLOW_NORMAL - }, - { "vcmpequh", - EXECUTE_VECTOR_COMPARE(cmp_eq, V8HI, V8HI, V8HI, 1), - PPC_I(VCMPEQUH), - VXR_form, 4, 70, CFLOW_NORMAL - }, - { "vcmpequw", - EXECUTE_VECTOR_COMPARE(cmp_eq, V4SI, V4SI, V4SI, 1), - PPC_I(VCMPEQUW), - VXR_form, 4, 134, CFLOW_NORMAL - }, - { "vcmpgefp", - EXECUTE_VECTOR_COMPARE(cmp_ge, V4SI, V4SF, V4SF, 1), - PPC_I(VCMPGEFP), - VXR_form, 4, 454, CFLOW_NORMAL - }, - { "vcmpgtfp", - EXECUTE_VECTOR_COMPARE(cmp_gt, V4SI, V4SF, V4SF, 1), - PPC_I(VCMPGTFP), - VXR_form, 4, 710, CFLOW_NORMAL - }, - { "vcmpgtsb", - EXECUTE_VECTOR_COMPARE(cmp_gt, V16QI, V16QIs, V16QIs, 1), - PPC_I(VCMPGTSB), - VXR_form, 4, 774, CFLOW_NORMAL - }, - { "vcmpgtsh", - EXECUTE_VECTOR_COMPARE(cmp_gt, V8HI, V8HIs, V8HIs, 1), - PPC_I(VCMPGTSH), - VXR_form, 4, 838, CFLOW_NORMAL - }, - { "vcmpgtsw", - EXECUTE_VECTOR_COMPARE(cmp_gt, V4SI, V4SIs, V4SIs, 1), - PPC_I(VCMPGTSW), - VXR_form, 4, 902, CFLOW_NORMAL - }, - { "vcmpgtub", - EXECUTE_VECTOR_COMPARE(cmp_gt, V16QI, V16QI, V16QI, 1), - PPC_I(VCMPGTUB), - VXR_form, 4, 518, CFLOW_NORMAL - }, - { "vcmpgtuh", - EXECUTE_VECTOR_COMPARE(cmp_gt, V8HI, V8HI, V8HI, 1), - PPC_I(VCMPGTUH), - VXR_form, 4, 582, CFLOW_NORMAL - }, - { "vcmpgtuw", - EXECUTE_VECTOR_COMPARE(cmp_gt, V4SI, V4SI, V4SI, 1), - PPC_I(VCMPGTUW), - VXR_form, 4, 646, CFLOW_NORMAL - }, - { "vctsxs", - EXECUTE_VECTOR_ARITH(cvt_fp2si, V4SI_SAT, UIMM, V4SF, NONE), - PPC_I(VCTSXS), - VX_form, 4, 970, CFLOW_NORMAL - }, - { "vctuxs", - EXECUTE_VECTOR_ARITH(cvt_fp2si, V4SI_SAT, UIMM, V4SF, NONE), - PPC_I(VCTUXS), - VX_form, 4, 906, CFLOW_NORMAL - }, - { "vexptefp", - EXECUTE_VECTOR_ARITH(exp2, V4SF, NONE, V4SF, NONE), - PPC_I(VEXPTEFP), - VX_form, 4, 394, CFLOW_NORMAL - }, - { "vlogefp", - EXECUTE_VECTOR_ARITH(log2, V4SF, NONE, V4SF, NONE), - PPC_I(VLOGEFP), - VX_form, 4, 458, CFLOW_NORMAL - }, - { "vmaddfp", - EXECUTE_VECTOR_ARITH(vmaddfp, V4SF, V4SF, V4SF, V4SF), - PPC_I(VMADDFP), - VA_form, 4, 46, CFLOW_NORMAL - }, - { "vmaxfp", - EXECUTE_VECTOR_ARITH(max, V4SF, V4SF, V4SF, NONE), - PPC_I(VMAXFP), - VX_form, 4, 1034, CFLOW_NORMAL - }, - { "vmaxsb", - EXECUTE_VECTOR_ARITH(max, V16QI, V16QI, V16QI, NONE), - PPC_I(VMAXSB), - VX_form, 4, 258, CFLOW_NORMAL - }, - { "vmaxsh", - EXECUTE_VECTOR_ARITH(max, V8HI, V8HI, V8HI, NONE), - PPC_I(VMAXSH), - VX_form, 4, 322, CFLOW_NORMAL - }, - { "vmaxsw", - EXECUTE_VECTOR_ARITH(max, V4SI, V4SI, V4SI, NONE), - PPC_I(VMAXSW), - VX_form, 4, 386, CFLOW_NORMAL - }, - { "vmaxub", - EXECUTE_VECTOR_ARITH(max, V16QI, V16QI, V16QI, NONE), - PPC_I(VMAXUB), - VX_form, 4, 2, CFLOW_NORMAL - }, - { "vmaxuh", - EXECUTE_VECTOR_ARITH(max, V8HI, V8HI, V8HI, NONE), - PPC_I(VMAXUH), - VX_form, 4, 66, CFLOW_NORMAL - }, - { "vmaxuw", - EXECUTE_VECTOR_ARITH(max, V4SI, V4SI, V4SI, NONE), - PPC_I(VMAXUW), - VX_form, 4, 130, CFLOW_NORMAL - }, - { "vmhaddshs", - EXECUTE_VECTOR_ARITH(mhraddsh<0>, V8HI_SAT, V8HI_SAT, V8HI_SAT, V8HI_SAT), - PPC_I(VMHADDSHS), - VA_form, 4, 32, CFLOW_NORMAL - }, - { "vmhraddshs", - EXECUTE_VECTOR_ARITH(mhraddsh<0x4000>, V8HI_SAT, V8HI_SAT, V8HI_SAT, V8HI_SAT), - PPC_I(VMHRADDSHS), - VA_form, 4, 33, CFLOW_NORMAL - }, - { "vminfp", - EXECUTE_VECTOR_ARITH(min, V4SF, V4SF, V4SF, NONE), - PPC_I(VMINFP), - VX_form, 4, 1098, CFLOW_NORMAL - }, - { "vminsb", - EXECUTE_VECTOR_ARITH(min, V16QI, V16QI, V16QI, NONE), - PPC_I(VMINSB), - VX_form, 4, 770, CFLOW_NORMAL - }, - { "vminsh", - EXECUTE_VECTOR_ARITH(min, V8HI, V8HI, V8HI, NONE), - PPC_I(VMINSH), - VX_form, 4, 834, CFLOW_NORMAL - }, - { "vminsw", - EXECUTE_VECTOR_ARITH(min, V4SI, V4SI, V4SI, NONE), - PPC_I(VMINSW), - VX_form, 4, 898, CFLOW_NORMAL - }, - { "vminub", - EXECUTE_VECTOR_ARITH(min, V16QI, V16QI, V16QI, NONE), - PPC_I(VMINUB), - VX_form, 4, 514, CFLOW_NORMAL - }, - { "vminuh", - EXECUTE_VECTOR_ARITH(min, V8HI, V8HI, V8HI, NONE), - PPC_I(VMINUH), - VX_form, 4, 578, CFLOW_NORMAL - }, - { "vminuw", - EXECUTE_VECTOR_ARITH(min, V4SI, V4SI, V4SI, NONE), - PPC_I(VMINUW), - VX_form, 4, 642, CFLOW_NORMAL - }, - { "vmladduhm", - EXECUTE_VECTOR_ARITH(mladduh, V8HI, V8HI, V8HI, V8HI), - PPC_I(VMLADDUHM), - VA_form, 4, 34, CFLOW_NORMAL - }, - { "vmrghb", - EXECUTE_VECTOR_MERGE(V16QIm, V16QIm, V16QIm, 0), - PPC_I(VMRGHB), - VX_form, 4, 12, CFLOW_NORMAL - }, - { "vmrghh", - EXECUTE_VECTOR_MERGE(V8HIm, V8HIm, V8HIm, 0), - PPC_I(VMRGHH), - VX_form, 4, 76, CFLOW_NORMAL - }, - { "vmrghw", - EXECUTE_VECTOR_MERGE(V4SI, V4SI, V4SI, 0), - PPC_I(VMRGHW), - VX_form, 4, 140, CFLOW_NORMAL - }, - { "vmrglb", - EXECUTE_VECTOR_MERGE(V16QIm, V16QIm, V16QIm, 1), - PPC_I(VMRGLB), - VX_form, 4, 268, CFLOW_NORMAL - }, - { "vmrglh", - EXECUTE_VECTOR_MERGE(V8HIm, V8HIm, V8HIm, 1), - PPC_I(VMRGLH), - VX_form, 4, 332, CFLOW_NORMAL - }, - { "vmrglw", - EXECUTE_VECTOR_MERGE(V4SI, V4SI, V4SI, 1), - PPC_I(VMRGLW), - VX_form, 4, 396, CFLOW_NORMAL - }, - { "vmsummbm", - EXECUTE_VECTOR_ARITH_MIXED(smul, V4SI, V16QI_SAT, V16QI_SAT, V4SI), - PPC_I(VMSUMMBM), - VA_form, 4, 37, CFLOW_NORMAL - }, - { "vmsumshm", - EXECUTE_VECTOR_ARITH_MIXED(smul, V4SI, V8HI_SAT, V8HI_SAT, V4SI), - PPC_I(VMSUMSHM), - VA_form, 4, 40, CFLOW_NORMAL - }, - { "vmsumshs", - EXECUTE_VECTOR_ARITH_MIXED(smul_64, V4SI_SAT, V8HI_SAT, V8HI_SAT, V4SIs), - PPC_I(VMSUMSHS), - VA_form, 4, 41, CFLOW_NORMAL - }, - { "vmsumubm", - EXECUTE_VECTOR_ARITH_MIXED(mul, V4SI, V16QI, V16QI, V4SI), - PPC_I(VMSUMUBM), - VA_form, 4, 36, CFLOW_NORMAL - }, - { "vmsumuhm", - EXECUTE_VECTOR_ARITH_MIXED(mul, V4SI, V8HI, V8HI, V4SI), - PPC_I(VMSUMUHM), - VA_form, 4, 38, CFLOW_NORMAL - }, - { "vmsumuhs", - EXECUTE_VECTOR_ARITH_MIXED(mul, V4SI_SAT, V8HI, V8HI, V4SI), - PPC_I(VMSUMUHS), - VA_form, 4, 39, CFLOW_NORMAL - }, - { "vmulesb", - EXECUTE_VECTOR_ARITH_ODD(0, smul, V8HIm, V16QIm_SAT, V16QIm_SAT, NONE), - PPC_I(VMULESB), - VX_form, 4, 776, CFLOW_NORMAL - }, - { "vmulesh", - EXECUTE_VECTOR_ARITH_ODD(0, smul, V4SI, V8HIm_SAT, V8HIm_SAT, NONE), - PPC_I(VMULESH), - VX_form, 4, 840, CFLOW_NORMAL - }, - { "vmuleub", - EXECUTE_VECTOR_ARITH_ODD(0, mul, V8HIm, V16QIm, V16QIm, NONE), - PPC_I(VMULEUB), - VX_form, 4, 520, CFLOW_NORMAL - }, - { "vmuleuh", - EXECUTE_VECTOR_ARITH_ODD(0, mul, V4SI, V8HIm, V8HIm, NONE), - PPC_I(VMULEUH), - VX_form, 4, 584, CFLOW_NORMAL - }, - { "vmulosb", - EXECUTE_VECTOR_ARITH_ODD(1, smul, V8HIm, V16QIm_SAT, V16QIm_SAT, NONE), - PPC_I(VMULOSB), - VX_form, 4, 264, CFLOW_NORMAL - }, - { "vmulosh", - EXECUTE_VECTOR_ARITH_ODD(1, smul, V4SI, V8HIm_SAT, V8HIm_SAT, NONE), - PPC_I(VMULOSH), - VX_form, 4, 328, CFLOW_NORMAL - }, - { "vmuloub", - EXECUTE_VECTOR_ARITH_ODD(1, mul, V8HIm, V16QIm, V16QIm, NONE), - PPC_I(VMULOUB), - VX_form, 4, 8, CFLOW_NORMAL - }, - { "vmulouh", - EXECUTE_VECTOR_ARITH_ODD(1, mul, V4SI, V8HIm, V8HIm, NONE), - PPC_I(VMULOUH), - VX_form, 4, 72, CFLOW_NORMAL - }, - { "vnmsubfp", - EXECUTE_VECTOR_ARITH(vnmsubfp, V4SF, V4SF, V4SF, V4SF), - PPC_I(VNMSUBFP), - VA_form, 4, 47, CFLOW_NORMAL - }, - { "vnor", - EXECUTE_VECTOR_ARITH(nor_64, V2DI, V2DI, V2DI, NONE), - PPC_I(VNOR), - VX_form, 4, 1284, CFLOW_NORMAL - }, - { "vor", - EXECUTE_VECTOR_ARITH(or_64, V2DI, V2DI, V2DI, NONE), - PPC_I(VOR), - VX_form, 4, 1156, CFLOW_NORMAL - }, - { "vperm", - EXECUTE_0(vector_permute), - PPC_I(VPERM), - VA_form, 4, 43, CFLOW_NORMAL - }, - { "vpkpx", - EXECUTE_0(vector_pack_pixel), - PPC_I(VPKPX), - VX_form, 4, 782, CFLOW_NORMAL - }, - { "vpkshss", - EXECUTE_VECTOR_PACK(V16QIm_SAT, V8HIm, V8HIm), - PPC_I(VPKSHSS), - VX_form, 4, 398, CFLOW_NORMAL - }, - { "vpkshus", - EXECUTE_VECTOR_PACK(V16QIm_SAT, V8HIm, V8HIm), - PPC_I(VPKSHUS), - VX_form, 4, 270, CFLOW_NORMAL - }, - { "vpkswss", - EXECUTE_VECTOR_PACK(V8HIm_SAT, V4SI, V4SI), - PPC_I(VPKSWSS), - VX_form, 4, 462, CFLOW_NORMAL - }, - { "vpkswus", - EXECUTE_VECTOR_PACK(V8HIm_SAT, V4SI, V4SI), - PPC_I(VPKSWUS), - VX_form, 4, 334, CFLOW_NORMAL - }, - { "vpkuhum", - EXECUTE_VECTOR_PACK(V16QIm, V8HIm, V8HIm), - PPC_I(VPKUHUM), - VX_form, 4, 14, CFLOW_NORMAL - }, - { "vpkuhus", - EXECUTE_VECTOR_PACK(V16QIm_USAT, V8HIm, V8HIm), - PPC_I(VPKUHUS), - VX_form, 4, 142, CFLOW_NORMAL - }, - { "vpkuwum", - EXECUTE_VECTOR_PACK(V8HIm, V4SI, V4SI), - PPC_I(VPKUWUM), - VX_form, 4, 78, CFLOW_NORMAL - }, - { "vpkuwus", - EXECUTE_VECTOR_PACK(V8HIm_USAT, V4SI, V4SI), - PPC_I(VPKUWUS), - VX_form, 4, 206, CFLOW_NORMAL - }, - { "vrefp", - EXECUTE_VECTOR_ARITH(fres, V4SF, NONE, V4SF, NONE), - PPC_I(VREFP), - VX_form, 4, 266, CFLOW_NORMAL - }, - { "vrfim", - EXECUTE_VECTOR_ARITH(frsim, V4SF, NONE, V4SF, NONE), - PPC_I(VRFIM), - VX_form, 4, 714, CFLOW_NORMAL - }, - { "vrfin", - EXECUTE_VECTOR_ARITH(frsin, V4SF, NONE, V4SF, NONE), - PPC_I(VRFIN), - VX_form, 4, 522, CFLOW_NORMAL - }, - { "vrfip", - EXECUTE_VECTOR_ARITH(frsip, V4SF, NONE, V4SF, NONE), - PPC_I(VRFIP), - VX_form, 4, 650, CFLOW_NORMAL - }, - { "vrfiz", - EXECUTE_VECTOR_ARITH(frsiz, V4SF, NONE, V4SF, NONE), - PPC_I(VRFIZ), - VX_form, 4, 586, CFLOW_NORMAL - }, - { "vrlb", - EXECUTE_VECTOR_ARITH(vrl, V16QI, V16QI, V16QI, NONE), - PPC_I(VRLB), - VX_form, 4, 4, CFLOW_NORMAL - }, - { "vrlh", - EXECUTE_VECTOR_ARITH(vrl, V8HI, V8HI, V8HI, NONE), - PPC_I(VRLH), - VX_form, 4, 68, CFLOW_NORMAL - }, - { "vrlw", - EXECUTE_VECTOR_ARITH(vrl, V4SI, V4SI, V4SI, NONE), - PPC_I(VRLW), - VX_form, 4, 132, CFLOW_NORMAL - }, - { "vrsqrtefp", - EXECUTE_VECTOR_ARITH(frsqrt, V4SF, NONE, V4SF, NONE), - PPC_I(VRSQRTEFP), - VX_form, 4, 330, CFLOW_NORMAL - }, - { "vsel", - EXECUTE_VECTOR_ARITH(vsel, V4SI, V4SI, V4SI, V4SI), - PPC_I(VSEL), - VA_form, 4, 42, CFLOW_NORMAL - }, - { "vsl", - EXECUTE_1(vector_shift, -1), - PPC_I(VSL), - VX_form, 4, 452, CFLOW_NORMAL - }, - { "vslb", - EXECUTE_VECTOR_ARITH(vsl, V16QI, V16QI, V16QI, NONE), - PPC_I(VSLB), - VX_form, 4, 260, CFLOW_NORMAL - }, - { "vsldoi", - EXECUTE_VECTOR_SHIFT_OCTET(-1, V16QIm, V16QIm, V16QIm, SHB), - PPC_I(VSLDOI), - VA_form, 4, 44, CFLOW_NORMAL - }, - { "vslh", - EXECUTE_VECTOR_ARITH(vsl, V8HI, V8HI, V8HI, NONE), - PPC_I(VSLH), - VX_form, 4, 324, CFLOW_NORMAL - }, - { "vslo", - EXECUTE_VECTOR_SHIFT_OCTET(-1, V16QIm, V16QIm, NONE, SHBO), - PPC_I(VSLO), - VX_form, 4, 1036, CFLOW_NORMAL - }, - { "vslw", - EXECUTE_VECTOR_ARITH(vsl, V4SI, V4SI, V4SI, NONE), - PPC_I(VSLW), - VX_form, 4, 388, CFLOW_NORMAL - }, - { "vspltb", - EXECUTE_VECTOR_SPLAT(nop, V16QI, V16QIm, false), - PPC_I(VSPLTB), - VX_form, 4, 524, CFLOW_NORMAL - }, - { "vsplth", - EXECUTE_VECTOR_SPLAT(nop, V8HI, V8HIm, false), - PPC_I(VSPLTH), - VX_form, 4, 588, CFLOW_NORMAL - }, - { "vspltisb", - EXECUTE_VECTOR_SPLAT(sign_extend_5_32, V16QI, UIMM, true), - PPC_I(VSPLTISB), - VX_form, 4, 780, CFLOW_NORMAL - }, - { "vspltish", - EXECUTE_VECTOR_SPLAT(sign_extend_5_32, V8HI, UIMM, true), - PPC_I(VSPLTISH), - VX_form, 4, 844, CFLOW_NORMAL - }, - { "vspltisw", - EXECUTE_VECTOR_SPLAT(sign_extend_5_32, V4SI, UIMM, true), - PPC_I(VSPLTISW), - VX_form, 4, 908, CFLOW_NORMAL - }, - { "vspltw", - EXECUTE_VECTOR_SPLAT(nop, V4SI, V4SI, false), - PPC_I(VSPLTW), - VX_form, 4, 652, CFLOW_NORMAL - }, - { "vsr", - EXECUTE_1(vector_shift, +1), - PPC_I(VSR), - VX_form, 4, 708, CFLOW_NORMAL - }, - { "vsrab", - EXECUTE_VECTOR_ARITH(vsr, V16QI, V16QIs, V16QI, NONE), - PPC_I(VSRAB), - VX_form, 4, 772, CFLOW_NORMAL - }, - { "vsrah", - EXECUTE_VECTOR_ARITH(vsr, V8HI, V8HIs, V8HI, NONE), - PPC_I(VSRAH), - VX_form, 4, 836, CFLOW_NORMAL - }, - { "vsraw", - EXECUTE_VECTOR_ARITH(vsr, V4SI, V4SIs, V4SIs, NONE), - PPC_I(VSRAW), - VX_form, 4, 900, CFLOW_NORMAL - }, - { "vsrb", - EXECUTE_VECTOR_ARITH(vsr, V16QI, V16QI, V16QI, NONE), - PPC_I(VSRB), - VX_form, 4, 516, CFLOW_NORMAL - }, - { "vsrh", - EXECUTE_VECTOR_ARITH(vsr, V8HI, V8HI, V8HI, NONE), - PPC_I(VSRH), - VX_form, 4, 580, CFLOW_NORMAL - }, - { "vsro", - EXECUTE_VECTOR_SHIFT_OCTET(+1, V16QIm, V16QIm, NONE, SHBO), - PPC_I(VSRO), - VX_form, 4, 1100, CFLOW_NORMAL - }, - { "vsrw", - EXECUTE_VECTOR_ARITH(vsr, V4SI, V4SI, V4SI, NONE), - PPC_I(VSRW), - VX_form, 4, 644, CFLOW_NORMAL - }, - { "vsubcuw", - EXECUTE_VECTOR_ARITH(subcuw, V4SI, V4SI, V4SI, NONE), - PPC_I(VSUBCUW), - VX_form, 4, 1408, CFLOW_NORMAL - }, - { "vsubfp", - EXECUTE_VECTOR_ARITH(fsubs, V4SF, V4SF, V4SF, NONE), - PPC_I(VSUBFP), - VX_form, 4, 74, CFLOW_NORMAL - }, - { "vsubsbs", - EXECUTE_VECTOR_ARITH(sub, V16QI_SAT, V16QI_SAT, V16QI_SAT, NONE), - PPC_I(VSUBSBS), - VX_form, 4, 1792, CFLOW_NORMAL - }, - { "vsubshs", - EXECUTE_VECTOR_ARITH(sub, V8HI_SAT, V8HI_SAT, V8HI_SAT, NONE), - PPC_I(VSUBSHS), - VX_form, 4, 1856, CFLOW_NORMAL - }, - { "vsubsws", - EXECUTE_VECTOR_ARITH(sub_64, V4SI_SAT, V4SI_SAT, V4SI_SAT, NONE), - PPC_I(VSUBSWS), - VX_form, 4, 1920, CFLOW_NORMAL - }, - { "vsububm", - EXECUTE_VECTOR_ARITH(sub, V16QI, V16QI, V16QI, NONE), - PPC_I(VSUBUBM), - VX_form, 4, 1024, CFLOW_NORMAL - }, - { "vsububs", - EXECUTE_VECTOR_ARITH(sub, V16QI_SAT, V16QI_SAT, V16QI_SAT, NONE), - PPC_I(VSUBUBS), - VX_form, 4, 1536, CFLOW_NORMAL - }, - { "vsubuhm", - EXECUTE_VECTOR_ARITH(sub, V8HI, V8HI, V8HI, NONE), - PPC_I(VSUBUHM), - VX_form, 4, 1088, CFLOW_NORMAL - }, - { "vsubuhs", - EXECUTE_VECTOR_ARITH(sub, V8HI_SAT, V8HI_SAT, V8HI_SAT, NONE), - PPC_I(VSUBUHS), - VX_form, 4, 1600, CFLOW_NORMAL - }, - { "vsubuwm", - EXECUTE_VECTOR_ARITH(sub, V4SI, V4SI, V4SI, NONE), - PPC_I(VSUBUWM), - VX_form, 4, 1152, CFLOW_NORMAL - }, - { "vsubuws", - EXECUTE_VECTOR_ARITH(sub_64, V4SI_SAT, V4SI_SAT, V4SI_SAT, NONE), - PPC_I(VSUBUWS), - VX_form, 4, 1664, CFLOW_NORMAL - }, - { "vsumsws", - EXECUTE_VECTOR_SUM(1, V4SI_SAT, V4SIs, V4SIs), - PPC_I(VSUMSWS), - VX_form, 4, 1928, CFLOW_NORMAL - }, - { "vsum2sws", - EXECUTE_VECTOR_SUM(2, V4SI_SAT, V4SIs, V4SIs), - PPC_I(VSUM2SWS), - VX_form, 4, 1672, CFLOW_NORMAL - }, - { "vsum4sbs", - EXECUTE_VECTOR_SUM(4, V4SI_SAT, V16QIs, V4SIs), - PPC_I(VSUM4SBS), - VX_form, 4, 1800, CFLOW_NORMAL - }, - { "vsum4shs", - EXECUTE_VECTOR_SUM(4, V4SI_SAT, V8HIs, V4SIs), - PPC_I(VSUM4SHS), - VX_form, 4, 1608, CFLOW_NORMAL - }, - { "vsum4ubs", - EXECUTE_VECTOR_SUM(4, V4SI_SAT, V16QI, V4SI), - PPC_I(VSUM4UBS), - VX_form, 4, 1544, CFLOW_NORMAL - }, - { "vupkhpx", - EXECUTE_1(vector_unpack_pixel, 0), - PPC_I(VUPKHPX), - VX_form, 4, 846, CFLOW_NORMAL - }, - { "vupkhsb", - EXECUTE_VECTOR_UNPACK(0, V8HIms, V16QIms), - PPC_I(VUPKHSB), - VX_form, 4, 526, CFLOW_NORMAL - }, - { "vupkhsh", - EXECUTE_VECTOR_UNPACK(0, V4SIs, V8HIms), - PPC_I(VUPKHSH), - VX_form, 4, 590, CFLOW_NORMAL - }, - { "vupklpx", - EXECUTE_1(vector_unpack_pixel, 1), - PPC_I(VUPKLPX), - VX_form, 4, 974, CFLOW_NORMAL - }, - { "vupklsb", - EXECUTE_VECTOR_UNPACK(1, V8HIms, V16QIms), - PPC_I(VUPKLSB), - VX_form, 4, 654, CFLOW_NORMAL - }, - { "vupklsh", - EXECUTE_VECTOR_UNPACK(1, V4SIs, V8HIms), - PPC_I(VUPKLSH), - VX_form, 4, 718, CFLOW_NORMAL - }, - { "vxor", - EXECUTE_VECTOR_ARITH(xor_64, V2DI, V2DI, V2DI, NONE), - PPC_I(VXOR), - VX_form, 4, 1220, CFLOW_NORMAL - } -}; - -void powerpc_cpu::init_decoder() -{ - const int ii_count = sizeof(powerpc_ii_table)/sizeof(powerpc_ii_table[0]); - D(bug("PowerPC decode table has %d entries\n", ii_count)); - assert(ii_count < (1 << (8 * sizeof(ii_index_t)))); - ii_table.reserve(ii_count); - - for (int i = 0; i < ii_count; i++) { - const instr_info_t * ii = &powerpc_ii_table[i]; - init_decoder_entry(ii); - } -} - -void powerpc_cpu::init_decoder_entry(const instr_info_t * ii) -{ - ii_table.push_back(*ii); - const ii_index_t ii_index = ii_table.size() - 1; - - assert((ii->format == INVALID_form && ii_index == 0) || - (ii->format != INVALID_form && ii_index != 0) ); - - switch (ii->format) { - case INVALID_form: - // Initialize all index table - for (int i = 0; i < II_INDEX_TABLE_SIZE; i++) - ii_index_table[i] = ii_index; - break; - - case B_form: - case D_form: - case I_form: - case M_form: - // Primary opcode only - for (int j = 0; j < 2048; j++) - ii_index_table[make_ii_index(ii->opcode, j)] = ii_index; - break; - - case SC_form: - // Primary opcode only, with reserved bits - ii_index_table[make_ii_index(ii->opcode, 2)] = ii_index; - break; - - case X_form: - case XL_form: - case XFX_form: - case XFL_form: - // Extended opcode in bits 21..30 - ii_index_table[make_ii_index(ii->opcode, (ii->xo << 1) )] = ii_index; - ii_index_table[make_ii_index(ii->opcode, (ii->xo << 1) | 1)] = ii_index; - break; - - case XO_form: - // Extended opcode in bits 22..30, with OE bit 21 - ii_index_table[make_ii_index(ii->opcode, (ii->xo << 1) )] = ii_index; - ii_index_table[make_ii_index(ii->opcode, (1 << 10) | (ii->xo << 1) )] = ii_index; - ii_index_table[make_ii_index(ii->opcode, (ii->xo << 1) | 1)] = ii_index; - ii_index_table[make_ii_index(ii->opcode, (1 << 10) | (ii->xo << 1) | 1)] = ii_index; - break; - - case A_form: - // Extended opcode in bits 26..30 - for (int j = 0; j < 32; j++) { - ii_index_table[make_ii_index(ii->opcode, (j << 6) | (ii->xo << 1) )] = ii_index; - ii_index_table[make_ii_index(ii->opcode, (j << 6) | (ii->xo << 1) | 1)] = ii_index; - } - break; - - case VX_form: - // Extended opcode in bits 21..31 - ii_index_table[make_ii_index(ii->opcode, ii->xo)] = ii_index; - break; - - case VXR_form: - // Extended opcode in bits 22..31 - ii_index_table[make_ii_index(ii->opcode, ii->xo)] = ii_index; - ii_index_table[make_ii_index(ii->opcode, (1 << 10) | ii->xo)] = ii_index; - break; - - case VA_form: - // Extended opcode in bits 26..31 - for (int j = 0; j < 32; j++) - ii_index_table[make_ii_index(ii->opcode, (j << 6) | ii->xo)] = ii_index; - break; - - default: - fprintf(stderr, "Unhandled form %d\n", ii->format); - abort(); - break; - } -} diff --git a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-dyngen-ops.cpp b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-dyngen-ops.cpp deleted file mode 100644 index 7f9e9f0b..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-dyngen-ops.cpp +++ /dev/null @@ -1,1769 +0,0 @@ -/* - * ppc-dyngen-ops.hpp - PowerPC synthetic instructions - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" -#include "cpu/vm.hpp" -#include "cpu/jit/dyngen-exec.h" -#define NO_DEFINE_ALIAS 1 -#include "cpu/ppc/ppc-cpu.hpp" -#include "cpu/ppc/ppc-bitfields.hpp" -#include "cpu/ppc/ppc-registers.hpp" -#include "cpu/ppc/ppc-operations.hpp" - -#if defined(__GNUC__) -// Force inlining under newer versions of GCC. -static inline uint64 vm_read_memory_8(vm_addr_t addr) __attribute__((always_inline)); -static inline void vm_write_memory_8(vm_addr_t addr, uint64 value) __attribute__((always_inline)); -static inline uint64 vm_do_read_memory_8(uint64 *a) __attribute__((always_inline)); -static inline void vm_do_write_memory_8(uint64 *a, uint64 v) __attribute__((always_inline)); -static inline uint64 generic_bswap_64(uint64 x) __attribute__((always_inline)); -static inline uint32 fp_store_single_convert(uint64 v) __attribute__((always_inline)); -#define INLINE inline __attribute__((always_inline)) -#else -#define INLINE inline -#endif - -// We need at least 4 general purpose registers -register struct powerpc_cpu *CPU asm(REG_CPU); -#define DYNGEN_DEFINE_GLOBAL_REGISTER(REG) \ -register uintptr A##REG asm(REG_T##REG); \ -register uint32 T##REG asm(REG_T##REG) -DYNGEN_DEFINE_GLOBAL_REGISTER(0); -DYNGEN_DEFINE_GLOBAL_REGISTER(1); -DYNGEN_DEFINE_GLOBAL_REGISTER(2); -#ifdef REG_T3 -DYNGEN_DEFINE_GLOBAL_REGISTER(3); -#else -#define A3 powerpc_dyngen_helper::reg_T3() -#define T3 powerpc_dyngen_helper::reg_T3() -#endif - -// Floating-point registers -#define FPREG(X) ((powerpc_fpr *)(X)) -#define F0 FPREG(A0)->d -#define F0_dw FPREG(A0)->j -#define F1 FPREG(A1)->d -#define F1_dw FPREG(A1)->j -#define F2 FPREG(A2)->d -#define F2_dw FPREG(A2)->j -#define FD powerpc_dyngen_helper::reg_F3().d -#define FD_dw powerpc_dyngen_helper::reg_F3().j - -// Vector registers -#define VREG(X) ((powerpc_vr *)(X))[0] -#define V0 VREG(reg_V0) -#define reg_V0 A0 -#define V1 VREG(reg_V1) -#define reg_V1 A1 -#define V2 VREG(reg_V2) -#define reg_V2 A2 -#define VD VREG(reg_VD) -#define reg_VD A3 - -/** - * Helper class to access protected CPU context - **/ - -struct powerpc_dyngen_helper { - static INLINE uint32 get_pc() { return CPU->pc(); } - static INLINE void set_pc(uint32 value) { CPU->pc() = value; } - static INLINE void inc_pc(int32 offset) { CPU->pc() += offset; } - static INLINE uint32 get_lr() { return CPU->lr(); } - static INLINE void set_lr(uint32 value) { CPU->lr() = value; } - static INLINE uint32 get_ctr() { return CPU->ctr(); } - static INLINE void set_ctr(uint32 value) { CPU->ctr() = value; } - static INLINE uint32 get_cr() { return CPU->cr().get(); } - static INLINE void set_cr(uint32 value) { CPU->cr().set(value); } - static INLINE uint32 get_fpscr() { return CPU->fpscr(); } - static INLINE void set_fpscr(uint32 value) { CPU->fpscr() = value; } - static INLINE uint32 get_xer() { return CPU->xer().get(); } - static INLINE void set_xer(uint32 value) { CPU->xer().set(value); } - static INLINE uint32 get_vrsave() { return CPU->vrsave(); } - static INLINE void set_vrsave(uint32 value) { CPU->vrsave() = value; } - static INLINE uint32 get_vscr() { return CPU->vscr().get(); } - static INLINE void set_vscr(uint32 value) { CPU->vscr().set(value); } - static INLINE void record(int crf, int32 v) { CPU->record_cr(crf, v); } - static INLINE powerpc_cr_register & cr() { return CPU->cr(); } - static INLINE powerpc_xer_register & xer() { return CPU->xer(); } - static INLINE powerpc_spcflags & spcflags() { return CPU->spcflags(); } - static INLINE void set_cr(int crfd, int v) { CPU->cr().set(crfd, v); } - static INLINE powerpc_registers *regs() { return &CPU->regs(); } - -#ifndef REG_T3 - static INLINE uintptr & reg_T3() { return CPU->codegen.reg_T3; } -#endif -//#ifndef REG_F3 - static INLINE powerpc_fpr & reg_F3() { return CPU->codegen.reg_F3; } -//#endif - - static INLINE powerpc_block_info *find_block(uint32 pc) { return CPU->my_block_cache.fast_find(pc); } -}; - -// Semantic action templates -#define DYNGEN_OPS -#include "ppc-execute.hpp" - - -/** - * Load/store general purpose registers - **/ - -#define DEFINE_OP(REG, N) \ -void OPPROTO op_load_##REG##_GPR##N(void) \ -{ \ - REG = CPU->gpr(N); \ -} \ -void OPPROTO op_store_##REG##_GPR##N(void) \ -{ \ - CPU->gpr(N) = REG; \ -} -#define DEFINE_REG(N) \ -DEFINE_OP(T0,N); \ -DEFINE_OP(T1,N); \ -DEFINE_OP(T2,N); - -DEFINE_REG(0); -DEFINE_REG(1); -DEFINE_REG(2); -DEFINE_REG(3); -DEFINE_REG(4); -DEFINE_REG(5); -DEFINE_REG(6); -DEFINE_REG(7); -DEFINE_REG(8); -DEFINE_REG(9); -DEFINE_REG(10); -DEFINE_REG(11); -DEFINE_REG(12); -DEFINE_REG(13); -DEFINE_REG(14); -DEFINE_REG(15); -DEFINE_REG(16); -DEFINE_REG(17); -DEFINE_REG(18); -DEFINE_REG(19); -DEFINE_REG(20); -DEFINE_REG(21); -DEFINE_REG(22); -DEFINE_REG(23); -DEFINE_REG(24); -DEFINE_REG(25); -DEFINE_REG(26); -DEFINE_REG(27); -DEFINE_REG(28); -DEFINE_REG(29); -DEFINE_REG(30); -DEFINE_REG(31); - -#undef DEFINE_REG -#undef DEFINE_OP - - -/** - * Load/store floating-point registers - **/ - -#define DEFINE_OP(REG, N) \ -void OPPROTO op_load_F##REG##_FPR##N(void) \ -{ \ - A##REG = (uintptr)&CPU->fpr(N); \ -} \ -void OPPROTO op_store_F##REG##_FPR##N(void) \ -{ \ - CPU->fpr_dw(N) = F##REG##_dw; \ -} -#define DEFINE_REG(N) \ -DEFINE_OP(0,N); \ -DEFINE_OP(1,N); \ -DEFINE_OP(2,N); \ -void OPPROTO op_store_FD_FPR##N(void) \ -{ \ - CPU->fpr_dw(N) = FD_dw; \ -} - -DEFINE_REG(0); -DEFINE_REG(1); -DEFINE_REG(2); -DEFINE_REG(3); -DEFINE_REG(4); -DEFINE_REG(5); -DEFINE_REG(6); -DEFINE_REG(7); -DEFINE_REG(8); -DEFINE_REG(9); -DEFINE_REG(10); -DEFINE_REG(11); -DEFINE_REG(12); -DEFINE_REG(13); -DEFINE_REG(14); -DEFINE_REG(15); -DEFINE_REG(16); -DEFINE_REG(17); -DEFINE_REG(18); -DEFINE_REG(19); -DEFINE_REG(20); -DEFINE_REG(21); -DEFINE_REG(22); -DEFINE_REG(23); -DEFINE_REG(24); -DEFINE_REG(25); -DEFINE_REG(26); -DEFINE_REG(27); -DEFINE_REG(28); -DEFINE_REG(29); -DEFINE_REG(30); -DEFINE_REG(31); - -#undef DEFINE_REG -#undef DEFINE_OP - - -/** - * Load/Store floating-point data - **/ - -#if defined(__i386__) -#define do_load_double(REG, EA) do { \ - uint32 *w = (uint32 *)® \ - w[1] = vm_read_memory_4(EA + 0); \ - w[0] = vm_read_memory_4(EA + 4); \ -} while (0) -#define do_store_double(REG, EA) do { \ - uint32 *w = (uint32 *)® \ - vm_write_memory_4(EA + 0, w[1]); \ - vm_write_memory_4(EA + 4, w[0]); \ -} while (0) -#endif - -#ifndef do_load_single -#define do_load_single(REG, EA) REG##_dw = fp_load_single_convert(vm_read_memory_4(EA)) -#endif - -#ifndef do_store_single -#define do_store_single(REG, EA) vm_write_memory_4(EA, fp_store_single_convert(REG##_dw)) -#endif - -#ifndef do_load_double -#define do_load_double(REG, EA) REG##_dw = vm_read_memory_8(EA) -#endif - -#ifndef do_store_double -#define do_store_double(REG, EA) vm_write_memory_8(EA, REG##_dw) -#endif - -#define im PARAM1 -#define DEFINE_OP(OFFSET) \ -void OPPROTO op_load_double_FD_T1_##OFFSET(void) \ -{ \ - do_load_double(FD, T1 + OFFSET); \ -} \ -void OPPROTO op_load_single_FD_T1_##OFFSET(void) \ -{ \ - do_load_single(FD, T1 + OFFSET); \ -} \ -void OPPROTO op_store_double_F0_T1_##OFFSET(void) \ -{ \ - do_store_double(F0, T1 + OFFSET); \ -} \ -void OPPROTO op_store_single_F0_T1_##OFFSET(void) \ -{ \ - do_store_single(F0, T1 + OFFSET); \ -} - -DEFINE_OP(0); -DEFINE_OP(im); -DEFINE_OP(T2); - -#undef im -#undef DEFINE_OP - -#if KPX_MAX_CPUS == 1 -void OPPROTO op_lwarx_T0_T1(void) -{ - T0 = vm_read_memory_4(T1); - powerpc_dyngen_helper::regs()->reserve_valid = 1; - powerpc_dyngen_helper::regs()->reserve_addr = T1; -} - -void OPPROTO op_stwcx_T0_T1(void) -{ - uint32 cr = powerpc_dyngen_helper::get_cr() & ~CR_field<0>::mask(); - cr |= powerpc_dyngen_helper::xer().get_so() << 28; - if (powerpc_dyngen_helper::regs()->reserve_valid) { - powerpc_dyngen_helper::regs()->reserve_valid = 0; - if (powerpc_dyngen_helper::regs()->reserve_addr == T1 /* physical_addr(EA) */) { - vm_write_memory_4(T1, T0); - cr |= CR_EQ_field<0>::mask(); - } - } - powerpc_dyngen_helper::set_cr(cr); - dyngen_barrier(); -} -#endif - - -/** - * Condition Registers - **/ - -void OPPROTO op_load_T0_CR(void) -{ - T0 = powerpc_dyngen_helper::get_cr(); -} - -void OPPROTO op_store_T0_CR(void) -{ - powerpc_dyngen_helper::set_cr(T0); -} - -#define DEFINE_OP(REG, N) \ -void OPPROTO op_load_##REG##_crb##N(void) \ -{ \ - const uint32 cr = powerpc_dyngen_helper::get_cr(); \ - REG = (cr >> (31 - N)) & 1; \ -} \ -void OPPROTO op_store_##REG##_crb##N(void) \ -{ \ - uint32 cr = powerpc_dyngen_helper::get_cr() & ~(1 << (31 - N)); \ - cr |= ((REG & 1) << (31 - N)); \ - powerpc_dyngen_helper::set_cr(cr); \ -} -#define DEFINE_REG(N) \ -DEFINE_OP(T0, N); \ -DEFINE_OP(T1, N); - -DEFINE_REG(0); -DEFINE_REG(1); -DEFINE_REG(2); -DEFINE_REG(3); -DEFINE_REG(4); -DEFINE_REG(5); -DEFINE_REG(6); -DEFINE_REG(7); -DEFINE_REG(8); -DEFINE_REG(9); -DEFINE_REG(10); -DEFINE_REG(11); -DEFINE_REG(12); -DEFINE_REG(13); -DEFINE_REG(14); -DEFINE_REG(15); -DEFINE_REG(16); -DEFINE_REG(17); -DEFINE_REG(18); -DEFINE_REG(19); -DEFINE_REG(20); -DEFINE_REG(21); -DEFINE_REG(22); -DEFINE_REG(23); -DEFINE_REG(24); -DEFINE_REG(25); -DEFINE_REG(26); -DEFINE_REG(27); -DEFINE_REG(28); -DEFINE_REG(29); -DEFINE_REG(30); -DEFINE_REG(31); - -#undef DEFINE_REG -#undef DEFINE_OP - -#define DEFINE_OP(CRF, REG) \ -void OPPROTO op_load_##REG##_cr##CRF(void) \ -{ \ - REG = powerpc_dyngen_helper::cr().get(CRF); \ -} \ -void OPPROTO op_store_##REG##_cr##CRF(void) \ -{ \ - powerpc_dyngen_helper::cr().set(CRF, REG); \ -} - -DEFINE_OP(0, T0); -DEFINE_OP(1, T0); -DEFINE_OP(2, T0); -DEFINE_OP(3, T0); -DEFINE_OP(4, T0); -DEFINE_OP(5, T0); -DEFINE_OP(6, T0); -DEFINE_OP(7, T0); - -#undef DEFINE_OP - -void OPPROTO op_mtcrf_T0_im(void) -{ - const uint32 mask = PARAM1; - const uint32 cr = powerpc_dyngen_helper::get_cr(); - powerpc_dyngen_helper::set_cr((cr & ~mask) | (T0 & mask)); -} - - -/** - * Native FP operations optimization - **/ - -#if defined(__i386__) -#define do_fabs(x) ({ double y; asm volatile ("fabs" : "=t" (y) : "0" (x)); y; }) -#define do_fneg(x) ({ double y; asm volatile ("fchs" : "=t" (y) : "0" (x)); y; }) -#endif - -#ifndef do_fabs -#define do_fabs(x) fabs(x) -#endif -#ifndef do_fadd -#define do_fadd(x, y) (x) + (y) -#endif -#ifndef do_fdiv -#define do_fdiv(x, y) (x) / (y) -#endif -#ifndef do_fmadd -#define do_fmadd(x, y, z) (((x) * (y)) + (z)) -#endif -#ifndef do_fmsub -#define do_fmsub(x, y, z) (((x) * (y)) - (z)) -#endif -#ifndef do_fmul -#define do_fmul(x, y) ((x) * (y)) -#endif -#ifndef do_fneg -#define do_fneg(x) -(x) -#endif -#ifndef do_fnabs -#define do_fnabs(x) do_fneg(do_fabs(x)) -#endif -#ifndef do_fnmadd -#define do_fnmadd(x, y, z) do_fneg(((x) * (y)) + (z)) -#endif -#ifndef do_fnmsub -#define do_fnmsub(x, y, z) do_fneg(((x) * (y)) - (z)) -#endif -#ifndef do_fsub -#define do_fsub(x, y) (x) - (y) -#endif - - -/** - * Double-precision floating point operations - **/ - -#define DEFINE_OP(NAME, CODE) \ -void OPPROTO op_##NAME(void) \ -{ \ - CODE; \ -} - -DEFINE_OP(fmov_F0_F1, F0_dw = F1_dw); -DEFINE_OP(fmov_F0_F2, F0_dw = F2_dw); -DEFINE_OP(fmov_F1_F0, F1_dw = F0_dw); -DEFINE_OP(fmov_F1_F2, F1_dw = F2_dw); -DEFINE_OP(fmov_F2_F0, F2_dw = F0_dw); -DEFINE_OP(fmov_F2_F1, F2_dw = F1_dw); -DEFINE_OP(fmov_FD_F0, FD_dw = F0_dw); -DEFINE_OP(fmov_FD_F1, FD_dw = F1_dw); -DEFINE_OP(fmov_FD_F2, FD_dw = F2_dw); - -DEFINE_OP(fabs_FD_F0, FD = do_fabs(F0)); -DEFINE_OP(fneg_FD_F0, FD = do_fneg(F0)); -DEFINE_OP(fnabs_FD_F0, FD = do_fnabs(F0)); - -DEFINE_OP(fadd_FD_F0_F1, FD = do_fadd(F0, F1)); -DEFINE_OP(fsub_FD_F0_F1, FD = do_fsub(F0, F1)); -DEFINE_OP(fmul_FD_F0_F1, FD = do_fmul(F0, F1)); -DEFINE_OP(fdiv_FD_F0_F1, FD = do_fdiv(F0, F1)); -DEFINE_OP(fmadd_FD_F0_F1_F2, FD = do_fmadd(F0, F1, F2)); -DEFINE_OP(fmsub_FD_F0_F1_F2, FD = do_fmsub(F0, F1, F2)); -DEFINE_OP(fnmadd_FD_F0_F1_F2, FD = do_fnmadd(F0, F1, F2)); -DEFINE_OP(fnmsub_FD_F0_F1_F2, FD = do_fnmsub(F0, F1, F2)); - -#undef DEFINE_OP - - -/** - * Single-Precision floating point operations - **/ - -#define DEFINE_OP(NAME, REG, OP) \ -void OPPROTO op_##NAME(void) \ -{ \ - float x = OP; \ - REG = x; \ -} - -DEFINE_OP(fadds_FD_F0_F1, FD, do_fadd(F0, F1)); -DEFINE_OP(fsubs_FD_F0_F1, FD, do_fsub(F0, F1)); -DEFINE_OP(fmuls_FD_F0_F1, FD, do_fmul(F0, F1)); -DEFINE_OP(fdivs_FD_F0_F1, FD, do_fdiv(F0, F1)); -DEFINE_OP(fmadds_FD_F0_F1_F2, FD, do_fmadd(F0, F1, F2)); -DEFINE_OP(fmsubs_FD_F0_F1_F2, FD, do_fmsub(F0, F1, F2)); -DEFINE_OP(fnmadds_FD_F0_F1_F2, FD, do_fnmadd(F0, F1, F2)); -DEFINE_OP(fnmsubs_FD_F0_F1_F2, FD, do_fnmsub(F0, F1, F2)); - -#undef DEFINE_OP - - -/** - * Special purpose registers - **/ - -void OPPROTO op_load_T0_VRSAVE(void) -{ - T0 = powerpc_dyngen_helper::get_vrsave(); -} - -void OPPROTO op_store_T0_VRSAVE(void) -{ - powerpc_dyngen_helper::set_vrsave(T0); -} - -void OPPROTO op_load_T0_XER(void) -{ - T0 = powerpc_dyngen_helper::get_xer(); -} - -void OPPROTO op_store_T0_XER(void) -{ - powerpc_dyngen_helper::set_xer(T0); -} - -void OPPROTO op_load_T0_PC(void) -{ - T0 = powerpc_dyngen_helper::get_pc(); -} - -void OPPROTO op_store_T0_PC(void) -{ - powerpc_dyngen_helper::set_pc(T0); -} - -void OPPROTO op_set_PC_im(void) -{ - powerpc_dyngen_helper::set_pc(PARAM1); -} - -void OPPROTO op_set_PC_T0(void) -{ - powerpc_dyngen_helper::set_pc(T0); -} - -void OPPROTO op_inc_PC(void) -{ - powerpc_dyngen_helper::inc_pc(PARAM1); -} - -void OPPROTO op_load_T0_LR(void) -{ - T0 = powerpc_dyngen_helper::get_lr(); -} - -void OPPROTO op_store_T0_LR(void) -{ - powerpc_dyngen_helper::set_lr(T0); -} - -void OPPROTO op_load_T0_CTR(void) -{ - T0 = powerpc_dyngen_helper::get_ctr(); -} - -void OPPROTO op_store_T0_CTR(void) -{ - powerpc_dyngen_helper::set_ctr(T0); -} - -void OPPROTO op_store_im_LR(void) -{ - powerpc_dyngen_helper::set_lr(PARAM1); -} - -void OPPROTO op_load_T0_CTR_aligned(void) -{ - T0 = powerpc_dyngen_helper::get_ctr() & -4; -} - -void OPPROTO op_load_T0_LR_aligned(void) -{ - T0 = powerpc_dyngen_helper::get_lr() & -4; -} - -void OPPROTO op_spcflags_init(void) -{ - powerpc_dyngen_helper::spcflags().set(PARAM1); -} - -void OPPROTO op_spcflags_set(void) -{ - powerpc_dyngen_helper::spcflags().set(PARAM1); -} - -void OPPROTO op_spcflags_clear(void) -{ - powerpc_dyngen_helper::spcflags().clear(PARAM1); -} - -#if defined(__x86_64__) -#define FAST_COMPARE_SPECFLAGS_DISPATCH(SPCFLAGS, TARGET) \ - asm volatile ("test %0,%0 ; jz " #TARGET : : "r" (SPCFLAGS)) -#endif -#ifndef FAST_COMPARE_SPECFLAGS_DISPATCH -#define FAST_COMPARE_SPECFLAGS_DISPATCH(SPCFLAGS, TARGET) \ - if (SPCFLAGS == 0) DYNGEN_FAST_DISPATCH(TARGET) -#endif - -void OPPROTO op_spcflags_check(void) -{ - FAST_COMPARE_SPECFLAGS_DISPATCH(powerpc_dyngen_helper::spcflags().get(), __op_jmp0); -} - - -/** - * Branch instructions - **/ - -template< int bo > -static INLINE void do_prep_branch_bo(void) -{ - bool ctr_ok = true; - bool cond_ok = true; - - if (BO_CONDITIONAL_BRANCH(bo)) { - if (BO_BRANCH_IF_TRUE(bo)) - cond_ok = T1; - else - cond_ok = !T1; - } - - if (BO_DECREMENT_CTR(bo)) { - T2 = powerpc_dyngen_helper::get_ctr() - 1; - powerpc_dyngen_helper::set_ctr(T2); - if (BO_BRANCH_IF_CTR_ZERO(bo)) - ctr_ok = !T2; - else - ctr_ok = T2; - } - - T1 = ctr_ok && cond_ok; - dyngen_barrier(); -} - -#define BO(A,B,C,D) (((A) << 4)| ((B) << 3) | ((C) << 2) | ((D) << 1)) -#define DEFINE_OP(BO_SUFFIX, BO_VALUE) \ -void OPPROTO op_prep_branch_bo_##BO_SUFFIX(void) \ -{ \ - do_prep_branch_bo(); \ -} - -DEFINE_OP(0000,(0,0,0,0)); -DEFINE_OP(0001,(0,0,0,1)); -DEFINE_OP(001x,(0,0,1,0)); -DEFINE_OP(0100,(0,1,0,0)); -DEFINE_OP(0101,(0,1,0,1)); -DEFINE_OP(011x,(0,1,1,0)); -DEFINE_OP(1x00,(1,0,0,0)); -DEFINE_OP(1x01,(1,0,0,1)); -// NOTE: the compiler is expected to optimize out the use of PARAM1 -DEFINE_OP(1x1x,(1,0,1,0)); - -#undef DEFINE_OP -#undef BO - -void OPPROTO op_branch_chain_1(void) -{ - DYNGEN_FAST_DISPATCH(__op_jmp0); -} - -void OPPROTO op_branch_chain_2(void) -{ - if (T1) - DYNGEN_FAST_DISPATCH(__op_jmp0); - else - DYNGEN_FAST_DISPATCH(__op_jmp1); - dyngen_barrier(); -} - -static INLINE void do_execute_branch_1(uint32 tpc) -{ - powerpc_dyngen_helper::set_pc(tpc); -} - -void OPPROTO op_branch_1_T0(void) -{ - do_execute_branch_1(T0); -} - -void OPPROTO op_branch_1_im(void) -{ - do_execute_branch_1(PARAM1); -} - -static INLINE void do_execute_branch_2(uint32 tpc, uint32 npc) -{ - powerpc_dyngen_helper::set_pc(T1 ? tpc : npc); - dyngen_barrier(); -} - -void OPPROTO op_branch_2_T0_im(void) -{ - do_execute_branch_2(T0, PARAM1); -} - -void OPPROTO op_branch_2_im_im(void) -{ - do_execute_branch_2(PARAM1, PARAM2); -} - - -/** - * Compare & Record instructions - **/ - -void OPPROTO op_record_cr0_T0(void) -{ - uint32 cr = powerpc_dyngen_helper::get_cr() & ~CR_field<0>::mask(); - cr |= powerpc_dyngen_helper::xer().get_so() << 28; - if ((int32)T0 < 0) - cr |= CR_LT_field<0>::mask(); - else if ((int32)T0 > 0) - cr |= CR_GT_field<0>::mask(); - else - cr |= CR_EQ_field<0>::mask(); - powerpc_dyngen_helper::set_cr(cr); - dyngen_barrier(); -} - -void OPPROTO op_record_cr1(void) -{ - powerpc_dyngen_helper::set_cr((powerpc_dyngen_helper::get_cr() & ~CR_field<1>::mask()) | - ((powerpc_dyngen_helper::get_fpscr() >> 4) & 0x0f000000)); -} - -#define im PARAM1 - -#if DYNGEN_ASM_OPTS && defined(__powerpc__) && 0 - -#define DEFINE_OP(NAME, COMP, LHS, RHST, RHS) \ -void OPPROTO op_##NAME##_##LHS##_##RHS(void) \ -{ \ - T0 = powerpc_dyngen_helper::xer().get_so(); \ - uint32 v; \ - asm volatile (COMP " 7,%1,%2 ; mfcr %0" : "=r" (v) : "r" (LHS), RHST (RHS) : "cr7"); \ - T0 |= (v & 0xe); \ -} - -DEFINE_OP(compare,"cmpw",T0,"r",T1); -DEFINE_OP(compare,"cmpw",T0,"r",im); -DEFINE_OP(compare,"cmpwi",T0,"i",0); -DEFINE_OP(compare_logical,"cmplw",T0,"r",T1); -DEFINE_OP(compare_logical,"cmplw",T0,"r",im); -DEFINE_OP(compare_logical,"cmplwi",T0,"i",0); - -#else - -#define DEFINE_OP(NAME, TYPE, LHS, RHS) \ -void OPPROTO op_##NAME##_##LHS##_##RHS(void) \ -{ \ - const uint32 SO = powerpc_dyngen_helper::xer().get_so(); \ - if ((TYPE)LHS < (TYPE)RHS) \ - T0 = SO | standalone_CR_LT_field::mask(); \ - else if ((TYPE)LHS > (TYPE)RHS) \ - T0 = SO | standalone_CR_GT_field::mask(); \ - else \ - T0 = SO | standalone_CR_EQ_field::mask(); \ - dyngen_barrier(); \ -} - -DEFINE_OP(compare,int32,T0,T1); -DEFINE_OP(compare,int32,T0,im); -DEFINE_OP(compare,int32,T0,0); -DEFINE_OP(compare_logical,uint32,T0,T1); -DEFINE_OP(compare_logical,uint32,T0,im); -DEFINE_OP(compare_logical,uint32,T0,0); - -#endif - -#undef im -#undef DEFINE_OP - - -/** - * Divide instructions - **/ - -#if DYNGEN_ASM_OPTS && defined(__powerpc__) -#define get_ov() ({ uint32 xer; asm volatile ("mfxer %0" : "=r" (xer)); XER_OV_field::extract(xer); }) -#endif - -void OPPROTO op_divw_T0_T1(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__powerpc__) - asm volatile ("divw %0,%0,%1" : "=r" (T0) : "r" (T1)); - return; -#endif -#endif - T0 = do_execute_divide(T0, T1); -} - -void OPPROTO op_divwo_T0_T1(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__powerpc__) - asm volatile ("divwo %0,%0,%1" : "=r" (T0) : "r" (T1)); - powerpc_dyngen_helper::xer().set_ov(get_ov()); - return; -#endif -#endif - T0 = do_execute_divide(T0, T1); -} - -void OPPROTO op_divwu_T0_T1(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__powerpc__) - asm volatile ("divwu %0,%0,%1" : "=r" (T0) : "r" (T1)); - return; -#endif -#endif - T0 = do_execute_divide(T0, T1); -} - -void OPPROTO op_divwuo_T0_T1(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__powerpc__) - asm volatile ("divwuo %0,%0,%1" : "=r" (T0) : "r" (T1)); - powerpc_dyngen_helper::xer().set_ov(get_ov()); - return; -#endif -#endif - T0 = do_execute_divide(T0, T1); -} - - -/** - * Multiply instructions - **/ - -void OPPROTO op_mulhw_T0_T1(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__i386__) || defined(__x86_64__) - asm volatile ("imul %0" : "+d" (T0) : "a" (T1)); - return; -#endif -#endif - T0 = (((int64)(int32)T0) * ((int64)(int32)T1)) >> 32; -} - -void OPPROTO op_mulhwu_T0_T1(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__i386__) || defined(__x86_64__) - asm volatile ("mul %0" : "+d" (T0) : "a" (T1)); - return; -#endif -#endif - T0 = (((uint64)T0) * ((uint64)T1)) >> 32; -} - -void OPPROTO op_mulli_T0_im(void) -{ - T0 = (int32)T0 * (int32)PARAM1; -} - -void OPPROTO op_mullwo_T0_T1(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__powerpc__) - asm volatile ("mullwo %0,%0,%1" : "=r" (T0) : "r" (T1)); - powerpc_dyngen_helper::xer().set_ov(get_ov()); - return; -#endif -#endif - int64 RD = (int64)(int32)T0 * (int64)(int32)T1; - powerpc_dyngen_helper::xer().set_ov((int32)RD != RD); - T0 = RD; - dyngen_barrier(); -} - - -/** - * Shift/Rotate instructions - **/ - -void OPPROTO op_slw_T0_T1(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__i386__) || defined(__x86_64__) - T0 <<= T1; // the shift count is masked to 5 bits - if (T1 & 0x20) - T0 = 0; - return; -#endif -#endif - T1 &= 0x3f; - T0 = (T1 & 0x20) ? 0 : (T0 << T1); - dyngen_barrier(); -} - -void OPPROTO op_srw_T0_T1(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__i386__) || defined(__x86_64__) - T0 >>= T1; // the shift count is masked to 5 bits - if (T1 & 0x20) - T0 = 0; - return; -#endif -#endif - T1 &= 0x3f; - T0 = (T1 & 0x20) ? 0 : (T0 >> T1); - dyngen_barrier(); -} - -void OPPROTO op_sraw_T0_T1(void) -{ - T1 &= 0x3f; - if (T1 & 0x20) { - const uint32 SB = T0 >> 31; - powerpc_dyngen_helper::xer().set_ca(SB); - T0 = -SB; - } - else { - const uint32 RD = ((int32)T0) >> T1; - const bool CA = (int32)T0 < 0 && (T0 & ~(0xffffffff << T1)); - powerpc_dyngen_helper::xer().set_ca(CA); - T0 = RD; - } - dyngen_barrier(); -} - -void OPPROTO op_sraw_T0_im(void) -{ - const uint32 n = PARAM1; - const uint32 RD = ((int32)T0) >> n; - const bool ca = (((int32)T0) < 0) && (T0 & ~(0xffffffff << n)); - powerpc_dyngen_helper::xer().set_ca(ca); - T0 = RD; - dyngen_barrier(); -} - -void OPPROTO op_rlwimi_T0_T1(void) -{ - T0 = op_ppc_rlwimi::apply(T1, PARAM1, PARAM2, T0); -} - -void OPPROTO op_rlwinm_T0_T1(void) -{ - T0 = op_rotl::apply(T0, PARAM1) & PARAM2; -} - -void OPPROTO op_rlwnm_T0_T1(void) -{ - T0 = op_rotl::apply(T0, T1) & PARAM1; -} - -void OPPROTO op_cntlzw_32_T0(void) -{ - int n; -#if DYNGEN_ASM_OPTS -#if defined(__i386__) || defined(__x86_64__) - n = -1; - asm volatile ("bsr %1,%0" : "+r" (n) : "r" (T0)); - T0 = 31 - n; - return; -#endif -#endif - uint32 m = 0x80000000; - for (n = 0; n < 32; n++, m >>= 1) - if (T0 & m) - break; - T0 = n; - dyngen_barrier(); -} - - -/** - * Addition/Subtraction - **/ - -void OPPROTO op_addo_T0_T1(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__powerpc__) - uint32 xer; - asm volatile ("addo %0,%0,%2 ; mfxer %1" : "=r" (T0), "=r" (xer) : "r" (T1)); - powerpc_dyngen_helper::xer().set_ov(XER_OV_field::extract(xer)); - return; -#endif -#if defined(__i386__) || defined(__x86_64__) - uint32 ov; - asm volatile ("add %2,%0; seto %b1" : "=r" (T0), "=r" (ov) : "r" (T1) : "cc"); - powerpc_dyngen_helper::xer().set_ov(ov); - return; -#endif -#endif - T0 = do_execute_addition(T0, T1); -} - -void OPPROTO op_addc_T0_im(void) -{ - T0 = do_execute_addition(T0, PARAM1); -} - -void OPPROTO op_addc_T0_T1(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__powerpc__) - uint32 xer; - asm volatile ("addc %0,%0,%2 ; mfxer %1" : "=r" (T0), "=r" (xer) : "r" (T1)); - powerpc_dyngen_helper::xer().set_ca(XER_CA_field::extract(xer)); - return; -#endif -#if defined(__i386__) || defined(__x86_64__) - uint32 ca; - asm volatile ("add %2,%0; setc %b1" : "=r" (T0), "=r" (ca) : "r" (T1) : "cc"); - powerpc_dyngen_helper::xer().set_ca(ca); - return; -#endif -#endif - T0 = do_execute_addition(T0, T1); -} - -void OPPROTO op_addco_T0_T1(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__powerpc__) - uint32 xer; - asm volatile ("addco %0,%0,%2 ; mfxer %1" : "=r" (T0), "=r" (xer) : "r" (T1)); - powerpc_dyngen_helper::xer().set_ca(XER_CA_field::extract(xer)); - powerpc_dyngen_helper::xer().set_ov(XER_OV_field::extract(xer)); - return; -#endif -#if defined(__i386__) || defined(__x86_64__) - uint32 ca, ov; - asm volatile ("add %3,%0; setc %b1; seto %b2" : "=r" (T0), "=r" (ca), "=r" (ov) : "r" (T1) : "cc"); - powerpc_dyngen_helper::xer().set_ca(ca); - powerpc_dyngen_helper::xer().set_ov(ov); - return; -#endif -#endif - T0 = do_execute_addition(T0, T1); -} - -void OPPROTO op_adde_T0_T1(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__powerpc__) - uint32 xer, ca = powerpc_dyngen_helper::xer().get_ca(); - asm volatile ("li 0,-1 ; addc 0,%0,0" : : "r" (ca) : "r0"); - asm volatile ("adde %0,%0,%2 ; mfxer %1" : "=r" (T0), "=r" (xer) : "r" (T1)); - powerpc_dyngen_helper::xer().set_ca(XER_CA_field::extract(xer)); - return; -#endif -#if defined(__i386__) || defined(__x86_64__) - uint32 ca = powerpc_dyngen_helper::xer().get_ca(); - asm volatile ("bt $0,%1; adc %2,%0; setc %b1" : "=r" (T0), "+r" (ca) : "r" (T1) : "cc"); - powerpc_dyngen_helper::xer().set_ca(ca); - return; -#endif -#endif - T0 = do_execute_addition(T0, T1); -} - -void OPPROTO op_addeo_T0_T1(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__powerpc__) - uint32 xer, ca = powerpc_dyngen_helper::xer().get_ca(); - asm volatile ("li 0,-1 ; addc 0,%0,0" : : "r" (ca) : "r0"); - asm volatile ("addeo %0,%0,%2 ; mfxer %1" : "=r" (T0), "=r" (xer) : "r" (T1)); - powerpc_dyngen_helper::xer().set_ca(XER_CA_field::extract(xer)); - powerpc_dyngen_helper::xer().set_ov(XER_OV_field::extract(xer)); - return; -#endif -#if defined(__i386__) || defined(__x86_64__) - uint32 ov, ca = powerpc_dyngen_helper::xer().get_ca(); - asm volatile ("bt $0,%1; adc %3,%0; setc %b1; seto %b2" : "=r" (T0), "+r" (ca), "=r" (ov) : "r" (T1) : "cc"); - powerpc_dyngen_helper::xer().set_ca(ca); - powerpc_dyngen_helper::xer().set_ov(ov); - return; -#endif -#endif - T0 = do_execute_addition(T0, T1); -} - -void OPPROTO op_addme_T0(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__powerpc__) - uint32 xer, ca = powerpc_dyngen_helper::xer().get_ca(); - asm volatile ("li 0,-1 ; addc 0,%0,0" : : "r" (ca) : "r0"); - asm volatile ("addme %0,%0 ; mfxer %1" : "=r" (T0), "=r" (xer)); - powerpc_dyngen_helper::xer().set_ca(XER_CA_field::extract(xer)); - return; -#endif -#if defined(__i386__) || defined(__x86_64__) - uint32 ca = powerpc_dyngen_helper::xer().get_ca(); - asm volatile ("bt $0,%1; adc $-1,%0; setc %b1" : "=r" (T0), "+r" (ca) : : "cc"); - powerpc_dyngen_helper::xer().set_ca(ca); - return; -#endif -#endif - T0 = do_execute_addition(T0, 0xffffffff); -} - -void OPPROTO op_addmeo_T0(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__powerpc__) - uint32 xer, ca = powerpc_dyngen_helper::xer().get_ca(); - asm volatile ("li 0,-1 ; addc 0,%0,0" : : "r" (ca) : "r0"); - asm volatile ("addmeo %0,%0 ; mfxer %1" : "=r" (T0), "=r" (xer)); - powerpc_dyngen_helper::xer().set_ca(XER_CA_field::extract(xer)); - powerpc_dyngen_helper::xer().set_ov(XER_OV_field::extract(xer)); - return; -#endif -#if defined(__i386__) || defined(__x86_64__) - uint32 ov, ca = powerpc_dyngen_helper::xer().get_ca(); - asm volatile ("bt $0,%1; adc $-1,%0; setc %b1; seto %b2" : "=r" (T0), "+r" (ca), "=r" (ov) : : "cc"); - powerpc_dyngen_helper::xer().set_ca(ca); - powerpc_dyngen_helper::xer().set_ov(ov); - return; -#endif -#endif - T0 = do_execute_addition(T0, 0xffffffff); -} - -void OPPROTO op_addze_T0(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__powerpc__) - uint32 xer, ca = powerpc_dyngen_helper::xer().get_ca(); - asm volatile ("li 0,-1 ; addc 0,%0,0" : : "r" (ca) : "r0"); - asm volatile ("addze %0,%0 ; mfxer %1" : "=r" (T0), "=r" (xer)); - powerpc_dyngen_helper::xer().set_ca(XER_CA_field::extract(xer)); - return; -#endif -#if defined(__i386__) || defined(__x86_64__) - uint32 ca = powerpc_dyngen_helper::xer().get_ca(); - asm volatile ("bt $0,%1; adc $0,%0; setc %b1" : "=r" (T0), "+r" (ca) : : "cc"); - powerpc_dyngen_helper::xer().set_ca(ca); - return; -#endif -#endif - T0 = do_execute_addition(T0, 0); -} - -void OPPROTO op_addzeo_T0(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__powerpc__) - uint32 xer, ca = powerpc_dyngen_helper::xer().get_ca(); - asm volatile ("li 0,-1 ; addc 0,%0,0" : : "r" (ca) : "r0"); - asm volatile ("addzeo %0,%0 ; mfxer %1" : "=r" (T0), "=r" (xer)); - powerpc_dyngen_helper::xer().set_ca(XER_CA_field::extract(xer)); - powerpc_dyngen_helper::xer().set_ov(XER_OV_field::extract(xer)); - return; -#endif -#if defined(__i386__) || defined(__x86_64__) - uint32 ov, ca = powerpc_dyngen_helper::xer().get_ca(); - asm volatile ("bt $0,%1; adc $0,%0; setc %b1; seto %b2" : "=r" (T0), "+r" (ca), "=r" (ov) : : "cc"); - powerpc_dyngen_helper::xer().set_ca(ca); - powerpc_dyngen_helper::xer().set_ov(ov); - return; -#endif -#endif - T0 = do_execute_addition(T0, 0); -} - -void OPPROTO op_subf_T0_T1(void) -{ - T0 = T1 - T0; -} - -void OPPROTO op_subfo_T0_T1(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__i386__) || defined(__x86_64__) - uint32 ov, TI; - TI = T1; - asm volatile ("sub %2,%0; seto %b1" : "+r" (TI), "=r" (ov) : "r" (T0) : "cc"); - T0 = TI; - powerpc_dyngen_helper::xer().set_ov(ov); - return; -#endif -#endif - T0 = do_execute_subtract(T0, T1); -} - -void OPPROTO op_subfc_T0_im(void) -{ - T0 = do_execute_subtract(T0, PARAM1); -} - -void OPPROTO op_subfc_T0_T1(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__i386__) || defined(__x86_64__) - uint32 ca, TI; - TI = T1; - asm volatile ("sub %2,%0; cmc; setc %b1" : "+r" (TI), "=r" (ca) : "r" (T0) : "cc"); - T0 = TI; - powerpc_dyngen_helper::xer().set_ca(ca); - return; -#endif -#endif - T0 = do_execute_subtract(T0, T1); -} - -void OPPROTO op_subfco_T0_T1(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__i386__) || defined(__x86_64__) - uint32 ca, ov, TI; - TI = T1; - asm volatile ("sub %3,%0; cmc; setc %b1; seto %b2" : "+r" (TI), "=r" (ca), "=r" (ov) : "r" (T0) : "cc"); - T0 = TI; - powerpc_dyngen_helper::xer().set_ca(ca); - powerpc_dyngen_helper::xer().set_ov(ov); - return; -#endif -#endif - T0 = do_execute_subtract(T0, T1); -} - -void OPPROTO op_subfe_T0_T1(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__i386__) || defined(__x86_64__) - uint32 ca = powerpc_dyngen_helper::xer().get_ca(); - uint32 TI = T1; - asm volatile ("bt $0,%1; cmc; sbb %2,%0; cmc; setc %b1" : "+r" (TI), "+r" (ca) : "r" (T0) : "cc"); - T0 = TI; - powerpc_dyngen_helper::xer().set_ca(ca); - return; -#endif -#endif - T0 = do_execute_subtract_extended(T0, T1); -} - -void OPPROTO op_subfeo_T0_T1(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__i386__) || defined(__x86_64__) - uint32 ov, ca = powerpc_dyngen_helper::xer().get_ca(); - uint32 TI = T1; - asm volatile ("bt $0,%1; cmc; sbb %3,%0; cmc; setc %b1; seto %b2" : "+r" (TI), "+r" (ca), "=r" (ov) : "r" (T0) : "cc"); - T0 = TI; - powerpc_dyngen_helper::xer().set_ca(ca); - powerpc_dyngen_helper::xer().set_ov(ov); - return; -#endif -#endif - T0 = do_execute_subtract_extended(T0, T1); -} - -void OPPROTO op_subfme_T0(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__i386__) || defined(__x86_64__) - uint32 ca = powerpc_dyngen_helper::xer().get_ca(); - uint32 TI = (uint32)-1; - asm volatile ("bt $0,%1; cmc; sbb %2,%0; cmc; setc %b1" : "+r" (TI), "+r" (ca) : "r" (T0) : "cc"); - T0 = TI; - powerpc_dyngen_helper::xer().set_ca(ca); - return; -#endif -#endif - T0 = do_execute_subtract_extended(T0, 0xffffffff); -} - -void OPPROTO op_subfmeo_T0(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__i386__) || defined(__x86_64__) - uint32 ov; - uint32 ca = powerpc_dyngen_helper::xer().get_ca(); - uint32 TI = (uint32)-1; - asm volatile ("bt $0,%1; cmc; sbb %3,%0; cmc; setc %b1; seto %b2" : "+r" (TI), "+r" (ca), "=r" (ov) : "r" (T0) : "cc"); - T0 = TI; - powerpc_dyngen_helper::xer().set_ca(ca); - powerpc_dyngen_helper::xer().set_ov(ov); - return; -#endif -#endif - T0 = do_execute_subtract_extended(T0, 0xffffffff); -} - -void OPPROTO op_subfze_T0(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__i386__) || defined(__x86_64__) - uint32 ca = powerpc_dyngen_helper::xer().get_ca(); - uint32 TI = 0; - asm volatile ("bt $0,%1; cmc; sbb %2,%0; cmc; setc %b1" : "+r" (TI), "+r" (ca) : "r" (T0) : "cc"); - T0 = TI; - powerpc_dyngen_helper::xer().set_ca(ca); - return; -#endif -#endif - T0 = do_execute_subtract_extended(T0, 0); -} - -void OPPROTO op_subfzeo_T0(void) -{ -#if DYNGEN_ASM_OPTS -#if defined(__i386__) || defined(__x86_64__) - uint32 ov; - uint32 ca = powerpc_dyngen_helper::xer().get_ca(); - uint32 TI = 0; - asm volatile ("bt $0,%1; cmc; sbb %3,%0; cmc; setc %b1; seto %b2" : "+r" (TI), "+r" (ca), "=r" (ov) : "r" (T0) : "cc"); - T0 = TI; - powerpc_dyngen_helper::xer().set_ca(ca); - powerpc_dyngen_helper::xer().set_ov(ov); - return; -#endif -#endif - T0 = do_execute_subtract_extended(T0, 0); -} - -/** - * Misc synthetic instructions - **/ - -void OPPROTO op_inc_32_mem(void) -{ - uint32 *m = (uint32 *)PARAM1; - *m += 1; -} - -void OPPROTO op_nego_T0(void) -{ - powerpc_dyngen_helper::xer().set_ov(T0 == 0x80000000); - T0 = -T0; -} - -void OPPROTO op_dcbz_T0(void) -{ - T0 &= -32; // align T0 on cache line boundaries - uint64 * block = (uint64 *) vm_do_get_real_address(T0); - block[0] = 0; block[1] = 0; block[2] = 0; block[3] = 0; -} - -/** - * Generate possible call to next basic block without going - * through register state restore & full cache lookup - **/ - -void OPPROTO op_jump_next_A0(void) -{ - powerpc_block_info *bi = (powerpc_block_info *)A0; - uint32 pc = powerpc_dyngen_helper::get_pc(); - if (likely(bi->pc == pc) || likely((bi = powerpc_dyngen_helper::find_block(pc)) != NULL)) - goto *(bi->entry_point); - dyngen_barrier(); -} - -/** - * Load/store multiple - **/ - -template< int N > -static INLINE void do_lmw(void) -{ - CPU->gpr(N) = vm_read_memory_4(T0); - T0 += 4; - do_lmw(); -} - -template<> -INLINE void do_lmw<31>(void) -{ - CPU->gpr(31) = vm_read_memory_4(T0); -} - -template<> -INLINE void do_lmw<32>(void) -{ - for (uint32 r = PARAM1, ad = T0; r <= 31; r++, ad += 4) - CPU->gpr(r) = vm_read_memory_4(ad); - dyngen_barrier(); -} - -template< int N > -static INLINE void do_stmw(void) -{ - vm_write_memory_4(T0, CPU->gpr(N)); - T0 += 4; - do_stmw(); -} - -template<> -INLINE void do_stmw<31>(void) -{ - vm_write_memory_4(T0, CPU->gpr(31)); -} - -template<> -INLINE void do_stmw<32>(void) -{ - for (uint32 r = PARAM1, ad = T0; r <= 31; r++, ad += 4) - vm_write_memory_4(ad, CPU->gpr(r)); - dyngen_barrier(); -} - -#define im 32 -#define DEFINE_OP(N) \ -void op_lmw_T0_## N(void) { do_lmw (); } \ -void op_stmw_T0_##N(void) { do_stmw(); } - -DEFINE_OP(im); -DEFINE_OP(26); -DEFINE_OP(27); -DEFINE_OP(28); -DEFINE_OP(29); -DEFINE_OP(30); -DEFINE_OP(31); - -#undef im -#undef DEFINE_OP - -/** - * Load/store addresses to vector registers - **/ - -#define DEFINE_OP(REG, N) \ -void OPPROTO op_load_ad_V##REG##_VR##N(void) \ -{ \ - reg_V##REG = (uintptr)&CPU->vr(N); \ -} -#define DEFINE_REG(N) \ -DEFINE_OP(D,N); \ -DEFINE_OP(0,N); \ -DEFINE_OP(1,N); \ -DEFINE_OP(2,N) - -DEFINE_REG(0); -DEFINE_REG(1); -DEFINE_REG(2); -DEFINE_REG(3); -DEFINE_REG(4); -DEFINE_REG(5); -DEFINE_REG(6); -DEFINE_REG(7); -DEFINE_REG(8); -DEFINE_REG(9); -DEFINE_REG(10); -DEFINE_REG(11); -DEFINE_REG(12); -DEFINE_REG(13); -DEFINE_REG(14); -DEFINE_REG(15); -DEFINE_REG(16); -DEFINE_REG(17); -DEFINE_REG(18); -DEFINE_REG(19); -DEFINE_REG(20); -DEFINE_REG(21); -DEFINE_REG(22); -DEFINE_REG(23); -DEFINE_REG(24); -DEFINE_REG(25); -DEFINE_REG(26); -DEFINE_REG(27); -DEFINE_REG(28); -DEFINE_REG(29); -DEFINE_REG(30); -DEFINE_REG(31); - -#undef DEFINE_REG -#undef DEFINE_OP -#undef AD - -void op_load_word_VD_T0(void) -{ - const uint32 ea = T0; - VD.w[(ea >> 2) & 3] = vm_read_memory_4(ea & ~3); -} - -void op_store_word_VD_T0(void) -{ - const uint32 ea = T0; - vm_write_memory_4(ea & ~3, VD.w[(ea >> 2) & 3]); -} - -void op_load_vect_VD_T0(void) -{ - const uint32 ea = T0 & ~15; - VD.w[0] = vm_read_memory_4(ea + 0); - VD.w[1] = vm_read_memory_4(ea + 4); - VD.w[2] = vm_read_memory_4(ea + 8); - VD.w[3] = vm_read_memory_4(ea + 12); -} - -void op_store_vect_VD_T0(void) -{ - const uint32 ea = T0 & ~15; - vm_write_memory_4(ea + 0, VD.w[0]); - vm_write_memory_4(ea + 4, VD.w[1]); - vm_write_memory_4(ea + 8, VD.w[2]); - vm_write_memory_4(ea + 12, VD.w[3]); -} - -/** - * Vector operations helpers - **/ - -#define VNONE op_VNONE -struct op_VNONE { - typedef null_operand type; - static INLINE uint32 get(powerpc_vr const & v, int i) { return 0; } - static INLINE void set(powerpc_vr const & v, int i, uint32) { } -}; - -#define V16QI op_V16QI -struct op_V16QI { - typedef uint8 type; - static INLINE type get(powerpc_vr const & v, int i) { return v.b[i]; } - static INLINE void set(powerpc_vr & v, int i, type x) { v.b[i] = x; } -}; - -#define V8HI op_V8HI -struct op_V8HI { - typedef uint16 type; - static INLINE type get(powerpc_vr const & v, int i) { return v.h[i]; } - static INLINE void set(powerpc_vr & v, int i, type x) { v.h[i] = x; } -}; - -#define V4SI op_V4SI -struct op_V4SI { - typedef uint32 type; - static INLINE type get(powerpc_vr const & v, int i) { return v.w[i]; } - static INLINE void set(powerpc_vr & v, int i, type x) { v.w[i] = x; } -}; - -#define V2DI op_V2DI -struct op_V2DI { - typedef uint64 type; - static INLINE type get(powerpc_vr const & v, int i) { return v.j[i]; } - static INLINE void set(powerpc_vr & v, int i, type x) { v.j[i] = x; } -}; - -#define V4SF op_V4SF -struct op_V4SF { - typedef float type; - static INLINE type get(powerpc_vr const & v, int i) { return v.f[i]; } - static INLINE void set(powerpc_vr & v, int i, type x) { v.f[i] = x; } -}; - -template< class OP, class VX, class VA, class VB, class VC, int N > -struct do_vector_execute { - static INLINE void apply() { - do_vector_execute::apply(); - VX::set( - VD, N, - op_apply::apply( - VA::get(V0, N), - VB::get(V1, N), - VC::get(V2, N))); - } -}; - -template< class OP, class VX, class VA, class VB, class VC > -struct do_vector_execute { - static INLINE void apply() { - VX::set( - VD, 0, op_apply::apply( - VA::get(V0, 0), - VB::get(V1, 0), - VC::get(V2, 0))); - } -}; - -template< class OP, class VX, class VA, class VB = VNONE, class VC = VNONE > -struct vector_execute { - static INLINE void apply() { - do_vector_execute::apply(); - } -}; - - -/** - * Vector synthetic operations - **/ - -void op_vaddfp_VD_V0_V1(void) -{ - vector_execute::apply(); -} - -void op_vsubfp_VD_V0_V1(void) -{ - vector_execute::apply(); -} - -void op_vmaddfp_VD_V0_V1_V2(void) -{ - vector_execute::apply(); -} - -#if defined(__i386__) && defined(__SSE__) -// Workaround gcc 3.2.2 miscompilation that inserts SSE instructions -struct op_do_vnmsubfp { - static INLINE float apply(float x, float y, float z) { -// return 0. - ((x * z) - y); - return y - (x * z); - } -}; -#else -typedef op_vnmsubfp op_do_vnmsubfp; -#endif - -void op_vnmsubfp_VD_V0_V1_V2(void) -{ - vector_execute::apply(); -} - -void op_vand_VD_V0_V1(void) -{ - vector_execute::apply(); -} - -void op_vandc_VD_V0_V1(void) -{ - vector_execute::apply(); -} - -void op_vnor_VD_V0_V1(void) -{ - vector_execute::apply(); -} - -void op_vor_VD_V0_V1(void) -{ - vector_execute::apply(); -} - -void op_vxor_VD_V0_V1(void) -{ - vector_execute::apply(); -} - -void op_record_cr6_VD(void) -{ - unsigned int cr6 = 0; -#if SIZEOF_VOID_P == 8 - if ((~VD.j[0] | ~VD.j[1]) == 0) - cr6 = 8; - else if ((VD.j[0] | VD.j[1]) == 0) - cr6 = 2; -#else - if ((~VD.w[0] | ~VD.w[1] | ~VD.w[2] | ~VD.w[3]) == 0) - cr6 = 8; - else if ((VD.w[0] | VD.w[1] | VD.w[2] | VD.w[3]) == 0) - cr6 = 2; -#endif - powerpc_dyngen_helper::cr().set(6, cr6); - dyngen_barrier(); -} - -void op_mfvscr_VD(void) -{ - VD.w[0] = 0; - VD.w[1] = 0; - VD.w[2] = 0; - VD.w[3] = powerpc_dyngen_helper::get_vscr(); -} - -void op_mtvscr_V0(void) -{ - powerpc_dyngen_helper::set_vscr(V0.w[3]); -} - -#undef VNONE -#undef V16QI -#undef V8HI -#undef V4SI -#undef V2DI -#undef V4SF - -/** - * X86 SIMD optimizations - **/ - -#if defined(__i386__) || defined(__x86_64__) -#undef VD -#undef V0 -#undef V1 -#undef V2 - -/* We are using GCC, so we can use its extensions */ -#if defined __MMX__ || __GNUC__ < 4 -#define __mmx_clobbers(reglist...) reglist -#else -#define __mmx_clobbers(reglist...) -#endif -#if defined __SSE__ || __GNUC__ < 4 -#define __sse_clobbers(reglist...) reglist -#else -#define __sse_clobbers(reglist...) -#endif - -// MMX instructions -void op_emms(void) -{ - asm volatile ("emms"); -} - -#define DEFINE_OP(NAME, OP, VA, VB) \ -void op_mmx_##NAME(void) \ -{ \ - asm volatile ("movq (%1),%%mm0\n" \ - "movq 8(%1),%%mm1\n" \ - #OP " (%2),%%mm0\n" \ - #OP " 8(%2),%%mm1\n" \ - "movq %%mm0,(%0)\n" \ - "movq %%mm1,8(%0)\n" \ - : : "r" (reg_VD), "r" (reg_##VA), "r" (reg_##VB) \ - : __mmx_clobbers("mm0", "mm1")); \ -} - -DEFINE_OP(vcmpequb, pcmpeqb, V0, V1); -DEFINE_OP(vcmpequh, pcmpeqw, V0, V1); -DEFINE_OP(vcmpequw, pcmpeqd, V0, V1); -DEFINE_OP(vcmpgtsb, pcmpgtb, V0, V1); -DEFINE_OP(vcmpgtsh, pcmpgtw, V0, V1); -DEFINE_OP(vcmpgtsw, pcmpgtd, V0, V1); -DEFINE_OP(vaddubm, paddb, V0, V1); -DEFINE_OP(vadduhm, paddw, V0, V1); -DEFINE_OP(vadduwm, paddd, V0, V1); -DEFINE_OP(vsububm, psubb, V0, V1); -DEFINE_OP(vsubuhm, psubw, V0, V1); -DEFINE_OP(vsubuwm, psubd, V0, V1); -DEFINE_OP(vand, pand, V0, V1); -DEFINE_OP(vandc, pandn, V1, V0); -DEFINE_OP(vor, por, V0, V1); -DEFINE_OP(vxor, pxor, V0, V1); -DEFINE_OP(vmaxub, pmaxub, V0, V1); -DEFINE_OP(vminub, pminub, V0, V1); -DEFINE_OP(vmaxsh, pmaxsw, V0, V1); -DEFINE_OP(vminsh, pminsw, V0, V1); - -#undef DEFINE_OP -#endif diff --git a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-dyngen.cpp b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-dyngen.cpp deleted file mode 100644 index 8d8451cb..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-dyngen.cpp +++ /dev/null @@ -1,313 +0,0 @@ -/* - * ppc-dyngen.cpp - PowerPC dynamic translation (low-level) - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" -#include "utils/utils-cpuinfo.hpp" -#include "cpu/ppc/ppc-dyngen.hpp" -#include "cpu/ppc/ppc-bitfields.hpp" -#include "cpu/ppc/ppc-instructions.hpp" - -#include -#include - -#define DYNGEN_IMPL 1 -#define DEFINE_GEN(NAME,RET,ARGS) RET powerpc_dyngen::NAME ARGS -#include "ppc-dyngen-ops.hpp" - -powerpc_dyngen::powerpc_dyngen(dyngen_cpu_base cpu) - : basic_dyngen(cpu) -{ -#ifdef SHEEPSHAVER - printf("Detected CPU features:"); - if (cpuinfo_check_mmx()) - printf(" MMX"); - if (cpuinfo_check_sse()) - printf(" SSE"); - if (cpuinfo_check_sse2()) - printf(" SSE2"); - if (cpuinfo_check_sse3()) - printf(" SSE3"); - if (cpuinfo_check_ssse3()) - printf(" SSSE3"); - if (cpuinfo_check_altivec()) - printf(" VMX"); - printf("\n"); -#endif -} - -uint8 *powerpc_dyngen::gen_start(uint32 pc) -{ - // Generate exit if there are pending spcflags - uint8 *p = basic_dyngen::gen_start(); - gen_op_spcflags_check(); - gen_op_set_PC_im(pc); - gen_exec_return(); - dg_set_jmp_target_noflush(jmp_addr[0], gen_align()); - jmp_addr[0] = NULL; - return p; -} - -void powerpc_dyngen::gen_compare_T0_T1(int crf) -{ - gen_op_compare_T0_T1(); - gen_store_T0_crf(crf); -} - -void powerpc_dyngen::gen_compare_T0_im(int crf, int32 value) -{ - if (value == 0) - gen_op_compare_T0_0(); - else - gen_op_compare_T0_im(value); - gen_store_T0_crf(crf); -} - -void powerpc_dyngen::gen_compare_logical_T0_T1(int crf) -{ - gen_op_compare_logical_T0_T1(); - gen_store_T0_crf(crf); -} - -void powerpc_dyngen::gen_compare_logical_T0_im(int crf, int32 value) -{ - if (value == 0) - gen_op_compare_logical_T0_0(); - else - gen_op_compare_logical_T0_im(value); - gen_store_T0_crf(crf); -} - -void powerpc_dyngen::gen_mtcrf_T0_im(uint32 mask) -{ - gen_op_mtcrf_T0_im(mask); -} - - -/** - * Load/store multiple words - **/ - -#define DEFINE_INSN(OP) \ -void powerpc_dyngen::gen_##OP##_T0(int r) \ -{ \ - switch (r) { \ - case 26: gen_op_##OP##_T0_26(); break; \ - case 27: gen_op_##OP##_T0_27(); break; \ - case 28: gen_op_##OP##_T0_28(); break; \ - case 29: gen_op_##OP##_T0_29(); break; \ - case 30: gen_op_##OP##_T0_30(); break; \ - case 31: gen_op_##OP##_T0_31(); break; \ - default: gen_op_##OP##_T0_im(r); break; \ - } \ -} - -DEFINE_INSN(lmw); -DEFINE_INSN(stmw); - -#undef DEFINE_INSN - - -/** - * Load/store registers - **/ - -#define DEFINE_INSN(OP, REG, REGT) \ -void powerpc_dyngen::gen_##OP##_##REG##_##REGT(int i) \ -{ \ - switch (i) { \ - case 0: gen_op_##OP##_##REG##_##REGT##0(); break; \ - case 1: gen_op_##OP##_##REG##_##REGT##1(); break; \ - case 2: gen_op_##OP##_##REG##_##REGT##2(); break; \ - case 3: gen_op_##OP##_##REG##_##REGT##3(); break; \ - case 4: gen_op_##OP##_##REG##_##REGT##4(); break; \ - case 5: gen_op_##OP##_##REG##_##REGT##5(); break; \ - case 6: gen_op_##OP##_##REG##_##REGT##6(); break; \ - case 7: gen_op_##OP##_##REG##_##REGT##7(); break; \ - case 8: gen_op_##OP##_##REG##_##REGT##8(); break; \ - case 9: gen_op_##OP##_##REG##_##REGT##9(); break; \ - case 10: gen_op_##OP##_##REG##_##REGT##10(); break; \ - case 11: gen_op_##OP##_##REG##_##REGT##11(); break; \ - case 12: gen_op_##OP##_##REG##_##REGT##12(); break; \ - case 13: gen_op_##OP##_##REG##_##REGT##13(); break; \ - case 14: gen_op_##OP##_##REG##_##REGT##14(); break; \ - case 15: gen_op_##OP##_##REG##_##REGT##15(); break; \ - case 16: gen_op_##OP##_##REG##_##REGT##16(); break; \ - case 17: gen_op_##OP##_##REG##_##REGT##17(); break; \ - case 18: gen_op_##OP##_##REG##_##REGT##18(); break; \ - case 19: gen_op_##OP##_##REG##_##REGT##19(); break; \ - case 20: gen_op_##OP##_##REG##_##REGT##20(); break; \ - case 21: gen_op_##OP##_##REG##_##REGT##21(); break; \ - case 22: gen_op_##OP##_##REG##_##REGT##22(); break; \ - case 23: gen_op_##OP##_##REG##_##REGT##23(); break; \ - case 24: gen_op_##OP##_##REG##_##REGT##24(); break; \ - case 25: gen_op_##OP##_##REG##_##REGT##25(); break; \ - case 26: gen_op_##OP##_##REG##_##REGT##26(); break; \ - case 27: gen_op_##OP##_##REG##_##REGT##27(); break; \ - case 28: gen_op_##OP##_##REG##_##REGT##28(); break; \ - case 29: gen_op_##OP##_##REG##_##REGT##29(); break; \ - case 30: gen_op_##OP##_##REG##_##REGT##30(); break; \ - case 31: gen_op_##OP##_##REG##_##REGT##31(); break; \ - default: abort(); \ - } \ -} - -// General purpose registers -DEFINE_INSN(load, T0, GPR); -DEFINE_INSN(load, T1, GPR); -DEFINE_INSN(load, T2, GPR); -DEFINE_INSN(store, T0, GPR); -DEFINE_INSN(store, T1, GPR); -DEFINE_INSN(store, T2, GPR); -DEFINE_INSN(load, F0, FPR); -DEFINE_INSN(load, F1, FPR); -DEFINE_INSN(load, F2, FPR); -DEFINE_INSN(store, F0, FPR); -DEFINE_INSN(store, F1, FPR); -DEFINE_INSN(store, F2, FPR); -DEFINE_INSN(store, FD, FPR); -DEFINE_INSN(load_ad, VD, VR); -DEFINE_INSN(load_ad, V0, VR); -DEFINE_INSN(load_ad, V1, VR); -DEFINE_INSN(load_ad, V2, VR); - -// Condition register bitfield -DEFINE_INSN(load, T0, crb); -DEFINE_INSN(load, T1, crb); -DEFINE_INSN(store, T0, crb); -DEFINE_INSN(store, T1, crb); - -#undef DEFINE_INSN - -// Floating point load store -#define DEFINE_OP(NAME, REG, TYPE) \ -void powerpc_dyngen::gen_##NAME##_##TYPE##_##REG##_T1_im(int32 offset) \ -{ \ - if (offset == 0) \ - gen_op_##NAME##_##TYPE##_##REG##_T1_0(); \ - else \ - gen_op_##NAME##_##TYPE##_##REG##_T1_im(offset); \ -} - -DEFINE_OP(load, FD, double); -DEFINE_OP(load, FD, single); -DEFINE_OP(store, F0, double); -DEFINE_OP(store, F0, single); - -#undef DEFINE_OP - -#define DEFINE_INSN(OP, REG) \ -void powerpc_dyngen::gen_##OP##_##REG##_crf(int crf) \ -{ \ - switch (crf) { \ - case 0: gen_op_##OP##_##REG##_cr0(); break; \ - case 1: gen_op_##OP##_##REG##_cr1(); break; \ - case 2: gen_op_##OP##_##REG##_cr2(); break; \ - case 3: gen_op_##OP##_##REG##_cr3(); break; \ - case 4: gen_op_##OP##_##REG##_cr4(); break; \ - case 5: gen_op_##OP##_##REG##_cr5(); break; \ - case 6: gen_op_##OP##_##REG##_cr6(); break; \ - case 7: gen_op_##OP##_##REG##_cr7(); break; \ - default: abort(); \ - } \ -} - -DEFINE_INSN(load, T0); -DEFINE_INSN(store, T0); - -#undef DEFINE_INSN - -void powerpc_dyngen::gen_bc(int bo, int bi, uint32 tpc, uint32 npc, bool direct_chaining) -{ - if (BO_CONDITIONAL_BRANCH(bo)) - gen_load_T1_crb(bi); - - switch (bo >> 1) { -#define _(A,B,C,D) (((A) << 3)| ((B) << 2) | ((C) << 1) | (D)) - case _(0,0,0,0): gen_op_prep_branch_bo_0000(); break; - case _(0,0,0,1): gen_op_prep_branch_bo_0001(); break; - case _(0,0,1,0): - case _(0,0,1,1): gen_op_prep_branch_bo_001x(); break; - case _(0,1,0,0): gen_op_prep_branch_bo_0100(); break; - case _(0,1,0,1): gen_op_prep_branch_bo_0101(); break; - case _(0,1,1,0): - case _(0,1,1,1): gen_op_prep_branch_bo_011x(); break; - case _(1,0,0,0): - case _(1,1,0,0): gen_op_prep_branch_bo_1x00(); break; - case _(1,0,0,1): - case _(1,1,0,1): gen_op_prep_branch_bo_1x01(); break; - case _(1,0,1,0): - case _(1,0,1,1): - case _(1,1,1,0): - case _(1,1,1,1): gen_op_prep_branch_bo_1x1x(); break; -#undef _ - default: abort(); - } - - if (BO_CONDITIONAL_BRANCH(bo) || BO_DECREMENT_CTR(bo)) { - // two-way branches - if (direct_chaining) - gen_op_branch_chain_2(); - else { - if (tpc != 0xffffffff) - gen_op_branch_2_im_im(tpc, npc); - else - gen_op_branch_2_T0_im(npc); - } - } - else { - // one-way branches - if (direct_chaining) - gen_op_branch_chain_1(); - else { - if (tpc != 0xffffffff) - gen_op_branch_1_im(tpc); - else - gen_op_branch_1_T0(); - } - } -} - -/** - * Vector instructions - **/ - -void powerpc_dyngen::gen_load_word_VD_T0(int vD) -{ - gen_load_ad_VD_VR(vD); - gen_op_load_word_VD_T0(); -} - -void powerpc_dyngen::gen_store_word_VS_T0(int vS) -{ - gen_load_ad_VD_VR(vS); - gen_op_store_word_VD_T0(); -} - -void powerpc_dyngen::gen_load_vect_VD_T0(int vD) -{ - gen_load_ad_VD_VR(vD); - gen_op_load_vect_VD_T0(); -} - -void powerpc_dyngen::gen_store_vect_VS_T0(int vS) -{ - gen_load_ad_VD_VR(vS); - gen_op_store_vect_VD_T0(); -} diff --git a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-dyngen.hpp b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-dyngen.hpp deleted file mode 100644 index 10af38fd..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-dyngen.hpp +++ /dev/null @@ -1,260 +0,0 @@ -/* - * ppc-dyngen.hpp - PowerPC dynamic translation (low-level) - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PPC_DYNGEN_H -#define PPC_DYNGEN_H - -#include "sysdeps.h" -#include "nvmemfun.hpp" -#include "cpu/ppc/ppc-config.hpp" - -#if PPC_ENABLE_JIT -#include "cpu/ppc/ppc-registers.hpp" -#include "cpu/jit/jit-config.hpp" -#include "cpu/jit/basic-dyngen.hpp" - -class powerpc_dyngen - : public basic_dyngen -{ -#ifndef REG_T3 - uintptr reg_T3; -#endif - -//#ifndef REG_F3 - powerpc_fpr reg_F3; -//#endif - - // Code generators for PowerPC synthetic instructions -#ifndef NO_DEFINE_ALIAS -# define DEFINE_GEN(NAME,RET,ARGS) RET NAME ARGS; -# include "ppc-dyngen-ops.hpp" -#endif - -public: - friend class powerpc_jit; - friend class powerpc_dyngen_helper; - - // Code generators - typedef nv_mem_fun_t< void, powerpc_dyngen > gen_handler_t; - - // Default constructor - powerpc_dyngen(dyngen_cpu_base cpu); - - // Generate prologue - uint8 *gen_start(uint32 pc); - - // Load/store registers - void gen_load_T0_GPR(int i); - void gen_load_T1_GPR(int i); - void gen_load_T2_GPR(int i); - void gen_store_T0_GPR(int i); - void gen_store_T1_GPR(int i); - void gen_store_T2_GPR(int i); - void gen_load_F0_FPR(int i); - void gen_load_F1_FPR(int i); - void gen_load_F2_FPR(int i); - void gen_store_FD_FPR(int i); - void gen_store_F0_FPR(int i); - void gen_store_F1_FPR(int i); - void gen_store_F2_FPR(int i); - - // Load/store multiple words - void gen_lmw_T0(int r); - void gen_stmw_T0(int r); - - // Raw aliases -#define DEFINE_ALIAS_RAW(NAME, PRE, POST, ARGLIST, ARGS) \ - void gen_##NAME ARGLIST { PRE; gen_op_##NAME ARGS; POST; } - -#define DEFINE_ALIAS_0(NAME,PRE,POST) DEFINE_ALIAS_RAW(NAME,PRE,POST,(),()) -#define DEFINE_ALIAS_1(NAME,PRE,POST) DEFINE_ALIAS_RAW(NAME,PRE,POST,(long p1),(p1)) -#define DEFINE_ALIAS_2(NAME,PRE,POST) DEFINE_ALIAS_RAW(NAME,PRE,POST,(long p1,long p2),(p1,p2)) -#define DEFINE_ALIAS_3(NAME,PRE,POST) DEFINE_ALIAS_RAW(NAME,PRE,POST,(long p1,long p2,long p3),(p1,p2,p3)) -#ifdef NO_DEFINE_ALIAS -#define DEFINE_ALIAS(NAME,N) -#else -#define DEFINE_ALIAS(NAME,N) DEFINE_ALIAS_##N(NAME,,) -#endif - - // Misc instructions -#if KPX_MAX_CPUS == 1 - DEFINE_ALIAS(lwarx_T0_T1,0); - DEFINE_ALIAS(stwcx_T0_T1,0); -#endif - DEFINE_ALIAS(inc_32_mem,1); - DEFINE_ALIAS(nego_T0,0); - DEFINE_ALIAS(dcbz_T0,0); - - // Condition registers - DEFINE_ALIAS(load_T0_CR,0); - DEFINE_ALIAS(store_T0_CR,0); - void gen_load_T0_crf(int crf); - void gen_store_T0_crf(int crf); - void gen_load_T0_crb(int i); - void gen_load_T1_crb(int i); - void gen_store_T0_crb(int i); - void gen_store_T1_crb(int i); - void gen_mtcrf_T0_im(uint32 mask); - - // Special purpose registers - DEFINE_ALIAS(load_T0_VRSAVE,0); - DEFINE_ALIAS(store_T0_VRSAVE,0); - DEFINE_ALIAS(load_T0_XER,0); - DEFINE_ALIAS(store_T0_XER,0); - DEFINE_ALIAS(load_T0_PC,0); - DEFINE_ALIAS(store_T0_PC,0); - DEFINE_ALIAS(set_PC_im,1); - DEFINE_ALIAS(set_PC_T0,0); - DEFINE_ALIAS(inc_PC,1); - DEFINE_ALIAS(load_T0_LR,0); - DEFINE_ALIAS(store_T0_LR,0); - DEFINE_ALIAS(load_T0_CTR,0); - DEFINE_ALIAS(load_T0_CTR_aligned,0); - DEFINE_ALIAS(store_T0_CTR,0); - DEFINE_ALIAS(load_T0_LR_aligned,0); - DEFINE_ALIAS(store_im_LR,1); - - DEFINE_ALIAS(spcflags_init,1); - DEFINE_ALIAS(spcflags_set,1); - DEFINE_ALIAS(spcflags_clear,1); - - // Control Flow - DEFINE_ALIAS(jump_next_A0,0); - - // Compare & Record instructions - DEFINE_ALIAS(record_cr0_T0,0); - DEFINE_ALIAS(record_cr1,0); - void gen_compare_T0_T1(int crf); - void gen_compare_T0_im(int crf, int32 value); - void gen_compare_logical_T0_T1(int crf); - void gen_compare_logical_T0_im(int crf, int32 value); - - // Multiply/Divide instructions - DEFINE_ALIAS(mulhw_T0_T1,0); - DEFINE_ALIAS(mulhwu_T0_T1,0); - DEFINE_ALIAS(mulli_T0_im,1); - DEFINE_ALIAS(mullwo_T0_T1,0); - DEFINE_ALIAS(divw_T0_T1,0); - DEFINE_ALIAS(divwo_T0_T1,0); - DEFINE_ALIAS(divwu_T0_T1,0); - DEFINE_ALIAS(divwuo_T0_T1,0); - - // Shift/Rotate instructions - DEFINE_ALIAS(slw_T0_T1,0); - DEFINE_ALIAS(srw_T0_T1,0); - DEFINE_ALIAS(sraw_T0_T1,0); - DEFINE_ALIAS(sraw_T0_im,1); - DEFINE_ALIAS(rlwimi_T0_T1,2); - DEFINE_ALIAS(rlwinm_T0_T1,2); - DEFINE_ALIAS(rlwnm_T0_T1,1); - DEFINE_ALIAS(cntlzw_32_T0,0); - - // Add/Sub related instructions - DEFINE_ALIAS(addo_T0_T1,0); - DEFINE_ALIAS(addc_T0_im,1); - DEFINE_ALIAS(addc_T0_T1,0); - DEFINE_ALIAS(addco_T0_T1,0); - DEFINE_ALIAS(adde_T0_T1,0); - DEFINE_ALIAS(addeo_T0_T1,0); - DEFINE_ALIAS(addme_T0,0); - DEFINE_ALIAS(addmeo_T0,0); - DEFINE_ALIAS(addze_T0,0); - DEFINE_ALIAS(addzeo_T0,0); - DEFINE_ALIAS(subf_T0_T1,0); - DEFINE_ALIAS(subfo_T0_T1,0); - DEFINE_ALIAS(subfc_T0_im,1); - DEFINE_ALIAS(subfc_T0_T1,0); - DEFINE_ALIAS(subfco_T0_T1,0); - DEFINE_ALIAS(subfe_T0_T1,0); - DEFINE_ALIAS(subfeo_T0_T1,0); - DEFINE_ALIAS(subfme_T0,0); - DEFINE_ALIAS(subfmeo_T0,0); - DEFINE_ALIAS(subfze_T0,0); - DEFINE_ALIAS(subfzeo_T0,0); - - // Double-precision floating point operations - DEFINE_ALIAS(fmov_F0_F1,0); - DEFINE_ALIAS(fmov_F0_F2,0); - DEFINE_ALIAS(fmov_F1_F0,0); - DEFINE_ALIAS(fmov_F1_F2,0); - DEFINE_ALIAS(fmov_F2_F0,0); - DEFINE_ALIAS(fmov_F2_F1,0); - DEFINE_ALIAS(fmov_FD_F0,0); - DEFINE_ALIAS(fmov_FD_F1,0); - DEFINE_ALIAS(fmov_FD_F2,0); - DEFINE_ALIAS(fabs_FD_F0,0); - DEFINE_ALIAS(fneg_FD_F0,0); - DEFINE_ALIAS(fnabs_FD_F0,0); - DEFINE_ALIAS(fadd_FD_F0_F1,0); - DEFINE_ALIAS(fsub_FD_F0_F1,0); - DEFINE_ALIAS(fmul_FD_F0_F1,0); - DEFINE_ALIAS(fdiv_FD_F0_F1,0); - DEFINE_ALIAS(fmadd_FD_F0_F1_F2,0); - DEFINE_ALIAS(fmsub_FD_F0_F1_F2,0); - DEFINE_ALIAS(fnmadd_FD_F0_F1_F2,0); - DEFINE_ALIAS(fnmsub_FD_F0_F1_F2,0); - - // Single-precision floating point operations - DEFINE_ALIAS(fadds_FD_F0_F1,0); - DEFINE_ALIAS(fsubs_FD_F0_F1,0); - DEFINE_ALIAS(fmuls_FD_F0_F1,0); - DEFINE_ALIAS(fdivs_FD_F0_F1,0); - DEFINE_ALIAS(fmadds_FD_F0_F1_F2,0); - DEFINE_ALIAS(fmsubs_FD_F0_F1_F2,0); - DEFINE_ALIAS(fnmadds_FD_F0_F1_F2,0); - DEFINE_ALIAS(fnmsubs_FD_F0_F1_F2,0); - - // Load/store floating point data - DEFINE_ALIAS(load_double_FD_T1_T2,0); - void gen_load_double_FD_T1_im(int32 offset); - DEFINE_ALIAS(load_single_FD_T1_T2,0); - void gen_load_single_FD_T1_im(int32 offset); - DEFINE_ALIAS(store_double_F0_T1_T2,0); - void gen_store_double_F0_T1_im(int32 offset); - DEFINE_ALIAS(store_single_F0_T1_T2,0); - void gen_store_single_F0_T1_im(int32 offset); - - // Branch instructions - void gen_bc(int bo, int bi, uint32 tpc, uint32 npc, bool direct_chaining); - - // Vector instructions - void gen_load_ad_VD_VR(int i); - void gen_load_ad_V0_VR(int i); - void gen_load_ad_V1_VR(int i); - void gen_load_ad_V2_VR(int i); - void gen_load_word_VD_T0(int vD); - void gen_load_vect_VD_T0(int vD); - void gen_store_word_VS_T0(int vS); - void gen_store_vect_VS_T0(int vS); - DEFINE_ALIAS(record_cr6_VD,0); - DEFINE_ALIAS(mfvscr_VD,0); - DEFINE_ALIAS(mtvscr_V0,0); - -#undef DEFINE_ALIAS -#undef DEFINE_ALIAS_0 -#undef DEFINE_ALIAS_1 -#undef DEFINE_ALIAS_2 -#undef DEFINE_ALIAS_3 -#undef DEFINE_ALIAS_RAW -}; - -#endif /* PPC_ENABLE_JIT */ - -#endif /* PPC_DYNGEN_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-execute.cpp b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-execute.cpp deleted file mode 100644 index 26e98533..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-execute.cpp +++ /dev/null @@ -1,1787 +0,0 @@ -/* - * ppc-execute.cpp - PowerPC semantics - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" - -#include -#include -#include - -#include "cpu/vm.hpp" -#include "cpu/ppc/ppc-cpu.hpp" -#include "cpu/ppc/ppc-bitfields.hpp" -#include "cpu/ppc/ppc-operands.hpp" -#include "cpu/ppc/ppc-operations.hpp" -#include "cpu/ppc/ppc-execute.hpp" - -#ifndef SHEEPSHAVER -#include "basic-kernel.hpp" -#endif - -#ifdef SHEEPSHAVER -#include "main.h" -#include "prefs.h" -#endif - -#if ENABLE_MON -#include "mon.h" -#include "mon_disass.h" -#endif - -#define DEBUG 0 -#include "debug.h" - -/** - * Illegal & NOP instructions - **/ - -void powerpc_cpu::execute_illegal(uint32 opcode) -{ - fprintf(stderr, "Illegal instruction at %08x, opcode = %08x\n", pc(), opcode); - -#ifdef SHEEPSHAVER - if (PrefsFindBool("ignoreillegal")) { - increment_pc(4); - return; - } -#endif - -#if ENABLE_MON - disass_ppc(stdout, pc(), opcode); - - // Start up mon in real-mode - char *arg[4] = {"mon", "-m", "-r", NULL}; - mon(3, arg); -#endif - abort(); -} - -void powerpc_cpu::execute_nop(uint32 opcode) -{ - increment_pc(4); -} - -/** - * Floating-point rounding modes conversion - **/ - -static inline int ppc_to_native_rounding_mode(int round) -{ - switch (round) { - case 0: return FE_TONEAREST; - case 1: return FE_TOWARDZERO; - case 2: return FE_UPWARD; - case 3: return FE_DOWNWARD; - } -} - -static inline int native_to_ppc_rounding_mode(int round) -{ - switch (round) { - case FE_TONEAREST: return 0; - case FE_TOWARDZERO: return 1; - case FE_UPWARD: return 2; - case FE_DOWNWARD: return 3; - } -} - -/** - * Helper class to compute the overflow/carry condition - * - * OP Operation to perform - */ - -template< class OP > -struct op_carry { - static inline bool apply(uint32, uint32, uint32) { - return false; - } -}; - -template<> -struct op_carry { - static inline bool apply(uint32 a, uint32 b, uint32 c) { - // TODO: use 32-bit arithmetics - uint64 carry = (uint64)a + (uint64)b + (uint64)c; - return (carry >> 32) != 0; - } -}; - -template< class OP > -struct op_overflow { - static inline bool apply(uint32, uint32, uint32) { - return false; - } -}; - -template<> -struct op_overflow { - static inline bool apply(uint32 a, uint32, uint32) { - return a == 0x80000000; - }; -}; - -template<> -struct op_overflow { - static inline bool apply(uint32 a, uint32 b, uint32 c) { - // TODO: use 32-bit arithmetics - int64 overflow = (int64)(int32)a + (int64)(int32)b + (int64)(int32)c; - return (((uint64)overflow) >> 63) ^ (((uint32)overflow) >> 31); - } -}; - -/** - * Perform an addition/substraction - * - * RA Input operand register, possibly 0 - * RB Input operand either register or immediate - * RC Input carry - * CA Predicate to compute the carry out of the operation - * OE Predicate to compute the overflow flag - * Rc Predicate to record CR0 - **/ - -template< class RA, class RB, class RC, class CA, class OE, class Rc > -void powerpc_cpu::execute_addition(uint32 opcode) -{ - const uint32 a = RA::get(this, opcode); - const uint32 b = RB::get(this, opcode); - const uint32 c = RC::get(this, opcode); - uint32 d = a + b + c; - - // Set XER (CA) if instruction affects carry bit - if (CA::test(opcode)) - xer().set_ca(op_carry::apply(a, b, c)); - - // Set XER (OV, SO) if instruction has OE set - if (OE::test(opcode)) - xer().set_ov(op_overflow::apply(a, b, c)); - - // Set CR0 (LT, GT, EQ, SO) if instruction has Rc set - if (Rc::test(opcode)) - record_cr0((int32)d); - - // Commit result to output operand - operand_RD::set(this, opcode, d); - - increment_pc(4); -} - -/** - * Generic arithmetic instruction - * - * OP Operation to perform - * RD Output register - * RA Input operand register - * RB Input operand register or immediate (optional: operand_NONE) - * RC Input operand register or immediate (optional: operand_NONE) - * OE Predicate to compute overflow flag - * Rc Predicate to record CR0 - **/ - -template< class OP, class RD, class RA, class RB, class RC, class OE, class Rc > -void powerpc_cpu::execute_generic_arith(uint32 opcode) -{ - const uint32 a = RA::get(this, opcode); - const uint32 b = RB::get(this, opcode); - const uint32 c = RC::get(this, opcode); - - uint32 d = op_apply::apply(a, b, c); - - // Set XER (OV, SO) if instruction has OE set - if (OE::test(opcode)) - xer().set_ov(op_overflow::apply(a, b, c)); - - // Set CR0 (LT, GT, EQ, SO) if instruction has Rc set - if (Rc::test(opcode)) - record_cr0((int32)d); - - // commit result to output operand - RD::set(this, opcode, d); - - increment_pc(4); -} - -/** - * Rotate Left Word Immediate then Mask Insert - * - * SH Shift count - * MA Mask value - * Rc Predicate to record CR0 - **/ - -template< class SH, class MA, class Rc > -void powerpc_cpu::execute_rlwimi(uint32 opcode) -{ - const uint32 n = SH::get(this, opcode); - const uint32 m = MA::get(this, opcode); - const uint32 rs = operand_RS::get(this, opcode); - const uint32 ra = operand_RA::get(this, opcode); - uint32 d = op_ppc_rlwimi::apply(rs, n, m, ra); - - // Set CR0 (LT, GT, EQ, SO) if instruction has Rc set - if (Rc::test(opcode)) - record_cr0((int32)d); - - // Commit result to output operand - operand_RA::set(this, opcode, d); - - increment_pc(4); -} - -/** - * Shift instructions - * - * OP Operation to perform - * RD Output operand - * RA Source operand - * SH Shift count - * SO Shift operation - * CA Predicate to compute carry bit - * Rc Predicate to record CR0 - **/ - -template< class OP > -struct invalid_shift { - static inline uint32 value(uint32) { - return 0; - } -}; - -template<> -struct invalid_shift { - static inline uint32 value(uint32 r) { - return 0 - (r >> 31); - } -}; - -template< class OP, class RD, class RA, class SH, class SO, class CA, class Rc > -void powerpc_cpu::execute_shift(uint32 opcode) -{ - const uint32 n = SO::apply(SH::get(this, opcode)); - const uint32 r = RA::get(this, opcode); - uint32 d; - - // Shift operation is valid only if rB[26] = 0 - if (n & 0x20) { - d = invalid_shift::value(r); - if (CA::test(opcode)) - xer().set_ca(d >> 31); - } - else { - d = OP::apply(r, n); - if (CA::test(opcode)) { - const uint32 ca = (r & 0x80000000) && (r & ~(0xffffffff << n)); - xer().set_ca(ca); - } - } - - // Set CR0 (LT, GT, EQ, SO) if instruction has Rc set - if (Rc::test(opcode)) - record_cr0((int32)d); - - // Commit result to output operand - RD::set(this, opcode, d); - - increment_pc(4); -} - -/** - * Branch conditional instructions - * - * PC Input program counter (PC, LR, CTR) - * BO BO operand - * DP Displacement operand - * AA Predicate for absolute address - * LK Predicate to record NPC into link register - **/ - -template< class PC, class BO, class DP, class AA, class LK > -void powerpc_cpu::execute_branch(uint32 opcode) -{ - const int bo = BO::get(this, opcode); - bool ctr_ok = true; - bool cond_ok = true; - - if (BO_CONDITIONAL_BRANCH(bo)) { - cond_ok = cr().test(BI_field::extract(opcode)); - if (!BO_BRANCH_IF_TRUE(bo)) - cond_ok = !cond_ok; - } - - if (BO_DECREMENT_CTR(bo)) { - ctr_ok = (ctr() -= 1) == 0; - if (!BO_BRANCH_IF_CTR_ZERO(bo)) - ctr_ok = !ctr_ok; - } - - const uint32 npc = pc() + 4; - if (ctr_ok && cond_ok) - pc() = ((AA::test(opcode) ? 0 : PC::get(this, opcode)) + DP::get(this, opcode)) & -4; - else - pc() = npc; - - if (LK::test(opcode)) - lr() = npc; -} - -/** - * Compare instructions - * - * RB Second operand (GPR, SIMM, UIMM) - * CT Type of variables to be compared (uint32, int32) - **/ - -template< class RB, typename CT > -void powerpc_cpu::execute_compare(uint32 opcode) -{ - const uint32 a = operand_RA::get(this, opcode); - const uint32 b = RB::get(this, opcode); - const uint32 crfd = crfD_field::extract(opcode); - record_cr(crfd, (CT)a < (CT)b ? -1 : ((CT)a > (CT)b ? +1 : 0)); - increment_pc(4); -} - -/** - * Operations on condition register - * - * OP Operation to perform - **/ - -template< class OP > -void powerpc_cpu::execute_cr_op(uint32 opcode) -{ - const uint32 crbA = crbA_field::extract(opcode); - uint32 a = (cr().get() >> (31 - crbA)) & 1; - const uint32 crbB = crbB_field::extract(opcode); - uint32 b = (cr().get() >> (31 - crbB)) & 1; - const uint32 crbD = crbD_field::extract(opcode); - uint32 d = OP::apply(a, b) & 1; - cr().set((cr().get() & ~(1 << (31 - crbD))) | (d << (31 - crbD))); - increment_pc(4); -} - -/** - * Divide instructions - * - * SB Signed division - * OE Predicate to compute overflow - * Rc Predicate to record CR0 - **/ - -template< bool SB, class OE, class Rc > -void powerpc_cpu::execute_divide(uint32 opcode) -{ - const uint32 a = operand_RA::get(this, opcode); - const uint32 b = operand_RB::get(this, opcode); - uint32 d; - - // Specialize divide semantic action - if (OE::test(opcode)) - d = do_execute_divide(a, b); - else - d = do_execute_divide(a, b); - - // Set CR0 (LT, GT, EQ, SO) if instruction has Rc set - if (Rc::test(opcode)) - record_cr0((int32)d); - - // Commit result to output operand - operand_RD::set(this, opcode, d); - - increment_pc(4); -} - -/** - * Multiply instructions - * - * HI Predicate for multiply high word - * SB Predicate for signed operation - * OE Predicate to compute overflow - * Rc Predicate to record CR0 - **/ - -template< bool HI, bool SB, class OE, class Rc > -void powerpc_cpu::execute_multiply(uint32 opcode) -{ - const uint32 a = operand_RA::get(this, opcode); - const uint32 b = operand_RB::get(this, opcode); - uint64 d = SB ? (int64)(int32)a * (int64)(int32)b : (uint64)a * (uint64)b; - - // Overflow if the product cannot be represented in 32 bits - if (OE::test(opcode)) { - xer().set_ov((d & UVAL64(0xffffffff80000000)) != 0 && - (d & UVAL64(0xffffffff80000000)) != UVAL64(0xffffffff80000000)); - } - - // Only keep high word if multiply high instruction - if (HI) - d >>= 32; - - // Set CR0 (LT, GT, EQ, SO) if instruction has Rc set - if (Rc::test(opcode)) - record_cr0((uint32)d); - - // Commit result to output operand - operand_RD::set(this, opcode, (uint32)d); - - increment_pc(4); -} - -/** - * Record FPSCR - * - * Update FP exception bits - **/ - -void powerpc_cpu::record_fpscr(int exceptions) -{ -#if PPC_ENABLE_FPU_EXCEPTIONS - // Reset non-sticky bits - fpscr() &= ~(FPSCR_VX_field::mask() | FPSCR_FEX_field::mask()); - - // Always update FX if any exception bit was set - if (exceptions) - fpscr() |= FPSCR_FX_field::mask() | exceptions; - - // Always update VX - if (fpscr() & (FPSCR_VXSNAN_field::mask() | FPSCR_VXISI_field::mask() | - FPSCR_VXISI_field::mask() | FPSCR_VXIDI_field::mask() | - FPSCR_VXZDZ_field::mask() | FPSCR_VXIMZ_field::mask() | - FPSCR_VXVC_field::mask() | FPSCR_VXSOFT_field::mask() | - FPSCR_VXSQRT_field::mask() | FPSCR_VXCVI_field::mask())) - fpscr() |= FPSCR_VX_field::mask(); - - // Always update FEX - if (((fpscr() & FPSCR_VX_field::mask()) && (fpscr() & FPSCR_VE_field::mask())) || - ((fpscr() & FPSCR_OX_field::mask()) && (fpscr() & FPSCR_OE_field::mask())) || - ((fpscr() & FPSCR_UX_field::mask()) && (fpscr() & FPSCR_UE_field::mask())) || - ((fpscr() & FPSCR_ZX_field::mask()) && (fpscr() & FPSCR_ZE_field::mask())) || - ((fpscr() & FPSCR_XX_field::mask()) && (fpscr() & FPSCR_XE_field::mask()))) - fpscr() |= FPSCR_FEX_field::mask(); -#endif -} - -/** - * Floating-point arithmetics - * - * FP Floating Point type - * OP Operation to perform - * RD Output register - * RA Input operand - * RB Input operand (optional) - * RC Input operand (optional) - * Rc Predicate to record CR1 - * FPSCR Predicate to compute FPSCR bits - **/ - -template< class FP, class OP, class RD, class RA, class RB, class RC, class Rc, bool FPSCR > -void powerpc_cpu::execute_fp_arith(uint32 opcode) -{ - const double a = RA::get(this, opcode); - const double b = RB::get(this, opcode); - const double c = RC::get(this, opcode); - -#if PPC_ENABLE_FPU_EXCEPTIONS - int exceptions; - if (FPSCR) { - exceptions = op_apply, RA, RB, RC>::apply(a, b, c); - feclearexcept(FE_ALL_EXCEPT); - febarrier(); - } -#endif - - FP d = op_apply::apply(a, b, c); - - if (FPSCR) { - - // Update FPSCR exception bits -#if PPC_ENABLE_FPU_EXCEPTIONS - febarrier(); - int raised = fetestexcept(FE_ALL_EXCEPT); - if (raised & FE_INEXACT) - exceptions |= FPSCR_XX_field::mask(); - if (raised & FE_DIVBYZERO) - exceptions |= FPSCR_ZX_field::mask(); - if (raised & FE_UNDERFLOW) - exceptions |= FPSCR_UX_field::mask(); - if (raised & FE_OVERFLOW) - exceptions |= FPSCR_OX_field::mask(); - record_fpscr(exceptions); -#endif - - // FPSCR[FPRF] is set to the class and sign of the result - if (!FPSCR_VE_field::test(fpscr())) - fp_classify(d); - } - - // Set CR1 (FX, FEX, VX, VOX) if instruction has Rc set - if (Rc::test(opcode)) - record_cr1(); - - // Commit result to output operand - RD::set(this, opcode, d); - increment_pc(4); -} - -/** - * Load/store instructions - * - * OP Operation to perform on loaded value - * RA Base operand - * RB Displacement (GPR(RB), EXTS(d)) - * LD Load operation? - * SZ Size of load/store operation - * UP Update RA with EA - * RX Reverse operand - **/ - -template< int SZ, bool RX > -struct memory_helper; - -#define DEFINE_MEMORY_HELPER(SIZE) \ -template< bool RX > \ -struct memory_helper \ -{ \ - static inline uint32 load(uint32 ea) { \ - return RX ? vm_read_memory_##SIZE##_reversed(ea) : vm_read_memory_##SIZE(ea); \ - } \ - static inline void store(uint32 ea, uint32 value) { \ - RX ? vm_write_memory_##SIZE##_reversed(ea, value) : vm_write_memory_##SIZE(ea, value); \ - } \ -} - -DEFINE_MEMORY_HELPER(1); -DEFINE_MEMORY_HELPER(2); -DEFINE_MEMORY_HELPER(4); - -template< class OP, class RA, class RB, bool LD, int SZ, bool UP, bool RX > -void powerpc_cpu::execute_loadstore(uint32 opcode) -{ - const uint32 a = RA::get(this, opcode); - const uint32 b = RB::get(this, opcode); - const uint32 ea = a + b; - - if (LD) - operand_RD::set(this, opcode, OP::apply(memory_helper::load(ea))); - else - memory_helper::store(ea, operand_RS::get(this, opcode)); - - if (UP) - RA::set(this, opcode, ea); - - increment_pc(4); -} - -template< class RA, class DP, bool LD > -void powerpc_cpu::execute_loadstore_multiple(uint32 opcode) -{ - const uint32 a = RA::get(this, opcode); - const uint32 d = DP::get(this, opcode); - uint32 ea = a + d; - - // FIXME: generate exception if ea is not word-aligned - if ((ea & 3) != 0) { -#ifdef SHEEPSHAVER - D(bug("unaligned load/store multiple to %08x\n", ea)); - increment_pc(4); - return; -#else - abort(); -#endif - } - - int r = LD ? rD_field::extract(opcode) : rS_field::extract(opcode); - while (r <= 31) { - if (LD) - gpr(r) = vm_read_memory_4(ea); - else - vm_write_memory_4(ea, gpr(r)); - r++; - ea += 4; - } - - increment_pc(4); -} - -/** - * Floating-point load/store instructions - * - * RA Base operand - * RB Displacement (GPR(RB), EXTS(d)) - * LD Load operation? - * DB Predicate for double value - * UP Predicate to update RA with EA - **/ - -template< class RA, class RB, bool LD, bool DB, bool UP > -void powerpc_cpu::execute_fp_loadstore(uint32 opcode) -{ - const uint32 a = RA::get(this, opcode); - const uint32 b = RB::get(this, opcode); - const uint32 ea = a + b; - uint64 v; - - if (LD) { - if (DB) - v = vm_read_memory_8(ea); - else - v = fp_load_single_convert(vm_read_memory_4(ea)); - operand_fp_dw_RD::set(this, opcode, v); - } - else { - v = operand_fp_dw_RS::get(this, opcode); - if (DB) - vm_write_memory_8(ea, v); - else - vm_write_memory_4(ea, fp_store_single_convert(v)); - } - - if (UP) - RA::set(this, opcode, ea); - - increment_pc(4); -} - -/** - * Load/Store String Word instruction - * - * RA Input operand as base EA - * IM lswi mode? - * NB Number of bytes to transfer - **/ - -template< class RA, bool IM, class NB > -void powerpc_cpu::execute_load_string(uint32 opcode) -{ - uint32 ea = RA::get(this, opcode); - if (!IM) - ea += operand_RB::get(this, opcode); - - int nb = NB::get(this, opcode); - if (IM && nb == 0) - nb = 32; - - int rd = rD_field::extract(opcode); -#if 1 - int i; - for (i = 0; nb - i >= 4; i += 4, rd = (rd + 1) & 0x1f) - gpr(rd) = vm_read_memory_4(ea + i); - switch (nb - i) { - case 1: - gpr(rd) = vm_read_memory_1(ea + i) << 24; - break; - case 2: - gpr(rd) = vm_read_memory_2(ea + i) << 16; - break; - case 3: - gpr(rd) = (vm_read_memory_2(ea + i) << 16) + (vm_read_memory_1(ea + i + 2) << 8); - break; - } -#else - for (int i = 0; i < nb; i++) { - switch (i & 3) { - case 0: - gpr(rd) = vm_read_memory_1(ea + i) << 24; - break; - case 1: - gpr(rd) = (gpr(rd) & 0xff00ffff) | (vm_read_memory_1(ea + i) << 16); - break; - case 2: - gpr(rd) = (gpr(rd) & 0xffff00ff) | (vm_read_memory_1(ea + i) << 8); - break; - case 3: - gpr(rd) = (gpr(rd) & 0xffffff00) | vm_read_memory_1(ea + i); - rd = (rd + 1) & 0x1f; - break; - } - } -#endif - - increment_pc(4); -} - -template< class RA, bool IM, class NB > -void powerpc_cpu::execute_store_string(uint32 opcode) -{ - uint32 ea = RA::get(this, opcode); - if (!IM) - ea += operand_RB::get(this, opcode); - - int nb = NB::get(this, opcode); - if (IM && nb == 0) - nb = 32; - - int rs = rS_field::extract(opcode); - int sh = 24; - for (int i = 0; i < nb; i++) { - vm_write_memory_1(ea + i, gpr(rs) >> sh); - sh -= 8; - if (sh < 0) { - sh = 24; - rs = (rs + 1) & 0x1f; - } - } - - increment_pc(4); -} - -/** - * Load Word and Reserve Indexed / Store Word Conditional Indexed - * - * RA Input operand as base EA - **/ - -template< class RA > -void powerpc_cpu::execute_lwarx(uint32 opcode) -{ - const uint32 ea = RA::get(this, opcode) + operand_RB::get(this, opcode); - uint32 reserve_data = vm_read_memory_4(ea); - regs().reserve_valid = 1; - regs().reserve_addr = ea; -#if KPX_MAX_CPUS != 1 - regs().reserve_data = reserve_data; -#endif - operand_RD::set(this, opcode, reserve_data); - increment_pc(4); -} - -template< class RA > -void powerpc_cpu::execute_stwcx(uint32 opcode) -{ - const uint32 ea = RA::get(this, opcode) + operand_RB::get(this, opcode); - cr().clear(0); - if (regs().reserve_valid) { - if (regs().reserve_addr == ea /* physical_addr(EA) */ -#if KPX_MAX_CPUS != 1 - /* HACK: if another processor wrote to the reserved block, - nothing happens, i.e. we should operate as if reserve == 0 */ - && regs().reserve_data == vm_read_memory_4(ea) -#endif - ) { - vm_write_memory_4(ea, operand_RS::get(this, opcode)); - cr().set(0, standalone_CR_EQ_field::mask()); - } - regs().reserve_valid = 0; - } - cr().set_so(0, xer().get_so()); - increment_pc(4); -} - -/** - * Floating-point compare instruction - * - * OC Predicate for ordered compare - **/ - -template< bool OC > -void powerpc_cpu::execute_fp_compare(uint32 opcode) -{ - const double a = operand_fp_RA::get(this, opcode); - const double b = operand_fp_RB::get(this, opcode); - const int crfd = crfD_field::extract(opcode); - int c; - - if (is_NaN(a) || is_NaN(b)) - c = 1; - else if (isless(a, b)) - c = 8; - else if (isgreater(a, b)) - c = 4; - else - c = 2; - - FPSCR_FPCC_field::insert(fpscr(), c); - cr().set(crfd, c); - - // Update FPSCR exception bits -#if PPC_ENABLE_FPU_EXCEPTIONS - int exceptions = 0; - if (is_SNaN(a) || is_SNaN(b)) { - exceptions |= FPSCR_VXSNAN_field::mask(); - if (OC && !FPSCR_VE_field::test(fpscr())) - exceptions |= FPSCR_VXVC_field::mask(); - } - else if (OC && (is_QNaN(a) || is_QNaN(b))) - exceptions |= FPSCR_VXVC_field::mask(); - record_fpscr(exceptions); -#endif - - increment_pc(4); -} - -/** - * Floating Convert to Integer Word instructions - * - * RN Rounding mode - * Rc Predicate to record CR1 - **/ - -template< class RN, class Rc > -void powerpc_cpu::execute_fp_int_convert(uint32 opcode) -{ - const double b = operand_fp_RB::get(this, opcode); - const uint32 r = RN::get(this, opcode); - any_register d; - -#if PPC_ENABLE_FPU_EXCEPTIONS - int exceptions = 0; - if (is_NaN(b)) { - exceptions |= FPSCR_VXCVI_field::mask(); - if (is_SNaN(b)) - exceptions |= FPSCR_VXSNAN_field::mask(); - } - if (isinf(b)) - exceptions |= FPSCR_VXCVI_field::mask(); - - feclearexcept(FE_ALL_EXCEPT); - febarrier(); -#endif - - // Convert to integer word if operand fits bounds - if (b >= -(double)0x80000000 && b <= (double)0x7fffffff) { -#if defined mathlib_lrint - int old_round = fegetround(); - fesetround(ppc_to_native_rounding_mode(r)); - d.j = (int32)mathlib_lrint(b); - fesetround(old_round); -#else - switch (r) { - case 0: d.j = (int32)op_frin::apply(b); break; // near - case 1: d.j = (int32)op_friz::apply(b); break; // zero - case 2: d.j = (int32)op_frip::apply(b); break; // +inf - case 3: d.j = (int32)op_frim::apply(b); break; // -inf - } -#endif - } - - // NOTE: this catches infinity and NaN operands - else if (b > 0) - d.j = 0x7fffffff; - else - d.j = 0x80000000; - - // Update FPSCR exception bits -#if PPC_ENABLE_FPU_EXCEPTIONS - febarrier(); - int raised = fetestexcept(FE_ALL_EXCEPT); - if (raised & FE_UNDERFLOW) - exceptions |= FPSCR_UX_field::mask(); - if (raised & FE_INEXACT) - exceptions |= FPSCR_XX_field::mask(); - record_fpscr(exceptions); -#endif - - // Set CR1 (FX, FEX, VX, VOX) if instruction has Rc set - if (Rc::test(opcode)) - record_cr1(); - - // Commit result to output operand - operand_fp_RD::set(this, opcode, d.d); - increment_pc(4); -} - -/** - * Floating-point Round to Single - * - * Rc Predicate to record CR1 - **/ - -template< class FP > -void powerpc_cpu::fp_classify(FP x) -{ - uint32 c = fpscr() & ~FPSCR_FPRF_field::mask(); - uint8 fc = fpclassify(x); - switch (fc) { - case FP_NAN: - c |= FPSCR_FPRF_FU_field::mask() | FPSCR_FPRF_C_field::mask(); - break; - case FP_ZERO: - c |= FPSCR_FPRF_FE_field::mask(); - if (signbit(x)) - c |= FPSCR_FPRF_C_field::mask(); - break; - case FP_INFINITE: - c |= FPSCR_FPRF_FU_field::mask(); - goto FL_FG_field; - case FP_SUBNORMAL: - c |= FPSCR_FPRF_C_field::mask(); - // fall-through - case FP_NORMAL: - FL_FG_field: - if (x < 0) - c |= FPSCR_FPRF_FL_field::mask(); - else - c |= FPSCR_FPRF_FG_field::mask(); - break; - } - fpscr() = c; -} - -template< class Rc > -void powerpc_cpu::execute_fp_round(uint32 opcode) -{ - const double b = operand_fp_RB::get(this, opcode); - -#if PPC_ENABLE_FPU_EXCEPTIONS - int exceptions = - fp_invalid_operation_condition:: - apply(FPSCR_VXSNAN_field::mask(), b); - - feclearexcept(FE_ALL_EXCEPT); - febarrier(); -#endif - - float d = (float)b; - - // Update FPSCR exception bits -#if PPC_ENABLE_FPU_EXCEPTIONS - febarrier(); - int raised = fetestexcept(FE_ALL_EXCEPT); - if (raised & FE_UNDERFLOW) - exceptions |= FPSCR_UX_field::mask(); - if (raised & FE_OVERFLOW) - exceptions |= FPSCR_OX_field::mask(); - if (raised & FE_INEXACT) - exceptions |= FPSCR_XX_field::mask(); - record_fpscr(exceptions); -#endif - - // FPSCR[FPRF] is set to the class and sign of the result - if (!FPSCR_VE_field::test(fpscr())) - fp_classify(d); - - // Set CR1 (FX, FEX, VX, VOX) if instruction has Rc set - if (Rc::test(opcode)) - record_cr1(); - - // Commit result to output operand - operand_fp_RD::set(this, opcode, (double)d); - increment_pc(4); -} - -/** - * System Call instruction - **/ - -void powerpc_cpu::execute_syscall(uint32 opcode) -{ -#ifdef SHEEPSHAVER - execute_illegal(opcode); -#else - cr().set_so(0, execute_do_syscall && !execute_do_syscall(this)); -#endif - increment_pc(4); -} - -/** - * Instructions dealing with system registers - **/ - -void powerpc_cpu::execute_mcrf(uint32 opcode) -{ - const int crfS = crfS_field::extract(opcode); - const int crfD = crfD_field::extract(opcode); - cr().set(crfD, cr().get(crfS)); - increment_pc(4); -} - -void powerpc_cpu::execute_mcrfs(uint32 opcode) -{ - const int crfS = crfS_field::extract(opcode); - const int crfD = crfD_field::extract(opcode); - - // The contents of FPSCR field crfS are copied to CR field crfD - const uint32 m = 0xf << (28 - 4 * crfS); - cr().set(crfD, (fpscr() & m) >> (28 - 4 * crfS)); - - // All exception bits copied (except FEX and VX) are cleared in the FPSCR - fpscr() &= ~(m & (FPSCR_FX_field::mask() | FPSCR_OX_field::mask() | - FPSCR_UX_field::mask() | FPSCR_ZX_field::mask() | - FPSCR_XX_field::mask() | FPSCR_VXSNAN_field::mask() | - FPSCR_VXISI_field::mask() | FPSCR_VXIDI_field::mask() | - FPSCR_VXZDZ_field::mask() | FPSCR_VXIMZ_field::mask() | - FPSCR_VXVC_field::mask() | FPSCR_VXSOFT_field::mask() | - FPSCR_VXSQRT_field::mask() | FPSCR_VXCVI_field::mask())); - - increment_pc(4); -} - -void powerpc_cpu::execute_mcrxr(uint32 opcode) -{ - const int crfD = crfD_field::extract(opcode); - const uint32 x = xer().get(); - cr().set(crfD, x >> 28); - xer().set(x & 0x0fffffff); - increment_pc(4); -} - -void powerpc_cpu::execute_mtcrf(uint32 opcode) -{ - uint32 mask = field2mask[CRM_field::extract(opcode)]; - cr().set((operand_RS::get(this, opcode) & mask) | (cr().get() & ~mask)); - increment_pc(4); -} - -template< class FM, class RB, class Rc > -void powerpc_cpu::execute_mtfsf(uint32 opcode) -{ - const uint64 fsf = RB::get(this, opcode); - const uint32 f = FM::get(this, opcode); - uint32 m = field2mask[f]; - - // FPSCR[FX] is altered only if FM[0] = 1 - if ((f & 0x80) == 0) - m &= ~FPSCR_FX_field::mask(); - - // The mtfsf instruction cannot alter FPSCR[FEX] nor FPSCR[VX] explicitly - int exceptions = fsf & m; - exceptions &= ~(FPSCR_FEX_field::mask() | FPSCR_VX_field::mask()); - - // Move frB bits to FPSCR according to field mask - fpscr() = (fpscr() & ~m) | exceptions; - - // Update FPSCR exception bits (don't implicitly update FX) - record_fpscr(0); - - // Update native FP control word - if (m & FPSCR_RN_field::mask()) - fesetround(ppc_to_native_rounding_mode(FPSCR_RN_field::extract(fpscr()))); - - // Set CR1 (FX, FEX, VX, VOX) if instruction has Rc set - if (Rc::test(opcode)) - record_cr1(); - - increment_pc(4); -} - -template< class RB, class Rc > -void powerpc_cpu::execute_mtfsfi(uint32 opcode) -{ - const uint32 crfD = crfD_field::extract(opcode); - uint32 m = 0xf << (4 * (7 - crfD)); - - // FPSCR[FX] is altered only if crfD = 0 - if (crfD == 0) - m &= ~FPSCR_FX_field::mask(); - - // The mtfsfi instruction cannot alter FPSCR[FEX] nor FPSCR[VX] explicitly - int exceptions = RB::get(this, opcode) & m; - exceptions &= ~(FPSCR_FEX_field::mask() | FPSCR_VX_field::mask()); - - // Move immediate to FPSCR according to field crfD - fpscr() = (fpscr() & ~m) | exceptions; - - // Update native FP control word - if (m & FPSCR_RN_field::mask()) - fesetround(ppc_to_native_rounding_mode(FPSCR_RN_field::extract(fpscr()))); - - // Update FPSCR exception bits (don't implicitly update FX) - record_fpscr(0); - - // Set CR1 (FX, FEX, VX, VOX) if instruction has Rc set - if (Rc::test(opcode)) - record_cr1(); - - increment_pc(4); -} - -template< class RB, class Rc > -void powerpc_cpu::execute_mtfsb(uint32 opcode) -{ - const bool set_bit = RB::get(this, opcode); - - // The mtfsb0 and mtfsb1 instructions cannot alter FPSCR[FEX] nor FPSCR[VX] explicitly - uint32 m = 1 << (31 - crbD_field::extract(opcode)); - m &= ~(FPSCR_FEX_field::mask() | FPSCR_VX_field::mask()); - - // Bit crbD of the FPSCR is set or clear - fpscr() &= ~m; - - // Update FPSCR exception bits - record_fpscr(set_bit ? m : 0); - - // Update native FP control word if FPSCR[RN] changed - if (m & FPSCR_RN_field::mask()) - fesetround(ppc_to_native_rounding_mode(FPSCR_RN_field::extract(fpscr()))); - - // Set CR1 (FX, FEX, VX, VOX) if instruction has Rc set - if (Rc::test(opcode)) - record_cr1(); - - increment_pc(4); -} - -template< class Rc > -void powerpc_cpu::execute_mffs(uint32 opcode) -{ - // Move FPSCR to FPR(FRD) - operand_fp_dw_RD::set(this, opcode, fpscr()); - - // Set CR1 (FX, FEX, VX, VOX) if instruction has Rc set - if (Rc::test(opcode)) - record_cr1(); - - increment_pc(4); -} - -void powerpc_cpu::execute_mfmsr(uint32 opcode) -{ - operand_RD::set(this, opcode, 0xf072); - increment_pc(4); -} - -template< class SPR > -void powerpc_cpu::execute_mfspr(uint32 opcode) -{ - const uint32 spr = SPR::get(this, opcode); - uint32 d; - switch (spr) { - case powerpc_registers::SPR_XER: d = xer().get();break; - case powerpc_registers::SPR_LR: d = lr(); break; - case powerpc_registers::SPR_CTR: d = ctr(); break; - case powerpc_registers::SPR_VRSAVE: d = vrsave(); break; -#ifdef SHEEPSHAVER - case powerpc_registers::SPR_SDR1: d = 0xdead001f; break; - case powerpc_registers::SPR_PVR: { - extern uint32 PVR; - d = PVR; - break; - } - default: d = 0; -#else - default: execute_illegal(opcode); -#endif - } - operand_RD::set(this, opcode, d); - increment_pc(4); -} - -template< class SPR > -void powerpc_cpu::execute_mtspr(uint32 opcode) -{ - const uint32 spr = SPR::get(this, opcode); - const uint32 s = operand_RS::get(this, opcode); - - switch (spr) { - case powerpc_registers::SPR_XER: xer().set(s); break; - case powerpc_registers::SPR_LR: lr() = s; break; - case powerpc_registers::SPR_CTR: ctr() = s; break; - case powerpc_registers::SPR_VRSAVE: vrsave() = s; break; -#ifndef SHEEPSHAVER - default: execute_illegal(opcode); -#endif - } - - increment_pc(4); -} - -// Compute with 96 bit intermediate result: (a * b) / c -static uint64 muldiv64(uint64 a, uint32 b, uint32 c) -{ - union { - uint64 ll; - struct { -#ifdef WORDS_BIGENDIAN - uint32 high, low; -#else - uint32 low, high; -#endif - } l; - } u, res; - - u.ll = a; - uint64 rl = (uint64)u.l.low * (uint64)b; - uint64 rh = (uint64)u.l.high * (uint64)b; - rh += (rl >> 32); - res.l.high = rh / c; - res.l.low = (((rh % c) << 32) + (rl & 0xffffffff)) / c; - return res.ll; -} - -static inline uint64 get_tb_ticks(void) -{ - uint64 ticks; -#ifdef SHEEPSHAVER - const uint32 TBFreq = TimebaseSpeed; - ticks = muldiv64(GetTicks_usec(), TBFreq, 1000000); -#else - const uint32 TBFreq = 25 * 1000 * 1000; // 25 MHz - ticks = muldiv64((uint64)clock(), TBFreq, CLOCKS_PER_SEC); -#endif - return ticks; -} - -template< class TBR > -void powerpc_cpu::execute_mftbr(uint32 opcode) -{ - uint32 tbr = TBR::get(this, opcode); - uint32 d; - switch (tbr) { - case 268: d = (uint32)get_tb_ticks(); break; - case 269: d = (get_tb_ticks() >> 32); break; - default: execute_illegal(opcode); - } - operand_RD::set(this, opcode, d); - increment_pc(4); -} - -/** - * Instruction cache management - **/ - -void powerpc_cpu::execute_invalidate_cache_range() -{ - if (cache_range.start != cache_range.end) { - invalidate_cache_range(cache_range.start, cache_range.end); - cache_range.start = cache_range.end = 0; - } -} - -template< class RA, class RB > -void powerpc_cpu::execute_icbi(uint32 opcode) -{ - const uint32 ea = RA::get(this, opcode) + RB::get(this, opcode); - const uint32 block_start = ea - (ea % 32); - - if (block_start == cache_range.end) { - // Extend region to invalidate - cache_range.end += 32; - } - else { - // New region to invalidate - execute_invalidate_cache_range(); - cache_range.start = block_start; - cache_range.end = cache_range.start + 32; - } - - increment_pc(4); -} - -void powerpc_cpu::execute_isync(uint32 opcode) -{ - execute_invalidate_cache_range(); - increment_pc(4); -} - -/** - * (Fake) data cache management - **/ - -template< class RA, class RB > -void powerpc_cpu::execute_dcbz(uint32 opcode) -{ - uint32 ea = RA::get(this, opcode) + RB::get(this, opcode); - vm_memset(ea - (ea % 32), 0, 32); - increment_pc(4); -} - -/** - * Vector load/store instructions - **/ - -template< bool SL > -void powerpc_cpu::execute_vector_load_for_shift(uint32 opcode) -{ - const uint32 ra = operand_RA_or_0::get(this, opcode); - const uint32 rb = operand_RB::get(this, opcode); - const uint32 ea = ra + rb; - powerpc_vr & vD = vr(vD_field::extract(opcode)); - int j = SL ? (ea & 0xf) : (0x10 - (ea & 0xf)); - for (int i = 0; i < 16; i++) - vD.b[ev_mixed::byte_element(i)] = j++; - increment_pc(4); -} - -template< class VD, class RA, class RB > -void powerpc_cpu::execute_vector_load(uint32 opcode) -{ - uint32 ea = RA::get(this, opcode) + RB::get(this, opcode); - typename VD::type & vD = VD::ref(this, opcode); - switch (VD::element_size) { - case 1: - VD::set_element(vD, (ea & 0x0f), vm_read_memory_1(ea)); - break; - case 2: - VD::set_element(vD, ((ea >> 1) & 0x07), vm_read_memory_2(ea & ~1)); - break; - case 4: - VD::set_element(vD, ((ea >> 2) & 0x03), vm_read_memory_4(ea & ~3)); - break; - case 8: - ea &= ~15; - vD.w[0] = vm_read_memory_4(ea + 0); - vD.w[1] = vm_read_memory_4(ea + 4); - vD.w[2] = vm_read_memory_4(ea + 8); - vD.w[3] = vm_read_memory_4(ea + 12); - break; - } - increment_pc(4); -} - -template< class VS, class RA, class RB > -void powerpc_cpu::execute_vector_store(uint32 opcode) -{ - uint32 ea = RA::get(this, opcode) + RB::get(this, opcode); - typename VS::type & vS = VS::ref(this, opcode); - switch (VS::element_size) { - case 1: - vm_write_memory_1(ea, VS::get_element(vS, (ea & 0x0f))); - break; - case 2: - vm_write_memory_2(ea & ~1, VS::get_element(vS, ((ea >> 1) & 0x07))); - break; - case 4: - vm_write_memory_4(ea & ~3, VS::get_element(vS, ((ea >> 2) & 0x03))); - break; - case 8: - ea &= ~15; - vm_write_memory_4(ea + 0, vS.w[0]); - vm_write_memory_4(ea + 4, vS.w[1]); - vm_write_memory_4(ea + 8, vS.w[2]); - vm_write_memory_4(ea + 12, vS.w[3]); - break; - } - increment_pc(4); -} - -/** - * Vector arithmetic - * - * OP Operation to perform on element - * VD Output operand vector - * VA Input operand vector - * VB Input operand vector (optional: operand_NONE) - * VC Input operand vector (optional: operand_NONE) - * Rc Predicate to record CR6 - * C1 If recording CR6, do we check for '1' bits in vD? - **/ - -template< class OP, class VD, class VA, class VB, class VC, class Rc, int C1 > -void powerpc_cpu::execute_vector_arith(uint32 opcode) -{ - typename VA::type const & vA = VA::const_ref(this, opcode); - typename VB::type const & vB = VB::const_ref(this, opcode); - typename VC::type const & vC = VC::const_ref(this, opcode); - typename VD::type & vD = VD::ref(this, opcode); - const int n_elements = 16 / VD::element_size; - - for (int i = 0; i < n_elements; i++) { - const typename VA::element_type a = VA::get_element(vA, i); - const typename VB::element_type b = VB::get_element(vB, i); - const typename VC::element_type c = VC::get_element(vC, i); - typename VD::element_type d = op_apply::apply(a, b, c); - if (VD::saturate(d)) - vscr().set_sat(1); - VD::set_element(vD, i, d); - } - - // Propagate all conditions to CR6 - if (Rc::test(opcode)) - record_cr6(vD, C1); - - increment_pc(4); -} - -/** - * Vector mixed arithmetic - * - * OP Operation to perform on element - * VD Output operand vector - * VA Input operand vector - * VB Input operand vector (optional: operand_NONE) - * VC Input operand vector (optional: operand_NONE) - **/ - -template< class OP, class VD, class VA, class VB, class VC > -void powerpc_cpu::execute_vector_arith_mixed(uint32 opcode) -{ - typename VA::type const & vA = VA::const_ref(this, opcode); - typename VB::type const & vB = VB::const_ref(this, opcode); - typename VC::type const & vC = VC::const_ref(this, opcode); - typename VD::type & vD = VD::ref(this, opcode); - const int n_elements = 16 / VD::element_size; - const int n_sub_elements = 4 / VA::element_size; - - for (int i = 0; i < n_elements; i++) { - const typename VC::element_type c = VC::get_element(vC, i); - typename VD::element_type d = c; - for (int j = 0; j < n_sub_elements; j++) { - const typename VA::element_type a = VA::get_element(vA, i * n_sub_elements + j); - const typename VB::element_type b = VB::get_element(vB, i * n_sub_elements + j); - d += op_apply::apply(a, b, c); - } - if (VD::saturate(d)) - vscr().set_sat(1); - VD::set_element(vD, i, d); - } - - increment_pc(4); -} - -/** - * Vector odd/even arithmetic - * - * ODD Flag: are we computing every odd element? - * OP Operation to perform on element - * VD Output operand vector - * VA Input operand vector - * VB Input operand vector (optional: operand_NONE) - * VC Input operand vector (optional: operand_NONE) - **/ - -template< int ODD, class OP, class VD, class VA, class VB, class VC > -void powerpc_cpu::execute_vector_arith_odd(uint32 opcode) -{ - typename VA::type const & vA = VA::const_ref(this, opcode); - typename VB::type const & vB = VB::const_ref(this, opcode); - typename VC::type const & vC = VC::const_ref(this, opcode); - typename VD::type & vD = VD::ref(this, opcode); - const int n_elements = 16 / VD::element_size; - - for (int i = 0; i < n_elements; i++) { - const typename VA::element_type a = VA::get_element(vA, (i * 2) + ODD); - const typename VB::element_type b = VB::get_element(vB, (i * 2) + ODD); - const typename VC::element_type c = VC::get_element(vC, (i * 2) + ODD); - typename VD::element_type d = op_apply::apply(a, b, c); - if (VD::saturate(d)) - vscr().set_sat(1); - VD::set_element(vD, i, d); - } - - increment_pc(4); -} - -/** - * Vector merge instructions - * - * OP Operation to perform on element - * VD Output operand vector - * VA Input operand vector - * VB Input operand vector (optional: operand_NONE) - * VC Input operand vector (optional: operand_NONE) - * LO Flag: use lower part of element - **/ - -template< class VD, class VA, class VB, int LO > -void powerpc_cpu::execute_vector_merge(uint32 opcode) -{ - typename VA::type const & vA = VA::const_ref(this, opcode); - typename VB::type const & vB = VB::const_ref(this, opcode); - typename VD::type & vD = VD::ref(this, opcode); - const int n_elements = 16 / VD::element_size; - - for (int i = 0; i < n_elements; i += 2) { - VD::set_element(vD, i , VA::get_element(vA, (i / 2) + LO * (n_elements / 2))); - VD::set_element(vD, i + 1, VB::get_element(vB, (i / 2) + LO * (n_elements / 2))); - } - - increment_pc(4); -} - -/** - * Vector pack/unpack instructions - * - * OP Operation to perform on element - * VD Output operand vector - * VA Input operand vector - * VB Input operand vector (optional: operand_NONE) - * VC Input operand vector (optional: operand_NONE) - * LO Flag: use lower part of element - **/ - -template< class VD, class VA, class VB > -void powerpc_cpu::execute_vector_pack(uint32 opcode) -{ - typename VA::type const & vA = VA::const_ref(this, opcode); - typename VB::type const & vB = VB::const_ref(this, opcode); - typename VD::type & vD = VD::ref(this, opcode); - const int n_elements = 16 / VD::element_size; - const int n_pivot = n_elements / 2; - - for (int i = 0; i < n_elements; i++) { - typename VD::element_type d; - if (i < n_pivot) - d = VA::get_element(vA, i); - else - d = VB::get_element(vB, i - n_pivot); - if (VD::saturate(d)) - vscr().set_sat(1); - VD::set_element(vD, i, d); - } - - increment_pc(4); -} - -template< int LO, class VD, class VA > -void powerpc_cpu::execute_vector_unpack(uint32 opcode) -{ - typename VA::type const & vA = VA::const_ref(this, opcode); - typename VD::type & vD = VD::ref(this, opcode); - const int n_elements = 16 / VD::element_size; - - for (int i = 0; i < n_elements; i++) - VD::set_element(vD, i, VA::get_element(vA, i + LO * n_elements)); - - increment_pc(4); -} - -void powerpc_cpu::execute_vector_pack_pixel(uint32 opcode) -{ - powerpc_vr const & vA = vr(vA_field::extract(opcode)); - powerpc_vr const & vB = vr(vB_field::extract(opcode)); - powerpc_vr & vD = vr(vD_field::extract(opcode)); - - for (int i = 0; i < 4; i++) { - const uint32 a = vA.w[i]; - vD.h[ev_mixed::half_element(i)] = ((a >> 9) & 0xfc00) | ((a >> 6) & 0x03e0) | ((a >> 3) & 0x001f); - const uint32 b = vB.w[i]; - vD.h[ev_mixed::half_element(i + 4)] = ((b >> 9) & 0xfc00) | ((b >> 6) & 0x03e0) | ((b >> 3) & 0x001f); - } - - increment_pc(4); -} - -template< int LO > -void powerpc_cpu::execute_vector_unpack_pixel(uint32 opcode) -{ - powerpc_vr const & vB = vr(vB_field::extract(opcode)); - powerpc_vr & vD = vr(vD_field::extract(opcode)); - - for (int i = 0; i < 4; i++) { - const uint32 h = vB.h[ev_mixed::half_element(i + LO * 4)]; - vD.w[i] = (((h & 0x8000) ? 0xff000000 : 0) | - ((h & 0x7c00) << 6) | - ((h & 0x03e0) << 3) | - (h & 0x001f)); - } - - increment_pc(4); -} - -/** - * Vector shift instructions - * - * SD Shift direction: left (-1), right (+1) - * OP Operation to perform on element - * VD Output operand vector - * VA Input operand vector - * VB Input operand vector (optional: operand_NONE) - * VC Input operand vector (optional: operand_NONE) - * SH Shift count operand - **/ - -template< int SD > -void powerpc_cpu::execute_vector_shift(uint32 opcode) -{ - powerpc_vr const & vA = vr(vA_field::extract(opcode)); - powerpc_vr const & vB = vr(vB_field::extract(opcode)); - powerpc_vr & vD = vr(vD_field::extract(opcode)); - - // The contents of the low-order three bits of all byte - // elements in vB must be identical to vB[125-127]; otherwise - // the value placed into vD is undefined. - const int sh = vB.b[ev_mixed::byte_element(15)] & 7; - if (sh == 0) { - for (int i = 0; i < 4; i++) - vD.w[i] = vA.w[i]; - } - else { - uint32 prev_bits = 0; - if (SD < 0) { - for (int i = 3; i >= 0; i--) { - uint32 next_bits = vA.w[i] >> (32 - sh); - vD.w[i] = ((vA.w[i] << sh) | prev_bits); - prev_bits = next_bits; - } - } - else if (SD > 0) { - for (int i = 0; i < 4; i++) { - uint32 next_bits = vA.w[i] << (32 - sh); - vD.w[i] = ((vA.w[i] >> sh) | prev_bits); - prev_bits = next_bits; - } - } - } - - increment_pc(4); -} - -template< int SD, class VD, class VA, class VB, class SH > -void powerpc_cpu::execute_vector_shift_octet(uint32 opcode) -{ - typename VA::type const & vA = VA::const_ref(this, opcode); - typename VB::type const & vB = VB::const_ref(this, opcode); - typename VD::type & vD = VD::ref(this, opcode); - const int n_elements = 16 / VD::element_size; - - const int sh = SH::get(this, opcode); - if (SD < 0) { - for (int i = 0; i < 16; i++) { - if (i + sh < 16) - VD::set_element(vD, i, VA::get_element(vA, i + sh)); - else - VD::set_element(vD, i, VB::get_element(vB, i - (16 - sh))); - } - } - else if (SD > 0) { - for (int i = 0; i < 16; i++) { - if (i < sh) - VD::set_element(vD, i, VB::get_element(vB, 16 - (i - sh))); - else - VD::set_element(vD, i, VA::get_element(vA, i - sh)); - } - } - - increment_pc(4); -} - -/** - * Vector splat instructions - * - * OP Operation to perform on element - * VD Output operand vector - * VA Input operand vector - * VB Input operand vector (optional: operand_NONE) - * IM Immediate value to replicate - **/ - -template< class OP, class VD, class VB, bool IM > -void powerpc_cpu::execute_vector_splat(uint32 opcode) -{ - typename VD::type & vD = VD::ref(this, opcode); - const int n_elements = 16 / VD::element_size; - - uint32 value; - if (IM) - value = OP::apply(vUIMM_field::extract(opcode)); - else { - typename VB::type const & vB = VB::const_ref(this, opcode); - const int n = vUIMM_field::extract(opcode) & (n_elements - 1); - value = OP::apply(VB::get_element(vB, n)); - } - - for (int i = 0; i < n_elements; i++) - VD::set_element(vD, i, value); - - increment_pc(4); -} - -/** - * Vector sum instructions - * - * SZ Size of destination vector elements - * VD Output operand vector - * VA Input operand vector - * VB Input operand vector (optional: operand_NONE) - **/ - -template< int SZ, class VD, class VA, class VB > -void powerpc_cpu::execute_vector_sum(uint32 opcode) -{ - typename VA::type const & vA = VA::const_ref(this, opcode); - typename VB::type const & vB = VB::const_ref(this, opcode); - typename VD::type & vD = VD::ref(this, opcode); - typename VD::element_type d; - - switch (SZ) { - case 1: // vsum - d = VB::get_element(vB, 3); - for (int j = 0; j < 4; j++) - d += VA::get_element(vA, j); - if (VD::saturate(d)) - vscr().set_sat(1); - VD::set_element(vD, 0, 0); - VD::set_element(vD, 1, 0); - VD::set_element(vD, 2, 0); - VD::set_element(vD, 3, d); - break; - - case 2: // vsum2 - for (int i = 0; i < 4; i += 2) { - d = VB::get_element(vB, i + 1); - for (int j = 0; j < 2; j++) - d += VA::get_element(vA, i + j); - if (VD::saturate(d)) - vscr().set_sat(1); - VD::set_element(vD, i + 0, 0); - VD::set_element(vD, i + 1, d); - } - break; - - case 4: // vsum4 - for (int i = 0; i < 4; i += 1) { - d = VB::get_element(vB, i); - const int n_elements = 4 / VA::element_size; - for (int j = 0; j < n_elements; j++) - d += VA::get_element(vA, i * n_elements + j); - if (VD::saturate(d)) - vscr().set_sat(1); - VD::set_element(vD, i, d); - } - break; - } - - increment_pc(4); -} - -/** - * Misc vector instructions - **/ - -void powerpc_cpu::execute_vector_permute(uint32 opcode) -{ - powerpc_vr const & vA = vr(vA_field::extract(opcode)); - powerpc_vr const & vB = vr(vB_field::extract(opcode)); - powerpc_vr const & vC = vr(vC_field::extract(opcode)); - powerpc_vr & vD = vr(vD_field::extract(opcode)); - - for (int i = 0; i < 16; i++) { - const int ei = ev_mixed::byte_element(i); - const int n = vC.b[ei] & 0x1f; - const int en = ev_mixed::byte_element(n & 0xf); - vD.b[ei] = (n & 0x10) ? vB.b[en] : vA.b[en]; - } - - increment_pc(4); -} - -void powerpc_cpu::execute_mfvscr(uint32 opcode) -{ - const int vD = vD_field::extract(opcode); - vr(vD).w[0] = 0; - vr(vD).w[1] = 0; - vr(vD).w[2] = 0; - vr(vD).w[3] = vscr().get(); - increment_pc(4); -} - -void powerpc_cpu::execute_mtvscr(uint32 opcode) -{ - const int vB = vB_field::extract(opcode); - vscr().set(vr(vB).w[3]); - increment_pc(4); -} - -/** - * Explicit template instantiations - **/ - -#include "ppc-execute-impl.cpp" diff --git a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-execute.hpp b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-execute.hpp deleted file mode 100644 index d3ce93f2..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-execute.hpp +++ /dev/null @@ -1,380 +0,0 @@ -/* - * ppc-execute.hpp - PowerPC semantic action templates - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PPC_EXECUTE_H -#define PPC_EXECUTE_H - -// This file is designed to be included from implementation files only. -#ifdef DYNGEN_OPS -#define PPC_CPU powerpc_dyngen_helper -#define DEFINE_HELPER(NAME, ARGS) static inline uint32 NAME ARGS -#define RETURN(VAL) dyngen_barrier(); return (VAL) -#else -#define PPC_CPU powerpc_cpu -#define DEFINE_HELPER(NAME, ARGS) inline uint32 powerpc_cpu::NAME ARGS -#define RETURN(VAL) return (VAL) -#endif - - -template< bool SB > struct register_value { typedef uint32 type; }; -template< > struct register_value< true > { typedef int32 type; }; - -/** - * Helper class to apply an unary/binary/trinary operation - * - * OP Operation to perform - * RA Input operand register - * RB Input operand register or immediate (optional: operand_NONE) - * RC Input operand register or immediate (optional: operand_NONE) - **/ - -struct null_operand; -struct null_vector_operand; - -template< class RT, class OP, class RA, class RB, class RC > -struct op_apply { - template< class A, class B, class C > - static inline RT apply(A a, B b, C c) { - return OP::apply(a, b, c); - } -}; - -template< class RT, class OP, class RA, class RB > -struct op_apply { - template< class A, class B, class C > - static inline RT apply(A a, B b, C) { - return OP::apply(a, b); - } -}; - -template< class RT, class OP, class RA > -struct op_apply { - template< class A, class B, class C > - static inline RT apply(A a, B, C) { - return OP::apply(a); - } -}; - -template< class RT, class OP, class RA, class RB > -struct op_apply { - template< class A, class B, class C > - static inline RT apply(A a, B b, C) { - return (RT)OP::apply(a, b); - } -}; - -template< class RT, class OP, class RA > -struct op_apply { - template< class A, class B, class C > - static inline RT apply(A a, B, C) { - return (RT)OP::apply(a); - } -}; - -template< class RT, class OP, class RB > -struct op_apply { - template< class A, class B, class C > - static inline RT apply(A, B b, C) { - return (RT)OP::apply(b); - } -}; - -/** - * Add instruction templates - **/ - -template< bool EX, bool CA, bool OE > -DEFINE_HELPER(do_execute_addition, (uint32 RA, uint32 RB)) -{ - uint32 RD = RA + RB + (EX ? PPC_CPU::xer().get_ca() : 0); - - const bool _RA = ((int32)RA) < 0; - const bool _RB = ((int32)RB) < 0; - const bool _RD = ((int32)RD) < 0; - - if (EX) { - const bool ca = _RB ^ ((_RB ^ _RA) & (_RA ^ _RD)); - PPC_CPU::xer().set_ca(ca); - } - else if (CA) { - const bool ca = (uint32)RD < (uint32)RA; - PPC_CPU::xer().set_ca(ca); - } - - if (OE) - PPC_CPU::xer().set_ov((_RB ^ _RD) & (_RA ^ _RD)); - - RETURN(RD); -} - -/** - * Subtract instruction templates - **/ - -template< bool CA, bool OE > -DEFINE_HELPER(do_execute_subtract, (uint32 RA, uint32 RB)) -{ - uint32 RD = RB - RA; - - const bool _RA = ((int32)RA) < 0; - const bool _RB = ((int32)RB) < 0; - const bool _RD = ((int32)RD) < 0; - - if (CA) - PPC_CPU::xer().set_ca((uint32)RD <= (uint32)RB); - - if (OE) - PPC_CPU::xer().set_ov((_RA ^ _RB) & (_RD ^ _RB)); - - RETURN(RD); -} - -template< bool OE > -DEFINE_HELPER(do_execute_subtract_extended, (uint32 RA, uint32 RB)) -{ - const uint32 RD = ~RA + RB + PPC_CPU::xer().get_ca(); - - const bool _RA = ((int32)RA) < 0; - const bool _RB = ((int32)RB) < 0; - const bool _RD = ((int32)RD) < 0; - - const bool ca = !_RA ^ ((_RA ^ _RD) & (_RB ^ _RD)); - PPC_CPU::xer().set_ca(ca); - - if (OE) - PPC_CPU::xer().set_ov((_RA ^ _RB) & (_RD ^ _RB)); - - RETURN(RD); -} - -/** - * Divide instruction templates - **/ - -template< bool SB, bool OE > -DEFINE_HELPER(do_execute_divide, (uint32 RA, uint32 RB)) -{ - typename register_value::type a = RA; - typename register_value::type b = RB; - uint32 RD; - - if (b == 0 || (SB && a == 0x80000000 && b == -1)) { - // Reference manual says result is undefined but it gets all - // bits set to MSB on a real processor - RD = SB ? ((int32)RA >> 31) : 0; - if (OE) - PPC_CPU::xer().set_ov(1); - } - else { - RD = a / b; - if (OE) - PPC_CPU::xer().set_ov(0); - } - - RETURN(RD); -} - -/** - * FP load/store - **/ - -// C.6 Floating-Point Load Instructions -static inline uint64 fp_load_single_convert(uint32 v) -{ - // XXX we currently use the native floating-point capabilities - any_register x; - x.i = v; - x.d = (double)x.f; - return x.j; -} - -// C.7 Floating-Point Store Instructions -static inline uint32 fp_store_single_convert(uint64 v) -{ - int exp = (v >> 52) & 0x7ff; - if (exp < 874 || exp > 896) { - // No denormalization required (or "undefined" behaviour) - // WORD[0 - 1] = frS[0 - 1] - // WORD[2 - 31] = frS[5 - 34] - return (uint32)(((v >> 32) & 0xc0000000) | ((v >> 29) & 0x3fffffff)); - } - - // Handle denormalization (874 <= frS[1 - 11] <= 896 - // XXX we currently use the native floating-point capabilities - any_register x; - x.j = v; - x.f = (float)x.d; - return x.i; -} - -/** - * FP classification - **/ - -static inline bool is_NaN(double v) -{ - any_register x; x.d = v; - return (((x.j & UVAL64(0x7ff0000000000000)) == UVAL64(0x7ff0000000000000)) && - ((x.j & UVAL64(0x000fffffffffffff)) != 0)); -} - -static inline bool is_QNaN(double v) -{ - any_register x; x.d = v; - return is_NaN(v) && (x.j & UVAL64(0x0008000000000000)); -} - -static inline bool is_SNaN(double v) -{ - return is_NaN(v) && !is_QNaN(v); -} - -static inline bool is_NaN(float v) -{ - any_register x; x.f = v; - return (((x.i & 0x7f800000) == 0x7f800000) && - ((x.i & 0x007fffff) != 0)); -} - -static inline bool is_QNaN(float v) -{ - any_register x; x.f = v; - return is_NaN(v) && (x.i & 0x00400000); -} - -static inline bool is_SNaN(float v) -{ - return is_NaN(v) && !is_QNaN(v); -} - -/** - * Check for FP Exception Conditions - **/ - -template< class OP > -struct fp_exception_condition { - static inline uint32 apply(double) { - return 0; - } - static inline uint32 apply(double, double) { - return 0; - } - static inline uint32 apply(double, double, double) { - return 0; - } -}; - -template< class FP > -struct fp_invalid_operation_condition { - static inline uint32 apply(int flags) { - uint32 exceptions = 0; - if (FPSCR_VXSOFT_field::test(flags)) - exceptions |= FPSCR_VXSOFT_field::mask(); - return 0; - } - static inline uint32 apply(int flags, FP a) { - uint32 exceptions = 0; - if (FPSCR_VXSNAN_field::test(flags) && is_SNaN(a)) - exceptions |= FPSCR_VXSNAN_field::mask(); - if (FPSCR_VXVC_field::test(flags) && is_NaN(a)) - exceptions |= FPSCR_VXVC_field::mask(); - if (FPSCR_VXSQRT_field::test(flags) && signbit(a)) - exceptions |= FPSCR_VXSQRT_field::mask(); - return exceptions; - } - static inline uint32 apply(int flags, FP a, FP b, bool negate = false) { - uint32 exceptions = apply(flags) | apply(flags, a) | apply(flags, b); - if (FPSCR_VXISI_field::test(flags) && isinf(a) && isinf(b)) { - if (( negate && (signbit(a) == signbit(b))) || - (!negate && (signbit(a) != signbit(b)))) - exceptions |= FPSCR_VXISI_field::mask(); - } - if (FPSCR_VXIDI_field::test(flags) && isinf(a) && isinf(b)) - exceptions |= FPSCR_VXIDI_field::mask(); - if (FPSCR_VXZDZ_field::test(flags) && a == 0 && b == 0) - exceptions |= FPSCR_VXZDZ_field::mask(); - if (FPSCR_VXIMZ_field::test(flags) && ((a == 0 && isinf(b)) || (isinf(a) && b == 0))) - exceptions |= FPSCR_VXIMZ_field::mask(); - return exceptions; - } -}; - -#define DEFINE_FP_INVALID_OPERATION(OP, TYPE, EXCP, NEGATE) \ -template<> \ -struct fp_exception_condition { \ - static inline uint32 apply(TYPE a, TYPE b) { \ - return fp_invalid_operation_condition::apply(EXCP, a, b, NEGATE); \ - } \ -}; - -DEFINE_FP_INVALID_OPERATION(op_fadd, double, FPSCR_VXSNAN_field::mask() | FPSCR_VXISI_field::mask(), 0); -DEFINE_FP_INVALID_OPERATION(op_fsub, double, FPSCR_VXSNAN_field::mask() | FPSCR_VXISI_field::mask(), 1); -DEFINE_FP_INVALID_OPERATION(op_fmul, double, FPSCR_VXSNAN_field::mask() | FPSCR_VXIMZ_field::mask(), 0); - -template< class FP > -struct fp_divide_exception_condition { - static inline uint32 apply(FP a, FP b) { - int exceptions = - fp_invalid_operation_condition:: - apply(FPSCR_VXSNAN_field::mask() | FPSCR_VXIDI_field::mask() | FPSCR_VXZDZ_field::mask(), - a, b); - if (isfinite(a) && a != 0 && b == 0) - exceptions = FPSCR_ZX_field::mask(); - return exceptions; - } -}; - -template<> struct fp_exception_condition : fp_divide_exception_condition { }; - -template< class FP, bool negate > -struct fp_fma_exception_condition { - static inline uint32 apply(FP a, FP b, FP c) { - int exceptions = - fp_invalid_operation_condition:: - apply(FPSCR_VXSNAN_field::mask(), a) | - fp_invalid_operation_condition:: - apply(FPSCR_VXSNAN_field::mask(), b) | - fp_invalid_operation_condition:: - apply(FPSCR_VXSNAN_field::mask(), c) | - fp_invalid_operation_condition:: - apply(FPSCR_VXIMZ_field::mask(), a, b); - // 2.1.5 -- The XER bit definitions are based on the - // operation of an instruction considered as a whole, - // not on intermediate results - if ((isinf(a) || isinf(b)) && isinf(c)) { - FP m = a * b; - if (isinf(m)) { - // make sure the intermediate result is an infinity and not a NaN - // FIXME: it could be faster to use (exceptions & IMZ) == 0 instead of isinf() - if (( negate && (signbit(m) == signbit(c))) || - (!negate && (signbit(m) != signbit(c)))) - exceptions |= FPSCR_VXISI_field::mask(); - } - } - return exceptions; - } -}; - -template<> struct fp_exception_condition : fp_fma_exception_condition { }; -template<> struct fp_exception_condition : fp_fma_exception_condition { }; -template<> struct fp_exception_condition : fp_fma_exception_condition { }; -template<> struct fp_exception_condition : fp_fma_exception_condition { }; - -#endif /* PPC_EXECUTE_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-instructions.hpp b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-instructions.hpp deleted file mode 100644 index c42b61d1..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-instructions.hpp +++ /dev/null @@ -1,366 +0,0 @@ -/* - * ppc-instructions.hpp - PowerPC instructions IDs - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PPC_INSTRUCTIONS_H -#define PPC_INSTRUCTIONS_H - -/** - * Define PowerPC instruction types - **/ - -#define PPC_I(X) powerpc_instruction_##X - -enum powerpc_instruction { - PPC_I(INVALID), - PPC_I(ADD), - PPC_I(ADDC), - PPC_I(ADDE), - PPC_I(ADDI), - PPC_I(ADDIC), - PPC_I(ADDIC_), - PPC_I(ADDIS), - PPC_I(ADDME), - PPC_I(ADDZE), - PPC_I(AND), - PPC_I(ANDC), - PPC_I(ANDI), - PPC_I(ANDIS), - PPC_I(B), - PPC_I(BC), - PPC_I(BCCTR), - PPC_I(BCLR), - PPC_I(CMP), - PPC_I(CMPI), - PPC_I(CMPL), - PPC_I(CMPLI), - PPC_I(CNTLZW), - PPC_I(CRAND), - PPC_I(CRANDC), - PPC_I(CREQV), - PPC_I(CRNAND), - PPC_I(CRNOR), - PPC_I(CROR), - PPC_I(CRORC), - PPC_I(CRXOR), - PPC_I(DCBA), - PPC_I(DCBF), - PPC_I(DCBI), - PPC_I(DCBST), - PPC_I(DCBT), - PPC_I(DCBTST), - PPC_I(DCBZ), - PPC_I(DIVW), - PPC_I(DIVWU), - PPC_I(DSS), - PPC_I(DST), - PPC_I(DSTST), - PPC_I(ECIWX), - PPC_I(ECOWX), - PPC_I(EIEIO), - PPC_I(EQV), - PPC_I(EXTSB), - PPC_I(EXTSH), - PPC_I(FABS), - PPC_I(FADD), - PPC_I(FADDS), - PPC_I(FCMPO), - PPC_I(FCMPU), - PPC_I(FCTIW), - PPC_I(FCTIWZ), - PPC_I(FDIV), - PPC_I(FDIVS), - PPC_I(FMADD), - PPC_I(FMADDS), - PPC_I(FMR), - PPC_I(FMSUB), - PPC_I(FMSUBS), - PPC_I(FMUL), - PPC_I(FMULS), - PPC_I(FNABS), - PPC_I(FNEG), - PPC_I(FNMADD), - PPC_I(FNMADDS), - PPC_I(FNMSUB), - PPC_I(FNMSUBS), - PPC_I(FRSP), - PPC_I(FSEL), - PPC_I(FSUB), - PPC_I(FSUBS), - PPC_I(ICBI), - PPC_I(ISYNC), - PPC_I(LBZ), - PPC_I(LBZU), - PPC_I(LBZUX), - PPC_I(LBZX), - PPC_I(LFD), - PPC_I(LFDU), - PPC_I(LFDUX), - PPC_I(LFDX), - PPC_I(LFS), - PPC_I(LFSU), - PPC_I(LFSUX), - PPC_I(LFSX), - PPC_I(LHA), - PPC_I(LHAU), - PPC_I(LHAUX), - PPC_I(LHAX), - PPC_I(LHBRX), - PPC_I(LHZ), - PPC_I(LHZU), - PPC_I(LHZUX), - PPC_I(LHZX), - PPC_I(LMW), - PPC_I(LSWI), - PPC_I(LSWX), - PPC_I(LVEBX), - PPC_I(LVEHX), - PPC_I(LVEWX), - PPC_I(LVSL), - PPC_I(LVSR), - PPC_I(LVX), - PPC_I(LVXL), - PPC_I(LWARX), - PPC_I(LWBRX), - PPC_I(LWZ), - PPC_I(LWZU), - PPC_I(LWZUX), - PPC_I(LWZX), - PPC_I(MCRF), - PPC_I(MCRFS), - PPC_I(MCRXR), - PPC_I(MFCR), - PPC_I(MFFS), - PPC_I(MFMSR), - PPC_I(MFSPR), - PPC_I(MFTB), - PPC_I(MFVSCR), - PPC_I(MTCRF), - PPC_I(MTFSB0), - PPC_I(MTFSB1), - PPC_I(MTFSF), - PPC_I(MTFSFI), - PPC_I(MTSPR), - PPC_I(MTVSCR), - PPC_I(MULHW), - PPC_I(MULHWU), - PPC_I(MULLI), - PPC_I(MULLW), - PPC_I(NAND), - PPC_I(NEG), - PPC_I(NOR), - PPC_I(OR), - PPC_I(ORC), - PPC_I(ORI), - PPC_I(ORIS), - PPC_I(RLWIMI), - PPC_I(RLWINM), - PPC_I(RLWNM), - PPC_I(SC), - PPC_I(SLW), - PPC_I(SRAW), - PPC_I(SRAWI), - PPC_I(SRW), - PPC_I(STB), - PPC_I(STBU), - PPC_I(STBUX), - PPC_I(STBX), - PPC_I(STFD), - PPC_I(STFDU), - PPC_I(STFDUX), - PPC_I(STFDX), - PPC_I(STFS), - PPC_I(STFSU), - PPC_I(STFSUX), - PPC_I(STFSX), - PPC_I(STH), - PPC_I(STHBRX), - PPC_I(STHU), - PPC_I(STHUX), - PPC_I(STHX), - PPC_I(STMW), - PPC_I(STSWI), - PPC_I(STSWX), - PPC_I(STVEBX), - PPC_I(STVEHX), - PPC_I(STVEWX), - PPC_I(STVX), - PPC_I(STVXL), - PPC_I(STW), - PPC_I(STWBRX), - PPC_I(STWCX), - PPC_I(STWU), - PPC_I(STWUX), - PPC_I(STWX), - PPC_I(SUBF), - PPC_I(SUBFC), - PPC_I(SUBFE), - PPC_I(SUBFIC), - PPC_I(SUBFME), - PPC_I(SUBFZE), - PPC_I(SYNC), - PPC_I(XOR), - PPC_I(XORI), - PPC_I(XORIS), - PPC_I(VADDCUW), - PPC_I(VADDFP), - PPC_I(VADDSBS), - PPC_I(VADDSHS), - PPC_I(VADDSWS), - PPC_I(VADDUBM), - PPC_I(VADDUBS), - PPC_I(VADDUHM), - PPC_I(VADDUHS), - PPC_I(VADDUWM), - PPC_I(VADDUWS), - PPC_I(VAND), - PPC_I(VANDC), - PPC_I(VAVGSB), - PPC_I(VAVGSH), - PPC_I(VAVGSW), - PPC_I(VAVGUB), - PPC_I(VAVGUH), - PPC_I(VAVGUW), - PPC_I(VCFSX), - PPC_I(VCFUX), - PPC_I(VCMPBFP), - PPC_I(VCMPEQFP), - PPC_I(VCMPEQUB), - PPC_I(VCMPEQUH), - PPC_I(VCMPEQUW), - PPC_I(VCMPGEFP), - PPC_I(VCMPGTFP), - PPC_I(VCMPGTSB), - PPC_I(VCMPGTSH), - PPC_I(VCMPGTSW), - PPC_I(VCMPGTUB), - PPC_I(VCMPGTUH), - PPC_I(VCMPGTUW), - PPC_I(VCTSXS), - PPC_I(VCTUXS), - PPC_I(VEXPTEFP), - PPC_I(VLOGEFP), - PPC_I(VMADDFP), - PPC_I(VMAXFP), - PPC_I(VMAXSB), - PPC_I(VMAXSH), - PPC_I(VMAXSW), - PPC_I(VMAXUB), - PPC_I(VMAXUH), - PPC_I(VMAXUW), - PPC_I(VMHADDSHS), - PPC_I(VMHRADDSHS), - PPC_I(VMINFP), - PPC_I(VMINSB), - PPC_I(VMINSH), - PPC_I(VMINSW), - PPC_I(VMINUB), - PPC_I(VMINUH), - PPC_I(VMINUW), - PPC_I(VMLADDUHM), - PPC_I(VMRGHB), - PPC_I(VMRGHH), - PPC_I(VMRGHW), - PPC_I(VMRGLB), - PPC_I(VMRGLH), - PPC_I(VMRGLW), - PPC_I(VMSUMMBM), - PPC_I(VMSUMSHM), - PPC_I(VMSUMSHS), - PPC_I(VMSUMUBM), - PPC_I(VMSUMUHM), - PPC_I(VMSUMUHS), - PPC_I(VMULESB), - PPC_I(VMULESH), - PPC_I(VMULEUB), - PPC_I(VMULEUH), - PPC_I(VMULOSB), - PPC_I(VMULOSH), - PPC_I(VMULOUB), - PPC_I(VMULOUH), - PPC_I(VNMSUBFP), - PPC_I(VNOR), - PPC_I(VOR), - PPC_I(VPERM), - PPC_I(VPKPX), - PPC_I(VPKSHSS), - PPC_I(VPKSHUS), - PPC_I(VPKSWSS), - PPC_I(VPKSWUS), - PPC_I(VPKUHUM), - PPC_I(VPKUHUS), - PPC_I(VPKUWUM), - PPC_I(VPKUWUS), - PPC_I(VREFP), - PPC_I(VRFIM), - PPC_I(VRFIN), - PPC_I(VRFIP), - PPC_I(VRFIZ), - PPC_I(VRLB), - PPC_I(VRLH), - PPC_I(VRLW), - PPC_I(VRSQRTEFP), - PPC_I(VSEL), - PPC_I(VSL), - PPC_I(VSLB), - PPC_I(VSLDOI), - PPC_I(VSLH), - PPC_I(VSLO), - PPC_I(VSLW), - PPC_I(VSPLTB), - PPC_I(VSPLTH), - PPC_I(VSPLTISB), - PPC_I(VSPLTISH), - PPC_I(VSPLTISW), - PPC_I(VSPLTW), - PPC_I(VSR), - PPC_I(VSRAB), - PPC_I(VSRAH), - PPC_I(VSRAW), - PPC_I(VSRB), - PPC_I(VSRH), - PPC_I(VSRO), - PPC_I(VSRW), - PPC_I(VSUBCUW), - PPC_I(VSUBFP), - PPC_I(VSUBSBS), - PPC_I(VSUBSHS), - PPC_I(VSUBSWS), - PPC_I(VSUBUBM), - PPC_I(VSUBUBS), - PPC_I(VSUBUHM), - PPC_I(VSUBUHS), - PPC_I(VSUBUWM), - PPC_I(VSUBUWS), - PPC_I(VSUMSWS), - PPC_I(VSUM2SWS), - PPC_I(VSUM4SBS), - PPC_I(VSUM4SHS), - PPC_I(VSUM4UBS), - PPC_I(VUPKHPX), - PPC_I(VUPKHSB), - PPC_I(VUPKHSH), - PPC_I(VUPKLPX), - PPC_I(VUPKLSB), - PPC_I(VUPKLSH), - PPC_I(VXOR), - PPC_I(MAX) // Total number of instruction types -}; - -#endif /* PPC_INSTRUCTIONS_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-jit.cpp b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-jit.cpp deleted file mode 100644 index 4b294401..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-jit.cpp +++ /dev/null @@ -1,942 +0,0 @@ -/* - * ppc-jit.cpp - PowerPC dynamic translation (mid-level) - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" -#include "cpu/jit/dyngen-exec.h" -#include "cpu/ppc/ppc-jit.hpp" -#include "cpu/ppc/ppc-cpu.hpp" -#include "cpu/ppc/ppc-instructions.hpp" -#include "cpu/ppc/ppc-operands.hpp" -#include "utils/utils-cpuinfo.hpp" -#include "utils/utils-sentinel.hpp" - -// Mid-level code generator info -const powerpc_jit::jit_info_t *powerpc_jit::jit_info[PPC_I(MAX)]; - -// PowerPC JIT initializer -powerpc_jit::powerpc_jit(dyngen_cpu_base cpu) - : powerpc_dyngen(cpu) -{ -} - -bool powerpc_jit::initialize(void) -{ - if (!powerpc_dyngen::initialize()) - return false; - - static bool once = true; - - if (once) { - once = false; - - // default to no handler - static const jit_info_t jit_not_available = { - -1, - (gen_handler_t)&powerpc_jit::gen_not_available, - }; - for (int i = 0; i < PPC_I(MAX); i++) - jit_info[i] = &jit_not_available; - - // generic altivec handlers - static const jit_info_t gen_vector[] = { -#define DEFINE_OP(MNEMO, GEN_OP, DYNGEN_OP) \ - { PPC_I(MNEMO), (gen_handler_t)&powerpc_jit::gen_vector_generic_##GEN_OP, &powerpc_dyngen::gen_op_##DYNGEN_OP } - DEFINE_OP(VADDFP, 2, vaddfp_VD_V0_V1), - DEFINE_OP(VSUBFP, 2, vsubfp_VD_V0_V1), - DEFINE_OP(VMADDFP, 3, vmaddfp_VD_V0_V1_V2), - DEFINE_OP(VNMSUBFP, 3, vnmsubfp_VD_V0_V1_V2), - DEFINE_OP(VAND, 2, vand_VD_V0_V1), - DEFINE_OP(VANDC, 2, vandc_VD_V0_V1), - DEFINE_OP(VNOR, 2, vnor_VD_V0_V1), - DEFINE_OP(VOR, 2, vor_VD_V0_V1), - DEFINE_OP(VXOR, 2, vxor_VD_V0_V1), - DEFINE_OP(MFVSCR, 1, mfvscr_VD), - DEFINE_OP(MTVSCR, 1, mtvscr_V0), -#undef DEFINE_OP -#define DEFINE_OP(MNEMO, GEN_OP) \ - { PPC_I(MNEMO), (gen_handler_t)&powerpc_jit::gen_vector_generic_##GEN_OP, } - DEFINE_OP(LVX, load), - DEFINE_OP(LVXL, load), - DEFINE_OP(LVEWX, load_word), - DEFINE_OP(STVX, store), - DEFINE_OP(STVXL, store), - DEFINE_OP(STVEWX, store_word), -#undef DEFINE_OP - }; - for (int i = 0; i < sizeof(gen_vector) / sizeof(gen_vector[0]); i++) - jit_info[gen_vector[i].mnemo] = &gen_vector[i]; - -#if defined(__i386__) || defined(__x86_64__) - // x86 optimized handlers - static const jit_info_t x86_vector[] = { -#define DEFINE_OP(MNEMO, GEN_OP) \ - { PPC_I(MNEMO), (gen_handler_t)&powerpc_jit::gen_x86_##GEN_OP, } - DEFINE_OP(MTVSCR, mtvscr), - DEFINE_OP(MFVSCR, mfvscr), - DEFINE_OP(LVX, lvx), - DEFINE_OP(LVXL, lvx), - DEFINE_OP(STVX, stvx), - DEFINE_OP(STVXL, stvx) -#undef DEFINE_OP - }; - for (int i = 0; i < sizeof(x86_vector) / sizeof(x86_vector[0]); i++) - jit_info[x86_vector[i].mnemo] = &x86_vector[i]; - - // MMX optimized handlers - static const jit_info_t mmx_vector[] = { -#define DEFINE_OP(MNEMO, GEN_OP, DYNGEN_OP) \ - { PPC_I(MNEMO), (gen_handler_t)&powerpc_jit::gen_mmx_arith_##GEN_OP, &powerpc_dyngen::gen_op_mmx_##DYNGEN_OP } - DEFINE_OP(VADDUBM, 2, vaddubm), - DEFINE_OP(VADDUHM, 2, vadduhm), - DEFINE_OP(VADDUWM, 2, vadduwm), - DEFINE_OP(VAND, 2, vand), - DEFINE_OP(VANDC, 2, vandc), - DEFINE_OP(VCMPEQUB, c, vcmpequb), - DEFINE_OP(VCMPEQUH, c, vcmpequh), - DEFINE_OP(VCMPEQUW, c, vcmpequw), - DEFINE_OP(VCMPGTSB, c, vcmpgtsb), - DEFINE_OP(VCMPGTSH, c, vcmpgtsh), - DEFINE_OP(VCMPGTSW, c, vcmpgtsw), - DEFINE_OP(VOR, 2, vor), - DEFINE_OP(VSUBUBM, 2, vsububm), - DEFINE_OP(VSUBUHM, 2, vsubuhm), - DEFINE_OP(VSUBUWM, 2, vsubuwm), - DEFINE_OP(VXOR, 2, vxor) -#undef DEFINE_OP - }; - if (cpuinfo_check_mmx()) { - for (int i = 0; i < sizeof(mmx_vector) / sizeof(mmx_vector[0]); i++) - jit_info[mmx_vector[i].mnemo] = &mmx_vector[i]; - } - - // SSE optimized handlers - static const jit_info_t sse_vector[] = { - // new MMX instructions brought into SSE capable CPUs -#define DEFINE_OP(MNEMO, GEN_OP, DYNGEN_OP) \ - { PPC_I(MNEMO), (gen_handler_t)&powerpc_jit::gen_mmx_arith_##GEN_OP, &powerpc_dyngen::gen_op_mmx_##DYNGEN_OP } - DEFINE_OP(VMAXSH, 2, vmaxsh), - DEFINE_OP(VMAXUB, 2, vmaxub), - DEFINE_OP(VMINSH, 2, vminsh), - DEFINE_OP(VMINUB, 2, vminub), -#undef DEFINE_OP - // full SSE instructions -#define DEFINE_OP(MNEMO, GEN_OP, TYPE_OP, SSE_OP) \ - { PPC_I(MNEMO), (gen_handler_t)&powerpc_jit::gen_sse_arith_##GEN_OP, (X86_INSN_SSE_##TYPE_OP << 8) | X86_SSE_##SSE_OP } - DEFINE_OP(VADDFP, 2, PS,ADD), - DEFINE_OP(VAND, 2, PS,AND), - DEFINE_OP(VANDC, s, PS,ANDN), - DEFINE_OP(VMAXFP, 2, PS,MAX), - DEFINE_OP(VMINFP, 2, PS,MIN), - DEFINE_OP(VOR, 2, PS,OR), - DEFINE_OP(VSUBFP, 2, PS,SUB), - DEFINE_OP(VXOR, 2, PS,XOR), - DEFINE_OP(VMINUB, 2, PI,PMINUB), - DEFINE_OP(VMAXUB, 2, PI,PMAXUB), - DEFINE_OP(VMINSH, 2, PI,PMINSW), - DEFINE_OP(VMAXSH, 2, PI,PMAXSW), - DEFINE_OP(VAVGUB, 2, PI,PAVGB), - DEFINE_OP(VAVGUH, 2, PI,PAVGW), -#undef DEFINE_OP -#define DEFINE_OP(MNEMO, COND) \ - { PPC_I(MNEMO), (gen_handler_t)&powerpc_jit::gen_sse_arith_c, X86_SSE_CC_##COND } - DEFINE_OP(VCMPEQFP, EQ), - DEFINE_OP(VCMPGEFP, GE), - DEFINE_OP(VCMPGTFP, GT), -#undef DEFINE_OP -#define DEFINE_OP(MNEMO, GEN_OP) \ - { PPC_I(MNEMO), (gen_handler_t)&powerpc_jit::gen_sse_##GEN_OP } - DEFINE_OP(VSEL, vsel), - DEFINE_OP(VMADDFP, vmaddfp), - DEFINE_OP(VNMSUBFP, vnmsubfp) -#undef DEFINE_OP - }; - - if (cpuinfo_check_sse()) { - for (int i = 0; i < sizeof(sse_vector) / sizeof(sse_vector[0]); i++) - jit_info[sse_vector[i].mnemo] = &sse_vector[i]; - } - - // SSE2 optimized handlers - static const jit_info_t sse2_vector[] = { -#define DEFINE_OP(MNEMO, GEN_OP, TYPE_OP, SSE_OP) \ - { PPC_I(MNEMO), (gen_handler_t)&powerpc_jit::gen_sse2_arith_##GEN_OP, (X86_INSN_SSE_##TYPE_OP << 8) | X86_SSE_##SSE_OP } - DEFINE_OP(VADDUBM, 2, PI,PADDB), - DEFINE_OP(VADDUHM, 2, PI,PADDW), - DEFINE_OP(VADDUWM, 2, PI,PADDD), - DEFINE_OP(VSUBUBM, 2, PI,PSUBB), - DEFINE_OP(VSUBUHM, 2, PI,PSUBW), - DEFINE_OP(VSUBUWM, 2, PI,PSUBD), - DEFINE_OP(VAND, 2, PI,PAND), - DEFINE_OP(VANDC, s, PI,PANDN), - DEFINE_OP(VOR, 2, PI,POR), - DEFINE_OP(VXOR, 2, PI,PXOR), - DEFINE_OP(VCMPEQUB, c, PI,PCMPEQB), - DEFINE_OP(VCMPEQUH, c, PI,PCMPEQW), - DEFINE_OP(VCMPEQUW, c, PI,PCMPEQD), - DEFINE_OP(VCMPGTSB, c, PI,PCMPGTB), - DEFINE_OP(VCMPGTSH, c, PI,PCMPGTW), - DEFINE_OP(VCMPGTSW, c, PI,PCMPGTD), - DEFINE_OP(VREFP, 2, PS,RCP), - DEFINE_OP(VRSQRTEFP,2, PS,RSQRT), -#undef DEFINE_OP -#define DEFINE_OP(MNEMO, GEN_OP) \ - { PPC_I(MNEMO), (gen_handler_t)&powerpc_jit::gen_sse2_##GEN_OP, } - DEFINE_OP(VSEL, vsel), - DEFINE_OP(VSLDOI, vsldoi), - DEFINE_OP(VSPLTB, vspltb), - DEFINE_OP(VSPLTH, vsplth), - DEFINE_OP(VSPLTW, vspltw), - DEFINE_OP(VSPLTISB, vspltisb), - DEFINE_OP(VSPLTISH, vspltish), - DEFINE_OP(VSPLTISW, vspltisw) -#undef DEFINE_OP - }; - - if (cpuinfo_check_sse2()) { - for (int i = 0; i < sizeof(sse2_vector) / sizeof(sse2_vector[0]); i++) - jit_info[sse2_vector[i].mnemo] = &sse2_vector[i]; - } - - // SSSE3 optimized handlers - static const jit_info_t ssse3_vector[] = { -#define DEFINE_OP(MNEMO, GEN_OP) \ - { PPC_I(MNEMO), (gen_handler_t)&powerpc_jit::gen_ssse3_##GEN_OP, } - DEFINE_OP(LVX, lvx), - DEFINE_OP(LVXL, lvx), - DEFINE_OP(STVX, stvx), - DEFINE_OP(STVXL, stvx), - DEFINE_OP(VPERM, vperm) -#undef DEFINE_OP - }; - - if (cpuinfo_check_ssse3()) { - for (int i = 0; i < sizeof(ssse3_vector) / sizeof(ssse3_vector[0]); i++) - jit_info[ssse3_vector[i].mnemo] = &ssse3_vector[i]; - } -#endif - } - - return true; -} - -// Dispatch mid-level code generators -bool powerpc_jit::gen_vector_1(int mnemo, int vD) -{ - return (this->*((bool (powerpc_jit::*)(int, int))jit_info[mnemo]->handler))(mnemo, vD); -} - -bool powerpc_jit::gen_vector_2(int mnemo, int vD, int vA, int vB) -{ - return (this->*((bool (powerpc_jit::*)(int, int, int, int))jit_info[mnemo]->handler))(mnemo, vD, vA, vB); -} - -bool powerpc_jit::gen_vector_3(int mnemo, int vD, int vA, int vB, int vC) -{ - return (this->*((bool (powerpc_jit::*)(int, int, int, int, int))jit_info[mnemo]->handler))(mnemo, vD, vA, vB, vC); -} - -bool powerpc_jit::gen_vector_compare(int mnemo, int vD, int vA, int vB, bool Rc) -{ - return (this->*((bool (powerpc_jit::*)(int, int, int, int, bool))jit_info[mnemo]->handler))(mnemo, vD, vA, vB, Rc); -} - - -bool powerpc_jit::gen_not_available(int mnemo) -{ - return false; -} - -bool powerpc_jit::gen_vector_generic_1(int mnemo, int vD) -{ - gen_load_ad_VD_VR(vD); - (this->*(jit_info[mnemo]->o.dyngen_handler))(); - return true; -} - -bool powerpc_jit::gen_vector_generic_2(int mnemo, int vD, int vA, int vB) -{ - gen_load_ad_VD_VR(vD); - gen_load_ad_V0_VR(vA); - gen_load_ad_V1_VR(vB); - (this->*(jit_info[mnemo]->o.dyngen_handler))(); - return true; -} - -bool powerpc_jit::gen_vector_generic_3(int mnemo, int vD, int vA, int vB, int vC) -{ - gen_load_ad_VD_VR(vD); - gen_load_ad_V0_VR(vA); - gen_load_ad_V1_VR(vB); - gen_load_ad_V2_VR(vC); - (this->*(jit_info[mnemo]->o.dyngen_handler))(); - return true; -} - -bool powerpc_jit::gen_vector_generic_c(int mnemo, int vD, int vA, int vB, bool Rc) -{ - gen_vector_generic_2(mnemo, vD, vA, vB); - if (Rc) - gen_record_cr6_VD(); - return true; -} - -bool powerpc_jit::gen_vector_generic_load(int mnemo, int vD, int rA, int rB) -{ - // NOTE: T0/VD are clobbered in the following instructions! - gen_load_T0_GPR(rB); - if (rA != 0) { - gen_load_T1_GPR(rA); - gen_add_32_T0_T1(); - } - gen_load_vect_VD_T0(vD); - return true; -} - -bool powerpc_jit::gen_vector_generic_store(int mnemo, int vS, int rA, int rB) -{ - // NOTE: T0/VS are clobbered in the following instructions! - gen_load_T0_GPR(rB); - if (rA != 0) { - gen_load_T1_GPR(rA); - gen_add_32_T0_T1(); - } - gen_store_vect_VS_T0(vS); - return true; -} - -bool powerpc_jit::gen_vector_generic_load_word(int mnemo, int vD, int rA, int rB) -{ - // NOTE: T0/VD are clobbered in the following instructions! - gen_load_T0_GPR(rB); - if (rA != 0) { - gen_load_T1_GPR(rA); - gen_add_32_T0_T1(); - } - gen_load_word_VD_T0(vD); - return true; -} - -bool powerpc_jit::gen_vector_generic_store_word(int mnemo, int vS, int rA, int rB) -{ - // NOTE: T0/VS are clobbered in the following instructions! - gen_load_T0_GPR(rB); - if (rA != 0) { - gen_load_T1_GPR(rA); - gen_add_32_T0_T1(); - } - gen_store_word_VS_T0(vS); - return true; -} - -#if PPC_PROFILE_REGS_USE -// XXX update reginfo[] counts for xPPC_GPR() accesses -static uint8 dummy_ppc_context[sizeof(powerpc_cpu)]; -#define xPPC_CONTEXT ((powerpc_cpu *)dummy_ppc_context) -#else -#define xPPC_CONTEXT ((powerpc_cpu *)0) -#endif -#define xPPC_FIELD(M) (((uintptr)&xPPC_CONTEXT->M) - (uintptr)xPPC_CONTEXT) -#define xPPC_GPR(N) xPPC_FIELD(gpr(N)) -#define xPPC_VR(N) xPPC_FIELD(vr(N)) -#define xPPC_CR xPPC_FIELD(cr()) -#define xPPC_VSCR xPPC_FIELD(vscr()) - -#if defined(__i386__) || defined(__x86_64__) -/* - * X86 optimizations - */ - -// mtvscr -bool powerpc_jit::gen_x86_mtvscr(int mnemo, int vD) -{ - gen_mov_32(x86_memory_operand(xPPC_VR(vD) + 3*4, REG_CPU_ID), REG_T0_ID); - gen_mov_32(REG_T0_ID, x86_memory_operand(xPPC_VSCR, REG_CPU_ID)); - return true; -} - -// mfvscr -bool powerpc_jit::gen_x86_mfvscr(int mnemo, int vB) -{ - gen_xor_32(REG_T0_ID, REG_T0_ID); - gen_mov_32(x86_memory_operand(xPPC_VSCR, REG_CPU_ID), REG_T1_ID); -#if SIZEOF_VOID_P == 8 - gen_mov_64(REG_T0_ID, x86_memory_operand(xPPC_VR(vB) + 0*4, REG_CPU_ID)); -#else - gen_mov_32(REG_T0_ID, x86_memory_operand(xPPC_VR(vB) + 0*4, REG_CPU_ID)); - gen_mov_32(REG_T0_ID, x86_memory_operand(xPPC_VR(vB) + 1*4, REG_CPU_ID)); -#endif - gen_mov_32(REG_T0_ID, x86_memory_operand(xPPC_VR(vB) + 2*4, REG_CPU_ID)); - gen_mov_32(REG_T1_ID, x86_memory_operand(xPPC_VR(vB) + 3*4, REG_CPU_ID)); - return true; -} - -// lvx, lvxl -bool powerpc_jit::gen_x86_lvx(int mnemo, int vD, int rA, int rB) -{ - gen_mov_32(x86_memory_operand(xPPC_GPR(rB), REG_CPU_ID), REG_T0_ID); - if (rA != 0) - gen_add_32(x86_memory_operand(xPPC_GPR(rA), REG_CPU_ID), REG_T0_ID); - gen_and_32(x86_immediate_operand(-16), REG_T0_ID); -#if SIZEOF_VOID_P == 8 - gen_mov_64(x86_memory_operand(0, REG_T0_ID), REG_T1_ID); - gen_mov_64(x86_memory_operand(8, REG_T0_ID), REG_T2_ID); - gen_bswap_64(REG_T1_ID); - gen_bswap_64(REG_T2_ID); - gen_rol_64(x86_immediate_operand(32), REG_T1_ID); - gen_rol_64(x86_immediate_operand(32), REG_T2_ID); - gen_mov_64(REG_T1_ID, x86_memory_operand(xPPC_VR(vD) + 0, REG_CPU_ID)); - gen_mov_64(REG_T2_ID, x86_memory_operand(xPPC_VR(vD) + 8, REG_CPU_ID)); -#else - gen_mov_32(x86_memory_operand(0*4, REG_T0_ID), REG_T1_ID); - gen_mov_32(x86_memory_operand(1*4, REG_T0_ID), REG_T2_ID); - gen_bswap_32(REG_T1_ID); - gen_bswap_32(REG_T2_ID); - gen_mov_32(REG_T1_ID, x86_memory_operand(xPPC_VR(vD) + 0*4, REG_CPU_ID)); - gen_mov_32(REG_T2_ID, x86_memory_operand(xPPC_VR(vD) + 1*4, REG_CPU_ID)); - gen_mov_32(x86_memory_operand(2*4, REG_T0_ID), REG_T1_ID); - gen_mov_32(x86_memory_operand(3*4, REG_T0_ID), REG_T2_ID); - gen_bswap_32(REG_T1_ID); - gen_bswap_32(REG_T2_ID); - gen_mov_32(REG_T1_ID, x86_memory_operand(xPPC_VR(vD) + 2*4, REG_CPU_ID)); - gen_mov_32(REG_T2_ID, x86_memory_operand(xPPC_VR(vD) + 3*4, REG_CPU_ID)); -#endif - return true; -} - -// stvx, stvxl -bool powerpc_jit::gen_x86_stvx(int mnemo, int vS, int rA, int rB) -{ - // NOTE: primitive scheduling - gen_mov_32(x86_memory_operand(xPPC_GPR(rB), REG_CPU_ID), REG_T0_ID); -#if SIZEOF_VOID_P == 8 - gen_mov_64(x86_memory_operand(xPPC_VR(vS) + 0, REG_CPU_ID), REG_T1_ID); - gen_mov_64(x86_memory_operand(xPPC_VR(vS) + 8, REG_CPU_ID), REG_T2_ID); - if (rA != 0) - gen_add_32(x86_memory_operand(xPPC_GPR(rA), REG_CPU_ID), REG_T0_ID); - gen_bswap_64(REG_T1_ID); - gen_bswap_64(REG_T2_ID); - gen_and_32(x86_immediate_operand(-16), REG_T0_ID); - gen_rol_64(x86_immediate_operand(32), REG_T1_ID); - gen_rol_64(x86_immediate_operand(32), REG_T2_ID); - gen_mov_64(REG_T1_ID, x86_memory_operand(0, REG_T0_ID)); - gen_mov_64(REG_T2_ID, x86_memory_operand(8, REG_T0_ID)); -#else - gen_mov_32(x86_memory_operand(xPPC_VR(vS) + 0*4, REG_CPU_ID), REG_T1_ID); - gen_mov_32(x86_memory_operand(xPPC_VR(vS) + 1*4, REG_CPU_ID), REG_T2_ID); - if (rA != 0) - gen_add_32(x86_memory_operand(xPPC_GPR(rA), REG_CPU_ID), REG_T0_ID); - gen_bswap_32(REG_T1_ID); - gen_bswap_32(REG_T2_ID); - gen_and_32(x86_immediate_operand(-16), REG_T0_ID); - gen_mov_32(REG_T1_ID, x86_memory_operand(0*4, REG_T0_ID)); - gen_mov_32(REG_T2_ID, x86_memory_operand(1*4, REG_T0_ID)); - gen_mov_32(x86_memory_operand(xPPC_VR(vS) + 2*4, REG_CPU_ID), REG_T1_ID); - gen_mov_32(x86_memory_operand(xPPC_VR(vS) + 3*4, REG_CPU_ID), REG_T2_ID); - gen_bswap_32(REG_T1_ID); - gen_bswap_32(REG_T2_ID); - gen_mov_32(REG_T1_ID, x86_memory_operand(2*4, REG_T0_ID)); - gen_mov_32(REG_T2_ID, x86_memory_operand(3*4, REG_T0_ID)); -#endif - return true; -} - -/* - * MMX optimizations - */ - -// Generic MMX arith -bool powerpc_jit::gen_mmx_arith_2(int mnemo, int vD, int vA, int vB) -{ - gen_load_ad_VD_VR(vD); - gen_load_ad_V0_VR(vA); - gen_load_ad_V1_VR(vB); - (this->*(jit_info[mnemo]->o.dyngen_handler))(); - gen_op_emms(); - return true; -} - -// MMX comparison -bool powerpc_jit::gen_mmx_arith_c(int mnemo, int vD, int vA, int vB, bool Rc) -{ - gen_mmx_arith_2(mnemo, vD, vA, vB); - if (Rc) - gen_record_cr6_VD(); - return true; -} - -/* - * SSE optimizations - */ - -// Record CR6 (vD contains the result of the CMP instruction) -void powerpc_jit::gen_sse_record_cr6(int vD) -{ - // NOTE: %ecx & %edx are caller saved registers and not static allocated at this time - assert(REG_T2_ID != (int)X86_ECX && REG_T2_ID != (int)X86_EDX); - gen_xor_32(X86_ECX, X86_ECX); // xor %t0,%t0 - gen_xor_32(X86_EDX, X86_EDX); // xor %t1,%t1 - gen_insn(X86_INSN_SSE_PS, X86_SSE_MOVMSK, vD, REG_T2_ID); // movmskps %v0,%t2 - gen_cmp_32(x86_immediate_operand(0), REG_T2_ID); // cmp $0,%t2 - gen_setcc(X86_CC_Z, X86_CL); // sete %t0 - gen_cmp_32(x86_immediate_operand(0xf), REG_T2_ID); // cmp $0xf,%t1 - gen_setcc(X86_CC_E, X86_DL); // sete %t1 - gen_lea_32(x86_memory_operand(0, X86_ECX, X86_EDX, 4), REG_T2_ID); // %t2 = %t0 + %t1*4 - gen_mov_32(x86_memory_operand(xPPC_CR, REG_CPU_ID), X86_ECX); // mov $xPPC_CR(%cpu),%t0 - gen_shl_32(x86_immediate_operand(5), REG_T2_ID); // %t2 holds new cr6 - gen_and_32(x86_immediate_operand(0xffffff0f), X86_ECX); // and $0xffffff0f,%t0 - gen_or_32(X86_ECX, REG_T2_ID); // or %t0,%t2 - gen_mov_32(REG_T2_ID, x86_memory_operand(xPPC_CR, REG_CPU_ID)); // mov %t0,$xPPC_CR(%cpu) -} - -// Generic SSE arith -bool powerpc_jit::gen_sse_arith_2(int mnemo, int vD, int vA, int vB) -{ - gen_movaps(x86_memory_operand(xPPC_VR(vA), REG_CPU_ID), REG_V0_ID); - const uint16 insn = jit_info[mnemo]->o.value; - gen_insn(insn >> 8, insn & 0xff, x86_memory_operand(xPPC_VR(vB), REG_CPU_ID), REG_V0_ID); - gen_movaps(REG_V0_ID, x86_memory_operand(xPPC_VR(vD), REG_CPU_ID)); - return true; -} - -// Generic SSE arith with swapped operands (ANDPS) -bool powerpc_jit::gen_sse_arith_s(int mnemo, int vD, int vA, int vB) -{ - return gen_sse_arith_2(mnemo, vD, vB, vA); -} - -// SSE comparison (CMPPS) -bool powerpc_jit::gen_sse_arith_c(int mnemo, int vD, int vA, int vB, bool Rc) -{ - // NOTE: this uses swapped operands for GT, GE (no change for EQ) - gen_movaps(x86_memory_operand(xPPC_VR(vB), REG_CPU_ID), REG_V0_ID); - gen_cmpps(jit_info[mnemo]->o.value, x86_memory_operand(xPPC_VR(vA), REG_CPU_ID), REG_V0_ID); - gen_movaps(REG_V0_ID, x86_memory_operand(xPPC_VR(vD), REG_CPU_ID)); - if (Rc) - gen_sse_record_cr6(REG_V0_ID); - return true; -} - -// vmaddfp -bool powerpc_jit::gen_sse_vmaddfp(int mnemo, int vD, int vA, int vB, int vC) -{ - gen_movaps(x86_memory_operand(xPPC_VR(vA), REG_CPU_ID), REG_V0_ID); - gen_mulps(x86_memory_operand(xPPC_VR(vC), REG_CPU_ID), REG_V0_ID); - gen_addps(x86_memory_operand(xPPC_VR(vB), REG_CPU_ID), REG_V0_ID); - gen_movaps(REG_V0_ID, x86_memory_operand(xPPC_VR(vD), REG_CPU_ID)); - return true; -} - -// vnmsubfp -bool powerpc_jit::gen_sse_vnmsubfp(int mnemo, int vD, int vA, int vB, int vC) -{ - gen_movaps(x86_memory_operand(xPPC_VR(vA), REG_CPU_ID), REG_V0_ID); - gen_xorps(REG_V1_ID, REG_V1_ID); - gen_mulps(x86_memory_operand(xPPC_VR(vC), REG_CPU_ID), REG_V0_ID); - gen_subps(x86_memory_operand(xPPC_VR(vB), REG_CPU_ID), REG_V0_ID); - gen_subps(REG_V0_ID, REG_V1_ID); - gen_movaps(REG_V1_ID, x86_memory_operand(xPPC_VR(vD), REG_CPU_ID)); - return true; -} - -// vsel -bool powerpc_jit::gen_sse_vsel(int mnemo, int vD, int vA, int vB, int vC) -{ - // NOTE: simplified into (vB & vC) | (vA & ~vC) - gen_movaps(x86_memory_operand(xPPC_VR(vC), REG_CPU_ID), REG_V0_ID); - gen_movaps(x86_memory_operand(xPPC_VR(vB), REG_CPU_ID), REG_V1_ID); - gen_movaps(x86_memory_operand(xPPC_VR(vA), REG_CPU_ID), REG_V2_ID); - gen_andps(REG_V0_ID, REG_V1_ID); - gen_andnps(REG_V2_ID, REG_V0_ID); - gen_orps(REG_V1_ID, REG_V0_ID); - gen_movaps(REG_V0_ID, x86_memory_operand(xPPC_VR(vD), REG_CPU_ID)); - return true; -} - -/* - * SSE2 optimizations - */ - -// Record CR6 (vD contains the result of the CMP instruction) -void powerpc_jit::gen_sse2_record_cr6(int vD) -{ - // NOTE: %ecx & %edx are caller saved registers and not static allocated at this time - assert(REG_T2_ID != (int)X86_ECX && REG_T2_ID != (int)X86_EDX); - gen_xor_32(X86_ECX, X86_ECX); // xor %t0,%t0 - gen_xor_32(X86_EDX, X86_EDX); // xor %t1,%t1 - gen_pmovmskb(vD, REG_T2_ID); // pmovmskb %v0,%t2 - gen_cmp_32(x86_immediate_operand(0), REG_T2_ID); // cmp $0,%t2 - gen_setcc(X86_CC_Z, X86_CL); // sete %t0 - gen_cmp_32(x86_immediate_operand(0xffff), REG_T2_ID); // cmp $0xffff,%t1 - gen_setcc(X86_CC_E, X86_EDX); // sete %t1 - gen_lea_32(x86_memory_operand(0, X86_ECX, X86_EDX, 4), REG_T2_ID); // %t2 = %t0 + %t1*4 - gen_mov_32(x86_memory_operand(xPPC_CR, REG_CPU_ID), X86_ECX); // mov $xPPC_CR(%cpu),%t0 - gen_shl_32(x86_immediate_operand(5), REG_T2_ID); // %t2 holds new cr6 - gen_and_32(x86_immediate_operand(0xffffff0f), X86_ECX); // and $0xffffff0f,%t0 - gen_or_32(X86_ECX, REG_T2_ID); // or %t0,%t2 - gen_mov_32(REG_T2_ID, x86_memory_operand(xPPC_CR, REG_CPU_ID)); // mov %t0,$xPPC_CR(%cpu) -} - -// Generic SSE2 arith -bool powerpc_jit::gen_sse2_arith_2(int mnemo, int vD, int vA, int vB) -{ - gen_movdqa(x86_memory_operand(xPPC_VR(vA), REG_CPU_ID), REG_V0_ID); - const uint16 insn = jit_info[mnemo]->o.value; - gen_insn(insn >> 8, insn & 0xff, x86_memory_operand(xPPC_VR(vB), REG_CPU_ID), REG_V0_ID); - gen_movdqa(REG_V0_ID, x86_memory_operand(xPPC_VR(vD), REG_CPU_ID)); - return true; -} - -// Generic SSE2 arith with swapped operands (PANDN) -bool powerpc_jit::gen_sse2_arith_s(int mnemo, int vD, int vA, int vB) -{ - return gen_sse2_arith_2(mnemo, vD, vB, vA); -} - -// SSE2 comparison (PCMPEQ, PCMPGT) -bool powerpc_jit::gen_sse2_arith_c(int mnemo, int vD, int vA, int vB, bool Rc) -{ - gen_sse2_arith_2(mnemo, vD, vA, vB); - if (Rc) - gen_sse2_record_cr6(REG_V0_ID); - return true; -} - -// vsldoi -bool powerpc_jit::gen_sse2_vsldoi(int mnemo, int vD, int vA, int vB, int SH) -{ - // Optimize out vsldoi vX,vX,vB,0 - if (SH == 0 && vA == vD) - return true; - - gen_movdqa(x86_memory_operand(xPPC_VR(vA), REG_CPU_ID), REG_V0_ID); - if (SH) { - gen_movdqa(x86_memory_operand(xPPC_VR(vB), REG_CPU_ID), REG_V1_ID); - gen_pshufd(x86_immediate_operand(0x1b), REG_V0_ID, REG_V0_ID); - gen_pshufd(x86_immediate_operand(0x1b), REG_V1_ID, REG_V1_ID); - gen_pslldq(x86_immediate_operand(SH), REG_V0_ID); - gen_psrldq(x86_immediate_operand(16 - SH), REG_V1_ID); - gen_por(REG_V1_ID, REG_V0_ID); - gen_pshufd(x86_immediate_operand(0x1b), REG_V0_ID, REG_V0_ID); - } - gen_movdqa(REG_V0_ID, x86_memory_operand(xPPC_VR(vD), REG_CPU_ID)); - return true; -} - -// vsel -bool powerpc_jit::gen_sse2_vsel(int mnemo, int vD, int vA, int vB, int vC) -{ - // NOTE: simplified into (vB & vC) | (vA & ~vC) - gen_movdqa(x86_memory_operand(xPPC_VR(vC), REG_CPU_ID), REG_V0_ID); - gen_movdqa(x86_memory_operand(xPPC_VR(vB), REG_CPU_ID), REG_V1_ID); - gen_movdqa(x86_memory_operand(xPPC_VR(vA), REG_CPU_ID), REG_V2_ID); - gen_pand(REG_V0_ID, REG_V1_ID); - gen_pandn(REG_V2_ID, REG_V0_ID); - gen_por(REG_V1_ID, REG_V0_ID); - gen_movdqa(REG_V0_ID, x86_memory_operand(xPPC_VR(vD), REG_CPU_ID)); - return true; -} - -/* - * Vector splat instructions - * - * Reference: "Optimizing subroutines in assembly language", Agner, table 13.6 - */ - -void powerpc_jit::gen_sse2_vsplat(int vD, int rValue) -{ - gen_movd_lx(rValue, REG_V0_ID); - gen_pshufd(x86_immediate_operand(0), REG_V0_ID, REG_V0_ID); - gen_movdqa(REG_V0_ID, x86_memory_operand(xPPC_VR(vD), REG_CPU_ID)); -} - -// vspltisb -bool powerpc_jit::gen_sse2_vspltisb(int mnemo, int vD, int SIMM) -{ - switch (SIMM) { - case 0: - gen_pxor(REG_V0_ID, REG_V0_ID); - goto commit; - case 1: - gen_pcmpeqw(REG_V0_ID, REG_V0_ID); - gen_psrlw(x86_immediate_operand(15), REG_V0_ID); - gen_packuswb(REG_V0_ID, REG_V0_ID); - goto commit; - case 2: - gen_pcmpeqw(REG_V0_ID, REG_V0_ID); - gen_psrlw(x86_immediate_operand(15), REG_V0_ID); - gen_psllw(x86_immediate_operand(1), REG_V0_ID); - gen_packuswb(REG_V0_ID, REG_V0_ID); - goto commit; - case 3: - gen_pcmpeqw(REG_V0_ID, REG_V0_ID); - gen_psrlw(x86_immediate_operand(14), REG_V0_ID); - gen_packuswb(REG_V0_ID, REG_V0_ID); - goto commit; - case 4: - gen_pcmpeqw(REG_V0_ID, REG_V0_ID); - gen_psrlw(x86_immediate_operand(15), REG_V0_ID); - gen_psllw(x86_immediate_operand(2), REG_V0_ID); - gen_packuswb(REG_V0_ID, REG_V0_ID); - goto commit; - case -1: - gen_pcmpeqw(REG_V0_ID, REG_V0_ID); - goto commit; - case -2: - gen_pcmpeqw(REG_V0_ID, REG_V0_ID); - gen_psllw(x86_immediate_operand(1), REG_V0_ID); - gen_packsswb(REG_V0_ID, REG_V0_ID); - goto commit; - { - commit: - gen_movdqa(REG_V0_ID, x86_memory_operand(xPPC_VR(vD), REG_CPU_ID)); - break; - } - default: - const uint32 value = ((uint8)SIMM) * 0x01010101; - gen_mov_32(x86_immediate_operand(value), REG_T0_ID); - gen_sse2_vsplat(vD, REG_T0_ID); - break; - } - return true; -} - -// vspltish -bool powerpc_jit::gen_sse2_vspltish(int mnemo, int vD, int SIMM) -{ - switch (SIMM) { - case 0: - gen_pxor(REG_V0_ID, REG_V0_ID); - goto commit; - case 1: - gen_pcmpeqw(REG_V0_ID, REG_V0_ID); - gen_psrlw(x86_immediate_operand(15), REG_V0_ID); - goto commit; - case 2: - gen_pcmpeqw(REG_V0_ID, REG_V0_ID); - gen_psrlw(x86_immediate_operand(15), REG_V0_ID); - gen_psllw(x86_immediate_operand(1), REG_V0_ID); - goto commit; - case 3: - gen_pcmpeqw(REG_V0_ID, REG_V0_ID); - gen_psrlw(x86_immediate_operand(14), REG_V0_ID); - goto commit; - case 4: - gen_pcmpeqw(REG_V0_ID, REG_V0_ID); - gen_psrlw(x86_immediate_operand(15), REG_V0_ID); - gen_psllw(x86_immediate_operand(2), REG_V0_ID); - goto commit; - case -1: - gen_pcmpeqw(REG_V0_ID, REG_V0_ID); - goto commit; - case -2: - gen_pcmpeqw(REG_V0_ID, REG_V0_ID); - gen_psllw(x86_immediate_operand(1), REG_V0_ID); - goto commit; - { - commit: - gen_movdqa(REG_V0_ID, x86_memory_operand(xPPC_VR(vD), REG_CPU_ID)); - break; - } - default: - const uint32 value = ((uint16)SIMM) * 0x10001; - gen_mov_32(x86_immediate_operand(value), REG_T0_ID); - gen_sse2_vsplat(vD, REG_T0_ID); - break; - } - return true; -} - -// vspltisw -bool powerpc_jit::gen_sse2_vspltisw(int mnemo, int vD, int SIMM) -{ - switch (SIMM) { - case 0: - gen_pxor(REG_V0_ID, REG_V0_ID); - goto commit; - case 1: - gen_pcmpeqd(REG_V0_ID, REG_V0_ID); - gen_psrld(x86_immediate_operand(31), REG_V0_ID); - goto commit; - case 2: - gen_pcmpeqd(REG_V0_ID, REG_V0_ID); - gen_psrld(x86_immediate_operand(31), REG_V0_ID); - gen_pslld(x86_immediate_operand(1), REG_V0_ID); - goto commit; - case 3: - gen_pcmpeqd(REG_V0_ID, REG_V0_ID); - gen_psrld(x86_immediate_operand(30), REG_V0_ID); - goto commit; - case 4: - gen_pcmpeqd(REG_V0_ID, REG_V0_ID); - gen_psrld(x86_immediate_operand(31), REG_V0_ID); - gen_pslld(x86_immediate_operand(2), REG_V0_ID); - goto commit; - case -1: - gen_pcmpeqd(REG_V0_ID, REG_V0_ID); - goto commit; - case -2: - gen_pcmpeqd(REG_V0_ID, REG_V0_ID); - gen_pslld(x86_immediate_operand(1), REG_V0_ID); - goto commit; - { - commit: - gen_movdqa(REG_V0_ID, x86_memory_operand(xPPC_VR(vD), REG_CPU_ID)); - break; - } - default: - const uint32 value = SIMM; - gen_mov_32(x86_immediate_operand(value), REG_T0_ID); - gen_sse2_vsplat(vD, REG_T0_ID); - } - return true; -} - -// vspltb -bool powerpc_jit::gen_sse2_vspltb(int mnemo, int vD, int UIMM, int vB) -{ - const int N = ev_mixed::byte_element(UIMM & 15); - gen_mov_zx_8_32(x86_memory_operand(xPPC_VR(vB) + N * 1, REG_CPU_ID), REG_T0_ID); - gen_imul_32(x86_immediate_operand(0x01010101), REG_T0_ID, REG_T0_ID); - gen_sse2_vsplat(vD, REG_T0_ID); - return true; -} - -// vsplth -bool powerpc_jit::gen_sse2_vsplth(int mnemo, int vD, int UIMM, int vB) -{ - const int N = ev_mixed::half_element(UIMM & 7); - gen_mov_zx_16_32(x86_memory_operand(xPPC_VR(vB) + N * 2, REG_CPU_ID), REG_T0_ID); - gen_imul_32(x86_immediate_operand(0x10001), REG_T0_ID, REG_T0_ID); - gen_sse2_vsplat(vD, REG_T0_ID); - return true; -} - -// vspltw -bool powerpc_jit::gen_sse2_vspltw(int mnemo, int vD, int UIMM, int vB) -{ - const int N = UIMM & 3; - gen_mov_32(x86_memory_operand(xPPC_VR(vB) + N * 4, REG_CPU_ID), REG_T0_ID); - gen_sse2_vsplat(vD, REG_T0_ID); - return true; -} - -/* - * SSSE3 optimizations - */ - -uintptr powerpc_jit::gen_ssse3_vswap_mask(void) -{ - // We must get the following bytes in memory - // 0x3 0x2 0x1 0x0 0x7 0x6 0x5 0x4 0xb 0xa 0x9 0x8 0xf 0xe 0xd 0xc - static uintptr control_mask = 0; - if (control_mask == 0) { - static const uint8 value[16] = { - 0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04, - 0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c - }; - control_mask = (uintptr)copy_data(value, sizeof(value)); - assert(control_mask <= 0xffffffff); - } - return control_mask; -} - -// lvx, lvxl -bool powerpc_jit::gen_ssse3_lvx(int mnemo, int vD, int rA, int rB) -{ - gen_mov_32(x86_memory_operand(xPPC_GPR(rB), REG_CPU_ID), REG_T0_ID); - if (rA != 0) - gen_add_32(x86_memory_operand(xPPC_GPR(rA), REG_CPU_ID), REG_T0_ID); - gen_and_32(x86_immediate_operand(-16), REG_T0_ID); - - x86_memory_operand vswapmask(gen_ssse3_vswap_mask(), X86_NOREG); - gen_movdqa(x86_memory_operand(0, REG_T0_ID), REG_V0_ID); - gen_insn(X86_INSN_SSE_3P, X86_SSSE3_PSHUFB, vswapmask, REG_V0_ID); - gen_movdqa(REG_V0_ID, x86_memory_operand(xPPC_VR(vD), REG_CPU_ID)); - return true; -} - -// stvx, stvxl -bool powerpc_jit::gen_ssse3_stvx(int mnemo, int vS, int rA, int rB) -{ - gen_mov_32(x86_memory_operand(xPPC_GPR(rB), REG_CPU_ID), REG_T0_ID); - if (rA != 0) - gen_add_32(x86_memory_operand(xPPC_GPR(rA), REG_CPU_ID), REG_T0_ID); - gen_and_32(x86_immediate_operand(-16), REG_T0_ID); - - x86_memory_operand vswapmask(gen_ssse3_vswap_mask(), X86_NOREG); - gen_movdqa(x86_memory_operand(xPPC_VR(vS), REG_CPU_ID), REG_V0_ID); - gen_insn(X86_INSN_SSE_3P, X86_SSSE3_PSHUFB, vswapmask, REG_V0_ID); - gen_movdqa(REG_V0_ID, x86_memory_operand(0, REG_T0_ID)); - return true; -} - -// vperm -bool powerpc_jit::gen_ssse3_vperm(int mnemo, int vD, int vA, int vB, int vC) -{ - static uintptr zero_mask = 0; - if (zero_mask == 0) { - static const uint8 value[16] = { - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 - }; - zero_mask = (uintptr)copy_data(value, sizeof(value)); - assert(zero_mask <= 0xffffffff); - } - - static uintptr index_mask = 0; - if (index_mask == 0) { - static const uint8 value[16] = { - 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, - 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f - }; - index_mask = (uintptr)copy_data(value, sizeof(value)); - assert(index_mask <= 0xffffffff); - }; - - /* - * PROP_IMSB(T) = T.index|most significant bit of T.index (T.bit0 = T.bit3) - * --> used to handle one vector at a time - * - * T.A = PSHUFB(PROP_IMSB(vC & IndexMask), vA); - * T.B = PSHUFB(PROP_IMSB(vC & IndexMaxk) ^ ZeroMask, vB); - * vD = T.A | T.B - */ - x86_memory_operand swap_mask(gen_ssse3_vswap_mask(), X86_NOREG); - gen_movdqa(x86_memory_operand(xPPC_VR(vC), REG_CPU_ID), REG_V2_ID); - gen_movdqa(swap_mask, REG_V3_ID); - gen_movdqa(x86_memory_operand(xPPC_VR(vA), REG_CPU_ID), REG_V0_ID); - gen_pand(x86_memory_operand(index_mask, X86_NOREG), REG_V2_ID); - gen_insn(X86_INSN_SSE_3P, X86_SSSE3_PSHUFB, REG_V3_ID, REG_V0_ID); - gen_insn(X86_INSN_SSE_3P, X86_SSSE3_PSHUFB, REG_V3_ID, REG_V2_ID); - gen_movdqa(REG_V2_ID, REG_V1_ID); - gen_psllq(x86_immediate_operand(3), REG_V2_ID); - gen_pand(x86_memory_operand(zero_mask, X86_NOREG), REG_V2_ID); - gen_por(REG_V2_ID, REG_V1_ID); - gen_movdqa(x86_memory_operand(xPPC_VR(vB), REG_CPU_ID), REG_V2_ID); - gen_insn(X86_INSN_SSE_3P, X86_SSSE3_PSHUFB, REG_V1_ID, REG_V0_ID); - gen_insn(X86_INSN_SSE_3P, X86_SSSE3_PSHUFB, REG_V3_ID, REG_V2_ID); - gen_pxor(x86_memory_operand(zero_mask, X86_NOREG), REG_V1_ID); - gen_insn(X86_INSN_SSE_3P, X86_SSSE3_PSHUFB, REG_V1_ID, REG_V2_ID); - gen_por(REG_V2_ID, REG_V0_ID); - gen_insn(X86_INSN_SSE_3P, X86_SSSE3_PSHUFB, REG_V3_ID, REG_V0_ID); - gen_movdqa(REG_V0_ID, x86_memory_operand(xPPC_VR(vD), REG_CPU_ID)); - return true; -} -#endif diff --git a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-jit.hpp b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-jit.hpp deleted file mode 100644 index a8e563ae..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-jit.hpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * ppc-jit.hpp - PowerPC dynamic translation (mid-level) - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PPC_JIT_H -#define PPC_JIT_H - -#include "sysdeps.h" -#include "cpu/ppc/ppc-dyngen.hpp" - -struct powerpc_jit - : public powerpc_dyngen -{ - // Default constructor - powerpc_jit(dyngen_cpu_base cpu); - - // Initialization - bool initialize(void); - - bool gen_vector_1(int mnemo, int vD); - bool gen_vector_2(int mnemo, int vD, int vA, int vB); - bool gen_vector_3(int mnemo, int vD, int vA, int vB, int vC); - bool gen_vector_compare(int mnemo, int vD, int vA, int vB, bool Rc); - -private: - // Mid-level code generator info - typedef bool (powerpc_jit::*gen_handler_t)(int, bool); - typedef void (powerpc_dyngen::*dyngen_handler_t)(void); - union jit_option_t { - jit_option_t() { } - uintptr value; - jit_option_t(uintptr v) : value(v) { } - dyngen_handler_t dyngen_handler; - jit_option_t(dyngen_handler_t const & h) : dyngen_handler(h) { } - }; - struct jit_info_t { - int mnemo; - gen_handler_t handler; - jit_option_t o; - }; - static const jit_info_t *jit_info[]; - -private: - bool gen_not_available(int mnemo); - bool gen_vector_generic_1(int mnemo, int vD); - bool gen_vector_generic_2(int mnemo, int vD, int vA, int vB); - bool gen_vector_generic_3(int mnemo, int vD, int vA, int vB, int vC); - bool gen_vector_generic_c(int mnemo, int vD, int vA, int vB, bool Rc); - bool gen_vector_generic_load(int mnemo, int vD, int rA, int rB); - bool gen_vector_generic_store(int mnemo, int vS, int rA, int rB); - bool gen_vector_generic_load_word(int mnemo, int vD, int rA, int rB); - bool gen_vector_generic_store_word(int mnemo, int vS, int rA, int rB); - -#if defined(__i386__) || defined(__x86_64__) - bool gen_x86_lvx(int mnemo, int vD, int rA, int rB); - bool gen_x86_lvewx(int mnemo, int vD, int rA, int rB); - bool gen_x86_stvx(int mnemo, int vS, int rA, int rB); - bool gen_x86_stvewx(int mnemo, int vS, int rA, int rB); - bool gen_x86_mtvscr(int mnemo, int vD); - bool gen_x86_mfvscr(int mnemo, int vB); - bool gen_mmx_arith_2(int mnemo, int vD, int vA, int vB); - bool gen_mmx_arith_c(int mnemo, int vD, int vA, int vB, bool Rc); - void gen_sse_record_cr6(int vD); - bool gen_sse_arith_2(int mnemo, int vD, int vA, int vB); - bool gen_sse_arith_s(int mnemo, int vD, int vA, int vB); - bool gen_sse_arith_c(int mnemo, int vD, int vA, int vB, bool Rc); - bool gen_sse_vsel(int mnemo, int vD, int vA, int vB, int vC); - bool gen_sse_vmaddfp(int mnemo, int vD, int vA, int vB, int vC); - bool gen_sse_vnmsubfp(int mnemo, int vD, int vA, int vB, int vC); - void gen_sse2_record_cr6(int vD); - bool gen_sse2_arith_2(int mnemo, int vD, int vA, int vB); - bool gen_sse2_arith_s(int mnemo, int vD, int vA, int vB); - bool gen_sse2_arith_c(int mnemo, int vD, int vA, int vB, bool Rc); - bool gen_sse2_vsel(int mnemo, int vD, int vA, int vB, int vC); - bool gen_sse2_vsldoi(int mnemo, int vD, int vA, int vB, int SH); - void gen_sse2_vsplat(int vD, int rValue); - bool gen_sse2_vspltisb(int mnemo, int vD, int SIMM); - bool gen_sse2_vspltish(int mnemo, int vD, int SIMM); - bool gen_sse2_vspltisw(int mnemo, int vD, int SIMM); - bool gen_sse2_vspltb(int mnemo, int vD, int UIMM, int vB); - bool gen_sse2_vsplth(int mnemo, int vD, int UIMM, int vB); - bool gen_sse2_vspltw(int mnemo, int vD, int UIMM, int vB); - uintptr gen_ssse3_vswap_mask(void); - bool gen_ssse3_lvx(int mnemo, int vD, int rA, int rB); - bool gen_ssse3_stvx(int mnemo, int vS, int rA, int rB); - bool gen_ssse3_vperm(int mnemo, int vD, int vA, int vB, int vC); -#endif -}; - -#endif /* PPC_JIT_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-operands.hpp b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-operands.hpp deleted file mode 100644 index 95716ac9..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-operands.hpp +++ /dev/null @@ -1,591 +0,0 @@ -/* - * ppc-operands.hpp - PowerPC operands definition - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PPC_OPERANDS_H -#define PPC_OPERANDS_H - -/** - * Numerical limits of vector registers components - **/ - -template< class type > -struct vector_numeric_limits { - static type min() throw(); - static type max() throw(); -}; - -#define DEFINE_NUMERIC_LIMITS(TYPE, SMAX, USFX) \ -template<> \ -struct vector_numeric_limits { \ - static inline TYPE min() throw() { return -(SMAX) - 1; } \ - static inline TYPE max() throw() { return SMAX; } \ -}; \ -template<> \ -struct vector_numeric_limits { \ - static inline u##TYPE min() throw() { return 0##USFX; } \ - static inline u##TYPE max() throw() { return SMAX * 2##USFX + 1; } \ -} - -DEFINE_NUMERIC_LIMITS( int8, 127, U); -DEFINE_NUMERIC_LIMITS(int16, 32767, U); -DEFINE_NUMERIC_LIMITS(int32, 2147483647L, UL); -DEFINE_NUMERIC_LIMITS(int64, 9223372036854775807LL, ULL); - -#undef DEFINE_NUMERIC_LIMITS - -/** - * Compile time checks - **/ - -template< int a, int b > -struct ensure_equals; - -template< int n > -struct ensure_equals { }; - -template< class type, int size > -struct ensure_sizeof : ensure_equals { }; - -/** - * General purpose registers - **/ - -template< class field, class op > -struct input_gpr_op { - static inline uint32 get(powerpc_cpu * cpu, uint32 opcode) { - return op::apply(cpu->gpr(field::extract(opcode))); - } -}; - -template< class field > -struct input_gpr : input_gpr_op< field, op_nop > { }; - -template< class field > -struct output_gpr { - static inline void set(powerpc_cpu * cpu, uint32 opcode, uint32 value) { - cpu->gpr(field::extract(opcode)) = value; - } -}; - -template< class field > -struct gpr_operand : input_gpr< field >, output_gpr< field > { }; - -template< class field, int except_regno > -struct input_gpr_except { - static inline uint32 get(powerpc_cpu * cpu, uint32 opcode) { - const int regno = field::extract(opcode); - return regno != except_regno ? cpu->gpr(regno) : 0; - }; - static inline void set(powerpc_cpu * cpu, uint32 opcode, uint32 value) { - const int regno = field::extract(opcode); - if (regno == except_regno) abort(); - cpu->gpr(regno) = value; - } -}; - -/** - * Floating-point registers - **/ - -template< class field > -struct input_fpr { - static inline double get(powerpc_cpu * cpu, uint32 opcode) { - return cpu->fpr(field::extract(opcode)); - } -}; - -template< class field > -struct output_fpr { - static inline void set(powerpc_cpu * cpu, uint32 opcode, double value) { - cpu->fpr(field::extract(opcode)) = value; - } -}; - -template< class field > -struct fpr_operand : input_fpr< field >, output_fpr< field > { }; - -template< class field > -struct input_fpr_dw { - static inline uint64 get(powerpc_cpu * cpu, uint32 opcode) { - return cpu->fpr_dw(field::extract(opcode)); - } -}; - -template< class field > -struct output_fpr_dw { - static inline void set(powerpc_cpu * cpu, uint32 opcode, uint64 value) { - cpu->fpr_dw(field::extract(opcode)) = value; - } -}; - -template< class field > -struct fpr_dw_operand : input_fpr_dw< field >, output_fpr_dw< field > { }; - -/** - * Vector registers - **/ - -struct ev_direct { - static inline int byte_element(int i) { return i; } - static inline int half_element(int i) { return i; } - static inline int word_element(int i) { return i; } -}; - -// This supposes elements are loaded by 4-byte word parts -#ifdef WORDS_BIGENDIAN -typedef ev_direct ev_mixed; -#else -struct ev_mixed : public ev_direct { -#if 0 - static inline int byte_element(int i) { return (i & ~3) + (3 - (i & 3)); } - static inline int half_element(int i) { return (i & ~1) + (1 - (i & 1)); } -#else - static inline int byte_element(int i) { - static const int lookup[16] = { - 3, 2, 1, 0, - 7, 6, 5, 4, - 11, 10, 9, 8, - 15, 14, 13, 12 - }; - return lookup[i]; - } - static inline int half_element(int i) { - static const int lookup[8] = { - 1, 0, 3, 2, - 5, 4, 7, 6 - }; - return lookup[i]; - } -#endif -}; -#endif - -struct null_vector_operand { - typedef uint32 type; - typedef uint32 element_type; - static const uint32 element_size = sizeof(element_type); - static inline type const_ref(powerpc_cpu *, uint32) { return 0; } // fake so that compiler optimizes it out - static inline element_type get_element(type const & reg, int i) { return 0; } -}; - -template< class field > -struct vimm_operand { - typedef uint32 type; - typedef uint32 element_type; - static const uint32 element_size = sizeof(element_type); - static inline type const_ref(powerpc_cpu *, uint32 opcode) { return field::extract(opcode); } - static inline element_type get_element(type const & reg, int i) { return reg; } -}; - -template< class field > -struct input_vr { - static inline powerpc_vr const & const_ref(powerpc_cpu * cpu, uint32 opcode) { - return cpu->vr(field::extract(opcode)); - } -}; - -template< class field > -struct output_vr { - static inline powerpc_vr & ref(powerpc_cpu * cpu, uint32 opcode) { - return cpu->vr(field::extract(opcode)); - } -}; - -template< class field, class value_type > -struct vector_operand : input_vr< field >, output_vr< field > { - typedef powerpc_vr type; - typedef value_type element_type; - static const uint32 element_size = sizeof(element_type); - static inline bool saturate(element_type) { return false; } -}; - -template< class field, class value_type, class sat_type > -struct vector_saturate_operand : input_vr< field >, output_vr< field > { - typedef powerpc_vr type; - typedef sat_type element_type; - static const uint32 element_size = sizeof(value_type); - static inline bool saturate(element_type & v) { - bool sat = false; - if (v > vector_numeric_limits::max()) { - v = vector_numeric_limits::max(); - sat = true; - } - else if (v < vector_numeric_limits::min()) { - v = vector_numeric_limits::min(); - sat = true; - } - return sat; - } -}; - -template< class field, class value_type, class sat_type = int16, class ev = ev_direct > -struct v16qi_sat_operand : vector_saturate_operand< field, value_type, sat_type >, ensure_sizeof< sat_type, 2 > { - static inline sat_type get_element(powerpc_vr const & reg, int i) { - return (sat_type)(value_type)reg.b[ev::byte_element(i)]; - } - static inline void set_element(powerpc_vr & reg, int i, sat_type value) { - reg.b[ev::byte_element(i)] = value; - } -}; - -template< class field, class value_type, class sat_type = int32, class ev = ev_direct > -struct v8hi_sat_operand : vector_saturate_operand< field, value_type, sat_type >, ensure_sizeof< sat_type, 4 > { - static inline sat_type get_element(powerpc_vr const & reg, int i) { - return (sat_type)(value_type)reg.h[ev::half_element(i)]; - } - static inline void set_element(powerpc_vr & reg, int i, sat_type value) { - reg.h[ev::half_element(i)] = value; - } -}; - -template< class field, class value_type, class sat_type = int64 > -struct v4si_sat_operand : vector_saturate_operand< field, value_type, sat_type >, ensure_sizeof< sat_type, 8 > { - static inline sat_type get_element(powerpc_vr const & reg, int i) { - return (sat_type)(value_type)reg.w[i]; - } - static inline void set_element(powerpc_vr & reg, int i, sat_type value) { - reg.w[i] = value; - } -}; - -template< class field, class value_type = uint8, class ev = ev_direct > -struct v16qi_operand : vector_operand< field, value_type >, ensure_sizeof< value_type, 1 > { - static inline value_type get_element(powerpc_vr const & reg, int i) { - return reg.b[ev::byte_element(i)]; - } - static inline void set_element(powerpc_vr & reg, int i, value_type value) { - reg.b[ev::byte_element(i)] = value; - } -}; - -template< class field, class value_type = uint16, class ev = ev_direct > -struct v8hi_operand : vector_operand< field, value_type >, ensure_sizeof< value_type, 2 > { - static inline value_type get_element(powerpc_vr const & reg, int i) { - return reg.h[ev::half_element(i)]; - } - static inline void set_element(powerpc_vr & reg, int i, value_type value) { - reg.h[ev::half_element(i)] = value; - } -}; - -template< class field, class value_type = uint32 > -struct v4si_operand : vector_operand< field, value_type >, ensure_sizeof< value_type, 4 > { - static inline value_type get_element(powerpc_vr const & reg, int i) { - return reg.w[i]; - } - static inline void set_element(powerpc_vr & reg, int i, value_type value) { - reg.w[i] = value; - } -}; - -template< class field, class value_type = uint64 > -struct v2di_operand : vector_operand< field, value_type >, ensure_sizeof< value_type, 8 > { - static inline value_type get_element(powerpc_vr const & reg, int i) { - return reg.j[i]; - } - static inline void set_element(powerpc_vr & reg, int i, value_type value) { - reg.j[i] = value; - } -}; - -template< class field > -struct v4sf_operand : vector_operand< field, float > { - static inline float get_element(powerpc_vr const & reg, int i) { - return reg.f[i]; - } - static inline void set_element(powerpc_vr & reg, int i, float value) { - reg.f[i] = value; - } -}; - -template< class field > -struct vSH_operand { - static inline uint32 get(powerpc_cpu * cpu, uint32 opcode) { - return (cpu->vr(field::extract(opcode)).b[ev_mixed::byte_element(15)] >> 3) & 15; - } -}; - - -/** - * Immediate operands - **/ - -struct null_operand { - static inline uint32 get(powerpc_cpu *, uint32) { - return 0; - } -}; -template< class field, class operation > -struct immediate_operand { - static inline uint32 get(powerpc_cpu *, uint32 opcode) { - return operation::apply(field::extract(opcode)); - } -}; - -template< int32 N > -struct immediate_value { - static inline uint32 get(powerpc_cpu *, uint32) { - return (uint32)N; - } -}; - -struct mask_operand { - static inline uint32 compute(uint32 mb, uint32 me) { - return ((mb > me) ? - ~(((uint32)-1 >> mb) ^ ((me >= 31) ? 0 : (uint32)-1 >> (me + 1))) : - (((uint32)-1 >> mb) ^ ((me >= 31) ? 0 : (uint32)-1 >> (me + 1)))); - } - static inline uint32 get(powerpc_cpu *, uint32 opcode) { - const uint32 mb = MB_field::extract(opcode); - const uint32 me = ME_field::extract(opcode); - return compute(mb, me); - } -}; - -/** - * Special purpose registers - **/ - -struct pc_operand { - static inline uint32 get(powerpc_cpu * cpu, uint32) { - return cpu->pc(); - }; -}; - -struct lr_operand { - static inline uint32 get(powerpc_cpu * cpu, uint32) { - return cpu->lr(); - }; -}; - -struct ctr_operand { - static inline uint32 get(powerpc_cpu * cpu, uint32) { - return cpu->ctr(); - }; -}; - -struct cr_operand { - static inline uint32 get(powerpc_cpu * cpu, uint32) { - return cpu->cr().get(); - } -}; - -template< class field > -struct xer_operand { - static inline uint32 get(powerpc_cpu * cpu, uint32) { - return field::extract(cpu->xer().get()); - } -}; - -template<> -struct xer_operand { - static inline uint32 get(powerpc_cpu * cpu, uint32) { - return cpu->xer().get_ca(); - } -}; - -template<> -struct xer_operand { - static inline uint32 get(powerpc_cpu * cpu, uint32) { - return cpu->xer().get_count(); - } -}; - -template< class field > -struct fpscr_operand { - static inline uint32 get(powerpc_cpu * cpu, uint32) { - return field::extract(cpu->fpscr()); - } -}; - -struct spr_operand { - static inline uint32 get(powerpc_cpu *, uint32 opcode) { - uint32 spr = SPR_field::extract(opcode); - return ((spr & 0x1f) << 5) | ((spr >> 5) & 0x1f); - } -}; - -struct tbr_operand { - static inline uint32 get(powerpc_cpu *, uint32 opcode) { - uint32 tbr = TBR_field::extract(opcode); - return ((tbr & 0x1f) << 5) | ((tbr >> 5) & 0x1f); - } -}; - - -/** - * Operand aliases for decode table - **/ - -typedef null_operand operand_NONE; -typedef cr_operand operand_CR; -typedef pc_operand operand_PC; -typedef lr_operand operand_LR; -typedef ctr_operand operand_CTR; -typedef input_gpr_op operand_RA_compl; -typedef gpr_operand operand_RA; -typedef gpr_operand operand_RB; -typedef gpr_operand operand_RS; -typedef gpr_operand operand_RD; -typedef input_gpr_except operand_RA_or_0; // RA ? GPR(RA) : 0 -typedef immediate_value<0> operand_RA_is_0; // RA -> 0 -typedef immediate_value<1> operand_ONE; -typedef immediate_value<0> operand_ZERO; -typedef immediate_value<-1> operand_MINUS_ONE; -typedef null_operand operand_fp_NONE; -typedef fpr_operand operand_fp_RA; -typedef fpr_operand operand_fp_RB; -typedef fpr_operand operand_fp_RC; -typedef fpr_operand operand_fp_RD; -typedef fpr_operand operand_fp_RS; -typedef fpr_dw_operand operand_fp_dw_RA; -typedef fpr_dw_operand operand_fp_dw_RB; -typedef fpr_dw_operand operand_fp_dw_RC; -typedef fpr_dw_operand operand_fp_dw_RD; -typedef fpr_dw_operand operand_fp_dw_RS; -typedef xer_operand operand_XER_CA; -typedef xer_operand operand_XER_COUNT; -typedef fpscr_operand operand_FPSCR_RN; -typedef spr_operand operand_SPR; -typedef tbr_operand operand_TBR; -typedef mask_operand operand_MASK; -typedef null_vector_operand operand_vD_NONE; -typedef null_vector_operand operand_vA_NONE; -typedef null_vector_operand operand_vB_NONE; -typedef null_vector_operand operand_vC_NONE; -typedef v16qi_operand operand_vD_V16QI; -typedef v16qi_operand operand_vA_V16QI; -typedef v16qi_operand operand_vB_V16QI; -typedef v16qi_operand operand_vC_V16QI; -typedef v16qi_operand operand_vD_V16QIs; -typedef v16qi_operand operand_vA_V16QIs; -typedef v16qi_operand operand_vB_V16QIs; -typedef v16qi_operand operand_vC_V16QIs; -typedef v16qi_operand operand_vD_V16QIms; -typedef v16qi_operand operand_vB_V16QIms; -typedef v8hi_operand operand_vD_V8HI; -typedef v8hi_operand operand_vA_V8HI; -typedef v8hi_operand operand_vB_V8HI; -typedef v8hi_operand operand_vC_V8HI; -typedef v8hi_operand operand_vD_V8HIs; -typedef v8hi_operand operand_vA_V8HIs; -typedef v8hi_operand operand_vB_V8HIs; -typedef v8hi_operand operand_vC_V8HIs; -typedef v8hi_operand operand_vD_V8HIms; -typedef v8hi_operand operand_vB_V8HIms; -typedef v4si_operand operand_vD_V4SI; -typedef v4si_operand operand_vA_V4SI; -typedef v4si_operand operand_vB_V4SI; -typedef v4si_operand operand_vC_V4SI; -typedef v4si_operand operand_vD_V4SIs; -typedef v4si_operand operand_vA_V4SIs; -typedef v4si_operand operand_vB_V4SIs; -typedef v4si_operand operand_vC_V4SIs; -typedef v2di_operand operand_vD_V2DI; -typedef v2di_operand operand_vA_V2DI; -typedef v2di_operand operand_vB_V2DI; -typedef v2di_operand operand_vC_V2DI; -typedef v2di_operand operand_vD_V2DIs; -typedef v2di_operand operand_vA_V2DIs; -typedef v2di_operand operand_vB_V2DIs; -typedef v2di_operand operand_vC_V2DIs; -typedef v4sf_operand operand_vD_V4SF; -typedef v4sf_operand operand_vA_V4SF; -typedef v4sf_operand operand_vB_V4SF; -typedef v4sf_operand operand_vC_V4SF; -typedef v4si_operand operand_vS_V4SI; -typedef v2di_operand operand_vS_V2DI; -typedef vimm_operand operand_vA_UIMM; -typedef vimm_operand operand_vB_UIMM; -typedef vSH_operand operand_SHBO; - -// vector mixed element accessors -typedef v16qi_operand operand_vA_V16QIm; -typedef v16qi_operand operand_vB_V16QIm; -typedef v16qi_operand operand_vD_V16QIm; -typedef v8hi_operand operand_vA_V8HIm; -typedef v8hi_operand operand_vB_V8HIm; -typedef v8hi_operand operand_vD_V8HIm; - -#define DEFINE_VECTOR_SAT_OPERAND(EV, REG, OP) \ -template< class value_type > \ -struct operand_##REG##_##EV##_SAT : OP##_sat_operand { } - -DEFINE_VECTOR_SAT_OPERAND(V4SI, vD, v4si); -DEFINE_VECTOR_SAT_OPERAND(V4SI, vA, v4si); -DEFINE_VECTOR_SAT_OPERAND(V4SI, vB, v4si); -DEFINE_VECTOR_SAT_OPERAND(V4SI, vC, v4si); -DEFINE_VECTOR_SAT_OPERAND(V8HI, vD, v8hi); -DEFINE_VECTOR_SAT_OPERAND(V8HI, vA, v8hi); -DEFINE_VECTOR_SAT_OPERAND(V8HI, vB, v8hi); -DEFINE_VECTOR_SAT_OPERAND(V8HI, vC, v8hi); -DEFINE_VECTOR_SAT_OPERAND(V16QI, vD, v16qi); -DEFINE_VECTOR_SAT_OPERAND(V16QI, vA, v16qi); -DEFINE_VECTOR_SAT_OPERAND(V16QI, vB, v16qi); -DEFINE_VECTOR_SAT_OPERAND(V16QI, vC, v16qi); - -#undef DEFINE_VECTOR_SAT_OPERAND - -#define DEFINE_VECTOR_MIXED_SAT_OPERAND(EV, SAT, REG, OP, TYPE) \ -template< class value_type > \ -struct operand_##REG##_##EV##m_##SAT : OP##_sat_operand { } - -DEFINE_VECTOR_MIXED_SAT_OPERAND(V16QI, SAT, vA, v16qi, int16); -DEFINE_VECTOR_MIXED_SAT_OPERAND(V16QI, SAT, vB, v16qi, int16); -DEFINE_VECTOR_MIXED_SAT_OPERAND(V16QI, SAT, vD, v16qi, int16); -DEFINE_VECTOR_MIXED_SAT_OPERAND(V16QI, USAT, vD, v16qi, uint16); -DEFINE_VECTOR_MIXED_SAT_OPERAND(V8HI, SAT, vA, v8hi, int32); -DEFINE_VECTOR_MIXED_SAT_OPERAND(V8HI, SAT, vB, v8hi, int32); -DEFINE_VECTOR_MIXED_SAT_OPERAND(V8HI, SAT, vD, v8hi, int32); -DEFINE_VECTOR_MIXED_SAT_OPERAND(V8HI, USAT, vD, v8hi, uint32); - -#undef DEFINE_VECTOR_MIXED_SAT_OPERAND - -#define DEFINE_VECTOR_USAT_OPERAND(EV, REG, OP, TYPE) \ -template< class value_type > \ -struct operand_##REG##_##EV##_USAT : OP##_sat_operand { } - -// FIXME: temporary for vector pack unsigned saturate variants -DEFINE_VECTOR_USAT_OPERAND(V4SI, vD, v4si, uint64); -DEFINE_VECTOR_USAT_OPERAND(V8HI, vD, v8hi, uint32); -DEFINE_VECTOR_USAT_OPERAND(V16QI, vD, v16qi, uint16); - -#undef DEFINE_VECTOR_USAT_OPERAND - -#define DEFINE_IMMEDIATE_OPERAND(NAME, FIELD, OP) \ -typedef immediate_operand operand_##NAME - -DEFINE_IMMEDIATE_OPERAND(LI, LI, sign_extend_LI_32); -DEFINE_IMMEDIATE_OPERAND(BO, BO, nop); -DEFINE_IMMEDIATE_OPERAND(BD, BD, sign_extend_BD_32); -DEFINE_IMMEDIATE_OPERAND(IMM, IMM, nop); -DEFINE_IMMEDIATE_OPERAND(UIMM, UIMM, zero_extend_16_32); -DEFINE_IMMEDIATE_OPERAND(UIMM_shifted, UIMM, zero_extend_16_32_shifted); -DEFINE_IMMEDIATE_OPERAND(SIMM, SIMM, sign_extend_16_32); -DEFINE_IMMEDIATE_OPERAND(SIMM_shifted, SIMM, sign_extend_16_32_shifted); -DEFINE_IMMEDIATE_OPERAND(D, d, sign_extend_16_32); -DEFINE_IMMEDIATE_OPERAND(NB, NB, nop); -DEFINE_IMMEDIATE_OPERAND(SH, SH, nop); -DEFINE_IMMEDIATE_OPERAND(FM, FM, nop); -DEFINE_IMMEDIATE_OPERAND(SHB, vSH, nop); - -#undef DEFINE_IMMEDIATE_OPERAND - -#endif /* PPC_OPERANDS_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-operations.hpp b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-operations.hpp deleted file mode 100644 index 47b56493..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-operations.hpp +++ /dev/null @@ -1,405 +0,0 @@ -/* - * ppc-operations.cpp - PowerPC specific operations - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PPC_OPERATIONS_H -#define PPC_OPERATIONS_H - -#include -#include "mathlib/mathlib.hpp" - -/** - * Define an unary/binary/trinary operation - * - * NAME Name of the operation - * TYPE Type of operands and result - * EXPR C++ expression defining the operation, parameters are x/y/z/t - **/ - -#define DEFINE_ALIAS_OP(NAME, T_NAME, TYPE) \ -typedef op_template_##T_NAME op_##NAME - -#define DEFINE_OP1(NAME, TYPE, EXPR) \ -struct op_##NAME { \ - static inline TYPE apply(TYPE x) { \ - return EXPR; \ - } \ -} - -#define DEFINE_TEMPLATE_OP1(NAME, EXPR) \ -template< class TYPE > \ -DEFINE_OP1(template_##NAME, TYPE, EXPR) - -#define DEFINE_OP2(NAME, TYPE, EXPR) \ -struct op_##NAME { \ - static inline TYPE apply(TYPE x, TYPE y) { \ - return EXPR; \ - } \ -} - -#define DEFINE_TEMPLATE_OP2(NAME, EXPR) \ -template< class TYPE > \ -DEFINE_OP2(template_##NAME, TYPE, EXPR) - -#define DEFINE_OP3(NAME, TYPE, EXPR) \ -struct op_##NAME { \ - static inline TYPE apply(TYPE x, TYPE y, TYPE z) { \ - return EXPR; \ - } \ -} - -#define DEFINE_OP4(NAME, TYPE, EXPR) \ -struct op_##NAME { \ - static inline TYPE apply(TYPE x, TYPE y, TYPE z, TYPE t) { \ - return EXPR; \ - } \ -} - -// Basic operations - -DEFINE_TEMPLATE_OP1(nop, x); -DEFINE_TEMPLATE_OP2(add, x + y); -DEFINE_TEMPLATE_OP2(sub, x - y); -DEFINE_TEMPLATE_OP2(mul, x * y); -DEFINE_TEMPLATE_OP2(div, x / y); -DEFINE_TEMPLATE_OP2(and, x & y); -DEFINE_TEMPLATE_OP2(or, x | y); -DEFINE_TEMPLATE_OP2(xor, x ^ y); -DEFINE_TEMPLATE_OP2(orc, x | ~y); -DEFINE_TEMPLATE_OP2(andc,x & ~y); -DEFINE_TEMPLATE_OP2(nand,~(x & y)); -DEFINE_TEMPLATE_OP2(nor, ~(x | y)); -DEFINE_TEMPLATE_OP2(eqv, ~(x ^ y)); - -// Integer basic operations - -DEFINE_ALIAS_OP(nop, nop, uint32); -DEFINE_ALIAS_OP(add, add, uint32); -DEFINE_ALIAS_OP(sub, sub, uint32); -DEFINE_ALIAS_OP(mul, mul, uint32); -DEFINE_ALIAS_OP(smul,mul, int32); -DEFINE_ALIAS_OP(div, div, uint32); -DEFINE_ALIAS_OP(sdiv,div, int32); -DEFINE_OP1(neg, uint32, -x); -DEFINE_OP1(compl, uint32, ~x); -DEFINE_OP2(mod, uint32, x % y); -DEFINE_ALIAS_OP(and, and, uint32); -DEFINE_ALIAS_OP(or, or, uint32); -DEFINE_ALIAS_OP(xor, xor, uint32); -DEFINE_ALIAS_OP(orc, orc, uint32); -DEFINE_ALIAS_OP(andc,andc,uint32); -DEFINE_ALIAS_OP(nand,nand,uint32); -DEFINE_ALIAS_OP(nor, nor, uint32); -DEFINE_ALIAS_OP(eqv, eqv, uint32); -DEFINE_OP2(shll, uint32, x << y); -DEFINE_OP2(shrl, uint32, x >> y); -DEFINE_OP2(shra, uint32, (int32)x >> y); -DEFINE_OP2(rotl, uint32, ((x << y) | (x >> (32 - y)))); -DEFINE_OP2(rotr, uint32, ((x >> y) | (x << (32 - y)))); - -DEFINE_OP4(ppc_rlwimi, uint32, (op_rotl::apply(x, y) & z) | (t & ~z)); -DEFINE_OP3(ppc_rlwinm, uint32, (op_rotl::apply(x, y) & z)); -DEFINE_OP3(ppc_rlwnm, uint32, (op_rotl::apply(x, (y & 0x1f)) & z)); - -DEFINE_ALIAS_OP(add_64, add, uint64); -DEFINE_ALIAS_OP(sub_64, sub, uint64); -DEFINE_ALIAS_OP(smul_64,mul, int64); -DEFINE_ALIAS_OP(and_64, and, uint64); -DEFINE_ALIAS_OP(andc_64,andc,uint64); -DEFINE_ALIAS_OP(or_64, or, uint64); -DEFINE_ALIAS_OP(nor_64, nor, uint64); -DEFINE_ALIAS_OP(xor_64, xor, uint64); - -// Floating-point basic operations - -DEFINE_OP1(fnop, double, x); -DEFINE_OP1(fabs, double, fabs(x)); -DEFINE_OP2(fadd, double, x + y); -DEFINE_OP2(fdiv, double, x / y); -DEFINE_OP3(fmadd, double, mathlib_fmadd(x, y, z)); -DEFINE_OP3(fmsub, double, mathlib_fmsub(x, y, z)); -DEFINE_OP2(fmul, double, x * y); -DEFINE_OP1(fnabs, double, -fabs(x)); -DEFINE_OP1(fneg, double, -x); -DEFINE_OP3(fnmadd, double, -mathlib_fmadd(x, y, z)); -DEFINE_OP3(fnmsub, double, -mathlib_fmsub(x, y, z)); -DEFINE_OP3(fnmadds, double, -(float)mathlib_fmadd(x, y, z)); -DEFINE_OP3(fnmsubs, double, -(float)mathlib_fmsub(x, y, z)); -DEFINE_OP2(fsub, double, x - y); -DEFINE_OP3(fsel, double, (x >= 0.0) ? y : z); -DEFINE_OP1(frim, double, floor(x)); -DEFINE_OP1(frin, double, round(x)); -DEFINE_OP1(frip, double, ceil(x)); -DEFINE_OP1(friz, double, trunc(x)); - -DEFINE_OP2(fadds, float, x + y); -DEFINE_OP2(fsubs, float, x - y); -DEFINE_OP1(exp2, float, exp2f(x)); -DEFINE_OP1(log2, float, log2f(x)); -DEFINE_OP1(fres, float, 1 / x); -DEFINE_OP1(frsqrt, float, 1 / sqrt(x)); -DEFINE_OP1(frsim, float, floorf(x)); -DEFINE_OP1(frsin, float, roundf(x)); -DEFINE_OP1(frsip, float, ceilf(x)); -DEFINE_OP1(frsiz, float, truncf(x)); - -// Misc operations used in AltiVec instructions - -template< class TYPE > -struct op_vrl { - static inline TYPE apply(TYPE v, TYPE n) { - const int sh = n & ((8 * sizeof(TYPE)) - 1); - return ((v << sh) | (v >> ((8 * sizeof(TYPE)) - sh))); - } -}; - -template< class TYPE > -struct op_vsl { - static inline TYPE apply(TYPE v, TYPE n) { - const int sh = n & ((8 * sizeof(TYPE)) - 1); - return v << sh; - } -}; - -template< class TYPE > -struct op_vsr { - static inline TYPE apply(TYPE v, TYPE n) { - const int sh = n & ((8 * sizeof(TYPE)) - 1); - return v >> sh; - } -}; - -template< uint16 round = 0 > -struct op_mhraddsh { - static inline int32 apply(int32 a, int32 b, int32 c) { - return (((a * b) + round) >> 15) + c; - } -}; - -struct op_cvt_fp2si { - static inline int64 apply(uint32 a, float b) { - // Delegate saturation to upper level - if (mathlib_isinf(b)) - return ((int64)(b < 0 ? 0x80000000 : 0x7fffffff)) << 32; - if (mathlib_isnan(b)) - return 0; - return (int64)(b * (1U << a)); - } -}; - -template< class TYPE > -struct op_cvt_si2fp { - static inline float apply(uint32 a, TYPE b) { - return ((float)b) / ((float)(1U << a)); - } -}; - -template< class TYPE > -struct op_max { - static inline TYPE apply(TYPE a, TYPE b) { - return (a > b) ? a : b; - } -}; - -template<> -struct op_max { - static inline float apply(float a, float b) { - // XXX The maximum of any value and a NaN is a QNaN - if (mathlib_isnan(a)) - return a; - if (mathlib_isnan(b)) - return b; - return a > b ? a : b; - } -}; - -template< class TYPE > -struct op_min { - static inline TYPE apply(TYPE a, TYPE b) { - return (a < b) ? a : b; - } -}; - -template<> -struct op_min { - static inline float apply(float a, float b) { - // XXX The minimum of any value and a NaN is a QNaN - if (mathlib_isnan(a)) - return a; - if (mathlib_isnan(b)) - return b; - return a < b ? a : b; - } -}; - -template< int nbytes > -struct op_all_ones { - static const uint32 value = (1U << (8 * nbytes)) - 1; -}; - -template<> -struct op_all_ones<4> { - static const uint32 value = 0xffffffff; -}; - -template< class VX > -struct op_cmp { - static const uint32 result = op_all_ones::value; -}; - -template< class VX > -struct op_cmp_eq { - static inline uint32 apply(VX a, VX b) { - return a == b ? op_cmp::result : 0; - } -}; - -template< class VX > -struct op_cmp_ge { - static inline uint32 apply(VX a, VX b) { - return a >= b ? op_cmp::result : 0; - } -}; - -template< class VX > -struct op_cmp_gt { - static inline uint32 apply(VX a, VX b) { - return a > b ? op_cmp::result : 0; - } -}; - -struct op_cmpbfp { - static inline uint32 apply(float a, float b) { - const bool le = a <= b; - const bool ge = a >= -b; - return (le ? 0 : (1 << 31)) | (ge ? 0 : (1 << 30)); - } -}; - -DEFINE_OP3(vsel, uint32, ((y & z) | (x & ~z))); -DEFINE_OP3(vmaddfp, float, ((x * z) + y)); -DEFINE_OP3(vnmsubfp, float, -((x * z) - y)); -DEFINE_OP3(mladduh, uint32, ((x * y) + z) & 0xffff); -DEFINE_OP2(addcuw, uint32, ((uint64)x + (uint64)y) >> 32); -DEFINE_OP2(subcuw, uint32, (~((int64)x - (int64)y) >> 32) & 1); -DEFINE_OP2(avgsb, int8, (((int16)x + (int16)y + 1) >> 1)); -DEFINE_OP2(avgsh, int16, (((int32)x + (int32)y + 1) >> 1)); -DEFINE_OP2(avgsw, int32, (((int64)x + (int64)y + 1) >> 1)); -DEFINE_OP2(avgub, uint8, ((uint16)x + (uint16)y + 1) >> 1); -DEFINE_OP2(avguh, uint16, ((uint32)x + (uint32)y + 1) >> 1); -DEFINE_OP2(avguw, uint32, ((uint64)x + (uint64)y + 1) >> 1); - - -#undef DEFINE_OP1 -#undef DEFINE_OP2 -#undef DEFINE_OP3 -#undef DEFINE_OP4 - -#undef DEFINE_TEMPLATE_OP1 -#undef DEFINE_TEMPLATE_OP2 -#undef DEFINE_TEMPLATE_OP3 - -#undef DEFINE_ALIAS_OP - - -// Sign/Zero-extend operation - -struct op_sign_extend_5_32 { - static inline uint32 apply(uint32 value) { - if (value & 0x10) - value -= 0x20; - return value; - } -}; - -struct op_sign_extend_16_32 { - static inline uint32 apply(uint32 value) { - return (uint32)(int32)(int16)value; - } -}; - -struct op_sign_extend_8_32 { - static inline uint32 apply(uint32 value) { - return (uint32)(int32)(int8)value; - } -}; - -struct op_zero_extend_16_32 { - static inline uint32 apply(uint32 value) { - return (uint32)(uint16)value; - } -}; - -struct op_zero_extend_8_32 { - static inline uint32 apply(uint32 value) { - return (uint32)(uint8)value; - } -}; - -struct op_sign_extend_16_32_shifted { - static inline uint32 apply(uint32 value) { - return op_sign_extend_16_32::apply(value) << 16; - } -}; - -struct op_zero_extend_16_32_shifted { - static inline uint32 apply(uint32 value) { - return op_zero_extend_16_32::apply(value) << 16; - } -}; - -struct op_sign_extend_BD_32 { - static inline uint32 apply(uint32 value) { - return op_sign_extend_16_32::apply(value << 2); - } -}; - -struct op_sign_extend_LI_32 { - static inline uint32 apply(uint32 value) { - if (value & 0x800000) - value |= 0xff000000; - return value << 2; - } -}; - - -// And Word with Immediate value - -template< uint32 value > -struct op_andi { - static inline uint32 apply(uint32 x) { - return x & value; - } -}; - - -// Count Leading Zero Word - -struct op_cntlzw { - static inline uint32 apply(uint32 x) { - uint32 n; - uint32 m = 0x80000000; - for (n = 0; n < 32; n++, m >>= 1) - if (x & m) - break; - return n; - } -}; - -#endif /* PPC_OPERATIONS_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-registers.hpp b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-registers.hpp deleted file mode 100644 index a44a32df..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-registers.hpp +++ /dev/null @@ -1,251 +0,0 @@ -/* - * ppc-registers.hpp - PowerPC registers definition - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PPC_REGISTERS_H -#define PPC_REGISTERS_H - -#include "cpu/ppc/ppc-bitfields.hpp" - -/** - * Condition Register - **/ - -class powerpc_cr_register -{ - uint32 cr; -public: - bool test(int condition) const; - void set(uint32 v); - uint32 get() const; - void clear(int crfd); - void set(int crfd, uint32 v); - uint32 get(int crfd) const; - void set_so(int crfd, bool v); - void compute(int crfd, int32 v); -}; - -inline void -powerpc_cr_register::clear(int crfd) -{ - cr &= ~(0xf << (28 - 4 * crfd)); -} - -inline void -powerpc_cr_register::set(int crfd, uint32 v) -{ - clear(crfd); - cr |= v << (28 - 4 * crfd); -} - -inline uint32 -powerpc_cr_register::get(int crfd) const -{ - return (cr >> (28 - 4 * crfd)) & 0xf; -} - -inline void -powerpc_cr_register::set_so(int crfd, bool v) -{ - const uint32 m = standalone_CR_SO_field::mask() << (28 - 4 * crfd); - cr = (cr & ~m) | (v ? m : 0); -} - -inline void -powerpc_cr_register::compute(int crfd, int32 v) -{ - const uint32 m = (standalone_CR_LT_field::mask() | - standalone_CR_GT_field::mask() | - standalone_CR_EQ_field::mask() ) << (28 - 4 * crfd); - cr = (cr & ~m); - if (v < 0) - cr |= standalone_CR_LT_field::mask() << (28 - 4 * crfd); - else if (v > 0) - cr |= standalone_CR_GT_field::mask() << (28 - 4 * crfd); - else - cr |= standalone_CR_EQ_field::mask() << (28 - 4 * crfd); -} - -inline void -powerpc_cr_register::set(uint32 v) -{ - cr = v; -} - -inline uint32 -powerpc_cr_register::get() const -{ - return cr; -} - -inline bool -powerpc_cr_register::test(int condition) const -{ - return (cr << condition) & 0x80000000; -} - - -/** - * XER register (SPR1) - **/ - -class powerpc_xer_register -{ - uint8 so; - uint8 ov; - uint8 ca; - uint8 byte_count; -public: - powerpc_xer_register(); - void set(uint32 xer); - uint32 get() const; - void set_so(int v) { so = v; } - int get_so() const { return so; } - void set_ov(int v) { ov = v; so |= v; } - int get_ov() const { return ov; } - void set_ca(int v) { ca = v; } - int get_ca() const { return ca; } - void set_count(int v) { byte_count = v; } - int get_count() const { return byte_count; } -}; - -inline -powerpc_xer_register::powerpc_xer_register() - : so(0), ov(0), ca(0), byte_count(0) -{ } - -inline uint32 -powerpc_xer_register::get() const -{ - return (so << 31) | (ov << 30) | (ca << 29) | byte_count; -} - -inline void -powerpc_xer_register::set(uint32 xer) -{ - so = XER_SO_field::extract(xer); - ov = XER_OV_field::extract(xer); - ca = XER_CA_field::extract(xer); - byte_count = XER_COUNT_field::extract(xer); -} - - -/** - * Special CPU flags - **/ - -#include "cpu/spcflags.hpp" -typedef basic_spcflags powerpc_spcflags; - - -/** - * Floating point register - **/ - -union powerpc_fpr { - uint64 j; - double d; -}; - - -/** - * Vector Status and Control Register - **/ - -class powerpc_vscr -{ - uint32 vscr; -public: - powerpc_vscr() : vscr(0) { } - void set(uint32 v) { vscr = v; } - uint32 get() const { return vscr; } - uint32 get_nj() const { return vscr & VSCR_NJ_field::mask(); } - void set_nj(bool v) { VSCR_NJ_field::insert(vscr, v); } - uint32 get_sat() const { return vscr & VSCR_SAT_field::mask(); } - void set_sat(bool v) { VSCR_SAT_field::insert(vscr, v); } -}; - - -/** - * Vector register - **/ - -union powerpc_vr -{ - uint8 b[16]; - uint16 h[8]; - uint32 w[4]; - uint64 j[2]; - float f[4]; -}; - - -/** - * User Environment Architecture (UEA) Register Set - **/ - -struct powerpc_registers -{ - enum { - GPR_BASE = 0, - FPR_BASE = 32, - CR = 64, - FPSCR, - XER, - LR, CTR, - PC, - SP = GPR_BASE + 1 - }; - - enum { - SPR_XER = 1, - SPR_LR = 8, - SPR_CTR = 9, - SPR_SDR1 = 25, - SPR_PVR = 287, - SPR_VRSAVE = 256, - }; - - static inline int GPR(int r) { return GPR_BASE + r; } - static inline int FPR(int r) { return FPR_BASE + r; } - static void interrupt_copy(powerpc_registers &oregs, powerpc_registers const &iregs); - - uint32 gpr[32]; // General-Purpose Registers - powerpc_fpr fpr[32]; // Floating-Point Registers - powerpc_vr vr[32]; // Vector Registers - powerpc_cr_register cr; // Condition Register - powerpc_xer_register xer; // XER Register (SPR 1) - powerpc_vscr vscr; // Vector Status and Control Register - uint32 vrsave; // AltiVec Save Register - uint32 fpscr; // Floating-Point Status and Control Register - uint32 lr; // Link Register (SPR 8) - uint32 ctr; // Count Register (SPR 9) - uint32 pc; // Program Counter - powerpc_spcflags spcflags; // Special CPU flags -#if KPX_MAX_CPUS == 1 - uint32 reserve_valid; - uint32 reserve_addr; -#else - static uint32 reserve_valid; - static uint32 reserve_addr; - static uint32 reserve_data; -#endif -}; - -#endif /* PPC_REGISTERS_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-translate.cpp b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-translate.cpp deleted file mode 100644 index 6db1fa29..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-translate.cpp +++ /dev/null @@ -1,1589 +0,0 @@ -/* - * ppc-translate.cpp - PowerPC dynamic translation - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" -#include "cpu/ppc/ppc-cpu.hpp" -#include "cpu/ppc/ppc-instructions.hpp" -#include "cpu/ppc/ppc-operands.hpp" - -#if PPC_ENABLE_JIT -#include "cpu/jit/dyngen-exec.h" -#endif - -#ifdef SHEEPSHAVER -#include "cpu_emulation.h" -#endif - -#include - -#define DEBUG 1 -#include "debug.h" - -#if ENABLE_MON -#include "mon.h" -#include "mon_disass.h" -#endif - -// Define to enable const branches optimization -#define FOLLOW_CONST_JUMPS 1 - -// FIXME: define ROM areas -static inline bool is_read_only_memory(uintptr addr) -{ -#ifdef SHEEPSHAVER - if ((addr - ROMBase) < ROM_AREA_SIZE) - return true; -#endif - return false; -} - -// Returns TRUE if we can directly generate a jump to the target block -// XXX mixing front-end and back-end conditions is not a very good idea... -static inline bool direct_chaining_possible(uint32 bpc, uint32 tpc) -{ -#ifndef DYNGEN_FAST_DISPATCH - return false; -#endif - return ((bpc ^ tpc) >> 12) == 0 || is_read_only_memory(tpc); -} - - -/** - * Basic block disassemblers - **/ - -#define TARGET_M68K 0 -#define TARGET_POWERPC 1 -#define TARGET_X86 2 -#define TARGET_AMD64 3 -#if defined(i386) || defined(__i386__) -#define TARGET_NATIVE TARGET_X86 -#endif -#if defined(x86_64) || defined(__x86_64__) -#define TARGET_NATIVE TARGET_AMD64 -#endif -#if defined(powerpc) || defined(__powerpc__) || defined(__ppc__) -#define TARGET_NATIVE TARGET_POWERPC -#endif - -#if PPC_ENABLE_JIT -static void disasm_block(int target, uint8 *start, uint32 length) -{ -#if ENABLE_MON - char disasm_str[200]; - sprintf(disasm_str, "%s $%x $%x", - target == TARGET_M68K ? "d68" : - target == TARGET_X86 ? "d86" : - target == TARGET_AMD64 ? "d8664" : - target == TARGET_POWERPC ? "d" : "x", - start, start + length - 1); - - char *arg[] = {"mon", -#ifdef SHEEPSHAVER - "-m", -#endif - "-r", disasm_str, NULL}; - mon(sizeof(arg)/sizeof(arg[0]) - 1, arg); -#endif -} - -static void disasm_translation(uint32 src_addr, uint32 src_len, - uint8* dst_addr, uint32 dst_len) -{ - printf("### Block at %08x translated to %p (%d bytes)\n", src_addr, dst_addr, dst_len); - printf("IN:\n"); - disasm_block(TARGET_POWERPC, vm_do_get_real_address(src_addr), src_len); - printf("OUT:\n"); -#ifdef TARGET_NATIVE - disasm_block(TARGET_NATIVE, dst_addr, dst_len); -#else - printf("unsupported disassembler for this archicture\n"); -#endif -} -#endif - - -/** - * DynGen dynamic code translation - **/ - -#if PPC_ENABLE_JIT -powerpc_cpu::block_info * -powerpc_cpu::compile_block(uint32 entry_point) -{ -#if DEBUG - bool disasm = false; -#else - const bool disasm = false; -#endif - -#if PPC_PROFILE_COMPILE_TIME - compile_count++; - clock_t start_time = clock(); -#endif - - powerpc_jit & dg = codegen; - codegen_context_t cg_context(dg); - cg_context.entry_point = entry_point; - again: - block_info *bi = my_block_cache.new_blockinfo(); - bi->init(entry_point); - bi->entry_point = dg.gen_start(entry_point); - - // Direct block chaining support variables - bool use_direct_block_chaining = false; - - int compile_status; - uint32 dpc = entry_point - 4; - uint32 min_pc, max_pc; - min_pc = max_pc = entry_point; - uint32 sync_pc = dpc; - uint32 sync_pc_offset = 0; - bool done_compile = false; - while (!done_compile) { - uint32 opcode = vm_read_memory_4(dpc += 4); - const instr_info_t *ii = decode(opcode); - if (ii->cflow & CFLOW_END_BLOCK) - done_compile = true; - - // Assume we can compile this opcode - compile_status = COMPILE_CODE_OK; - -#if PPC_FLIGHT_RECORDER - if (is_logging()) { - typedef void (*func_t)(dyngen_cpu_base, uint32, uint32); - func_t func = (func_t)nv_mem_fun((execute_pmf)&powerpc_cpu::do_record_step).ptr(); - dg.gen_invoke_CPU_im_im(func, dpc, opcode); - } -#endif - - union operands_t { - struct { - int size, sign; - int do_update; - int do_indexed; - } mem; - struct { - uint32 target; - } jmp; - }; - operands_t op; - - switch (ii->mnemo) { - case PPC_I(LBZ): // Load Byte and Zero - op.mem.size = 1; - op.mem.sign = 0; - op.mem.do_update = 0; - op.mem.do_indexed = 0; - goto do_load; - case PPC_I(LBZU): // Load Byte and Zero with Update - op.mem.size = 1; - op.mem.sign = 0; - op.mem.do_update = 1; - op.mem.do_indexed = 0; - goto do_load; - case PPC_I(LBZUX): // Load Byte and Zero with Update Indexed - op.mem.size = 1; - op.mem.sign = 0; - op.mem.do_update = 1; - op.mem.do_indexed = 1; - goto do_load; - case PPC_I(LBZX): // Load Byte and Zero Indexed - op.mem.size = 1; - op.mem.sign = 0; - op.mem.do_update = 0; - op.mem.do_indexed = 1; - goto do_load; - case PPC_I(LHA): // Load Half Word Algebraic - op.mem.size = 2; - op.mem.sign = 1; - op.mem.do_update = 0; - op.mem.do_indexed = 0; - goto do_load; - case PPC_I(LHAU): // Load Half Word Algebraic with Update - op.mem.size = 2; - op.mem.sign = 1; - op.mem.do_update = 1; - op.mem.do_indexed = 0; - goto do_load; - case PPC_I(LHAUX): // Load Half Word Algebraic with Update Indexed - op.mem.size = 2; - op.mem.sign = 1; - op.mem.do_update = 1; - op.mem.do_indexed = 1; - goto do_load; - case PPC_I(LHAX): // Load Half Word Algebraic Indexed - op.mem.size = 2; - op.mem.sign = 1; - op.mem.do_update = 0; - op.mem.do_indexed = 1; - goto do_load; - case PPC_I(LHZ): // Load Half Word and Zero - op.mem.size = 2; - op.mem.sign = 0; - op.mem.do_update = 0; - op.mem.do_indexed = 0; - goto do_load; - case PPC_I(LHZU): // Load Half Word and Zero with Update - op.mem.size = 2; - op.mem.sign = 0; - op.mem.do_update = 1; - op.mem.do_indexed = 0; - goto do_load; - case PPC_I(LHZUX): // Load Half Word and Zero with Update Indexed - op.mem.size = 2; - op.mem.sign = 0; - op.mem.do_update = 1; - op.mem.do_indexed = 1; - goto do_load; - case PPC_I(LHZX): // Load Half Word and Zero Indexed - op.mem.size = 2; - op.mem.sign = 0; - op.mem.do_update = 0; - op.mem.do_indexed = 1; - goto do_load; - case PPC_I(LWZ): // Load Word and Zero - op.mem.size = 4; - op.mem.sign = 0; - op.mem.do_update = 0; - op.mem.do_indexed = 0; - goto do_load; - case PPC_I(LWZU): // Load Word and Zero with Update - op.mem.size = 4; - op.mem.sign = 0; - op.mem.do_update = 1; - op.mem.do_indexed = 0; - goto do_load; - case PPC_I(LWZUX): // Load Word and Zero with Update Indexed - op.mem.size = 4; - op.mem.sign = 0; - op.mem.do_update = 1; - op.mem.do_indexed = 1; - goto do_load; - case PPC_I(LWZX): // Load Word and Zero Indexed - op.mem.size = 4; - op.mem.sign = 0; - op.mem.do_update = 0; - op.mem.do_indexed = 1; - goto do_load; - { - do_load: - // Extract RZ operand - const int rA = rA_field::extract(opcode); - if (rA == 0 && !op.mem.do_update) - dg.gen_mov_32_T1_im(0); - else - dg.gen_load_T1_GPR(rA); - - // Extract index operand - if (op.mem.do_indexed) - dg.gen_load_T2_GPR(rB_field::extract(opcode)); - - switch (op.mem.size) { - case 1: - if (op.mem.do_indexed) - dg.gen_load_u8_T0_T1_T2(); - else - dg.gen_load_u8_T0_T1_im(operand_D::get(this, opcode)); - break; - case 2: - if (op.mem.do_indexed) { - if (op.mem.sign) - dg.gen_load_s16_T0_T1_T2(); - else - dg.gen_load_u16_T0_T1_T2(); - } - else { - const int32 offset = operand_D::get(this, opcode); - if (op.mem.sign) - dg.gen_load_s16_T0_T1_im(offset); - else - dg.gen_load_u16_T0_T1_im(offset); - } - break; - case 4: - if (op.mem.do_indexed) { - dg.gen_load_u32_T0_T1_T2(); - } - else { - const int32 offset = operand_D::get(this, opcode); - dg.gen_load_u32_T0_T1_im(offset); - } - break; - } - - // Commit result - dg.gen_store_T0_GPR(rD_field::extract(opcode)); - - // Update RA - if (op.mem.do_update) { - if (op.mem.do_indexed) - dg.gen_add_32_T1_T2(); - else - dg.gen_add_32_T1_im(operand_D::get(this, opcode)); - dg.gen_store_T1_GPR(rA); - } - break; - } - case PPC_I(STB): // Store Byte - op.mem.size = 1; - op.mem.do_update = 0; - op.mem.do_indexed = 0; - goto do_store; - case PPC_I(STBU): // Store Byte with Update - op.mem.size = 1; - op.mem.do_update = 1; - op.mem.do_indexed = 0; - goto do_store; - case PPC_I(STBUX): // Store Byte with Update Indexed - op.mem.size = 1; - op.mem.do_update = 1; - op.mem.do_indexed = 1; - goto do_store; - case PPC_I(STBX): // Store Byte Indexed - op.mem.size = 1; - op.mem.do_update = 0; - op.mem.do_indexed = 1; - goto do_store; - case PPC_I(STH): // Store Half Word - op.mem.size = 2; - op.mem.do_update = 0; - op.mem.do_indexed = 0; - goto do_store; - case PPC_I(STHU): // Store Half Word with Update - op.mem.size = 2; - op.mem.do_update = 1; - op.mem.do_indexed = 0; - goto do_store; - case PPC_I(STHUX): // Store Half Word with Update Indexed - op.mem.size = 2; - op.mem.do_update = 1; - op.mem.do_indexed = 1; - goto do_store; - case PPC_I(STHX): // Store Half Word Indexed - op.mem.size = 2; - op.mem.do_update = 0; - op.mem.do_indexed = 1; - goto do_store; - case PPC_I(STW): // Store Word - op.mem.size = 4; - op.mem.do_update = 0; - op.mem.do_indexed = 0; - goto do_store; - case PPC_I(STWU): // Store Word with Update - op.mem.size = 4; - op.mem.do_update = 1; - op.mem.do_indexed = 0; - goto do_store; - case PPC_I(STWUX): // Store Word with Update Indexed - op.mem.size = 4; - op.mem.do_update = 1; - op.mem.do_indexed = 1; - goto do_store; - case PPC_I(STWX): // Store Word Indexed - op.mem.size = 4; - op.mem.do_update = 0; - op.mem.do_indexed = 1; - goto do_store; - { - do_store: - // Extract RZ operand - const int rA = rA_field::extract(opcode); - if (rA == 0 && !op.mem.do_update) - dg.gen_mov_32_T1_im(0); - else - dg.gen_load_T1_GPR(rA); - - // Extract index operand - if (op.mem.do_indexed) - dg.gen_load_T2_GPR(rB_field::extract(opcode)); - - // Load register to commit to memory - dg.gen_load_T0_GPR(rS_field::extract(opcode)); - - switch (op.mem.size) { - case 1: - if (op.mem.do_indexed) - dg.gen_store_8_T0_T1_T2(); - else - dg.gen_store_8_T0_T1_im(operand_D::get(this, opcode)); - break; - case 2: - if (op.mem.do_indexed) - dg.gen_store_16_T0_T1_T2(); - else - dg.gen_store_16_T0_T1_im(operand_D::get(this, opcode)); - break; - case 4: - if (op.mem.do_indexed) - dg.gen_store_32_T0_T1_T2(); - else - dg.gen_store_32_T0_T1_im(operand_D::get(this, opcode)); - break; - } - - // Update RA - if (op.mem.do_update) { - if (op.mem.do_indexed) - dg.gen_add_32_T1_T2(); - else - dg.gen_add_32_T1_im(operand_D::get(this, opcode)); - dg.gen_store_T1_GPR(rA); - } - break; - } - case PPC_I(LMW): // Load Multiple Word - case PPC_I(STMW): // Store Multiple Word - { - const int rA = rA_field::extract(opcode); - if (rA == 0) - dg.gen_mov_32_T0_im(operand_D::get(this, opcode)); - else { - dg.gen_load_T0_GPR(rA); - dg.gen_add_32_T0_im(operand_D::get(this, opcode)); - } - switch (ii->mnemo) { - case PPC_I(LMW): dg.gen_lmw_T0(rD_field::extract(opcode)); break; - case PPC_I(STMW): dg.gen_stmw_T0(rS_field::extract(opcode)); break; - } - break; - } -#if KPX_MAX_CPUS == 1 - case PPC_I(STWCX): // Store Word Conditional Indexed - case PPC_I(LWARX): // Load Word and Reserve Indexed - { - const int rA = rA_field::extract(opcode); - const int rB = rB_field::extract(opcode); - if (rA == 0) - dg.gen_load_T1_GPR(rB); - else { - dg.gen_load_T1_GPR(rA); - dg.gen_load_T2_GPR(rB); - dg.gen_add_32_T1_T2(); - } - switch (ii->mnemo) { - case PPC_I(LWARX): - dg.gen_lwarx_T0_T1(); - dg.gen_store_T0_GPR(rD_field::extract(opcode)); - break; - case PPC_I(STWCX): - dg.gen_load_T0_GPR(rS_field::extract(opcode)); - dg.gen_stwcx_T0_T1(); - break; - } - break; - } -#endif - case PPC_I(BC): // Branch Conditional - { - const int bo = BO_field::extract(opcode); -#if FOLLOW_CONST_JUMPS - if (!BO_CONDITIONAL_BRANCH(bo) && !BO_DECREMENT_CTR(bo)) { - if (LK_field::test(opcode)) { - const uint32 npc = dpc + 4; - dg.gen_store_im_LR(npc); - } - if (AA_field::test(opcode)) - dpc = 0; - op.jmp.target = ((dpc + operand_BD::get(this, opcode)) & -4); - goto do_const_jump; - } -#endif - const uint32 tpc = ((AA_field::test(opcode) ? 0 : dpc) + operand_BD::get(this, opcode)) & -4; - const uint32 npc = dpc + 4; -#if DYNGEN_DIRECT_BLOCK_CHAINING - // Use direct block chaining for in-page jumps or jumps to ROM area - if (direct_chaining_possible(bi->pc, tpc)) { - use_direct_block_chaining = true; - bi->li[0].jmp_pc = tpc; - // Make sure it's a conditional branch - if (BO_CONDITIONAL_BRANCH(bo) || BO_DECREMENT_CTR(bo)) - bi->li[1].jmp_pc = npc; - } -#endif - - if (LK_field::test(opcode)) - dg.gen_store_im_LR(npc); - - dg.gen_bc(bo, BI_field::extract(opcode), tpc, npc, use_direct_block_chaining); - break; - } - case PPC_I(BCCTR): // Branch Conditional to Count Register - dg.gen_load_T0_CTR_aligned(); - goto do_branch; - case PPC_I(BCLR): // Branch Conditional to Link Register - dg.gen_load_T0_LR_aligned(); - goto do_branch; - { - do_branch: - const int bo = BO_field::extract(opcode); - const int bi = BI_field::extract(opcode); - - const uint32 npc = dpc + 4; - if (LK_field::test(opcode)) - dg.gen_store_im_LR(npc); - - dg.gen_bc(bo, bi, (uint32)-1, npc, use_direct_block_chaining); - break; - } - case PPC_I(B): // Branch - goto do_call; - { -#if FOLLOW_CONST_JUMPS - do_const_jump: - sync_pc = dpc = op.jmp.target - 4; - sync_pc_offset = 0; - if (dpc < min_pc) - min_pc = dpc; - else if (dpc > max_pc) - max_pc = dpc; - done_compile = false; - break; -#endif - do_call: - uint32 tpc = AA_field::test(opcode) ? 0 : dpc; - tpc = (tpc + operand_LI::get(this, opcode)) & -4; - - const uint32 npc = dpc + 4; - if (LK_field::test(opcode)) - dg.gen_store_im_LR(npc); -#if FOLLOW_CONST_JUMPS - else { - op.jmp.target = tpc; - goto do_const_jump; - } -#endif - -#if DYNGEN_DIRECT_BLOCK_CHAINING - // Use direct block chaining, addresses will be resolved at execution - if (direct_chaining_possible(bi->pc, tpc)) { - use_direct_block_chaining = true; - bi->li[0].jmp_pc = tpc; - } -#endif - - // BO field is built so that we always branch to pc - dg.gen_bc(BO_MAKE(0,0,0,0), 0, tpc, 0, use_direct_block_chaining); - break; - } - case PPC_I(CMP): // Compare - { - dg.gen_load_T0_GPR(rA_field::extract(opcode)); - dg.gen_load_T1_GPR(rB_field::extract(opcode)); - dg.gen_compare_T0_T1(crfD_field::extract(opcode)); - break; - } - case PPC_I(CMPI): // Compare Immediate - { - dg.gen_load_T0_GPR(rA_field::extract(opcode)); - dg.gen_compare_T0_im(crfD_field::extract(opcode), operand_SIMM::get(this, opcode)); - break; - } - case PPC_I(CMPL): // Compare Logical - { - dg.gen_load_T0_GPR(rA_field::extract(opcode)); - dg.gen_load_T1_GPR(rB_field::extract(opcode)); - dg.gen_compare_logical_T0_T1(crfD_field::extract(opcode)); - break; - } - case PPC_I(CMPLI): // Compare Logical Immediate - { - dg.gen_load_T0_GPR(rA_field::extract(opcode)); - dg.gen_compare_logical_T0_im(crfD_field::extract(opcode), operand_UIMM::get(this, opcode)); - break; - } - case PPC_I(CRAND): // Condition Register AND - case PPC_I(CRANDC): // Condition Register AND with Complement - case PPC_I(CREQV): // Condition Register Equivalent - case PPC_I(CRNAND): // Condition Register NAND - case PPC_I(CRNOR): // Condition Register NOR - case PPC_I(CROR): // Condition Register OR - case PPC_I(CRORC): // Condition Register OR with Complement - case PPC_I(CRXOR): // Condition Register XOR - { - dg.gen_load_T0_crb(crbA_field::extract(opcode)); - dg.gen_load_T1_crb(crbB_field::extract(opcode)); - switch (ii->mnemo) { - case PPC_I(CRAND): dg.gen_and_32_T0_T1(); break; - case PPC_I(CRANDC): dg.gen_andc_32_T0_T1(); break; - case PPC_I(CREQV): dg.gen_eqv_32_T0_T1(); break; - case PPC_I(CRNAND): dg.gen_nand_32_T0_T1(); break; - case PPC_I(CRNOR): dg.gen_nor_32_T0_T1(); break; - case PPC_I(CROR): dg.gen_or_32_T0_T1(); break; - case PPC_I(CRORC): dg.gen_orc_32_T0_T1(); break; - case PPC_I(CRXOR): dg.gen_xor_32_T0_T1(); break; - default: abort(); - } - dg.gen_store_T0_crb(crbD_field::extract(opcode)); - break; - } - case PPC_I(AND): // AND - case PPC_I(ANDC): // AND with Complement - case PPC_I(EQV): // Equivalent - case PPC_I(NAND): // NAND - case PPC_I(NOR): // NOR - case PPC_I(ORC): // ORC - case PPC_I(XOR): // XOR - { - dg.gen_load_T0_GPR(rS_field::extract(opcode)); - dg.gen_load_T1_GPR(rB_field::extract(opcode)); - switch (ii->mnemo) { - case PPC_I(AND): dg.gen_and_32_T0_T1(); break; - case PPC_I(ANDC): dg.gen_andc_32_T0_T1(); break; - case PPC_I(EQV): dg.gen_eqv_32_T0_T1(); break; - case PPC_I(NAND): dg.gen_nand_32_T0_T1(); break; - case PPC_I(NOR): dg.gen_nor_32_T0_T1(); break; - case PPC_I(ORC): dg.gen_orc_32_T0_T1(); break; - case PPC_I(XOR): dg.gen_xor_32_T0_T1(); break; - default: abort(); - } - dg.gen_store_T0_GPR(rA_field::extract(opcode)); - if (Rc_field::test(opcode)) - dg.gen_record_cr0_T0(); - break; - } - case PPC_I(OR): // OR - { - const int rS = rS_field::extract(opcode); - const int rB = rB_field::extract(opcode); - const int rA = rA_field::extract(opcode); - dg.gen_load_T0_GPR(rS); - if (rS != rB) { // Not MR case - dg.gen_load_T1_GPR(rB); - dg.gen_or_32_T0_T1(); - } - dg.gen_store_T0_GPR(rA); - if (Rc_field::test(opcode)) - dg.gen_record_cr0_T0(); - break; - } - case PPC_I(ORI): // OR Immediate - { - const int rA = rA_field::extract(opcode); - const int rS = rS_field::extract(opcode); - const uint32 val = operand_UIMM::get(this, opcode); - if (val == 0) { - if (rA != rS) { // Skip NOP, handle register move - dg.gen_load_T0_GPR(rS); - dg.gen_store_T0_GPR(rA); - } - } - else { - dg.gen_load_T0_GPR(rS); - dg.gen_or_32_T0_im(val); - dg.gen_store_T0_GPR(rA); - } - break; - } - case PPC_I(XORI): // XOR Immediate - { - dg.gen_load_T0_GPR(rS_field::extract(opcode)); - dg.gen_xor_32_T0_im(operand_UIMM::get(this, opcode)); - dg.gen_store_T0_GPR(rA_field::extract(opcode)); - break; - } - case PPC_I(ORIS): // OR Immediate Shifted - case PPC_I(XORIS): // XOR Immediate Shifted - { - dg.gen_load_T0_GPR(rS_field::extract(opcode)); - uint32 val = operand_UIMM_shifted::get(this, opcode); - switch (ii->mnemo) { - case PPC_I(ORIS): dg.gen_or_32_T0_im(val); break; - case PPC_I(XORIS): dg.gen_xor_32_T0_im(val); break; - default: abort(); - } - dg.gen_store_T0_GPR(rA_field::extract(opcode)); - break; - } - case PPC_I(ANDI): // AND Immediate - { - dg.gen_load_T0_GPR(rS_field::extract(opcode)); - dg.gen_and_32_T0_im(operand_UIMM::get(this, opcode)); - dg.gen_store_T0_GPR(rA_field::extract(opcode)); - dg.gen_record_cr0_T0(); - break; - } - case PPC_I(ANDIS): // AND Immediate Shifted - { - dg.gen_load_T0_GPR(rS_field::extract(opcode)); - dg.gen_and_32_T0_im(operand_UIMM_shifted::get(this, opcode)); - dg.gen_store_T0_GPR(rA_field::extract(opcode)); - dg.gen_record_cr0_T0(); - break; - } - case PPC_I(EXTSB): // Extend Sign Byte - case PPC_I(EXTSH): // Extend Sign Half Word - { - dg.gen_load_T0_GPR(rS_field::extract(opcode)); - switch (ii->mnemo) { - case PPC_I(EXTSB): dg.gen_se_8_32_T0(); break; - case PPC_I(EXTSH): dg.gen_se_16_32_T0(); break; - default: abort(); - } - dg.gen_store_T0_GPR(rA_field::extract(opcode)); - if (Rc_field::test(opcode)) - dg.gen_record_cr0_T0(); - break; - } - case PPC_I(NEG): // Negate - { - dg.gen_load_T0_GPR(rA_field::extract(opcode)); - if (OE_field::test(opcode)) - dg.gen_nego_T0(); - else - dg.gen_neg_32_T0(); - if (Rc_field::test(opcode)) - dg.gen_record_cr0_T0(); - dg.gen_store_T0_GPR(rD_field::extract(opcode)); - break; - } - case PPC_I(MFCR): // Move from Condition Register - { - dg.gen_load_T0_CR(); - dg.gen_store_T0_GPR(rD_field::extract(opcode)); - break; - } - case PPC_I(MFSPR): // Move from Special-Purpose Register - { - const int spr = operand_SPR::get(this, opcode); - switch (spr) { - case powerpc_registers::SPR_XER: - dg.gen_load_T0_XER(); - break; - case powerpc_registers::SPR_LR: - dg.gen_load_T0_LR(); - break; - case powerpc_registers::SPR_CTR: - dg.gen_load_T0_CTR(); - break; - case powerpc_registers::SPR_VRSAVE: - dg.gen_load_T0_VRSAVE(); - break; -#ifdef SHEEPSHAVER - case powerpc_registers::SPR_SDR1: - dg.gen_mov_32_T0_im(0xdead001f); - break; - case powerpc_registers::SPR_PVR: { - extern uint32 PVR; - dg.gen_mov_32_T0_im(PVR); - break; - } - default: - dg.gen_mov_32_T0_im(0); - break; -#else - default: goto do_generic; -#endif - } - dg.gen_store_T0_GPR(rD_field::extract(opcode)); - break; - } - case PPC_I(MTSPR): // Move to Special-Purpose Register - { - dg.gen_load_T0_GPR(rS_field::extract(opcode)); - const int spr = operand_SPR::get(this, opcode); - switch (spr) { - case powerpc_registers::SPR_XER: - dg.gen_store_T0_XER(); - break; - case powerpc_registers::SPR_LR: - dg.gen_store_T0_LR(); - break; - case powerpc_registers::SPR_CTR: - dg.gen_store_T0_CTR(); - break; - case powerpc_registers::SPR_VRSAVE: - dg.gen_store_T0_VRSAVE(); - break; -#ifndef SHEEPSHAVER - default: goto do_generic; -#endif - } - break; - } - case PPC_I(ADD): // Add - case PPC_I(ADDC): // Add Carrying - case PPC_I(ADDE): // Add Extended - case PPC_I(SUBF): // Subtract From - case PPC_I(SUBFC): // Subtract from Carrying - case PPC_I(SUBFE): // Subtract from Extended - case PPC_I(MULLW): // Multiply Low Word - case PPC_I(DIVW): // Divide Word - case PPC_I(DIVWU): // Divide Word Unsigned - { - dg.gen_load_T0_GPR(rA_field::extract(opcode)); - dg.gen_load_T1_GPR(rB_field::extract(opcode)); - if (OE_field::test(opcode)) { - switch (ii->mnemo) { - case PPC_I(ADD): dg.gen_addo_T0_T1(); break; - case PPC_I(ADDC): dg.gen_addco_T0_T1(); break; - case PPC_I(ADDE): dg.gen_addeo_T0_T1(); break; - case PPC_I(SUBF): dg.gen_subfo_T0_T1(); break; - case PPC_I(SUBFC): dg.gen_subfco_T0_T1(); break; - case PPC_I(SUBFE): dg.gen_subfeo_T0_T1(); break; - case PPC_I(MULLW): dg.gen_mullwo_T0_T1(); break; - case PPC_I(DIVW): dg.gen_divwo_T0_T1(); break; - case PPC_I(DIVWU): dg.gen_divwuo_T0_T1(); break; - default: abort(); - } - } - else { - switch (ii->mnemo) { - case PPC_I(ADD): dg.gen_add_32_T0_T1(); break; - case PPC_I(ADDC): dg.gen_addc_T0_T1(); break; - case PPC_I(ADDE): dg.gen_adde_T0_T1(); break; - case PPC_I(SUBF): dg.gen_subf_T0_T1(); break; - case PPC_I(SUBFC): dg.gen_subfc_T0_T1(); break; - case PPC_I(SUBFE): dg.gen_subfe_T0_T1(); break; - case PPC_I(MULLW): dg.gen_umul_32_T0_T1(); break; - case PPC_I(DIVW): dg.gen_divw_T0_T1(); break; - case PPC_I(DIVWU): dg.gen_divwu_T0_T1(); break; - default: abort(); - } - } - if (Rc_field::test(opcode)) - dg.gen_record_cr0_T0(); - dg.gen_store_T0_GPR(rD_field::extract(opcode)); - break; - } - case PPC_I(ADDIC): // Add Immediate Carrying - case PPC_I(ADDIC_): // Add Immediate Carrying and Record - case PPC_I(SUBFIC): // Subtract from Immediate Carrying - { - dg.gen_load_T0_GPR(rA_field::extract(opcode)); - const uint32 val = operand_SIMM::get(this, opcode); - switch (ii->mnemo) { - case PPC_I(ADDIC): - dg.gen_addc_T0_im(val); - break; - case PPC_I(ADDIC_): - dg.gen_addc_T0_im(val); - dg.gen_record_cr0_T0(); - break; - case PPC_I(SUBFIC): - dg.gen_subfc_T0_im(val); - break; - defautl: - abort(); - } - dg.gen_store_T0_GPR(rD_field::extract(opcode)); - break; - } - case PPC_I(ADDME): // Add to Minus One Extended - case PPC_I(ADDZE): // Add to Zero Extended - case PPC_I(SUBFME): // Subtract from Minus One Extended - case PPC_I(SUBFZE): // Subtract from Zero Extended - { - dg.gen_load_T0_GPR(rA_field::extract(opcode)); - if (OE_field::test(opcode)) { - switch (ii->mnemo) { - case PPC_I(ADDME): dg.gen_addmeo_T0(); break; - case PPC_I(ADDZE): dg.gen_addzeo_T0(); break; - case PPC_I(SUBFME): dg.gen_subfmeo_T0(); break; - case PPC_I(SUBFZE): dg.gen_subfzeo_T0(); break; - default: abort(); - } - } - else { - switch (ii->mnemo) { - case PPC_I(ADDME): dg.gen_addme_T0(); break; - case PPC_I(ADDZE): dg.gen_addze_T0(); break; - case PPC_I(SUBFME): dg.gen_subfme_T0(); break; - case PPC_I(SUBFZE): dg.gen_subfze_T0(); break; - default: abort(); - } - } - if (Rc_field::test(opcode)) - dg.gen_record_cr0_T0(); - dg.gen_store_T0_GPR(rD_field::extract(opcode)); - break; - } - case PPC_I(ADDI): // Add Immediate - { - const int rA = rA_field::extract(opcode); - const int rD = rD_field::extract(opcode); - if (rA == 0) // li rD,value - dg.gen_mov_32_T0_im(operand_SIMM::get(this, opcode)); - else { - dg.gen_load_T0_GPR(rA); - dg.gen_add_32_T0_im(operand_SIMM::get(this, opcode)); - } - dg.gen_store_T0_GPR(rD); - break; - } - case PPC_I(ADDIS): // Add Immediate Shifted - { - const int rA = rA_field::extract(opcode); - const int rD = rD_field::extract(opcode); - if (rA == 0) // lis rD,value - dg.gen_mov_32_T0_im(operand_SIMM_shifted::get(this, opcode)); - else { - dg.gen_load_T0_GPR(rA); - dg.gen_add_32_T0_im(operand_SIMM_shifted::get(this, opcode)); - } - dg.gen_store_T0_GPR(rD); - break; - } - case PPC_I(RLWIMI): // Rotate Left Word Immediate then Mask Insert - { - const int rA = rA_field::extract(opcode); - const int rS = rS_field::extract(opcode); - const int SH = SH_field::extract(opcode); - const int MB = MB_field::extract(opcode); - const int ME = ME_field::extract(opcode); - dg.gen_load_T0_GPR(rA); - dg.gen_load_T1_GPR(rS); - const uint32 m = mask_operand::compute(MB, ME); - dg.gen_rlwimi_T0_T1(SH, m); - dg.gen_store_T0_GPR(rA); - if (Rc_field::test(opcode)) - dg.gen_record_cr0_T0(); - break; - } - case PPC_I(RLWINM): // Rotate Left Word Immediate then AND with Mask - { - const int rS = rS_field::extract(opcode); - const int rA = rA_field::extract(opcode); - const int SH = SH_field::extract(opcode); - const int MB = MB_field::extract(opcode); - const int ME = ME_field::extract(opcode); - const uint32 m = mask_operand::compute(MB, ME); - dg.gen_load_T0_GPR(rS); - if (MB == 0) { - if (ME == 31) { - // rotlwi rA,rS,SH - if (SH > 0) - dg.gen_rol_32_T0_im(SH); - } - else if (ME == (31 - SH)) { - // slwi rA,rS,SH - dg.gen_lsl_32_T0_im(SH); - } - else if (SH == 0) { - // andi rA,rS,MASK(0,ME) - dg.gen_and_32_T0_im(m); - } - else goto do_generic_rlwinm; - } - else if (ME == 31) { - if (SH == (32 - MB)) { - // srwi rA,rS,SH - dg.gen_lsr_32_T0_im(MB); - } - else if (SH == 0) { - // andi rA,rS,MASK(MB,31) - dg.gen_and_32_T0_im(m); - } - else goto do_generic_rlwinm; - } - else { - // rlwinm rA,rS,SH,MB,ME - do_generic_rlwinm: - dg.gen_rlwinm_T0_T1(SH, m); - } - dg.gen_store_T0_GPR(rA); - if (Rc_field::test(opcode)) - dg.gen_record_cr0_T0(); - break; - } - case PPC_I(RLWNM): // Rotate Left Word then AND with Mask - { - const int rS = rS_field::extract(opcode); - const int rB = rB_field::extract(opcode); - const int rA = rA_field::extract(opcode); - const int MB = MB_field::extract(opcode); - const int ME = ME_field::extract(opcode); - const uint32 m = mask_operand::compute(MB, ME); - dg.gen_load_T0_GPR(rS); - dg.gen_load_T1_GPR(rB); - if (MB == 0 && ME == 31) - dg.gen_rol_32_T0_T1(); - else - dg.gen_rlwnm_T0_T1(m); - dg.gen_store_T0_GPR(rA); - if (Rc_field::test(opcode)) - dg.gen_record_cr0_T0(); - break; - } - case PPC_I(CNTLZW): // Count Leading Zeros Word - { - dg.gen_load_T0_GPR(rS_field::extract(opcode)); - dg.gen_cntlzw_32_T0(); - dg.gen_store_T0_GPR(rA_field::extract(opcode)); - if (Rc_field::test(opcode)) - dg.gen_record_cr0_T0(); - break; - } - case PPC_I(SLW): // Shift Left Word - { - dg.gen_load_T0_GPR(rS_field::extract(opcode)); - dg.gen_load_T1_GPR(rB_field::extract(opcode)); - dg.gen_slw_T0_T1(); - dg.gen_store_T0_GPR(rA_field::extract(opcode)); - if (Rc_field::test(opcode)) - dg.gen_record_cr0_T0(); - break; - } - case PPC_I(SRW): // Shift Right Word - { - dg.gen_load_T0_GPR(rS_field::extract(opcode)); - dg.gen_load_T1_GPR(rB_field::extract(opcode)); - dg.gen_srw_T0_T1(); - dg.gen_store_T0_GPR(rA_field::extract(opcode)); - if (Rc_field::test(opcode)) - dg.gen_record_cr0_T0(); - break; - } - case PPC_I(SRAW): // Shift Right Algebraic Word - { - dg.gen_load_T0_GPR(rS_field::extract(opcode)); - dg.gen_load_T1_GPR(rB_field::extract(opcode)); - dg.gen_sraw_T0_T1(); - dg.gen_store_T0_GPR(rA_field::extract(opcode)); - if (Rc_field::test(opcode)) - dg.gen_record_cr0_T0(); - break; - } - case PPC_I(SRAWI): // Shift Right Algebraic Word Immediate - { - dg.gen_load_T0_GPR(rS_field::extract(opcode)); - dg.gen_sraw_T0_im(SH_field::extract(opcode)); - dg.gen_store_T0_GPR(rA_field::extract(opcode)); - if (Rc_field::test(opcode)) - dg.gen_record_cr0_T0(); - break; - } - case PPC_I(MULHW): // Multiply High Word - case PPC_I(MULHWU): // Multiply High Word Unsigned - { - dg.gen_load_T0_GPR(rA_field::extract(opcode)); - dg.gen_load_T1_GPR(rB_field::extract(opcode)); - if (ii->mnemo == PPC_I(MULHW)) - dg.gen_mulhw_T0_T1(); - else - dg.gen_mulhwu_T0_T1(); - dg.gen_store_T0_GPR(rD_field::extract(opcode)); - if (Rc_field::test(opcode)) - dg.gen_record_cr0_T0(); - break; - } - case PPC_I(MULLI): // Multiply Low Immediate - { - dg.gen_load_T0_GPR(rA_field::extract(opcode)); - dg.gen_mulli_T0_im(operand_SIMM::get(this, opcode)); - dg.gen_store_T0_GPR(rD_field::extract(opcode)); - break; - } - case PPC_I(DCBZ): // Data Cache Block Clear to Zero - { - const int rA = rA_field::extract(opcode); - const int rB = rB_field::extract(opcode); - if (rA == 0) - dg.gen_load_T0_GPR(rB); - else { - dg.gen_load_T0_GPR(rA); - dg.gen_load_T1_GPR(rB); - dg.gen_add_32_T0_T1(); - } - dg.gen_dcbz_T0(); - break; - } - case PPC_I(DCBA): // Data Cache Block Allocate - case PPC_I(DCBF): // Data Cache Block Flush - case PPC_I(DCBI): // Data Cache Block Invalidate - case PPC_I(DCBST): // Data Cache Block Store - case PPC_I(DCBT): // Data Cache Block Touch - case PPC_I(DCBTST): // Data Cache Block Touch for Store - case PPC_I(ECIWX): // External Control In Word Indexed - case PPC_I(ECOWX): // External Control Out Word Indexed - case PPC_I(EIEIO): // Enforce In-Order Execution of I/O - case PPC_I(SYNC): // Synchronize - { - break; - } - case PPC_I(ISYNC): // Instruction synchronize - { - typedef void (*func_t)(dyngen_cpu_base); - func_t func = (func_t)nv_mem_fun(&powerpc_cpu::execute_invalidate_cache_range).ptr(); - dg.gen_invoke_CPU(func); - break; - } - case PPC_I(MTCRF): // Move to Condition Register Fields - { - dg.gen_load_T0_GPR(rS_field::extract(opcode)); - dg.gen_mtcrf_T0_im(field2mask[CRM_field::extract(opcode)]); - break; - } - case PPC_I(MCRF): // Move Condition Register Field - { - dg.gen_load_T0_crf(crfS_field::extract(opcode)); - dg.gen_store_T0_crf(crfD_field::extract(opcode)); - break; - } - case PPC_I(LFD): // Load Floating-Point Double - op.mem.size = 8; - op.mem.do_update = 0; - op.mem.do_indexed = 0; - goto do_fp_load;; - case PPC_I(LFDU): // Load Floating-Point Double with Update - op.mem.size = 8; - op.mem.do_update = 1; - op.mem.do_indexed = 0; - goto do_fp_load; - case PPC_I(LFDUX): // Load Floating-Point Double with Update Indexed - op.mem.size = 8; - op.mem.do_update = 1; - op.mem.do_indexed = 1; - goto do_fp_load; - case PPC_I(LFDX): // Load Floating-Point Double Indexed - op.mem.size = 8; - op.mem.do_update = 0; - op.mem.do_indexed = 1; - goto do_fp_load; - case PPC_I(LFS): // Load Floating-Point Single - op.mem.size = 4; - op.mem.do_update = 0; - op.mem.do_indexed = 0; - goto do_fp_load; - case PPC_I(LFSU): // Load Floating-Point Single with Update - op.mem.size = 4; - op.mem.do_update = 1; - op.mem.do_indexed = 0; - goto do_fp_load; - case PPC_I(LFSUX): // Load Floating-Point Single with Update Indexed - op.mem.size = 4; - op.mem.do_update = 1; - op.mem.do_indexed = 1; - goto do_fp_load; - case PPC_I(LFSX): // Load Floating-Point Single Indexed - op.mem.size = 4; - op.mem.do_update = 0; - op.mem.do_indexed = 1; - goto do_fp_load; - { - do_fp_load: - // Extract RZ operand - const int rA = rA_field::extract(opcode); - if (rA == 0 && !op.mem.do_update) - dg.gen_mov_32_T1_im(0); - else - dg.gen_load_T1_GPR(rA); - - // Extract index operand - if (op.mem.do_indexed) - dg.gen_load_T2_GPR(rB_field::extract(opcode)); - - // Load floating point data - if (op.mem.size == 8) { - if (op.mem.do_indexed) - dg.gen_load_double_FD_T1_T2(); - else - dg.gen_load_double_FD_T1_im(operand_D::get(this, opcode)); - } - else { - if (op.mem.do_indexed) - dg.gen_load_single_FD_T1_T2(); - else - dg.gen_load_single_FD_T1_im(operand_D::get(this, opcode)); - } - - // Commit result - dg.gen_store_FD_FPR(frD_field::extract(opcode)); - - // Update RA - if (op.mem.do_update) { - if (op.mem.do_indexed) - dg.gen_add_32_T1_T2(); - else - dg.gen_add_32_T1_im(operand_D::get(this, opcode)); - dg.gen_store_T1_GPR(rA); - } - break; - } - case PPC_I(STFD): // Store Floating-Point Double - op.mem.size = 8; - op.mem.do_update = 0; - op.mem.do_indexed = 0; - goto do_fp_store; - case PPC_I(STFDU): // Store Floating-Point Double with Update - op.mem.size = 8; - op.mem.do_update = 1; - op.mem.do_indexed = 0; - goto do_fp_store; - case PPC_I(STFDUX): // Store Floating-Point Double with Update Indexed - op.mem.size = 8; - op.mem.do_update = 1; - op.mem.do_indexed = 1; - goto do_fp_store; - case PPC_I(STFDX): // Store Floating-Point Double Indexed - op.mem.size = 8; - op.mem.do_update = 0; - op.mem.do_indexed = 1; - goto do_fp_store; - case PPC_I(STFS): // Store Floating-Point Single - op.mem.size = 4; - op.mem.do_update = 0; - op.mem.do_indexed = 0; - goto do_fp_store; - case PPC_I(STFSU): // Store Floating-Point Single with Update - op.mem.size = 4; - op.mem.do_update = 1; - op.mem.do_indexed = 0; - goto do_fp_store; - case PPC_I(STFSUX): // Store Floating-Point Single with Update Indexed - op.mem.size = 4; - op.mem.do_update = 1; - op.mem.do_indexed = 1; - goto do_fp_store; - case PPC_I(STFSX): // Store Floating-Point Single Indexed - op.mem.size = 4; - op.mem.do_update = 0; - op.mem.do_indexed = 1; - goto do_fp_store; - { - do_fp_store: - // Extract RZ operand - const int rA = rA_field::extract(opcode); - if (rA == 0 && !op.mem.do_update) - dg.gen_mov_32_T1_im(0); - else - dg.gen_load_T1_GPR(rA); - - // Extract index operand - if (op.mem.do_indexed) - dg.gen_load_T2_GPR(rB_field::extract(opcode)); - - // Load register to commit to memory - dg.gen_load_F0_FPR(frS_field::extract(opcode)); - - // Store floating point data - if (op.mem.size == 8) { - if (op.mem.do_indexed) - dg.gen_store_double_F0_T1_T2(); - else - dg.gen_store_double_F0_T1_im(operand_D::get(this, opcode)); - } - else { - if (op.mem.do_indexed) - dg.gen_store_single_F0_T1_T2(); - else - dg.gen_store_single_F0_T1_im(operand_D::get(this, opcode)); - } - - // Update RA - if (op.mem.do_update) { - if (op.mem.do_indexed) - dg.gen_add_32_T1_T2(); - else - dg.gen_add_32_T1_im(operand_D::get(this, opcode)); - dg.gen_store_T1_GPR(rA); - } - break; - } -#if PPC_ENABLE_FPU_EXCEPTIONS == 0 - case PPC_I(FABS): // Floating Absolute Value - case PPC_I(FNABS): // Floating Negative Absolute Value - case PPC_I(FNEG): // Floating Negate - case PPC_I(FMR): // Floating Move Register - { - dg.gen_load_F0_FPR(frB_field::extract(opcode)); - switch (ii->mnemo) { - case PPC_I(FABS): dg.gen_fabs_FD_F0(); break; - case PPC_I(FNABS): dg.gen_fnabs_FD_F0(); break; - case PPC_I(FNEG): dg.gen_fneg_FD_F0(); break; - case PPC_I(FMR): dg.gen_fmov_FD_F0(); break; - } - dg.gen_store_FD_FPR(frD_field::extract(opcode)); - if (Rc_field::test(opcode)) - dg.gen_record_cr1(); - break; - } - case PPC_I(FADD): // Floating Add (Double-Precision) - case PPC_I(FSUB): // Floating Subtract (Double-Precision) - case PPC_I(FMUL): // Floating Multiply (Double-Precision) - case PPC_I(FDIV): // Floating Divide (Double-Precision) - case PPC_I(FADDS): // Floating Add (Single-Precision) - case PPC_I(FSUBS): // Floating Subtract (Single-Precision) - case PPC_I(FMULS): // Floating Multiply (Single-Precision) - case PPC_I(FDIVS): // Floating Divide (Single-Precision) - { - dg.gen_load_F0_FPR(frA_field::extract(opcode)); - if (ii->mnemo == PPC_I(FMUL) || ii->mnemo == PPC_I(FMULS)) - dg.gen_load_F1_FPR(frC_field::extract(opcode)); - else - dg.gen_load_F1_FPR(frB_field::extract(opcode)); - switch (ii->mnemo) { - case PPC_I(FADD): dg.gen_fadd_FD_F0_F1(); break; - case PPC_I(FSUB): dg.gen_fsub_FD_F0_F1(); break; - case PPC_I(FMUL): dg.gen_fmul_FD_F0_F1(); break; - case PPC_I(FDIV): dg.gen_fdiv_FD_F0_F1(); break; - case PPC_I(FADDS): dg.gen_fadds_FD_F0_F1(); break; - case PPC_I(FSUBS): dg.gen_fsubs_FD_F0_F1(); break; - case PPC_I(FMULS): dg.gen_fmuls_FD_F0_F1(); break; - case PPC_I(FDIVS): dg.gen_fdivs_FD_F0_F1(); break; - } - dg.gen_store_FD_FPR(frD_field::extract(opcode)); - if (Rc_field::test(opcode)) - dg.gen_record_cr1(); - break; - } - case PPC_I(FMADD): // Floating Multiply-Add (Double-Precision) - case PPC_I(FMSUB): // Floating Multiply-Subtract (Double-Precision) - case PPC_I(FNMADD): // Floating Negative Multiply-Add (Double-Precision) - case PPC_I(FNMSUB): // Floating Negative Multiply-Subract (Double-Precision) - case PPC_I(FMADDS): // Floating Multiply-Add (Single-Precision) - case PPC_I(FMSUBS): // Floating Multiply-Subtract (Single-Precision) - case PPC_I(FNMADDS): // Floating Negative Multiply-Add (Single-Precision) - case PPC_I(FNMSUBS): // Floating Negative Multiply-Subract (Single-Precision) - { - dg.gen_load_F0_FPR(frA_field::extract(opcode)); - dg.gen_load_F1_FPR(frC_field::extract(opcode)); - dg.gen_load_F2_FPR(frB_field::extract(opcode)); - switch (ii->mnemo) { - case PPC_I(FMADD): dg.gen_fmadd_FD_F0_F1_F2(); break; - case PPC_I(FMSUB): dg.gen_fmsub_FD_F0_F1_F2(); break; - case PPC_I(FNMADD): dg.gen_fnmadd_FD_F0_F1_F2(); break; - case PPC_I(FNMSUB): dg.gen_fnmsub_FD_F0_F1_F2(); break; - case PPC_I(FMADDS): dg.gen_fmadds_FD_F0_F1_F2(); break; - case PPC_I(FMSUBS): dg.gen_fmsubs_FD_F0_F1_F2(); break; - case PPC_I(FNMADDS): dg.gen_fnmadds_FD_F0_F1_F2(); break; - case PPC_I(FNMSUBS): dg.gen_fnmsubs_FD_F0_F1_F2(); break; - } - dg.gen_store_FD_FPR(frD_field::extract(opcode)); - if (Rc_field::test(opcode)) - dg.gen_record_cr1(); - break; - } -#endif - case PPC_I(LVEWX): - case PPC_I(LVX): - case PPC_I(LVXL): - case PPC_I(STVEWX): - case PPC_I(STVX): - case PPC_I(STVXL): - assert(vD_field::mask() == vS_field::mask()); - assert(vA_field::mask() == rA_field::mask()); - assert(vB_field::mask() == rB_field::mask()); - // fall-through - case PPC_I(VCMPEQFP): - case PPC_I(VCMPEQUB): - case PPC_I(VCMPEQUH): - case PPC_I(VCMPEQUW): - case PPC_I(VCMPGEFP): - case PPC_I(VCMPGTFP): - case PPC_I(VCMPGTSB): - case PPC_I(VCMPGTSH): - case PPC_I(VCMPGTSW): - { - const int vD = vD_field::extract(opcode); - const int vA = vA_field::extract(opcode); - const int vB = vB_field::extract(opcode); - if (!dg.gen_vector_compare(ii->mnemo, vD, vA, vB, vRc_field::test(opcode))) - goto do_generic; - break; - } - case PPC_I(VADDFP): - case PPC_I(VADDUBM): - case PPC_I(VADDUHM): - case PPC_I(VADDUWM): - case PPC_I(VAND): - case PPC_I(VANDC): - case PPC_I(VAVGUB): - case PPC_I(VAVGUH): - case PPC_I(VMAXSH): - case PPC_I(VMAXUB): - case PPC_I(VMINSH): - case PPC_I(VMINUB): - case PPC_I(VNOR): - case PPC_I(VOR): - case PPC_I(VSUBFP): - case PPC_I(VSUBUBM): - case PPC_I(VSUBUHM): - case PPC_I(VSUBUWM): - case PPC_I(VXOR): - case PPC_I(VREFP): - case PPC_I(VRSQRTEFP): - { - const int vD = vD_field::extract(opcode); - const int vA = vA_field::extract(opcode); - const int vB = vB_field::extract(opcode); - if (!dg.gen_vector_2(ii->mnemo, vD, vA, vB)) - goto do_generic; - break; - } - case PPC_I(VSEL): - case PPC_I(VPERM): - case PPC_I(VMADDFP): - case PPC_I(VNMSUBFP): - { - const int vD = vD_field::extract(opcode); - const int vA = vA_field::extract(opcode); - const int vB = vB_field::extract(opcode); - const int vC = vC_field::extract(opcode); - if (!dg.gen_vector_3(ii->mnemo, vD, vA, vB, vC)) - goto do_generic; - break; - } - case PPC_I(VSLDOI): - { - const int vD = vD_field::extract(opcode); - const int vA = vA_field::extract(opcode); - const int vB = vB_field::extract(opcode); - const int SH = vSH_field::extract(opcode); - if (!dg.gen_vector_3(ii->mnemo, vD, vA, vB, SH)) - goto do_generic; - break; - } - case PPC_I(MFVSCR): - { - if (!dg.gen_vector_1(ii->mnemo, vD_field::extract(opcode))) - goto do_generic; - break; - } - case PPC_I(MTVSCR): - { - if (!dg.gen_vector_1(ii->mnemo, vB_field::extract(opcode))) - goto do_generic; - break; - } - case PPC_I(VSPLTISB): - case PPC_I(VSPLTISH): - case PPC_I(VSPLTISW): - { - const int vD = vD_field::extract(opcode); - const int SIMM = op_sign_extend_5_32::apply(vUIMM_field::extract(opcode)); - if (!dg.gen_vector_2(ii->mnemo, vD, SIMM, 0)) - goto do_generic; - break; - } - case PPC_I(VSPLTB): - case PPC_I(VSPLTH): - case PPC_I(VSPLTW): - { - const int vD = vD_field::extract(opcode); - const int UIMM = vUIMM_field::extract(opcode); - const int vB = vB_field::extract(opcode); - if (!dg.gen_vector_2(ii->mnemo, vD, UIMM, vB)) - goto do_generic; - break; - } - default: // Direct call to instruction handler - { - typedef void (*func_t)(dyngen_cpu_base, uint32); - func_t func; - do_generic: - func = (func_t)ii->execute.ptr(); - goto do_invoke; - do_illegal: - func = (func_t)nv_mem_fun(&powerpc_cpu::execute_illegal).ptr(); - goto do_invoke; - do_invoke: -#if PPC_PROFILE_GENERIC_CALLS - if (ii->mnemo <= PPC_I(MAX)) { - uintptr mem = (uintptr)&generic_calls_count[ii->mnemo]; - if (mem <= 0xffffffff) - dg.gen_inc_32_mem(mem); - } -#endif - cg_context.pc = dpc; - cg_context.opcode = opcode; - cg_context.instr_info = ii; - cg_context.done_compile = done_compile; - compile_status = compile1(cg_context); - switch (compile_status) { - case COMPILE_FAILURE: - case COMPILE_EPILOGUE_OK: - if ((dpc - sync_pc) > sync_pc_offset) { - sync_pc = dpc; - sync_pc_offset = 0; - if (compile_status == COMPILE_EPILOGUE_OK) - break; - dg.gen_set_PC_im(dpc); - } - sync_pc_offset += 4; - dg.gen_invoke_CPU_im(func, opcode); - compile_status = COMPILE_CODE_OK; // could generate code, though a call to handler - break; - } - done_compile = cg_context.done_compile; - } - } - if (dg.full_translation_cache()) { - // Invalidate cache and start again - invalidate_cache(); - goto again; - } - } - // Do nothing if block has special epilogue code generated already - assert(compile_status != COMPILE_FAILURE); - if (compile_status != COMPILE_EPILOGUE_OK) { - // In direct block chaining mode, this code is reached only if - // there are pending spcflags, i.e. get out of this block - if (!use_direct_block_chaining) { - // TODO: optimize this to a direct jump to pregenerated code? - dg.gen_mov_ad_A0_im((uintptr)bi); - dg.gen_jump_next_A0(); - } - dg.gen_exec_return(); - } - bi->end_pc = dpc; - if (dpc < min_pc) - min_pc = dpc; - else if (dpc > max_pc) - max_pc = dpc; - bi->min_pc = min_pc; - bi->max_pc = max_pc; - -#if DYNGEN_DIRECT_BLOCK_CHAINING - // Generate backpatch trampolines - if (use_direct_block_chaining) { - typedef void *(*func_t)(dyngen_cpu_base); - func_t func = (func_t)nv_mem_fun(&powerpc_cpu::compile_chain_block).ptr(); - for (int i = 0; i < block_info::MAX_TARGETS; i++) { - if (bi->li[i].jmp_pc != block_info::INVALID_PC) { - uint8 *p = dg.gen_align(16); - dg.gen_mov_ad_A0_im(((uintptr)bi) | i); - dg.gen_invoke_CPU_A0_ret_A0(func); - dg.gen_jmp_A0(); - assert(dg.jmp_addr[i] != NULL); - bi->li[i].jmp_addr = dg.jmp_addr[i]; - bi->li[i].jmp_resolve_addr = p; - dg_set_jmp_target_noflush(bi->li[i].jmp_addr, bi->li[i].jmp_resolve_addr); - } - } - } -#endif - - bi->size = dg.code_ptr() - bi->entry_point; - if (disasm) - disasm_translation(entry_point, dpc - entry_point + 4, bi->entry_point, bi->size); - - dg.gen_end(); - my_block_cache.add_to_cl_list(bi); - if (is_read_only_memory(bi->pc)) - my_block_cache.add_to_dormant_list(bi); - else - my_block_cache.add_to_active_list(bi); -#if PPC_PROFILE_COMPILE_TIME - compile_time += (clock() - start_time); -#endif - return bi; -} -#endif diff --git a/SheepShaver/src/kpx_cpu/src/cpu/spcflags.hpp b/SheepShaver/src/kpx_cpu/src/cpu/spcflags.hpp deleted file mode 100644 index 0b521d53..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/spcflags.hpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * spcflags.hpp - CPU special flags - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef SPCFLAGS_H -#define SPCFLAGS_H - -/** - * Basic special flags - **/ - -enum { - SPCFLAG_CPU_EXEC_RETURN = 1 << 0, // Return from emulation loop - SPCFLAG_CPU_TRIGGER_INTERRUPT = 1 << 1, // Trigger user interrupt - SPCFLAG_CPU_HANDLE_INTERRUPT = 1 << 2, // Call user interrupt handler - SPCFLAG_CPU_ENTER_MON = 1 << 3, // Enter cxmon - SPCFLAG_JIT_EXEC_RETURN = 1 << 4, // Return from compiled code -}; - -class basic_spcflags -{ - uint32 mask; - spinlock_t lock; - -public: - - basic_spcflags() - : mask(0), lock(SPIN_LOCK_UNLOCKED) - { } - - bool empty() const - { return (mask == 0); } - - bool test(uint32 v) const - { return (mask & v); } - - void init(uint32 v) - { spin_lock(&lock); mask = v; spin_unlock(&lock); } - - uint32 get() const - { return mask; } - - void set(uint32 v) - { spin_lock(&lock); mask |= v; spin_unlock(&lock); } - - void clear(uint32 v) - { spin_lock(&lock); mask &= ~v; spin_unlock(&lock); } -}; - -#endif /* SPCFLAGS_H */ diff --git a/SheepShaver/src/kpx_cpu/src/cpu/vm.hpp b/SheepShaver/src/kpx_cpu/src/cpu/vm.hpp deleted file mode 100644 index 55f30ec3..00000000 --- a/SheepShaver/src/kpx_cpu/src/cpu/vm.hpp +++ /dev/null @@ -1,298 +0,0 @@ -/* - * vm.hpp - Virtual memory management - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef VM_H -#define VM_H - -/// -/// Optimized memory accessors -/// - -#if defined(__i386__) || defined(__powerpc__) || defined(__ppc__) || defined(__m68k__) || defined(__x86_64__) -# define VM_CAN_ACCESS_UNALIGNED -#endif - -#ifdef WORDS_BIGENDIAN - -#ifdef VM_CAN_ACCESS_UNALIGNED - -#ifndef VM_OPTIMIZED_MEMORY_ACCESS_2 -#define VM_OPTIMIZED_MEMORY_ACCESS_2 -static inline uint32 vm_do_read_memory_2(uint16 *a) { return *a; } -static inline void vm_do_write_memory_2(uint16 *a, uint32 v) { *a = v; } -#endif - -#ifndef VM_OPTIMIZED_MEMORY_ACCESS_4 -#define VM_OPTIMIZED_MEMORY_ACCESS_4 -static inline uint32 vm_do_read_memory_4(uint32 *a) { return *a; } -static inline void vm_do_write_memory_4(uint32 *a, uint32 v) { *a = v; } -#endif - -#ifndef VM_OPTIMIZED_MEMORY_ACCESS_8 -#define VM_OPTIMIZED_MEMORY_ACCESS_8 -static inline uint64 vm_do_read_memory_8(uint64 *a) { return *a; } -static inline void vm_do_write_memory_8(uint64 *a, uint64 v) { *a = v; } -#endif - -#endif /* VM_CAN_ACCESS_UNALIGNED */ - -#else - -#ifdef VM_CAN_ACCESS_UNALIGNED - -#ifndef VM_OPTIMIZED_MEMORY_ACCESS_2 -#define VM_OPTIMIZED_MEMORY_ACCESS_2 -static inline uint32 vm_do_read_memory_2(uint16 *a) { return bswap_16(*a); } -static inline void vm_do_write_memory_2(uint16 *a, uint32 v) { *a = bswap_16(v); } -#endif - -#ifndef VM_OPTIMIZED_MEMORY_ACCESS_4 -#define VM_OPTIMIZED_MEMORY_ACCESS_4 -static inline uint32 vm_do_read_memory_4(uint32 *a) { return bswap_32(*a); } -static inline void vm_do_write_memory_4(uint32 *a, uint32 v) { *a = bswap_32(v); } -#endif - -#ifndef VM_OPTIMIZED_MEMORY_ACCESS_8 -#define VM_OPTIMIZED_MEMORY_ACCESS_8 -static inline uint64 vm_do_read_memory_8(uint64 *a) { return bswap_64(*a); } -static inline void vm_do_write_memory_8(uint64 *a, uint64 v) { *a = bswap_64(v); } -#endif - -#endif /* VM_CAN_ACCESS_UNALIGNED */ - -#endif /* WORDS_BIGENDIAN */ - -/// -/// Generic core memory accessors -/// - -static inline uint32 vm_do_read_memory_1(uint8 *a) -{ - return *a; -} -static inline void vm_do_write_memory_1(uint8 *a, uint32 v) -{ - *a = v; -} - -#ifndef VM_OPTIMIZED_MEMORY_ACCESS_2 -static inline uint32 vm_do_read_memory_2(uint16 *a) -{ - uint8 * b = (uint8 *)a; - return (b[0] << 8) | b[1]; -} -static inline void vm_do_write_memory_2(uint16 *a, uint32 v) -{ - uint8 * b = (uint8 *)a; - b[0] = v >> 8; - b[1] = v; -} -#endif - -#ifndef VM_OPTIMIZED_MEMORY_ACCESS_4 -static inline uint32 vm_do_read_memory_4(uint32 *a) -{ - uint8 * b = (uint8 *)a; - return (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3]; -} -static inline void vm_do_write_memory_4(uint32 *a, uint32 v) -{ - uint8 * b = (uint8 *)a; - b[0] = v >> 24; - b[1] = v >> 16; - b[2] = v >> 8; - b[3] = v; -} -#endif - -#ifndef VM_OPTIMIZED_MEMORY_ACCESS_8 -static inline uint64 vm_do_read_memory_8(uint64 *a) -{ - uint8 * b = (uint8 *)a; - return - ((uint64)b[0] << 56) | - ((uint64)b[1] << 48) | - ((uint64)b[2] << 40) | - ((uint64)b[3] << 32) | - ((uint64)b[4] << 24) | - ((uint64)b[5] << 16) | - ((uint64)b[6] << 8) | - ((uint64)b[7]); -} - -static inline void vm_do_write_memory_8(uint64 *a, uint64 v) -{ - uint8 * b = (uint8 *)a; - b[0] = v >> 56; - b[1] = v >> 48; - b[2] = v >> 40; - b[3] = v >> 32; - b[4] = v >> 24; - b[5] = v >> 16; - b[6] = v >> 8; - b[7] = v; -} -#endif - -#ifndef VM_OPTIMIZED_MEMORY_ACCESS_2_REVERSED -static inline uint32 vm_do_read_memory_2_reversed(uint16 *a) -{ - uint8 * b = (uint8 *)a; - return b[0] | (b[1] << 8); -} -static inline void vm_do_write_memory_2_reversed(uint16 *a, uint32 v) -{ - uint8 * b = (uint8 *)a; - b[0] = v; - b[1] = v >> 8; -} -#endif - -#ifndef VM_OPTIMIZED_MEMORY_ACCESS_4_REVERSED -static inline uint32 vm_do_read_memory_4_reversed(uint32 *a) -{ - uint8 * b = (uint8 *)a; - return b[0] | (b[1] << 8) | (b[2] << 16) | (b[3] << 24); -} -static inline void vm_do_write_memory_4_reversed(uint32 *a, uint32 v) -{ - uint8 * b = (uint8 *)a; - b[0] = v; - b[1] = v >> 8; - b[2] = v >> 16; - b[3] = v >> 24; -} -#endif - -/// -/// Actual memory accessors visible to CPU through virtual addresses -/// - -typedef uintptr vm_addr_t; - -#if REAL_ADDRESSING -const uintptr VMBaseDiff = 0; -#elif DIRECT_ADDRESSING -#ifdef NATMEM_OFFSET -const uintptr VMBaseDiff = NATMEM_OFFSET; -#endif -// Wrap address to 32-bit if we are not using 33-bit addressing space -#if defined(SHEEPSHAVER) && SIZEOF_VOID_P == 8 -#define vm_wrap_address(ADDR) (uintptr)(uint32)(ADDR) -#endif -#endif -#ifndef vm_wrap_address -#define vm_wrap_address(ADDR) (ADDR) -#endif - -#if REAL_ADDRESSING || DIRECT_ADDRESSING -static inline uint8 * vm_do_get_real_address(vm_addr_t addr) -{ - return (uint8 *)vm_wrap_address(VMBaseDiff + addr); -} -static inline vm_addr_t vm_do_get_virtual_address(uint8 *addr) -{ - return vm_wrap_address((uintptr)addr - VMBaseDiff); -} -static inline uint32 vm_read_memory_1(vm_addr_t addr) -{ - uint8 * const m = vm_do_get_real_address(addr); - return vm_do_read_memory_1(m); -} -static inline uint32 vm_read_memory_2(vm_addr_t addr) -{ - uint16 * const m = (uint16 *)vm_do_get_real_address(addr); - return vm_do_read_memory_2(m); -} -static inline uint32 vm_read_memory_4(vm_addr_t addr) -{ - uint32 * const m = (uint32 *)vm_do_get_real_address(addr); - return vm_do_read_memory_4(m); -} -static inline uint64 vm_read_memory_8(vm_addr_t addr) -{ - uint64 * const m = (uint64 *)vm_do_get_real_address(addr); - return vm_do_read_memory_8(m); -} -#define vm_read_memory_1_reversed vm_read_memory_1 -static inline uint32 vm_read_memory_2_reversed(vm_addr_t addr) -{ - uint16 * const m = (uint16 *)vm_do_get_real_address(addr); - return vm_do_read_memory_2_reversed(m); -} -static inline uint32 vm_read_memory_4_reversed(vm_addr_t addr) -{ - uint32 * const m = (uint32 *)vm_do_get_real_address(addr); - return vm_do_read_memory_4_reversed(m); -} -static inline void vm_write_memory_1(vm_addr_t addr, uint32 value) -{ - uint8 * const m = vm_do_get_real_address(addr); - vm_do_write_memory_1(m, value); -} -static inline void vm_write_memory_2(vm_addr_t addr, uint32 value) -{ - uint16 * const m = (uint16 *)vm_do_get_real_address(addr); - vm_do_write_memory_2(m, value); -} -static inline void vm_write_memory_4(vm_addr_t addr, uint32 value) -{ - uint32 * const m = (uint32 *)vm_do_get_real_address(addr); - vm_do_write_memory_4(m, value); -} -static inline void vm_write_memory_8(vm_addr_t addr, uint64 value) -{ - uint64 * const m = (uint64 *)vm_do_get_real_address(addr); - vm_do_write_memory_8(m, value); -} -#define vm_write_memory_1_reversed vm_write_memory_1 -static inline void vm_write_memory_2_reversed(vm_addr_t addr, uint32 value) -{ - uint16 * const m = (uint16 *)vm_do_get_real_address(addr); - vm_do_write_memory_2_reversed(m, value); -} -static inline void vm_write_memory_4_reversed(vm_addr_t addr, uint32 value) -{ - uint32 * const m = (uint32 *)vm_do_get_real_address(addr); - vm_do_write_memory_4_reversed(m, value); -} -static inline void *vm_memset(vm_addr_t addr, int c, size_t n) -{ - uint8 * const m = (uint8 *)vm_do_get_real_address(addr); - return memset(m, c, n); -} -#ifdef __cplusplus -static inline void *vm_memcpy(void *dest, vm_addr_t src, size_t n) -{ - return memcpy(dest, vm_do_get_real_address(src), n); -} -static inline void *vm_memcpy(vm_addr_t dest, const void *src, size_t n) -{ - return memcpy(vm_do_get_real_address(dest), src, n); -} -#endif -static inline void *vm_memcpy(vm_addr_t dest, vm_addr_t src, size_t n) -{ - return memcpy(vm_do_get_real_address(dest), vm_do_get_real_address(src), n); -} -#endif - -#endif /* VM_H */ - diff --git a/SheepShaver/src/kpx_cpu/src/mathlib/ieeefp-i386.cpp b/SheepShaver/src/kpx_cpu/src/mathlib/ieeefp-i386.cpp deleted file mode 100755 index 3b471cda..00000000 --- a/SheepShaver/src/kpx_cpu/src/mathlib/ieeefp-i386.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - * ieeefp-i386.cpp - Access to FPU environment, x86 specific code - * Code largely derived from GNU libc - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * CPU features - */ - -/* XXX: duplicate from cpu/ppc/ppc-dyngen.cpp! */ -static uint32 cpu_features = 0; - -enum { - HWCAP_I386_CMOV = 1 << 15, - HWCAP_I386_MMX = 1 << 23, - HWCAP_I386_SSE = 1 << 25, - HWCAP_I386_SSE2 = 1 << 26, -}; - -static unsigned int x86_cpuid(void) -{ - int fl1, fl2; - - /* See if we can use cpuid. On AMD64 we always can. */ - __asm__ ("pushfl; pushfl; popl %0; movl %0,%1; xorl %2,%0;" - "pushl %0; popfl; pushfl; popl %0; popfl" - : "=&r" (fl1), "=&r" (fl2) - : "i" (0x00200000)); - if (((fl1 ^ fl2) & 0x00200000) == 0) - return (0); - - /* Host supports cpuid. See if cpuid gives capabilities, try - CPUID(0). Preserve %ebx and %ecx; cpuid insn clobbers these, we - don't need their CPUID values here, and %ebx may be the PIC - register. */ - __asm__ ("push %%ecx ; push %%ebx ; cpuid ; pop %%ebx ; pop %%ecx" - : "=a" (fl1) : "0" (0) : "edx", "cc"); - if (fl1 == 0) - return (0); - - /* Invoke CPUID(1), return %edx; caller can examine bits to - determine what's supported. */ - __asm__ ("push %%ecx ; push %%ebx ; cpuid ; pop %%ebx ; pop %%ecx" : "=d" (fl2) : "a" (1) : "cc"); - - return fl2; -} - -static inline int has_cpu_features(int test_cpu_features) -{ - static bool initted = false; - if (!initted) { - cpu_features = x86_cpuid(); - initted = true; - } - return cpu_features & test_cpu_features; -} - - -/* - * Rounding control - */ - -// Get current rounding direction -int fegetround(void) -{ - unsigned short cw; - - __asm__ __volatile__("fnstcw %0" : "=m" (*&cw)); - - return cw & 0xc00; -} - -// Set the rounding direction represented by ROUND -int fesetround(int round) -{ - unsigned short cw; - - if ((round & ~0xc00) != 0) - return 1; - - __asm__ __volatile__("fnstcw %0" : "=m" (*&cw)); - cw &= ~0xc00; - cw |= round; - __asm__ __volatile__("fldcw %0" : : "m" (*&cw)); - - if (has_cpu_features(HWCAP_I386_SSE) != 0) { - uint32 xcw; - __asm__ __volatile__("stmxcsr %0" : "=m" (*&xcw)); - xcw &= ~0x6000; - xcw |= round << 3; - __asm__ __volatile__("ldmxcsr %0" : : "m" (*&xcw)); - } - - return 0; -} diff --git a/SheepShaver/src/kpx_cpu/src/mathlib/ieeefp-i386.hpp b/SheepShaver/src/kpx_cpu/src/mathlib/ieeefp-i386.hpp deleted file mode 100755 index 17e27d14..00000000 --- a/SheepShaver/src/kpx_cpu/src/mathlib/ieeefp-i386.hpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * ieeefp-i386.hpp - IEEE754 Floating-Point Math library, x86 specific code - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * Code derived from the GNU C Library - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef IEEEFP_I386_H -#define IEEEFP_I386_H - -// 7.6 Floating-point environment -#ifndef HAVE_FENV_H - -// Exceptions -enum { - FE_INVALID = 0x01, -#define FE_INVALID FE_INVALID - FE_DIVBYZERO = 0x04, -#define FE_DIVBYZERO FE_DIVBYZERO - FE_OVERFLOW = 0x08, -#define FE_OVERFLOW FE_OVERFLOW - FE_UNDERFLOW = 0x10, -#define FE_UNDERFLOW FE_UNDERFLOW - FE_INEXACT = 0x20 -#define FE_INEXACT FE_INEXACT -}; - -#define FE_ALL_EXCEPT (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT) - -// Rounding modes -enum { - FE_TONEAREST = 0, -#define FE_TONEAREST FE_TONEAREST - FE_DOWNWARD = 0x400, -#define FE_DOWNWARD FE_DOWNWARD - FE_UPWARD = 0x800, -#define FE_UPWARD FE_UPWARD - FE_TOWARDZERO = 0xc00 -#define FE_TOWARDZERO FE_TOWARDZERO -}; - -#endif - -#endif /* IEEEFP_I386_H */ diff --git a/SheepShaver/src/kpx_cpu/src/mathlib/ieeefp-mips.hpp b/SheepShaver/src/kpx_cpu/src/mathlib/ieeefp-mips.hpp deleted file mode 100644 index 593331eb..00000000 --- a/SheepShaver/src/kpx_cpu/src/mathlib/ieeefp-mips.hpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * ieee-mips.hpp - IEE754 Floating-Point Math library, mips specific code - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * Code derived from the GNU C Library - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef IEEEFP_MIPS_H -#define IEEEFP_MIPS_H - -// 7.6 Floating-point environment -#ifndef USE_FENV_H - -// Exceptions -enum { - FE_INEXACT = 0x04, -#define FE_INEXACT FE_INEXACT - FE_UNDERFLOW = 0x08, -#define FE_UNDERFLOW FE_UNDERFLOW - FE_OVERFLOW = 0x10, -#define FE_OVERFLOW FE_OVERFLOW - FE_DIVBYZERO = 0x20, -#define FE_DIVBYZERO FE_DIVBYZERO - FE_INVALID = 0x40, -#define FE_INVALID FE_INVALID -}; - -#define FE_ALL_EXCEPT (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID) - -// Rounding modes -enum { - FE_TONEAREST = 0x0, -#define FE_TONEAREST FE_TONEAREST - FE_TOWARDZERO = 0x1, -#define FE_TOWARDZERO FE_TOWARDZERO - FE_UPWARD = 0x2, -#define FE_UPWARD FE_UPWARD - FE_DOWNWARD = 0x3 -#define FE_DOWNWARD FE_DOWNWARD -}; - -#endif - -#endif /* IEEEFP_MIPS_H */ diff --git a/SheepShaver/src/kpx_cpu/src/mathlib/ieeefp.cpp b/SheepShaver/src/kpx_cpu/src/mathlib/ieeefp.cpp deleted file mode 100755 index 8158acee..00000000 --- a/SheepShaver/src/kpx_cpu/src/mathlib/ieeefp.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - * ieeefp.cpp - Access to FPU environment - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" - -#ifndef HAVE_FENV_H -#include "mathlib/ieeefp.hpp" -#if defined(__i386__) -#include "mathlib/ieeefp-i386.cpp" -#endif -#endif - diff --git a/SheepShaver/src/kpx_cpu/src/mathlib/ieeefp.hpp b/SheepShaver/src/kpx_cpu/src/mathlib/ieeefp.hpp deleted file mode 100755 index 7fe544e5..00000000 --- a/SheepShaver/src/kpx_cpu/src/mathlib/ieeefp.hpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - * ieeefp.hpp - IEEE754 Floating-Point Math library - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef IEEEFP_H -#define IEEEFP_H - -// Can we use C99 extensions in C++ mode? -#ifdef HAVE_FENV_H -#if defined __GNUC__ -#define USE_FENV_H 1 -#endif -#endif - -// Arch-dependent definitions -#if defined(__i386__) -#include "mathlib/ieeefp-i386.hpp" -#endif -#if defined(__mips__) || (defined(sgi) && defined(mips)) -#include "mathlib/ieeefp-mips.hpp" -#endif - -#ifdef USE_FENV_H -#include -#else - -// Rounding control -extern "C" int fegetround(void); -extern "C" int fesetround(int); - -#endif /* FENV_H */ - -// Make sure previous instructions are executed first -// XXX this is most really a hint to the compiler so that is doesn't -// reorder calls to fe*() functions before the actual compuation... -#if defined __GNUC__ -#define febarrier() __asm__ __volatile__ ("") -#endif -#ifndef febarrier -#define febarrier() -#endif - -// HOST_FLOAT_WORDS_BIG_ENDIAN is a tristate: -// yes (1) / no (0) / default (undefined) -#if HOST_FLOAT_WORDS_BIG_ENDIAN -#define FLOAT_WORD_ORDER_BIG_ENDIAN -#elif defined(WORDS_BIGENDIAN) -#define FLOAT_WORD_ORDER_BIG_ENDIAN -#endif - -// Representation of an IEEE 754 float -union mathlib_ieee_float_shape_type { - float value; - uint32 word; -}; - -#define MATHLIB_GET_FLOAT_WORD(i,d) \ -do { \ - mathlib_ieee_float_shape_type gf_u; \ - gf_u.value = (d); \ - (i) = gf_u.word; \ -} while (0) - -#define MATHLIB_SET_FLOAT_WORD(d,i) \ -do { \ - mathlib_ieee_float_shape_type sf_u; \ - sf_u.word = (i); \ - (d) = sf_u.value; \ -} while (0) - -// Representation of an IEEE 754 double -union mathlib_ieee_double_shape_type { - double value; - struct { -#ifdef FLOAT_WORD_ORDER_BIG_ENDIAN - uint32 msw; - uint32 lsw; -#else - uint32 lsw; - uint32 msw; -#endif - } parts; -}; - -#define MATHLIB_EXTRACT_WORDS(ix0,ix1,d) \ -do { \ - mathlib_ieee_double_shape_type ew_u; \ - ew_u.value = (d); \ - (ix0) = ew_u.parts.msw; \ - (ix1) = ew_u.parts.lsw; \ -} while (0) - -#define MATHLIB_GET_HIGH_WORD(i,d) \ -do { \ - mathlib_ieee_double_shape_type gh_u; \ - gh_u.value = (d); \ - (i) = gh_u.parts.msw; \ -} while (0) - -#define MATHLIB_GET_LOW_WORD(i,d) \ -do { \ - mathlib_ieee_double_shape_type gl_u; \ - gl_u.value = (d); \ - (i) = gl_u.parts.lsw; \ -} while (0) - -#endif /* IEEEFP_H */ diff --git a/SheepShaver/src/kpx_cpu/src/mathlib/mathlib-i386.cpp b/SheepShaver/src/kpx_cpu/src/mathlib/mathlib-i386.cpp deleted file mode 100644 index cc82bbea..00000000 --- a/SheepShaver/src/kpx_cpu/src/mathlib/mathlib-i386.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * mathlib-i386.cpp - Math library wrapper, x86 specific code - * Code largely derived from GNU libc - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -// 7.12.9.8 The trunc functions -#ifndef HAVE_TRUNC -#define HAVE_TRUNC -double trunc(double x) -{ - volatile unsigned short int cw; - volatile unsigned short int cwtmp; - double value; - - __asm__ __volatile__("fnstcw %0" : "=m" (cw)); - cwtmp = (cw & 0xf3ff) | 0x0c00; /* toward zero */ - __asm__ __volatile__("fldcw %0" : : "m" (cwtmp)); - __asm__ __volatile__("frndint" : "=t" (value) : "0" (x)); - __asm__ __volatile__("fldcw %0" : : "m" (cw)); - return value; -} -#endif diff --git a/SheepShaver/src/kpx_cpu/src/mathlib/mathlib-i386.hpp b/SheepShaver/src/kpx_cpu/src/mathlib/mathlib-i386.hpp deleted file mode 100644 index 3c23b81c..00000000 --- a/SheepShaver/src/kpx_cpu/src/mathlib/mathlib-i386.hpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * mathlib-i386.hpp - Math library wrapper, x86 specific code - * Code largely derived from GNU libc - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef MATHLIB_I386_H -#define MATHLIB_I386_H - -// 7.12.9.5 The lrint and llrint functions -#if defined(__GNUC__) -#define mathlib_lrint(x) \ -({ long int __result; \ - __asm__ __volatile__ ("fistpl %0" : "=m" (__result) : "t" (x) : "st"); \ - __result; }) -#endif - -// 7.12.14 Comparison macros -#if defined(__GNUC__) -#ifndef isless -#define isless(x, y) \ -({ register char __result; \ - __asm__ ("fucompp; fnstsw; testb $0x45, %%ah; setz %%al" \ - : "=a" (__result) : "u" (x), "t" (y) : "cc", "st", "st(1)"); \ - __result; }) -#endif - -#ifndef isgreater -#define isgreater(x, y) \ -({ register char __result; \ - __asm__ ("fucompp; fnstsw; testb $0x45, %%ah; setz %%al" \ - : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \ - __result; }) -#endif -#endif - -#endif /* MATHLIB_I386_H */ diff --git a/SheepShaver/src/kpx_cpu/src/mathlib/mathlib-ppc.hpp b/SheepShaver/src/kpx_cpu/src/mathlib/mathlib-ppc.hpp deleted file mode 100644 index 79cccb22..00000000 --- a/SheepShaver/src/kpx_cpu/src/mathlib/mathlib-ppc.hpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * mathlib-ppc.hpp - Math library wrapper, ppc specific code - * Code largely derived from GNU libc - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef MATHLIB_PPC_H -#define MATHLIB_PPC_H - -// Floating-Point Multiply Add -#if defined __GNUC__ -static inline double mathlib_fmadd(double x, double y, double z) -{ - double r; - __asm__ __volatile__ ("fmadd %0,%1,%2,%3" : "=f" (r) : "f" (x), "f" (y) , "f" (z)); - return r; -} - -static inline float mathlib_fmadd(float x, float y, float z) -{ - float r; - __asm__ __volatile__ ("fmadds %0,%1,%2,%3" : "=f" (r) : "f" (x), "f" (y) , "f" (z)); - return r; -} - -#define mathlib_fmadd(x, y, z) (mathlib_fmadd)(x, y, z) -#endif - -// Floating-Point Multiply Subtract -#if defined __GNUC__ -static inline double mathlib_fmsub(double x, double y, double z) -{ - double r; - __asm__ __volatile__ ("fmsub %0,%1,%2,%3" : "=f" (r) : "f" (x), "f" (y) , "f" (z)); - return r; -} - -static inline float mathlib_fmsub(float x, float y, float z) -{ - float r; - __asm__ __volatile__ ("fmsubs %0,%1,%2,%3" : "=f" (r) : "f" (x), "f" (y) , "f" (z)); - return r; -} - -#define mathlib_fmsub(x, y, z) (mathlib_fmsub)(x, y, z) -#endif - -#endif /* MATHLIB_PPC_H */ diff --git a/SheepShaver/src/kpx_cpu/src/mathlib/mathlib-x86_64.hpp b/SheepShaver/src/kpx_cpu/src/mathlib/mathlib-x86_64.hpp deleted file mode 100644 index 4af8a426..00000000 --- a/SheepShaver/src/kpx_cpu/src/mathlib/mathlib-x86_64.hpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - * mathlib-x86_64.hpp - Math library wrapper, x86-64 specific code - * Code largely derived from GNU libc - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef MATHLIB_X86_64_H -#define MATHLIB_X86_64_H - -// 7.12.9.5 The lrint and llrint functions -#if defined(__GNUC__) -#define mathlib_lrint(x) \ -({ long int __result; \ - __asm__ __volatile__ ("cvtsd2si %1, %0" : "=r" (__result) : "x" (x)); \ - __result; }) -#endif - -#endif /* MATHLIB_X86_64_H */ diff --git a/SheepShaver/src/kpx_cpu/src/mathlib/mathlib.cpp b/SheepShaver/src/kpx_cpu/src/mathlib/mathlib.cpp deleted file mode 100644 index d51a8db2..00000000 --- a/SheepShaver/src/kpx_cpu/src/mathlib/mathlib.cpp +++ /dev/null @@ -1,228 +0,0 @@ -/* - * mathlib.cpp - Math library wrapper - * Code largely derived from GNU libc - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" -#include "mathlib/mathlib.hpp" - -#include -#include - - -/** - * Arch-dependent optimizations - **/ - -#if defined(__i386__) -#include "mathlib/mathlib-i386.cpp" -#endif - - -/** - * Helper functions - **/ - -static void unimplemented(const char *function) -{ - fprintf(stderr, "MATHLIB: unimplemented function '%s', aborting execution\n", function); - abort(); -} - - -/** - * 7.12.3.1 The fpclassify macro - **/ - -int mathlib_fpclassifyf (float x) -{ - uint32 wx; - int retval = FP_NORMAL; - - MATHLIB_GET_FLOAT_WORD (wx, x); - wx &= 0x7fffffff; - if (wx == 0) - retval = FP_ZERO; - else if (wx < 0x800000) - retval = FP_SUBNORMAL; - else if (wx >= 0x7f800000) - retval = wx > 0x7f800000 ? FP_NAN : FP_INFINITE; - - return retval; -} - -int mathlib_fpclassify (double x) -{ - uint32 hx, lx; - int retval = FP_NORMAL; - - MATHLIB_EXTRACT_WORDS (hx, lx, x); - lx |= hx & 0xfffff; - hx &= 0x7ff00000; - if ((hx | lx) == 0) - retval = FP_ZERO; - else if (hx == 0) - retval = FP_SUBNORMAL; - else if (hx == 0x7ff00000) - retval = lx != 0 ? FP_NAN : FP_INFINITE; - - return retval; -} - -int mathlib_fpclassifyl(long double x) -{ - unimplemented("fpclassifyl"); -} - - -/** - * 7.12.3.6 The signbit macro - **/ - -int mathlib_signbitf (float x) -{ - int32 hx; - - MATHLIB_GET_FLOAT_WORD (hx, x); - return hx & 0x80000000; -} - -int mathlib_signbit (double x) -{ - int32 hx; - - MATHLIB_GET_HIGH_WORD (hx, x); - return hx & 0x80000000; -} - -int mathlib_signbitl(long double x) -{ - unimplemented("signbitl"); -} - - -/** - * 7.12.9.5 The lrint and llrint functions - **/ - -#ifndef mathlib_lrint -long mathlib_lrint(double x) -{ - int32 j0; - uint32 i0, i1; - volatile double w; - double t; - long int result; - int sx; - - static const double two52[2] = { - 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */ - -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */ - }; - - MATHLIB_EXTRACT_WORDS (i0, i1, x); - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; - sx = i0 >> 31; - i0 &= 0xfffff; - i0 |= 0x100000; - - if (j0 < 20) { - if (j0 < -1) - return 0; - else { - w = two52[sx] + x; - t = w - two52[sx]; - MATHLIB_EXTRACT_WORDS (i0, i1, t); - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; - i0 &= 0xfffff; - i0 |= 0x100000; - - result = i0 >> (20 - j0); - } - } - else if (j0 < (int32) (8 * sizeof (long int)) - 1) { - if (j0 >= 52) - result = ((long int) i0 << (j0 - 20)) | (i1 << (j0 - 52)); - else { - w = two52[sx] + x; - t = w - two52[sx]; - MATHLIB_EXTRACT_WORDS (i0, i1, t); - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; - i0 &= 0xfffff; - i0 |= 0x100000; - - if (j0 == 20) - result = (long int) i0; - else - result = ((long int) i0 << (j0 - 20)) | (i1 >> (52 - j0)); - } - } - else { - /* The number is too large. It is left implementation defined - what happens. */ - return (long int) x; - } - - return sx ? -result : result; -} -#endif - - -/** - * 7.12.9.6 The round functions - **/ - -float mathlib_roundf(float x) -{ - int32 i0, j0; - static const float huge = 1.0e30; - - MATHLIB_GET_FLOAT_WORD (i0, x); - j0 = ((i0 >> 23) & 0xff) - 0x7f; - if (j0 < 23) { - if (j0 < 0) { - if (huge + x > 0.0F) { - i0 &= 0x80000000; - if (j0 == -1) - i0 |= 0x3f800000; - } - } - else { - uint32 i = 0x007fffff >> j0; - if ((i0 & i) == 0) - /* X is integral. */ - return x; - if (huge + x > 0.0F) { - /* Raise inexact if x != 0. */ - i0 += 0x00400000 >> j0; - i0 &= ~i; - } - } - } - else { - if (j0 == 0x80) - /* Inf or NaN. */ - return x + x; - else - return x; - } - - MATHLIB_SET_FLOAT_WORD (x, i0); - return x; -} diff --git a/SheepShaver/src/kpx_cpu/src/mathlib/mathlib.hpp b/SheepShaver/src/kpx_cpu/src/mathlib/mathlib.hpp deleted file mode 100644 index d0ef5dcf..00000000 --- a/SheepShaver/src/kpx_cpu/src/mathlib/mathlib.hpp +++ /dev/null @@ -1,339 +0,0 @@ - -/* - * mathlib.hpp - Math library wrapper - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef MATHLIB_H -#define MATHLIB_H - -#include -#include "mathlib/ieeefp.hpp" - -// Broken MacOS X headers -#if defined(__APPLE__) && defined(__MACH__) -// ... the following exist but are not macro-defined ... -#ifndef FP_NAN -#define FP_NAN FP_NAN -#define FP_INFINITE FP_INFINITE -#define FP_ZERO FP_ZERO -#define FP_NORMAL FP_NORMAL -#define FP_SUBNORMAL FP_SUBNORMAL -#endif -#endif - -// GCC fixes for IRIX/mips -#if defined __GNUC__ && defined __sgi__ && defined __mips__ -#define mathlib_generic_1(func, x) \ - (sizeof(x) == sizeof(float) ? _##func##f(x) : _##func(x)) - -#define fpclassify(x) mathlib_generic_1(fpclassify, x) -#define isnormal(x) mathlib_generic_1(isnormal, x) -#define isfinite(x) mathlib_generic_1(isfinite, x) -#define isnan(x) mathlib_generic_1(isnan, x) -#define isinf(x) mathlib_generic_1(isinf, x) -#define signbit(x) mathlib_generic_1(signbit, x) - -#define mathlib_generic_2(func, x, y) \ - ((sizeof(x) == sizeof(float) && sizeof(x) == sizeof(y)) ? _##func##f(x, y) : _##func(x, y)) - -#define isless(x,y) mathlib_generic_2(isless, x, y) -#define isgreater(x,y) mathlib_generic_2(isgreater, x, y) -#endif - -// C++ exception specifications -#if defined __GLIBC__ && defined __THROW -#define MATHLIB_THROW __THROW -#else -#define MATHLIB_THROW -#endif - -// 7.12 Mathematics [#6] -#ifndef FP_NAN -enum { - FP_NAN, -# define FP_NAN FP_NAN - FP_INFINITE, -# define FP_INFINITE FP_INFINITE - FP_ZERO, -# define FP_ZERO FP_ZERO - FP_SUBNORMAL, -# define FP_SUBNORMAL FP_SUBNORMAL - FP_NORMAL -# define FP_NORMAL FP_NORMAL -}; -#endif - -// Arch-dependent definitions -#if defined(__i386__) -#include "mathlib/mathlib-i386.hpp" -#endif -#if defined(__x86_64__) -#include "mathlib/mathlib-x86_64.hpp" -#endif -#if defined(__powerpc__) || defined(__ppc__) -#include "mathlib/mathlib-ppc.hpp" -#endif - -// Floating-Point Multiply Add/Subtract functions -#if (SIZEOF_LONG_DOUBLE > SIZEOF_DOUBLE) && (SIZEOF_DOUBLE > SIZEOF_FLOAT) -// FIXME: this is wrong for underflow conditions -#ifndef mathlib_fmadd -static inline double mathlib_fmadd(double x, double y, double z) -{ - return ((long double)x * (long double)y) + z; -} -static inline float mathlib_fmadd(float x, float y, float z) -{ - return ((double)x * (double)y) + z; -} -#define mathlib_fmadd(x, y, z) (mathlib_fmadd)(x, y, z) -#endif -#ifndef mathlib_fmsub -static inline double mathlib_fmsub(double x, double y, double z) -{ - return ((long double)x * (long double)y) - z; -} -static inline float mathlib_fmsub(float x, float y, float z) -{ - return ((double)x * (double)y) - z; -} -#define mathlib_fmsub(x, y, z) (mathlib_fmsub)(x, y, z) -#endif -#endif -#ifndef mathlib_fmadd -#define mathlib_fmadd(x, y, z) (((x) * (y)) + (z)) -#endif -#ifndef mathlib_fmsub -#define mathlib_fmsub(x, y, z) (((x) * (y)) - (z)) -#endif - -// 7.12.6.2 The exp2 functions -#ifdef HAVE_EXP2F -extern "C" float exp2f(float x) MATHLIB_THROW; -#else -#ifdef HAVE_EXP2 -extern "C" double exp2(double x) MATHLIB_THROW; -#define exp2f(x) (float)exp2(x) -#else -#ifndef exp2f -#define exp2f(x) powf(2.0, (x)) -#endif -#endif -#endif - -// 7.12.6.10 The log2 functions -#ifdef HAVE_LOG2F -extern "C" float log2f(float x) MATHLIB_THROW; -#else -#ifdef HAVE_LOG2 -extern "C" double log2(double x) MATHLIB_THROW; -#define log2f(x) (float)log2(x) -#else -#ifndef M_LN2 -#define M_LN2 logf(2.0) -#endif -#ifndef log2f -#define log2f(x) logf(x) / M_LN2 -#endif -#endif -#endif - -// 7.12.9.1 The ceil functions -#ifdef HAVE_CEILF -extern "C" float ceilf(float x) MATHLIB_THROW; -#else -#ifdef HAVE_CEIL -extern "C" double ceil(double x) MATHLIB_THROW; -#define ceilf(x) (float)ceil(x) -#endif -#endif - -// 7.12.9.2 The floor functions -#ifdef HAVE_FLOORF -extern "C" float floorf(float x) MATHLIB_THROW; -#else -#ifdef HAVE_FLOOR -extern "C" double floor(double x) MATHLIB_THROW; -#define floorf(x) (float)floor(x) -#endif -#endif - -// 7.12.9.5 The lrint and llrint functions -#ifdef HAVE_LRINT -extern "C" long lrint(double x) MATHLIB_THROW; -#else -#ifndef mathlib_lrint -extern long mathlib_lrint(double); -#endif -#define lrint(x) mathlib_lrint(x) -#endif - -// 7.12.9.6 The round functions -#ifdef HAVE_ROUNDF -extern "C" float roundf(float x) MATHLIB_THROW; -#else -#ifdef HAVE_ROUND -extern "C" double round(double x) MATHLIB_THROW; -#define roundf(x) (float)round(x) -#else -extern float mathlib_roundf(float); -#define roundf(x) mathlib_roundf(x) -#endif -#endif - -// 7.12.9.8 The trunc functions -#ifdef HAVE_TRUNCF -extern "C" float truncf(float x) MATHLIB_THROW; -#else -#ifdef HAVE_TRUNC -extern "C" double trunc(double x) MATHLIB_THROW; -#define truncf(x) (float)trunc(x) -#endif -#endif - -// 7.12.3.1 The fpclassify macro -#ifndef fpclassify -#ifndef mathlib_fpclassifyf -extern int mathlib_fpclassifyf(float x); -#endif -#ifndef mathlib_fpclassify -extern int mathlib_fpclassify(double x); -#endif -#ifndef mathlib_fpclassifyl -extern int mathlib_fpclassifyl(long double x); -#endif -#define fpclassify(x) \ - (sizeof (x) == sizeof (float) \ - ? mathlib_fpclassifyf (x) \ - : sizeof (x) == sizeof (double) \ - ? mathlib_fpclassify (x) : mathlib_fpclassifyl (x)) -#endif - -// 7.12.3.2 The isfinite macro -static inline int mathlib_isfinite(float x) -{ - int32 ix; - - MATHLIB_GET_FLOAT_WORD(ix, x); - return (int)((uint32)((ix & 0x7fffffff) - 0x7f800000) >> 31); -} - -static inline int mathlib_isfinite(double x) -{ - int32 hx; - - MATHLIB_GET_HIGH_WORD(hx, x); - return (int)((uint32)((hx & 0x7fffffff) - 0x7ff00000) >> 31); -} - -#ifndef isfinite -#define isfinite(x) mathlib_isfinite(x) -#endif - -// 7.12.3.3 The isinf macro -static inline int mathlib_isinf(float x) -{ - int32 ix, t; - - MATHLIB_GET_FLOAT_WORD(ix, x); - t = ix & 0x7fffffff; - t ^= 0x7f800000; - t |= -t; - return ~(t >> 31) & (ix >> 30); -} - -static inline int mathlib_isinf(double x) -{ - int32 hx, lx; - - MATHLIB_EXTRACT_WORDS(hx, lx, x); - lx |= (hx & 0x7fffffff) ^ 0x7ff00000; - lx |= -lx; - return ~(lx >> 31) & (hx >> 30); -} - -#ifndef isinf -#if defined __sgi && defined __mips -// specialized implementation for IRIX mips compilers -extern "C" int _isinf(double); -extern "C" int _isinff(float); -static inline int isinf(double x) { return _isinf(x); } -static inline int isinf(float x) { return _isinff(x); } -#else -#define isinf(x) mathlib_isinf(x) -#endif -#endif - -// 7.12.3.4 The isnan macro -static inline int mathlib_isnan(float x) -{ - int32 ix; - - MATHLIB_GET_FLOAT_WORD(ix, x); - ix &= 0x7fffffff; - ix = 0x7f800000 - ix; - return (int)(((uint32)ix) >> 31); -} - -static inline int mathlib_isnan(double x) -{ - int32 hx, lx; - - MATHLIB_EXTRACT_WORDS(hx, lx, x); - hx &= 0x7fffffff; - hx |= (uint32)(lx|(-lx)) >> 31; - hx = 0x7ff00000 - hx; - return (int)(((uint32)hx) >> 31); -} - -#ifndef isnan -#define isnan(x) mathlib_isnan(x) -#endif - -// 7.12.3.6 The signbit macro -#ifndef signbit -#ifndef mathlib_signbitf -extern int mathlib_signbitf(float x); -#endif -#ifndef mathlib_signbit -extern int mathlib_signbit(double x); -#endif -#ifndef mathlib_signbitl -extern int mathlib_signbitl(long double x); -#endif -#define signbit(x) \ - (sizeof (x) == sizeof (float) \ - ? mathlib_signbitf (x) \ - : sizeof (x) == sizeof (double) \ - ? mathlib_signbit (x) : mathlib_signbitl (x)) -#endif - -// 7.12.14.1 The isgreater macro -// FIXME: this is wrong for unordered values -#ifndef isgreater -#define isgreater(x, y) ((x) > (y)) -#endif - -// 7.12.14.3 The isless macro -// FIXME: this is wrong for unordered values -#ifndef isless -#define isless(x, y) ((x) < (y)) -#endif - -#endif /* MATHLIB_H */ diff --git a/SheepShaver/src/kpx_cpu/src/test/test-powerpc.cpp b/SheepShaver/src/kpx_cpu/src/test/test-powerpc.cpp deleted file mode 100644 index 2e5b99d3..00000000 --- a/SheepShaver/src/kpx_cpu/src/test/test-powerpc.cpp +++ /dev/null @@ -1,2242 +0,0 @@ -/* - * test-powerpc.cpp - PowerPC regression testing - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -// NOTE: Results file md5sum: 3e29432abb6e21e625a2eef8cf2f0840 ($Revision$) - -#include -#include -#include -#include -#include -#include // ntohl(), htonl() -#include -#include -#include -#include - -#if defined(__powerpc__) || defined(__ppc__) -#define NATIVE_POWERPC -#endif - -#if EMU_KHEPERIX -#include "sysdeps.h" -#include "vm_alloc.h" -#include "cpu/ppc/ppc-cpu.hpp" -#include "cpu/ppc/ppc-instructions.hpp" -#endif - -#if EMU_MICROLIB -#include -typedef unsigned int uint32; -typedef unsigned long uintptr; -#undef RD -#undef RA -#undef RB -#undef FB -#undef FE -#endif - -#if EMU_MODEL3PPC -extern "C" { -#include "ppc.h" -} -typedef unsigned int uint32; -typedef unsigned long uintptr; -typedef uint32_t UINT32; -typedef char CHAR; -typedef int BOOL; -#endif - -#if EMU_QEMU -extern "C" { -#include "target-ppc/cpu.h" -extern void tb_flush(); -} -typedef uint32_t uint32; -typedef uintptr_t uintptr; -#endif - -// Disassemblers needed for debugging purposes -#if ENABLE_MON -#include "mon.h" -#include "mon_disass.h" -#endif - -// Define units to test (in-order: ALU, FPU, VMX) -#define TEST_ALU_OPS 1 -#if EMU_KHEPERIX -#define TEST_FPU_OPS 1 -#define TEST_VMX_OPS 1 -#endif - -// Define units to skip during testing -#define SKIP_ALU_OPS 0 -#define SKIP_FPU_OPS 0 -#define SKIP_VMX_OPS 0 - -// Define instructions to test -#define TEST_ADD 1 -#define TEST_SUB 1 -#define TEST_MUL 1 -#define TEST_DIV 1 -#define TEST_SHIFT 1 -#define TEST_ROTATE 1 -#define TEST_MISC 1 -#define TEST_LOGICAL 1 -#define TEST_COMPARE 1 -#define TEST_CR_LOGICAL 1 -#define TEST_VMX_LOADSH 1 -#define TEST_VMX_LOAD 1 -#define TEST_VMX_ARITH 1 - - -// Partial PowerPC runtime assembler from GNU lightning -#undef _I -#define _I(X) ((uint32)(X)) -#undef _UL -#define _UL(X) ((uint32)(X)) -#undef _MASK -#define _MASK(N) ((uint32)((1<<(N)))-1) -#undef _ck_s -#define _ck_s(W,I) (_UL(I) & _MASK(W)) -#undef _ck_u -#define _ck_u(W,I) (_UL(I) & _MASK(W)) -#undef _ck_su -#define _ck_su(W,I) (_UL(I) & _MASK(W)) -#undef _u1 -#define _u1(I) _ck_u( 1,I) -#undef _u5 -#define _u5(I) _ck_u( 5,I) -#undef _u6 -#define _u6(I) _ck_u( 6,I) -#undef _u9 -#define _u9(I) _ck_u( 9,I) -#undef _u10 -#define _u10(I) _ck_u(10,I) -#undef _u11 -#define _u11(I) _ck_u(11,I) -#undef _s16 -#define _s16(I) _ck_s(16,I) - -#undef _D -#define _D( OP,RD,RA, DD ) _I((_u6(OP)<<26)|(_u5(RD)<<21)|(_u5(RA)<<16)| _s16(DD) ) -#undef _X -#define _X( OP,RD,RA,RB, XO,RC ) _I((_u6(OP)<<26)|(_u5(RD)<<21)|(_u5(RA)<<16)|( _u5(RB)<<11)| (_u10(XO)<<1)|_u1(RC)) -#undef _XO -#define _XO( OP,RD,RA,RB,OE,XO,RC ) _I((_u6(OP)<<26)|(_u5(RD)<<21)|(_u5(RA)<<16)|( _u5(RB)<<11)|(_u1(OE)<<10)|( _u9(XO)<<1)|_u1(RC)) -#undef _M -#define _M( OP,RS,RA,SH,MB,ME,RC ) _I((_u6(OP)<<26)|(_u5(RS)<<21)|(_u5(RA)<<16)|( _u5(SH)<<11)|(_u5(MB)<< 6)|( _u5(ME)<<1)|_u1(RC)) -#undef _VX -#define _VX( OP,VD,VA,VB, XO ) _I((_u6(OP)<<26)|(_u5(VD)<<21)|(_u5(VA)<<16)|( _u5(VB)<<11)| _u11(XO) ) -#undef _VXR -#define _VXR( OP,VD,VA,VB, XO,RC ) _I((_u6(OP)<<26)|(_u5(VD)<<21)|(_u5(VA)<<16)|( _u5(VB)<<11)| (_u1(RC)<<10)|_u10(XO)) -#undef _VA -#define _VA( OP,VD,VA,VB,VC,XO ) _I((_u6(OP)<<26)|(_u5(VD)<<21)|(_u5(VA)<<16)|( _u5(VB)<<11)|(_u5(VC)<< 6)| _u6(XO) ) - -// PowerPC opcodes -static inline uint32 POWERPC_LI(int RD, uint32 v) { return _D(14,RD,00,(v&0xffff)); } -static inline uint32 POWERPC_MR(int RD, int RA) { return _X(31,RA,RD,RA,444,0); } -static inline uint32 POWERPC_MFCR(int RD) { return _X(31,RD,00,00,19,0); } -static inline uint32 POWERPC_LVX(int vD, int rA, int rB) { return _X(31,vD,rA,rB,103,0); } -static inline uint32 POWERPC_STVX(int vS, int rA, int rB) { return _X(31,vS,rA,rB,231,0); } -static inline uint32 POWERPC_MFSPR(int rD, int SPR) { return _X(31,rD,(SPR&0x1f),((SPR>>5)&0x1f),339,0); } -static inline uint32 POWERPC_MTSPR(int rS, int SPR) { return _X(31,rS,(SPR&0x1f),((SPR>>5)&0x1f),467,0); } -const uint32 POWERPC_NOP = 0x60000000; -const uint32 POWERPC_BLR = 0x4e800020; -const uint32 POWERPC_BLRL = 0x4e800021; -const uint32 POWERPC_ILLEGAL = 0x00000000; -const uint32 POWERPC_EMUL_OP = 0x18000000; - -// Invalidate test cache -#ifdef NATIVE_POWERPC -static void inline ppc_flush_icache_range(uint32 *start_p, uint32 length) -{ - const int MIN_CACHE_LINE_SIZE = 8; /* conservative value */ - - unsigned long start = (unsigned long)start_p; - unsigned long stop = start + length; - unsigned long p; - - p = start & ~(MIN_CACHE_LINE_SIZE - 1); - stop = (stop + MIN_CACHE_LINE_SIZE - 1) & ~(MIN_CACHE_LINE_SIZE - 1); - - for (p = start; p < stop; p += MIN_CACHE_LINE_SIZE) { - asm volatile ("dcbst 0,%0" : : "r"(p) : "memory"); - } - asm volatile ("sync" : : : "memory"); - for (p = start; p < stop; p += MIN_CACHE_LINE_SIZE) { - asm volatile ("icbi 0,%0" : : "r"(p) : "memory"); - } - asm volatile ("sync" : : : "memory"); - asm volatile ("isync" : : : "memory"); -} -#else -static void inline ppc_flush_icache_range(uint32 *start_p, uint32 length) -{ -} -#endif - -#if EMU_KHEPERIX -// Wrappers when building from SheepShaver tree -#ifdef SHEEPSHAVER -uint32 ROMBase = 0x40800000; -int64 TimebaseSpeed = 25000000; // Default: 25 MHz -uint32 PVR = 0x000c0000; // Default: 7400 (with AltiVec) - -bool PrefsFindBool(const char *name) -{ - return false; -} - -uint64 GetTicks_usec(void) -{ - return clock(); -} - -void HandleInterrupt(powerpc_registers *) -{ -} - -#if PPC_ENABLE_JIT && PPC_REENTRANT_JIT -void init_emul_op_trampolines(basic_dyngen & dg) -{ -} -#endif -#endif - -struct powerpc_cpu_base - : public powerpc_cpu -{ - powerpc_cpu_base(); - void init_decoder(); - void execute_return(uint32 opcode); - void invalidate_cache_range(uint32 *start, uint32 size) - { powerpc_cpu::invalidate_cache_range((uintptr)start, ((uintptr)start) + size); } - - uint32 emul_get_xer() const { return xer().get(); } - void emul_set_xer(uint32 value) { xer().set(value); } - uint32 emul_get_cr() const { return cr().get(); } - void emul_set_cr(uint32 value) { cr().set(value); } - uint32 get_lr() const { return lr(); } - void set_lr(uint32 value) { lr() = value; } - uint32 get_gpr(int i) const { return gpr(i); } - void set_gpr(int i, uint32 value) { gpr(i) = value; } -}; - -powerpc_cpu_base::powerpc_cpu_base() -#ifndef SHEEPSHAVER - : powerpc_cpu(NULL) -#endif -{ - init_decoder(); -} - -void powerpc_cpu_base::execute_return(uint32 opcode) -{ - spcflags().set(SPCFLAG_CPU_EXEC_RETURN); -} - -void powerpc_cpu_base::init_decoder() -{ - static const instr_info_t return_ii_table[] = { - { "return", - (execute_pmf)&powerpc_cpu_base::execute_return, - PPC_I(MAX), - D_form, 6, 0, CFLOW_JUMP - } - }; - - const int ii_count = sizeof(return_ii_table)/sizeof(return_ii_table[0]); - - for (int i = 0; i < ii_count; i++) { - const instr_info_t * ii = &return_ii_table[i]; - init_decoder_entry(ii); - } -} -#endif - -#if EMU_MICROLIB -static volatile bool ppc_running = false; - -struct powerpc_cpu_base -{ - powerpc_cpu_base(); - void execute(uintptr); - void enable_jit() { } - void invalidate_cache() { } - void invalidate_cache_range(uint32 *start, uint32 size) { } - - uint32 emul_get_xer() const { return XER; } - void emul_set_xer(uint32 value) { XER = value; } - uint32 emul_get_cr() const { return CR; } - void emul_set_cr(uint32 value) { CR = value; } - uint32 get_lr() const { return LR; } - void set_lr(uint32 value) { LR = value; } - uint32 get_gpr(int i) const { return GPR(i); } - void set_gpr(int i, uint32 value) { GPR(i) = value; } -}; - -void sheep_impl(ppc_inst_t inst) -{ - ppc_running = false; -} - -extern "C" void init_table(int opcd, void (*impl)(ppc_inst_t), char *(*bin2c)(ppc_inst_t, addr_t, char *), char *(*disasm)(ppc_inst_t, addr_t, char *), void (*translate)(ppc_inst_t, struct DecodedInstruction *), void (*xmlize)(ppc_inst_t, addr_t, char *), char *mnemonic); - -powerpc_cpu_base::powerpc_cpu_base() -{ - ppc_init(); - init_table(6, sheep_impl, NULL, NULL, NULL, NULL, "sheep"); -} - -#define ppc_code_fetch(A) ntohl(*((uint32 *)(A))) - -void powerpc_cpu_base::execute(uintptr entry_point) -{ - PC = entry_point; - - ppc_running = true; - while (ppc_running) { - ppc_inst_t inst = ppc_code_fetch(PC); - ppc_execute(inst); - } -} -#endif - -#if EMU_MODEL3PPC -extern "C" BOOL DisassemblePowerPC(UINT32, UINT32, CHAR *, CHAR *, BOOL); -BOOL DisassemblePowerPC(UINT32, UINT32, CHAR *, CHAR *, BOOL) { } - -static volatile bool ppc_running = false; - -struct powerpc_cpu_base -{ - powerpc_cpu_base(); - void execute(uintptr); - void enable_jit() { } - void invalidate_cache() { } - void invalidate_cache_range(uint32 *start, uint32 size) { } - - uint32 emul_get_xer() const { return ppc_get_reg(PPC_REG_XER); } - void emul_set_xer(uint32 value) { ppc_set_reg(PPC_REG_XER, value); } - uint32 emul_get_cr() const { return ppc_get_reg(PPC_REG_CR); } - void emul_set_cr(uint32 value) { ppc_set_reg(PPC_REG_CR, value); } - uint32 get_lr() const { return ppc_get_reg(PPC_REG_LR); } - void set_lr(uint32 value) { ppc_set_reg(PPC_REG_LR, value); } - uint32 get_gpr(int i) const { return ppc_get_r(i); } - void set_gpr(int i, uint32 value) { ppc_set_r(i, value); } -}; - -static uint32 read_32(uint32 a) -{ - return ntohl(*((uint32 *)a)); -} - -static uint32 read_op(uint32 a) -{ - uint32 opcode = read_32(a); - if (opcode == POWERPC_EMUL_OP) { - ppc_running = false; - return POWERPC_NOP; - } - return opcode; -} - -powerpc_cpu_base::powerpc_cpu_base() -{ - ppc_init(NULL); - ppc_set_read_32_handler((void *)&read_32); - ppc_set_read_op_handler((void *)&read_op); -} - -void powerpc_cpu_base::execute(uintptr entry_point) -{ - ppc_set_reg(PPC_REG_PC, entry_point); - - ppc_running = true; - while (ppc_running) - ppc_run(1); -} -#endif - -#if EMU_QEMU -class powerpc_cpu_base -{ - CPUPPCState *ppc; -public: - powerpc_cpu_base(); - ~powerpc_cpu_base(); - void execute(uintptr); - void enable_jit() { } - void invalidate_cache() { tb_flush(); } - void invalidate_cache_range(uint32 *start, uint32 size) { invalidate_cache(); } - - uint32 emul_get_xer() const; - void emul_set_xer(uint32 value); - uint32 emul_get_cr() const; - void emul_set_cr(uint32 value); - uint32 get_lr() const { return ppc->LR; } - void set_lr(uint32 value) { ppc->LR = value; } - uint32 get_gpr(int i) const { return ppc->gpr[i]; } - void set_gpr(int i, uint32 value) { ppc->gpr[i] = value; } -}; - -uint32 powerpc_cpu_base::emul_get_xer() const -{ - uint32 xer = 0; - for (int i = 0; i < 32; i++) - xer |= ppc->xer[i] << i; - return xer; -} - -void powerpc_cpu_base::emul_set_xer(uint32 value) -{ - for (int i = 0; i < 32; i++) - ppc->xer[i] = (value >> i) & 1; -} - -uint32 powerpc_cpu_base::emul_get_cr() const -{ - uint32 cr = 0; - for (int i = 0; i < 8; i++) - cr |= (ppc->crf[i] & 15) << (28 - 4 * i); - return cr; -} - -void powerpc_cpu_base::emul_set_cr(uint32 value) -{ - for (int i = 0; i < 8; i++) - ppc->crf[i] = (value >> (28 - 4 * i)) & 15; -} - -powerpc_cpu_base::powerpc_cpu_base() -{ - ppc = cpu_ppc_init(); -} - -powerpc_cpu_base::~powerpc_cpu_base() -{ - cpu_ppc_close(ppc); -} - -void powerpc_cpu_base::execute(uintptr entry_point) -{ - ppc->nip = entry_point; - cpu_exec(ppc); -} -#endif - -// Define bit-fields -#if !EMU_KHEPERIX -template< int FB, int FE > -struct static_mask { - enum { value = (0xffffffff >> FB) ^ (0xffffffff >> (FE + 1)) }; -}; - -template< int FB > -struct static_mask { - enum { value = 0xffffffff >> FB }; -}; - -template< int FB, int FE > -struct bit_field { - static inline uint32 mask() { - return static_mask::value; - } - static inline bool test(uint32 value) { - return value & mask(); - } - static inline uint32 extract(uint32 value) { - const uint32 m = mask() >> (31 - FE); - return (value >> (31 - FE)) & m; - } - static inline void insert(uint32 & data, uint32 value) { - const uint32 m = mask(); - data = (data & ~m) | ((value << (31 - FE)) & m); - } -}; - -// General purpose registers -typedef bit_field< 11, 15 > rA_field; -typedef bit_field< 16, 20 > rB_field; -typedef bit_field< 6, 10 > rD_field; -typedef bit_field< 6, 10 > rS_field; - -// Vector registers -typedef bit_field< 11, 15 > vA_field; -typedef bit_field< 16, 20 > vB_field; -typedef bit_field< 21, 25 > vC_field; -typedef bit_field< 6, 10 > vD_field; -typedef bit_field< 6, 10 > vS_field; -typedef bit_field< 22, 25 > vSH_field; - -// Condition registers -typedef bit_field< 11, 15 > crbA_field; -typedef bit_field< 16, 20 > crbB_field; -typedef bit_field< 6, 10 > crbD_field; -typedef bit_field< 6, 8 > crfD_field; -typedef bit_field< 11, 13 > crfS_field; - -// CR register fields -template< int CRn > struct CR_field : bit_field< 4*CRn+0, 4*CRn+3 > { }; -template< int CRn > struct CR_LT_field : bit_field< 4*CRn+0, 4*CRn+0 > { }; -template< int CRn > struct CR_GT_field : bit_field< 4*CRn+1, 4*CRn+1 > { }; -template< int CRn > struct CR_EQ_field : bit_field< 4*CRn+2, 4*CRn+2 > { }; -template< int CRn > struct CR_SO_field : bit_field< 4*CRn+3, 4*CRn+3 > { }; -template< int CRn > struct CR_UN_field : bit_field< 4*CRn+3, 4*CRn+3 > { }; - -// Immediates -typedef bit_field< 16, 31 > UIMM_field; -typedef bit_field< 21, 25 > MB_field; -typedef bit_field< 26, 30 > ME_field; -typedef bit_field< 16, 20 > SH_field; - -// XER register fields -typedef bit_field< 0, 0 > XER_SO_field; -typedef bit_field< 1, 1 > XER_OV_field; -typedef bit_field< 2, 2 > XER_CA_field; -#endif -#undef CA -#define CA XER_CA_field::mask() -#undef OV -#define OV XER_OV_field::mask() -#undef SO -#define SO XER_SO_field::mask() - -// Flag: does the host support AltiVec instructions? -static bool has_altivec = true; - -// A 128-bit AltiVec register -typedef uint8 vector_t[16]; - -class aligned_vector_t { - struct { - vector_t v; - uint8 pad[16]; - } vs; -public: - aligned_vector_t() - { clear(); } - void clear() - { memset(addr(), 0, sizeof(vector_t)); } - void copy(vector_t const & vi, int n = sizeof(vector_t)) - { clear(); memcpy(addr(), &vi, n); } - vector_t *addr() const - { return (vector_t *)(((char *)&vs.v) + (16 - (((uintptr)&vs.v) % 16))); } - vector_t const & value() const - { return *addr(); } - vector_t & value() - { return *addr(); } -}; - -union vector_helper_t { - vector_t v; - uint8 b[16]; - uint16 h[8]; - uint32 w[4]; - float f[4]; -}; - -static void print_vector(vector_t const & v, char type = 'b') -{ - vector_helper_t x; - memcpy(&x.b, &v, sizeof(vector_t)); - - printf("{"); - switch (type) { - case 'b': - default: - for (int i = 0; i < 16; i++) { - if (i != 0) - printf(","); - printf(" %02x", x.b[i]); - } - break; - case 'h': - for (int i = 0; i < 8; i++) { - if (i != 0) - printf(","); - printf(" %04x", x.h[i]); - } - break; - case 'w': - for (int i = 0; i < 4; i++) { - if (i != 0) - printf(","); - printf(" %08x", x.w[i]); - } - break; - case 'f': - case 'e': // estimate result - case 'l': // estimate log2 result - for (int i = 0; i < 4; i++) { - x.w[i] = ntohl(x.w[i]); - if (i != 0) - printf(","); - printf(" %g", x.f[i]); - } - break; - } - printf(" }"); -} - -static inline bool do_float_equals(float a, float b, float tolerance) -{ - if (a == b) - return true; - - if (isnan(a) && isnan(b)) - return true; - - if (isinf(a) && isinf(b) && signbit(a) == signbit(b)) - return true; - - if ((b < (a + tolerance)) && (b > (a - tolerance))) - return true; - - return false; -} - -static inline bool float_equals(float a, float b) -{ - return do_float_equals(a, b, 3 * std::numeric_limits::epsilon()); -} - -static bool vector_equals(char type, vector_t const & a, vector_t const & b) -{ - // the vector is in ppc big endian format - float tolerance; - switch (type) { - case 'f': - tolerance = 3 * std::numeric_limits::epsilon(); - goto do_compare; - case 'l': // FIXME: this does not handle |x-1|<=1/8 case - tolerance = 1. / 32.; - goto do_compare; - case 'e': - tolerance = 1. / 4096.; - do_compare: - for (int i = 0; i < 4; i++) { - union { float f; uint32 i; } u, v; - u.i = ntohl(((uint32 *)&a)[i]); - v.i = ntohl(((uint32 *)&b)[i]); - if (!do_float_equals(u.f, v.f, tolerance)) - return false; - } - return true; - } - - return memcmp(&a, &b, sizeof(vector_t)) == 0; -} - -static bool vector_all_eq(char type, vector_t const & b) -{ - uint32 v; - vector_helper_t x; - memcpy(&x.v, &b, sizeof(vector_t)); - - bool all_eq = true; - switch (type) { - case 'b': - default: - v = x.b[0]; - for (int i = 1; all_eq && i < 16; i++) - if (x.b[i] != v) - all_eq = false; - break; - case 'h': - v = x.h[0]; - for (int i = 1; all_eq && i < 8; i++) - if (x.h[i] != v) - all_eq = false; - break; - case 'w': - case 'f': - v = x.w[0]; - for (int i = 1; all_eq && i < 4; i++) - if (x.w[i] != v) - all_eq = false; - break; - } - return all_eq; -} - -// Define PowerPC tester -class powerpc_test_cpu - : public powerpc_cpu_base -{ -#ifdef NATIVE_POWERPC - uint32 native_get_xer() const - { uint32 xer; asm volatile ("mfxer %0" : "=r" (xer)); return xer; } - - void native_set_xer(uint32 xer) const - { asm volatile ("mtxer %0" : : "r" (xer)); } - - uint32 native_get_cr() const - { uint32 cr; asm volatile ("mfcr %0" : "=r" (cr)); return cr; } - - void native_set_cr(uint32 cr) const - { asm volatile ("mtcr %0" : : "r" (cr)); } -#endif - - void flush_icache_range(uint32 *start, uint32 size) - { invalidate_cache_range(start, size); ppc_flush_icache_range(start, size); } - - void print_xer_flags(uint32 xer) const; - void print_flags(uint32 cr, uint32 xer, int crf = 0) const; - void execute(uint32 *code); - -public: - - powerpc_test_cpu(); - ~powerpc_test_cpu(); - - bool test(void); - - void set_results_file(FILE *fp) - { results_file = fp; } - -private: - - static const bool verbose = false; - uint32 tests, errors; - - // Results file for reference - FILE *results_file; - uint32 get32(); - void put32(uint32 v); - void get_vector(vector_t & v); - void put_vector(vector_t const & v); - - // Initial CR0, XER states - uint32 init_cr; - uint32 init_xer; - - // XER preset values to test with - std::vector xer_values; - void gen_xer_values(uint32 use_mask, uint32 set_mask); - - // Emulated registers IDs - enum { - RD = 3, - RA = 4, - RB = 5, - RC = 6, - VSCR = 7, - }; - - // Operands - enum { - __, - vD, vS, vA, vB, vC, vI, vN, - rD, rS, rA, rB, rC, - }; - - struct vector_test_t { - uint8 name[14]; - char type; - char op_type; - uint32 opcode; - uint8 operands[4]; - }; - - struct vector_value_t { - char type; - vector_t v; - }; - - static const uint32 reg_values[]; - static const uint32 imm_values[]; - static const uint32 msk_values[]; - static const vector_value_t vector_values[]; - static const vector_value_t vector_fp_values[]; - - void test_one_1(uint32 *code, const char *insn, uint32 a1, uint32 a2, uint32 a3, uint32 a0 = 0); - void test_one(uint32 *code, const char *insn, uint32 a1, uint32 a2, uint32 a3, uint32 a0 = 0); - void test_instruction_CNTLZ(const char *insn, uint32 opcode); - void test_instruction_RR___(const char *insn, uint32 opcode); - void test_instruction_RRI__(const char *insn, uint32 opcode); -#define test_instruction_RRK__ test_instruction_RRI__ - void test_instruction_RRS__(const char *insn, uint32 opcode); - void test_instruction_RRR__(const char *insn, uint32 opcode); - void test_instruction_RRRSH(const char *insn, uint32 opcode); - void test_instruction_RRIII(const char *insn, uint32 opcode); - void test_instruction_RRRII(const char *insn, uint32 opcode); - void test_instruction_CRR__(const char *insn, uint32 opcode); - void test_instruction_CRI__(const char *insn, uint32 opcode); -#define test_instruction_CRK__ test_instruction_CRI__ - void test_instruction_CCC__(const char *insn, uint32 opcode); - - void test_add(void); - void test_sub(void); - void test_mul(void); - void test_div(void); - void test_shift(void); - void test_rotate(void); - void test_logical(void); - void test_compare(void); - void test_cr_logical(void); - - void test_one_vector(uint32 *code, vector_test_t const & vt, uint8 *rA, uint8 *rB = 0, uint8 *rC = 0); - void test_one_vector(uint32 *code, vector_test_t const & vt, vector_t const *vA = 0, vector_t const *vB = 0, vector_t const *vC = 0) - { test_one_vector(code, vt, (uint8 *)vA, (uint8 *)vB, (uint8 *)vC); } - void test_vector_load(void); - void test_vector_load_for_shift(void); - void test_vector_arith(void); -}; - -powerpc_test_cpu::powerpc_test_cpu() - : powerpc_cpu_base(), results_file(NULL) -{ -#if ENABLE_MON - mon_init(); -#endif -} - -powerpc_test_cpu::~powerpc_test_cpu() -{ -#if ENABLE_MON - mon_exit(); -#endif -} - -uint32 powerpc_test_cpu::get32() -{ - uint32 v; - if (fread(&v, sizeof(v), 1, results_file) != 1) { - fprintf(stderr, "ERROR: unexpected end of results file\n"); - exit(EXIT_FAILURE); - } - return ntohl(v); -} - -void powerpc_test_cpu::put32(uint32 v) -{ - uint32 out = htonl(v); - if (fwrite(&out, sizeof(out), 1, results_file) != 1) { - fprintf(stderr, "could not write item to results file\n"); - exit(EXIT_FAILURE); - } -} - -void powerpc_test_cpu::get_vector(vector_t & v) -{ - if (fread(&v, sizeof(v), 1, results_file) != 1) { - fprintf(stderr, "ERROR: unexpected end of results file\n"); - exit(EXIT_FAILURE); - } -} - -void powerpc_test_cpu::put_vector(vector_t const & v) -{ - if (fwrite(&v, sizeof(v), 1, results_file) != 1) { - fprintf(stderr, "could not write vector to results file\n"); - exit(EXIT_FAILURE); - } -} - -void powerpc_test_cpu::execute(uint32 *code_p) -{ - static uint32 code[2]; - code[0] = htonl(POWERPC_BLRL); - code[1] = htonl(POWERPC_EMUL_OP); - -#ifndef NATIVE_POWERPC - const int n_func_words = 1024; - static uint32 func[n_func_words]; - static int old_i; - again: - int i = old_i; - for (int j = 0; ; j++, i++) { - if (i >= n_func_words) { - old_i = 0; - invalidate_cache(); - goto again; - } - uint32 opcode = code_p[j]; - func[i] = htonl(opcode); - if (opcode == POWERPC_BLR) - break; - } - code_p = &func[old_i]; - old_i = i; -#endif - - assert((uintptr)code_p <= UINT_MAX); - set_lr((uintptr)code_p); - - assert((uintptr)code <= UINT_MAX); - powerpc_cpu_base::execute((uintptr)code); -} - -void powerpc_test_cpu::gen_xer_values(uint32 use_mask, uint32 set_mask) -{ - const uint32 mask = use_mask | set_mask; - - // Always test with XER=0 - xer_values.clear(); - xer_values.push_back(0); - - // Iterate over XER fields, only handle CA, OV, SO - for (uint32 m = 0x80000000; m != 0; m >>= 1) { - if (m & (CA | OV | SO) & mask) { - const int n_xer_values = xer_values.size(); - for (int i = 0; i < n_xer_values; i++) - xer_values.push_back(xer_values[i] | m); - } - } - -#if 0 - printf("%d XER values\n", xer_values.size()); - for (int i = 0; i < xer_values.size(); i++) { - print_xer_flags(xer_values[i]); - printf("\n"); - } -#endif -} - -void powerpc_test_cpu::print_xer_flags(uint32 xer) const -{ - printf("%s,%s,%s", - (xer & XER_CA_field::mask() ? "CA" : "__"), - (xer & XER_OV_field::mask() ? "OV" : "__"), - (xer & XER_SO_field::mask() ? "SO" : "__")); -} - -void powerpc_test_cpu::print_flags(uint32 cr, uint32 xer, int crf) const -{ - cr = cr << (4 * crf); - printf("%s,%s,%s,%s,%s,%s", - (cr & CR_LT_field<0>::mask() ? "LT" : "__"), - (cr & CR_GT_field<0>::mask() ? "GT" : "__"), - (cr & CR_EQ_field<0>::mask() ? "EQ" : "__"), - (cr & CR_SO_field<0>::mask() ? "SO" : "__"), - (xer & XER_OV_field::mask() ? "OV" : "__"), - (xer & XER_CA_field::mask() ? "CA" : "__")); -} - -#define TEST_INSTRUCTION(FORMAT, NATIVE_OP, EMUL_OP) do { \ - printf("Testing " NATIVE_OP "\n"); \ - test_instruction_##FORMAT(NATIVE_OP, EMUL_OP); \ -} while (0) - -void powerpc_test_cpu::test_one(uint32 *code, const char *insn, uint32 a1, uint32 a2, uint32 a3, uint32 a0) -{ - // Iterate over test XER values as input - const int n_xer_values = xer_values.size(); - for (int i = 0; i < n_xer_values; i++) { - init_xer = xer_values[i]; - test_one_1(code, insn, a1, a2, a3, a0); - } - init_xer = 0; -} - -void powerpc_test_cpu::test_one_1(uint32 *code, const char *insn, uint32 a1, uint32 a2, uint32 a3, uint32 a0) -{ -#ifdef NATIVE_POWERPC - // Invoke native code - const uint32 save_xer = native_get_xer(); - const uint32 save_cr = native_get_cr(); - native_set_xer(init_xer); - native_set_cr(init_cr); - typedef uint32 (*func_t)(uint32, uint32, uint32); - func_t func = (func_t)code; - const uint32 native_rd = func(a0, a1, a2); - const uint32 native_xer = native_get_xer(); - const uint32 native_cr = native_get_cr(); - native_set_xer(save_xer); - native_set_cr(save_cr); - if (results_file) { - put32(native_rd); - put32(native_xer); - put32(native_cr); - } -#else - const uint32 native_rd = get32(); - const uint32 native_xer = get32(); - const uint32 native_cr = get32(); -#endif - - if (SKIP_ALU_OPS) - return; - - // Invoke emulated code - emul_set_xer(init_xer); - emul_set_cr(init_cr); - set_gpr(RD, a0); - set_gpr(RA, a1); - set_gpr(RB, a2); - execute(code); - const uint32 emul_rd = get_gpr(RD); - const uint32 emul_xer = emul_get_xer(); - const uint32 emul_cr = emul_get_cr(); - - ++tests; - - bool ok = native_rd == emul_rd - && native_xer == emul_xer - && native_cr == emul_cr; - - if (code[0] == POWERPC_MR(0, RA)) - code++; - - if (!ok) { - printf("FAIL: %s [%08x]\n", insn, code[0]); - errors++; - } - else if (verbose) { - printf("PASS: %s [%08x]\n", insn, code[0]); - } - - if (!ok || verbose) { -#if ENABLE_MON - disass_ppc(stdout, (uintptr)code, code[0]); -#endif -#define PRINT_OPERANDS(PREFIX) do { \ - printf(" %08x, %08x, %08x, %08x => %08x [", \ - a0, a1, a2, a3, PREFIX##_rd); \ - print_flags(PREFIX##_cr, PREFIX##_xer); \ - printf("]\n"); \ - } while (0) - PRINT_OPERANDS(native); - PRINT_OPERANDS(emul); -#undef PRINT_OPERANDS - } -} - -const uint32 powerpc_test_cpu::reg_values[] = { - 0x00000000, 0x10000000, 0x20000000, - 0x30000000, 0x40000000, 0x50000000, - 0x60000000, 0x70000000, 0x80000000, - 0x90000000, 0xa0000000, 0xb0000000, - 0xc0000000, 0xd0000000, 0xe0000000, - 0xf0000000, 0xfffffffd, 0xfffffffe, - 0xffffffff, 0x00000001, 0x00000002, - 0x00000003, 0x11111111, 0x22222222, - 0x33333333, 0x44444444, 0x55555555, - 0x66666666, 0x77777777, 0x88888888, - 0x99999999, 0xaaaaaaaa, 0xbbbbbbbb, - 0xcccccccc, 0xdddddddd, 0xeeeeeeee -}; - -const uint32 powerpc_test_cpu::imm_values[] = { - 0x0000, 0x1000, 0x2000, - 0x3000, 0x4000, 0x5000, - 0x6000, 0x7000, 0x8000, - 0x9000, 0xa000, 0xb000, - 0xc000, 0xd000, 0xe000, - 0xf000, 0xfffd, 0xfffe, - 0xffff, 0x0001, 0x0002, - 0x0003, 0x1111, 0x2222, - 0x3333, 0x4444, 0x5555, - 0x6666, 0x7777, 0x8888, - 0x9999, 0xaaaa, 0xbbbb, - 0xcccc, 0xdddd, 0xeeee -}; - -const uint32 powerpc_test_cpu::msk_values[] = { - 0, 1, -// 15, 16, 17, - 30, 31 -}; - -void powerpc_test_cpu::test_instruction_CNTLZ(const char *insn, uint32 opcode) -{ - // Test code - static uint32 code[] = { - POWERPC_ILLEGAL, POWERPC_BLR, - POWERPC_MR(0, RA), POWERPC_ILLEGAL, POWERPC_BLR - }; - - // Input values - const int n_values = sizeof(reg_values)/sizeof(reg_values[0]); - - code[0] = code[3] = opcode; // RD,RA,RB - rA_field::insert(code[3], 0); // RD,R0,RB - flush_icache_range(code, sizeof(code)); - - for (uint32 mask = 0x80000000; mask != 0; mask >>= 1) { - uint32 ra = mask; - test_one(&code[0], insn, ra, 0, 0); - test_one(&code[2], insn, ra, 0, 0); - } - // random values (including zero) - for (int i = 0; i < n_values; i++) { - uint32 ra = reg_values[i]; - test_one(&code[0], insn, ra, 0, 0); - test_one(&code[2], insn, ra, 0, 0); - } -} - -void powerpc_test_cpu::test_instruction_RR___(const char *insn, uint32 opcode) -{ - // Test code - static uint32 code[] = { - POWERPC_ILLEGAL, POWERPC_BLR, - POWERPC_MR(0, RA), POWERPC_ILLEGAL, POWERPC_BLR - }; - - // Input values - const int n_values = sizeof(reg_values)/sizeof(reg_values[0]); - - code[0] = code[3] = opcode; // RD,RA,RB - rA_field::insert(code[3], 0); // RD,R0,RB - flush_icache_range(code, sizeof(code)); - - for (int i = 0; i < n_values; i++) { - uint32 ra = reg_values[i]; - test_one(&code[0], insn, ra, 0, 0); - test_one(&code[2], insn, ra, 0, 0); - } -} - -void powerpc_test_cpu::test_instruction_RRI__(const char *insn, uint32 opcode) -{ - // Test code - static uint32 code[] = { - POWERPC_ILLEGAL, POWERPC_BLR, - POWERPC_MR(0, RA), POWERPC_ILLEGAL, POWERPC_BLR - }; - - // Input values - const int n_reg_values = sizeof(reg_values)/sizeof(reg_values[0]); - const int n_imm_values = sizeof(imm_values)/sizeof(imm_values[0]); - - for (int j = 0; j < n_imm_values; j++) { - const uint32 im = imm_values[j]; - uint32 op = opcode; - UIMM_field::insert(op, im); - code[0] = code[3] = op; // RD,RA,IM - rA_field::insert(code[3], 0); // RD,R0,IM - flush_icache_range(code, sizeof(code)); - for (int i = 0; i < n_reg_values; i++) { - const uint32 ra = reg_values[i]; - test_one(&code[0], insn, ra, im, 0); - test_one(&code[2], insn, ra, im, 0); - } - } -} - -void powerpc_test_cpu::test_instruction_RRS__(const char *insn, uint32 opcode) -{ - // Test code - static uint32 code[] = { - POWERPC_ILLEGAL, POWERPC_BLR, - POWERPC_MR(0, RA), POWERPC_ILLEGAL, POWERPC_BLR - }; - - // Input values - const int n_values = sizeof(reg_values)/sizeof(reg_values[0]); - - for (int j = 0; j < 32; j++) { - const uint32 sh = j; - SH_field::insert(opcode, sh); - code[0] = code[3] = opcode; - rA_field::insert(code[3], 0); - flush_icache_range(code, sizeof(code)); - for (int i = 0; i < n_values; i++) { - const uint32 ra = reg_values[i]; - test_one(&code[0], insn, ra, sh, 0); - } - } -} - -void powerpc_test_cpu::test_instruction_RRR__(const char *insn, uint32 opcode) -{ - // Test code - static uint32 code[] = { - POWERPC_ILLEGAL, POWERPC_BLR, - POWERPC_MR(0, RA), POWERPC_ILLEGAL, POWERPC_BLR - }; - - // Input values - const int n_values = sizeof(reg_values)/sizeof(reg_values[0]); - - code[0] = code[3] = opcode; // RD,RA,RB - rA_field::insert(code[3], 0); // RD,R0,RB - flush_icache_range(code, sizeof(code)); - - for (int i = 0; i < n_values; i++) { - const uint32 ra = reg_values[i]; - for (int j = 0; j < n_values; j++) { - const uint32 rb = reg_values[j]; - test_one(&code[0], insn, ra, rb, 0); - test_one(&code[2], insn, ra, rb, 0); - } - } -} - -void powerpc_test_cpu::test_instruction_RRRSH(const char *insn, uint32 opcode) -{ - // Test code - static uint32 code[] = { - POWERPC_ILLEGAL, POWERPC_BLR, - POWERPC_MR(0, RA), POWERPC_ILLEGAL, POWERPC_BLR - }; - - // Input values - const int n_values = sizeof(reg_values)/sizeof(reg_values[0]); - - code[0] = code[3] = opcode; // RD,RA,RB - rA_field::insert(code[3], 0); // RD,R0,RB - flush_icache_range(code, sizeof(code)); - - for (int i = 0; i < n_values; i++) { - const uint32 ra = reg_values[i]; - for (int j = 0; j <= 64; j++) { - const uint32 rb = j; - test_one(&code[0], insn, ra, rb, 0); - test_one(&code[2], insn, ra, rb, 0); - } - } -} - -void powerpc_test_cpu::test_instruction_RRIII(const char *insn, uint32 opcode) -{ - // Test code - static uint32 code[] = { - POWERPC_ILLEGAL, POWERPC_BLR, - POWERPC_MR(0, RA), POWERPC_ILLEGAL, POWERPC_BLR - }; - - // Input values - const int n_reg_values = sizeof(reg_values)/sizeof(reg_values[0]); - const int n_msk_values = sizeof(msk_values)/sizeof(msk_values[0]); - - for (int sh = 0; sh < 32; sh++) { - for (int i_mb = 0; i_mb < n_msk_values; i_mb++) { - const uint32 mb = msk_values[i_mb]; - for (int i_me = 0; i_me < n_msk_values; i_me++) { - const uint32 me = msk_values[i_me]; - SH_field::insert(opcode, sh); - MB_field::insert(opcode, mb); - ME_field::insert(opcode, me); - code[0] = opcode; - code[3] = opcode; - rA_field::insert(code[3], 0); - flush_icache_range(code, sizeof(code)); - for (int i = 0; i < n_reg_values; i++) { - const uint32 ra = reg_values[i]; - test_one(&code[0], insn, ra, sh, 0, 0); - test_one(&code[2], insn, ra, sh, 0, 0); - } - } - } - } -} - -void powerpc_test_cpu::test_instruction_RRRII(const char *insn, uint32 opcode) -{ - // Test code - static uint32 code[] = { - POWERPC_ILLEGAL, POWERPC_BLR, - POWERPC_MR(0, RA), POWERPC_ILLEGAL, POWERPC_BLR - }; - - // Input values - const int n_reg_values = sizeof(reg_values)/sizeof(reg_values[0]); - const int n_msk_values = sizeof(msk_values)/sizeof(msk_values[0]); - - for (int i_mb = 0; i_mb < n_msk_values; i_mb++) { - const uint32 mb = msk_values[i_mb]; - for (int i_me = 0; i_me < n_msk_values; i_me++) { - const uint32 me = msk_values[i_me]; - MB_field::insert(opcode, mb); - ME_field::insert(opcode, me); - code[0] = opcode; - code[3] = opcode; - rA_field::insert(code[3], 0); - flush_icache_range(code, sizeof(code)); - for (int i = 0; i < n_reg_values; i++) { - const uint32 ra = reg_values[i]; - for (int j = -1; j <= 33; j++) { - const uint32 rb = j; - test_one(&code[0], insn, ra, rb, 0, 0); - test_one(&code[2], insn, ra, rb, 0, 0); - } - } - } - } -} - -void powerpc_test_cpu::test_instruction_CRR__(const char *insn, uint32 opcode) -{ - // Test code - static uint32 code[] = { - POWERPC_ILLEGAL, POWERPC_BLR, - POWERPC_MR(0, RA), POWERPC_ILLEGAL, POWERPC_BLR - }; - - // Input values - const int n_values = sizeof(reg_values)/sizeof(reg_values[0]); - - for (int k = 0; k < 8; k++) { - crfD_field::insert(opcode, k); - code[0] = code[3] = opcode; // crfD,RA,RB - rA_field::insert(code[3], 0); // crfD,R0,RB - flush_icache_range(code, sizeof(code)); - for (int i = 0; i < n_values; i++) { - const uint32 ra = reg_values[i]; - for (int j = 0; j < n_values; j++) { - const uint32 rb = reg_values[j]; - test_one(&code[0], insn, ra, rb, 0); - test_one(&code[2], insn, ra, rb, 0); - } - } - } -} - -void powerpc_test_cpu::test_instruction_CRI__(const char *insn, uint32 opcode) -{ - // Test code - static uint32 code[] = { - POWERPC_ILLEGAL, POWERPC_BLR, - POWERPC_MR(0, RA), POWERPC_ILLEGAL, POWERPC_BLR - }; - - // Input values - const int n_reg_values = sizeof(reg_values)/sizeof(reg_values[0]); - const int n_imm_values = sizeof(imm_values)/sizeof(imm_values[0]); - - for (int k = 0; k < 8; k++) { - crfD_field::insert(opcode, k); - for (int j = 0; j < n_imm_values; j++) { - const uint32 im = imm_values[j]; - UIMM_field::insert(opcode, im); - code[0] = code[3] = opcode; // crfD,RA,SIMM - rA_field::insert(code[3], 0); // crfD,R0,SIMM - flush_icache_range(code, sizeof(code)); - for (int i = 0; i < n_reg_values; i++) { - const uint32 ra = reg_values[i]; - test_one(&code[0], insn, ra, im, 0); - test_one(&code[2], insn, ra, im, 0); - } - } - } -} - -void powerpc_test_cpu::test_instruction_CCC__(const char *insn, uint32 opcode) -{ - // Test code - static uint32 code[] = { - POWERPC_ILLEGAL, POWERPC_MFCR(RD), POWERPC_BLR, - }; - - const uint32 saved_cr = init_cr; - crbD_field::insert(opcode, 0); - - // Loop over crbA=[4-7] (crf1), crbB=[28-31] (crf7) - for (int crbA = 4; crbA <= 7; crbA++) { - crbA_field::insert(opcode, crbA); - for (int crbB = 28; crbB <= 31; crbB++) { - crbB_field::insert(opcode, crbB); - code[0] = opcode; - flush_icache_range(code, sizeof(code)); - // Generate CR values for (crf1, crf7) - uint32 cr = 0; - for (int i = 0; i < 16; i++) { - CR_field<1>::insert(cr, i); - for (int j = 0; j < 16; j++) { - CR_field<7>::insert(cr, j); - init_cr = cr; - test_one(&code[0], insn, init_cr, 0, 0); - } - } - } - } - init_cr = saved_cr; -} - -void powerpc_test_cpu::test_add(void) -{ -#if TEST_ADD - gen_xer_values(0, 0); - TEST_INSTRUCTION(RRI__,"addi", _D (14,RD,RA,00)); - TEST_INSTRUCTION(RRI__,"addis", _D (15,RD,RA,00)); - gen_xer_values(0, SO); - TEST_INSTRUCTION(RRR__,"add", _XO(31,RD,RA,RB,0,266,0)); - TEST_INSTRUCTION(RRR__,"add.", _XO(31,RD,RA,RB,0,266,1)); - gen_xer_values(0, SO|OV); - TEST_INSTRUCTION(RRR__,"addo", _XO(31,RD,RA,RB,1,266,0)); - TEST_INSTRUCTION(RRR__,"addo." , _XO(31,RD,RA,RB,1,266,1)); - gen_xer_values(0, SO|CA); - TEST_INSTRUCTION(RRR__,"addc", _XO(31,RD,RA,RB,0, 10,0)); - TEST_INSTRUCTION(RRR__,"addc.", _XO(31,RD,RA,RB,0, 10,1)); - TEST_INSTRUCTION(RRI__,"addic", _D (12,RD,RA,00)); - TEST_INSTRUCTION(RRI__,"addic.", _D (13,RD,RA,00)); - gen_xer_values(0, SO|CA|OV); - TEST_INSTRUCTION(RRR__,"addco", _XO(31,RD,RA,RB,1, 10,0)); - TEST_INSTRUCTION(RRR__,"addco.", _XO(31,RD,RA,RB,1, 10,1)); - gen_xer_values(CA, SO|CA); - TEST_INSTRUCTION(RRR__,"adde", _XO(31,RD,RA,RB,0,138,0)); - TEST_INSTRUCTION(RRR__,"adde.", _XO(31,RD,RA,RB,0,138,1)); - TEST_INSTRUCTION(RR___,"addme", _XO(31,RD,RA,00,0,234,0)); - TEST_INSTRUCTION(RR___,"addme.", _XO(31,RD,RA,00,0,234,1)); - TEST_INSTRUCTION(RR___,"addze", _XO(31,RD,RA,00,0,202,0)); - TEST_INSTRUCTION(RR___,"addze.", _XO(31,RD,RA,00,0,202,1)); - gen_xer_values(CA, SO|CA|OV); - TEST_INSTRUCTION(RRR__,"addeo", _XO(31,RD,RA,RB,1,138,0)); - TEST_INSTRUCTION(RRR__,"addeo.", _XO(31,RD,RA,RB,1,138,1)); - TEST_INSTRUCTION(RR___,"addmeo", _XO(31,RD,RA,00,1,234,0)); - TEST_INSTRUCTION(RR___,"addmeo.", _XO(31,RD,RA,00,1,234,1)); - TEST_INSTRUCTION(RR___,"addzeo", _XO(31,RD,RA,00,1,202,0)); - TEST_INSTRUCTION(RR___,"addzeo.", _XO(31,RD,RA,00,1,202,1)); -#endif -} - -void powerpc_test_cpu::test_sub(void) -{ -#if TEST_SUB - gen_xer_values(0, SO); - TEST_INSTRUCTION(RRR__,"subf", _XO(31,RD,RA,RB,0, 40,0)); - TEST_INSTRUCTION(RRR__,"subf.", _XO(31,RD,RA,RB,0, 40,1)); - gen_xer_values(0, SO|OV); - TEST_INSTRUCTION(RRR__,"subfo", _XO(31,RD,RA,RB,1, 40,0)); - TEST_INSTRUCTION(RRR__,"subfo.", _XO(31,RD,RA,RB,1, 40,1)); - gen_xer_values(0, SO|CA); - TEST_INSTRUCTION(RRR__,"subfc", _XO(31,RD,RA,RB,0, 8,0)); - TEST_INSTRUCTION(RRR__,"subfc.", _XO(31,RD,RA,RB,0, 8,1)); - gen_xer_values(0, SO|CA|OV); - TEST_INSTRUCTION(RRR__,"subfco", _XO(31,RD,RA,RB,1, 8,0)); - TEST_INSTRUCTION(RRR__,"subfco.", _XO(31,RD,RA,RB,1, 8,1)); - gen_xer_values(0, CA); - TEST_INSTRUCTION(RRI__,"subfic", _D ( 8,RD,RA,00)); - gen_xer_values(CA, SO|CA); - TEST_INSTRUCTION(RRR__,"subfe", _XO(31,RD,RA,RB,0,136,0)); - TEST_INSTRUCTION(RRR__,"subfe.", _XO(31,RD,RA,RB,0,136,1)); - TEST_INSTRUCTION(RR___,"subfme", _XO(31,RD,RA,00,0,232,0)); - TEST_INSTRUCTION(RR___,"subfme.", _XO(31,RD,RA,00,0,232,1)); - TEST_INSTRUCTION(RR___,"subfze", _XO(31,RD,RA,00,0,200,0)); - TEST_INSTRUCTION(RR___,"subfze.", _XO(31,RD,RA,00,0,200,1)); - gen_xer_values(CA, SO|CA|OV); - TEST_INSTRUCTION(RRR__,"subfeo", _XO(31,RD,RA,RB,1,136,0)); - TEST_INSTRUCTION(RRR__,"subfeo.", _XO(31,RD,RA,RB,1,136,1)); - TEST_INSTRUCTION(RR___,"subfmeo", _XO(31,RD,RA,00,1,232,0)); - TEST_INSTRUCTION(RR___,"subfmeo.", _XO(31,RD,RA,00,1,232,1)); - TEST_INSTRUCTION(RR___,"subfzeo", _XO(31,RD,RA,00,1,200,0)); - TEST_INSTRUCTION(RR___,"subfzeo.", _XO(31,RD,RA,00,1,200,1)); -#endif -} - -void powerpc_test_cpu::test_mul(void) -{ -#if TEST_MUL - gen_xer_values(0, SO); - TEST_INSTRUCTION(RRR__,"mulhw", _XO(31,RD,RA,RB,0, 75,0)); - TEST_INSTRUCTION(RRR__,"mulhw.", _XO(31,RD,RA,RB,0, 75,1)); - TEST_INSTRUCTION(RRR__,"mulhwu", _XO(31,RD,RA,RB,0, 11,0)); - TEST_INSTRUCTION(RRR__,"mulhwu.", _XO(31,RD,RA,RB,0, 11,1)); - TEST_INSTRUCTION(RRI__,"mulli", _D ( 7,RD,RA,00)); - TEST_INSTRUCTION(RRR__,"mullw", _XO(31,RD,RA,RB,0,235,0)); - TEST_INSTRUCTION(RRR__,"mullw.", _XO(31,RD,RA,RB,0,235,1)); - gen_xer_values(0, SO|OV); - TEST_INSTRUCTION(RRR__,"mullwo", _XO(31,RD,RA,RB,1,235,0)); - TEST_INSTRUCTION(RRR__,"mullwo.", _XO(31,RD,RA,RB,1,235,1)); -#endif -} - -void powerpc_test_cpu::test_div(void) -{ -#if TEST_DIV - gen_xer_values(0, SO); - TEST_INSTRUCTION(RRR__,"divw", _XO(31,RD,RA,RB,0,491,0)); - TEST_INSTRUCTION(RRR__,"divw.", _XO(31,RD,RA,RB,0,491,1)); - TEST_INSTRUCTION(RRR__,"divwu", _XO(31,RD,RA,RB,0,459,0)); - TEST_INSTRUCTION(RRR__,"divwu.", _XO(31,RD,RA,RB,0,459,1)); - gen_xer_values(0, SO|OV); - TEST_INSTRUCTION(RRR__,"divwo", _XO(31,RD,RA,RB,1,491,0)); - TEST_INSTRUCTION(RRR__,"divwo.", _XO(31,RD,RA,RB,1,491,1)); - TEST_INSTRUCTION(RRR__,"divwuo", _XO(31,RD,RA,RB,1,459,0)); - TEST_INSTRUCTION(RRR__,"divwuo.", _XO(31,RD,RA,RB,1,459,1)); -#endif -} - -void powerpc_test_cpu::test_logical(void) -{ -#if TEST_LOGICAL - gen_xer_values(0, SO); - TEST_INSTRUCTION(RRR__,"and", _X (31,RA,RD,RB,28,0)); - TEST_INSTRUCTION(RRR__,"and.", _X (31,RA,RD,RB,28,1)); - TEST_INSTRUCTION(RRR__,"andc", _X (31,RA,RD,RB,60,0)); - TEST_INSTRUCTION(RRR__,"andc.", _X (31,RA,RD,RB,60,1)); - TEST_INSTRUCTION(RRK__,"andi.", _D (28,RA,RD,00)); - TEST_INSTRUCTION(RRK__,"andis.", _D (29,RA,RD,00)); - TEST_INSTRUCTION(CNTLZ,"cntlzw", _X (31,RA,RD,00,26,0)); - TEST_INSTRUCTION(CNTLZ,"cntlzw.", _X (31,RA,RD,00,26,1)); - TEST_INSTRUCTION(RRR__,"eqv", _X (31,RA,RD,RB,284,0)); - TEST_INSTRUCTION(RRR__,"eqv.", _X (31,RA,RD,RB,284,1)); - TEST_INSTRUCTION(RR___,"extsb", _X (31,RA,RD,00,954,0)); - TEST_INSTRUCTION(RR___,"extsb.", _X (31,RA,RD,00,954,1)); - TEST_INSTRUCTION(RR___,"extsh", _X (31,RA,RD,00,922,0)); - TEST_INSTRUCTION(RR___,"extsh.", _X (31,RA,RD,00,922,1)); - TEST_INSTRUCTION(RRR__,"nand", _X (31,RA,RD,RB,476,0)); - TEST_INSTRUCTION(RRR__,"nand.", _X (31,RA,RD,RB,476,1)); - TEST_INSTRUCTION(RR___,"neg", _XO(31,RD,RA,RB,0,104,0)); - TEST_INSTRUCTION(RR___,"neg.", _XO(31,RD,RA,RB,0,104,1)); - TEST_INSTRUCTION(RRR__,"nor", _X (31,RA,RD,RB,124,0)); - TEST_INSTRUCTION(RRR__,"nor.", _X (31,RA,RD,RB,124,1)); - TEST_INSTRUCTION(RRR__,"or", _X (31,RA,RD,RB,444,0)); - TEST_INSTRUCTION(RRR__,"or.", _X (31,RA,RD,RB,444,1)); - TEST_INSTRUCTION(RRR__,"orc", _X (31,RA,RD,RB,412,0)); - TEST_INSTRUCTION(RRR__,"orc.", _X (31,RA,RD,RB,412,1)); - TEST_INSTRUCTION(RRK__,"ori", _D (24,RA,RD,00)); - TEST_INSTRUCTION(RRK__,"oris", _D (25,RA,RD,00)); - TEST_INSTRUCTION(RRR__,"xor", _X (31,RA,RD,RB,316,0)); - TEST_INSTRUCTION(RRR__,"xor.", _X (31,RA,RD,RB,316,1)); - TEST_INSTRUCTION(RRK__,"xori", _D (26,RA,RD,00)); - TEST_INSTRUCTION(RRK__,"xoris", _D (27,RA,RD,00)); - gen_xer_values(0, SO|OV); - TEST_INSTRUCTION(RR___,"nego", _XO(31,RD,RA,RB,1,104,0)); - TEST_INSTRUCTION(RR___,"nego.", _XO(31,RD,RA,RB,1,104,1)); -#endif -} - -void powerpc_test_cpu::test_shift(void) -{ -#if TEST_SHIFT - gen_xer_values(0, SO); - TEST_INSTRUCTION(RRRSH,"slw", _X (31,RA,RD,RB, 24,0)); - TEST_INSTRUCTION(RRRSH,"slw.", _X (31,RA,RD,RB, 24,1)); - TEST_INSTRUCTION(RRRSH,"sraw", _X (31,RA,RD,RB,792,0)); - TEST_INSTRUCTION(RRRSH,"sraw.", _X (31,RA,RD,RB,792,1)); - TEST_INSTRUCTION(RRS__,"srawi", _X (31,RA,RD,00,824,0)); - TEST_INSTRUCTION(RRS__,"srawi.", _X (31,RA,RD,00,824,1)); - TEST_INSTRUCTION(RRRSH,"srw", _X (31,RA,RD,RB,536,0)); - TEST_INSTRUCTION(RRRSH,"srw.", _X (31,RA,RD,RB,536,1)); -#endif -} - -void powerpc_test_cpu::test_rotate(void) -{ -#if TEST_ROTATE - gen_xer_values(0, SO); - TEST_INSTRUCTION(RRIII,"rlwimi", _M (20,RA,RD,00,00,00,0)); - TEST_INSTRUCTION(RRIII,"rlwimi.", _M (20,RA,RD,00,00,00,1)); - TEST_INSTRUCTION(RRIII,"rlwinm", _M (21,RA,RD,00,00,00,0)); - TEST_INSTRUCTION(RRIII,"rlwinm.", _M (21,RA,RD,00,00,00,1)); - TEST_INSTRUCTION(RRRII,"rlwnm", _M (23,RA,RD,RB,00,00,0)); - TEST_INSTRUCTION(RRRII,"rlwnm.", _M (23,RA,RD,RB,00,00,1)); -#endif -} - -void powerpc_test_cpu::test_compare(void) -{ -#if TEST_COMPARE - gen_xer_values(0, SO); - TEST_INSTRUCTION(CRR__,"cmp", _X (31,00,RA,RB,000,0)); - TEST_INSTRUCTION(CRI__,"cmpi", _D (11,00,RA,00)); - TEST_INSTRUCTION(CRR__,"cmpl", _X (31,00,RA,RB, 32,0)); - TEST_INSTRUCTION(CRK__,"cmpli", _D (10,00,RA,00)); -#endif -} - -void powerpc_test_cpu::test_cr_logical(void) -{ -#if TEST_CR_LOGICAL - gen_xer_values(0, SO); - TEST_INSTRUCTION(CCC__,"crand", _X (19,00,00,00,257,0)); - TEST_INSTRUCTION(CCC__,"crandc", _X (19,00,00,00,129,0)); - TEST_INSTRUCTION(CCC__,"creqv", _X (19,00,00,00,289,0)); - TEST_INSTRUCTION(CCC__,"crnand", _X (19,00,00,00,225,0)); - TEST_INSTRUCTION(CCC__,"crnor", _X (19,00,00,00, 33,0)); - TEST_INSTRUCTION(CCC__,"cror", _X (19,00,00,00,449,0)); - TEST_INSTRUCTION(CCC__,"crorc", _X (19,00,00,00,417,0)); - TEST_INSTRUCTION(CCC__,"crxor", _X (19,00,00,00,193,0)); -#endif -} - -// Template-generated vector values -const powerpc_test_cpu::vector_value_t powerpc_test_cpu::vector_values[] = { - {'w',{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {'w',{0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01}}, - {'w',{0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02}}, - {'w',{0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03}}, - {'w',{0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04}}, - {'w',{0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05}}, - {'w',{0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06}}, - {'w',{0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07}}, - {'w',{0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08}}, - {'w',{0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10}}, - {'w',{0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}}, - {'w',{0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20}}, - {'w',{0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28}}, - {'w',{0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30}}, - {'w',{0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38}}, - {'w',{0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40}}, - {'w',{0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48}}, - {'w',{0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50}}, - {'w',{0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58}}, - {'w',{0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60}}, - {'w',{0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68}}, - {'w',{0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70}}, - {'w',{0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78}}, - {'w',{0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00}}, - {'w',{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04}}, - {'w',{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10}}, - {'w',{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}}, - {'w',{0x11,0x11,0x11,0x11,0x22,0x22,0x22,0x22,0x33,0x33,0x33,0x33,0x44,0x44,0x44,0x44}}, - {'w',{0x88,0x88,0x88,0x88,0x77,0x77,0x77,0x77,0x66,0x66,0x66,0x66,0x55,0x55,0x55,0x55}}, - {'w',{0x99,0x99,0x99,0x99,0xaa,0xaa,0xaa,0xaa,0xbb,0xbb,0xbb,0xbb,0xcc,0xcc,0xcc,0xcc}}, - {'w',{0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xee,0xee,0xee,0xee,0xdd,0xdd,0xdd,0xdd}}, - {'w',{0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,0xaa,0xbb,0xcc,0xdd,0xee,0xff}}, - {'h',{0x00,0x00,0x11,0x11,0x22,0x22,0x33,0x33,0x44,0x44,0x55,0x55,0x66,0x66,0x77,0x77}}, - {'h',{0x00,0x01,0x00,0x02,0x00,0x03,0x00,0x04,0x00,0x05,0x00,0x06,0x00,0x07,0x00,0x08}}, - {'h',{0x00,0x16,0x00,0x15,0x00,0x14,0x00,0x13,0x00,0x12,0x00,0x10,0x00,0x10,0x00,0x09}}, - {'b',{0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,0xaa,0xbb,0xcc,0xdd,0xee,0xff}}, - {'b',{0xff,0xee,0xdd,0xcc,0xbb,0xaa,0x99,0x88,0x77,0x66,0x55,0x44,0x33,0x22,0x11,0x00}}, - {'b',{0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f}}, - {'b',{0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f}}, - {'b',{0x2f,0x2e,0x2d,0x2c,0x2b,0x2a,0x29,0x28,0x27,0x26,0x25,0x24,0x23,0x22,0x21,0x20}} -}; - -const powerpc_test_cpu::vector_value_t powerpc_test_cpu::vector_fp_values[] = { - {'f',{0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00}}, // -0, -0, -0, -0 - {'f',{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, // 0, 0, 0, 0 - {'f',{0xbf,0x80,0x00,0x00,0xbf,0x80,0x00,0x00,0xbf,0x80,0x00,0x00,0xbf,0x80,0x00,0x00}}, // -1, -1, -1, -1 - {'f',{0x3f,0x80,0x00,0x00,0x3f,0x80,0x00,0x00,0x3f,0x80,0x00,0x00,0x3f,0x80,0x00,0x00}}, // 1, 1, 1, 1 - {'f',{0xc0,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0xc0,0x00,0x00,0x00}}, // -2, -2, -2, -2 - {'f',{0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00}}, // 2, 2, 2, 2 - {'f',{0xc0,0x00,0x00,0x00,0xbf,0x80,0x00,0x00,0x3f,0x80,0x00,0x00,0x40,0x00,0x00,0x00}}, // -2, -1, 1, 2 - {'f',{0xc0,0x40,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x00,0x00}}, // -3, -0, 0, 3 - {'f',{0x40,0x00,0x00,0x00,0x3f,0x80,0x00,0x00,0xbf,0x80,0x00,0x00,0xc0,0x00,0x00,0x00}} // 2, 1, -1, -2 -}; - -void powerpc_test_cpu::test_one_vector(uint32 *code, vector_test_t const & vt, uint8 *rAp, uint8 *rBp, uint8 *rCp) -{ -#if TEST_VMX_OPS - static vector_t native_vD; - memset(&native_vD, 0, sizeof(native_vD)); - static vector_helper_t native_vSCR; - memset(&native_vSCR, 0, sizeof(native_vSCR)); - static aligned_vector_t dummy_vector; - dummy_vector.clear(); - if (!rAp) rAp = (uint8 *)dummy_vector.addr(); - if (!rBp) rBp = (uint8 *)dummy_vector.addr(); - if (!rCp) rCp = (uint8 *)dummy_vector.addr(); -#ifdef NATIVE_POWERPC - // Invoke native code - const uint32 save_cr = native_get_cr(); - native_set_cr(init_cr); - native_vSCR.w[3] = 0; - typedef void (*func_t)(uint8 *, uint8 *, uint8 *, uint8 *, uint8 *); - func_t func = (func_t)code; - func((uint8 *)&native_vD, rAp, rBp, rCp, native_vSCR.b); - const uint32 native_cr = native_get_cr(); - const uint32 native_vscr = native_vSCR.w[3]; - native_set_cr(save_cr); - if (results_file) { - put_vector(native_vD); - put32(native_cr); - put32(native_vscr); - } -#else - get_vector(native_vD); - const uint32 native_cr = get32(); - const uint32 native_vscr = get32(); -#endif - - if (SKIP_VMX_OPS) - return; - - // Invoke emulated code - static aligned_vector_t emul_vD; - emul_vD.clear(); - static aligned_vector_t emul_vSCR; - emul_vSCR.clear(); - emul_set_cr(init_cr); - set_gpr(RD, (uintptr)emul_vD.addr()); - set_gpr(RA, (uintptr)rAp); - set_gpr(RB, (uintptr)rBp); - set_gpr(RC, (uintptr)rCp); - set_gpr(VSCR, (uintptr)emul_vSCR.addr()); - execute(code); - vector_helper_t emul_vSCR_helper; - memcpy(&emul_vSCR_helper, emul_vSCR.addr(), sizeof(vector_t)); - const uint32 emul_cr = emul_get_cr(); - const uint32 emul_vscr = ntohl(emul_vSCR_helper.w[3]); - - ++tests; - - bool ok = vector_equals(vt.type, native_vD, emul_vD.value()) - && native_cr == emul_cr - && native_vscr == emul_vscr; - - if (!ok) { - printf("FAIL: %s [%08x]\n", vt.name, vt.opcode); - errors++; - } - else if (verbose) { - printf("PASS: %s [%08x]\n", vt.name, vt.opcode); - } - - if (!ok || verbose) { -#if ENABLE_MON - disass_ppc(stdout, (uintptr)code, vt.opcode); -#endif - char op_type = tolower(vt.op_type); - if (!op_type) - op_type = vt.type; -#define PRINT_OPERAND(N, vX, rX) \ - switch (vt.operands[N]) { \ - case vX: \ - printf(#vX " = "); \ - print_vector(*((vector_t *)rX##p)); \ - printf("\n"); \ - break; \ - case vI: \ - case vN: \ - printf(#vX " = %d\n", vX##_field::extract(vt.opcode)); \ - break; \ - case rX: \ - printf(#rX " = %08x", rX##p); \ - if (rX##p) switch (op_type) { \ - case 'b': printf(" [%02x]", *rX##p); break; \ - case 'h': printf(" [%04x]", *((uint16 *)rX##p)); break; \ - case 'w': printf(" [%08x]", *((uint32 *)rX##p)); break; \ - } \ - printf("\n"); \ - break; \ - } - PRINT_OPERAND(1, vA, rA); - PRINT_OPERAND(2, vB, rB); - PRINT_OPERAND(3, vC, rC); -#undef PRINT_OPERAND - printf("vD.N = "); - print_vector(native_vD, vt.type); - printf("\n"); - printf("vD.E = "); - print_vector(emul_vD.value(), vt.type); - printf("\n"); - printf("CR.N = %08x ; VSCR.N = %08x\n", native_cr, native_vscr); - printf("CR.E = %08x ; VSCR.E = %08x\n", emul_cr, emul_vscr); - } -#endif -} - -void powerpc_test_cpu::test_vector_load_for_shift(void) -{ -#if TEST_VMX_LOADSH - // Tested instructions - static const vector_test_t tests[] = { - { "lvsl", 'b', 0, _X (31,00,00,00, 6,0), { vD, rA, rB } }, - { "lvsr", 'b', 0, _X (31,00,00,00, 38,0), { vD, rA, rB } }, - }; - - // Code template - static uint32 code[] = { - POWERPC_MFSPR(12, 256), // mfvrsave r12 - _D(15,0,0,0x1000), // lis r0,0x1000 ([v3]) - POWERPC_MTSPR(0, 256), // mtvrsave r0 - POWERPC_LI(RA, 0), // li rB, - 0, // - POWERPC_STVX(RD, 0, RD), // stvx v3,r3(0) - POWERPC_MTSPR(12, 256), // mtvrsave r12 - POWERPC_BLR // blr - }; - - int i_opcode = -1; - const int n_instructions = sizeof(code) / sizeof(code[0]); - for (int i = 0; i < n_instructions; i++) { - if (code[i] == 0) { - i_opcode = i; - break; - } - } - assert(i_opcode != -1); - - const int n_elements = sizeof(tests) / sizeof(tests[0]); - for (int i = 0; i < n_elements; i++) { - vector_test_t const & vt = tests[i]; - code[i_opcode] = vt.opcode; - vD_field::insert(code[i_opcode], RD); - rA_field::insert(code[i_opcode], 00); - rB_field::insert(code[i_opcode], RA); - - printf("Testing %s\n", vt.name); - for (int j = 0; j < 32; j++) { - UIMM_field::insert(code[i_opcode - 1], j); - flush_icache_range(code, sizeof(code)); - test_one_vector(code, vt, (uint8 *)NULL); - } - } -#endif -} - -void powerpc_test_cpu::test_vector_load(void) -{ -#if TEST_VMX_LOAD - // Tested instructions - static const vector_test_t tests[] = { - { "lvebx", 'b', 0, _X (31,00,00,00, 7,0), { vD, rA, rB } }, - { "lvehx", 'h', 0, _X (31,00,00,00, 39,0), { vD, rA, rB } }, - { "lvewx", 'w', 0, _X (31,00,00,00, 71,0), { vD, rA, rB } } - }; - - // Code template - static uint32 code[] = { - POWERPC_MFSPR(12, 256), // mfvrsave r12 - _D(15,0,0,0x1000), // lis r0,0x1000 ([v3]) - POWERPC_MTSPR(0, 256), // mtvrsave r0 - POWERPC_LVX(RD, 0, RD), // lvx v3,r3(0) - 0, // - POWERPC_STVX(RD, 0, RD), // stvx v3,r3(0) - POWERPC_MTSPR(12, 256), // mtvrsave r12 - POWERPC_BLR // blr - }; - - int i_opcode = -1; - const int n_instructions = sizeof(code) / sizeof(code[0]); - for (int i = 0; i < n_instructions; i++) { - if (code[i] == 0) { - i_opcode = i; - break; - } - } - assert(i_opcode != -1); - - const int n_elements = sizeof(tests) / sizeof(tests[0]); - for (int i = 0; i < n_elements; i++) { - vector_test_t const & vt = tests[i]; - code[i_opcode] = vt.opcode; - vD_field::insert(code[i_opcode], RD); - rA_field::insert(code[i_opcode], 00); - rB_field::insert(code[i_opcode], RA); - flush_icache_range(code, sizeof(code)); - - printf("Testing %s\n", vt.name); - const int n_vector_values = sizeof(vector_values)/sizeof(vector_values[0]); - for (int j = 0; j < n_vector_values; j++) { - static aligned_vector_t av; - switch (vt.type) { - case 'b': - for (int k = 0; k < 16; k++) { - av.copy(*(vector_t *)((uint8 *)(&vector_values[j].v) + 1 * k), 16 - 1 * k); - test_one_vector(code, vt, av.addr()); - } - break; - case 'h': - for (int k = 0; k < 8; k++) { - av.copy(*(vector_t *)((uint8 *)(&vector_values[j].v) + 2 * k), 16 - 2 * k); - test_one_vector(code, vt, av.addr()); - } - break; - case 'w': - for (int k = 0; k < 4; k++) { - av.copy(*(vector_t *)((uint8 *)(&vector_values[j].v) + 4 * k), 16 - 4 * k); - test_one_vector(code, vt, av.addr()); - } - break; - } - } - } -#endif -} - -void powerpc_test_cpu::test_vector_arith(void) -{ -#if TEST_VMX_ARITH - // Tested instructions - static const vector_test_t tests[] = { - { "vaddcuw", 'w', 0 , _VX(04,RD,RA,RB, 384), { vD, vA, vB } }, - { "vaddfp", 'f', 0 , _VX(04,RD,RA,RB, 10), { vD, vA, vB } }, - { "vaddsbs", 'b', 0 , _VX(04,RD,RA,RB, 768), { vD, vA, vB } }, - { "vaddshs", 'h', 0 , _VX(04,RD,RA,RB, 832), { vD, vA, vB } }, - { "vaddsws", 'w', 0 , _VX(04,RD,RA,RB, 896), { vD, vA, vB } }, - { "vaddubm", 'b', 0 , _VX(04,RD,RA,RB, 0), { vD, vA, vB } }, - { "vaddubs", 'b', 0 , _VX(04,RD,RA,RB, 512), { vD, vA, vB } }, - { "vadduhm", 'h', 0 , _VX(04,RD,RA,RB, 64), { vD, vA, vB } }, - { "vadduhs", 'h', 0 , _VX(04,RD,RA,RB, 576), { vD, vA, vB } }, - { "vadduwm", 'w', 0 , _VX(04,RD,RA,RB, 128), { vD, vA, vB } }, - { "vadduws", 'w', 0 , _VX(04,RD,RA,RB, 640), { vD, vA, vB } }, - { "vand", 'w', 0 , _VX(04,RD,RA,RB,1028), { vD, vA, vB } }, - { "vandc", 'w', 0 , _VX(04,RD,RA,RB,1092), { vD, vA, vB } }, - { "vavgsb", 'b', 0 , _VX(04,RD,RA,RB,1282), { vD, vA, vB } }, - { "vavgsh", 'h', 0 , _VX(04,RD,RA,RB,1346), { vD, vA, vB } }, - { "vavgsw", 'w', 0 , _VX(04,RD,RA,RB,1410), { vD, vA, vB } }, - { "vavgub", 'b', 0 , _VX(04,RD,RA,RB,1026), { vD, vA, vB } }, - { "vavguh", 'h', 0 , _VX(04,RD,RA,RB,1090), { vD, vA, vB } }, - { "vavguw", 'w', 0 , _VX(04,RD,RA,RB,1154), { vD, vA, vB } }, - { "vcfsx", 'f', 'w', _VX(04,RD,00,RB, 842), { vD, vI, vB } }, - { "vcfux", 'f', 'w', _VX(04,RD,00,RB, 778), { vD, vI, vB } }, - { "vcmpbfp", 'w', 'f', _VXR(04,RD,RA,RB,966,0), { vD, vA, vB } }, - { "vcmpbfp.", 'w', 'f', _VXR(04,RD,RA,RB,966,1), { vD, vA, vB } }, - { "vcmpeqfp", 'w', 'f', _VXR(04,RD,RA,RB,198,0), { vD, vA, vB } }, - { "vcmpeqfp.", 'w', 'f', _VXR(04,RD,RA,RB,198,1), { vD, vA, vB } }, - { "vcmpequb", 'b', 0 , _VXR(04,RD,RA,RB, 6,0), { vD, vA, vB } }, - { "vcmpequb.", 'b', 0 , _VXR(04,RD,RA,RB, 6,1), { vD, vA, vB } }, - { "vcmpequh", 'h', 0 , _VXR(04,RD,RA,RB, 70,0), { vD, vA, vB } }, - { "vcmpequh.", 'h', 0 , _VXR(04,RD,RA,RB, 70,1), { vD, vA, vB } }, - { "vcmpequw", 'w', 0 , _VXR(04,RD,RA,RB,134,0), { vD, vA, vB } }, - { "vcmpequw.", 'w', 0 , _VXR(04,RD,RA,RB,134,1), { vD, vA, vB } }, - { "vcmpgefp", 'w', 'f', _VXR(04,RD,RA,RB,454,0), { vD, vA, vB } }, - { "vcmpgefp.", 'w', 'f', _VXR(04,RD,RA,RB,454,1), { vD, vA, vB } }, - { "vcmpgtfp", 'w', 'f', _VXR(04,RD,RA,RB,710,0), { vD, vA, vB } }, - { "vcmpgtfp.", 'w', 'f', _VXR(04,RD,RA,RB,710,1), { vD, vA, vB } }, - { "vcmpgtsb", 'b', 0 , _VXR(04,RD,RA,RB,774,0), { vD, vA, vB } }, - { "vcmpgtsb.", 'b', 0 , _VXR(04,RD,RA,RB,774,1), { vD, vA, vB } }, - { "vcmpgtsh", 'h', 0 , _VXR(04,RD,RA,RB,838,0), { vD, vA, vB } }, - { "vcmpgtsh.", 'h', 0 , _VXR(04,RD,RA,RB,838,1), { vD, vA, vB } }, - { "vcmpgtsw", 'w', 0 , _VXR(04,RD,RA,RB,902,0), { vD, vA, vB } }, - { "vcmpgtsw.", 'w', 0 , _VXR(04,RD,RA,RB,902,1), { vD, vA, vB } }, - { "vcmpgtub", 'b', 0 , _VXR(04,RD,RA,RB,518,0), { vD, vA, vB } }, - { "vcmpgtub.", 'b', 0 , _VXR(04,RD,RA,RB,518,1), { vD, vA, vB } }, - { "vcmpgtuh", 'h', 0 , _VXR(04,RD,RA,RB,582,0), { vD, vA, vB } }, - { "vcmpgtuh.", 'h', 0 , _VXR(04,RD,RA,RB,582,1), { vD, vA, vB } }, - { "vcmpgtuw", 'w', 0 , _VXR(04,RD,RA,RB,646,0), { vD, vA, vB } }, - { "vcmpgtuw.", 'w', 0 , _VXR(04,RD,RA,RB,646,1), { vD, vA, vB } }, - { "vctsxs", 'w', 'f', _VX(04,RD,00,RB, 970), { vD, vI, vB } }, - { "vctuxs", 'w', 'f', _VX(04,RD,00,RB, 906), { vD, vI, vB } }, - { "vexptefp", 'f', 0 , _VX(04,RD,00,RB, 394), { vD, __, vB } }, - { "vlogefp", 'l', 'f', _VX(04,RD,00,RB, 458), { vD, __, vB } }, - { "vmaddfp", 'f', 0 , _VA(04,RD,RA,RB,RC,46),{ vD, vA, vB, vC } }, - { "vmaxfp", 'f', 0 , _VX(04,RD,RA,RB,1034), { vD, vA, vB } }, - { "vmaxsb", 'b', 0 , _VX(04,RD,RA,RB, 258), { vD, vA, vB } }, - { "vmaxsh", 'h', 0 , _VX(04,RD,RA,RB, 322), { vD, vA, vB } }, - { "vmaxsw", 'w', 0 , _VX(04,RD,RA,RB, 386), { vD, vA, vB } }, - { "vmaxub", 'b', 0 , _VX(04,RD,RA,RB, 2), { vD, vA, vB } }, - { "vmaxuh", 'h', 0 , _VX(04,RD,RA,RB, 66), { vD, vA, vB } }, - { "vmaxuw", 'w', 0 , _VX(04,RD,RA,RB, 130), { vD, vA, vB } }, - { "vmhaddshs", 'h', 0 , _VA(04,RD,RA,RB,RC,32),{ vD, vA, vB, vC } }, - { "vmhraddshs", 'h', 0 , _VA(04,RD,RA,RB,RC,33),{ vD, vA, vB, vC } }, - { "vminfp", 'f', 0 , _VX(04,RD,RA,RB,1098), { vD, vA, vB } }, - { "vminsb", 'b', 0 , _VX(04,RD,RA,RB, 770), { vD, vA, vB } }, - { "vminsh", 'h', 0 , _VX(04,RD,RA,RB, 834), { vD, vA, vB } }, - { "vminsw", 'w', 0 , _VX(04,RD,RA,RB, 898), { vD, vA, vB } }, - { "vminub", 'b', 0 , _VX(04,RD,RA,RB, 514), { vD, vA, vB } }, - { "vminuh", 'h', 0 , _VX(04,RD,RA,RB, 578), { vD, vA, vB } }, - { "vminuw", 'w', 0 , _VX(04,RD,RA,RB, 642), { vD, vA, vB } }, - { "vmladduhm", 'h', 0 , _VA(04,RD,RA,RB,RC,34),{ vD, vA, vB, vC } }, - { "vmrghb", 'b', 0 , _VX(04,RD,RA,RB, 12), { vD, vA, vB } }, - { "vmrghh", 'h', 0 , _VX(04,RD,RA,RB, 76), { vD, vA, vB } }, - { "vmrghw", 'w', 0 , _VX(04,RD,RA,RB, 140), { vD, vA, vB } }, - { "vmrglb", 'b', 0 , _VX(04,RD,RA,RB, 268), { vD, vA, vB } }, - { "vmrglh", 'h', 0 , _VX(04,RD,RA,RB, 332), { vD, vA, vB } }, - { "vmrglw", 'w', 0 , _VX(04,RD,RA,RB, 396), { vD, vA, vB } }, - { "vmsummbm", 'b', 0 , _VA(04,RD,RA,RB,RC,37),{ vD, vA, vB, vC } }, - { "vmsumshm", 'h', 0 , _VA(04,RD,RA,RB,RC,40),{ vD, vA, vB, vC } }, - { "vmsumshs", 'h', 0 , _VA(04,RD,RA,RB,RC,41),{ vD, vA, vB, vC } }, - { "vmsumubm", 'b', 0 , _VA(04,RD,RA,RB,RC,36),{ vD, vA, vB, vC } }, - { "vmsumuhm", 'h', 0 , _VA(04,RD,RA,RB,RC,38),{ vD, vA, vB, vC } }, - { "vmsumuhs", 'h', 0 , _VA(04,RD,RA,RB,RC,39),{ vD, vA, vB, vC } }, - { "vmulesb", 'b', 0 , _VX(04,RD,RA,RB, 776), { vD, vA, vB } }, - { "vmulesh", 'h', 0 , _VX(04,RD,RA,RB, 840), { vD, vA, vB } }, - { "vmuleub", 'b', 0 , _VX(04,RD,RA,RB, 520), { vD, vA, vB } }, - { "vmuleuh", 'h', 0 , _VX(04,RD,RA,RB, 584), { vD, vA, vB } }, - { "vmulosb", 'b', 0 , _VX(04,RD,RA,RB, 264), { vD, vA, vB } }, - { "vmulosh", 'h', 0 , _VX(04,RD,RA,RB, 328), { vD, vA, vB } }, - { "vmuloub", 'b', 0 , _VX(04,RD,RA,RB, 8), { vD, vA, vB } }, - { "vmulouh", 'h', 0 , _VX(04,RD,RA,RB, 72), { vD, vA, vB } }, - { "vnmsubfp", 'f', 0 , _VA(04,RD,RA,RB,RC,47),{ vD, vA, vB, vC } }, - { "vnor", 'w', 0 , _VX(04,RD,RA,RB,1284), { vD, vA, vB } }, - { "vor", 'w', 0 , _VX(04,RD,RA,RB,1156), { vD, vA, vB } }, - { "vperm", 'b', 0 , _VA(04,RD,RA,RB,RC,43),{ vD, vA, vB, vC } }, - { "vpkpx", 'h', 0 , _VX(04,RD,RA,RB, 782), { vD, vA, vB } }, - { "vpkshss", 'b', 0 , _VX(04,RD,RA,RB, 398), { vD, vA, vB } }, - { "vpkshus", 'b', 0 , _VX(04,RD,RA,RB, 270), { vD, vA, vB } }, - { "vpkswss", 'h', 0 , _VX(04,RD,RA,RB, 462), { vD, vA, vB } }, - { "vpkswus", 'h', 0 , _VX(04,RD,RA,RB, 334), { vD, vA, vB } }, - { "vpkuhum", 'b', 0 , _VX(04,RD,RA,RB, 14), { vD, vA, vB } }, - { "vpkuhus", 'b', 0 , _VX(04,RD,RA,RB, 142), { vD, vA, vB } }, - { "vpkuwum", 'h', 0 , _VX(04,RD,RA,RB, 78), { vD, vA, vB } }, - { "vpkuwus", 'h', 0 , _VX(04,RD,RA,RB, 206), { vD, vA, vB } }, - { "vrefp", 'e', 'f', _VX(04,RD,00,RB, 266), { vD, __, vB } }, - { "vrfim", 'f', 0 , _VX(04,RD,00,RB, 714), { vD, __, vB } }, - { "vrfin", 'f', 0 , _VX(04,RD,00,RB, 522), { vD, __, vB } }, - { "vrfip", 'f', 0 , _VX(04,RD,00,RB, 650), { vD, __, vB } }, - { "vrfiz", 'f', 0 , _VX(04,RD,00,RB, 586), { vD, __, vB } }, - { "vrlb", 'b', 0 , _VX(04,RD,RA,RB, 4), { vD, vA, vB } }, - { "vrlh", 'h', 0 , _VX(04,RD,RA,RB, 68), { vD, vA, vB } }, - { "vrlw", 'w', 0 , _VX(04,RD,RA,RB, 132), { vD, vA, vB } }, - { "vrsqrtefp", 'e', 'f', _VX(04,RD,00,RB, 330), { vD, __, vB } }, - { "vsel", 'b', 0 , _VA(04,RD,RA,RB,RC,42),{ vD, vA, vB, vC } }, - { "vsl", 'b', 'B', _VX(04,RD,RA,RB, 452), { vD, vA, vB } }, - { "vslb", 'b', 0 , _VX(04,RD,RA,RB, 260), { vD, vA, vB } }, - { "vsldoi", 'b', 0 , _VA(04,RD,RA,RB,00,44),{ vD, vA, vB, vN } }, - { "vslh", 'h', 0 , _VX(04,RD,RA,RB, 324), { vD, vA, vB } }, - { "vslo", 'b', 0 , _VX(04,RD,RA,RB,1036), { vD, vA, vB } }, - { "vslw", 'w', 0 , _VX(04,RD,RA,RB, 388), { vD, vA, vB } }, - { "vspltb", 'b', 0 , _VX(04,RD,00,RB, 524), { vD, vI, vB } }, - { "vsplth", 'h', 0 , _VX(04,RD,00,RB, 588), { vD, vI, vB } }, - { "vspltisb", 'b', 0 , _VX(04,RD,00,00, 780), { vD, vI } }, - { "vspltish", 'h', 0 , _VX(04,RD,00,00, 844), { vD, vI } }, - { "vspltisw", 'w', 0 , _VX(04,RD,00,00, 908), { vD, vI } }, - { "vspltw", 'w', 0 , _VX(04,RD,00,RB, 652), { vD, vI, vB } }, - { "vsr", 'b', 'B', _VX(04,RD,RA,RB, 708), { vD, vA, vB } }, - { "vsrab", 'b', 0 , _VX(04,RD,RA,RB, 772), { vD, vA, vB } }, - { "vsrah", 'h', 0 , _VX(04,RD,RA,RB, 836), { vD, vA, vB } }, - { "vsraw", 'w', 0 , _VX(04,RD,RA,RB, 900), { vD, vA, vB } }, - { "vsrb", 'b', 0 , _VX(04,RD,RA,RB, 516), { vD, vA, vB } }, - { "vsrh", 'h', 0 , _VX(04,RD,RA,RB, 580), { vD, vA, vB } }, - { "vsro", 'b', 0 , _VX(04,RD,RA,RB,1100), { vD, vA, vB } }, - { "vsrw", 'w', 0 , _VX(04,RD,RA,RB, 644), { vD, vA, vB } }, - { "vsubcuw", 'w', 0 , _VX(04,RD,RA,RB,1408), { vD, vA, vB } }, - { "vsubfp", 'f', 0 , _VX(04,RD,RA,RB, 74), { vD, vA, vB } }, - { "vsubsbs", 'b', 0 , _VX(04,RD,RA,RB,1792), { vD, vA, vB } }, - { "vsubshs", 'h', 0 , _VX(04,RD,RA,RB,1856), { vD, vA, vB } }, - { "vsubsws", 'w', 0 , _VX(04,RD,RA,RB,1920), { vD, vA, vB } }, - { "vsububm", 'b', 0 , _VX(04,RD,RA,RB,1024), { vD, vA, vB } }, - { "vsububs", 'b', 0 , _VX(04,RD,RA,RB,1536), { vD, vA, vB } }, - { "vsubuhm", 'h', 0 , _VX(04,RD,RA,RB,1088), { vD, vA, vB } }, - { "vsubuhs", 'h', 0 , _VX(04,RD,RA,RB,1600), { vD, vA, vB } }, - { "vsubuwm", 'w', 0 , _VX(04,RD,RA,RB,1152), { vD, vA, vB } }, - { "vsubuws", 'w', 0 , _VX(04,RD,RA,RB,1664), { vD, vA, vB } }, - { "vsum2sws", 'w', 0 , _VX(04,RD,RA,RB,1672), { vD, vA, vB } }, - { "vsum4sbs", 'w', 0 , _VX(04,RD,RA,RB,1800), { vD, vA, vB } }, - { "vsum4shs", 'w', 0 , _VX(04,RD,RA,RB,1608), { vD, vA, vB } }, - { "vsum4ubs", 'w', 0 , _VX(04,RD,RA,RB,1544), { vD, vA, vB } }, - { "vsumsws", 'w', 0 , _VX(04,RD,RA,RB,1928), { vD, vA, vB } }, - { "vupkhpx", 'w', 0 , _VX(04,RD,00,RB, 846), { vD, __, vB } }, - { "vupkhsb", 'h', 0 , _VX(04,RD,00,RB, 526), { vD, __, vB } }, - { "vupkhsh", 'w', 0 , _VX(04,RD,00,RB, 590), { vD, __, vB } }, - { "vupklpx", 'w', 0 , _VX(04,RD,00,RB, 974), { vD, __, vB } }, - { "vupklsb", 'h', 0 , _VX(04,RD,00,RB, 654), { vD, __, vB } }, - { "vupklsh", 'w', 0 , _VX(04,RD,00,RB, 718), { vD, __, vB } }, - { "vxor", 'w', 0 , _VX(04,RD,RA,RB,1220), { vD, vA, vB } }, - }; - - // Code template - static uint32 code[] = { - POWERPC_MFSPR(12, 256), // mfvrsave r12 - _D(15,0,0,0x9e00), // lis r0,0x9e00 ([v0;v3-v6]) - POWERPC_MTSPR(0, 256), // mtvrsave r0 - POWERPC_LVX(RA, 0, RA), // lvx v4,r4(0) - POWERPC_LVX(RB, 0, RB), // lvx v5,r5(0) - POWERPC_LVX(RC, 0, RC), // lvx v6,r6(0) - POWERPC_LVX(0, 0, VSCR), // lvx v0,r7(0) - _VX(04,00,00,00,1604), // mtvscr v0 - 0, // v3,v4,v5 - _VX(04,00,00,00,1540), // mfvscr v0 - POWERPC_STVX(0, 0, VSCR), // stvx v0,r7(0) - POWERPC_STVX(RD, 0, RD), // stvx v3,r3(0) - POWERPC_MTSPR(12, 256), // mtvrsave r12 - POWERPC_BLR // blr - }; - - int i_opcode = -1; - const int n_instructions = sizeof(code) / sizeof(code[0]); - for (int i = 0; i < n_instructions; i++) { - if (code[i] == 0) { - i_opcode = i; - break; - } - } - assert(i_opcode != -1); - - const int n_elements = sizeof(tests) / sizeof(tests[0]); - for (int n = 0; n < n_elements; n++) { - vector_test_t vt = tests[n]; - code[i_opcode] = vt.opcode; - flush_icache_range(code, sizeof(code)); - - // Operand type - char op_type = vt.op_type; - if (!op_type) - op_type = vt.type; - - // Operand values - int n_vector_values; - const vector_value_t *vvp; - if (op_type == 'f') { - n_vector_values = sizeof(vector_fp_values)/sizeof(vector_fp_values[0]); - vvp = vector_fp_values; - } - else { - n_vector_values = sizeof(vector_values)/sizeof(vector_values[0]); - vvp = vector_values; - } - - printf("Testing %s\n", vt.name); - static aligned_vector_t avi, avj, avk; - if (vt.operands[1] == vA && vt.operands[2] == vB && vt.operands[3] == vC) { - for (int i = 0; i < n_vector_values; i++) { - avi.copy(vvp[i].v); - for (int j = 0; j < n_vector_values; j++) { - avj.copy(vvp[j].v); - for (int k = 0; k < n_vector_values; k++) { - avk.copy(vvp[k].v); - test_one_vector(code, vt, avi.addr(), avj.addr(), avk.addr()); - } - } - } - } - else if (vt.operands[1] == vA && vt.operands[2] == vB && vt.operands[3] == vN) { - for (int i = 0; i < 16; i++) { - vSH_field::insert(vt.opcode, i); - code[i_opcode] = vt.opcode; - flush_icache_range(code, sizeof(code)); - avi.copy(vvp[i].v); - for (int j = 0; j < n_vector_values; j++) { - avj.copy(vvp[j].v); - for (int k = 0; k < n_vector_values; k++) - test_one_vector(code, vt, avi.addr(), avj.addr()); - } - } - } - else if (vt.operands[1] == vA && vt.operands[2] == vB) { - for (int i = 0; i < n_vector_values; i++) { - avi.copy(vvp[i].v); - for (int j = 0; j < n_vector_values; j++) { - if (op_type == 'B') { - if (!vector_all_eq('b', vvp[j].v)) - continue; - } - avj.copy(vvp[j].v); - test_one_vector(code, vt, avi.addr(), avj.addr()); - } - } - } - else if (vt.operands[1] == vI && vt.operands[2] == vB) { - for (int i = 0; i < 32; i++) { - rA_field::insert(vt.opcode, i); - code[i_opcode] = vt.opcode; - flush_icache_range(code, sizeof(code)); - for (int j = 0; j < n_vector_values; j++) { - avj.copy(vvp[j].v); - test_one_vector(code, vt, NULL, avj.addr()); - } - } - } - else if (vt.operands[1] == vI) { - for (int i = 0; i < 32; i++) { - rA_field::insert(vt.opcode, i); - code[i_opcode] = vt.opcode; - flush_icache_range(code, sizeof(code)); - test_one_vector(code, vt); - } - } - else if (vt.operands[1] == __ && vt.operands[2] == vB) { - for (int i = 0; i < n_vector_values; i++) { - avi.copy(vvp[i].v); - test_one_vector(code, vt, NULL, avi.addr()); - } - } - else { - printf("ERROR: unhandled test case\n"); - abort(); - } - } -#endif -} - -// Illegal handler to catch out AltiVec instruction -#ifdef NATIVE_POWERPC -static sigjmp_buf env; - -static void sigill_handler(int sig) -{ - has_altivec = false; - siglongjmp(env, 1); -} -#endif - -bool powerpc_test_cpu::test(void) -{ - // Tests initialization - tests = errors = 0; - init_cr = init_xer = 0; - - // Execution ALU tests -#if TEST_ALU_OPS - test_add(); - test_sub(); - test_mul(); - test_div(); - test_shift(); - test_rotate(); - test_logical(); - test_compare(); - test_cr_logical(); -#endif - - // Execute VMX tests -#if TEST_VMX_OPS - if (has_altivec) { - test_vector_load_for_shift(); - test_vector_load(); - test_vector_arith(); - } -#endif - - printf("%u errors out of %u tests\n", errors, tests); - return errors == 0; -} - -int main(int argc, char *argv[]) -{ -#ifdef EMU_KHEPERIX - // Initialize VM system (predecode cache uses vm_acquire()) - vm_init(); -#endif - - FILE *fp = NULL; - powerpc_test_cpu *ppc = new powerpc_test_cpu; - - if (argc > 1) { - const char *arg = argv[1]; - if (strcmp(arg, "--jit") == 0) { - --argc; - argv[1] = argv[0]; - ++argv; - ppc->enable_jit(); - } - } - - if (argc > 1) { - const char *file = argv[1]; -#ifdef NATIVE_POWERPC - if ((fp = fopen(file, "wb")) == NULL) { - fprintf(stderr, "ERROR: can't open %s for writing\n", file); - return EXIT_FAILURE; - } -#else - if ((fp = fopen(file, "rb")) == NULL) { - fprintf(stderr, "ERROR: can't open %s for reading\n", file); - return EXIT_FAILURE; - } -#endif - ppc->set_results_file(fp); - - // Use a large enough buffer - static char buffer[4096]; - setvbuf(fp, buffer, _IOFBF, sizeof(buffer)); - } - - // We need a results file on non PowerPC platforms -#ifndef NATIVE_POWERPC - if (fp == NULL) { - fprintf(stderr, "ERROR: a results file for reference is required\n"); - return EXIT_FAILURE; - } -#endif - - // Check if host CPU supports AltiVec instructions - has_altivec = true; -#ifdef NATIVE_POWERPC - signal(SIGILL, sigill_handler); - if (!sigsetjmp(env, 1)) - asm volatile(".long 0x10000484"); // vor v0,v0,v0 - signal(SIGILL, SIG_DFL); -#endif - - bool ok = ppc->test(); - if (fp) fclose(fp); - delete ppc; - return !ok; -} diff --git a/SheepShaver/src/kpx_cpu/src/utils/utils-cpuinfo.cpp b/SheepShaver/src/kpx_cpu/src/utils/utils-cpuinfo.cpp deleted file mode 100644 index d7e2d012..00000000 --- a/SheepShaver/src/kpx_cpu/src/utils/utils-cpuinfo.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/* - * utils-cpuinfo.cpp - Processor capability information - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" -#include "utils/utils-cpuinfo.hpp" -#include "utils/utils-sentinel.hpp" - -// x86 CPU features -static uint32 x86_cpu_features = 0; - -enum { - HWCAP_I386_CMOV = 1 << 15, - HWCAP_I386_MMX = 1 << 23, - HWCAP_I386_SSE = 1 << 25, - HWCAP_I386_SSE2 = 1 << 26, - HWCAP_I386_EDX_FLAGS = (HWCAP_I386_CMOV|HWCAP_I386_MMX|HWCAP_I386_SSE|HWCAP_I386_SSE2), - HWCAP_I386_SSE3 = 1 << 0, - HWCAP_I386_SSSE3 = 1 << 9, - HWCAP_I386_SSE4_1 = 1 << 19, - HWCAP_I386_SSE4_2 = 1 << 20, - HWCAP_I386_ECX_FLAGS = (HWCAP_I386_SSE3|HWCAP_I386_SSSE3|HWCAP_I386_SSE4_1|HWCAP_I386_SSE4_2) -}; - -// Determine x86 CPU features -DEFINE_INIT_SENTINEL(init_x86_cpu_features); - -static void init_x86_cpu_features(void) -{ -#if defined(__i386__) || defined(__x86_64__) - unsigned int fl1, fl2; - -#ifndef __x86_64__ - /* See if we can use cpuid. On AMD64 we always can. */ - __asm__ ("pushfl; pushfl; popl %0; movl %0,%1; xorl %2,%0;" - "pushl %0; popfl; pushfl; popl %0; popfl" - : "=&r" (fl1), "=&r" (fl2) - : "i" (0x00200000)); - if (((fl1 ^ fl2) & 0x00200000) == 0) - return; -#endif - - /* Host supports cpuid. See if cpuid gives capabilities, try - CPUID(0). Preserve %ebx and %ecx; cpuid insn clobbers these, we - don't need their CPUID values here, and %ebx may be the PIC - register. */ -#ifdef __x86_64__ - __asm__ ("pushq %%rcx; pushq %%rbx; cpuid; popq %%rbx; popq %%rcx" - : "=a" (fl1) : "0" (0) : "rdx", "cc"); -#else - __asm__ ("push %%ecx ; push %%ebx ; cpuid ; pop %%ebx ; pop %%ecx" - : "=a" (fl1) : "0" (0) : "edx", "cc"); -#endif - if (fl1 == 0) - return; - - /* Invoke CPUID(1), return %edx; caller can examine bits to - determine what's supported. */ -#ifdef __x86_64__ - __asm__ ("push %%rbx ; cpuid ; pop %%rbx" : "=c" (fl1), "=d" (fl2) : "a" (1) : "cc"); -#else - __asm__ ("push %%ebx ; cpuid ; pop %%ebx" : "=c" (fl1), "=d" (fl2) : "a" (1) : "cc"); -#endif - - x86_cpu_features = (fl1 & HWCAP_I386_ECX_FLAGS) | (fl2 & HWCAP_I386_EDX_FLAGS); -#endif -} - -// Check for x86 feature CMOV -bool cpuinfo_check_cmov(void) -{ - return x86_cpu_features & HWCAP_I386_CMOV; -} - -// Check for x86 feature MMX -bool cpuinfo_check_mmx(void) -{ - return x86_cpu_features & HWCAP_I386_MMX; -} - -// Check for x86 feature SSE -bool cpuinfo_check_sse(void) -{ - return x86_cpu_features & HWCAP_I386_SSE; -} - -// Check for x86 feature SSE2 -bool cpuinfo_check_sse2(void) -{ - return x86_cpu_features & HWCAP_I386_SSE2; -} - -// Check for x86 feature SSE3 -bool cpuinfo_check_sse3(void) -{ - return x86_cpu_features & HWCAP_I386_SSE3; -} - -// Check for x86 feature SSSE3 -bool cpuinfo_check_ssse3(void) -{ - return x86_cpu_features & HWCAP_I386_SSSE3; -} - -// Check for x86 feature SSE4.1 -bool cpuinfo_check_sse4_1(void) -{ - return x86_cpu_features & HWCAP_I386_SSE4_1; -} - -// Check for x86 feature SSE4_2 -bool cpuinfo_check_sse4_2(void) -{ - return x86_cpu_features & HWCAP_I386_SSE4_2; -} - -// PowerPC CPU features -static uint32 ppc_cpu_features = 0; - -enum { - HWCAP_PPC_ALTIVEC = 1 << 0 -}; - -// Determine PowerPC CPU features -DEFINE_INIT_SENTINEL(init_ppc_cpu_features); - -static void init_ppc_cpu_features(void) -{ -} - -// Check for ppc feature VMX (Altivec) -bool cpuinfo_check_altivec(void) -{ - return ppc_cpu_features & HWCAP_PPC_ALTIVEC; -} diff --git a/SheepShaver/src/kpx_cpu/src/utils/utils-cpuinfo.hpp b/SheepShaver/src/kpx_cpu/src/utils/utils-cpuinfo.hpp deleted file mode 100644 index 22bd621f..00000000 --- a/SheepShaver/src/kpx_cpu/src/utils/utils-cpuinfo.hpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * utils-cpuinfo.hpp - Processor capability information - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef UTILS_CPUINFO_H -#define UTILS_CPUINFO_H - -// Check for x86 feature CMOV -extern bool cpuinfo_check_cmov(void); - -// Check for x86 feature MMX -extern bool cpuinfo_check_mmx(void); - -// Check for x86 feature SSE -extern bool cpuinfo_check_sse(void); - -// Check for x86 feature SSE2 -extern bool cpuinfo_check_sse2(void); - -// Check for x86 feature SSE3 -extern bool cpuinfo_check_sse3(void); - -// Check for x86 feature SSSE3 -extern bool cpuinfo_check_ssse3(void); - -// Check for x86 feature SSE4.1 -extern bool cpuinfo_check_sse4_1(void); - -// Check for x86 feature SSE4_2 -extern bool cpuinfo_check_sse4_2(void); - -// Check for ppc feature VMX (Altivec) -extern bool cpuinfo_check_altivec(void); - -#endif /* UTILS_CPUINFO_H */ diff --git a/SheepShaver/src/kpx_cpu/src/utils/utils-sentinel.hpp b/SheepShaver/src/kpx_cpu/src/utils/utils-sentinel.hpp deleted file mode 100644 index b696f419..00000000 --- a/SheepShaver/src/kpx_cpu/src/utils/utils-sentinel.hpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * utils-sentinel.hpp - Helper functions for program initialization and termination - * - * Kheperix (C) 2003-2005 Gwenole Beauchesne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef UTILS_SENTINEL_H -#define UTILS_SENTINEL_H - -class program_sentinel { - void (*fini)(void); -public: - program_sentinel(void (*init_func)(void) = 0, void (*exit_func)(void) = 0) - : fini(exit_func) - { if (init_func) init_func(); } - ~program_sentinel() - { if (fini) fini(); } -}; - -#define DEFINE_INIT_SENTINEL(FUNCTION) \ -static void FUNCTION(void); \ -static program_sentinel g_program_init_sentinel__##FUNCTION(FUNCTION) - -#define DEFINE_EXIT_SENTINEL(FUNCTION) \ -static void FUNCTION(void); \ -static program_sentinel g_program_exit_sentinel__##FUNCTION(0, FUNCTION) - -#define DEFINE_PROG_SENTINEL(FUNCTION) \ -static void init_##FUNCTION(void); \ -static void exit_##FUNCTION(void); \ -static program_sentinel g_program_sentinel_##FUNCTION(init_##FUNCTION, exit_##FUNCTION) - -#endif /* UTILS_SENTINEL_H */ diff --git a/SheepShaver/src/macos_util.cpp b/SheepShaver/src/macos_util.cpp deleted file mode 100644 index 13b21397..00000000 --- a/SheepShaver/src/macos_util.cpp +++ /dev/null @@ -1,354 +0,0 @@ -/* - * macos_util.cpp - MacOS definitions/utility functions - * - * SheepShaver (C) Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" -#include "cpu_emulation.h" -#include "main.h" -#include "sony.h" -#include "disk.h" -#include "cdrom.h" -#include "xlowmem.h" -#include "emul_op.h" -#include "macos_util.h" -#include "thunks.h" - -#define DEBUG 0 -#include "debug.h" - - -// Function pointers -typedef long (*cu_ptr)(void *, uint32); -static uint32 cu_tvect = 0; -static inline long CallUniversal(void *arg1, uint32 arg2) -{ - return (long)CallMacOS2(cu_ptr, cu_tvect, arg1, arg2); -} -typedef int16 (*gsl_ptr)(char *, uint32, uint32, uint32 *, void **, char *); -static uint32 gsl_tvect = 0; -static inline int16 GetSharedLibrary(uintptr arg1, uint32 arg2, uint32 arg3, uintptr arg4, uintptr arg5, uintptr arg6) -{ - return (int16)CallMacOS6(gsl_ptr, gsl_tvect, (char *)arg1, arg2, arg3, (uint32 *)arg4, (void **)arg5, (char *)arg6); -} -typedef int16 (*fs_ptr)(uint32, char *, void **, uint32 *); -static uint32 fs_tvect = 0; -static inline int16 FindSymbol(uint32 arg1, uintptr arg2, uintptr arg3, uintptr arg4) -{ - return (int16)CallMacOS4(fs_ptr, fs_tvect, arg1, (char *)arg2, (void **)arg3, (uint32 **)arg4); -} -typedef int16 (*cc_ptr)(uint32 *); -static uint32 cc_tvect = 0; -static inline int16 CloseConnection(uint32 *arg1) -{ - return (int16)CallMacOS1(cc_ptr, cc_tvect, arg1); -} -typedef uint32 (*nps_ptr)(uint32); -static uint32 nps_tvect = 0; -static inline uint32 NewPtrSys(uint32 arg1) -{ - return CallMacOS1(nps_ptr, nps_tvect, arg1); -} -typedef void (*d_ptr)(uint32); -static uint32 d_tvect = 0; -static inline void DisposePtr(uint32 arg1) -{ - CallMacOS1(d_ptr, d_tvect, arg1); -} - - -/* - * Reset MacOS utilities - */ - -void MacOSUtilReset(void) -{ - cu_tvect = 0; - gsl_tvect = 0; - fs_tvect = 0; - cc_tvect = 0; -} - - -/* - * Enqueue QElem to list - */ - -void Enqueue(uint32 elem, uint32 list) -{ - WriteMacInt32(elem + qLink, 0); - if (!ReadMacInt32(list + qTail)) { - WriteMacInt32(list + qHead, elem); - WriteMacInt32(list + qTail, elem); - } else { - WriteMacInt32(ReadMacInt32(list + qTail) + qLink, elem); - WriteMacInt32(list + qTail, elem); - } -} - - -/* - * Find first free drive number, starting at num - */ - -static bool is_drive_number_free(int num) -{ - uint32 e = ReadMacInt32(0x308 + qHead); - while (e) { - uint32 d = e - dsQLink; - if ((int)ReadMacInt16(d + dsQDrive) == num) - return false; - e = ReadMacInt32(e + qLink); - } - return true; -} - -int FindFreeDriveNumber(int num) -{ - while (!is_drive_number_free(num)) - num++; - return num; -} - - -/* - * Mount volume with given file handle (call this function when you are unable to - * do automatic media change detection and the user has to press a special key - * or something to mount a volume; this function will check if there's really a - * volume in the drive with SysIsDiskInserted(); volumes which are present on startup - * are automatically mounted) - */ - -void MountVolume(void *fh) -{ - SonyMountVolume(fh) || DiskMountVolume(fh) || CDROMMountVolume(fh); -} - - -/* - * Calculate disk image file layout given file size and first 256 data bytes - */ - -void FileDiskLayout(loff_t size, uint8 *data, loff_t &start_byte, loff_t &real_size) -{ - if (size == 419284 || size == 838484) { - // 400K/800K DiskCopy image, 84 byte header - start_byte = 84; - real_size = (size - 84) & ~0x1ff; - } else { - // 0..511 byte header - start_byte = size & 0x1ff; - real_size = size - start_byte; - } -} - - -/* - * Find symbol in shared library (using CFM) - * lib and sym must be Pascal strings! - */ - -uint32 FindLibSymbol(const char *lib_str, const char *sym_str) -{ - SheepVar32 conn_id = 0; - SheepVar32 main_addr = 0; - SheepArray<256> err; - WriteMacInt8(err.addr(), 0); - SheepVar32 sym_addr = 0; - SheepVar32 sym_class = 0; - - SheepString lib(lib_str); - SheepString sym(sym_str); - - D(bug("FindLibSymbol %s in %s...\n", sym.value()+1, lib.value()+1)); - - if (ReadMacInt32(XLM_RUN_MODE) == MODE_EMUL_OP) { - M68kRegisters r; - - // Find shared library - static const uint8 proc1_template[] = { - 0x55, 0x8f, // subq.l #2,a7 - 0x2f, 0x08, // move.l a0,-(a7) - 0x2f, 0x3c, 0x70, 0x77, 0x70, 0x63, // move.l #'pwpc',-(a7) - 0x2f, 0x3c, 0x00, 0x00, 0x00, 0x01, // move.l #kReferenceCFrag,-(a7) - 0x2f, 0x09, // move.l a1,-(a7) - 0x2f, 0x0a, // move.l a2,-(a7) - 0x2f, 0x0b, // move.l a3,-(a7) - 0x3f, 0x3c, 0x00, 0x01, // (GetSharedLibrary) - 0xaa, 0x5a, // CFMDispatch - 0x30, 0x1f, // move.w (a7)+,d0 - M68K_RTS >> 8, M68K_RTS & 0xff - }; - BUILD_SHEEPSHAVER_PROCEDURE(proc1); - r.a[0] = lib.addr(); - r.a[1] = conn_id.addr(); - r.a[2] = main_addr.addr(); - r.a[3] = err.addr(); - Execute68k(proc1, &r); - D(bug(" GetSharedLibrary: ret %d, connection ID %ld, main %p\n", (int16)r.d[0], conn_id.value(), main_addr.value())); - if (r.d[0]) - return 0; - - // Find symbol - static const uint8 proc2_template[] = { - 0x55, 0x8f, // subq.l #2,a7 - 0x2f, 0x00, // move.l d0,-(a7) - 0x2f, 0x08, // move.l a0,-(a7) - 0x2f, 0x09, // move.l a1,-(a7) - 0x2f, 0x0a, // move.l a2,-(a7) - 0x3f, 0x3c, 0x00, 0x05, // (FindSymbol) - 0xaa, 0x5a, // CFMDispatch - 0x30, 0x1f, // move.w (a7)+,d0 - M68K_RTS >> 8, M68K_RTS & 0xff - }; - BUILD_SHEEPSHAVER_PROCEDURE(proc2); - r.d[0] = conn_id.value(); - r.a[0] = sym.addr(); - r.a[1] = sym_addr.addr(); - r.a[2] = sym_class.addr(); - Execute68k(proc2, &r); - D(bug(" FindSymbol1: ret %d, sym_addr %p, sym_class %ld\n", (int16)r.d[0], sym_addr.value(), sym_class.value())); -//!! CloseConnection()? - if (r.d[0]) - return 0; - else - return sym_addr.value(); - - } else { - - if (GetSharedLibrary == NULL || FindSymbol == NULL) { - printf("FATAL: FindLibSymbol() called too early\n"); - return 0; - } - int16 res; - res = GetSharedLibrary(lib.addr(), FOURCC('p','w','p','c'), 1, conn_id.addr(), main_addr.addr(), err.addr()); - D(bug(" GetSharedLibrary: ret %d, connection ID %ld, main %p\n", res, conn_id.value(), main_addr.value())); - if (res) - return 0; - res = FindSymbol(conn_id.value(), sym.addr(), sym_addr.addr(), sym_class.addr()); - D(bug(" FindSymbol: ret %d, sym_addr %p, sym_class %ld\n", res, sym_addr.value(), sym_class.value())); -//!!?? CloseConnection(&conn_id); - if (res) - return 0; - else - return sym_addr.value(); - } -} - - -/* - * Find CallUniversalProc() TVector - */ - -void InitCallUniversalProc() -{ - cu_tvect = FindLibSymbol("\014InterfaceLib", "\021CallUniversalProc"); - D(bug("CallUniversalProc TVECT at %08lx\n", cu_tvect)); - if (cu_tvect == 0) { - printf("FATAL: Can't find CallUniversalProc()\n"); - QuitEmulator(); - } - - gsl_tvect = FindLibSymbol("\014InterfaceLib", "\020GetSharedLibrary"); - D(bug("GetSharedLibrary TVECT at %08lx\n", gsl_tvect)); - if (gsl_tvect == 0) { - printf("FATAL: Can't find GetSharedLibrary()\n"); - QuitEmulator(); - } - - fs_tvect = FindLibSymbol("\014InterfaceLib", "\012FindSymbol"); - D(bug("FindSymbol TVECT at %08lx\n", fs_tvect)); - if (fs_tvect == 0) { - printf("FATAL: Can't find FindSymbol()\n"); - QuitEmulator(); - } - - cc_tvect = FindLibSymbol("\014InterfaceLib", "\017CloseConnection"); - D(bug("CloseConnection TVECT at %08lx\n", cc_tvect)); - if (cc_tvect == 0) { - printf("FATAL: Can't find CloseConnection()\n"); - QuitEmulator(); - } - - nps_tvect = FindLibSymbol("\014InterfaceLib", "\011NewPtrSys"); - D(bug("NewPtrSys TVECT at %08lx\n", nps_tvect)); - if (nps_tvect == 0) { - printf("FATAL: Can't find NewPtrSys()\n"); - QuitEmulator(); - } - - d_tvect = FindLibSymbol("\014InterfaceLib", "\012DisposePtr"); - D(bug("DisposePtr TVECT at %08lx\n", d_tvect)); - if (d_tvect == 0) { - printf("FATAL: Can't find DisposePtr()\n"); - QuitEmulator(); - } -} - - -/* - * CallUniversalProc - */ - -long CallUniversalProc(void *upp, uint32 info) -{ - if (cu_tvect == 0) { - printf("FATAL: CallUniversalProc() called too early\n"); - return 0; - } - return CallUniversal(upp, info); -} - - -/* - * Convert time_t value to MacOS time (seconds since 1.1.1904) - */ - -uint32 TimeToMacTime(time_t t) -{ - // This code is taken from glibc 2.2 - - // Convert to number of seconds elapsed since 1-Jan-1904 - struct tm *local = localtime(&t); - const int TM_EPOCH_YEAR = 1900; - const int MAC_EPOCH_YEAR = 1904; - int a4 = ((local->tm_year + TM_EPOCH_YEAR) >> 2) - !(local->tm_year & 3); - int b4 = (MAC_EPOCH_YEAR >> 2) - !(MAC_EPOCH_YEAR & 3); - int a100 = a4 / 25 - (a4 % 25 < 0); - int b100 = b4 / 25 - (b4 % 25 < 0); - int a400 = a100 >> 2; - int b400 = b100 >> 2; - int intervening_leap_days = (a4 - b4) - (a100 - b100) + (a400 - b400); - uint32 days = local->tm_yday + 365 * (local->tm_year - 4) + intervening_leap_days; - return local->tm_sec + 60 * (local->tm_min + 60 * (local->tm_hour + 24 * days)); -} - - -/* - * Memory allocators in MacOS system heap zone - */ - -uint32 Mac_sysalloc(uint32 size) -{ - return NewPtrSys(size); -} - -void Mac_sysfree(uint32 addr) -{ - DisposePtr(addr); -} diff --git a/SheepShaver/src/main.cpp b/SheepShaver/src/main.cpp deleted file mode 100644 index 1224fbe1..00000000 --- a/SheepShaver/src/main.cpp +++ /dev/null @@ -1,326 +0,0 @@ -/* - * main.cpp - ROM patches - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" - -#include "main.h" -#include "version.h" -#include "prefs.h" -#include "prefs_editor.h" -#include "cpu_emulation.h" -#include "emul_op.h" -#include "xlowmem.h" -#include "xpram.h" -#include "timer.h" -#include "adb.h" -#include "sony.h" -#include "disk.h" -#include "cdrom.h" -#include "scsi.h" -#include "video.h" -#include "audio.h" -#include "ether.h" -#include "serial.h" -#include "clip.h" -#include "extfs.h" -#include "sys.h" -#include "macos_util.h" -#include "rom_patches.h" -#include "user_strings.h" -#include "vm_alloc.h" -#include "sigsegv.h" -#include "thunks.h" - -#define DEBUG 0 -#include "debug.h" - -#ifdef ENABLE_MON -#include "mon.h" - -static uint32 sheepshaver_read_byte(uintptr adr) -{ - return ReadMacInt8(adr); -} - -static void sheepshaver_write_byte(uintptr adr, uint32 b) -{ - WriteMacInt8(adr, b); -} -#endif - - -/* - * Initialize everything, returns false on error - */ - -bool InitAll(const char *vmdir) -{ - // Load NVRAM - XPRAMInit(vmdir); - - // Load XPRAM default values if signature not found - if (XPRAM[0x130c] != 0x4e || XPRAM[0x130d] != 0x75 - || XPRAM[0x130e] != 0x4d || XPRAM[0x130f] != 0x63) { - D(bug("Loading XPRAM default values\n")); - memset(XPRAM + 0x1300, 0, 0x100); - XPRAM[0x130c] = 0x4e; // "NuMc" signature - XPRAM[0x130d] = 0x75; - XPRAM[0x130e] = 0x4d; - XPRAM[0x130f] = 0x63; - XPRAM[0x1301] = 0x80; // InternalWaitFlags = DynWait (don't wait for SCSI devices upon bootup) - XPRAM[0x1310] = 0xa8; // Standard PRAM values - XPRAM[0x1311] = 0x00; - XPRAM[0x1312] = 0x00; - XPRAM[0x1313] = 0x22; - XPRAM[0x1314] = 0xcc; - XPRAM[0x1315] = 0x0a; - XPRAM[0x1316] = 0xcc; - XPRAM[0x1317] = 0x0a; - XPRAM[0x131c] = 0x00; - XPRAM[0x131d] = 0x02; - XPRAM[0x131e] = 0x63; - XPRAM[0x131f] = 0x00; - XPRAM[0x1308] = 0x13; - XPRAM[0x1309] = 0x88; - XPRAM[0x130a] = 0x00; - XPRAM[0x130b] = 0xcc; - XPRAM[0x1376] = 0x00; // OSDefault = MacOS - XPRAM[0x1377] = 0x01; - XPRAM[0x138a] = 0x25; // Use PPC memory manager ("Modern Memory Manager") - } - - // Set boot volume - int16 i16 = PrefsFindInt32("bootdrive"); - XPRAM[0x1378] = i16 >> 8; - XPRAM[0x1379] = i16 & 0xff; - i16 = PrefsFindInt32("bootdriver"); - XPRAM[0x137a] = i16 >> 8; - XPRAM[0x137b] = i16 & 0xff; - - // Create BootGlobs at top of Mac memory - memset(RAMBaseHost + RAMSize - 4096, 0, 4096); - BootGlobsAddr = RAMBase + RAMSize - 0x1c; - WriteMacInt32(BootGlobsAddr - 5 * 4, RAMBase + RAMSize); // MemTop - WriteMacInt32(BootGlobsAddr + 0 * 4, RAMBase); // First RAM bank - WriteMacInt32(BootGlobsAddr + 1 * 4, RAMSize); - WriteMacInt32(BootGlobsAddr + 2 * 4, (uint32)-1); // End of bank table - - // Init thunks - if (!ThunksInit()) - return false; - - // Init drivers - SonyInit(); - DiskInit(); - CDROMInit(); - SCSIInit(); - - // Init external file system - ExtFSInit(); - - // Init ADB - ADBInit(); - - // Init audio - AudioInit(); - - // Init network - EtherInit(); - - // Init serial ports - SerialInit(); - - // Init Time Manager - TimerInit(); - - // Init clipboard - ClipInit(); - - // Init video - if (!VideoInit()) - return false; - - // Install ROM patches - if (!PatchROM()) { - ErrorAlert(GetString(STR_UNSUPPORTED_ROM_TYPE_ERR)); - return false; - } - - // Initialize Kernel Data - KernelData *kernel_data = (KernelData *)Mac2HostAddr(KERNEL_DATA_BASE); - memset(kernel_data, 0, sizeof(KernelData)); - if (ROMType == ROMTYPE_NEWWORLD) { - uint32 of_dev_tree = SheepMem::Reserve(4 * sizeof(uint32)); - Mac_memset(of_dev_tree, 0, 4 * sizeof(uint32)); - uint32 vector_lookup_tbl = SheepMem::Reserve(128); - uint32 vector_mask_tbl = SheepMem::Reserve(64); - memset((uint8 *)kernel_data + 0xb80, 0x3d, 0x80); - Mac_memset(vector_lookup_tbl, 0, 128); - Mac_memset(vector_mask_tbl, 0, 64); - kernel_data->v[0xb80 >> 2] = htonl(ROMBase); - kernel_data->v[0xb84 >> 2] = htonl(of_dev_tree); // OF device tree base - kernel_data->v[0xb90 >> 2] = htonl(vector_lookup_tbl); - kernel_data->v[0xb94 >> 2] = htonl(vector_mask_tbl); - kernel_data->v[0xb98 >> 2] = htonl(ROMBase); // OpenPIC base - kernel_data->v[0xbb0 >> 2] = htonl(0); // ADB base - kernel_data->v[0xc20 >> 2] = htonl(RAMSize); - kernel_data->v[0xc24 >> 2] = htonl(RAMSize); - kernel_data->v[0xc30 >> 2] = htonl(RAMSize); - kernel_data->v[0xc34 >> 2] = htonl(RAMSize); - kernel_data->v[0xc38 >> 2] = htonl(0x00010020); - kernel_data->v[0xc3c >> 2] = htonl(0x00200001); - kernel_data->v[0xc40 >> 2] = htonl(0x00010000); - kernel_data->v[0xc50 >> 2] = htonl(RAMBase); - kernel_data->v[0xc54 >> 2] = htonl(RAMSize); - kernel_data->v[0xf60 >> 2] = htonl(PVR); - kernel_data->v[0xf64 >> 2] = htonl(CPUClockSpeed); // clock-frequency - kernel_data->v[0xf68 >> 2] = htonl(BusClockSpeed); // bus-frequency - kernel_data->v[0xf6c >> 2] = htonl(TimebaseSpeed); // timebase-frequency - } else if (ROMType == ROMTYPE_GOSSAMER) { - kernel_data->v[0xc80 >> 2] = htonl(RAMSize); - kernel_data->v[0xc84 >> 2] = htonl(RAMSize); - kernel_data->v[0xc90 >> 2] = htonl(RAMSize); - kernel_data->v[0xc94 >> 2] = htonl(RAMSize); - kernel_data->v[0xc98 >> 2] = htonl(0x00010020); - kernel_data->v[0xc9c >> 2] = htonl(0x00200001); - kernel_data->v[0xca0 >> 2] = htonl(0x00010000); - kernel_data->v[0xcb0 >> 2] = htonl(RAMBase); - kernel_data->v[0xcb4 >> 2] = htonl(RAMSize); - kernel_data->v[0xf60 >> 2] = htonl(PVR); - kernel_data->v[0xf64 >> 2] = htonl(CPUClockSpeed); // clock-frequency - kernel_data->v[0xf68 >> 2] = htonl(BusClockSpeed); // bus-frequency - kernel_data->v[0xf6c >> 2] = htonl(TimebaseSpeed); // timebase-frequency - } else { - kernel_data->v[0xc80 >> 2] = htonl(RAMSize); - kernel_data->v[0xc84 >> 2] = htonl(RAMSize); - kernel_data->v[0xc90 >> 2] = htonl(RAMSize); - kernel_data->v[0xc94 >> 2] = htonl(RAMSize); - kernel_data->v[0xc98 >> 2] = htonl(0x00010020); - kernel_data->v[0xc9c >> 2] = htonl(0x00200001); - kernel_data->v[0xca0 >> 2] = htonl(0x00010000); - kernel_data->v[0xcb0 >> 2] = htonl(RAMBase); - kernel_data->v[0xcb4 >> 2] = htonl(RAMSize); - kernel_data->v[0xf80 >> 2] = htonl(PVR); - kernel_data->v[0xf84 >> 2] = htonl(CPUClockSpeed); // clock-frequency - kernel_data->v[0xf88 >> 2] = htonl(BusClockSpeed); // bus-frequency - kernel_data->v[0xf8c >> 2] = htonl(TimebaseSpeed); // timebase-frequency - } - - // Initialize extra low memory - D(bug("Initializing Low Memory...\n")); - Mac_memset(0, 0, 0x3000); - WriteMacInt32(XLM_SIGNATURE, FOURCC('B','a','a','h')); // Signature to detect SheepShaver - WriteMacInt32(XLM_KERNEL_DATA, KernelDataAddr); // For trap replacement routines - WriteMacInt32(XLM_PVR, PVR); // Theoretical PVR - WriteMacInt32(XLM_BUS_CLOCK, BusClockSpeed); // For DriverServicesLib patch - WriteMacInt16(XLM_EXEC_RETURN_OPCODE, M68K_EXEC_RETURN); // For Execute68k() (RTS from the executed 68k code will jump here and end 68k mode) - WriteMacInt32(XLM_ZERO_PAGE, SheepMem::ZeroPage()); // Pointer to read-only page with all bits set to 0 -#if !EMULATED_PPC -#ifdef SYSTEM_CLOBBERS_R2 - WriteMacInt32(XLM_TOC, (uint32)TOC); // TOC pointer of emulator -#endif -#ifdef SYSTEM_CLOBBERS_R13 - WriteMacInt32(XLM_R13, (uint32)R13); // TLS register -#endif -#endif - - WriteMacInt32(XLM_ETHER_AO_GET_HWADDR, NativeFunction(NATIVE_ETHER_AO_GET_HWADDR)); // Low level ethernet driver functions - WriteMacInt32(XLM_ETHER_AO_ADD_MULTI, NativeFunction(NATIVE_ETHER_AO_ADD_MULTI)); - WriteMacInt32(XLM_ETHER_AO_DEL_MULTI, NativeFunction(NATIVE_ETHER_AO_DEL_MULTI)); - WriteMacInt32(XLM_ETHER_AO_SEND_PACKET, NativeFunction(NATIVE_ETHER_AO_SEND_PACKET)); - - WriteMacInt32(XLM_ETHER_INIT, NativeFunction(NATIVE_ETHER_INIT)); // DLPI ethernet driver functions - WriteMacInt32(XLM_ETHER_TERM, NativeFunction(NATIVE_ETHER_TERM)); - WriteMacInt32(XLM_ETHER_OPEN, NativeFunction(NATIVE_ETHER_OPEN)); - WriteMacInt32(XLM_ETHER_CLOSE, NativeFunction(NATIVE_ETHER_CLOSE)); - WriteMacInt32(XLM_ETHER_WPUT, NativeFunction(NATIVE_ETHER_WPUT)); - WriteMacInt32(XLM_ETHER_RSRV, NativeFunction(NATIVE_ETHER_RSRV)); - WriteMacInt32(XLM_VIDEO_DOIO, NativeFunction(NATIVE_VIDEO_DO_DRIVER_IO)); - D(bug("Low Memory initialized\n")); - -#if ENABLE_MON - // Initialize mon - mon_init(); - mon_read_byte = sheepshaver_read_byte; - mon_write_byte = sheepshaver_write_byte; -#endif - - return true; -} - - -/* - * Deinitialize everything - */ - -void ExitAll(void) -{ -#if ENABLE_MON - // Deinitialize mon - mon_exit(); -#endif - - // Save NVRAM - XPRAMExit(); - - // Exit clipboard - ClipExit(); - - // Exit Time Manager - TimerExit(); - - // Exit serial - SerialExit(); - - // Exit network - EtherExit(); - - // Exit audio - AudioExit(); - - // Exit ADB - ADBExit(); - - // Exit video - VideoExit(); - - // Exit external file system - ExtFSExit(); - - // Exit drivers - SCSIExit(); - CDROMExit(); - DiskExit(); - SonyExit(); - - // Delete thunks - ThunksExit(); -} - - -/* - * Patch things after system startup (gets called by disk driver accRun routine) - */ - -void PatchAfterStartup(void) -{ - ExecuteNative(NATIVE_VIDEO_INSTALL_ACCEL); - InstallExtFS(); -} diff --git a/SheepShaver/src/name_registry.cpp b/SheepShaver/src/name_registry.cpp deleted file mode 100644 index 89819d6d..00000000 --- a/SheepShaver/src/name_registry.cpp +++ /dev/null @@ -1,368 +0,0 @@ -/* - * name_registry.cpp - Name Registry handling - * - * SheepShaver (C) Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -#include "sysdeps.h" -#include "name_registry.h" -#include "main.h" -#include "macos_util.h" -#include "user_strings.h" -#include "emul_op.h" -#include "thunks.h" - -#define DEBUG 0 -#include "debug.h" - - -// Function pointers -typedef int16 (*rcec_ptr)(const RegEntryID *, const char *, RegEntryID *); -static uint32 rcec_tvect = 0; -static inline int16 RegistryCStrEntryCreate(uintptr arg1, const char *arg2, uint32 arg3) -{ - SheepString arg2str(arg2); - return (int16)CallMacOS3(rcec_ptr, rcec_tvect, (const RegEntryID *)arg1, arg2str.addr(), arg3); -} -typedef int16 (*rpc_ptr)(const RegEntryID *, const char *, const void *, uint32); -static uint32 rpc_tvect = 0; -static inline int16 RegistryPropertyCreate(uintptr arg1, const char *arg2, uintptr arg3, uint32 arg4) -{ - SheepString arg2str(arg2); - return (int16)CallMacOS4(rpc_ptr, rpc_tvect, (const RegEntryID *)arg1, arg2str.addr(), (const void *)arg3, arg4); -} -static inline int16 RegistryPropertyCreateStr(uintptr arg1, const char *arg2, const char *arg3) -{ - SheepString arg3str(arg3); - return RegistryPropertyCreate(arg1, arg2, arg3str.addr(), strlen(arg3) + 1); -} - -// Video driver stub -static const uint8 video_driver[] = { -#include "VideoDriverStub.i" -}; - -// Ethernet driver stub -static const uint8 ethernet_driver[] = { -#ifdef USE_ETHER_FULL_DRIVER -#include "EthernetDriverFull.i" -#else -#include "EthernetDriverStub.i" -#endif -}; - -// Helper for RegEntryID -typedef SheepArray SheepRegEntryID; - -// Helper for a pair -struct SheepPair : public SheepArray<8> { - SheepPair(uint32 base, uint32 size) : SheepArray<8>() - { WriteMacInt32(addr(), base); WriteMacInt32(addr() + 4, size); } -}; - - -/* - * Patch Name Registry during startup - */ - -void DoPatchNameRegistry(void) -{ - SheepVar32 u32; - D(bug("Patching Name Registry...")); - - // Create "device-tree" - SheepRegEntryID device_tree; - if (!RegistryCStrEntryCreate(0, "Devices:device-tree", device_tree.addr())) { - u32.set_value(BusClockSpeed); - RegistryPropertyCreate(device_tree.addr(), "clock-frequency", u32.addr(), 4); - RegistryPropertyCreateStr(device_tree.addr(), "model", "Power Macintosh"); - - // Create "AAPL,ROM" - SheepRegEntryID aapl_rom; - if (!RegistryCStrEntryCreate(device_tree.addr(), "AAPL,ROM", aapl_rom.addr())) { - RegistryPropertyCreateStr(aapl_rom.addr(), "device_type", "rom"); - SheepPair reg(ROMBase, ROM_SIZE); - RegistryPropertyCreate(aapl_rom.addr(), "reg", reg.addr(), 8); - } - - // Create "PowerPC,60x" - SheepRegEntryID power_pc; - const char *str; - switch (PVR >> 16) { - case 1: // 601 - str = "PowerPC,601"; - break; - case 3: // 603 - str = "PowerPC,603"; - break; - case 4: // 604 - str = "PowerPC,604"; - break; - case 6: // 603e - str = "PowerPC,603e"; - break; - case 7: // 603ev - str = "PowerPC,603ev"; - break; - case 8: // 750 - str = "PowerPC,750"; - break; - case 9: // 604e - str = "PowerPC,604e"; - break; - case 10: // 604ev5 - str = "PowerPC,604ev"; - break; - case 50: // 821 - str = "PowerPC,821"; - break; - case 80: // 860 - str = "PowerPC,860"; - break; - case 12: // 7400, 7410, 7450, 7455, 7457 - case 0x800c: - case 0x8000: - case 0x8001: - case 0x8002: - str = "PowerPC,G4"; - break; - default: - str = "PowerPC,???"; - break; - } - if (!RegistryCStrEntryCreate(device_tree.addr(), str, power_pc.addr())) { - u32.set_value(CPUClockSpeed); - RegistryPropertyCreate(power_pc.addr(), "clock-frequency", u32.addr(), 4); - u32.set_value(BusClockSpeed); - RegistryPropertyCreate(power_pc.addr(), "bus-frequency", u32.addr(), 4); - u32.set_value(TimebaseSpeed); - RegistryPropertyCreate(power_pc.addr(), "timebase-frequency", u32.addr(), 4); - u32.set_value(PVR); - RegistryPropertyCreate(power_pc.addr(), "cpu-version", u32.addr(), 4); - RegistryPropertyCreateStr(power_pc.addr(), "device_type", "cpu"); - switch (PVR >> 16) { - case 1: // 601 - u32.set_value(64); - RegistryPropertyCreate(power_pc.addr(), "d-cache-block-size", u32.addr(), 4); - u32.set_value(128); - RegistryPropertyCreate(power_pc.addr(), "d-cache-sets", u32.addr(), 4); - u32.set_value(0x8000); - RegistryPropertyCreate(power_pc.addr(), "d-cache-size", u32.addr(), 4); - u32.set_value(64); - RegistryPropertyCreate(power_pc.addr(), "i-cache-block-size", u32.addr(), 4); - u32.set_value(128); - RegistryPropertyCreate(power_pc.addr(), "i-cache-sets", u32.addr(), 4); - u32.set_value(0x8000); - RegistryPropertyCreate(power_pc.addr(), "i-cache-size", u32.addr(), 4); - u32.set_value(128); - RegistryPropertyCreate(power_pc.addr(), "tlb-sets", u32.addr(), 4); - u32.set_value(256); - RegistryPropertyCreate(power_pc.addr(), "tlb-size", u32.addr(), 4); - break; - case 3: // 603 - u32.set_value(32); - RegistryPropertyCreate(power_pc.addr(), "d-cache-block-size", u32.addr(), 4); - u32.set_value(64); - RegistryPropertyCreate(power_pc.addr(), "d-cache-sets", u32.addr(), 4); - u32.set_value(0x2000); - RegistryPropertyCreate(power_pc.addr(), "d-cache-size", u32.addr(), 4); - u32.set_value(32); - RegistryPropertyCreate(power_pc.addr(), "i-cache-block-size", u32.addr(), 4); - u32.set_value(64); - RegistryPropertyCreate(power_pc.addr(), "i-cache-sets", u32.addr(), 4); - u32.set_value(0x2000); - RegistryPropertyCreate(power_pc.addr(), "i-cache-size", u32.addr(), 4); - u32.set_value(32); - RegistryPropertyCreate(power_pc.addr(), "tlb-sets", u32.addr(), 4); - u32.set_value(64); - RegistryPropertyCreate(power_pc.addr(), "tlb-size", u32.addr(), 4); - break; - case 4: // 604 - u32.set_value(32); - RegistryPropertyCreate(power_pc.addr(), "d-cache-block-size", u32.addr(), 4); - u32.set_value(128); - RegistryPropertyCreate(power_pc.addr(), "d-cache-sets", u32.addr(), 4); - u32.set_value(0x4000); - RegistryPropertyCreate(power_pc.addr(), "d-cache-size", u32.addr(), 4); - u32.set_value(32); - RegistryPropertyCreate(power_pc.addr(), "i-cache-block-size", u32.addr(), 4); - u32.set_value(128); - RegistryPropertyCreate(power_pc.addr(), "i-cache-sets", u32.addr(), 4); - u32.set_value(0x4000); - RegistryPropertyCreate(power_pc.addr(), "i-cache-size", u32.addr(), 4); - u32.set_value(64); - RegistryPropertyCreate(power_pc.addr(), "tlb-sets", u32.addr(), 4); - u32.set_value(128); - RegistryPropertyCreate(power_pc.addr(), "tlb-size", u32.addr(), 4); - break; - case 6: // 603e - case 7: // 603ev - u32.set_value(32); - RegistryPropertyCreate(power_pc.addr(), "d-cache-block-size", u32.addr(), 4); - u32.set_value(128); - RegistryPropertyCreate(power_pc.addr(), "d-cache-sets", u32.addr(), 4); - u32.set_value(0x4000); - RegistryPropertyCreate(power_pc.addr(), "d-cache-size", u32.addr(), 4); - u32.set_value(32); - RegistryPropertyCreate(power_pc.addr(), "i-cache-block-size", u32.addr(), 4); - u32.set_value(128); - RegistryPropertyCreate(power_pc.addr(), "i-cache-sets", u32.addr(), 4); - u32.set_value(0x4000); - RegistryPropertyCreate(power_pc.addr(), "i-cache-size", u32.addr(), 4); - u32.set_value(32); - RegistryPropertyCreate(power_pc.addr(), "tlb-sets", u32.addr(), 4); - u32.set_value(64); - RegistryPropertyCreate(power_pc.addr(), "tlb-size", u32.addr(), 4); - break; - case 8: // 750, 750FX - case 0x7000: - u32.set_value(32); - RegistryPropertyCreate(power_pc.addr(), "d-cache-block-size", u32.addr(), 4); - u32.set_value(256); - RegistryPropertyCreate(power_pc.addr(), "d-cache-sets", u32.addr(), 4); - u32.set_value(0x8000); - RegistryPropertyCreate(power_pc.addr(), "d-cache-size", u32.addr(), 4); - u32.set_value(32); - RegistryPropertyCreate(power_pc.addr(), "i-cache-block-size", u32.addr(), 4); - u32.set_value(256); - RegistryPropertyCreate(power_pc.addr(), "i-cache-sets", u32.addr(), 4); - u32.set_value(0x8000); - RegistryPropertyCreate(power_pc.addr(), "i-cache-size", u32.addr(), 4); - u32.set_value(64); - RegistryPropertyCreate(power_pc.addr(), "tlb-sets", u32.addr(), 4); - u32.set_value(128); - RegistryPropertyCreate(power_pc.addr(), "tlb-size", u32.addr(), 4); - break; - case 9: // 604e - case 10: // 604ev5 - u32.set_value(32); - RegistryPropertyCreate(power_pc.addr(), "d-cache-block-size", u32.addr(), 4); - u32.set_value(256); - RegistryPropertyCreate(power_pc.addr(), "d-cache-sets", u32.addr(), 4); - u32.set_value(0x8000); - RegistryPropertyCreate(power_pc.addr(), "d-cache-size", u32.addr(), 4); - u32.set_value(32); - RegistryPropertyCreate(power_pc.addr(), "i-cache-block-size", u32.addr(), 4); - u32.set_value(256); - RegistryPropertyCreate(power_pc.addr(), "i-cache-sets", u32.addr(), 4); - u32.set_value(0x8000); - RegistryPropertyCreate(power_pc.addr(), "i-cache-size", u32.addr(), 4); - u32.set_value(64); - RegistryPropertyCreate(power_pc.addr(), "tlb-sets", u32.addr(), 4); - u32.set_value(128); - RegistryPropertyCreate(power_pc.addr(), "tlb-size", u32.addr(), 4); - break; - case 12: // 7400, 7410, 7450, 7455, 7457 - case 0x800c: - case 0x8000: - case 0x8001: - case 0x8002: - u32.set_value(32); - RegistryPropertyCreate(power_pc.addr(), "d-cache-block-size", u32.addr(), 4); - u32.set_value(128); - RegistryPropertyCreate(power_pc.addr(), "d-cache-sets", u32.addr(), 4); - u32.set_value(0x8000); - RegistryPropertyCreate(power_pc.addr(), "d-cache-size", u32.addr(), 4); - u32.set_value(32); - RegistryPropertyCreate(power_pc.addr(), "i-cache-block-size", u32.addr(), 4); - u32.set_value(128); - RegistryPropertyCreate(power_pc.addr(), "i-cache-sets", u32.addr(), 4); - u32.set_value(0x8000); - RegistryPropertyCreate(power_pc.addr(), "i-cache-size", u32.addr(), 4); - u32.set_value(64); - RegistryPropertyCreate(power_pc.addr(), "tlb-sets", u32.addr(), 4); - u32.set_value(128); - RegistryPropertyCreate(power_pc.addr(), "tlb-size", u32.addr(), 4); - break; - case 0x39: // 970 - u32.set_value(128); - RegistryPropertyCreate(power_pc.addr(), "d-cache-block-size", u32.addr(), 4); - u32.set_value(128); - RegistryPropertyCreate(power_pc.addr(), "d-cache-sets", u32.addr(), 4); - u32.set_value(0x8000); - RegistryPropertyCreate(power_pc.addr(), "d-cache-size", u32.addr(), 4); - u32.set_value(128); - RegistryPropertyCreate(power_pc.addr(), "i-cache-block-size", u32.addr(), 4); - u32.set_value(512); - RegistryPropertyCreate(power_pc.addr(), "i-cache-sets", u32.addr(), 4); - u32.set_value(0x10000); - RegistryPropertyCreate(power_pc.addr(), "i-cache-size", u32.addr(), 4); - u32.set_value(256); - RegistryPropertyCreate(power_pc.addr(), "tlb-sets", u32.addr(), 4); - u32.set_value(0x1000); - RegistryPropertyCreate(power_pc.addr(), "tlb-size", u32.addr(), 4); - break; - default: - break; - } - u32.set_value(32); - RegistryPropertyCreate(power_pc.addr(), "reservation-granularity", u32.addr(), 4); - SheepPair reg(0, 0); - RegistryPropertyCreate(power_pc.addr(), "reg", reg.addr(), 8); - } - - // Create "memory" - SheepRegEntryID memory; - if (!RegistryCStrEntryCreate(device_tree.addr(), "memory", memory.addr())) { - SheepPair reg(RAMBase, RAMSize); - RegistryPropertyCreateStr(memory.addr(), "device_type", "memory"); - RegistryPropertyCreate(memory.addr(), "reg", reg.addr(), 8); - } - - // Create "video" - SheepRegEntryID video; - if (!RegistryCStrEntryCreate(device_tree.addr(), "video", video.addr())) { - RegistryPropertyCreateStr(video.addr(), "AAPL,connector", "monitor"); - RegistryPropertyCreateStr(video.addr(), "device_type", "display"); - SheepArray the_video_driver; - Host2Mac_memcpy(the_video_driver.addr(), video_driver, sizeof(video_driver)); - RegistryPropertyCreate(video.addr(), "driver,AAPL,MacOS,PowerPC", the_video_driver.addr(), sizeof(video_driver)); - RegistryPropertyCreateStr(video.addr(), "model", "SheepShaver Video"); - } - - // Create "ethernet" - SheepRegEntryID ethernet; - if (!RegistryCStrEntryCreate(device_tree.addr(), "ethernet", ethernet.addr())) { - RegistryPropertyCreateStr(ethernet.addr(), "AAPL,connector", "ethernet"); - RegistryPropertyCreateStr(ethernet.addr(), "device_type", "network"); - SheepArray the_ethernet_driver; - Host2Mac_memcpy(the_ethernet_driver.addr(), ethernet_driver, sizeof(ethernet_driver)); - RegistryPropertyCreate(ethernet.addr(), "driver,AAPL,MacOS,PowerPC", the_ethernet_driver.addr(), sizeof(ethernet_driver)); - // local-mac-address - // max-frame-size 2048 - } - } - D(bug("done.\n")); -} - -void PatchNameRegistry(void) -{ - // Find RegistryCStrEntryCreate() and RegistryPropertyCreate() TVECTs - rcec_tvect = FindLibSymbol("\017NameRegistryLib", "\027RegistryCStrEntryCreate"); - D(bug("RegistryCStrEntryCreate TVECT at %08x\n", rcec_tvect)); - rpc_tvect = FindLibSymbol("\017NameRegistryLib", "\026RegistryPropertyCreate"); - D(bug("RegistryPropertyCreate TVECT at %08x\n", rpc_tvect)); - if (rcec_tvect == 0 || rpc_tvect == 0) { - ErrorAlert(GetString(STR_NO_NAME_REGISTRY_ERR)); - QuitEmulator(); - } - - // Main routine must be executed in PPC mode - ExecuteNative(NATIVE_PATCH_NAME_REGISTRY); -} diff --git a/SheepShaver/src/pict.c b/SheepShaver/src/pict.c deleted file mode 120000 index bcbd7ff4..00000000 --- a/SheepShaver/src/pict.c +++ /dev/null @@ -1 +0,0 @@ -../../BasiliskII/src/pict.c \ No newline at end of file diff --git a/SheepShaver/src/prefs.cpp b/SheepShaver/src/prefs.cpp deleted file mode 120000 index 6559f3b1..00000000 --- a/SheepShaver/src/prefs.cpp +++ /dev/null @@ -1 +0,0 @@ -../../BasiliskII/src/prefs.cpp \ No newline at end of file diff --git a/SheepShaver/src/prefs_items.cpp b/SheepShaver/src/prefs_items.cpp deleted file mode 100644 index 1d4758dc..00000000 --- a/SheepShaver/src/prefs_items.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * prefs_items.cpp - Common preferences items - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" - -#include "sys.h" -#include "prefs.h" - - -// Common preferences items (those which exist on all platforms) -prefs_desc common_prefs_items[] = { - {"disk", TYPE_STRING, true, "device/file name of Mac volume"}, - {"floppy", TYPE_STRING, true, "device/file name of Mac floppy drive"}, - {"cdrom", TYPE_STRING, true, "device/file names of Mac CD-ROM drive"}, - {"extfs", TYPE_STRING, false, "root path of ExtFS"}, - {"scsi0", TYPE_STRING, false, "SCSI target for Mac SCSI ID 0"}, - {"scsi1", TYPE_STRING, false, "SCSI target for Mac SCSI ID 1"}, - {"scsi2", TYPE_STRING, false, "SCSI target for Mac SCSI ID 2"}, - {"scsi3", TYPE_STRING, false, "SCSI target for Mac SCSI ID 3"}, - {"scsi4", TYPE_STRING, false, "SCSI target for Mac SCSI ID 4"}, - {"scsi5", TYPE_STRING, false, "SCSI target for Mac SCSI ID 5"}, - {"scsi6", TYPE_STRING, false, "SCSI target for Mac SCSI ID 6"}, - {"screen", TYPE_STRING, false, "video mode"}, - {"windowmodes", TYPE_INT32, false, "bitmap of allowed window video modes"}, - {"screenmodes", TYPE_INT32, false, "bitmap of allowed fullscreen video modes"}, - {"seriala", TYPE_STRING, false, "device name of Mac serial port A"}, - {"serialb", TYPE_STRING, false, "device name of Mac serial port B"}, - {"rom", TYPE_STRING, false, "path of ROM file"}, - {"bootdrive", TYPE_INT32, false, "boot drive number"}, - {"bootdriver", TYPE_INT32, false, "boot driver number"}, - {"ramsize", TYPE_INT32, false, "size of Mac RAM in bytes"}, - {"frameskip", TYPE_INT32, false, "number of frames to skip in refreshed video modes"}, - {"gfxaccel", TYPE_BOOLEAN, false, "turn on QuickDraw acceleration"}, - {"nocdrom", TYPE_BOOLEAN, false, "don't install CD-ROM driver"}, - {"nonet", TYPE_BOOLEAN, false, "don't use Ethernet"}, - {"nosound", TYPE_BOOLEAN, false, "don't enable sound output"}, - {"nogui", TYPE_BOOLEAN, false, "disable GUI"}, - {"noclipconversion", TYPE_BOOLEAN, false, "don't convert clipboard contents"}, - {"ignoresegv", TYPE_BOOLEAN, false, "ignore illegal memory accesses"}, - {"ignoreillegal", TYPE_BOOLEAN, false, "ignore illegal instructions"}, - {"jit", TYPE_BOOLEAN, false, "enable JIT compiler"}, - {"jit68k", TYPE_BOOLEAN, false, "enable 68k DR emulator"}, - {"keyboardtype", TYPE_INT32, false, "hardware keyboard type"}, - {NULL, TYPE_END, false, NULL} // End of list -}; - -/* - * Set default values for preferences items - */ - -void AddPrefsDefaults(void) -{ -#ifndef PREFS_EDITOR - SysAddSerialPrefs(); -#endif - PrefsAddInt32("bootdriver", 0); - PrefsAddInt32("bootdrive", 0); - PrefsAddInt32("ramsize", 16 * 1024 * 1024); - PrefsAddInt32("frameskip", 8); - PrefsAddBool("gfxaccel", true); - PrefsAddBool("nocdrom", false); - PrefsAddBool("nonet", false); - PrefsAddBool("nosound", false); - PrefsAddBool("nogui", false); - PrefsAddBool("noclipconversion", false); - PrefsAddBool("ignoresegv", false); - PrefsAddBool("ignoreillegal", false); - -#if USE_JIT - // JIT compiler specific options - PrefsAddBool("jit", true); -#else - PrefsAddBool("jit", false); -#endif - PrefsAddBool("jit68k", false); - - PrefsAddInt32("keyboardtype", 5); -} diff --git a/SheepShaver/src/rom_patches.cpp b/SheepShaver/src/rom_patches.cpp deleted file mode 100644 index 9dcd826a..00000000 --- a/SheepShaver/src/rom_patches.cpp +++ /dev/null @@ -1,2499 +0,0 @@ -/* - * rom_patches.cpp - ROM patches - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * TODO: - * IRQ_NEST must be handled atomically - * Don't use r1 in extra routines - */ - -#include - -#include "sysdeps.h" -#include "rom_patches.h" -#include "main.h" -#include "prefs.h" -#include "cpu_emulation.h" -#include "emul_op.h" -#include "xlowmem.h" -#include "sony.h" -#include "disk.h" -#include "cdrom.h" -#include "audio.h" -#include "audio_defs.h" -#include "serial.h" -#include "macos_util.h" -#include "thunks.h" - -#define DEBUG 0 -#include "debug.h" - - -// 68k breakpoint address -//#define M68K_BREAK_POINT 0x29e0 // BootMe -//#define M68K_BREAK_POINT 0x2a1e // Boot block code returned -//#define M68K_BREAK_POINT 0x3150 // CritError -//#define M68K_BREAK_POINT 0x187ce // Unimplemented trap - -// PowerPC breakpoint address -//#define POWERPC_BREAK_POINT 0x36e6c0 // 68k emulator start - -#define DISABLE_SCSI 1 - - -// Other ROM addresses -const uint32 CHECK_LOAD_PATCH_SPACE = 0x2fcf00; -const uint32 ZERO_SCRAP_PATCH_SPACE = 0x2fcf80; -const uint32 PUT_SCRAP_PATCH_SPACE = 0x2fcfc0; -const uint32 GET_SCRAP_PATCH_SPACE = 0x2fd100; -const uint32 ADDR_MAP_PATCH_SPACE = 0x2fd140; - -// Global variables -int ROMType; // ROM type -static uint32 sony_offset; // Offset of .Sony driver resource - -// Prototypes -static bool patch_nanokernel_boot(void); -static bool patch_68k_emul(void); -static bool patch_nanokernel(void); -static bool patch_68k(void); - - -// Decode LZSS data -static void decode_lzss(const uint8 *src, uint8 *dest, int size) -{ - char dict[0x1000]; - int run_mask = 0, dict_idx = 0xfee; - for (;;) { - if (run_mask < 0x100) { - // Start new run - if (--size < 0) - break; - run_mask = *src++ | 0xff00; - } - bool bit = run_mask & 1; - run_mask >>= 1; - if (bit) { - // Verbatim copy - if (--size < 0) - break; - int c = *src++; - dict[dict_idx++] = c; - *dest++ = c; - dict_idx &= 0xfff; - } else { - // Copy from dictionary - if (--size < 0) - break; - int idx = *src++; - if (--size < 0) - break; - int cnt = *src++; - idx |= (cnt << 4) & 0xf00; - cnt = (cnt & 0x0f) + 3; - while (cnt--) { - char c = dict[idx++]; - dict[dict_idx++] = c; - *dest++ = c; - idx &= 0xfff; - dict_idx &= 0xfff; - } - } - } -} - -// Decode parcels of ROM image (MacOS 9.X and even earlier) -void decode_parcels(const uint8 *src, uint8 *dest, int size) -{ - uint32 parcel_offset = 0x14; - D(bug("Offset Type Name\n")); - while (parcel_offset != 0) { - const uint32 *parcel_data = (uint32 *)(src + parcel_offset); - uint32 next_offset = ntohl(parcel_data[0]); - uint32 parcel_type = ntohl(parcel_data[1]); - D(bug("%08x %c%c%c%c %s\n", parcel_offset, - (parcel_type >> 24) & 0xff, (parcel_type >> 16) & 0xff, - (parcel_type >> 8) & 0xff, parcel_type & 0xff, &parcel_data[6])); - if (parcel_type == FOURCC('r','o','m',' ')) { - uint32 lzss_offset = ntohl(parcel_data[2]); - uint32 lzss_size = ((uintptr)src + next_offset) - ((uintptr)parcel_data + lzss_offset); - decode_lzss((uint8 *)parcel_data + lzss_offset, dest, lzss_size); - } - parcel_offset = next_offset; - } -} - - -/* - * Decode ROM image, 4 MB plain images or NewWorld images - */ - -bool DecodeROM(uint8 *data, uint32 size) -{ - if (size == ROM_SIZE) { - // Plain ROM image - memcpy(ROMBaseHost, data, ROM_SIZE); - return true; - } - else if (strncmp((char *)data, "", 11) == 0) { - // CHRP compressed ROM image - uint32 image_offset, image_size; - bool decode_info_ok = false; - - char *s = strstr((char *)data, "constant lzss-offset"); - if (s != NULL) { - // Probably a plain LZSS compressed ROM image - if (sscanf(s - 7, "%06x", &image_offset) == 1) { - s = strstr((char *)data, "constant lzss-size"); - if (s != NULL && (sscanf(s - 7, "%06x", &image_size) == 1)) - decode_info_ok = true; - } - } - else { - // Probably a MacOS 9.2.x ROM image - s = strstr((char *)data, "constant parcels-offset"); - if (s != NULL) { - if (sscanf(s - 7, "%06x", &image_offset) == 1) { - s = strstr((char *)data, "constant parcels-size"); - if (s != NULL && (sscanf(s - 7, "%06x", &image_size) == 1)) - decode_info_ok = true; - } - } - } - - // No valid information to decode the ROM found? - if (!decode_info_ok) - return false; - - // Check signature, this could be a parcels-based ROM image - uint32 rom_signature = ntohl(*(uint32 *)(data + image_offset)); - if (rom_signature == FOURCC('p','r','c','l')) { - D(bug("Offset of parcels data: %08x\n", image_offset)); - D(bug("Size of parcels data: %08x\n", image_size)); - decode_parcels(data + image_offset, ROMBaseHost, image_size); - } - else { - D(bug("Offset of compressed data: %08x\n", image_offset)); - D(bug("Size of compressed data: %08x\n", image_size)); - decode_lzss(data + image_offset, ROMBaseHost, image_size); - } - return true; - } - return false; -} - - -/* - * Search ROM for byte string, return ROM offset (or 0) - */ - -static uint32 find_rom_data(uint32 start, uint32 end, const uint8 *data, uint32 data_len) -{ - uint32 ofs = start; - while (ofs < end) { - if (!memcmp(ROMBaseHost + ofs, data, data_len)) - return ofs; - ofs++; - } - return 0; -} - - -/* - * Search ROM resource by type/ID, return ROM offset of resource data - */ - -static uint32 rsrc_ptr = 0; - -// id = 4711 means "find any ID" -static uint32 find_rom_resource(uint32 s_type, int16 s_id = 4711, bool cont = false) -{ - uint32 lp = ROMBase + 0x1a; - uint32 x = ReadMacInt32(lp); - uint32 header_size = ReadMacInt8(ROMBase + x + 5); - - if (!cont) - rsrc_ptr = x; - else if (rsrc_ptr == 0) - return 0; - - for (;;) { - lp = ROMBase + rsrc_ptr; - rsrc_ptr = ReadMacInt32(lp); - if (rsrc_ptr == 0) - break; - - rsrc_ptr += header_size; - - lp = ROMBase + rsrc_ptr + 4; - uint32 data = ReadMacInt32(lp); - uint32 type = ReadMacInt32(lp + 4); - int16 id = ReadMacInt16(lp + 8); - if (type == s_type && (id == s_id || s_id == 4711)) - return data; - } - return 0; -} - - -/* - * Search offset of A-Trap routine in ROM - */ - -static uint32 find_rom_trap(uint16 trap) -{ - uint32 lp = ROMBase + ReadMacInt32(ROMBase + 0x22); - - if (trap > 0xa800) - return ReadMacInt32(lp + 4 * (trap & 0x3ff)); - else - return ReadMacInt32(lp + 4 * ((trap & 0xff) + 0x400)); -} - - -/* - * Return target of branch instruction specified at ADDR, or 0 if - * there is no such instruction - */ - -static uint32 rom_powerpc_branch_target(uint32 addr) -{ - uint32 opcode = ntohl(*(uint32 *)(ROMBaseHost + addr)); - uint32 primop = opcode >> 26; - uint32 target = 0; - - if (primop == 18) { // Branch - target = opcode & 0x3fffffc; - if (target & 0x2000000) - target |= 0xfc000000; - if ((opcode & 2) == 0) - target += addr; - } - else if (primop == 16) { // Branch Conditional - target = (int32)(int16)(opcode & 0xfffc); - if ((opcode & 2) == 0) - target += addr; - } - return target; -} - - -/* - * Search ROM for instruction branching to target address, return 0 if none found - */ - -static uint32 find_rom_powerpc_branch(uint32 start, uint32 end, uint32 target) -{ - for (uint32 addr = start; addr < end; addr += 4) { - if (rom_powerpc_branch_target(addr) == target) - return addr; - } - return 0; -} - - -/* - * Check that requested ROM patch space is really available - */ - -static bool check_rom_patch_space(uint32 base, uint32 size) -{ - size = (size + 3) & -4; - for (int i = 0; i < size; i += 4) { - uint32 x = ntohl(*(uint32 *)(ROMBaseHost + base + i)); - if (x != 0x6b636b63 && x != 0) - return false; - } - return true; -} - - -/* - * List of audio sifters installed in ROM and System file - */ - -struct sift_entry { - uint32 type; - int16 id; -}; -static sift_entry sifter_list[32]; -static int num_sifters; - -void AddSifter(uint32 type, int16 id) -{ - if (FindSifter(type, id)) - return; - D(bug(" adding sifter type %c%c%c%c (%08x), id %d\n", type >> 24, (type >> 16) & 0xff, (type >> 8) & 0xff, type & 0xff, type, id)); - sifter_list[num_sifters].type = type; - sifter_list[num_sifters].id = id; - num_sifters++; -} - -bool FindSifter(uint32 type, int16 id) -{ - for (int i=0; i> 8, SonyDriverFlags & 0xff, 0, 0, 0, 0, 0, 0, - 0x00, 0x18, // Open() offset - 0x00, 0x1c, // Prime() offset - 0x00, 0x20, // Control() offset - 0x00, 0x2c, // Status() offset - 0x00, 0x52, // Close() offset - 0x05, 0x2e, 0x53, 0x6f, 0x6e, 0x79, // ".Sony" - - // Open() - M68K_EMUL_OP_SONY_OPEN >> 8, M68K_EMUL_OP_SONY_OPEN & 0xff, - 0x4e, 0x75, // rts - - // Prime() - M68K_EMUL_OP_SONY_PRIME >> 8, M68K_EMUL_OP_SONY_PRIME & 0xff, - 0x60, 0x0e, // bra IOReturn - - // Control() - M68K_EMUL_OP_SONY_CONTROL >> 8, M68K_EMUL_OP_SONY_CONTROL & 0xff, - 0x0c, 0x68, 0x00, 0x01, 0x00, 0x1a, // cmp.w #1,$1a(a0) - 0x66, 0x04, // bne IOReturn - 0x4e, 0x75, // rts - - // Status() - M68K_EMUL_OP_SONY_STATUS >> 8, M68K_EMUL_OP_SONY_STATUS & 0xff, - - // IOReturn - 0x32, 0x28, 0x00, 0x06, // move.w 6(a0),d1 - 0x08, 0x01, 0x00, 0x09, // btst #9,d1 - 0x67, 0x0c, // beq 1 - 0x4a, 0x40, // tst.w d0 - 0x6f, 0x02, // ble 2 - 0x42, 0x40, // clr.w d0 - 0x31, 0x40, 0x00, 0x10, //2 move.w d0,$10(a0) - 0x4e, 0x75, // rts - 0x4a, 0x40, //1 tst.w d0 - 0x6f, 0x04, // ble 3 - 0x42, 0x40, // clr.w d0 - 0x4e, 0x75, // rts - 0x2f, 0x38, 0x08, 0xfc, //3 move.l $8fc,-(sp) - 0x4e, 0x75, // rts - - // Close() - 0x70, 0xe8, // moveq #-24,d0 - 0x4e, 0x75 // rts -}; - -static const uint8 disk_driver[] = { // Generic disk driver - // Driver header - DiskDriverFlags >> 8, DiskDriverFlags & 0xff, 0, 0, 0, 0, 0, 0, - 0x00, 0x18, // Open() offset - 0x00, 0x1c, // Prime() offset - 0x00, 0x20, // Control() offset - 0x00, 0x2c, // Status() offset - 0x00, 0x52, // Close() offset - 0x05, 0x2e, 0x44, 0x69, 0x73, 0x6b, // ".Disk" - - // Open() - M68K_EMUL_OP_DISK_OPEN >> 8, M68K_EMUL_OP_DISK_OPEN & 0xff, - 0x4e, 0x75, // rts - - // Prime() - M68K_EMUL_OP_DISK_PRIME >> 8, M68K_EMUL_OP_DISK_PRIME & 0xff, - 0x60, 0x0e, // bra IOReturn - - // Control() - M68K_EMUL_OP_DISK_CONTROL >> 8, M68K_EMUL_OP_DISK_CONTROL & 0xff, - 0x0c, 0x68, 0x00, 0x01, 0x00, 0x1a, // cmp.w #1,$1a(a0) - 0x66, 0x04, // bne IOReturn - 0x4e, 0x75, // rts - - // Status() - M68K_EMUL_OP_DISK_STATUS >> 8, M68K_EMUL_OP_DISK_STATUS & 0xff, - - // IOReturn - 0x32, 0x28, 0x00, 0x06, // move.w 6(a0),d1 - 0x08, 0x01, 0x00, 0x09, // btst #9,d1 - 0x67, 0x0c, // beq 1 - 0x4a, 0x40, // tst.w d0 - 0x6f, 0x02, // ble 2 - 0x42, 0x40, // clr.w d0 - 0x31, 0x40, 0x00, 0x10, //2 move.w d0,$10(a0) - 0x4e, 0x75, // rts - 0x4a, 0x40, //1 tst.w d0 - 0x6f, 0x04, // ble 3 - 0x42, 0x40, // clr.w d0 - 0x4e, 0x75, // rts - 0x2f, 0x38, 0x08, 0xfc, //3 move.l $8fc,-(sp) - 0x4e, 0x75, // rts - - // Close() - 0x70, 0xe8, // moveq #-24,d0 - 0x4e, 0x75 // rts -}; - -static const uint8 cdrom_driver[] = { // CD-ROM driver - // Driver header - CDROMDriverFlags >> 8, CDROMDriverFlags & 0xff, 0, 0, 0, 0, 0, 0, - 0x00, 0x1c, // Open() offset - 0x00, 0x20, // Prime() offset - 0x00, 0x24, // Control() offset - 0x00, 0x30, // Status() offset - 0x00, 0x56, // Close() offset - 0x08, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x43, 0x44, 0x00, // ".AppleCD" - - // Open() - M68K_EMUL_OP_CDROM_OPEN >> 8, M68K_EMUL_OP_CDROM_OPEN & 0xff, - 0x4e, 0x75, // rts - - // Prime() - M68K_EMUL_OP_CDROM_PRIME >> 8, M68K_EMUL_OP_CDROM_PRIME & 0xff, - 0x60, 0x0e, // bra IOReturn - - // Control() - M68K_EMUL_OP_CDROM_CONTROL >> 8, M68K_EMUL_OP_CDROM_CONTROL & 0xff, - 0x0c, 0x68, 0x00, 0x01, 0x00, 0x1a, // cmp.w #1,$1a(a0) - 0x66, 0x04, // bne IOReturn - 0x4e, 0x75, // rts - - // Status() - M68K_EMUL_OP_CDROM_STATUS >> 8, M68K_EMUL_OP_CDROM_STATUS & 0xff, - - // IOReturn - 0x32, 0x28, 0x00, 0x06, // move.w 6(a0),d1 - 0x08, 0x01, 0x00, 0x09, // btst #9,d1 - 0x67, 0x0c, // beq 1 - 0x4a, 0x40, // tst.w d0 - 0x6f, 0x02, // ble 2 - 0x42, 0x40, // clr.w d0 - 0x31, 0x40, 0x00, 0x10, //2 move.w d0,$10(a0) - 0x4e, 0x75, // rts - 0x4a, 0x40, //1 tst.w d0 - 0x6f, 0x04, // ble 3 - 0x42, 0x40, // clr.w d0 - 0x4e, 0x75, // rts - 0x2f, 0x38, 0x08, 0xfc, //3 move.l $8fc,-(sp) - 0x4e, 0x75, // rts - - // Close() - 0x70, 0xe8, // moveq #-24,d0 - 0x4e, 0x75 // rts -}; - -static uint32 long_ptr; - -static void SetLongBase(uint32 addr) -{ - long_ptr = addr; -} - -static void Long(uint32 value) -{ - WriteMacInt32(long_ptr, value); - long_ptr += 4; -} - -static void gen_ain_driver(uintptr addr) -{ - SetLongBase(addr); - - // .AIn driver header - Long(0x4d000000); Long(0x00000000); - Long(0x00200040); Long(0x00600080); - Long(0x00a0042e); Long(0x41496e00); - Long(0x00000000); Long(0x00000000); - Long(0xaafe0700); Long(0x00000000); - Long(0x00000000); Long(0x00179822); - Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_NOTHING)); - Long(0x00000000); Long(0x00000000); - Long(0xaafe0700); Long(0x00000000); - Long(0x00000000); Long(0x00179822); - Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_PRIME_IN)); - Long(0x00000000); Long(0x00000000); - Long(0xaafe0700); Long(0x00000000); - Long(0x00000000); Long(0x00179822); - Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_CONTROL)); - Long(0x00000000); Long(0x00000000); - Long(0xaafe0700); Long(0x00000000); - Long(0x00000000); Long(0x00179822); - Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_STATUS)); - Long(0x00000000); Long(0x00000000); - Long(0xaafe0700); Long(0x00000000); - Long(0x00000000); Long(0x00179822); - Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_NOTHING)); - Long(0x00000000); Long(0x00000000); -}; - -static void gen_aout_driver(uintptr addr) -{ - SetLongBase(addr); - - // .AOut driver header - Long(0x4d000000); Long(0x00000000); - Long(0x00200040); Long(0x00600080); - Long(0x00a0052e); Long(0x414f7574); - Long(0x00000000); Long(0x00000000); - Long(0xaafe0700); Long(0x00000000); - Long(0x00000000); Long(0x00179822); - Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_OPEN)); - Long(0x00000000); Long(0x00000000); - Long(0xaafe0700); Long(0x00000000); - Long(0x00000000); Long(0x00179822); - Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_PRIME_OUT)); - Long(0x00000000); Long(0x00000000); - Long(0xaafe0700); Long(0x00000000); - Long(0x00000000); Long(0x00179822); - Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_CONTROL)); - Long(0x00000000); Long(0x00000000); - Long(0xaafe0700); Long(0x00000000); - Long(0x00000000); Long(0x00179822); - Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_STATUS)); - Long(0x00000000); Long(0x00000000); - Long(0xaafe0700); Long(0x00000000); - Long(0x00000000); Long(0x00179822); - Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_CLOSE)); - Long(0x00000000); Long(0x00000000); -}; - -static void gen_bin_driver(uintptr addr) -{ - SetLongBase(addr); - - // .BIn driver header - Long(0x4d000000); Long(0x00000000); - Long(0x00200040); Long(0x00600080); - Long(0x00a0042e); Long(0x42496e00); - Long(0x00000000); Long(0x00000000); - Long(0xaafe0700); Long(0x00000000); - Long(0x00000000); Long(0x00179822); - Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_NOTHING)); - Long(0x00000000); Long(0x00000000); - Long(0xaafe0700); Long(0x00000000); - Long(0x00000000); Long(0x00179822); - Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_PRIME_IN)); - Long(0x00000000); Long(0x00000000); - Long(0xaafe0700); Long(0x00000000); - Long(0x00000000); Long(0x00179822); - Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_CONTROL)); - Long(0x00000000); Long(0x00000000); - Long(0xaafe0700); Long(0x00000000); - Long(0x00000000); Long(0x00179822); - Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_STATUS)); - Long(0x00000000); Long(0x00000000); - Long(0xaafe0700); Long(0x00000000); - Long(0x00000000); Long(0x00179822); - Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_NOTHING)); - Long(0x00000000); Long(0x00000000); -}; - -static void gen_bout_driver(uintptr addr) -{ - SetLongBase(addr); - - // .BOut driver header - Long(0x4d000000); Long(0x00000000); - Long(0x00200040); Long(0x00600080); - Long(0x00a0052e); Long(0x424f7574); - Long(0x00000000); Long(0x00000000); - Long(0xaafe0700); Long(0x00000000); - Long(0x00000000); Long(0x00179822); - Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_OPEN)); - Long(0x00000000); Long(0x00000000); - Long(0xaafe0700); Long(0x00000000); - Long(0x00000000); Long(0x00179822); - Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_PRIME_OUT)); - Long(0x00000000); Long(0x00000000); - Long(0xaafe0700); Long(0x00000000); - Long(0x00000000); Long(0x00179822); - Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_CONTROL)); - Long(0x00000000); Long(0x00000000); - Long(0xaafe0700); Long(0x00000000); - Long(0x00000000); Long(0x00179822); - Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_STATUS)); - Long(0x00000000); Long(0x00000000); - Long(0xaafe0700); Long(0x00000000); - Long(0x00000000); Long(0x00179822); - Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_CLOSE)); - Long(0x00000000); Long(0x00000000); -}; - -static const uint8 adbop_patch[] = { // Call ADBOp() completion procedure - // The completion procedure may call ADBOp() again! - 0x40, 0xe7, // move sr,-(sp) - 0x00, 0x7c, 0x07, 0x00, // ori #$0700,sr - M68K_EMUL_OP_ADBOP >> 8, M68K_EMUL_OP_ADBOP & 0xff, - 0x48, 0xe7, 0x70, 0xf0, // movem.l d1-d3/a0-a3,-(sp) - 0x26, 0x48, // move.l a0,a3 - 0x4a, 0xab, 0x00, 0x04, // tst.l 4(a3) - 0x67, 0x00, 0x00, 0x18, // beq 1 - 0x20, 0x53, // move.l (a3),a0 - 0x22, 0x6b, 0x00, 0x04, // move.l 4(a3),a1 - 0x24, 0x6b, 0x00, 0x08, // move.l 8(a3),a2 - 0x26, 0x78, 0x0c, 0xf8, // move.l $cf8,a3 - 0x4e, 0x91, // jsr (a1) - 0x70, 0x00, // moveq #0,d0 - 0x60, 0x00, 0x00, 0x04, // bra 2 - 0x70, 0xff, //1 moveq #-1,d0 - 0x4c, 0xdf, 0x0f, 0x0e, //2 movem.l (sp)+,d1-d3/a0-a3 - 0x46, 0xdf, // move (sp)+,sr - 0x4e, 0x75 // rts -}; - - -/* - * Copy PowerPC code to ROM image and reverse bytes if necessary - */ - -static inline void memcpy_powerpc_code(void *dst, const void *src, size_t len) -{ -#ifdef WORDS_BIGENDIAN - (void)memcpy(dst, src, len); -#else - uint32 *d = (uint32 *)dst; - uint32 *s = (uint32 *)src; - for (int i = 0; i < len/4; i++) - d[i] = htonl(s[i]); -#endif -} - - -/* - * Install ROM patches (RAMBase and KernelDataAddr must be set) - */ - -bool PatchROM(void) -{ - // Print ROM info - D(bug("Checksum: %08lx\n", ntohl(*(uint32 *)ROMBaseHost))); - D(bug("Version: %04x\n", ntohs(*(uint16 *)(ROMBaseHost + 8)))); - D(bug("Sub Version: %04x\n", ntohs(*(uint16 *)(ROMBaseHost + 18)))); - D(bug("Nanokernel ID: %s\n", (char *)ROMBaseHost + 0x30d064)); - D(bug("Resource Map at %08lx\n", ntohl(*(uint32 *)(ROMBaseHost + 26)))); - D(bug("Trap Tables at %08lx\n\n", ntohl(*(uint32 *)(ROMBaseHost + 34)))); - - // Detect ROM type - if (!memcmp(ROMBaseHost + 0x30d064, "Boot TNT", 8)) - ROMType = ROMTYPE_TNT; - else if (!memcmp(ROMBaseHost + 0x30d064, "Boot Alchemy", 12)) - ROMType = ROMTYPE_ALCHEMY; - else if (!memcmp(ROMBaseHost + 0x30d064, "Boot Zanzibar", 13)) - ROMType = ROMTYPE_ZANZIBAR; - else if (!memcmp(ROMBaseHost + 0x30d064, "Boot Gazelle", 12)) - ROMType = ROMTYPE_GAZELLE; - else if (!memcmp(ROMBaseHost + 0x30d064, "Boot Gossamer", 13)) - ROMType = ROMTYPE_GOSSAMER; - else if (!memcmp(ROMBaseHost + 0x30d064, "NewWorld", 8)) - ROMType = ROMTYPE_NEWWORLD; - else - return false; - - // Check that other ROM addresses point to really free regions - if (!check_rom_patch_space(CHECK_LOAD_PATCH_SPACE, 0x40)) - return false; - if (!check_rom_patch_space(ZERO_SCRAP_PATCH_SPACE, 0x40)) - return false; - if (!check_rom_patch_space(PUT_SCRAP_PATCH_SPACE, 0x40)) - return false; - if (!check_rom_patch_space(GET_SCRAP_PATCH_SPACE, 0x40)) - return false; - if (!check_rom_patch_space(ADDR_MAP_PATCH_SPACE - 10 * 4, 0x100)) - return false; - - // Apply patches - if (!patch_nanokernel_boot()) return false; - if (!patch_68k_emul()) return false; - if (!patch_nanokernel()) return false; - if (!patch_68k()) return false; - -#ifdef M68K_BREAK_POINT - // Install 68k breakpoint - uint16 *wp = (uint16 *)(ROMBaseHost + M68K_BREAK_POINT); - *wp++ = htons(M68K_EMUL_BREAK); - *wp = htons(M68K_EMUL_RETURN); -#endif - -#ifdef POWERPC_BREAK_POINT - // Install PowerPC breakpoint - uint32 *lp = (uint32 *)(ROMBaseHost + POWERPC_BREAK_POINT); - *lp = htonl(0); -#endif - - // Copy 68k emulator to 2MB boundary - memcpy(ROMBaseHost + ROM_SIZE, ROMBaseHost + (ROM_SIZE - 0x100000), 0x100000); - return true; -} - - -/* - * Nanokernel boot routine patches - */ - -static bool patch_nanokernel_boot(void) -{ - uint32 *lp; - uint32 base, loc; - - // ROM boot structure patches - lp = (uint32 *)(ROMBaseHost + 0x30d000); - lp[0x9c >> 2] = htonl(KernelDataAddr); // LA_InfoRecord - lp[0xa0 >> 2] = htonl(KernelDataAddr); // LA_KernelData - lp[0xa4 >> 2] = htonl(KernelDataAddr + 0x1000); // LA_EmulatorData - lp[0xa8 >> 2] = htonl(ROMBase + 0x480000); // LA_DispatchTable - lp[0xac >> 2] = htonl(ROMBase + 0x460000); // LA_EmulatorCode - lp[0x360 >> 2] = htonl(0); // Physical RAM base (? on NewWorld ROM, this contains -1) - lp[0xfd8 >> 2] = htonl(ROMBase + 0x2a); // 68k reset vector - - // Skip SR/BAT/SDR init - loc = 0x310000; - if (ROMType == ROMTYPE_GAZELLE || ROMType == ROMTYPE_GOSSAMER || ROMType == ROMTYPE_NEWWORLD) { - lp = (uint32 *)(ROMBaseHost + loc); - *lp++ = htonl(POWERPC_NOP); - *lp = htonl(0x38000000); - } - static const uint8 sr_init_dat[] = {0x35, 0x4a, 0xff, 0xfc, 0x7d, 0x86, 0x50, 0x2e}; - if ((base = find_rom_data(0x3101b0, 0x3105b0, sr_init_dat, sizeof(sr_init_dat))) == 0) return false; - D(bug("sr_init %08lx\n", base)); - lp = (uint32 *)(ROMBaseHost + loc + 8); - *lp = htonl(0x48000000 | ((base - loc - 8) & 0x3fffffc)); // b ROMBase+0x3101b0 - lp = (uint32 *)(ROMBaseHost + base); - *lp++ = htonl(0x80200000 + XLM_KERNEL_DATA); // lwz r1,(pointer to Kernel Data) - *lp++ = htonl(0x3da0dead); // lis r13,0xdead (start of kernel memory) - *lp++ = htonl(0x3dc00010); // lis r14,0x0010 (size of page table) - *lp = htonl(0x3de00010); // lis r15,0x0010 (size of kernel memory) - - // Don't read PVR - static const uint8 pvr_read_dat[] = {0x7d, 0x9f, 0x42, 0xa6}; - if ((base = find_rom_data(0x3103b0, 0x3108b0, pvr_read_dat, sizeof(pvr_read_dat))) == 0) return false; - D(bug("pvr_read %08lx\n", base)); - lp = (uint32 *)(ROMBaseHost + base); - *lp = htonl(0x81800000 + XLM_PVR); // lwz r12,(theoretical PVR) - - // Set CPU specific data (even if ROM doesn't have support for that CPU) - if (ntohl(lp[6]) != 0x2c0c0001) - return false; - uint32 ofs = ntohl(lp[7]) & 0xffff; - D(bug("ofs %08lx\n", ofs)); - lp[8] = htonl((ntohl(lp[8]) & 0xffff) | 0x48000000); // beq -> b - loc = (ntohl(lp[8]) & 0xffff) + (uintptr)(lp+8) - (uintptr)ROMBaseHost; - D(bug("loc %08lx\n", loc)); - lp = (uint32 *)(ROMBaseHost + ofs + 0x310000); - switch (PVR >> 16) { - case 1: // 601 - lp[0] = htonl(0x1000); // Page size - lp[1] = htonl(0x8000); // Data cache size - lp[2] = htonl(0x8000); // Inst cache size - lp[3] = htonl(0x00200020); // Coherency block size/Reservation granule size - lp[4] = htonl(0x00010040); // Unified caches/Inst cache line size - lp[5] = htonl(0x00400020); // Data cache line size/Data cache block size touch - lp[6] = htonl(0x00200020); // Inst cache block size/Data cache block size - lp[7] = htonl(0x00080008); // Inst cache assoc/Data cache assoc - lp[8] = htonl(0x01000002); // TLB total size/TLB assoc - break; - case 3: // 603 - lp[0] = htonl(0x1000); // Page size - lp[1] = htonl(0x2000); // Data cache size - lp[2] = htonl(0x2000); // Inst cache size - lp[3] = htonl(0x00200020); // Coherency block size/Reservation granule size - lp[4] = htonl(0x00000020); // Unified caches/Inst cache line size - lp[5] = htonl(0x00200020); // Data cache line size/Data cache block size touch - lp[6] = htonl(0x00200020); // Inst cache block size/Data cache block size - lp[7] = htonl(0x00020002); // Inst cache assoc/Data cache assoc - lp[8] = htonl(0x00400002); // TLB total size/TLB assoc - break; - case 4: // 604 - lp[0] = htonl(0x1000); // Page size - lp[1] = htonl(0x4000); // Data cache size - lp[2] = htonl(0x4000); // Inst cache size - lp[3] = htonl(0x00200020); // Coherency block size/Reservation granule size - lp[4] = htonl(0x00000020); // Unified caches/Inst cache line size - lp[5] = htonl(0x00200020); // Data cache line size/Data cache block size touch - lp[6] = htonl(0x00200020); // Inst cache block size/Data cache block size - lp[7] = htonl(0x00040004); // Inst cache assoc/Data cache assoc - lp[8] = htonl(0x00800002); // TLB total size/TLB assoc - break; -// case 5: // 740? - case 6: // 603e - case 7: // 603ev - lp[0] = htonl(0x1000); // Page size - lp[1] = htonl(0x4000); // Data cache size - lp[2] = htonl(0x4000); // Inst cache size - lp[3] = htonl(0x00200020); // Coherency block size/Reservation granule size - lp[4] = htonl(0x00000020); // Unified caches/Inst cache line size - lp[5] = htonl(0x00200020); // Data cache line size/Data cache block size touch - lp[6] = htonl(0x00200020); // Inst cache block size/Data cache block size - lp[7] = htonl(0x00040004); // Inst cache assoc/Data cache assoc - lp[8] = htonl(0x00400002); // TLB total size/TLB assoc - break; - case 8: // 750, 750FX - case 0x7000: - lp[0] = htonl(0x1000); // Page size - lp[1] = htonl(0x8000); // Data cache size - lp[2] = htonl(0x8000); // Inst cache size - lp[3] = htonl(0x00200020); // Coherency block size/Reservation granule size - lp[4] = htonl(0x00000020); // Unified caches/Inst cache line size - lp[5] = htonl(0x00200020); // Data cache line size/Data cache block size touch - lp[6] = htonl(0x00200020); // Inst cache block size/Data cache block size - lp[7] = htonl(0x00080008); // Inst cache assoc/Data cache assoc - lp[8] = htonl(0x00800002); // TLB total size/TLB assoc - break; - case 9: // 604e - case 10: // 604ev5 - lp[0] = htonl(0x1000); // Page size - lp[1] = htonl(0x8000); // Data cache size - lp[2] = htonl(0x8000); // Inst cache size - lp[3] = htonl(0x00200020); // Coherency block size/Reservation granule size - lp[4] = htonl(0x00000020); // Unified caches/Inst cache line size - lp[5] = htonl(0x00200020); // Data cache line size/Data cache block size touch - lp[6] = htonl(0x00200020); // Inst cache block size/Data cache block size - lp[7] = htonl(0x00040004); // Inst cache assoc/Data cache assoc - lp[8] = htonl(0x00800002); // TLB total size/TLB assoc - break; -// case 11: // X704? - case 12: // 7400, 7410, 7450, 7455, 7457 - case 0x800c: - case 0x8000: - case 0x8001: - case 0x8002: - lp[0] = htonl(0x1000); // Page size - lp[1] = htonl(0x8000); // Data cache size - lp[2] = htonl(0x8000); // Inst cache size - lp[3] = htonl(0x00200020); // Coherency block size/Reservation granule size - lp[4] = htonl(0x00000020); // Unified caches/Inst cache line size - lp[5] = htonl(0x00200020); // Data cache line size/Data cache block size touch - lp[6] = htonl(0x00200020); // Inst cache block size/Data cache block size - lp[7] = htonl(0x00080008); // Inst cache assoc/Data cache assoc - lp[8] = htonl(0x00800002); // TLB total size/TLB assoc - break; - case 13: // ??? - lp[0] = htonl(0x1000); // Page size - lp[1] = htonl(0x8000); // Data cache size - lp[2] = htonl(0x8000); // Inst cache size - lp[3] = htonl(0x00200020); // Coherency block size/Reservation granule size - lp[4] = htonl(0x00000020); // Unified caches/Inst cache line size - lp[5] = htonl(0x00200020); // Data cache line size/Data cache block size touch - lp[6] = htonl(0x00200020); // Inst cache block size/Data cache block size - lp[7] = htonl(0x00080008); // Inst cache assoc/Data cache assoc - lp[8] = htonl(0x01000004); // TLB total size/TLB assoc - break; -// case 50: // 821 -// case 80: // 860 - case 96: // ??? - lp[0] = htonl(0x1000); // Page size - lp[1] = htonl(0x8000); // Data cache size - lp[2] = htonl(0x8000); // Inst cache size - lp[3] = htonl(0x00200020); // Coherency block size/Reservation granule size - lp[4] = htonl(0x00010020); // Unified caches/Inst cache line size - lp[5] = htonl(0x00200020); // Data cache line size/Data cache block size touch - lp[6] = htonl(0x00200020); // Inst cache block size/Data cache block size - lp[7] = htonl(0x00080008); // Inst cache assoc/Data cache assoc - lp[8] = htonl(0x00800004); // TLB total size/TLB assoc - break; - case 0x39: // 970 - lp[0] = htonl(0x1000); // Page size - lp[1] = htonl(0x8000); // Data cache size - lp[2] = htonl(0x10000); // Inst cache size - lp[3] = htonl(0x00200020); // Coherency block size/Reservation granule size - lp[4] = htonl(0x00010020); // Unified caches/Inst cache line size - lp[5] = htonl(0x00200020); // Data cache line size/Data cache block size touch - lp[6] = htonl(0x00800080); // Inst cache block size/Data cache block size - lp[7] = htonl(0x00020002); // Inst cache assoc/Data cache assoc - lp[8] = htonl(0x02000004); // TLB total size/TLB assoc - break; - default: - printf("WARNING: Unknown CPU type\n"); - break; - } - - // Don't set SPRG3, don't test MQ - static const uint8 sprg3_mq_dat[] = {0x7d, 0x13, 0x43, 0xa6, 0x3d, 0x00, 0x00, 0x04, 0x7d, 0x00, 0x03, 0xa6, 0x39, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x02, 0xa6}; - if ((base = find_rom_data(loc + 0x20, loc + 0x60, sprg3_mq_dat, sizeof(sprg3_mq_dat))) == 0) return false; - D(bug("sprg3/mq %08lx\n", base)); - lp = (uint32 *)(ROMBaseHost + base); - lp[0] = htonl(POWERPC_NOP); - lp[2] = htonl(POWERPC_NOP); - lp[4] = htonl(POWERPC_NOP); - - // Don't read MSR - static const uint8 msr_dat[] = {0x7d, 0xc0, 0x00, 0xa6}; - if ((base = find_rom_data(loc + 0x40, loc + 0x80, msr_dat, sizeof(msr_dat))) == 0) return false; - D(bug("msr %08lx\n", base)); - lp = (uint32 *)(ROMBaseHost + base); - *lp = htonl(0x39c00000); // li r14,0 - - // Don't write to DEC - lp = (uint32 *)(ROMBaseHost + loc + 0x70); - *lp++ = htonl(POWERPC_NOP); - loc = (ntohl(lp[0]) & 0xffff) + (uintptr)lp - (uintptr)ROMBaseHost; - D(bug("loc %08lx\n", loc)); - - // Don't set SPRG3 - static const uint8 sprg3_dat[] = {0x39, 0x21, 0x03, 0x60, 0x7d, 0x33, 0x43, 0xa6, 0x39, 0x01, 0x04, 0x20}; - if ((base = find_rom_data(0x310000, 0x314000, sprg3_dat, sizeof(sprg3_dat))) == 0) return false; - D(bug("sprg3 %08lx\n", base + 4)); - lp = (uint32 *)(ROMBaseHost + base + 4); - *lp = htonl(POWERPC_NOP); - - // Don't read PVR - static const uint8 pvr_read2_dat[] = {0x7e, 0xff, 0x42, 0xa6, 0x56, 0xf7, 0x84, 0x3e}; - if ((base = find_rom_data(0x310000, 0x320000, pvr_read2_dat, sizeof(pvr_read2_dat))) == 0) return false; - D(bug("pvr_read2 %08lx\n", base)); - lp = (uint32 *)(ROMBaseHost + base); - *lp = htonl(0x82e00000 + XLM_PVR); // lwz r23,(theoretical PVR) - if ((base = find_rom_data(base + 4, 0x320000, pvr_read2_dat, sizeof(pvr_read2_dat))) != 0) { - D(bug("pvr_read2 %08lx\n", base)); - lp = (uint32 *)(ROMBaseHost + base); - *lp = htonl(0x82e00000 + XLM_PVR); // lwz r23,(theoretical PVR) - } - static const uint8 pvr_read3_dat[] = {0x7e, 0x5f, 0x42, 0xa6, 0x56, 0x52, 0x84, 0x3e}; - if ((base = find_rom_data(0x310000, 0x320000, pvr_read3_dat, sizeof(pvr_read3_dat))) != 0) { - D(bug("pvr_read3 %08lx\n", base)); - lp = (uint32 *)(ROMBaseHost + base); - *lp = htonl(0x82400000 + XLM_PVR); // lwz r18,(theoretical PVR) - } - static const uint8 pvr_read4_dat[] = {0x7d, 0x3f, 0x42, 0xa6, 0x55, 0x29, 0x84, 0x3e}; - if ((base = find_rom_data(0x310000, 0x320000, pvr_read4_dat, sizeof(pvr_read4_dat))) != 0) { - D(bug("pvr_read4 %08lx\n", base)); - lp = (uint32 *)(ROMBaseHost + base); - *lp = htonl(0x81200000 + XLM_PVR); // lzw r9,(theoritical PVR) - } - - // Don't read SDR1 - static const uint8 sdr1_read_dat[] = {0x7d, 0x19, 0x02, 0xa6, 0x55, 0x16, 0x81, 0xde}; - if ((base = find_rom_data(0x310000, 0x320000, sdr1_read_dat, sizeof(sdr1_read_dat))) == 0) return false; - D(bug("sdr1_read %08lx\n", base)); - lp = (uint32 *)(ROMBaseHost + base); - *lp++ = htonl(0x3d00dead); // lis r8,0xdead (pointer to page table) - *lp++ = htonl(0x3ec0001f); // lis r22,0x001f (size of page table) - *lp = htonl(POWERPC_NOP); - - // Don't clear page table, don't invalidate TLB - static const uint8 pgtb_clear_dat[] = {0x36, 0xd6, 0xff, 0xfc, 0x7e, 0xe8, 0xb1, 0x2e, 0x41, 0x81, 0xff, 0xf8}; - if ((base = find_rom_data(0x310000, 0x320000, pgtb_clear_dat, sizeof(pgtb_clear_dat))) == 0) return false; - D(bug("pgtb_clear %08lx\n", base + 4)); - lp = (uint32 *)(ROMBaseHost + base + 4); - *lp = htonl(POWERPC_NOP); - D(bug("tblie %08lx\n", base + 12)); - lp = (uint32 *)(ROMBaseHost + base + 12); - *lp = htonl(POWERPC_NOP); - - // Don't create RAM descriptor table - static const uint8 desc_create_dat[] = {0x97, 0xfd, 0x00, 0x04, 0x3b, 0xff, 0x10, 0x00, 0x4b, 0xff, 0xff, 0xdc}; - if ((base = find_rom_data(0x310000, 0x320000, desc_create_dat, sizeof(desc_create_dat))) == 0) return false; - D(bug("desc_create %08lx\n", base)) - lp = (uint32 *)(ROMBaseHost + base); - *lp = htonl(POWERPC_NOP); - - // Don't load SRs and BATs - static const uint8 sr_load[] = {0x7c, 0x00, 0x04, 0xac, 0x83, 0x9d, 0x00, 0x00, 0x93, 0x81, 0x05, 0xe8}; - if ((loc = find_rom_data(0x310000, 0x320000, sr_load, sizeof(sr_load))) == 0) return false; - static const uint8 sr_load_caller[] = {0x3e, 0xd6, 0xff, 0xff, 0x41, 0x81, 0xff, 0xdc, 0xb2, 0xc8, 0x00, 0x02}; - if ((base = find_rom_data(0x310000, 0x320000, sr_load_caller, sizeof(sr_load_caller))) == 0) return false; - if ((base = find_rom_powerpc_branch(base + 12, 0x320000, loc)) == 0) return false; - D(bug("sr_load %08lx, called from %08lx\n", loc, base)); - lp = (uint32 *)(ROMBaseHost + base); - *lp = htonl(POWERPC_NOP); - - // Don't mess with SRs - static const uint8 sr_load2_dat[] = {0x83, 0xa1, 0x05, 0xe8, 0x57, 0x7c, 0x3e, 0x78, 0x7f, 0xbd, 0xe0, 0x2e}; - if ((base = find_rom_data(0x310000, 0x320000, sr_load2_dat, sizeof(sr_load2_dat))) == 0) return false; - D(bug("sr_load2 %08lx\n", base)); - lp = (uint32 *)(ROMBaseHost + base); - *lp = htonl(POWERPC_BLR); - - // Don't check performance monitor - static const uint8 pm_check_dat[] = {0x7e, 0x58, 0xeb, 0xa6, 0x7e, 0x53, 0x90, 0xf8, 0x7e, 0x78, 0xea, 0xa6}; - if ((base = find_rom_data(0x310000, 0x320000, pm_check_dat, sizeof(pm_check_dat))) == 0) return false; - D(bug("pm_check %08lx\n", base)); - lp = (uint32 *)(ROMBaseHost + base); - - static const int spr_check_list[] = { - 952 /* mmcr0 */, 953 /* pmc1 */, 954 /* pmc2 */, 955 /* sia */, - 956 /* mmcr1 */, 957 /* pmc3 */, 958 /* pmc4 */, 959 /* sda */ - }; - - for (int i = 0; i < sizeof(spr_check_list)/sizeof(spr_check_list[0]); i++) { - int spr = spr_check_list[i]; - uint32 mtspr = 0x7e4003a6 | ((spr & 0x1f) << 16) | ((spr & 0x3e0) << 6); - uint32 mfspr = 0x7e6002a6 | ((spr & 0x1f) << 16) | ((spr & 0x3e0) << 6); - for (int ofs = 0; ofs < 64; ofs++) { - if (ntohl(lp[ofs]) == mtspr) { - if (ntohl(lp[ofs + 2]) != mfspr) - return false; - D(bug(" SPR%d %08lx\n", spr, base + 4*ofs)); - lp[ofs] = htonl(POWERPC_NOP); - lp[ofs + 2] = htonl(POWERPC_NOP); - } - } - } - - // Jump to 68k emulator - static const uint8 jump68k_dat[] = {0x7d, 0x92, 0x43, 0xa6, 0x7d, 0x5a, 0x03, 0xa6, 0x7d, 0x7b, 0x03, 0xa6}; - if ((loc = find_rom_data(0x310000, 0x320000, jump68k_dat, sizeof(jump68k_dat))) == 0) return false; - static const uint8 jump68k_caller_dat[] = {0x85, 0x13, 0x00, 0x08, 0x56, 0xbf, 0x50, 0x3e, 0x63, 0xff, 0x0c, 0x00}; - if ((base = find_rom_data(0x310000, 0x320000, jump68k_caller_dat, sizeof(jump68k_caller_dat))) == 0) return false; - if ((base = find_rom_powerpc_branch(base + 12, 0x320000, loc)) == 0) return false; - D(bug("jump68k %08lx, called from %08lx\n", loc, base)); - lp = (uint32 *)(ROMBaseHost + base); - *lp++ = htonl(0x80610634); // lwz r3,0x0634(r1) (pointer to Emulator Data) - *lp++ = htonl(0x8081119c); // lwz r4,0x119c(r1) (pointer to opcode table) - *lp++ = htonl(0x80011184); // lwz r0,0x1184(r1) (pointer to emulator init routine) - *lp++ = htonl(0x7c0903a6); // mtctr r0 - *lp = htonl(POWERPC_BCTR); - return true; -} - - -/* - * 68k emulator patches - */ - -static bool patch_68k_emul(void) -{ - uint32 *lp; - uint32 base, loc; - - // Overwrite twi instructions - static const uint8 twi_dat[] = {0x0f, 0xff, 0x00, 0x00, 0x0f, 0xff, 0x00, 0x01, 0x0f, 0xff, 0x00, 0x02}; - if ((base = find_rom_data(0x36e600, 0x36ea00, twi_dat, sizeof(twi_dat))) == 0) return false; - D(bug("twi %08lx\n", base)); - lp = (uint32 *)(ROMBaseHost + base); - *lp++ = htonl(0x48000000 + 0x36f900 - base); // b 0x36f900 (Emulator start) - *lp++ = htonl(0x48000000 + 0x36fa00 - base - 4); // b 0x36fa00 (Mixed mode) - *lp++ = htonl(0x48000000 + 0x36fb00 - base - 8); // b 0x36fb00 (Reset/FC1E opcode) - *lp++ = htonl(0x48000000 + 0x36fc00 - base - 12); // FE0A opcode - *lp++ = htonl(POWERPC_ILLEGAL); // Interrupt - *lp++ = htonl(0x48000000 + 0x36fd00 - base - 20); // FE0F opcode - *lp++ = htonl(POWERPC_ILLEGAL); - *lp++ = htonl(POWERPC_ILLEGAL); - *lp++ = htonl(POWERPC_ILLEGAL); - *lp++ = htonl(POWERPC_ILLEGAL); - *lp++ = htonl(POWERPC_ILLEGAL); - *lp++ = htonl(POWERPC_ILLEGAL); - *lp++ = htonl(POWERPC_ILLEGAL); - *lp++ = htonl(POWERPC_ILLEGAL); - *lp++ = htonl(POWERPC_ILLEGAL); - *lp = htonl(POWERPC_ILLEGAL); - -#if EMULATED_PPC - // Install EMUL_RETURN, EXEC_RETURN, EXEC_NATIVE and EMUL_OP opcodes - lp = (uint32 *)(ROMBaseHost + 0x380000 + (M68K_EMUL_RETURN << 3)); - *lp++ = htonl(POWERPC_EMUL_OP); - *lp++ = htonl(0x4bf66e80); // b 0x366084 - *lp++ = htonl(POWERPC_EMUL_OP | 1); - *lp++ = htonl(0x4bf66e78); // b 0x366084 - *lp++ = htonl(POWERPC_EMUL_OP | 2); - *lp++ = htonl(0x4bf66e70); // b 0x366084 - for (int i=0; i> 16)); // lis r0,xxx - *lp++ = htonl(0x60000000 + ((ROMBase + base) & 0xffff)); // ori r0,r0,xxx - *lp++ = htonl(0x7c0803a6); // mtlr r0 - *lp = htonl(POWERPC_BLR); // blr - } - return true; -} - - -/* - * Nanokernel patches - */ - -static bool patch_nanokernel(void) -{ - uint32 *lp; - uint32 base, loc; - - // Patch Mixed Mode trap - static const uint8 virt2phys_dat[] = {0x7d, 0x1b, 0x43, 0x78, 0x3b, 0xa1, 0x03, 0x20}; - if ((base = find_rom_data(0x313000, 0x314000, virt2phys_dat, sizeof(virt2phys_dat))) == 0) return false; - D(bug("virt2phys %08lx\n", base + 8)); - lp = (uint32 *)(ROMBaseHost + base + 8); // Don't translate virtual->physical - lp[0] = htonl(0x7f7fdb78); // mr r31,r27 - lp[2] = htonl(POWERPC_NOP); - - static const uint8 ppc_excp_tbl_dat[] = {0x39, 0x01, 0x04, 0x20, 0x7d, 0x13, 0x43, 0xa6}; - if ((base = find_rom_data(0x313000, 0x314000, ppc_excp_tbl_dat, sizeof(ppc_excp_tbl_dat))) == 0) return false; - D(bug("ppc_excp_tbl %08lx\n", base)); - lp = (uint32 *)(ROMBaseHost + base); // Don't activate PPC exception table - *lp++ = htonl(0x39000000 + MODE_NATIVE); // li r8,MODE_NATIVE - *lp = htonl(0x91000000 + XLM_RUN_MODE); // stw r8,XLM_RUN_MODE - - static const uint8 save_fpu_dat[] = {0x7d, 0x00, 0x00, 0xa6, 0x61, 0x08, 0x20, 0x00, 0x7d, 0x00, 0x01, 0x24}; - if ((base = find_rom_data(0x310000, 0x314000, save_fpu_dat, sizeof(save_fpu_dat))) == 0) return false; - D(bug("save_fpu %08lx\n", base)); - lp = (uint32 *)(ROMBaseHost + base); // Don't modify MSR to turn on FPU - if (ntohl(lp[4]) != 0x556b04e2) return false; - loc = base; -#if 1 - // FIXME: is that really intended? - *lp++ = htonl(POWERPC_NOP); - lp++; - *lp++ = htonl(POWERPC_NOP); - lp++; - *lp = htonl(POWERPC_NOP); -#else - lp[0] = htonl(POWERPC_NOP); - lp[1] = htonl(POWERPC_NOP); - lp[2] = htonl(POWERPC_NOP); - lp[3] = htonl(POWERPC_NOP); -#endif - - static const uint8 save_fpu_caller_dat[] = {0x93, 0xa6, 0x01, 0xec, 0x93, 0xc6, 0x01, 0xf4, 0x93, 0xe6, 0x01, 0xfc, 0x40}; - if ((base = find_rom_data(0x310000, 0x314000, save_fpu_caller_dat, sizeof(save_fpu_caller_dat))) == 0) return false; - D(bug("save_fpu_caller %08lx\n", base + 12)); - if (rom_powerpc_branch_target(base + 12) != loc) return false; - lp = (uint32 *)(ROMBaseHost + base + 12); // Always save FPU state - *lp = htonl(0x48000000 | (ntohl(*lp) & 0xffff)); // bl 0x00312e88 - - static const uint8 mdec_dat[] = {0x7f, 0xf6, 0x02, 0xa6, 0x2c, 0x08, 0x00, 0x00, 0x93, 0xe1, 0x06, 0x68, 0x7d, 0x16, 0x03, 0xa6}; - if ((base = find_rom_data(0x310000, 0x314000, mdec_dat, sizeof(mdec_dat))) == 0) return false; - D(bug("mdec %08lx\n", base)); - lp = (uint32 *)(ROMBaseHost + base); // Don't modify DEC - lp[0] = htonl(0x3be00000); // li r31,0 -#if 1 - lp[3] = htonl(POWERPC_NOP); - lp[4] = htonl(POWERPC_NOP); -#else - lp[3] = htonl(0x39000040); // li r8,0x40 - lp[4] = htonl(0x990600e4); // stb r8,0xe4(r6) -#endif - - static const uint8 restore_fpu_caller_dat[] = {0x81, 0x06, 0x00, 0xf4, 0x81, 0x46, 0x00, 0xfc, 0x7d, 0x09, 0x03, 0xa6, 0x40}; - if ((base = find_rom_data(0x310000, 0x314000, restore_fpu_caller_dat, sizeof(restore_fpu_caller_dat))) == 0) return false; - D(bug("restore_fpu_caller %08lx\n", base + 12)); - lp = (uint32 *)(ROMBaseHost + base + 12); // Always restore FPU state - *lp = htonl(0x48000000 | (ntohl(*lp) & 0xffff)); // bl 0x00312ddc - - static const uint8 m68k_excp_tbl_dat[] = {0x81, 0x21, 0x06, 0x58, 0x39, 0x01, 0x03, 0x60, 0x7d, 0x13, 0x43, 0xa6}; - if ((base = find_rom_data(0x310000, 0x314000, m68k_excp_tbl_dat, sizeof(m68k_excp_tbl_dat))) == 0) return false; - D(bug("m68k_excp %08lx\n", base + 4)); - lp = (uint32 *)(ROMBaseHost + base + 4); // Don't activate 68k exception table - *lp++ = htonl(0x39000000 + MODE_68K); // li r8,MODE_68K - *lp = htonl(0x91000000 + XLM_RUN_MODE); // stw r8,XLM_RUN_MODE - - // Patch 68k emulator trap routine - static const uint8 restore_fpu_caller2_dat[] = {0x81, 0x86, 0x00, 0x8c, 0x80, 0x66, 0x00, 0x94, 0x80, 0x86, 0x00, 0x9c, 0x40}; - if ((base = find_rom_data(0x310000, 0x314000, restore_fpu_caller2_dat, sizeof(restore_fpu_caller2_dat))) == 0) return false; - D(bug("restore_fpu_caller2 %08lx\n", base + 12)); - loc = rom_powerpc_branch_target(base + 12); - lp = (uint32 *)(ROMBaseHost + base + 12); // Always restore FPU state - *lp = htonl(0x48000000 | (ntohl(*lp) & 0xffff)); // bl 0x00312dd4 - - static const uint8 restore_fpu_dat[] = {0x55, 0x68, 0x04, 0xa5, 0x4c, 0x82, 0x00, 0x20, 0x81, 0x06, 0x00, 0xe4}; - if ((base = find_rom_data(0x310000, 0x314000, restore_fpu_dat, sizeof(restore_fpu_dat))) == 0) return false; - D(bug("restore_fpu %08lx\n", base)); - if (base != loc) return false; - lp = (uint32 *)(ROMBaseHost + base + 4); // Don't modify MSR to turn on FPU - *lp++ = htonl(POWERPC_NOP); - lp += 2; - *lp++ = htonl(POWERPC_NOP); - lp++; - *lp++ = htonl(POWERPC_NOP); - *lp++ = htonl(POWERPC_NOP); - *lp = htonl(POWERPC_NOP); - - // Disable suspend (FE0F opcode) - // TODO: really suspend SheepShaver? - static const uint8 suspend_dat[] = {0x7c, 0x88, 0x68, 0x39, 0x41, 0x9d}; - if ((base = find_rom_data(0x315000, 0x316000, suspend_dat, sizeof(suspend_dat))) == 0) return false; - D(bug("suspend %08lx\n", base)); - lp = (uint32 *)(ROMBaseHost + base + 4); - *lp = htonl((ntohl(*lp) & 0xffff) | 0x48000000); // bgt -> b - - // Patch trap return routine - static const uint8 trap_return_dat[] = {0x80, 0xc1, 0x00, 0x18, 0x80, 0x21, 0x00, 0x04, 0x4c, 0x00, 0x00, 0x64}; - if ((base = find_rom_data(0x312000, 0x320000, trap_return_dat, sizeof(trap_return_dat))) == 0) return false; - D(bug("trap_return %08lx\n", base + 8)); - lp = (uint32 *)(ROMBaseHost + base + 8); // Replace rfi - *lp = htonl(POWERPC_BCTR); - - while (ntohl(*lp) != 0x7d5a03a6) lp--; - *lp++ = htonl(0x7d4903a6); // mtctr r10 - *lp++ = htonl(0x7daff120); // mtcr r13 - *lp = htonl(0x48000000 + ((0x318000 - ((uintptr)lp - (uintptr)ROMBaseHost)) & 0x03fffffc)); // b ROMBase+0x318000 - uint32 npc = (uintptr)(lp + 1) - (uintptr)ROMBaseHost; - - lp = (uint32 *)(ROMBaseHost + 0x318000); - *lp++ = htonl(0x81400000 + XLM_IRQ_NEST); // lwz r10,XLM_IRQ_NEST - *lp++ = htonl(0x394affff); // subi r10,r10,1 - *lp++ = htonl(0x91400000 + XLM_IRQ_NEST); // stw r10,XLM_IRQ_NEST - *lp = htonl(0x48000000 + ((npc - 0x31800c) & 0x03fffffc)); // b ROMBase+0x312c2c - - // Patch FEOA opcode, selector 0x0A (virtual->physical page index) - static const uint8 fe0a_0a_dat[] = {0x55, 0x23, 0xa3, 0x3e, 0x4b}; - if ((base = find_rom_data(0x314000, 0x318000, fe0a_0a_dat, sizeof(fe0a_0a_dat))) == 0) return false; - loc = rom_powerpc_branch_target(base - 8); - static const uint8 fe0a_dat[] = {0x7e, 0x04, 0x48, 0x40, 0x81, 0xe1, 0x06, 0xb0, 0x54, 0x88, 0x10, 0x3a, 0x40, 0x90}; - if (find_rom_data(loc, 0x318000, fe0a_dat, sizeof(fe0a_dat)) != loc) return false; - D(bug("fe0a_0a %08lx\n", base - 8)); - lp = (uint32 *)(ROMBaseHost + base - 8); - *lp++ = htonl(0x7c832378); // mr r3,r4 - *lp++ = htonl(POWERPC_NOP); - *lp = htonl(POWERPC_NOP); - - // Disable FE0A opcode, selector 0x11 (init page tables?) - static const uint8 fe0a_11_dat[] = {0x56, 0x07, 0x06, 0x74, 0x2c, 0x07, 0x00, 0x60, 0x40}; - if ((base = find_rom_data(0x314000, 0x318000, fe0a_11_dat, sizeof(fe0a_11_dat))) == 0) return false; - loc = rom_powerpc_branch_target(base - 4); - if (find_rom_data(0x314000, 0x318000, fe0a_dat, sizeof(fe0a_dat)) != loc) return false; - D(bug("fe0a_11 %08lx\n", base - 4)); - lp = (uint32 *)(ROMBaseHost + base - 4); - *lp++ = htonl(POWERPC_NOP); - *lp++ = htonl(POWERPC_NOP); - *lp++ = htonl(POWERPC_NOP); - *lp = htonl(ntohl(*lp) | 0x02800000); // bf => ba - - // Patch FE0A opcode to fake a page table entry so that V=P for RAM and ROM - static const uint8 pg_lookup_dat[] = {0x7e, 0x0f, 0x40, 0x6e, 0x81, 0xc1, 0x06, 0xa4, 0x7e, 0x00, 0x71, 0x20}; - if ((base = find_rom_data(0x310000, 0x320000, pg_lookup_dat, sizeof(pg_lookup_dat))) == 0) return false; - D(bug("fe0a_pgtb_lookup %08lx\n", base - 12)); - lp = (uint32 *)(ROMBaseHost + base - 12); - if (ntohl(lp[0]) != 0x81e106b0) // lwz r15,$06b0(r1) - return false; - lp[0] = htonl(0x54906026); // slwi r16,r4,12 - lp[3] = htonl(0x62100121); // ori r16,r16,0x121 - - // Patch FE0A opcode to not write to kernel memory - static const uint8 krnl_write_dat[] = {0x38, 0xe0, 0x00, 0x01, 0x7e, 0x10, 0x38, 0x78, 0x92, 0x0f, 0x00, 0x00}; - if ((base = find_rom_data(0x310000, 0x320000, krnl_write_dat, sizeof(krnl_write_dat))) == 0) return false; - D(bug("fe0a_krnl_write %08lx\n", base)); - lp = (uint32 *)(ROMBaseHost + base); - lp[2] = htonl(POWERPC_NOP); - -/* - // Disable FE0A/FE06 opcodes - lp = (uint32 *)(ROMBase + 0x3144ac); - *lp++ = htonl(POWERPC_NOP); - *lp += 8; -*/ - return true; -} - - -/* - * 68k boot routine patches - */ - -static bool patch_68k(void) -{ - uint32 *lp; - uint16 *wp; - uint8 *bp; - uint32 base, loc; - - // Remove 68k RESET instruction - static const uint8 reset_dat[] = {0x4e, 0x70}; - if ((base = find_rom_data(0xc8, 0x120, reset_dat, sizeof(reset_dat))) == 0) return false; - D(bug("reset %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp = htons(M68K_NOP); - - // Fake reading PowerMac ID (via Universal) - static const uint8 powermac_id_dat[] = {0x45, 0xf9, 0x5f, 0xff, 0xff, 0xfc, 0x20, 0x12, 0x72, 0x00}; - if ((base = find_rom_data(0xe000, 0x15000, powermac_id_dat, sizeof(powermac_id_dat))) == 0) return false; - D(bug("powermac_id %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp++ = htons(0x203c); // move.l #id,d0 - *wp++ = htons(0); -// if (ROMType == ROMTYPE_NEWWORLD) -// *wp++ = htons(0x3035); // (PowerMac 9500 ID) -// else - *wp++ = htons(0x3020); // (PowerMac 9500 ID) - *wp++ = htons(0xb040); // cmp.w d0,d0 - *wp = htons(0x4ed6); // jmp (a6) - - // Patch UniversalInfo - if (ROMType == ROMTYPE_NEWWORLD) { - static const uint8 univ_info_dat[] = {0x3f, 0xff, 0x04, 0x00}; - if ((base = find_rom_data(0x14000, 0x18000, univ_info_dat, sizeof(univ_info_dat))) == 0) return false; - D(bug("universal_info %08lx\n", base)); - lp = (uint32 *)(ROMBaseHost + base - 0x14); - lp[0x00 >> 2] = htonl(ADDR_MAP_PATCH_SPACE - (base - 0x14)); - lp[0x10 >> 2] = htonl(0xcc003d11); // Make it like the PowerMac 9500 UniversalInfo - lp[0x14 >> 2] = htonl(0x3fff0401); - lp[0x18 >> 2] = htonl(0x0300001c); - lp[0x1c >> 2] = htonl(0x000108c4); - lp[0x24 >> 2] = htonl(0xc301bf26); - lp[0x28 >> 2] = htonl(0x00000861); - lp[0x58 >> 2] = htonl(0x30200000); - lp[0x60 >> 2] = htonl(0x0000003d); - } else if (ROMType == ROMTYPE_ZANZIBAR) { - base = 0x12b70; - lp = (uint32 *)(ROMBaseHost + base - 0x14); - lp[0x00 >> 2] = htonl(ADDR_MAP_PATCH_SPACE - (base - 0x14)); - lp[0x10 >> 2] = htonl(0xcc003d11); // Make it like the PowerMac 9500 UniversalInfo - lp[0x14 >> 2] = htonl(0x3fff0401); - lp[0x18 >> 2] = htonl(0x0300001c); - lp[0x1c >> 2] = htonl(0x000108c4); - lp[0x24 >> 2] = htonl(0xc301bf26); - lp[0x28 >> 2] = htonl(0x00000861); - lp[0x58 >> 2] = htonl(0x30200000); - lp[0x60 >> 2] = htonl(0x0000003d); - } else if (ROMType == ROMTYPE_GOSSAMER) { - base = 0x12d20; - lp = (uint32 *)(ROMBaseHost + base - 0x14); - lp[0x00 >> 2] = htonl(ADDR_MAP_PATCH_SPACE - (base - 0x14)); - lp[0x10 >> 2] = htonl(0xcc003d11); // Make it like the PowerMac 9500 UniversalInfo - lp[0x14 >> 2] = htonl(0x3fff0401); - lp[0x18 >> 2] = htonl(0x0300001c); - lp[0x1c >> 2] = htonl(0x000108c4); - lp[0x24 >> 2] = htonl(0xc301bf26); - lp[0x28 >> 2] = htonl(0x00000861); - lp[0x58 >> 2] = htonl(0x30410000); - lp[0x60 >> 2] = htonl(0x0000003d); - } - - // Construct AddrMap for NewWorld ROM - if (ROMType == ROMTYPE_NEWWORLD || ROMType == ROMTYPE_ZANZIBAR || ROMType == ROMTYPE_GOSSAMER) { - lp = (uint32 *)(ROMBaseHost + ADDR_MAP_PATCH_SPACE); - memset(lp - 10, 0, 0x128); - lp[-10] = htonl(0x0300001c); - lp[-9] = htonl(0x000108c4); - lp[-4] = htonl(0x00300000); - lp[-2] = htonl(0x11010000); - lp[-1] = htonl(0xf8000000); - lp[0] = htonl(0xffc00000); - lp[2] = htonl(0xf3016000); - lp[3] = htonl(0xf3012000); - lp[4] = htonl(0xf3012000); - lp[24] = htonl(0xf3018000); - lp[25] = htonl(0xf3010000); - lp[34] = htonl(0xf3011000); - lp[38] = htonl(0xf3015000); - lp[39] = htonl(0xf3014000); - lp[43] = htonl(0xf3000000); - lp[48] = htonl(0xf8000000); - } - - // Don't initialize VIA (via Universal) - static const uint8 via_init_dat[] = {0x08, 0x00, 0x00, 0x02, 0x67, 0x00, 0x00, 0x2c, 0x24, 0x68, 0x00, 0x08}; - if ((base = find_rom_data(0xe000, 0x15000, via_init_dat, sizeof(via_init_dat))) == 0) return false; - D(bug("via_init %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base + 4); - *wp = htons(0x6000); // bra - - static const uint8 via_init2_dat[] = {0x24, 0x68, 0x00, 0x08, 0x00, 0x12, 0x00, 0x30, 0x4e, 0x71}; - if ((base = find_rom_data(0xa000, 0x10000, via_init2_dat, sizeof(via_init2_dat))) == 0) return false; - D(bug("via_init2 %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp = htons(0x4ed6); // jmp (a6) - - static const uint8 via_init3_dat[] = {0x22, 0x68, 0x00, 0x08, 0x28, 0x3c, 0x20, 0x00, 0x01, 0x00}; - if ((base = find_rom_data(0xa000, 0x10000, via_init3_dat, sizeof(via_init3_dat))) == 0) return false; - D(bug("via_init3 %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp = htons(0x4ed6); // jmp (a6) - - // Don't RunDiags, get BootGlobs pointer directly - if (ROMType == ROMTYPE_NEWWORLD) { - static const uint8 run_diags_dat[] = {0x60, 0xff, 0x00, 0x0c}; - if ((base = find_rom_data(0x110, 0x128, run_diags_dat, sizeof(run_diags_dat))) == 0) return false; - D(bug("run_diags %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp++ = htons(0x4df9); // lea xxx,a6 - *wp++ = htons((RAMBase + RAMSize - 0x1c) >> 16); - *wp = htons((RAMBase + RAMSize - 0x1c) & 0xffff); - } else { - static const uint8 run_diags_dat[] = {0x74, 0x00, 0x2f, 0x0e}; - if ((base = find_rom_data(0xd0, 0xf0, run_diags_dat, sizeof(run_diags_dat))) == 0) return false; - D(bug("run_diags %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base - 6); - *wp++ = htons(0x4df9); // lea xxx,a6 - *wp++ = htons((RAMBase + RAMSize - 0x1c) >> 16); - *wp = htons((RAMBase + RAMSize - 0x1c) & 0xffff); - } - - // Replace NVRAM routines - static const uint8 nvram1_dat[] = {0x48, 0xe7, 0x01, 0x0e, 0x24, 0x68, 0x00, 0x08, 0x08, 0x83, 0x00, 0x1f}; - if ((base = find_rom_data(0x7000, 0xc000, nvram1_dat, sizeof(nvram1_dat))) == 0) return false; - D(bug("nvram1 %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp++ = htons(M68K_EMUL_OP_XPRAM1); - *wp = htons(M68K_RTS); - - if (ROMType == ROMTYPE_NEWWORLD) { - static const uint8 nvram2_dat[] = {0x48, 0xe7, 0x1c, 0xe0, 0x4f, 0xef, 0xff, 0xb4}; - if ((base = find_rom_data(0xa000, 0xd000, nvram2_dat, sizeof(nvram2_dat))) == 0) return false; - D(bug("nvram2 %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp++ = htons(M68K_EMUL_OP_XPRAM2); - *wp = htons(0x4ed3); // jmp (a3) - - static const uint8 nvram3_dat[] = {0x48, 0xe7, 0xdc, 0xe0, 0x4f, 0xef, 0xff, 0xb4}; - if ((base = find_rom_data(0xa000, 0xd000, nvram3_dat, sizeof(nvram3_dat))) == 0) return false; - D(bug("nvram3 %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp++ = htons(M68K_EMUL_OP_XPRAM3); - *wp = htons(0x4ed3); // jmp (a3) - - static const uint8 nvram4_dat[] = {0x4e, 0x56, 0xff, 0xa8, 0x48, 0xe7, 0x1f, 0x38, 0x16, 0x2e, 0x00, 0x13}; - if ((base = find_rom_data(0xa000, 0xd000, nvram4_dat, sizeof(nvram4_dat))) == 0) return false; - D(bug("nvram4 %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base + 16); - *wp++ = htons(0x1a2e); // move.b ($000f,a6),d5 - *wp++ = htons(0x000f); - *wp++ = htons(M68K_EMUL_OP_NVRAM3); - *wp++ = htons(0x4cee); // movem.l ($ff88,a6),d3-d7/a2-a4 - *wp++ = htons(0x1cf8); - *wp++ = htons(0xff88); - *wp++ = htons(0x4e5e); // unlk a6 - *wp = htons(M68K_RTS); - - static const uint8 nvram5_dat[] = {0x0c, 0x80, 0x03, 0x00, 0x00, 0x00, 0x66, 0x0a, 0x70, 0x00, 0x21, 0xf8, 0x02, 0x0c, 0x01, 0xe4}; - if ((base = find_rom_data(0xa000, 0xd000, nvram5_dat, sizeof(nvram5_dat))) == 0) return false; - D(bug("nvram5 %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base + 6); - *wp = htons(M68K_NOP); - - static const uint8 nvram6_dat[] = {0x2f, 0x0a, 0x24, 0x48, 0x4f, 0xef, 0xff, 0xa0, 0x20, 0x0f}; - if ((base = find_rom_data(0x9000, 0xb000, nvram6_dat, sizeof(nvram6_dat))) == 0) return false; - D(bug("nvram6 %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp++ = htons(0x7000); // moveq #0,d0 - *wp++ = htons(0x2080); // move.l d0,(a0) - *wp++ = htons(0x4228); // clr.b 4(a0) - *wp++ = htons(0x0004); - *wp = htons(M68K_RTS); - - static const uint8 nvram7_dat[] = {0x42, 0x2a, 0x00, 0x04, 0x4f, 0xef, 0x00, 0x60, 0x24, 0x5f, 0x4e, 0x75, 0x4f, 0xef, 0xff, 0xa0, 0x20, 0x0f}; - base = find_rom_data(0x9000, 0xb000, nvram7_dat, sizeof(nvram7_dat)); - if (base) { - D(bug("nvram7 %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base + 12); - *wp = htons(M68K_RTS); - } - } else { - static const uint8 nvram2_dat[] = {0x4e, 0xd6, 0x06, 0x41, 0x13, 0x00}; - if ((base = find_rom_data(0x7000, 0xb000, nvram2_dat, sizeof(nvram2_dat))) == 0) return false; - D(bug("nvram2 %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base + 2); - *wp++ = htons(M68K_EMUL_OP_XPRAM2); - *wp = htons(0x4ed3); // jmp (a3) - - static const uint8 nvram3_dat[] = {0x4e, 0xd3, 0x06, 0x41, 0x13, 0x00}; - if ((base = find_rom_data(0x7000, 0xb000, nvram3_dat, sizeof(nvram3_dat))) == 0) return false; - D(bug("nvram3 %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base + 2); - *wp++ = htons(M68K_EMUL_OP_XPRAM3); - *wp = htons(0x4ed3); // jmp (a3) - - static const uint32 nvram4_loc[] = {0x582f0, 0xa0a0, 0x7e50, 0xa1d0, 0x538d0, 0}; - wp = (uint16 *)(ROMBaseHost + nvram4_loc[ROMType]); - *wp++ = htons(0x202f); // move.l 4(sp),d0 - *wp++ = htons(0x0004); - *wp++ = htons(M68K_EMUL_OP_NVRAM1); - if (ROMType == ROMTYPE_ZANZIBAR || ROMType == ROMTYPE_GAZELLE) - *wp = htons(M68K_RTS); - else { - *wp++ = htons(0x1f40); // move.b d0,8(sp) - *wp++ = htons(0x0008); - *wp++ = htons(0x4e74); // rtd #4 - *wp = htons(0x0004); - } - - static const uint32 nvram5_loc[] = {0x58460, 0xa0f0, 0x7f40, 0xa220, 0x53a20, 0}; - wp = (uint16 *)(ROMBaseHost + nvram5_loc[ROMType]); - if (ROMType == ROMTYPE_ZANZIBAR || ROMType == ROMTYPE_GAZELLE) { - *wp++ = htons(0x202f); // move.l 4(sp),d0 - *wp++ = htons(0x0004); - *wp++ = htons(0x122f); // move.b 11(sp),d1 - *wp++ = htons(0x000b); - *wp++ = htons(M68K_EMUL_OP_NVRAM2); - *wp = htons(M68K_RTS); - } else { - *wp++ = htons(0x202f); // move.l 6(sp),d0 - *wp++ = htons(0x0006); - *wp++ = htons(0x122f); // move.b 4(sp),d1 - *wp++ = htons(0x0004); - *wp++ = htons(M68K_EMUL_OP_NVRAM2); - *wp++ = htons(0x4e74); // rtd #6 - *wp = htons(0x0006); - } - } - - // Fix MemTop/BootGlobs during system startup - static const uint8 mem_top_dat[] = {0x2c, 0x6c, 0xff, 0xec, 0x2a, 0x4c, 0xdb, 0xec, 0xff, 0xf4}; - if ((base = find_rom_data(0x120, 0x180, mem_top_dat, sizeof(mem_top_dat))) == 0) return false; - D(bug("mem_top %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp++ = htons(M68K_EMUL_OP_FIX_MEMTOP); - *wp = htons(M68K_NOP); - - // Don't initialize SCC (via 0x1ac) - static const uint8 scc_init_caller_dat[] = {0x21, 0xce, 0x01, 0x08, 0x22, 0x78, 0x0d, 0xd8}; - if ((base = find_rom_data(0x180, 0x1f0, scc_init_caller_dat, sizeof(scc_init_caller_dat))) == 0) return false; - D(bug("scc_init_caller %08lx\n", base + 12)); - wp = (uint16 *)(ROMBaseHost + base + 12); - loc = ntohs(wp[1]) + ((uintptr)wp - (uintptr)ROMBaseHost) + 2; - static const uint8 scc_init_dat[] = {0x20, 0x78, 0x01, 0xdc, 0x22, 0x78, 0x01, 0xd8}; - if ((base = find_rom_data(loc, loc + 0x80, scc_init_dat, sizeof(scc_init_dat))) == 0) return false; - D(bug("scc_init %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp++ = htons(M68K_EMUL_OP_RESET); - *wp = htons(M68K_RTS); - - // Don't EnableExtCache (via 0x1f6) and don't DisableIntSources(via 0x1fc) - static const uint8 ext_cache_dat[] = {0x4e, 0x7b, 0x00, 0x02}; - if ((base = find_rom_data(0x1d0, 0x230, ext_cache_dat, sizeof(ext_cache_dat))) == 0) return false; - D(bug("ext_cache %08lx\n", base)); - loc = ReadMacInt32(ROMBase + base + 6); - wp = (uint16 *)(ROMBaseHost + loc + base + 6); - *wp = htons(M68K_RTS); - loc = ReadMacInt32(ROMBase + base + 12); - wp = (uint16 *)(ROMBaseHost + loc + base + 12); - *wp = htons(M68K_RTS); - - // Fake CPU speed test (SetupTimeK) - static const uint8 timek_dat[] = {0x0c, 0x38, 0x00, 0x04, 0x01, 0x2f, 0x6d, 0x3c}; - if ((base = find_rom_data(0x400, 0x500, timek_dat, sizeof(timek_dat))) == 0) return false; - D(bug("timek %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp++ = htons(0x31fc); // move.w #xxx,TimeDBRA - *wp++ = htons(100); - *wp++ = htons(0x0d00); - *wp++ = htons(0x31fc); // move.w #xxx,TimeSCCDBRA - *wp++ = htons(100); - *wp++ = htons(0x0d02); - *wp++ = htons(0x31fc); // move.w #xxx,TimeSCSIDBRA - *wp++ = htons(100); - *wp++ = htons(0x0b24); - *wp++ = htons(0x31fc); // move.w #xxx,TimeRAMDBRA - *wp++ = htons(100); - *wp++ = htons(0x0cea); - *wp = htons(M68K_RTS); - - // Relocate jump tables ($2000..) - static const uint8 jump_tab_dat[] = {0x41, 0xfa, 0x00, 0x0e, 0x21, 0xc8, 0x20, 0x10, 0x4e, 0x75}; - if ((base = find_rom_data(0x3000, 0x6000, jump_tab_dat, sizeof(jump_tab_dat))) == 0) return false; - D(bug("jump_tab %08lx\n", base)); - lp = (uint32 *)(ROMBaseHost + base + 16); - for (;;) { - D(bug(" %08lx\n", (uintptr)lp - (uintptr)ROMBaseHost)); - while ((ntohl(*lp) & 0xff000000) == 0xff000000) { - *lp = htonl((ntohl(*lp) & (ROM_SIZE-1)) + ROMBase); - lp++; - } - while (!ntohl(*lp)) lp++; - if (ntohl(*lp) != 0x41fa000e) - break; - lp += 4; - } - - // Create SysZone at start of Mac RAM (SetSysAppZone, via 0x22a) - static const uint8 sys_zone_dat[] = {0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x40, 0x00}; - if ((base = find_rom_data(0x600, 0x900, sys_zone_dat, sizeof(sys_zone_dat))) == 0) return false; - D(bug("sys_zone %08lx\n", base)); - lp = (uint32 *)(ROMBaseHost + base); - *lp++ = htonl(RAMBase ? RAMBase : 0x3000); - *lp = htonl(RAMBase ? RAMBase + 0x1800 : 0x4800); - - // Set boot stack at RAMBase+4MB and fix logical/physical RAM size (CompBootStack) - // The RAM size fix must be done after InitMemMgr! - static const uint8 boot_stack_dat[] = {0x08, 0x38, 0x00, 0x06, 0x24, 0x0b}; - if ((base = find_rom_data(0x580, 0x800, boot_stack_dat, sizeof(boot_stack_dat))) == 0) return false; - D(bug("boot_stack %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp++ = htons(0x207c); // move.l #RAMBase+0x3ffffe,a0 - *wp++ = htons((RAMBase + 0x3ffffe) >> 16); - *wp++ = htons((RAMBase + 0x3ffffe) & 0xffff); - *wp++ = htons(M68K_EMUL_OP_FIX_MEMSIZE); - *wp = htons(M68K_RTS); - - // Get PowerPC page size (InitVMemMgr, via 0x240) - static const uint8 page_size_dat[] = {0x20, 0x30, 0x81, 0xf2, 0x5f, 0xff, 0xef, 0xd8, 0x00, 0x10}; - if ((base = find_rom_data(0xb000, 0x12000, page_size_dat, sizeof(page_size_dat))) == 0) return false; - D(bug("page_size %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp++ = htons(0x203c); // move.l #$1000,d0 - *wp++ = htons(0); - *wp++ = htons(0x1000); - *wp++ = htons(M68K_NOP); - *wp = htons(M68K_NOP); - - // Gestalt PowerPC page size, CPU type, RAM size (InitGestalt, via 0x25c) - static const uint8 page_size2_dat[] = {0x26, 0x79, 0x5f, 0xff, 0xef, 0xd8, 0x25, 0x6b, 0x00, 0x10, 0x00, 0x1e}; - if ((base = find_rom_data(0x50000, 0x70000, page_size2_dat, sizeof(page_size2_dat))) == 0) return false; - D(bug("page_size2 %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp++ = htons(0x257c); // move.l #$1000,$1e(a2) - *wp++ = htons(0); - *wp++ = htons(0x1000); - *wp++ = htons(0x001e); - *wp++ = htons(0x157c); // move.b #PVR,$1d(a2) - uint32 cput = (PVR >> 16); - if (cput == 0x7000) - cput |= 0x20; - else if (cput >= 0x8000 && cput <= 0x8002) - cput |= 0x10; - cput &= 0xff; - *wp++ = htons(cput); - *wp++ = htons(0x001d); - *wp++ = htons(0x263c); // move.l #RAMSize,d3 - *wp++ = htons(RAMSize >> 16); - *wp++ = htons(RAMSize & 0xffff); - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); - *wp = htons(M68K_NOP); - if (ROMType == ROMTYPE_NEWWORLD) - wp = (uint16 *)(ROMBaseHost + base + 0x4a); - else - wp = (uint16 *)(ROMBaseHost + base + 0x28); - *wp++ = htons(M68K_NOP); - *wp = htons(M68K_NOP); - - // Gestalt CPU/bus clock speed (InitGestalt, via 0x25c) - if (ROMType == ROMTYPE_ZANZIBAR) { - wp = (uint16 *)(ROMBaseHost + 0x5d87a); - *wp++ = htons(0x203c); // move.l #Hz,d0 - *wp++ = htons(BusClockSpeed >> 16); - *wp++ = htons(BusClockSpeed & 0xffff); - *wp++ = htons(M68K_NOP); - *wp = htons(M68K_NOP); - wp = (uint16 *)(ROMBaseHost + 0x5d888); - *wp++ = htons(0x203c); // move.l #Hz,d0 - *wp++ = htons(CPUClockSpeed >> 16); - *wp++ = htons(CPUClockSpeed & 0xffff); - *wp++ = htons(M68K_NOP); - *wp = htons(M68K_NOP); - } - - // Don't write to GC interrupt mask register (via 0x262) - if (ROMType != ROMTYPE_NEWWORLD) { - static const uint8 gc_mask_dat[] = {0x83, 0xa8, 0x00, 0x24, 0x4e, 0x71}; - if ((base = find_rom_data(0x13000, 0x20000, gc_mask_dat, sizeof(gc_mask_dat))) == 0) return false; - D(bug("gc_mask %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp++ = htons(M68K_NOP); - *wp = htons(M68K_NOP); - wp = (uint16 *)(ROMBaseHost + base + 0x40); - *wp++ = htons(M68K_NOP); - *wp = htons(M68K_NOP); - wp = (uint16 *)(ROMBaseHost + base + 0x78); - *wp++ = htons(M68K_NOP); - *wp = htons(M68K_NOP); - wp = (uint16 *)(ROMBaseHost + base + 0x96); - *wp++ = htons(M68K_NOP); - *wp = htons(M68K_NOP); - - static const uint8 gc_mask2_dat[] = {0x02, 0xa8, 0x00, 0x00, 0x00, 0x80, 0x00, 0x24}; - if ((base = find_rom_data(0x13000, 0x20000, gc_mask2_dat, sizeof(gc_mask2_dat))) == 0) return false; - D(bug("gc_mask2 %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - if (ROMType == ROMTYPE_GOSSAMER) { - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); - } - for (int i=0; i<5; i++) { - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); - wp += 2; - } - if (ROMType == ROMTYPE_ZANZIBAR || ROMType == ROMTYPE_GOSSAMER) { - for (int i=0; i<6; i++) { - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); - wp += 2; - } - } - } - - // Don't initialize Cuda (via 0x274) - static const uint8 cuda_init_dat[] = {0x08, 0xa9, 0x00, 0x04, 0x16, 0x00, 0x4e, 0x71, 0x13, 0x7c, 0x00, 0x84, 0x1c, 0x00, 0x4e, 0x71}; - if ((base = find_rom_data(0xa000, 0x12000, cuda_init_dat, sizeof(cuda_init_dat))) == 0) return false; - D(bug("cuda_init %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); - *wp = htons(M68K_NOP); - - // Patch GetCPUSpeed (via 0x27a) (some ROMs have two of them) - static const uint8 cpu_speed_dat[] = {0x20, 0x30, 0x81, 0xf2, 0x5f, 0xff, 0xef, 0xd8, 0x00, 0x04, 0x4c, 0x7c}; - if ((base = find_rom_data(0x6000, 0xa000, cpu_speed_dat, sizeof(cpu_speed_dat))) == 0) return false; - D(bug("cpu_speed %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp++ = htons(0x203c); // move.l #(MHz<<16)|MHz,d0 - *wp++ = htons(CPUClockSpeed / 1000000); - *wp++ = htons(CPUClockSpeed / 1000000); - *wp = htons(M68K_RTS); - if ((base = find_rom_data(base, 0xa000, cpu_speed_dat, sizeof(cpu_speed_dat))) != 0) { - D(bug("cpu_speed2 %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp++ = htons(0x203c); // move.l #(MHz<<16)|MHz,d0 - *wp++ = htons(CPUClockSpeed / 1000000); - *wp++ = htons(CPUClockSpeed / 1000000); - *wp = htons(M68K_RTS); - } - - // Don't poke VIA in InitTimeMgr (via 0x298) - static const uint8 time_via_dat[] = {0x40, 0xe7, 0x00, 0x7c, 0x07, 0x00, 0x28, 0x78, 0x01, 0xd4, 0x43, 0xec, 0x10, 0x00}; - if ((base = find_rom_data(0x30000, 0x40000, time_via_dat, sizeof(time_via_dat))) == 0) return false; - D(bug("time_via %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp++ = htons(0x4cdf); // movem.l (sp)+,d0-d5/a0-a4 - *wp++ = htons(0x1f3f); - *wp = htons(M68K_RTS); - - // Don't read from 0xff800000 (Name Registry, Open Firmware?) (via 0x2a2) - // Remove this if FE03 works!! - static const uint8 open_firmware_dat[] = {0x2f, 0x79, 0xff, 0x80, 0x00, 0x00, 0x00, 0xfc}; - if ((base = find_rom_data(0x48000, 0x58000, open_firmware_dat, sizeof(open_firmware_dat))) == 0) return false; - D(bug("open_firmware %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp++ = htons(0x2f7c); // move.l #deadbeef,0xfc(a7) - *wp++ = htons(0xdead); - *wp++ = htons(0xbeef); - *wp = htons(0x00fc); - wp = (uint16 *)(ROMBaseHost + base + 0x1a); - *wp++ = htons(M68K_NOP); // (FE03 opcode, tries to jump to 0xdeadbeef) - *wp = htons(M68K_NOP); - - // Don't EnableExtCache (via 0x2b2) - static const uint8 ext_cache2_dat[] = {0x4f, 0xef, 0xff, 0xec, 0x20, 0x4f, 0x10, 0xbc, 0x00, 0x01, 0x11, 0x7c, 0x00, 0x1b}; - if ((base = find_rom_data(0x13000, 0x20000, ext_cache2_dat, sizeof(ext_cache2_dat))) == 0) return false; - D(bug("ext_cache2 %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp = htons(M68K_RTS); - - // Don't install Time Manager task for 60Hz interrupt (Enable60HzInts, via 0x2b8) - if (ROMType == ROMTYPE_NEWWORLD || ROMType == ROMTYPE_GOSSAMER) { - static const uint8 tm_task_dat[] = {0x30, 0x3c, 0x4e, 0x2b, 0xa9, 0xc9}; - if ((base = find_rom_data(0x2a0, 0x320, tm_task_dat, sizeof(tm_task_dat))) == 0) return false; - D(bug("tm_task %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base + 28); - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); - *wp = htons(M68K_NOP); - } else { - static const uint8 tm_task_dat[] = {0x20, 0x3c, 0x73, 0x79, 0x73, 0x61}; - if ((base = find_rom_data(0x280, 0x300, tm_task_dat, sizeof(tm_task_dat))) == 0) return false; - D(bug("tm_task %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base - 6); - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); - *wp = htons(M68K_NOP); - } - - // Don't read PVR from 0x5fffef80 in DriverServicesLib (via 0x316) - if (ROMType != ROMTYPE_NEWWORLD && ROMType != ROMTYPE_GOSSAMER) { - uint32 dsl_offset = find_rom_resource(FOURCC('n','l','i','b'), -16401); - if (ROMType == ROMTYPE_ZANZIBAR) { - static const uint8 dsl_pvr_dat[] = {0x40, 0x82, 0x00, 0x40, 0x38, 0x60, 0xef, 0x80, 0x3c, 0x63, 0x60, 0x00, 0x80, 0x83, 0x00, 0x00, 0x54, 0x84, 0x84, 0x3e}; - if ((base = find_rom_data(dsl_offset, dsl_offset + 0x6000, dsl_pvr_dat, sizeof(dsl_pvr_dat))) == 0) return false; - } else { - static const uint8 dsl_pvr_dat[] = {0x3b, 0xc3, 0x00, 0x00, 0x30, 0x84, 0xff, 0xa0, 0x40, 0x82, 0x00, 0x44, 0x80, 0x84, 0xef, 0xe0, 0x54, 0x84, 0x84, 0x3e}; - if ((base = find_rom_data(dsl_offset, dsl_offset + 0x6000, dsl_pvr_dat, sizeof(dsl_pvr_dat))) == 0) return false; - } - D(bug("dsl_pvr %08lx\n", base)); - lp = (uint32 *)(ROMBaseHost + base + 12); - *lp = htonl(0x3c800000 | (PVR >> 16)); // lis r4,PVR - - // Don't read bus clock from 0x5fffef88 in DriverServicesLib (via 0x316) - if (ROMType == ROMTYPE_ZANZIBAR) { - static const uint8 dsl_bus_dat[] = {0x81, 0x07, 0x00, 0x00, 0x39, 0x20, 0x42, 0x40, 0x81, 0x62, 0xff, 0x20}; - if ((base = find_rom_data(dsl_offset, dsl_offset + 0x6000, dsl_bus_dat, sizeof(dsl_bus_dat))) == 0) return false; - D(bug("dsl_bus %08lx\n", base)); - lp = (uint32 *)(ROMBaseHost + base); - *lp = htonl(0x81000000 + XLM_BUS_CLOCK); // lwz r8,(bus clock speed) - } else { - static const uint8 dsl_bus_dat[] = {0x80, 0x83, 0xef, 0xe8, 0x80, 0x62, 0x00, 0x10, 0x7c, 0x04, 0x03, 0x96}; - if ((base = find_rom_data(dsl_offset, dsl_offset + 0x6000, dsl_bus_dat, sizeof(dsl_bus_dat))) == 0) return false; - D(bug("dsl_bus %08lx\n", base)); - lp = (uint32 *)(ROMBaseHost + base); - *lp = htonl(0x80800000 + XLM_BUS_CLOCK); // lwz r4,(bus clock speed) - } - } - - // Don't open InterruptTreeTNT in MotherBoardHAL init in DriverServicesLib init - if (ROMType == ROMTYPE_ZANZIBAR) { - lp = (uint32 *)(ROMBaseHost + find_rom_resource(FOURCC('n','l','i','b'), -16408) + 0x16c); - *lp = htonl(0x38600000); // li r3,0 - } - - // Don't read from MacPgm in WipeOutMACPGMINFOProcPtrs (StdCLib) - if (1) { - uint32 hpchk_offset = find_rom_resource(FOURCC('n','l','i','b'), 10); - static const uint8 hpchk_dat[] = {0x80, 0x80, 0x03, 0x16, 0x94, 0x21, 0xff, 0xb0, 0x83, 0xc4, 0x00, 0x04}; - if ((base = find_rom_data(hpchk_offset, hpchk_offset + 0x3000, hpchk_dat, sizeof(hpchk_dat))) == 0) return false; - D(bug("macpgm %08lx\n", base)); - lp = (uint32 *)(ROMBaseHost + base); - *lp = htonl(0x80800000 + XLM_ZERO_PAGE); // lwz r4,(zero page) - } - - // Patch Name Registry - static const uint8 name_reg_dat[] = {0x70, 0xff, 0xab, 0xeb}; - if ((base = find_rom_data(0x300, 0x380, name_reg_dat, sizeof(name_reg_dat))) == 0) return false; - D(bug("name_reg %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp = htons(M68K_EMUL_OP_NAME_REGISTRY); - -#if DISABLE_SCSI - // Fake SCSI Manager - // Remove this if SCSI Manager works!! - static const uint8 scsi_mgr_a_dat[] = {0x4e, 0x56, 0x00, 0x00, 0x20, 0x3c, 0x00, 0x00, 0x04, 0x0c, 0xa7, 0x1e}; - static const uint8 scsi_mgr_b_dat[] = {0x4e, 0x56, 0x00, 0x00, 0x2f, 0x0c, 0x20, 0x3c, 0x00, 0x00, 0x04, 0x0c, 0xa7, 0x1e}; - if ((base = find_rom_data(0x1c000, 0x28000, scsi_mgr_a_dat, sizeof(scsi_mgr_a_dat))) == 0) { - if ((base = find_rom_data(0x1c000, 0x28000, scsi_mgr_b_dat, sizeof(scsi_mgr_b_dat))) == 0) return false; - } - D(bug("scsi_mgr %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp++ = htons(0x21fc); // move.l #xxx,0x624 (SCSIAtomic) - *wp++ = htons((ROMBase + base + 18) >> 16); - *wp++ = htons((ROMBase + base + 18) & 0xffff); - *wp++ = htons(0x0624); - *wp++ = htons(0x21fc); // move.l #xxx,0xe54 (SCSIDispatch) - *wp++ = htons((ROMBase + base + 22) >> 16); - *wp++ = htons((ROMBase + base + 22) & 0xffff); - *wp++ = htons(0x0e54); - *wp++ = htons(M68K_RTS); - *wp++ = htons(M68K_EMUL_OP_SCSI_ATOMIC); - *wp++ = htons(M68K_RTS); - *wp++ = htons(M68K_EMUL_OP_SCSI_DISPATCH); - *wp = htons(0x4ed0); // jmp (a0) - wp = (uint16 *)(ROMBaseHost + base + 0x20); - *wp++ = htons(0x7000); // moveq #0,d0 - *wp = htons(M68K_RTS); -#endif - -#if DISABLE_SCSI - // Don't access SCSI variables - // Remove this if SCSI Manager works!! - if (ROMType == ROMTYPE_NEWWORLD) { - static const uint8 scsi_var_dat[] = {0x70, 0x01, 0xa0, 0x89, 0x4a, 0x6e, 0xfe, 0xac, 0x4f, 0xef, 0x00, 0x10, 0x66, 0x00}; - if ((base = find_rom_data(0x1f500, 0x1f600, scsi_var_dat, sizeof(scsi_var_dat))) != 0) { - D(bug("scsi_var %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base + 12); - *wp = htons(0x6000); // bra - } - - static const uint8 scsi_var2_dat[] = {0x4e, 0x56, 0xfc, 0x58, 0x48, 0xe7, 0x1f, 0x38}; - if ((base = find_rom_data(0x1f700, 0x1f800, scsi_var2_dat, sizeof(scsi_var2_dat))) != 0) { - D(bug("scsi_var2 %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp++ = htons(0x7000); // moveq #0,d0 - *wp = htons(M68K_RTS); - } - } - else if (ROMType == ROMTYPE_GOSSAMER) { - static const uint8 scsi_var_dat[] = {0x70, 0x01, 0xa0, 0x89, 0x4a, 0x6e, 0xfe, 0xac, 0x4f, 0xef, 0x00, 0x10, 0x66, 0x00}; - if ((base = find_rom_data(0x1d700, 0x1d800, scsi_var_dat, sizeof(scsi_var_dat))) != 0) { - D(bug("scsi_var %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base + 12); - *wp = htons(0x6000); // bra - } - - static const uint8 scsi_var2_dat[] = {0x4e, 0x56, 0xfc, 0x5a, 0x48, 0xe7, 0x1f, 0x38}; - if ((base = find_rom_data(0x1d900, 0x1da00, scsi_var2_dat, sizeof(scsi_var2_dat))) != 0) { - D(bug("scsi_var2 %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp++ = htons(0x7000); // moveq #0,d0 - *wp = htons(M68K_RTS); - } - } -#endif - - // Don't wait in ADBInit (via 0x36c) - static const uint8 adb_init_dat[] = {0x08, 0x2b, 0x00, 0x05, 0x01, 0x5d, 0x66, 0xf8}; - if ((base = find_rom_data(0x31000, 0x3d000, adb_init_dat, sizeof(adb_init_dat))) == 0) return false; - D(bug("adb_init %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base + 6); - *wp = htons(M68K_NOP); - - // Modify check in InitResources() so that addresses >0x80000000 work - static const uint8 init_res_dat[] = {0x4a, 0xb8, 0x0a, 0x50, 0x6e, 0x20}; - if ((base = find_rom_data(0x78000, 0x8c000, init_res_dat, sizeof(init_res_dat))) == 0) return false; - D(bug("init_res %08lx\n", base)); - bp = (uint8 *)(ROMBaseHost + base + 4); - *bp = 0x66; - - // Modify vCheckLoad() so that we can patch resources (68k Resource Manager) - static const uint8 check_load_dat[] = {0x20, 0x78, 0x07, 0xf0, 0x4e, 0xd0}; - if ((base = find_rom_data(0x78000, 0x8c000, check_load_dat, sizeof(check_load_dat))) == 0) return false; - D(bug("check_load %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp++ = htons(M68K_JMP); - *wp++ = htons((ROMBase + CHECK_LOAD_PATCH_SPACE) >> 16); - *wp = htons((ROMBase + CHECK_LOAD_PATCH_SPACE) & 0xffff); - wp = (uint16 *)(ROMBaseHost + CHECK_LOAD_PATCH_SPACE); - *wp++ = htons(0x2f03); // move.l d3,-(a7) - *wp++ = htons(0x2078); // move.l $07f0,a0 - *wp++ = htons(0x07f0); - *wp++ = htons(M68K_JSR_A0); - *wp++ = htons(M68K_EMUL_OP_CHECKLOAD); - *wp = htons(M68K_RTS); - - // Replace .Sony driver - sony_offset = find_rom_resource(FOURCC('D','R','V','R'), 4); - if (ROMType == ROMTYPE_ZANZIBAR || ROMType == ROMTYPE_NEWWORLD) - sony_offset = find_rom_resource(FOURCC('D','R','V','R'), 4, true); // First DRVR 4 is .MFMFloppy - if (sony_offset == 0) { - sony_offset = find_rom_resource(FOURCC('n','d','r','v'), -20196); // NewWorld 1.6 has "PCFloppy" ndrv - if (sony_offset == 0) - return false; - lp = (uint32 *)(ROMBaseHost + rsrc_ptr + 8); - *lp = htonl(FOURCC('D','R','V','R')); - wp = (uint16 *)(ROMBaseHost + rsrc_ptr + 12); - *wp = htons(4); - } - D(bug("sony_offset %08lx\n", sony_offset)); - memcpy((void *)(ROMBaseHost + sony_offset), sony_driver, sizeof(sony_driver)); - - // Install .Disk and .AppleCD drivers - memcpy((void *)(ROMBaseHost + sony_offset + 0x100), disk_driver, sizeof(disk_driver)); - memcpy((void *)(ROMBaseHost + sony_offset + 0x200), cdrom_driver, sizeof(cdrom_driver)); - - // Install serial drivers - gen_ain_driver( ROMBase + sony_offset + 0x300); - gen_aout_driver(ROMBase + sony_offset + 0x400); - gen_bin_driver( ROMBase + sony_offset + 0x500); - gen_bout_driver(ROMBase + sony_offset + 0x600); - - // Copy icons to ROM - SonyDiskIconAddr = ROMBase + sony_offset + 0x800; - memcpy(ROMBaseHost + sony_offset + 0x800, SonyDiskIcon, sizeof(SonyDiskIcon)); - SonyDriveIconAddr = ROMBase + sony_offset + 0xa00; - memcpy(ROMBaseHost + sony_offset + 0xa00, SonyDriveIcon, sizeof(SonyDriveIcon)); - DiskIconAddr = ROMBase + sony_offset + 0xc00; - memcpy(ROMBaseHost + sony_offset + 0xc00, DiskIcon, sizeof(DiskIcon)); - CDROMIconAddr = ROMBase + sony_offset + 0xe00; - memcpy(ROMBaseHost + sony_offset + 0xe00, CDROMIcon, sizeof(CDROMIcon)); - - // Patch driver install routine - static const uint8 drvr_install_dat[] = {0xa7, 0x1e, 0x21, 0xc8, 0x01, 0x1c, 0x4e, 0x75}; - if ((base = find_rom_data(0xb00, 0xd00, drvr_install_dat, sizeof(drvr_install_dat))) == 0) return false; - D(bug("drvr_install %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base + 8); - *wp++ = htons(M68K_EMUL_OP_INSTALL_DRIVERS); - *wp = htons(M68K_RTS); - - // Don't install serial drivers from ROM - if (ROMType == ROMTYPE_ZANZIBAR || ROMType == ROMTYPE_NEWWORLD || ROMType == ROMTYPE_GOSSAMER) { - wp = (uint16 *)(ROMBaseHost + find_rom_resource(FOURCC('S','E','R','D'), 0)); - *wp = htons(M68K_RTS); - } else { - wp = (uint16 *)(ROMBaseHost + find_rom_resource(FOURCC('s','l','0','5'), 2) + 0xc4); - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); - *wp = htons(0x7000); // moveq #0,d0 - wp = (uint16 *)(ROMBaseHost + find_rom_resource(FOURCC('s','l','0','5'), 2) + 0x8ee); - *wp = htons(M68K_NOP); - } - uint32 nsrd_offset = find_rom_resource(FOURCC('n','s','r','d'), 1); - if (nsrd_offset) { - lp = (uint32 *)(ROMBaseHost + rsrc_ptr + 8); - *lp = htonl(FOURCC('x','s','r','d')); - } - - // Replace ADBOp() - memcpy(ROMBaseHost + find_rom_trap(0xa07c), adbop_patch, sizeof(adbop_patch)); - - // Replace Time Manager - wp = (uint16 *)(ROMBaseHost + find_rom_trap(0xa058)); - *wp++ = htons(M68K_EMUL_OP_INSTIME); - *wp = htons(M68K_RTS); - wp = (uint16 *)(ROMBaseHost + find_rom_trap(0xa059)); - *wp++ = htons(0x40e7); // move sr,-(sp) - *wp++ = htons(0x007c); // ori #$0700,sr - *wp++ = htons(0x0700); - *wp++ = htons(M68K_EMUL_OP_RMVTIME); - *wp++ = htons(0x46df); // move (sp)+,sr - *wp = htons(M68K_RTS); - wp = (uint16 *)(ROMBaseHost + find_rom_trap(0xa05a)); - *wp++ = htons(0x40e7); // move sr,-(sp) - *wp++ = htons(0x007c); // ori #$0700,sr - *wp++ = htons(0x0700); - *wp++ = htons(M68K_EMUL_OP_PRIMETIME); - *wp++ = htons(0x46df); // move (sp)+,sr - *wp = htons(M68K_RTS); - wp = (uint16 *)(ROMBaseHost + find_rom_trap(0xa093)); - *wp++ = htons(M68K_EMUL_OP_MICROSECONDS); - *wp = htons(M68K_RTS); - - // Disable Egret Manager - static const uint8 egret_dat[] = {0x2f, 0x30, 0x81, 0xe2, 0x20, 0x10, 0x00, 0x18}; - if ((base = find_rom_data(0xa000, 0x10000, egret_dat, sizeof(egret_dat))) == 0) return false; - D(bug("egret %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - *wp++ = htons(0x7000); - *wp = htons(M68K_RTS); - - // Don't call FE0A opcode in Shutdown Manager - static const uint8 shutdown_dat[] = {0x40, 0xe7, 0x00, 0x7c, 0x07, 0x00, 0x48, 0xe7, 0x3f, 0x00, 0x2c, 0x00, 0x2e, 0x01}; - if ((base = find_rom_data(0x30000, 0x40000, shutdown_dat, sizeof(shutdown_dat))) == 0) return false; - D(bug("shutdown %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); - if (ROMType == ROMTYPE_ZANZIBAR) - *wp = htons(M68K_RTS); - else if (ntohs(wp[-4]) == 0x61ff) - *wp = htons(M68K_RTS); - else if (ntohs(wp[-2]) == 0x6700) - wp[-2] = htons(0x6000); // bra - - // Patch PowerOff() - wp = (uint16 *)(ROMBaseHost + find_rom_trap(0xa05b)); // PowerOff() - *wp = htons(M68K_EMUL_RETURN); - - // Patch VIA interrupt handler - static const uint8 via_int_dat[] = {0x70, 0x7f, 0xc0, 0x29, 0x1a, 0x00, 0xc0, 0x29, 0x1c, 0x00}; - if ((base = find_rom_data(0x13000, 0x1c000, via_int_dat, sizeof(via_int_dat))) == 0) return false; - D(bug("via_int %08lx\n", base)); - uint32 level1_int = ROMBase + base; - wp = (uint16 *)(ROMBaseHost + base); // Level 1 handler - *wp++ = htons(0x7002); // moveq #2,d0 (60Hz interrupt) - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); - *wp = htons(M68K_NOP); - - static const uint8 via_int2_dat[] = {0x13, 0x7c, 0x00, 0x02, 0x1a, 0x00, 0x4e, 0x71, 0x52, 0xb8, 0x01, 0x6a}; - if ((base = find_rom_data(0x10000, 0x18000, via_int2_dat, sizeof(via_int2_dat))) == 0) return false; - D(bug("via_int2 %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); // 60Hz handler - *wp++ = htons(M68K_EMUL_OP_IRQ); - *wp++ = htons(0x4a80); // tst.l d0 - *wp++ = htons(0x6700); // beq xxx - *wp = htons(0xffe8); - - if (ROMType == ROMTYPE_NEWWORLD) { - static const uint8 via_int3_dat[] = {0x48, 0xe7, 0xf0, 0xf0, 0x76, 0x01, 0x60, 0x26}; - if ((base = find_rom_data(0x15000, 0x19000, via_int3_dat, sizeof(via_int3_dat))) == 0) return false; - D(bug("via_int3 %08lx\n", base)); - wp = (uint16 *)(ROMBaseHost + base); // CHRP level 1 handler - *wp++ = htons(M68K_JMP); - *wp++ = htons((level1_int - 12) >> 16); - *wp = htons((level1_int - 12) & 0xffff); - } - - // Patch ZeroScrap() for clipboard exchange with host OS - uint32 zero_scrap = find_rom_trap(0xa9fc); // ZeroScrap() - wp = (uint16 *)(ROMBaseHost + ZERO_SCRAP_PATCH_SPACE); - *wp++ = htons(M68K_EMUL_OP_ZERO_SCRAP); - *wp++ = htons(M68K_JMP); - *wp++ = htons((ROMBase + zero_scrap) >> 16); - *wp++ = htons((ROMBase + zero_scrap) & 0xffff); - base = ROMBase + ReadMacInt32(ROMBase + 0x22); - WriteMacInt32(base + 4 * (0xa9fc & 0x3ff), ZERO_SCRAP_PATCH_SPACE); - - // Patch PutScrap() for clipboard exchange with host OS - uint32 put_scrap = find_rom_trap(0xa9fe); // PutScrap() - wp = (uint16 *)(ROMBaseHost + PUT_SCRAP_PATCH_SPACE); - *wp++ = htons(M68K_EMUL_OP_PUT_SCRAP); - *wp++ = htons(M68K_JMP); - *wp++ = htons((ROMBase + put_scrap) >> 16); - *wp++ = htons((ROMBase + put_scrap) & 0xffff); - base = ROMBase + ReadMacInt32(ROMBase + 0x22); - WriteMacInt32(base + 4 * (0xa9fe & 0x3ff), PUT_SCRAP_PATCH_SPACE); - - // Patch GetScrap() for clipboard exchange with host OS - uint32 get_scrap = find_rom_trap(0xa9fd); // GetScrap() - wp = (uint16 *)(ROMBaseHost + GET_SCRAP_PATCH_SPACE); - *wp++ = htons(M68K_EMUL_OP_GET_SCRAP); - *wp++ = htons(M68K_JMP); - *wp++ = htons((ROMBase + get_scrap) >> 16); - *wp++ = htons((ROMBase + get_scrap) & 0xffff); - base = ROMBase + ReadMacInt32(ROMBase + 0x22); - WriteMacInt32(base + 4 * (0xa9fd & 0x3ff), GET_SCRAP_PATCH_SPACE); - - // Patch SynchIdleTime() - if (PrefsFindBool("idlewait")) { - base = find_rom_trap(0xabf7) + 4; // SynchIdleTime() - wp = (uint16 *)(ROMBaseHost + base); - D(bug("SynchIdleTime at %08lx\n", base)); - if (ntohs(*wp) == 0x2078) { // movea.l ExpandMem,a0 - *wp++ = htons(M68K_EMUL_OP_IDLE_TIME); - *wp = htons(M68K_NOP); - } - else if (ntohs(*wp) == 0x70fe) // moveq #-2,d0 - *wp++ = htons(M68K_EMUL_OP_IDLE_TIME_2); - else { - D(bug("SynchIdleTime patch not installed\n")); - } - } - - // Construct list of all sifters used by sound components in ROM - D(bug("Searching for sound components with type sdev in ROM\n")); - uint32 thing = find_rom_resource(FOURCC('t','h','n','g')); - while (thing) { - thing += ROMBase; - D(bug(" found %c%c%c%c %c%c%c%c\n", ReadMacInt8(thing), ReadMacInt8(thing + 1), ReadMacInt8(thing + 2), ReadMacInt8(thing + 3), ReadMacInt8(thing + 4), ReadMacInt8(thing + 5), ReadMacInt8(thing + 6), ReadMacInt8(thing + 7))); - if (ReadMacInt32(thing) == FOURCC('s','d','e','v') && ReadMacInt32(thing + 4) == FOURCC('s','i','n','g')) { - WriteMacInt32(thing + 4, FOURCC('a','w','g','c')); - D(bug(" found sdev component at offset %08x in ROM\n", thing)); - AddSifter(ReadMacInt32(thing + componentResType), ReadMacInt16(thing + componentResID)); - if (ReadMacInt32(thing + componentPFCount)) - AddSifter(ReadMacInt32(thing + componentPFResType), ReadMacInt16(thing + componentPFResID)); - } - thing = find_rom_resource(FOURCC('t','h','n','g'), 4711, true); - } - - // Patch component code - D(bug("Patching sifters in ROM\n")); - for (int i=0; i pb_var; - const uintptr pb = pb_var.addr(); - -#if DISABLE_SCSI - // Setup fake SCSI Globals - r.d[0] = 0x1000; - Execute68kTrap(0xa71e, &r); // NewPtrSysClear() - uint32 scsi_globals = r.a[0]; - D(bug("Fake SCSI globals at %08lx\n", scsi_globals)); - WriteMacInt32(0xc0c, scsi_globals); // Set SCSIGlobals -#endif - - // Install floppy driver - if (ROMType == ROMTYPE_NEWWORLD || ROMType == ROMTYPE_GOSSAMER) { - - // Force installation of floppy driver with NewWorld and Gossamer ROMs - r.a[0] = ROMBase + sony_offset; - r.d[0] = (uint32)SonyRefNum; - Execute68kTrap(0xa43d, &r); // DrvrInstallRsrvMem() - r.a[0] = ReadMacInt32(ReadMacInt32(0x11c) + ~SonyRefNum * 4); // Get driver handle from Unit Table - Execute68kTrap(0xa029, &r); // HLock() - uint32 dce = ReadMacInt32(r.a[0]); - WriteMacInt32(dce + dCtlDriver, ROMBase + sony_offset); - WriteMacInt16(dce + dCtlFlags, SonyDriverFlags); - } - - // Open .Sony driver - SheepString sony_str("\005.Sony"); - WriteMacInt8(pb + ioPermssn, 0); - WriteMacInt32(pb + ioNamePtr, sony_str.addr()); - r.a[0] = pb; - Execute68kTrap(0xa000, &r); // Open() - - // Install disk driver - r.a[0] = ROMBase + sony_offset + 0x100; - r.d[0] = (uint32)DiskRefNum; - Execute68kTrap(0xa43d, &r); // DrvrInstallRsrvMem() - r.a[0] = ReadMacInt32(ReadMacInt32(0x11c) + ~DiskRefNum * 4); // Get driver handle from Unit Table - Execute68kTrap(0xa029, &r); // HLock() - uint32 dce = ReadMacInt32(r.a[0]); - WriteMacInt32(dce + dCtlDriver, ROMBase + sony_offset + 0x100); - WriteMacInt16(dce + dCtlFlags, DiskDriverFlags); - - // Open disk driver - SheepString disk_str("\005.Disk"); - WriteMacInt32(pb + ioNamePtr, disk_str.addr()); - r.a[0] = pb; - Execute68kTrap(0xa000, &r); // Open() - - // Install CD-ROM driver unless nocdrom option given - if (!PrefsFindBool("nocdrom")) { - - // Install CD-ROM driver - r.a[0] = ROMBase + sony_offset + 0x200; - r.d[0] = (uint32)CDROMRefNum; - Execute68kTrap(0xa43d, &r); // DrvrInstallRsrvMem() - r.a[0] = ReadMacInt32(ReadMacInt32(0x11c) + ~CDROMRefNum * 4); // Get driver handle from Unit Table - Execute68kTrap(0xa029, &r); // HLock() - dce = ReadMacInt32(r.a[0]); - WriteMacInt32(dce + dCtlDriver, ROMBase + sony_offset + 0x200); - WriteMacInt16(dce + dCtlFlags, CDROMDriverFlags); - - // Open CD-ROM driver - SheepString apple_cd("\010.AppleCD"); - WriteMacInt32(pb + ioNamePtr, apple_cd.addr()); - r.a[0] = pb; - Execute68kTrap(0xa000, &r); // Open() - } - - // Install serial drivers - r.a[0] = ROMBase + sony_offset + 0x300; - r.d[0] = (uint32)-6; - Execute68kTrap(0xa43d, &r); // DrvrInstallRsrvMem() - r.a[0] = ReadMacInt32(ReadMacInt32(0x11c) + ~(-6) * 4); // Get driver handle from Unit Table - Execute68kTrap(0xa029, &r); // HLock() - dce = ReadMacInt32(r.a[0]); - WriteMacInt32(dce + dCtlDriver, ROMBase + sony_offset + 0x300); - WriteMacInt16(dce + dCtlFlags, 0x4d00); - - r.a[0] = ROMBase + sony_offset + 0x400; - r.d[0] = (uint32)-7; - Execute68kTrap(0xa43d, &r); // DrvrInstallRsrvMem() - r.a[0] = ReadMacInt32(ReadMacInt32(0x11c) + ~(-7) * 4); // Get driver handle from Unit Table - Execute68kTrap(0xa029, &r); // HLock() - dce = ReadMacInt32(r.a[0]); - WriteMacInt32(dce + dCtlDriver, ROMBase + sony_offset + 0x400); - WriteMacInt16(dce + dCtlFlags, 0x4e00); - - r.a[0] = ROMBase + sony_offset + 0x500; - r.d[0] = (uint32)-8; - Execute68kTrap(0xa43d, &r); // DrvrInstallRsrvMem() - r.a[0] = ReadMacInt32(ReadMacInt32(0x11c) + ~(-8) * 4); // Get driver handle from Unit Table - Execute68kTrap(0xa029, &r); // HLock() - dce = ReadMacInt32(r.a[0]); - WriteMacInt32(dce + dCtlDriver, ROMBase + sony_offset + 0x500); - WriteMacInt16(dce + dCtlFlags, 0x4d00); - - r.a[0] = ROMBase + sony_offset + 0x600; - r.d[0] = (uint32)-9; - Execute68kTrap(0xa43d, &r); // DrvrInstallRsrvMem() - r.a[0] = ReadMacInt32(ReadMacInt32(0x11c) + ~(-9) * 4); // Get driver handle from Unit Table - Execute68kTrap(0xa029, &r); // HLock() - dce = ReadMacInt32(r.a[0]); - WriteMacInt32(dce + dCtlDriver, ROMBase + sony_offset + 0x600); - WriteMacInt16(dce + dCtlFlags, 0x4e00); -} diff --git a/SheepShaver/src/rsrc_patches.cpp b/SheepShaver/src/rsrc_patches.cpp deleted file mode 100644 index 8bf0ac4f..00000000 --- a/SheepShaver/src/rsrc_patches.cpp +++ /dev/null @@ -1,1051 +0,0 @@ -/* - * rsrc_patches.cpp - Resource patches - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include - -#include "sysdeps.h" -#include "rsrc_patches.h" -#include "cpu_emulation.h" -#include "emul_op.h" -#include "xlowmem.h" -#include "macos_util.h" -#include "rom_patches.h" -#include "main.h" -#include "audio.h" -#include "audio_defs.h" -#include "thunks.h" - -#define DEBUG 0 -#include "debug.h" - - -// Sound input driver -static const uint8 sound_input_driver[] = { // .AppleSoundInput driver header - // Driver header - 0x4d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x24, // Open() offset - 0x00, 0x28, // Prime() offset - 0x00, 0x2c, // Control() offset - 0x00, 0x38, // Status() offset - 0x00, 0x5e, // Close() offset - 0x10, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x00, // ".AppleSoundInput" - - // Open() - M68K_EMUL_OP_SOUNDIN_OPEN >> 8, M68K_EMUL_OP_SOUNDIN_OPEN & 0xff, - 0x4e, 0x75, // rts - - // Prime() - M68K_EMUL_OP_SOUNDIN_PRIME >> 8, M68K_EMUL_OP_SOUNDIN_PRIME & 0xff, - 0x60, 0x0e, // bra IOReturn - - // Control() - M68K_EMUL_OP_SOUNDIN_CONTROL >> 8, M68K_EMUL_OP_SOUNDIN_CONTROL & 0xff, - 0x0c, 0x68, 0x00, 0x01, 0x00, 0x1a, // cmp.w #1,$1a(a0) - 0x66, 0x04, // bne IOReturn - 0x4e, 0x75, // rts - - // Status() - M68K_EMUL_OP_SOUNDIN_STATUS >> 8, M68K_EMUL_OP_SOUNDIN_STATUS & 0xff, - - // IOReturn - 0x32, 0x28, 0x00, 0x06, // move.w 6(a0),d1 - 0x08, 0x01, 0x00, 0x09, // btst #9,d1 - 0x67, 0x0c, // beq 1 - 0x4a, 0x40, // tst.w d0 - 0x6f, 0x02, // ble 2 - 0x42, 0x40, // clr.w d0 - 0x31, 0x40, 0x00, 0x10, //2 move.w d0,$10(a0) - 0x4e, 0x75, // rts - 0x4a, 0x40, //1 tst.w d0 - 0x6f, 0x04, // ble 3 - 0x42, 0x40, // clr.w d0 - 0x4e, 0x75, // rts - 0x2f, 0x38, 0x08, 0xfc, //3 move.l $8fc,-(sp) - 0x4e, 0x75, // rts - - // Close() - M68K_EMUL_OP_SOUNDIN_CLOSE >> 8, M68K_EMUL_OP_SOUNDIN_CLOSE & 0xff, - 0x4e, 0x75, // rts -}; - - -/* - * Search resource for byte string, return offset (or 0) - */ - -static uint32 find_rsrc_data(const uint8 *rsrc, uint32 max, const uint8 *search, uint32 search_len, uint32 ofs = 0) -{ - while (ofs < max - search_len) { - if (!memcmp(rsrc + ofs, search, search_len)) - return ofs; - ofs++; - } - return 0; -} - - -/* - * Resource patches via vCheckLoad - */ - -// 680x0 code pattern matching helper -#define PM(N, V) (p[N] == htons(V)) - -void CheckLoad(uint32 type, int16 id, uint16 *p, uint32 size) -{ - uint16 *p16; - uint32 base; - D(bug("vCheckLoad %c%c%c%c (%08x) ID %d, data %p, size %d\n", type >> 24, (type >> 16) & 0xff, (type >> 8) & 0xff, type & 0xff, type, id, p, size)); - - // Don't modify resources in ROM - if ((uintptr)p >= (uintptr)ROMBaseHost && (uintptr)p <= (uintptr)(ROMBaseHost + ROM_SIZE)) - return; - - if (type == FOURCC('b','o','o','t') && id == 3) { - D(bug("boot 3 found\n")); - size >>= 1; - while (size--) { - if (PM(0,0x51c9) && PM(2,0x2e49)) { - // Set boot stack pointer (7.5.2, 7.5.3, 7.5.5, 7.6, 7.6.1, 8.0, 8.1, 8.5, 8.6, 9.0) - p[2] = htons(M68K_EMUL_OP_FIX_BOOTSTACK); - D(bug(" patch 1 applied\n")); - } else if (PM(0,0x4267) && PM(1,0x3f01) && PM(2,0x3f2a) && PM(3,0x0006) && PM(4,0x6100)) { - // Check when ntrb 17 is installed (for native Resource Manager patch) (7.5.3, 7.5.5) - p[7] = htons(M68K_EMUL_OP_NTRB_17_PATCH3); - D(bug(" patch 2 applied\n")); - } else if (PM(0,0x3f2a) && PM(1,0x0006) && PM(2,0x3f2a) && PM(3,0x0002) && PM(4,0x6100)) { - // Check when ntrb 17 is installed (for native Resource Manager patch) (7.6, 7.6.1, 8.0, 8.1) - p[7] = htons(M68K_EMUL_OP_NTRB_17_PATCH); - D(bug(" patch 3 applied\n")); - } else if (PM(0,0x3f2a) && PM(1,0x0006) && PM(2,0x3f2a) && PM(3,0x0002) && PM(4,0x61ff) && PM(8,0x245f)) { - // Check when ntrb 17 is installed (for native Resource Manager patch) (8.5, 8.6) - p[8] = htons(M68K_EMUL_OP_NTRB_17_PATCH); - D(bug(" patch 4 applied\n")); - } else if (PM(0,0x3f2a) && PM(1,0x0006) && PM(2,0x3f2a) && PM(3,0x0002) && PM(4,0x61ff) && PM(7,0x301f)) { - // Check when ntrb 17 is installed (for native Resource Manager patch) (9.0) - p[7] = htons(M68K_EMUL_OP_NTRB_17_PATCH4); - p[8] = htons(ntohs(p[8]) & 0xf0ff); // bra - D(bug(" patch 5 applied\n")); - } else if (PM(0,0x0c39) && PM(1,0x0001) && PM(2,0xf800) && PM(3,0x0008) && PM(4,0x6f00)) { - // Don't read from 0xf8000008 (8.5 with Zanzibar ROM, 8.6, 9.0) - p[0] = htons(M68K_NOP); - p[1] = htons(M68K_NOP); - p[2] = htons(M68K_NOP); - p[3] = htons(M68K_NOP); - p[4] = htons(0x6000); // bra - D(bug(" patch 6 applied\n")); - } else if (PM(0,0x2f3c) && PM(1,0x6b72) && PM(2,0x6e6c) && PM(3,0x4267) && PM(4,0xa9a0) && PM(5,0x265f) && PM(6,0x200b) && PM(7,0x6700)) { - // Don't replace nanokernel ("krnl" resource) (8.6, 9.0) - p[0] = htons(M68K_NOP); - p[1] = htons(M68K_NOP); - p[2] = htons(M68K_NOP); - p[3] = htons(M68K_NOP); - p[4] = htons(M68K_NOP); - p[7] = htons(0x6000); // bra - D(bug(" patch 7 applied\n")); - } else if (PM(0,0xa8fe) && PM(1,0x3038) && PM(2,0x017a) && PM(3,0x0c40) && PM(4,0x8805) && PM(5,0x6710)) { - // No SCSI (calls via 0x205c jump vector which is not initialized in NewWorld ROM 1.6) (8.6) - if (ROMType == ROMTYPE_NEWWORLD) { - p[5] = htons(0x6010); // bra - D(bug(" patch 8 applied\n")); - } - } else if (PM(0,0x2f3c) && PM(1,0x7665) && PM(2,0x7273) && PM(3,0x3f3c) && PM(4,0x0001) && PM(10,0x2041) && PM(11,0x2248) && PM(12,0x2050) && PM(20,0x7066) && PM(21,0xa9c9)) { - // Check when vers 1 is installed (for safe abort if MacOS < 8.1 is used with a NewWorld ROM) - p[10] = htons(M68K_EMUL_OP_CHECK_SYSV); - p[11] = htons(0x4a81); // tst.l d1 - p[12] = htons(0x670e); // beq.s - D(bug(" patch 9 applied\n")); - } - p++; - } - - } else if (type == FOURCC('g','n','l','d') && id == 0) { - D(bug("gnld 0 found\n")); - - // Patch native Resource Manager after ntrbs are installed (7.5.2) - static const uint8 dat[] = {0x4e, 0xba, 0x00, 0x9e, 0x3e, 0x00, 0x50, 0x4f, 0x67, 0x04}; - base = find_rsrc_data((uint8 *)p, size, dat, sizeof(dat)); - if (base) { - p16 = (uint16 *)((uintptr)p + base + 6); - *p16 = htons(M68K_EMUL_OP_NTRB_17_PATCH2); - D(bug(" patch 1 applied\n")); - } - - } else if (type == FOURCC('p','t','c','h') && id == 156) { - D(bug("ptch 156 found\n")); - size >>= 1; - while (size--) { - if (PM(0,0x4e56) && PM(1,0xfffa) && PM(2,0x48e7) && PM(3,0x1f18) && PM(4,0x7800) && PM(5,0x267c) && PM(6,0x6900) && PM(7,0x0000)) { - // Don't call FE0A opcode (9.0) - p[0] = htons(0x7000); // moveq #0,d0 - p[1] = htons(M68K_RTS); - D(bug(" patch 1 applied\n")); - break; - } - p++; - } - - } else if (type == FOURCC('p','t','c','h') && id == 420) { - D(bug("ptch 420 found\n")); - size >>= 1; - while (size--) { - if (PM(0,0xa030) && PM(1,0x5240) && PM(2,0x303c) && PM(3,0x0100) && PM(4,0xc06e) && PM(5,0xfef6)) { - // Disable VM (7.5.2, 7.5.3, 7.5.5, 7.6, 7.6.1) - p[1] = htons(M68K_NOP); - p[2] = htons(M68K_NOP); - p[3] = htons(M68K_NOP); - p[4] = htons(M68K_NOP); - p[5] = htons(M68K_NOP); - p[6] = htons(M68K_NOP); - p[7] = htons(M68K_NOP); - p[8] = htons(M68K_NOP); - p[9] = htons(M68K_NOP); - p[10] = htons(M68K_NOP); - p[11] = htons(M68K_NOP); - D(bug(" patch 1 applied\n")); - break; - } else if (PM(0,0xa030) && PM(1,0x5240) && PM(2,0x7000) && PM(3,0x302e) && PM(4,0xfef6) && PM(5,0x323c) && PM(6,0x0100)) { - // Disable VM (8.0, 8.1) - p[8] = htons(M68K_NOP); - p[15] = htons(M68K_NOP); - D(bug(" patch 2 applied\n")); - break; - } else if (PM(0,0xa030) && PM(1,0x5240) && PM(2,0x7000) && PM(3,0x302e) && PM(4,0xfecc) && PM(5,0x323c) && PM(6,0x0100)) { - // Disable VM (8.5, 8.6, 9.0) - p[8] = htons(M68K_NOP); - p[15] = htons(M68K_NOP); - D(bug(" patch 3 applied\n")); - break; - } - p++; - } - - } else if (type == FOURCC('g','p','c','h') && id == 16) { - D(bug("gpch 16 found\n")); - size >>= 1; - while (size--) { - if (PM(0,0x6700) && PM(13,0x7013) && PM(14,0xfe0a)) { - // Don't call FE0A in Shutdown Manager (7.6.1, 8.0, 8.1, 8.5) - p[0] = htons(0x6000); - D(bug(" patch 1 applied\n")); - break; - } - p++; - } - - } else if (type == FOURCC('g','p','c','h') && id == 650) { - D(bug("gpch 650 found\n")); - size >>= 1; - while (size--) { - if (PM(0,0x6600) && PM(1,0x001a) && PM(2,0x2278) && PM(3,0x0134)) { - // We don't have SonyVars (7.5.2) - p[0] = htons(0x6000); - D(bug(" patch 1 applied\n")); - } else if (PM(0,0x6618) && PM(1,0x2278) && PM(2,0x0134)) { - // We don't have SonyVars (7.5.3) - p[-6] = htons(M68K_NOP); - p[-3] = htons(M68K_NOP); - p[0] = htons(0x6018); - D(bug(" patch 2 applied\n")); - } else if (PM(0,0x6660) && PM(1,0x2278) && PM(2,0x0134)) { - // We don't have SonyVars (7.5.3 Revision 2.2) - p[-6] = htons(M68K_NOP); - p[-3] = htons(M68K_NOP); - p[0] = htons(0x6060); - D(bug(" patch 3 applied\n")); - } else if (PM(0,0x666e) && PM(1,0x2278) && PM(2,0x0134)) { - // We don't have SonyVars (7.5.5) - p[-6] = htons(M68K_NOP); - p[-3] = htons(M68K_NOP); - p[0] = htons(0x606e); - D(bug(" patch 4 applied\n")); - } else if (PM(0,0x6400) && PM(1,0x011c) && PM(2,0x2278) && PM(3,0x0134)) { - // We don't have SonyVars (7.6.1, 8.0, 8.1, 8.5, 8.6, 9.0) - p[0] = htons(0x6000); - D(bug(" patch 5 applied\n")); - } else if (PM(0,0x6400) && PM(1,0x00e6) && PM(2,0x2278) && PM(3,0x0134)) { - // We don't have SonyVars (7.6) - p[0] = htons(0x6000); - D(bug(" patch 6 applied\n")); - } - p++; - } - - } else if (type == FOURCC('g','p','c','h') && id == 655) { - D(bug("gpch 655 found\n")); - size >>= 1; - while (size--) { - if (PM(0,0x83a8) && PM(1,0x0024) && PM(2,0x4e71)) { - // Don't write to GC interrupt mask (7.6, 7.6.1, 8.0, 8.1 with Zanzibar ROM) - p[0] = htons(M68K_NOP); - p[1] = htons(M68K_NOP); - D(bug(" patch 1 applied\n")); - } else if (PM(0,0x207c) && PM(1,0xf300) && PM(2,0x0034)) { - // Don't read PowerMac ID (7.6, 7.6.1, 8.0, 8.1 with Zanzibar ROM) - p[0] = htons(0x303c); // move.w #id,d0 - p[1] = htons(0x3020); - p[2] = htons(M68K_RTS); - D(bug(" patch 2 applied\n")); - } else if (PM(0,0x13fc) && PM(1,0x0081) && PM(2,0xf130) && PM(3,0xa030)) { - // Don't write to hardware (7.6, 7.6.1, 8.0, 8.1 with Zanzibar ROM) - p[0] = htons(M68K_NOP); - p[1] = htons(M68K_NOP); - p[2] = htons(M68K_NOP); - p[3] = htons(M68K_NOP); - D(bug(" patch 3 applied\n")); - } else if (PM(0,0x4e56) && PM(1,0x0000) && PM(2,0x227c) && PM(3,0xf800) && PM(4,0x0000)) { - // OpenFirmare? (7.6.1, 8.0, 8.1 with Zanzibar ROM) - p[0] = htons(M68K_RTS); - D(bug(" patch 4 applied\n")); - } else if (PM(0,0x4e56) && PM(1,0xfffc) && PM(2,0x48e7) && PM(3,0x0300) && PM(4,0x598f) && PM(5,0x2eb8) && PM(6,0x01dc)) { - // Don't write to SCC (7.6.1, 8.0, 8.1 with Zanzibar ROM) - p[0] = htons(M68K_RTS); - D(bug(" patch 5 applied\n")); - } else if (PM(0,0x4e56) && PM(1,0x0000) && PM(2,0x227c) && PM(3,0xf300) && PM(4,0x0034)) { - // Don't write to GC (7.6.1, 8.0, 8.1 with Zanzibar ROM) - p[0] = htons(M68K_RTS); - D(bug(" patch 6 applied\n")); - } else if (PM(0,0x40e7) && PM(1,0x007c) && PM(2,0x0700) && PM(3,0x48e7) && PM(4,0x00c0) && PM(5,0x2078) && PM(6,0x0dd8) && PM(7,0xd1e8) && PM(8,0x0044) && PM(9,0x8005) && PM(11,0x93c8) && PM(12,0x2149) && PM(13,0x0024)) { - // Don't replace NVRAM routines (7.6, 7.6.1, 8.0, 8.1 with Zanzibar ROM) - p[0] = htons(M68K_RTS); - D(bug(" patch 7 applied\n")); - } else if (PM(0,0x207c) && PM(1,0x50f1) && PM(2,0xa101) && (PM(3,0x08d0) || PM(3,0x0890))) { - // Don't write to 0x50f1a101 (8.1 with Zanzibar ROM) - p[3] = htons(M68K_NOP); - p[4] = htons(M68K_NOP); - D(bug(" patch 8 applied\n")); - } - p++; - } - - } else if (type == FOURCC('g','p','c','h') && id == 750) { - D(bug("gpch 750 found\n")); - size >>= 1; - while (size--) { - if (PM(0,0xf301) && PM(1,0x9100) && PM(2,0x0c11) && PM(3,0x0044)) { - // Don't read from 0xf3019100 (MACE ENET) (7.6, 7.6.1, 8.0, 8.1) - p[2] = htons(M68K_NOP); - p[3] = htons(M68K_NOP); - p[4] = htons(0x6026); - D(bug(" patch 1 applied\n")); - } else if (PM(0,0x41e8) && PM(1,0x0374) && PM(2,0xfc1e)) { - // Don't call FC1E opcode (7.6, 7.6.1, 8.0, 8.1, 8.5, 8.6) - p[2] = htons(M68K_NOP); - D(bug(" patch 2 applied\n")); - } else if (PM(0,0x700a) && PM(1,0xfe0a)) { - // Don't call FE0A opcode (7.6, 7.6.1, 8.0, 8.1, 8.5, 8.6, 9.0) - p[1] = htons(0x2008); // move.l a0,d0 - D(bug(" patch 3 applied\n")); - } else if (PM(0,0x6c00) && PM(1,0x016a) && PM(2,0x2278) && PM(3,0x0134)) { - // We don't have SonyVars (8.6) - p[-4] = htons(0x21fc); // move.l $40810000,($0000) - p[-3] = htons(0x4081); - p[-2] = htons(0x0000); - p[-1] = htons(0x0000); - p[0] = htons(0x6000); - D(bug(" patch 4 applied\n")); - } - p++; - } - - } else if (type == FOURCC('g','p','c','h') && id == 999) { - D(bug("gpch 999 found\n")); - size >>= 1; - while (size--) { - if (PM(0,0xf301) && PM(1,0x9100) && PM(2,0x0c11) && PM(3,0x0044)) { - // Don't read from 0xf3019100 (MACE ENET) (8.5, 8.6) - p[2] = htons(M68K_NOP); - p[3] = htons(M68K_NOP); - p[4] = htons(0x6026); - D(bug(" patch 1 applied\n")); - } - p++; - } - - } else if (type == FOURCC('g','p','c','h') && id == 3000) { - D(bug("gpch 3000 found\n")); - size >>= 1; - while (size--) { - if (PM(0,0xf301) && PM(1,0x9100) && PM(2,0x0c11) && PM(3,0x0044)) { - // Don't read from 0xf3019100 (MACE ENET) (8.1 with NewWorld ROM) - p[2] = htons(M68K_NOP); - p[3] = htons(M68K_NOP); - p[4] = htons(0x6026); - D(bug(" patch 1 applied\n")); - } - p++; - } - - } else if (type == FOURCC('l','t','l','k') && id == 0) { - D(bug("ltlk 0 found\n")); -#if 1 - size >>= 1; - while (size--) { - if (PM(0,0xc2fc) && PM(1,0x0fa0) && PM(2,0x82c5)) { - // Prevent division by 0 in speed test (7.5.2, 7.5.3, 7.5.5, 7.6, 7.6.1, 8.0, 8.1) - p[2] = htons(0x7200); - WriteMacInt32(0x1d8, 0x2c00); - WriteMacInt32(0x1dc, 0x2c00); - D(bug(" patch 1 applied\n")); - } else if (PM(0,0x1418) && PM(1,0x84c1)) { - // Prevent division by 0 (7.5.2, 7.5.3, 7.5.5, 7.6, 7.6.1, 8.0, 8.1) - p[1] = htons(0x7400); - D(bug(" patch 2 applied\n")); - } else if (PM(0,0x2678) && PM(1,0x01dc) && PM(2,0x3018) && PM(3,0x6708) && PM(4,0x1680) && PM(5,0xe058) && PM(6,0x1680)) { - // Don't write to SCC (7.5.2, 7.5.3, 7.5.5, 7.6, 7.6.1, 8.0, 8.1) - p[4] = htons(M68K_NOP); - p[6] = htons(M68K_NOP); - D(bug(" patch 3 applied\n")); - } else if (PM(0,0x2278) && PM(1,0x01dc) && PM(2,0x12bc) && PM(3,0x0006) && PM(4,0x4e71) && PM(5,0x1292)) { - // Don't write to SCC (7.5.2, 7.5.3, 7.5.5, 7.6, 7.6.1, 8.0, 8.1) - p[2] = htons(M68K_NOP); - p[3] = htons(M68K_NOP); - p[5] = htons(M68K_NOP); - D(bug(" patch 4 applied\n")); - } else if (PM(0,0x2278) && PM(1,0x01dc) && PM(2,0x12bc) && PM(3,0x0003) && PM(4,0x4e71) && PM(5,0x1281)) { - // Don't write to SCC (7.5.2, 7.5.3, 7.5.5, 7.6, 7.6.1, 8.0, 8.1) - p[2] = htons(M68K_NOP); - p[3] = htons(M68K_NOP); - p[5] = htons(M68K_NOP); - D(bug(" patch 5 applied\n")); - } else if (PM(0,0x0811) && PM(1,0x0000) && PM(2,0x51c8) && PM(3,0xfffa)) { - // Don't test SCC (7.5.2, 7.5.3, 7.5.5, 7.6, 7.6.1, 8.0, 8.1) - p[0] = htons(M68K_NOP); - p[1] = htons(M68K_NOP); - D(bug(" patch 6 applied\n")); - } else if (PM(0,0x4a2a) && PM(1,0x063e) && PM(2,0x66fa)) { - // Don't wait for SCC (7.5.2, 7.5.3, 7.5.5) - p[2] = htons(M68K_NOP); - D(bug(" patch 7 applied\n")); - } else if (PM(0,0x4a2a) && PM(1,0x03a6) && PM(2,0x66fa)) { - // Don't wait for SCC (7.6, 7.6.1, 8.0, 8.1) - p[2] = htons(M68K_NOP); - D(bug(" patch 8 applied\n")); - } - p++; - } -#else - // Disable LocalTalk - p[0] = htons(M68K_JMP_A0); - p[1] = htons(0x7000); // moveq #0,d0 - p[2] = htons(M68K_RTS); - D(bug(" patch 1 applied\n")); -#endif - - } else if (type == FOURCC('n','s','r','d') && id == 1) { - D(bug("nsrd 1 found\n")); - if (p[(0x378 + 0x460) >> 1] == htons(0x7c08) && p[(0x37a + 0x460) >> 1] == htons(0x02a6)) { - // Don't overwrite our serial drivers (7.5.3 Revision 2.2) - p[(0x378 + 0x460) >> 1] = htons(0x4e80); // blr - p[(0x37a + 0x460) >> 1] = htons(0x0020); - D(bug(" patch 1 applied\n")); - } else if (p[(0x378 + 0x570) >> 1] == htons(0x7c08) && p[(0x37a + 0x570) >> 1] == htons(0x02a6)) { - // Don't overwrite our serial drivers (8.0, 8.1) - p[(0x378 + 0x570) >> 1] = htons(0x4e80); // blr - p[(0x37a + 0x570) >> 1] = htons(0x0020); - D(bug(" patch 2 applied\n")); - } else if (p[(0x378 + 0x6c0) >> 1] == htons(0x7c08) && p[(0x37a + 0x6c0) >> 1] == htons(0x02a6)) { - // Don't overwrite our serial drivers (8.5, 8.6) - p[(0x378 + 0x6c0) >> 1] = htons(0x4e80); // blr - p[(0x37a + 0x6c0) >> 1] = htons(0x0020); - D(bug(" patch 3 applied\n")); - } else if (p[(0x374 + 0x510) >> 1] == htons(0x7c08) && p[(0x376 + 0x510) >> 1] == htons(0x02a6)) { - // Don't overwrite our serial drivers (9.0) - p[(0x374 + 0x510) >> 1] = htons(0x4e80); // blr - p[(0x376 + 0x510) >> 1] = htons(0x0020); - D(bug(" patch 4 applied\n")); - } - - } else if (type == FOURCC('c','i','t','t') && id == 45) { - D(bug("citt 45 found\n")); - size >>= 1; - while (size--) { - if (PM(0,0x203c) && PM(1,0x0100) && PM(2,0x0000) && PM(3,0xc0ae) && PM(4,0xfffc)) { - // Don't replace SCSI Manager (8.1, 8.5, 8.6, 9.0) - p[5] = htons((ntohs(p[5]) & 0xff) | 0x6000); // beq - D(bug(" patch 1 applied\n")); - break; - } - p++; - } - - } else if (type == FOURCC('t','h','n','g')) { - // Collect info about used audio sifters - uint32 thing = Host2MacAddr((uint8 *)p); - uint32 c_type = ReadMacInt32(thing); - uint32 sub_type = ReadMacInt32(thing + 4); - if (c_type == FOURCC('s','d','e','v') && sub_type == FOURCC('s','i','n','g')) { - WriteMacInt32(thing + 4, FOURCC('a','w','g','c')); - D(bug("thng %d, type %c%c%c%c (%08x), sub type %c%c%c%c (%08x), data %p\n", id, c_type >> 24, (c_type >> 16) & 0xff, (c_type >> 8) & 0xff, c_type & 0xff, c_type, sub_type >> 24, (sub_type >> 16) & 0xff, (sub_type >> 8) & 0xff, sub_type & 0xff, sub_type, p)); - AddSifter(ReadMacInt32(thing + componentResType), ReadMacInt16(thing + componentResID)); - if (ReadMacInt32(thing + componentPFCount)) - AddSifter(ReadMacInt32(thing + componentPFResType), ReadMacInt16(thing + componentPFResID)); - } - - } else if (type == FOURCC('s','i','f','t') || type == FOURCC('n','i','f','t')) { - // Patch audio sifters - if (FindSifter(type, id)) { - D(bug("sifter found\n")); - p[0] = htons(0x4e56); p[1] = htons(0x0000); // link a6,#0 - p[2] = htons(0x48e7); p[3] = htons(0x8018); // movem.l d0/a3-a4,-(a7) - p[4] = htons(0x266e); p[5] = htons(0x000c); // movea.l $c(a6),a3 - p[6] = htons(0x286e); p[7] = htons(0x0008); // movea.l $8(a6),a4 - p[8] = htons(M68K_EMUL_OP_AUDIO_DISPATCH); - p[9] = htons(0x2d40); p[10] = htons(0x0010); // move.l d0,$10(a6) - p[11] = htons(0x4cdf); p[12] = htons(0x1801); // movem.l (a7)+,d0/a3-a4 - p[13] = htons(0x4e5e); // unlk a6 - p[14] = htons(0x4e74); p[15] = htons(0x0008); // rtd #8 - D(bug(" patch applied\n")); - } - - } else if (type == FOURCC('D','R','V','R') && (id == -16501 || id == -16500)) { - D(bug("DRVR -16501/-16500 found\n")); - // Install sound input driver - memcpy(p, sound_input_driver, sizeof(sound_input_driver)); - D(bug(" patch 1 applied\n")); - - } else if (type == FOURCC('I','N','I','T') && id == 1 && size == (2416 >> 1)) { - D(bug("INIT 1 (size 2416) found\n")); - size >>= 1; - while (size--) { - if (PM(0,0x247c) && PM(1,0xf301) && PM(2,0x9000)) { - // Prevent "MacOS Licensing Extension" from accessing hardware (7.6) - p[22] = htons(0x6028); - D(bug(" patch 1 applied\n")); - break; - } - p++; - } - - } else if (type == FOURCC('s','c','o','d') && id == -16465) { - D(bug("scod -16465 found\n")); - - // Don't crash in Process Manager on reset/shutdown (8.6, 9.0) - static const uint8 dat[] = {0x4e, 0x56, 0x00, 0x00, 0x48, 0xe7, 0x03, 0x18, 0x2c, 0x2e, 0x00, 0x10}; - base = find_rsrc_data((uint8 *)p, size, dat, sizeof(dat)); - if (base) { - p16 = (uint16 *)((uintptr)p + base); - p16[0] = htons(0x7000); // moveq #0,d0 - p16[1] = htons(M68K_RTS); - D(bug(" patch 1 applied\n")); - } - - } else if (type == FOURCC('N','O','b','j') && id == 100) { - D(bug("NObj 100 found\n")); - - // Don't access VIA registers in MacBench 5.0 - static const uint8 dat1[] = {0x7c, 0x08, 0x02, 0xa6, 0xbf, 0x01, 0xff, 0xe0, 0x90, 0x01, 0x00, 0x08}; - base = find_rsrc_data((uint8 *)p, size, dat1, sizeof(dat1)); - if (base) { - p[(base + 0x00) >> 1] = htons(0x3860); // li r3,0 - p[(base + 0x02) >> 1] = htons(0x0000); - p[(base + 0x04) >> 1] = htons(0x4e80); // blr - p[(base + 0x06) >> 1] = htons(0x0020); - D(bug(" patch 1 applied\n")); - } - static const uint8 dat2[] = {0x7c, 0x6c, 0x1b, 0x78, 0x7c, 0x8b, 0x23, 0x78, 0x38, 0xc0, 0x3f, 0xfd}; - base = find_rsrc_data((uint8 *)p, size, dat2, sizeof(dat2)); - if (base) { - p[(base + 0x00) >> 1] = htons(0x3860); // li r3,0 - p[(base + 0x02) >> 1] = htons(0x0000); - p[(base + 0x04) >> 1] = htons(0x4e80); // blr - p[(base + 0x06) >> 1] = htons(0x0020); - D(bug(" patch 2 applied\n")); - } - - } else if (type == FOURCC('C','O','D','E') && id == 27 && size == 25024) { - D(bug("CODE 27 found [Apple Personal Diagnostics]\n")); - - // Don't access FCBs directly in Apple Personal Diagnostics (MacOS 9) - // FIXME: this should not be called in the first place, use UTResolveFCB? - static const uint8 dat[] = {0x2d, 0x78, 0x03, 0x4e, 0xff, 0xf8, 0x20, 0x6e, 0xff, 0xf8}; - base = find_rsrc_data((uint8 *)p, size, dat, sizeof(dat)); - if (base - && ReadMacInt16(0x3f6) == 4 /* FSFCBLen */ - && p[(base + 0x1a) >> 1] == htons(0x605e) - && p[(base + 0x80) >> 1] == htons(0x7000)) - { - p[(base + 0x1a) >> 1] = htons(0x6064); - D(bug(" patch1 applied\n")); - } - - } else if (type == FOURCC('i','n','f','n') && (id == 129 || id == 200)) { - D(bug("infn %d found\n", id)); - size >>= 1; - while (size--) { - if (PM(0,0x203c) && PM(1,0xf800) && PM(2,0x0000) && PM(4,0x2040) && PM(5,0x1028) && PM(6,0x0090)) { - // Don't read from 0xf8000090 during MacOS (8.5, 9.0) installation - p[0] = htons(M68K_NOP); - p[1] = htons(M68K_NOP); - p[2] = htons(M68K_NOP); - p[3] = htons(M68K_NOP); - p[4] = htons(M68K_NOP); - p[5] = htons(M68K_NOP); - p[6] = htons(0x7000); // moveq #0,d0 - D(bug(" patch 1 applied\n")); - break; - } - p++; - } - - } -} - - -/* - * Resource patches via GetNamedResource() and Get1NamedResource() - */ - -void CheckLoad(uint32 type, const char *name, uint8 *p, uint32 size) -{ - uint16 *p16; - uint32 base; - D(bug("vCheckLoad %c%c%c%c (%08x) name \"%*s\", data %p, size %d\n", type >> 24, (type >> 16) & 0xff, (type >> 8) & 0xff, type & 0xff, type, name[0], &name[1], p, size)); - - // Don't modify resources in ROM - if ((uintptr)p >= (uintptr)ROMBaseHost && (uintptr)p <= (uintptr)(ROMBaseHost + ROM_SIZE)) - return; - - if (type == FOURCC('D','R','V','R') && strncmp(&name[1], ".AFPTranslator", name[0]) == 0) { - D(bug(" DRVR .AFPTranslator found\n")); - - // Don't access ROM85 as it it was a pointer to a ROM version number (8.0, 8.1) - static const uint8 dat[] = {0x3a, 0x2e, 0x00, 0x0a, 0x55, 0x4f, 0x3e, 0xb8, 0x02, 0x8e, 0x30, 0x1f, 0x48, 0xc0, 0x24, 0x40, 0x20, 0x40}; - base = find_rsrc_data(p, size, dat, sizeof(dat)); - if (base) { - p16 = (uint16 *)(p + base + 4); - *p16++ = htons(0x303c); // move.l #ROM85,%d0 - *p16++ = htons(0x028e); - *p16++ = htons(M68K_NOP); - *p16++ = htons(M68K_NOP); - D(bug(" patch 1 applied\n")); - } - } -} - - -/* - * Native Resource Manager patches - */ - -#ifdef __BEOS__ -static -#else -extern "C" -#endif -void check_load_invoc(uint32 type, int16 id, uint32 h) -{ - if (h == 0) - return; - uint32 p = ReadMacInt32(h); - if (p == 0) - return; - uint32 size = ReadMacInt32(p - 2 * 4) & 0xffffff; - - CheckLoad(type, id, (uint16 *)Mac2HostAddr(p), size); -} - -#ifdef __BEOS__ -static -#else -extern "C" -#endif -void named_check_load_invoc(uint32 type, uint32 name, uint32 h) -{ - if (h == 0) - return; - uint32 p = ReadMacInt32(h); - if (p == 0) - return; - uint32 size = ReadMacInt32(p - 2 * 4) & 0xffffff; - - CheckLoad(type, (char *)Mac2HostAddr(name), Mac2HostAddr(p), size); -} - -#ifdef __BEOS__ -static asm void **get_resource(register uint32 type, register int16 id) -{ - // Create stack frame - mflr r0 - stw r0,8(r1) - stwu r1,-(56+12)(r1) - - // Save type/ID - stw r3,56(r1) - stw r4,56+4(r1) - - // Call old routine - lwz r0,XLM_GET_RESOURCE - lwz r2,XLM_RES_LIB_TOC - mtctr r0 - bctrl - lwz r2,XLM_TOC // Get TOC - stw r3,56+8(r1) // Save handle - - // Call CheckLoad - lwz r3,56(r1) - lwz r4,56+4(r1) - lwz r5,56+8(r1) - bl check_load_invoc - lwz r3,56+8(r1) // Restore handle - - // Return to caller - lwz r0,56+12+8(r1) - mtlr r0 - addi r1,r1,56+12 - blr -} - -static asm void **get_1_resource(register uint32 type, register int16 id) -{ - // Create stack frame - mflr r0 - stw r0,8(r1) - stwu r1,-(56+12)(r1) - - // Save type/ID - stw r3,56(r1) - stw r4,56+4(r1) - - // Call old routine - lwz r0,XLM_GET_1_RESOURCE - lwz r2,XLM_RES_LIB_TOC - mtctr r0 - bctrl - lwz r2,XLM_TOC // Get TOC - stw r3,56+8(r1) // Save handle - - // Call CheckLoad - lwz r3,56(r1) - lwz r4,56+4(r1) - lwz r5,56+8(r1) - bl check_load_invoc - lwz r3,56+8(r1) // Restore handle - - // Return to caller - lwz r0,56+12+8(r1) - mtlr r0 - addi r1,r1,56+12 - blr -} - -static asm void **get_ind_resource(register uint32 type, register int16 index) -{ - // Create stack frame - mflr r0 - stw r0,8(r1) - stwu r1,-(56+12)(r1) - - // Save type/index - stw r3,56(r1) - stw r4,56+4(r1) - - // Call old routine - lwz r0,XLM_GET_IND_RESOURCE - lwz r2,XLM_RES_LIB_TOC - mtctr r0 - bctrl - lwz r2,XLM_TOC // Get TOC - stw r3,56+8(r1) // Save handle - - // Call CheckLoad - lwz r3,56(r1) - lwz r4,56+4(r1) - lwz r5,56+8(r1) - bl check_load_invoc - lwz r3,56+8(r1) // Restore handle - - // Return to caller - lwz r0,56+12+8(r1) - mtlr r0 - addi r1,r1,56+12 - blr -} - -static asm void **get_1_ind_resource(register uint32 type, register int16 index) -{ - // Create stack frame - mflr r0 - stw r0,8(r1) - stwu r1,-(56+12)(r1) - - // Save type/index - stw r3,56(r1) - stw r4,56+4(r1) - - // Call old routine - lwz r0,XLM_GET_1_IND_RESOURCE - lwz r2,XLM_RES_LIB_TOC - mtctr r0 - bctrl - lwz r2,XLM_TOC // Get TOC - stw r3,56+8(r1) // Save handle - - // Call CheckLoad - lwz r3,56(r1) - lwz r4,56+4(r1) - lwz r5,56+8(r1) - bl check_load_invoc - lwz r3,56+8(r1) // Restore handle - - // Return to caller - lwz r0,56+12+8(r1) - mtlr r0 - addi r1,r1,56+12 - blr -} - -static asm void **r_get_resource(register uint32 type, register int16 id) -{ - // Create stack frame - mflr r0 - stw r0,8(r1) - stwu r1,-(56+12)(r1) - - // Save type/ID - stw r3,56(r1) - stw r4,56+4(r1) - - // Call old routine - lwz r0,XLM_R_GET_RESOURCE - lwz r2,XLM_RES_LIB_TOC - mtctr r0 - bctrl - lwz r2,XLM_TOC // Get TOC - stw r3,56+8(r1) // Save handle - - // Call CheckLoad - lwz r3,56(r1) - lwz r4,56+4(r1) - lwz r5,56+8(r1) - bl check_load_invoc - lwz r3,56+8(r1) // Restore handle - - // Return to caller - lwz r0,56+12+8(r1) - mtlr r0 - addi r1,r1,56+12 - blr -} - -static asm void **get_named_resource(register uint32 type, register uint32 name) -{ - // Create stack frame - mflr r0 - stw r0,8(r1) - stwu r1,-(56+12)(r1) - - // Save type/ID - stw r3,56(r1) - stw r4,56+4(r1) - - // Call old routine - lwz r0,XLM_GET_NAMED_RESOURCE - lwz r2,XLM_RES_LIB_TOC - mtctr r0 - bctrl - lwz r2,XLM_TOC // Get TOC - stw r3,56+8(r1) // Save handle - - // Call CheckLoad - lwz r3,56(r1) - lwz r4,56+4(r1) - lwz r5,56+8(r1) - bl named_check_load_invoc - lwz r3,56+8(r1) // Restore handle - - // Return to caller - lwz r0,56+12+8(r1) - mtlr r0 - addi r1,r1,56+12 - blr -} - -static asm void **get_1_named_resource(register uint32 type, register uint32 name) -{ - // Create stack frame - mflr r0 - stw r0,8(r1) - stwu r1,-(56+12)(r1) - - // Save type/ID - stw r3,56(r1) - stw r4,56+4(r1) - - // Call old routine - lwz r0,XLM_GET_1_NAMED_RESOURCE - lwz r2,XLM_RES_LIB_TOC - mtctr r0 - bctrl - lwz r2,XLM_TOC // Get TOC - stw r3,56+8(r1) // Save handle - - // Call CheckLoad - lwz r3,56(r1) - lwz r4,56+4(r1) - lwz r5,56+8(r1) - bl named_check_load_invoc - lwz r3,56+8(r1) // Restore handle - - // Return to caller - lwz r0,56+12+8(r1) - mtlr r0 - addi r1,r1,56+12 - blr -} -#else -// Routines in asm_linux.S -extern "C" void get_resource(void); -extern "C" void get_1_resource(void); -extern "C" void get_ind_resource(void); -extern "C" void get_1_ind_resource(void); -extern "C" void r_get_resource(void); -extern "C" void get_named_resource(void); -extern "C" void get_1_named_resource(void); -#endif - -void PatchNativeResourceManager(void) -{ - D(bug("PatchNativeResourceManager\n")); - - // Patch native GetResource() - uint32 upp = ReadMacInt32(0x1480); - if ((upp & 0xffc00000) == ROMBase) - return; - uint32 tvec = ReadMacInt32(upp + 5 * 4); - D(bug(" GetResource() entry %08x, TOC %08x\n", ReadMacInt32(tvec), ReadMacInt32(tvec + 4))); - WriteMacInt32(XLM_RES_LIB_TOC, ReadMacInt32(tvec + 4)); - WriteMacInt32(XLM_GET_RESOURCE, ReadMacInt32(tvec)); -#if EMULATED_PPC - WriteMacInt32(tvec, NativeFunction(NATIVE_GET_RESOURCE)); -#else -#ifdef __BEOS__ - uint32 *tvec2 = (uint32 *)get_resource; - WriteMacInt32(tvec, tvec2[0]); - WriteMacInt32(tvec + 4, tvec2[1]); -#else - WriteMacInt32(tvec, (uint32)get_resource); -#endif -#endif - - // Patch native Get1Resource() - upp = ReadMacInt32(0x0e7c); - tvec = ReadMacInt32(upp + 5 * 4); - D(bug(" Get1Resource() entry %08x, TOC %08x\n", ReadMacInt32(tvec), ReadMacInt32(tvec + 4))); - WriteMacInt32(XLM_GET_1_RESOURCE, ReadMacInt32(tvec)); -#if EMULATED_PPC - WriteMacInt32(tvec, NativeFunction(NATIVE_GET_1_RESOURCE)); -#else -#ifdef __BEOS__ - tvec2 = (uint32 *)get_1_resource; - WriteMacInt32(tvec, tvec2[0]); - WriteMacInt32(tvec + 4, tvec2[1]); -#else - WriteMacInt32(tvec, (uint32)get_1_resource); -#endif -#endif - - // Patch native GetIndResource() - upp = ReadMacInt32(0x1474); - tvec = ReadMacInt32(upp + 5 * 4); - D(bug(" GetIndResource() entry %08x, TOC %08x\n", ReadMacInt32(tvec), ReadMacInt32(tvec + 4))); - WriteMacInt32(XLM_GET_IND_RESOURCE, ReadMacInt32(tvec)); -#if EMULATED_PPC - WriteMacInt32(tvec, NativeFunction(NATIVE_GET_IND_RESOURCE)); -#else -#ifdef __BEOS__ - tvec2 = (uint32 *)get_ind_resource; - WriteMacInt32(tvec, tvec2[0]); - WriteMacInt32(tvec + 4, tvec2[1]); -#else - WriteMacInt32(tvec, (uint32)get_ind_resource); -#endif -#endif - - // Patch native Get1IndResource() - upp = ReadMacInt32(0x0e38); - tvec = ReadMacInt32(upp + 5 * 4); - D(bug(" Get1IndResource() entry %08x, TOC %08x\n", ReadMacInt32(tvec), ReadMacInt32(tvec + 4))); - WriteMacInt32(XLM_GET_1_IND_RESOURCE, ReadMacInt32(tvec)); -#if EMULATED_PPC - WriteMacInt32(tvec, NativeFunction(NATIVE_GET_1_IND_RESOURCE)); -#else -#ifdef __BEOS__ - tvec2 = (uint32 *)get_1_ind_resource; - WriteMacInt32(tvec, tvec2[0]); - WriteMacInt32(tvec + 4, tvec2[1]); -#else - WriteMacInt32(tvec, (uint32)get_1_ind_resource); -#endif -#endif - - // Patch native RGetResource() - upp = ReadMacInt32(0x0e30); - tvec = ReadMacInt32(upp + 5 * 4); - D(bug(" RGetResource() entry %08x, TOC %08x\n", ReadMacInt32(tvec), ReadMacInt32(tvec + 4))); - WriteMacInt32(XLM_R_GET_RESOURCE, ReadMacInt32(tvec)); -#if EMULATED_PPC - WriteMacInt32(tvec, NativeFunction(NATIVE_R_GET_RESOURCE)); -#else -#ifdef __BEOS__ - tvec2 = (uint32 *)r_get_resource; - WriteMacInt32(tvec, tvec2[0]); - WriteMacInt32(tvec + 4, tvec2[1]); -#else - WriteMacInt32(tvec, (uint32)r_get_resource); -#endif -#endif - - // Patch native GetNamedResource() - upp = ReadMacInt32(0x1484); - tvec = ReadMacInt32(upp + 5 * 4); - D(bug(" GetNamedResource() entry %08x, TOC %08x\n", ReadMacInt32(tvec), ReadMacInt32(tvec + 4))); - WriteMacInt32(XLM_GET_NAMED_RESOURCE, ReadMacInt32(tvec)); -#if EMULATED_PPC - WriteMacInt32(tvec, NativeFunction(NATIVE_GET_NAMED_RESOURCE)); -#else -#ifdef __BEOS__ - tvec2 = (uint32 *)get_named_resource; - WriteMacInt32(tvec, tvec2[0]); - WriteMacInt32(tvec + 4, tvec2[1]); -#else - WriteMacInt32(tvec, (uint32)get_named_resource); -#endif -#endif - - // Patch native Get1NamedResource() - upp = ReadMacInt32(0x0e80); - tvec = ReadMacInt32(upp + 5 * 4); - D(bug(" Get1NamedResource() entry %08x, TOC %08x\n", ReadMacInt32(tvec), ReadMacInt32(tvec + 4))); - WriteMacInt32(XLM_GET_1_NAMED_RESOURCE, ReadMacInt32(tvec)); -#if EMULATED_PPC - WriteMacInt32(tvec, NativeFunction(NATIVE_GET_1_NAMED_RESOURCE)); -#else -#ifdef __BEOS__ - tvec2 = (uint32 *)get_1_named_resource; - WriteMacInt32(tvec, tvec2[0]); - WriteMacInt32(tvec + 4, tvec2[1]); -#else - WriteMacInt32(tvec, (uint32)get_1_named_resource); -#endif -#endif -} diff --git a/SheepShaver/src/scsi.cpp b/SheepShaver/src/scsi.cpp deleted file mode 120000 index 1e1a7e34..00000000 --- a/SheepShaver/src/scsi.cpp +++ /dev/null @@ -1 +0,0 @@ -../../BasiliskII/src/scsi.cpp \ No newline at end of file diff --git a/SheepShaver/src/serial.cpp b/SheepShaver/src/serial.cpp deleted file mode 100644 index 723fc8dc..00000000 --- a/SheepShaver/src/serial.cpp +++ /dev/null @@ -1,315 +0,0 @@ -/* - * serial.cpp - Serial device driver - * - * SheepShaver (C) 1997-2008 Marc Hellwig and Christian Bauer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" -#include "main.h" -#include "macos_util.h" -#include "serial.h" -#include "serial_defs.h" - -#define DEBUG 0 -#include "debug.h" - - -// Global variables -SERDPort *the_serd_port[2]; - -// Function pointers from imported functions -typedef int16 (*iocic_ptr)(uint32, int16); -static uint32 iocic_tvect = 0; -static inline int16 IOCommandIsComplete(uint32 arg1, int16 arg2) -{ - return (int16)CallMacOS2(iocic_ptr, iocic_tvect, arg1, arg2); -} - - -/* - * Empty function (AIn/BIn Open/Close) - */ - -int16 SerialNothing(uint32 pb, uint32 dce) -{ - return noErr; -} - - -/* - * Driver Open() routine (output side only) - */ - -int16 SerialOpen(uint32 pb, uint32 dce) -{ - D(bug("SerialOpen pb %08lx, dce %08lx\n", pb, dce)); - - // Get IOCommandIsComplete function - iocic_tvect = FindLibSymbol("\021DriverServicesLib", "\023IOCommandIsComplete"); - D(bug("IOCommandIsComplete TVECT at %08lx\n", iocic_tvect)); - if (iocic_tvect == 0) { - printf("FATAL: SerialOpen(): Can't find IOCommandIsComplete()\n"); - return openErr; - } - - // Do nothing if port is already open - SERDPort *the_port = the_serd_port[(-(int16)ReadMacInt16(dce + dCtlRefNum)-6) >> 1]; - if (the_port->is_open) - return noErr; - - // Init variables - the_port->read_pending = the_port->write_pending = false; - the_port->read_done = the_port->write_done = false; - the_port->cum_errors = 0; - - // Open port - int16 res = the_port->open(ReadMacInt16(0x1fc + ((-(int16)ReadMacInt16(dce + dCtlRefNum)-6) & 2))); - if (res) - return res; - - // Allocate Deferred Task structures - if ((the_port->dt_store = Mac_sysalloc(SIZEOF_serdt * 2)) == 0) - return openErr; - uint32 input_dt = the_port->input_dt = the_port->dt_store; - uint32 output_dt = the_port->output_dt = the_port->dt_store + SIZEOF_serdt; - D(bug(" input_dt %08lx, output_dt %08lx\n", input_dt, output_dt)); - - WriteMacInt16(input_dt + qType, dtQType); - WriteMacInt32(input_dt + dtAddr, input_dt + serdtCode); - WriteMacInt32(input_dt + dtParam, input_dt + serdtResult); - // Deferred function for signalling that Prime is complete (pointer to mydtResult in a1) - WriteMacInt16(input_dt + serdtCode, 0x2019); // move.l (a1)+,d0 (result) - WriteMacInt16(input_dt + serdtCode + 2, 0x2251); // move.l (a1),a1 (dce) - WriteMacInt32(input_dt + serdtCode + 4, 0x207808fc); // move.l JIODone,a0 - WriteMacInt16(input_dt + serdtCode + 8, 0x4ed0); // jmp (a0) - - WriteMacInt16(output_dt + qType, dtQType); - WriteMacInt32(output_dt + dtAddr, output_dt + serdtCode); - WriteMacInt32(output_dt + dtParam, output_dt + serdtResult); - // Deferred function for signalling that Prime is complete (pointer to mydtResult in a1) - WriteMacInt16(output_dt + serdtCode, 0x2019); // move.l (a1)+,d0 (result) - WriteMacInt16(output_dt + serdtCode + 2, 0x2251); // move.l (a1),a1 (dce) - WriteMacInt32(output_dt + serdtCode + 4, 0x207808fc); // move.l JIODone,a0 - WriteMacInt16(output_dt + serdtCode + 8, 0x4ed0); // jmp (a0) - - the_port->is_open = true; - return noErr; -} - - -/* - * Driver Prime() routines - */ - -int16 SerialPrimeIn(uint32 pb, uint32 dce) -{ - D(bug("SerialPrimeIn pb %08lx, dce %08lx\n", pb, dce)); - int16 res; - - SERDPort *the_port = the_serd_port[(-(int16)ReadMacInt16(dce + dCtlRefNum)-6) >> 1]; - if (!the_port->is_open) - res = notOpenErr; - else { - if (the_port->read_pending) { - printf("FATAL: SerialPrimeIn() called while request is pending\n"); - res = readErr; - } else - res = the_port->prime_in(pb, dce); - } - - if (ReadMacInt16(pb + ioTrap) & 0x0200) - if (res > 0) { - WriteMacInt16(pb + ioResult, 0); - return 0; // Command in progress - } else { - WriteMacInt16(pb + ioResult, res); - return res; - } - else - if (res > 0) - return 0; // Command in progress - else { - IOCommandIsComplete(pb, res); - return res; - } -} - -int16 SerialPrimeOut(uint32 pb, uint32 dce) -{ - D(bug("SerialPrimeOut pb %08lx, dce %08lx\n", pb, dce)); - int16 res; - - SERDPort *the_port = the_serd_port[(-(int16)ReadMacInt16(dce + dCtlRefNum)-6) >> 1]; - if (!the_port->is_open) - res = notOpenErr; - else { - if (the_port->write_pending) { - printf("FATAL: SerialPrimeOut() called while request is pending\n"); - res = writErr; - } else - res = the_port->prime_out(pb, dce); - } - - if (ReadMacInt16(pb + ioTrap) & 0x0200) - if (res > 0) { - WriteMacInt16(pb + ioResult, 0); - return 0; // Command in progress - } else { - WriteMacInt16(pb + ioResult, res); - return res; - } - else - if (res > 0) - return 0; // Command in progress - else { - IOCommandIsComplete(pb, res); - return res; - } -} - - -/* - * Driver Control() routine - */ - -int16 SerialControl(uint32 pb, uint32 dce) -{ - uint16 code = ReadMacInt16(pb + csCode); - D(bug("SerialControl %d, pb %08lx, dce %08lx\n", code, pb, dce)); - int16 res; - - SERDPort *the_port = the_serd_port[(-(int16)ReadMacInt16(dce + dCtlRefNum)-6) >> 1]; - if (!the_port->is_open) - res = notOpenErr; - else { - switch (code) { - case kSERDSetPollWrite: - res = noErr; - break; - default: - res = the_port->control(pb, dce, code); - break; - } - } - - if (code == 1) - return res; - else if (ReadMacInt16(pb + ioTrap) & 0x0200) { - WriteMacInt16(pb + ioResult, res); - return res; - } else { - IOCommandIsComplete(pb, res); - return res; - } -} - - -/* - * Driver Status() routine - */ - -int16 SerialStatus(uint32 pb, uint32 dce) -{ - uint16 code = ReadMacInt16(pb + csCode); - D(bug("SerialStatus %d, pb %08lx, dce %08lx\n", code, pb, dce)); - int16 res; - - SERDPort *the_port = the_serd_port[(-(int16)ReadMacInt16(dce + dCtlRefNum)-6) >> 1]; - if (!the_port->is_open) - res = notOpenErr; - else { - switch (code) { - case kSERDVersion: - WriteMacInt8(pb + csParam, 9); // Second-generation SerialDMA driver - res = noErr; - break; - - case 0x8000: - WriteMacInt8(pb + csParam, 9); // Second-generation SerialDMA driver - WriteMacInt16(pb + csParam + 4, 0x1997); // Date of serial driver - WriteMacInt16(pb + csParam + 6, 0x0616); - res = noErr; - break; - - default: - res = the_port->status(pb, dce, code); - break; - } - } - - if (ReadMacInt16(pb + ioTrap) & 0x0200) { - WriteMacInt16(pb + ioResult, res); - return res; - } else { - IOCommandIsComplete(pb, res); - return res; - } -} - - -/* - * Driver Close() routine - */ - -int16 SerialClose(uint32 pb, uint32 dce) -{ - D(bug("SerialClose pb %08lx, dce %08lx\n", pb, dce)); - - // Close port if open - SERDPort *the_port = the_serd_port[(-(int16)ReadMacInt16(dce + dCtlRefNum)-6) >> 1]; - if (the_port->is_open) { - Mac_sysfree(the_port->dt_store); - int16 res = the_port->close(); - the_port->is_open = false; - return res; - } else - return noErr; -} - - -/* - * Serial interrupt - Prime command completed, activate deferred tasks to call IODone - */ - -void SerialInterrupt(void) -{ - D(bug("SerialIRQ\n")); - - // Port 0 - if (the_serd_port[0]->is_open) { - if (the_serd_port[0]->read_pending && the_serd_port[0]->read_done) { - Enqueue(the_serd_port[0]->input_dt, 0xd92); - the_serd_port[0]->read_pending = the_serd_port[0]->read_done = false; - } - if (the_serd_port[0]->write_pending && the_serd_port[0]->write_done) { - Enqueue(the_serd_port[0]->output_dt, 0xd92); - the_serd_port[0]->write_pending = the_serd_port[0]->write_done = false; - } - } - - // Port 1 - if (the_serd_port[1]->is_open) { - if (the_serd_port[1]->read_pending && the_serd_port[1]->read_done) { - Enqueue(the_serd_port[1]->input_dt, 0xd92); - the_serd_port[1]->read_pending = the_serd_port[1]->read_done = false; - } - if (the_serd_port[1]->write_pending && the_serd_port[1]->write_done) { - Enqueue(the_serd_port[1]->output_dt, 0xd92); - the_serd_port[1]->write_pending = the_serd_port[1]->write_done = false; - } - } -} diff --git a/SheepShaver/src/slirp b/SheepShaver/src/slirp deleted file mode 120000 index 4e6fe8f5..00000000 --- a/SheepShaver/src/slirp +++ /dev/null @@ -1 +0,0 @@ -../../BasiliskII/src/slirp \ No newline at end of file diff --git a/SheepShaver/src/sony.cpp b/SheepShaver/src/sony.cpp deleted file mode 120000 index 42aaabb7..00000000 --- a/SheepShaver/src/sony.cpp +++ /dev/null @@ -1 +0,0 @@ -../../BasiliskII/src/sony.cpp \ No newline at end of file diff --git a/SheepShaver/src/thunks.cpp b/SheepShaver/src/thunks.cpp deleted file mode 100644 index f8a1b64a..00000000 --- a/SheepShaver/src/thunks.cpp +++ /dev/null @@ -1,406 +0,0 @@ -/* - * thunks.cpp - Thunks to share data and code with MacOS - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" -#include "thunks.h" -#include "emul_op.h" -#include "cpu_emulation.h" -#include "xlowmem.h" - -// Native function declarations -#include "main.h" -#include "video.h" -#include "name_registry.h" -#include "serial.h" -#include "ether.h" -#include "macos_util.h" - -// Generate PowerPC thunks for GetResource() replacements? -#define POWERPC_GET_RESOURCE_THUNKS 1 - - -/* NativeOp instruction format: - +------------+-------------------------+--+-----------+------------+ - | 6 | |FN| OP | 2 | - +------------+-------------------------+--+-----------+------------+ - 0 5 |6 18 19 20 25 26 31 -*/ - -#define POWERPC_NATIVE_OP(FN, OP) \ - (POWERPC_EMUL_OP | ((FN) << 12) | (((uint32)OP) << 6) | 2) - -/* - * Return the fake PowerPC opcode to handle specified native code - */ - -#if EMULATED_PPC -uint32 NativeOpcode(int selector) -{ - uint32 opcode; - switch (selector) { - case NATIVE_CHECK_LOAD_INVOC: - case NATIVE_NAMED_CHECK_LOAD_INVOC: - case NATIVE_NQD_SYNC_HOOK: - case NATIVE_NQD_BITBLT_HOOK: - case NATIVE_NQD_FILLRECT_HOOK: - case NATIVE_NQD_UNKNOWN_HOOK: - case NATIVE_NQD_BITBLT: - case NATIVE_NQD_INVRECT: - case NATIVE_NQD_FILLRECT: - opcode = POWERPC_NATIVE_OP(0, selector); - break; - case NATIVE_PATCH_NAME_REGISTRY: - case NATIVE_VIDEO_INSTALL_ACCEL: - case NATIVE_VIDEO_VBL: - case NATIVE_VIDEO_DO_DRIVER_IO: - case NATIVE_ETHER_AO_GET_HWADDR: - case NATIVE_ETHER_AO_ADD_MULTI: - case NATIVE_ETHER_AO_DEL_MULTI: - case NATIVE_ETHER_AO_SEND_PACKET: - case NATIVE_ETHER_IRQ: - case NATIVE_ETHER_INIT: - case NATIVE_ETHER_TERM: - case NATIVE_ETHER_OPEN: - case NATIVE_ETHER_CLOSE: - case NATIVE_ETHER_WPUT: - case NATIVE_ETHER_RSRV: - case NATIVE_SERIAL_NOTHING: - case NATIVE_SERIAL_OPEN: - case NATIVE_SERIAL_PRIME_IN: - case NATIVE_SERIAL_PRIME_OUT: - case NATIVE_SERIAL_CONTROL: - case NATIVE_SERIAL_STATUS: - case NATIVE_SERIAL_CLOSE: - case NATIVE_GET_RESOURCE: - case NATIVE_GET_1_RESOURCE: - case NATIVE_GET_IND_RESOURCE: - case NATIVE_GET_1_IND_RESOURCE: - case NATIVE_R_GET_RESOURCE: - case NATIVE_GET_NAMED_RESOURCE: - case NATIVE_GET_1_NAMED_RESOURCE: - case NATIVE_MAKE_EXECUTABLE: - opcode = POWERPC_NATIVE_OP(1, selector); - break; - default: - abort(); - } - return opcode; -} -#endif - - -/* - * Generate PowerPC thunks for GetResource() replacements - */ - -#if EMULATED_PPC -static uint32 get_resource_func; -static uint32 get_1_resource_func; -static uint32 get_ind_resource_func; -static uint32 get_1_ind_resource_func; -static uint32 r_get_resource_func; -static uint32 get_named_resource_func; -static uint32 get_1_named_resource_func; - -static void generate_powerpc_thunks(void) -{ - // check_load_invoc() thunk - uint32 check_load_invoc_opcode = NativeOpcode(NATIVE_CHECK_LOAD_INVOC); - uint32 base; - - static uint32 get_resource_template[] = { - PL(0x7c0802a6), // mflr r0 - PL(0x90010008), // stw r0,8(r1) - PL(0x9421ffbc), // stwu r1,-68(r1) - PL(0x90610038), // stw r3,56(r1) - PL(0x9081003c), // stw r4,60(r1) - PL(0x00000000), // lwz r0,XLM_GET_RESOURCE(r0) - PL(0x80402834), // lwz r2,XLM_RES_LIB_TOC(r0) - PL(0x7c0903a6), // mtctr r0 - PL(0x4e800421), // bctrl - PL(0x90610040), // stw r3,64(r1) - PL(0x80610038), // lwz r3,56(r1) - PL(0xa881003e), // lha r4,62(r1) - PL(0x80a10040), // lwz r5,64(r1) - PL(0x00000001), // - PL(0x80610040), // lwz r3,64(r1) - PL(0x8001004c), // lwz r0,76(r1) - PL(0x7c0803a6), // mtlr r0 - PL(0x38210044), // addi r1,r1,68 - PL(0x4e800020) // blr - }; - const uint32 get_resource_template_size = sizeof(get_resource_template); - - int xlm_index = -1, check_load_invoc_index = -1; - for (int i = 0; i < get_resource_template_size/4; i++) { - uint32 opcode = ntohl(get_resource_template[i]); - switch (opcode) { - case 0x00000000: - xlm_index = i; - break; - case 0x00000001: - check_load_invoc_index = i; - break; - } - } - assert(xlm_index != -1 && check_load_invoc_index != -1); - - // GetResource() - get_resource_func = base = SheepMem::Reserve(get_resource_template_size); - Host2Mac_memcpy(base, get_resource_template, get_resource_template_size); - WriteMacInt32(base + xlm_index * 4, 0x80000000 | XLM_GET_RESOURCE); - WriteMacInt32(base + check_load_invoc_index * 4, check_load_invoc_opcode); - - // Get1Resource() - get_1_resource_func = base = SheepMem::Reserve(get_resource_template_size); - Host2Mac_memcpy(base, get_resource_template, get_resource_template_size); - WriteMacInt32(base + xlm_index * 4, 0x80000000 | XLM_GET_1_RESOURCE); - WriteMacInt32(base + check_load_invoc_index * 4, check_load_invoc_opcode); - - // GetIndResource() - get_ind_resource_func = base = SheepMem::Reserve(get_resource_template_size); - Host2Mac_memcpy(base, get_resource_template, get_resource_template_size); - WriteMacInt32(base + xlm_index * 4, 0x80000000 | XLM_GET_IND_RESOURCE); - WriteMacInt32(base + check_load_invoc_index * 4, check_load_invoc_opcode); - - // Get1IndResource() - get_1_ind_resource_func = base = SheepMem::Reserve(get_resource_template_size); - Host2Mac_memcpy(base, get_resource_template, get_resource_template_size); - WriteMacInt32(base + xlm_index * 4, 0x80000000 | XLM_GET_1_IND_RESOURCE); - WriteMacInt32(base + check_load_invoc_index * 4, check_load_invoc_opcode); - - // RGetResource() - r_get_resource_func = base = SheepMem::Reserve(get_resource_template_size); - Host2Mac_memcpy(base, get_resource_template, get_resource_template_size); - WriteMacInt32(base + xlm_index * 4, 0x80000000 | XLM_R_GET_RESOURCE); - WriteMacInt32(base + check_load_invoc_index * 4, check_load_invoc_opcode); - - // named_check_load_invoc() thunk - check_load_invoc_opcode = NativeOpcode(NATIVE_NAMED_CHECK_LOAD_INVOC); - - static uint32 get_named_resource_template[] = { - PL(0x7c0802a6), // mflr r0 - PL(0x90010008), // stw r0,8(r1) - PL(0x9421ffbc), // stwu r1,-68(r1) - PL(0x90610038), // stw r3,56(r1) - PL(0x9081003c), // stw r4,60(r1) - PL(0x00000000), // lwz r0,XLM_GET_NAMED_RESOURCE(r0) - PL(0x80402834), // lwz r2,XLM_RES_LIB_TOC(r0) - PL(0x7c0903a6), // mtctr r0 - PL(0x4e800421), // bctrl - PL(0x90610040), // stw r3,64(r1) - PL(0x80610038), // lwz r3,56(r1) - PL(0x8081003c), // lwz r4,60(r1) - PL(0x80a10040), // lwz r5,64(r1) - PL(0x00000001), // - PL(0x80610040), // lwz r3,64(r1) - PL(0x8001004c), // lwz r0,76(r1) - PL(0x7c0803a6), // mtlr r0 - PL(0x38210044), // addi r1,r1,68 - PL(0x4e800020) // blr - }; - const uint32 get_named_resource_template_size = sizeof(get_named_resource_template); - - xlm_index = -1, check_load_invoc_index = -1; - for (int i = 0; i < get_resource_template_size/4; i++) { - uint32 opcode = ntohl(get_resource_template[i]); - switch (opcode) { - case 0x00000000: - xlm_index = i; - break; - case 0x00000001: - check_load_invoc_index = i; - break; - } - } - assert(xlm_index != -1 && check_load_invoc_index != -1); - - // GetNamedResource() - get_named_resource_func = base = SheepMem::Reserve(get_named_resource_template_size); - Host2Mac_memcpy(base, get_named_resource_template, get_named_resource_template_size); - WriteMacInt32(base + xlm_index * 4, 0x80000000 | XLM_GET_NAMED_RESOURCE); - WriteMacInt32(base + check_load_invoc_index * 4, check_load_invoc_opcode); - - // Get1NamedResource() - get_1_named_resource_func = base = SheepMem::Reserve(get_named_resource_template_size); - Host2Mac_memcpy(base, get_named_resource_template, get_named_resource_template_size); - WriteMacInt32(base + xlm_index * 4, 0x80000000 | XLM_GET_1_NAMED_RESOURCE); - WriteMacInt32(base + check_load_invoc_index * 4, check_load_invoc_opcode); -} -#endif - - -/* - * Initialize the thunks system - */ - -struct native_op_t { - uint32 tvect; - uint32 func; - SheepRoutineDescriptor *desc; -}; -static native_op_t native_op[NATIVE_OP_MAX]; - -bool ThunksInit(void) -{ -#if EMULATED_PPC - for (int i = 0; i < NATIVE_OP_MAX; i++) { - uintptr base = SheepMem::Reserve(16); - WriteMacInt32(base + 0, base + 8); - WriteMacInt32(base + 4, 0); // Fake TVECT - WriteMacInt32(base + 8, NativeOpcode(i)); - WriteMacInt32(base + 12, POWERPC_BLR); - native_op[i].tvect = base; - native_op[i].func = base + 8; - } -#if POWERPC_GET_RESOURCE_THUNKS - generate_powerpc_thunks(); - native_op[NATIVE_GET_RESOURCE].func = get_resource_func; - native_op[NATIVE_GET_1_RESOURCE].func = get_1_resource_func; - native_op[NATIVE_GET_IND_RESOURCE].func = get_ind_resource_func; - native_op[NATIVE_GET_1_IND_RESOURCE].func = get_1_ind_resource_func; - native_op[NATIVE_R_GET_RESOURCE].func = r_get_resource_func; - native_op[NATIVE_GET_NAMED_RESOURCE].func = get_named_resource_func; - native_op[NATIVE_GET_1_NAMED_RESOURCE].func = get_1_named_resource_func; -#endif -#else -#if defined(__linux__) || defined(__NetBSD__) || (defined(__APPLE__) && defined(__MACH__)) -#define DEFINE_NATIVE_OP(ID, FUNC) do { \ - uintptr base = SheepMem::Reserve(8); \ - WriteMacInt32(base + 0, (uint32)FUNC); \ - WriteMacInt32(base + 4, (uint32)TOC); \ - native_op[ID].tvect = base; \ - native_op[ID].func = (uint32)FUNC; \ - } while (0) -#elif defined(__BEOS__) -#define DEFINE_NATIVE_OP(ID, FUNC) do { \ - native_op[ID].tvect = FUNC; \ - native_op[ID].func = ((uint32 *)FUNC)[0]; \ - } while (0) -#else -#error "FIXME: define NativeOp for your platform" -#endif - // FIXME: add GetResource() and friends for completeness - DEFINE_NATIVE_OP(NATIVE_PATCH_NAME_REGISTRY, DoPatchNameRegistry); - DEFINE_NATIVE_OP(NATIVE_VIDEO_INSTALL_ACCEL, VideoInstallAccel); - DEFINE_NATIVE_OP(NATIVE_VIDEO_VBL, VideoVBL); - DEFINE_NATIVE_OP(NATIVE_VIDEO_DO_DRIVER_IO, VideoDoDriverIO); - DEFINE_NATIVE_OP(NATIVE_ETHER_AO_GET_HWADDR, AO_get_ethernet_address); - DEFINE_NATIVE_OP(NATIVE_ETHER_AO_ADD_MULTI, AO_enable_multicast); - DEFINE_NATIVE_OP(NATIVE_ETHER_AO_DEL_MULTI, AO_disable_multicast); - DEFINE_NATIVE_OP(NATIVE_ETHER_AO_SEND_PACKET, AO_transmit_packet); - DEFINE_NATIVE_OP(NATIVE_ETHER_IRQ, EtherIRQ); - DEFINE_NATIVE_OP(NATIVE_ETHER_INIT, InitStreamModule); - DEFINE_NATIVE_OP(NATIVE_ETHER_TERM, TerminateStreamModule); - DEFINE_NATIVE_OP(NATIVE_ETHER_OPEN, ether_open); - DEFINE_NATIVE_OP(NATIVE_ETHER_CLOSE, ether_close); - DEFINE_NATIVE_OP(NATIVE_ETHER_WPUT, ether_wput); - DEFINE_NATIVE_OP(NATIVE_ETHER_RSRV, ether_rsrv); - DEFINE_NATIVE_OP(NATIVE_SERIAL_NOTHING, SerialNothing); - DEFINE_NATIVE_OP(NATIVE_SERIAL_OPEN, SerialOpen); - DEFINE_NATIVE_OP(NATIVE_SERIAL_PRIME_IN, SerialPrimeIn); - DEFINE_NATIVE_OP(NATIVE_SERIAL_PRIME_OUT, SerialPrimeOut); - DEFINE_NATIVE_OP(NATIVE_SERIAL_CONTROL, SerialControl); - DEFINE_NATIVE_OP(NATIVE_SERIAL_STATUS, SerialStatus); - DEFINE_NATIVE_OP(NATIVE_SERIAL_CLOSE, SerialClose); - DEFINE_NATIVE_OP(NATIVE_MAKE_EXECUTABLE, MakeExecutable); - DEFINE_NATIVE_OP(NATIVE_NQD_SYNC_HOOK, NQD_sync_hook); - DEFINE_NATIVE_OP(NATIVE_NQD_BITBLT_HOOK, NQD_bitblt_hook); - DEFINE_NATIVE_OP(NATIVE_NQD_FILLRECT_HOOK, NQD_fillrect_hook); - DEFINE_NATIVE_OP(NATIVE_NQD_UNKNOWN_HOOK, NQD_unknown_hook); - DEFINE_NATIVE_OP(NATIVE_NQD_BITBLT, NQD_bitblt); - DEFINE_NATIVE_OP(NATIVE_NQD_INVRECT, NQD_invrect); - DEFINE_NATIVE_OP(NATIVE_NQD_FILLRECT, NQD_fillrect); -#undef DEFINE_NATIVE_OP -#endif - - // Initialize routine descriptors (if TVECT exists) - for (int i = 0; i < NATIVE_OP_MAX; i++) { - uint32 tvect = native_op[i].tvect; - if (tvect) - native_op[i].desc = new SheepRoutineDescriptor(0, tvect); - } - - return true; -} - - -/* - * Delete generated thunks - */ - -void ThunksExit(void) -{ - for (int i = 0; i < NATIVE_OP_MAX; i++) { - SheepRoutineDescriptor *desc = native_op[i].desc; - if (desc) - delete desc; - } -} - - -/* - * Return the native function descriptor (TVECT) - */ - -uint32 NativeTVECT(int selector) -{ - assert(selector < NATIVE_OP_MAX); - const uint32 tvect = native_op[selector].tvect; - assert(tvect != 0); - return tvect; -} - - -/* - * Return the native function address - */ - -uint32 NativeFunction(int selector) -{ - assert(selector < NATIVE_OP_MAX); - const uint32 func = native_op[selector].func; - assert(func != 0); - return func; -} - - -/* - * Return the routine descriptor address of the native function - */ - -uint32 NativeRoutineDescriptor(int selector) -{ - assert(selector < NATIVE_OP_MAX); - SheepRoutineDescriptor * const desc = native_op[selector].desc; - assert(desc != 0); - return desc->addr(); -} - - -/* - * Execute native code from EMUL_OP routine (real mode switch) - */ - -void ExecuteNative(int selector) -{ - M68kRegisters r; - Execute68k(NativeRoutineDescriptor(selector), &r); -} diff --git a/SheepShaver/src/timer.cpp b/SheepShaver/src/timer.cpp deleted file mode 100644 index 3edd6ca0..00000000 --- a/SheepShaver/src/timer.cpp +++ /dev/null @@ -1,677 +0,0 @@ -/* - * timer.cpp - Time Manager emulation - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" -#include "timer.h" -#include "macos_util.h" -#include "main.h" -#include "cpu_emulation.h" - -#ifdef PRECISE_TIMING_POSIX -#include -#include -#endif - -#ifdef PRECISE_TIMING_MACH -#include -#endif - -#define DEBUG 0 -#include "debug.h" - - -#define TM_QUEUE 0 // Enable TMQueue management (doesn't work) - - -// Definitions for Time Manager -enum { // TMTask struct - tmAddr = 6, - tmCount = 10, - tmWakeUp = 14, - tmReserved = 18 -}; - - -// Array of additional info for each installed TMTask -struct TMDesc { - uint32 task; // Mac address of associated TMTask - tm_time_t wakeup; // Time this task is scheduled for execution - TMDesc *next; -}; - -static TMDesc *tmDescList; - -#if PRECISE_TIMING -#ifdef PRECISE_TIMING_BEOS -static thread_id timer_thread = -1; -static bool thread_active = true; -static const tm_time_t wakeup_time_max = 0x7fffffffffffffff; -static volatile tm_time_t wakeup_time = wakeup_time_max; -static sem_id wakeup_time_sem = -1; -static int32 timer_func(void *arg); -#endif -#ifdef PRECISE_TIMING_POSIX -static pthread_t timer_thread; -static bool timer_thread_active = false; -static volatile bool timer_thread_cancel = false; -static tm_time_t wakeup_time_max = { 0x7fffffff, 999999999 }; -static tm_time_t wakeup_time = wakeup_time_max; -static pthread_mutex_t wakeup_time_lock = PTHREAD_MUTEX_INITIALIZER; -static void *timer_func(void *arg); -#endif -#ifdef PRECISE_TIMING_MACH -static clock_serv_t system_clock; -static thread_act_t timer_thread; -static bool timer_thread_active = false; -static tm_time_t wakeup_time_max = { 0x7fffffff, 999999999 }; -static tm_time_t wakeup_time = wakeup_time_max; -static semaphore_t wakeup_time_sem; -static void *timer_func(void *arg); -#endif -#endif - - -inline static void free_desc(TMDesc *desc) -{ - if (desc == tmDescList) { - tmDescList = desc->next; - } else { - for (TMDesc *d = tmDescList; d; d = d->next) { - if (d->next == desc) { - d->next = desc->next; - break; - } - } - } - delete desc; -} - -/* - * Find descriptor associated with given TMTask - */ - -inline static TMDesc *find_desc(uint32 tm) -{ - TMDesc *desc = tmDescList; - while (desc) { - if (desc->task == tm) { - return desc; - } - desc = desc->next; - } - return NULL; -} - - -/* - * Enqueue task in Time Manager queue - */ - -static void enqueue_tm(uint32 tm) -{ -#if TM_QUEUE - uint32 tm_var = ReadMacInt32(0xb30); - WriteMacInt32(tm + qLink, ReadMacInt32(tm_var)); - WriteMacInt32(tm_var, tm); -#endif -} - - -/* - * Remove task from Time Manager queue - */ - -static void dequeue_tm(uint32 tm) -{ -#if TM_QUEUE - uint32 p = ReadMacInt32(0xb30); - while (p) { - uint32 next = ReadMacInt32(p + qLink); - if (next == tm) { - WriteMacInt32(p + qLink, ReadMacInt32(next + qLink)); - return; - } - } -#endif -} - - -/* - * Timer thread operations - */ - -#ifdef PRECISE_TIMING_POSIX -const int SIGSUSPEND = SIGRTMIN + 6; -const int SIGRESUME = SIGRTMIN + 7; -static struct sigaction sigsuspend_action; -static struct sigaction sigresume_action; - -static int suspend_count = 0; -static pthread_mutex_t suspend_count_lock = PTHREAD_MUTEX_INITIALIZER; -static sem_t suspend_ack_sem; -static sigset_t suspend_handler_mask; - -// Signal handler for suspended thread -static void sigsuspend_handler(int sig) -{ - sem_post(&suspend_ack_sem); - sigsuspend(&suspend_handler_mask); -} - -// Signal handler for resumed thread -static void sigresume_handler(int sig) -{ - /* simply trigger a signal to stop clock_nanosleep() */ -} - -// Initialize timer thread -static bool timer_thread_init(void) -{ - // Install suspend signal handler - sigemptyset(&sigsuspend_action.sa_mask); - sigaddset(&sigsuspend_action.sa_mask, SIGRESUME); - sigsuspend_action.sa_handler = sigsuspend_handler; - sigsuspend_action.sa_flags = SA_RESTART; -#ifdef HAVE_SIGNAL_SA_RESTORER - sigsuspend_action.sa_restorer = NULL; -#endif - if (sigaction(SIGSUSPEND, &sigsuspend_action, NULL) < 0) - return false; - - // Install resume signal handler - sigemptyset(&sigresume_action.sa_mask); - sigresume_action.sa_handler = sigresume_handler; - sigresume_action.sa_flags = SA_RESTART; -#ifdef HAVE_SIGNAL_SA_RESTORER - sigresume_action.sa_restorer = NULL; -#endif - if (sigaction(SIGRESUME, &sigresume_action, NULL) < 0) - return false; - - // Initialize semaphore - if (sem_init(&suspend_ack_sem, 0, 0) < 0) - return false; - - // Initialize suspend_handler_mask, it excludes SIGRESUME - if (sigfillset(&suspend_handler_mask) != 0) - return false; - if (sigdelset(&suspend_handler_mask, SIGRESUME) != 0) - return false; - - // Create thread in running state - suspend_count = 0; - return (pthread_create(&timer_thread, NULL, timer_func, NULL) == 0); -} - -// Kill timer thread -static void timer_thread_kill(void) -{ - timer_thread_cancel = true; -#ifdef HAVE_PTHREAD_CANCEL - pthread_cancel(timer_thread); -#endif - pthread_join(timer_thread, NULL); -} - -// Suspend timer thread -static void timer_thread_suspend(void) -{ - pthread_mutex_lock(&suspend_count_lock); - if (suspend_count == 0) { - suspend_count ++; - if (pthread_kill(timer_thread, SIGSUSPEND) == 0) - sem_wait(&suspend_ack_sem); - } - pthread_mutex_unlock(&suspend_count_lock); -} - -// Resume timer thread -static void timer_thread_resume(void) -{ - pthread_mutex_lock(&suspend_count_lock); - assert(suspend_count > 0); - if (suspend_count == 1) { - suspend_count = 0; - pthread_kill(timer_thread, SIGRESUME); - } - pthread_mutex_unlock(&suspend_count_lock); -} -#endif - - -/* - * Initialize Time Manager - */ - -void TimerInit(void) -{ - TimerReset(); - -#if PRECISE_TIMING - // Start timer thread -#ifdef PRECISE_TIMING_BEOS - wakeup_time_sem = create_sem(1, "Wakeup Time"); - timer_thread = spawn_thread(timer_func, "Time Manager", B_REAL_TIME_PRIORITY, NULL); - resume_thread(timer_thread); -#elif PRECISE_TIMING_MACH - pthread_t pthread; - - host_get_clock_service(mach_host_self(), REALTIME_CLOCK, &system_clock); - semaphore_create(mach_task_self(), &wakeup_time_sem, SYNC_POLICY_FIFO, 1); - - pthread_create(&pthread, NULL, &timer_func, NULL); -#endif -#ifdef PRECISE_TIMING_POSIX - timer_thread_active = timer_thread_init(); -#endif -#endif -} - - -/* - * Exit Time Manager - */ - -void TimerExit(void) -{ -#if PRECISE_TIMING - // Quit timer thread - if (timer_thread > 0) { -#ifdef PRECISE_TIMING_BEOS - status_t l; - thread_active = false; - suspend_thread(timer_thread); - resume_thread(timer_thread); - wait_for_thread(timer_thread, &l); - delete_sem(wakeup_time_sem); -#endif -#ifdef PRECISE_TIMING_MACH - timer_thread_active = false; - semaphore_destroy(mach_task_self(), wakeup_time_sem); -#endif -#ifdef PRECISE_TIMING_POSIX - timer_thread_kill(); -#endif - } -#endif -} - - -/* - * Emulator reset, remove all timer tasks - */ - -void TimerReset(void) -{ - TMDesc *desc = tmDescList; - while (desc) { - TMDesc *next = desc->next; - delete desc; - desc = next; - } - tmDescList = NULL; -} - - -/* - * Insert timer task - */ - -int16 InsTime(uint32 tm, uint16 trap) -{ - D(bug("InsTime %08lx, trap %04x\n", tm, trap)); - WriteMacInt16((uint32)tm + qType, ReadMacInt16((uint32)tm + qType) & 0x1fff | (trap << 4) & 0x6000); - if (find_desc(tm)) - printf("WARNING: InsTime(%08x): Task re-inserted\n", tm); - else { - TMDesc *desc = new TMDesc; - desc->task = tm; - desc->next = tmDescList; - tmDescList = desc; - } - return 0; -} - - -/* - * Remove timer task - */ - -int16 RmvTime(uint32 tm) -{ - D(bug("RmvTime %08lx\n", tm)); - - // Find descriptor - TMDesc *desc = find_desc(tm); - if (!desc) { - printf("WARNING: RmvTime(%08x): Descriptor not found\n", tm); - return 0; - } - - // Task active? -#if PRECISE_TIMING_BEOS - while (acquire_sem(wakeup_time_sem) == B_INTERRUPTED) ; - suspend_thread(timer_thread); -#endif -#ifdef PRECISE_TIMING_MACH - semaphore_wait(wakeup_time_sem); - thread_suspend(timer_thread); -#endif -#if PRECISE_TIMING_POSIX - timer_thread_suspend(); - pthread_mutex_lock(&wakeup_time_lock); -#endif - if (ReadMacInt16(tm + qType) & 0x8000) { - - // Yes, make task inactive and remove it from the Time Manager queue - WriteMacInt16(tm + qType, ReadMacInt16(tm + qType) & 0x7fff); - dequeue_tm(tm); -#if PRECISE_TIMING - // Look for next task to be called and set wakeup_time - wakeup_time = wakeup_time_max; - for (TMDesc *d = tmDescList; d; d = d->next) - if ((ReadMacInt16(d->task + qType) & 0x8000)) - if (timer_cmp_time(d->wakeup, wakeup_time) < 0) - wakeup_time = d->wakeup; -#endif - - // Compute remaining time - tm_time_t remaining, current; - timer_current_time(current); - timer_sub_time(remaining, desc->wakeup, current); - WriteMacInt32(tm + tmCount, timer_host2mac_time(remaining)); - } else - WriteMacInt32(tm + tmCount, 0); - D(bug(" tmCount %ld\n", ReadMacInt32(tm + tmCount))); -#if PRECISE_TIMING_BEOS - release_sem(wakeup_time_sem); - thread_info info; - do { - resume_thread(timer_thread); // This will unblock the thread - get_thread_info(timer_thread, &info); - } while (info.state == B_THREAD_SUSPENDED); // Sometimes, resume_thread() doesn't work (BeOS bug?) -#endif -#ifdef PRECISE_TIMING_MACH - semaphore_signal(wakeup_time_sem); - thread_abort(timer_thread); - thread_resume(timer_thread); -#endif -#if PRECISE_TIMING_POSIX - pthread_mutex_unlock(&wakeup_time_lock); - timer_thread_resume(); - assert(suspend_count == 0); -#endif - - // Free descriptor - free_desc(desc); - return 0; -} - - -/* - * Start timer task - */ - -int16 PrimeTime(uint32 tm, int32 time) -{ - D(bug("PrimeTime %08lx, time %ld\n", tm, time)); - - // Find descriptor - TMDesc *desc = find_desc(tm); - if (!desc) { - printf("FATAL: PrimeTime(%08x): Descriptor not found\n", tm); - return 0; - } - - // Convert delay time - tm_time_t delay; - timer_mac2host_time(delay, time); - - // Extended task? - if (ReadMacInt16(tm + qType) & 0x4000) { - - // Yes, tmWakeUp set? - if (ReadMacInt32(tm + tmWakeUp)) { - - // PrimeTime(0) can either mean (a) "the task runs as soon as interrupts are enabled" - // or (b) "continue previous delay" if an expired task was stopped via RmvTime() and - // then re-installed using InsXTime(). Since tmWakeUp was set, this is case (b). - // The remaining time was saved in tmCount by RmvTime(). - if (time == 0) { - timer_mac2host_time(delay, ReadMacInt16(tm + tmCount)); - } - - // Yes, calculate wakeup time relative to last scheduled time - tm_time_t wakeup; - timer_add_time(wakeup, desc->wakeup, delay); - desc->wakeup = wakeup; - - } else { - - // No, calculate wakeup time relative to current time - tm_time_t now; - timer_current_time(now); - timer_add_time(desc->wakeup, now, delay); - } - - // Set tmWakeUp to indicate that task was scheduled - WriteMacInt32(tm + tmWakeUp, 0x12345678); - - } else { - - // Not extended task, calculate wakeup time relative to current time - tm_time_t now; - timer_current_time(now); - timer_add_time(desc->wakeup, now, delay); - } - - // Make task active and enqueue it in the Time Manager queue -#if PRECISE_TIMING_BEOS - while (acquire_sem(wakeup_time_sem) == B_INTERRUPTED) ; - suspend_thread(timer_thread); -#endif -#ifdef PRECISE_TIMING_MACH - semaphore_wait(wakeup_time_sem); - thread_suspend(timer_thread); -#endif -#if PRECISE_TIMING_POSIX - timer_thread_suspend(); - pthread_mutex_lock(&wakeup_time_lock); -#endif - WriteMacInt16(tm + qType, ReadMacInt16(tm + qType) | 0x8000); - enqueue_tm(tm); -#if PRECISE_TIMING - // Look for next task to be called and set wakeup_time - wakeup_time = wakeup_time_max; - for (TMDesc *d = tmDescList; d; d = d->next) - if ((ReadMacInt16(d->task + qType) & 0x8000)) - if (timer_cmp_time(d->wakeup, wakeup_time) < 0) - wakeup_time = d->wakeup; -#ifdef PRECISE_TIMING_BEOS - release_sem(wakeup_time_sem); - thread_info info; - do { - resume_thread(timer_thread); // This will unblock the thread - get_thread_info(timer_thread, &info); - } while (info.state == B_THREAD_SUSPENDED); // Sometimes, resume_thread() doesn't work (BeOS bug?) -#endif -#ifdef PRECISE_TIMING_MACH - semaphore_signal(wakeup_time_sem); - thread_abort(timer_thread); - thread_resume(timer_thread); -#endif -#ifdef PRECISE_TIMING_POSIX - pthread_mutex_unlock(&wakeup_time_lock); - timer_thread_resume(); - assert(suspend_count == 0); -#endif -#endif - return 0; -} - - -/* - * Time Manager thread - */ - -#ifdef PRECISE_TIMING_BEOS -static int32 timer_func(void *arg) -{ - while (thread_active) { - - // Wait until time specified by wakeup_time - snooze_until(wakeup_time, B_SYSTEM_TIMEBASE); - - while (acquire_sem(wakeup_time_sem) == B_INTERRUPTED) ; - if (wakeup_time < system_time()) { - - // Timer expired, trigger interrupt - wakeup_time = 0x7fffffffffffffff; - SetInterruptFlag(INTFLAG_TIMER); - TriggerInterrupt(); - } - release_sem(wakeup_time_sem); - } - return 0; -} -#endif - -#ifdef PRECISE_TIMING_MACH -static void *timer_func(void *arg) -{ - timer_thread = mach_thread_self(); - timer_thread_active = true; - - while (timer_thread_active) { - clock_sleep(system_clock, TIME_ABSOLUTE, wakeup_time, NULL); - semaphore_wait(wakeup_time_sem); - - tm_time_t system_time; - - timer_current_time(system_time); - if (timer_cmp_time(wakeup_time, system_time) < 0) { - wakeup_time = wakeup_time_max; - SetInterruptFlag(INTFLAG_TIMER); - TriggerInterrupt(); - } - semaphore_signal(wakeup_time_sem); - } - return NULL; -} -#endif - -#ifdef PRECISE_TIMING_POSIX -static void *timer_func(void *arg) -{ - while (!timer_thread_cancel) { - // Wait until time specified by wakeup_time - clock_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, &wakeup_time, NULL); - - tm_time_t system_time; - timer_current_time(system_time); - if (timer_cmp_time(wakeup_time, system_time) < 0) { - - // Timer expired, trigger interrupt - pthread_mutex_lock(&wakeup_time_lock); - wakeup_time = wakeup_time_max; - pthread_mutex_unlock(&wakeup_time_lock); - SetInterruptFlag(INTFLAG_TIMER); - TriggerInterrupt(); - } - } - return NULL; -} -#endif - - -/* - * Timer interrupt function (executed as part of 60Hz interrupt) - */ - -void TimerInterrupt(void) -{ -// D(bug("TimerIRQ\n")); - - // Look for active TMTasks that have expired - tm_time_t now; - timer_current_time(now); - TMDesc *desc = tmDescList; - while (desc) { - TMDesc *next = desc->next; - uint32 tm = desc->task; - if ((ReadMacInt16(tm + qType) & 0x8000) && timer_cmp_time(desc->wakeup, now) <= 0) { - - // Found one, mark as inactive and remove it from the Time Manager queue - WriteMacInt16(tm + qType, ReadMacInt16(tm + qType) & 0x7fff); - dequeue_tm(tm); - - // Call timer function - uint32 addr = ReadMacInt32(tm + tmAddr); - if (addr) { - D(bug("Calling TimeTask %08lx, addr %08lx\n", tm, addr)); - M68kRegisters r; - r.a[0] = addr; - r.a[1] = tm; - Execute68k(r.a[0], &r); - D(bug(" returned from TimeTask\n")); - } - } - desc = next; - } - -#if PRECISE_TIMING - // Look for next task to be called and set wakeup_time -#if PRECISE_TIMING_BEOS - while (acquire_sem(wakeup_time_sem) == B_INTERRUPTED) ; - suspend_thread(timer_thread); -#endif -#if PRECISE_TIMING_MACH - semaphore_wait(wakeup_time_sem); - thread_suspend(timer_thread); -#endif -#if PRECISE_TIMING_POSIX - timer_thread_suspend(); - pthread_mutex_lock(&wakeup_time_lock); -#endif - wakeup_time = wakeup_time_max; - for (TMDesc *d = tmDescList; d; d = d->next) - if ((ReadMacInt16(d->task + qType) & 0x8000)) - if (timer_cmp_time(d->wakeup, wakeup_time) < 0) - wakeup_time = d->wakeup; -#if PRECISE_TIMING_BEOS - release_sem(wakeup_time_sem); - thread_info info; - do { - resume_thread(timer_thread); // This will unblock the thread - get_thread_info(timer_thread, &info); - } while (info.state == B_THREAD_SUSPENDED); // Sometimes, resume_thread() doesn't work (BeOS bug?) -#endif -#if PRECISE_TIMING_MACH - semaphore_signal(wakeup_time_sem); - thread_abort(timer_thread); - thread_resume(timer_thread); -#endif -#if PRECISE_TIMING_POSIX - pthread_mutex_unlock(&wakeup_time_lock); - timer_thread_resume(); - assert(suspend_count == 0); -#endif -#endif -} diff --git a/SheepShaver/src/user_strings.cpp b/SheepShaver/src/user_strings.cpp deleted file mode 100644 index 4041d451..00000000 --- a/SheepShaver/src/user_strings.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/* - * user_strings.cpp - Localizable strings - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NOTES: - * - * This should only be used for user-interface related messages that must be - * translated or transcibed for localized versions of SheepShaver. - * It should NOT be used for: - * - file names - * - names of threads, areas, ports, semaphores, drivers, views and other "invisible" names - * - debugging messages - * - error messages that only go to the shell ("FATAL"/"WARNING", those are really debugging messages) - */ - -#include "sysdeps.h" -#include "user_strings.h" - -#ifdef __BEOS__ -#define ELLIPSIS "\xE2\x80\xA6" -#else -#define ELLIPSIS "..." -#endif - - -// Common string definitions -user_string_def common_strings[] = { - {STR_ABOUT_TEXT1, "SheepShaver V%d.%d"}, - {STR_ABOUT_TEXT2, "by Christian Bauer and Mar\"c\" Hellwig"}, - {STR_READING_ROM_FILE, "Reading ROM file...\n"}, - {STR_SHELL_ERROR_PREFIX, "ERROR: %s\n"}, - {STR_GUI_ERROR_PREFIX, "SheepShaver error:\n%s"}, - {STR_ERROR_ALERT_TITLE, "SheepShaver Error"}, - {STR_SHELL_WARNING_PREFIX, "WARNING: %s\n"}, - {STR_GUI_WARNING_PREFIX, "SheepShaver warning:\n%s"}, - {STR_WARNING_ALERT_TITLE, "SheepShaver Warning"}, - {STR_NOTICE_ALERT_TITLE, "SheepShaver Notice"}, - {STR_ABOUT_TITLE, "About SheepShaver"}, - {STR_OK_BUTTON, "OK"}, - {STR_START_BUTTON, "Start"}, - {STR_QUIT_BUTTON, "Quit"}, - {STR_CANCEL_BUTTON, "Cancel"}, - {STR_IGNORE_BUTTON, "Ignore"}, - - {STR_NOT_ENOUGH_MEMORY_ERR, "Your computer does not have enough memory to run SheepShaver."}, - {STR_NO_KERNEL_DATA_ERR, "Cannot create Kernel Data area: %s (%08x)."}, - {STR_NO_ROM_FILE_ERR, "Cannot open ROM file."}, - {STR_RAM_HIGHER_THAN_ROM_ERR, "RAM area higher than ROM area. Try to decrease the MacOS RAM size."}, - {STR_ROM_FILE_READ_ERR, "Cannot read ROM file."}, - {STR_ROM_SIZE_ERR, "Invalid ROM file size. SheepShaver requires a 4MB PCI PowerMac ROM."}, - {STR_UNSUPPORTED_ROM_TYPE_ERR, "Unsupported ROM type."}, - {STR_POWER_INSTRUCTION_ERR, "Your Mac program is using POWER instructions which are not supported by SheepShaver.\n(pc %p, sp %p, opcode %08lx)"}, - {STR_MEM_ACCESS_ERR, "Your Mac program made an illegal %s %s access to address %p.\n(pc %p, 68k pc %p, sp %p)"}, - {STR_MEM_ACCESS_READ, "read"}, - {STR_MEM_ACCESS_WRITE, "write"}, - {STR_UNKNOWN_SEGV_ERR, "Your Mac program did something terribly stupid.\n(pc %p, 68k pc %p, sp %p, opcode %08lx)"}, - {STR_NO_NAME_REGISTRY_ERR, "Cannot find Name Registry. Giving up."}, - {STR_FULL_SCREEN_ERR, "Cannot open full screen display: %s (%08x)."}, - {STR_SCSI_BUFFER_ERR, "Cannot allocate SCSI buffer (requested %d bytes). Giving up."}, - {STR_SCSI_SG_FULL_ERR, "SCSI scatter/gather table full. Giving up."}, - - {STR_SMALL_RAM_WARN, "Selected less than 8MB Mac RAM, using 8MB."}, - {STR_CANNOT_UNMOUNT_WARN, "The volume '%s' could not be unmounted. SheepShaver will not use it."}, - {STR_CREATE_VOLUME_WARN, "Cannot create hardfile (%s)."}, - - {STR_PREFS_TITLE, "SheepShaver Settings"}, - {STR_PREFS_MENU, "Settings"}, - {STR_PREFS_ITEM_ABOUT, "About SheepShaver" ELLIPSIS}, - {STR_PREFS_ITEM_START, "Start SheepShaver"}, - {STR_PREFS_ITEM_ZAP_PRAM, "Zap PRAM File"}, - {STR_PREFS_ITEM_QUIT, "Quit SheepShaver"}, - - {STR_NONE_LAB, ""}, - - {STR_VOLUMES_PANE_TITLE, "Volumes"}, - {STR_ADD_VOLUME_BUTTON, "Add" ELLIPSIS}, - {STR_CREATE_VOLUME_BUTTON, "Create" ELLIPSIS}, - {STR_REMOVE_VOLUME_BUTTON, "Remove"}, - {STR_ADD_VOLUME_PANEL_BUTTON, "Add"}, - {STR_CREATE_VOLUME_PANEL_BUTTON, "Create"}, - {STR_CDROM_DRIVE_CTRL, "CD-ROM Drive"}, - {STR_BOOTDRIVER_CTRL, "Boot From"}, - {STR_BOOT_ANY_LAB, "Any"}, - {STR_BOOT_CDROM_LAB, "CD-ROM"}, - {STR_NOCDROM_CTRL, "Disable CD-ROM Driver"}, - {STR_ADD_VOLUME_TITLE, "Add Volume"}, - {STR_CREATE_VOLUME_TITLE, "Create Hardfile"}, - {STR_HARDFILE_SIZE_CTRL, "Size (MB)"}, - - {STR_GRAPHICS_SOUND_PANE_TITLE, "Graphics/Sound"}, - {STR_FRAMESKIP_CTRL, "Window Refresh Rate"}, - {STR_REF_5HZ_LAB, "5 Hz"}, - {STR_REF_7_5HZ_LAB, "7.5 Hz"}, - {STR_REF_10HZ_LAB, "10 Hz"}, - {STR_REF_15HZ_LAB, "15 Hz"}, - {STR_REF_30HZ_LAB, "30 Hz"}, - {STR_REF_60HZ_LAB, "60 Hz"}, - {STR_REF_DYNAMIC_LAB, "Dynamic"}, - {STR_GFXACCEL_CTRL, "QuickDraw Acceleration"}, - {STR_8_BIT_CTRL, "8 Bit"}, - {STR_16_BIT_CTRL, "15 Bit"}, - {STR_32_BIT_CTRL, "32 Bit"}, - {STR_W_640x480_CTRL, "Window 640x480"}, - {STR_W_800x600_CTRL, "Window 800x600"}, - {STR_640x480_CTRL, "Fullscreen 640x480"}, - {STR_800x600_CTRL, "Fullscreen 800x600"}, - {STR_1024x768_CTRL, "Fullscreen 1024x768"}, - {STR_1152x768_CTRL, "Fullscreen 1152x768"}, - {STR_1152x900_CTRL, "Fullscreen 1152x900"}, - {STR_1280x1024_CTRL, "Fullscreen 1280x1024"}, - {STR_1600x1200_CTRL, "Fullscreen 1600x1200"}, - {STR_VIDEO_MODE_CTRL, "Enabled Video Modes"}, - {STR_FULLSCREEN_CTRL, "Fullscreen"}, - {STR_WINDOW_CTRL, "Window"}, - {STR_VIDEO_TYPE_CTRL, "Video Type"}, - {STR_DISPLAY_X_CTRL, "Width"}, - {STR_DISPLAY_Y_CTRL, "Height"}, - {STR_SIZE_384_LAB, "384"}, - {STR_SIZE_480_LAB, "480"}, - {STR_SIZE_512_LAB, "512"}, - {STR_SIZE_600_LAB, "600"}, - {STR_SIZE_640_LAB, "640"}, - {STR_SIZE_768_LAB, "768"}, - {STR_SIZE_800_LAB, "800"}, - {STR_SIZE_1024_LAB, "1024"}, - {STR_SIZE_MAX_LAB, "Maximum"}, - {STR_NOSOUND_CTRL, "Disable Sound Output"}, - - {STR_SERIAL_NETWORK_PANE_TITLE, "Serial/Network"}, - {STR_SERPORTA_CTRL, "Modem Port"}, - {STR_SERPORTB_CTRL, "Printer Port"}, - {STR_NONET_CTRL, "Disable Ethernet"}, - {STR_ETHERNET_IF_CTRL, "Ethernet Interface"}, - - {STR_MEMORY_MISC_PANE_TITLE, "Memory/Misc"}, - {STR_RAMSIZE_CTRL, "MacOS RAM Size (MB)"}, - {STR_RAMSIZE_4MB_LAB, "4"}, - {STR_RAMSIZE_8MB_LAB, "8"}, - {STR_RAMSIZE_16MB_LAB, "16"}, - {STR_RAMSIZE_32MB_LAB, "32"}, - {STR_RAMSIZE_64MB_LAB, "64"}, - {STR_RAMSIZE_128MB_LAB, "128"}, - {STR_RAMSIZE_256MB_LAB, "256"}, - {STR_RAMSIZE_512MB_LAB, "512"}, - {STR_RAMSIZE_1024MB_LAB, "1024"}, - {STR_RAMSIZE_SLIDER, "MacOS RAM Size:"}, - {STR_RAMSIZE_FMT, "%d MB"}, - {STR_IGNORESEGV_CTRL, "Ignore Illegal Memory Accesses"}, - {STR_IDLEWAIT_CTRL, "Don't Use CPU When Idle"}, - {STR_ROM_FILE_CTRL, "ROM File"}, - - {STR_JIT_PANE_TITLE, "JIT Compiler"}, - {STR_JIT_CTRL, "Enable JIT Compiler"}, - {STR_JIT_68K_CTRL, "Enable built-in 68k DR Emulator (EXPERIMENTAL)"}, - - {STR_WINDOW_TITLE, "SheepShaver"}, - {STR_WINDOW_TITLE_FROZEN, "SheepShaver *** FROZEN ***"}, - {STR_WINDOW_MENU, "SheepShaver"}, - {STR_WINDOW_ITEM_ABOUT, "About SheepShaver" ELLIPSIS}, - {STR_WINDOW_ITEM_REFRESH, "Refresh Rate"}, - {STR_WINDOW_ITEM_MOUNT, "Mount"}, - - {STR_SOUND_IN_NAME, "\010Built-In"}, - - {STR_EXTFS_NAME, "Host Directory Tree"}, - {STR_EXTFS_VOLUME_NAME, "Host"}, - - {-1, NULL} // End marker -}; diff --git a/SheepShaver/src/video.cpp b/SheepShaver/src/video.cpp deleted file mode 100644 index d0eda93d..00000000 --- a/SheepShaver/src/video.cpp +++ /dev/null @@ -1,1097 +0,0 @@ -/* - * video.cpp - Video/graphics emulation - * - * SheepShaver (C) 1997-2008 Marc Hellwig and Christian Bauer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * TODO - * - check for supported modes ??? - */ - -#include -#include - -#include "sysdeps.h" -#include "video.h" -#include "video_defs.h" -#include "main.h" -#include "adb.h" -#include "macos_util.h" -#include "user_strings.h" -#include "version.h" -#include "thunks.h" - -#define DEBUG 0 -#include "debug.h" - - -// Global variables -bool video_activated = false; // Flag: video display activated, mouse and keyboard data valid -uint32 screen_base = 0; // Frame buffer base address -int cur_mode; // Number of current video mode (index in VModes array) -int display_type = DIS_INVALID; // Current display type -rgb_color mac_pal[256]; -uint8 remap_mac_be[256]; -uint8 MacCursor[68] = {16, 1}; // Mac cursor image - - -bool keyfile_valid; // Flag: Keyfile is valid, enable full-screen modes - - -/* - * Video mode information (constructed by VideoInit()) - */ - -struct VideoInfo VModes[64]; - - -/* - * Driver local variables - */ - -VidLocals *private_data = NULL; // Pointer to driver local variables (there is only one display, so this is ok) - -static long save_conf_id = APPLE_W_640x480; -static long save_conf_mode = APPLE_8_BIT; - - -// Function pointers of imported functions -typedef int16 (*iocic_ptr)(void *, int16); -static uint32 iocic_tvect = 0; -static inline int16 IOCommandIsComplete(uintptr arg1, int16 arg2) -{ - return (int16)CallMacOS2(iocic_ptr, iocic_tvect, (void *)arg1, arg2); -} -typedef int16 (*vslnewis_ptr)(void *, uint32, uint32 *); -static uint32 vslnewis_tvect = 0; -static inline int16 VSLNewInterruptService(uintptr arg1, uint32 arg2, uintptr arg3) -{ - return (int16)CallMacOS3(vslnewis_ptr, vslnewis_tvect, (void *)arg1, arg2, (uint32 *)arg3); -} -typedef int16 (*vsldisposeis_ptr)(uint32); -static uint32 vsldisposeis_tvect = 0; -static inline int16 VSLDisposeInterruptService(uint32 arg1) -{ - return (int16)CallMacOS1(vsldisposeis_ptr, vsldisposeis_tvect, arg1); -} -typedef int16 (*vsldois_ptr)(uint32); -static uint32 vsldois_tvect = 0; -int16 VSLDoInterruptService(uint32 arg1) -{ - return (int16)CallMacOS1(vsldois_ptr, vsldois_tvect, arg1); -} -typedef void (*nqdmisc_ptr)(uint32, void *); -static uint32 nqdmisc_tvect = 0; -void NQDMisc(uint32 arg1, uintptr arg2) -{ - CallMacOS2(nqdmisc_ptr, nqdmisc_tvect, arg1, (void *)arg2); -} - - -// Prototypes -static int16 set_gamma(VidLocals *csSave, uint32 gamma); - - -/* - * Tell whether window/screen is activated or not (for mouse/keyboard polling) - */ - -bool VideoActivated(void) -{ - return video_activated; -} - - -/* - * Create RGB snapshot of current screen - */ - -bool VideoSnapshot(int xsize, int ysize, uint8 *p) -{ - if (display_type == DIS_WINDOW) { - uint8 *screen = (uint8 *)private_data->saveBaseAddr; - uint32 row_bytes = VModes[cur_mode].viRowBytes; - uint32 y2size = VModes[cur_mode].viYsize; - uint32 x2size = VModes[cur_mode].viXsize; - for (int j=0;jsaveBaseAddr = screen_base; - csSave->saveData = VModes[cur_mode].viAppleID;// First mode ... - csSave->saveMode = VModes[cur_mode].viAppleMode; - csSave->savePage = 0; - csSave->saveVidParms = 0; // Add the right table - csSave->luminanceMapping = false; - csSave->cursorHardware = UseHardwareCursor(); - csSave->cursorX = 0; - csSave->cursorY = 0; - csSave->cursorVisible = 0; - csSave->cursorSet = 0; - csSave->cursorHotFlag = false; - csSave->cursorHotX = 0; - csSave->cursorHotY = 0; - - // Find and set default gamma table - csSave->gammaTable = 0; - csSave->maxGammaTableSize = 0; - set_gamma(csSave, 0); - - // Install and activate interrupt service - SheepVar32 theServiceID = 0; - VSLNewInterruptService(csSave->regEntryID, FOURCC('v','b','l',' '), theServiceID.addr()); - csSave->vslServiceID = theServiceID.value(); - D(bug(" Interrupt ServiceID %08lx\n", csSave->vslServiceID)); - csSave->interruptsEnabled = true; - - return noErr; -} - - -/* - * Video driver control routine - */ - -static bool allocate_gamma_table(VidLocals *csSave, uint32 size) -{ - if (size > csSave->maxGammaTableSize) { - if (csSave->gammaTable) { - Mac_sysfree(csSave->gammaTable); - csSave->gammaTable = 0; - csSave->maxGammaTableSize = 0; - } - if ((csSave->gammaTable = Mac_sysalloc(size)) == 0) - return false; - csSave->maxGammaTableSize = size; - } - return true; -} - -static int16 set_gamma(VidLocals *csSave, uint32 gamma) -{ - if (gamma == 0) { // Build linear ramp, 256 entries - - // Allocate new table, if necessary - if (!allocate_gamma_table(csSave, SIZEOF_GammaTbl + 256)) - return memFullErr; - - // Initialize header - WriteMacInt16(csSave->gammaTable + gVersion, 0); // A version 0 style of the GammaTbl structure - WriteMacInt16(csSave->gammaTable + gType, 0); // Frame buffer hardware invariant - WriteMacInt16(csSave->gammaTable + gFormulaSize, 0); // No formula data, just correction data - WriteMacInt16(csSave->gammaTable + gChanCnt, 1); // Apply same correction to Red, Green, & Blue - WriteMacInt16(csSave->gammaTable + gDataCnt, 256); // gDataCnt == 2^^gDataWidth - WriteMacInt16(csSave->gammaTable + gDataWidth, 8); // 8 bits of significant data per entry - - // Build the linear ramp - uint32 p = csSave->gammaTable + gFormulaData; - for (int i=0; i<256; i++) - WriteMacInt8(p + i, i); - - } else { // User-supplied gamma table - - // Validate header - if (ReadMacInt16(gamma + gVersion) != 0) - return paramErr; - if (ReadMacInt16(gamma + gType) != 0) - return paramErr; - int chan_cnt = ReadMacInt16(gamma + gChanCnt); - if (chan_cnt != 1 && chan_cnt != 3) - return paramErr; - int data_width = ReadMacInt16(gamma + gDataWidth); - if (data_width > 8) - return paramErr; - int data_cnt = ReadMacInt16(gamma + gDataCnt); - if (data_cnt != (1 << data_width)) - return paramErr; - - // Allocate new table, if necessary - int size = SIZEOF_GammaTbl + ReadMacInt16(gamma + gFormulaSize) + chan_cnt * data_cnt; - if (!allocate_gamma_table(csSave, size)) - return memFullErr; - - // Copy table - Mac2Mac_memcpy(csSave->gammaTable, gamma, size); - } - return noErr; -} - -static int16 VideoControl(uint32 pb, VidLocals *csSave) -{ - int16 code = ReadMacInt16(pb + csCode); - D(bug("VideoControl %d: ", code)); - uint32 param = ReadMacInt32(pb + csParam); - switch (code) { - - case cscReset: // VidReset - D(bug("VidReset\n")); - return controlErr; - - case cscKillIO: // VidKillIO - D(bug("VidKillIO\n")); - return controlErr; - - case cscSetMode: // SetVidMode - D(bug("SetVidMode\n")); - D(bug("mode:%04x page:%04x \n", ReadMacInt16(param + csMode), - ReadMacInt16(param + csPage))); - WriteMacInt32(param + csData, csSave->saveData); - return video_mode_change(csSave, param); - - case cscSetEntries: { // SetEntries - D(bug("SetEntries\n")); - if (VModes[cur_mode].viAppleMode > APPLE_8_BIT) return controlErr; - uint32 s_pal = ReadMacInt32(param + csTable); - uint16 start = ReadMacInt16(param + csStart); - uint16 count = ReadMacInt16(param + csCount); - if (s_pal == 0 || count > 256) return controlErr; - - // Preparations for gamma correction - bool do_gamma = false; - uint8 *red_gamma = NULL; - uint8 *green_gamma = NULL; - uint8 *blue_gamma = NULL; - int gamma_data_width = 0; - if (csSave->gammaTable) { -#ifdef __BEOS__ - // Windows are gamma-corrected by BeOS - const bool can_do_gamma = (display_type == DIS_SCREEN); -#else - const bool can_do_gamma = true; -#endif - if (can_do_gamma) { - uint32 gamma_table = csSave->gammaTable; - red_gamma = Mac2HostAddr(gamma_table + gFormulaData + ReadMacInt16(gamma_table + gFormulaSize)); - int chan_cnt = ReadMacInt16(gamma_table + gChanCnt); - if (chan_cnt == 1) - green_gamma = blue_gamma = red_gamma; - else { - int ofs = ReadMacInt16(gamma_table + gDataCnt); - green_gamma = red_gamma + ofs; - blue_gamma = green_gamma + ofs; - } - gamma_data_width = ReadMacInt16(gamma_table + gDataWidth); - do_gamma = true; - } - } - - // Set palette - rgb_color *d_pal; - if (start == 0xffff) { // Indexed - for (int i=0; i<=count; i++) { - d_pal = mac_pal + (ReadMacInt16(s_pal + csValue) & 0xff); - uint8 red = (uint16)ReadMacInt16(s_pal + csRed) >> 8; - uint8 green = (uint16)ReadMacInt16(s_pal + csGreen) >> 8; - uint8 blue = (uint16)ReadMacInt16(s_pal + csBlue) >> 8; - if (csSave->luminanceMapping) - red = green = blue = (red * 0x4ccc + green * 0x970a + blue * 0x1c29) >> 16; - if (do_gamma) { - red = red_gamma[red >> (8 - gamma_data_width)]; - green = green_gamma[green >> (8 - gamma_data_width)]; - blue = blue_gamma[blue >> (8 - gamma_data_width)]; - } - (*d_pal).red = red; - (*d_pal).green = green; - (*d_pal).blue = blue; - s_pal += 8; - } - } else { // Sequential - d_pal = mac_pal + start; - for (int i=0; i<=count; i++) { - uint8 red = (uint16)ReadMacInt16(s_pal + csRed) >> 8; - uint8 green = (uint16)ReadMacInt16(s_pal + csGreen) >> 8; - uint8 blue = (uint16)ReadMacInt16(s_pal + csBlue) >> 8; - if (csSave->luminanceMapping) - red = green = blue = (red * 0x4ccc + green * 0x970a + blue * 0x1c29) >> 16; - if (do_gamma) { - red = red_gamma[red >> (8 - gamma_data_width)]; - green = green_gamma[green >> (8 - gamma_data_width)]; - blue = blue_gamma[blue >> (8 - gamma_data_width)]; - } - (*d_pal).red = red; - (*d_pal).green = green; - (*d_pal).blue = blue; - d_pal++; - s_pal += 8; - } - } - video_set_palette(); - return noErr; - } - - case cscSetGamma: { // SetGamma - uint32 user_table = ReadMacInt32(param + csGTable); - D(bug("SetGamma %08x\n", user_table)); - return set_gamma(csSave, user_table); - } - - case cscGrayPage: { // GrayPage - D(bug("GrayPage %d\n", ReadMacInt16(param + csPage))); - if (ReadMacInt16(param + csPage)) - return paramErr; - - uint32 pattern[6] = { - 0xaaaaaaaa, // 1 bpp - 0xcccccccc, // 2 bpp - 0xf0f0f0f0, // 4 bpp - 0xff00ff00, // 8 bpp - 0xffff0000, // 16 bpp - 0xffffffff // 32 bpp - }; - uint32 p = csSave->saveBaseAddr; - uint32 pat = pattern[VModes[cur_mode].viAppleMode - APPLE_1_BIT]; - bool invert = (VModes[cur_mode].viAppleMode == APPLE_32_BIT); - for (uint32 y=0; yluminanceMapping = ReadMacInt8(param); - return noErr; - - case cscSetInterrupt: // SetInterrupt - D(bug("SetInterrupt\n")); - csSave->interruptsEnabled = !ReadMacInt8(param); - return noErr; - - case cscDirectSetEntries: // DirectSetEntries - D(bug("DirectSetEntries\n")); - return controlErr; - - case cscSetDefaultMode: // SetDefaultMode - D(bug("SetDefaultMode\n")); - return controlErr; - - case cscSwitchMode: - D(bug("cscSwitchMode (Display Manager support) \nMode:%02x ID:%04x Page:%d\n", - ReadMacInt16(param + csMode), ReadMacInt32(param + csData), ReadMacInt16(param + csPage))); - return video_mode_change(csSave, param); - - case cscSavePreferredConfiguration: - D(bug("SavePreferredConfiguration\n")); - save_conf_id = ReadMacInt32(param + csData); - save_conf_mode = ReadMacInt16(param + csMode); - return noErr; - - case cscSetHardwareCursor: { -// D(bug("SetHardwareCursor\n")); - - if (!csSave->cursorHardware) - return controlErr; - - csSave->cursorSet = false; - bool changed = false; - - // Image - uint32 cursor = ReadMacInt32(param); // Pointer to CursorImage - uint32 pmhandle = ReadMacInt32(cursor + ciCursorPixMap); - if (pmhandle == 0 || ReadMacInt32(pmhandle) == 0) - return controlErr; - uint32 pixmap = ReadMacInt32(pmhandle); - - // XXX: only certain image formats are handled properly at the moment - uint16 rowBytes = ReadMacInt16(pixmap + 4) & 0x7FFF; - if (rowBytes != 2) - return controlErr; - - // Mask - uint32 bmhandle = ReadMacInt32(cursor + ciCursorBitMask); - if (bmhandle == 0 || ReadMacInt32(bmhandle) == 0) - return controlErr; - uint32 bitmap = ReadMacInt32(bmhandle); - - // Get cursor data even on a screen, to set the right cursor image when switching back to a window. - // Hotspot is stale, but will be fixed by the next call to DrawHardwareCursor, which is likely to - // occur immediately hereafter. - - if (memcmp(MacCursor + 4, Mac2HostAddr(ReadMacInt32(pixmap)), 32)) { - memcpy(MacCursor + 4, Mac2HostAddr(ReadMacInt32(pixmap)), 32); - changed = true; - } - if (memcmp(MacCursor + 4 + 32, Mac2HostAddr(ReadMacInt32(bitmap)), 32)) { - memcpy(MacCursor + 4 + 32, Mac2HostAddr(ReadMacInt32(bitmap)), 32); - changed = true; - } - - // Set new cursor image - if (!video_can_change_cursor()) - return controlErr; - if (changed) - video_set_cursor(); - - csSave->cursorSet = true; - csSave->cursorHotFlag = true; - return noErr; - } - - case cscDrawHardwareCursor: { -// D(bug("DrawHardwareCursor\n")); - - if (!csSave->cursorHardware) - return controlErr; - - int32 oldX = csSave->cursorX; - int32 oldY = csSave->cursorY; - uint32 oldVisible = csSave->cursorVisible; - - csSave->cursorX = ReadMacInt32(param + csCursorX); - csSave->cursorY = ReadMacInt32(param + csCursorY); - csSave->cursorVisible = ReadMacInt32(param + csCursorVisible); - bool changed = (csSave->cursorVisible != oldVisible); - - // If this is the first DrawHardwareCursor call since the cursor was last set (via SetHardwareCursor), - // attempt to set an appropriate cursor hotspot. SetHardwareCursor itself does not know what the - // hotspot should be; it knows only the cursor image and mask. The hotspot is known only to the caller, - // and we have to try to infer it here. The usual sequence of calls when changing the cursor is: - // - // DrawHardwareCursor with (oldX, oldY, invisible) - // SetHardwareCursor with (cursor) - // DrawHardwareCursor with (newX, newY, visible) - // - // The key thing to note is that the sequence is intended not to change the current screen pixel location - // indicated by the hotspot. Thus, the difference between (newX, newY) and (oldX, oldY) reflects precisely - // the difference between the old cursor hotspot and the new one. For example, if you change from a - // cursor whose hotspot is (1, 1) to one whose hotspot is (7, 4), then you must adjust the cursor position - // by (-6, -3) in order for the same screen pixel to remain under the new hotspot. - // - // Alas, on rare occasions this heuristic can fail, and if you did nothing else you could even get stuck - // with the wrong hotspot from then on. To address that possibility, we force the hotspot to (1, 1) - // whenever the cursor being drawn is the standard arrow. Thus, while it is very unlikely that you will - // ever have the wrong hotspot, if you do, it is easy to recover. - - if (csSave->cursorHotFlag) { - csSave->cursorHotFlag = false; - D(bug("old hotspot (%d, %d)\n", csSave->cursorHotX, csSave->cursorHotY)); - - static uint8 arrow[] = { - 0x00, 0x00, 0x40, 0x00, 0x60, 0x00, 0x70, 0x00, 0x78, 0x00, 0x7C, 0x00, 0x7E, 0x00, 0x7F, 0x00, - 0x7F, 0x80, 0x7C, 0x00, 0x6C, 0x00, 0x46, 0x00, 0x06, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, - }; - if (memcmp(MacCursor + 4, arrow, 32) == 0) { - csSave->cursorHotX = 1; - csSave->cursorHotY = 1; - } else if (csSave->cursorX != oldX || csSave->cursorY != oldY) { - int32 hotX = csSave->cursorHotX + (oldX - csSave->cursorX); - int32 hotY = csSave->cursorHotY + (oldY - csSave->cursorY); - - if (0 <= hotX && hotX <= 15 && 0 <= hotY && hotY <= 15) { - csSave->cursorHotX = hotX; - csSave->cursorHotY = hotY; - } - } - if (MacCursor[2] != csSave->cursorHotX || MacCursor[3] != csSave->cursorHotY) { - MacCursor[2] = csSave->cursorHotX; - MacCursor[3] = csSave->cursorHotY; - changed = true; - } - D(bug("new hotspot (%d, %d)\n", csSave->cursorHotX, csSave->cursorHotY)); - } - - if (changed && video_can_change_cursor()) - video_set_cursor(); - - return noErr; - } - - case 43: { // Driver Gestalt - uint32 sel = ReadMacInt32(pb + csParam); - D(bug(" driver gestalt %c%c%c%c\n", sel >> 24, sel >> 16, sel >> 8, sel)); - switch (sel) { - case FOURCC('v','e','r','s'): - WriteMacInt32(pb + csParam + 4, 0x01008000); - break; - case FOURCC('i','n','t','f'): - WriteMacInt32(pb + csParam + 4, FOURCC('c','a','r','d')); - break; - case FOURCC('s','y','n','c'): - WriteMacInt32(pb + csParam + 4, 0x01000000); - break; - default: - return statusErr; - }; - return noErr; - } - - default: - D(bug(" unknown control code %d\n", code)); - return controlErr; - } -} - - -/* - * Video driver status routine - */ - -// Search for given AppleID in mode table -static bool has_mode(uint32 id) -{ - VideoInfo *p = VModes; - while (p->viType != DIS_INVALID) { - if (p->viAppleID == id) - return true; - p++; - } - return false; -} - -// Find maximum depth for given AppleID -static uint32 max_depth(uint32 id) -{ - uint32 max = APPLE_1_BIT; - VideoInfo *p = VModes; - while (p->viType != DIS_INVALID) { - if (p->viAppleID == id && p->viAppleMode > max) - max = p->viAppleMode; - p++; - } - return max; -} - -// Get X/Y size of specified resolution -static void get_size_of_resolution(int id, uint32 &x, uint32 &y) -{ - VideoInfo *p = VModes; - while (p->viType != DIS_INVALID) { - if (p->viAppleID == id) { - x = p->viXsize; - y = p->viYsize; - return; - } - p++; - } - x = y = 0; -} - -static int16 VideoStatus(uint32 pb, VidLocals *csSave) -{ - int16 code = ReadMacInt16(pb + csCode); - D(bug("VideoStatus %d: ", code)); - uint32 param = ReadMacInt32(pb + csParam); - switch (code) { - - case cscGetMode: // GetMode - D(bug("GetMode\n")); - WriteMacInt32(param + csBaseAddr, csSave->saveBaseAddr); - WriteMacInt16(param + csMode, csSave->saveMode); - WriteMacInt16(param + csPage, csSave->savePage); - D(bug("return: mode:%04x page:%04x ", ReadMacInt16(param + csMode), - ReadMacInt16(param + csPage))); - D(bug("base adress %08lx\n", ReadMacInt32(param + csBaseAddr))); - return noErr; - - case cscGetEntries: { // GetEntries - D(bug("GetEntries\n")); - uint32 d_pal = ReadMacInt32(param + csTable); - uint16 start = ReadMacInt16(param + csStart); - uint16 count = ReadMacInt16(param + csCount); - rgb_color *s_pal; - if ((VModes[cur_mode].viAppleMode == APPLE_32_BIT)|| - (VModes[cur_mode].viAppleMode == APPLE_16_BIT)) { - D(bug("ERROR: GetEntries in direct mode \n")); - return statusErr; - } - - if (start == 0xffff) { // Indexed - for (uint16 i=0;i 255) - return paramErr; - s_pal = mac_pal + start; - for (uint16 i=0;isaveBaseAddr); - return noErr; - - case cscGetGray: // GetGray - D(bug("GetGray\n")); - WriteMacInt8(param, csSave->luminanceMapping ? 1 : 0); - return noErr; - - case cscGetInterrupt: // GetInterrupt - D(bug("GetInterrupt\n")); - WriteMacInt8(param, csSave->interruptsEnabled ? 0 : 1); - return noErr; - - case cscGetGamma: // GetGamma - D(bug("GetGamma\n")); - WriteMacInt32(param, (uint32)csSave->gammaTable); - return noErr; - - case cscGetDefaultMode: // GetDefaultMode - D(bug("GetDefaultMode\n")); - return statusErr; - - case cscGetCurMode: // GetCurMode - D(bug("GetCurMode\n")); - WriteMacInt16(param + csMode, csSave->saveMode); - WriteMacInt32(param + csData, csSave->saveData); - WriteMacInt16(param + csPage, csSave->savePage); - WriteMacInt32(param + csBaseAddr, csSave->saveBaseAddr); - - D(bug("return: mode:%04x ID:%08lx page:%04x ", ReadMacInt16(param + csMode), - ReadMacInt32(param + csData), ReadMacInt16(param + csPage))); - D(bug("base adress %08lx\n", ReadMacInt32(param + csBaseAddr))); - return noErr; - - case cscGetConnection: // GetConnection - D(bug("GetConnection\n")); - WriteMacInt16(param + csDisplayType, kMultiModeCRT3Connect); - WriteMacInt8(param + csConnectTaggedType, 6); - WriteMacInt8(param + csConnectTaggedData, 0x23); - WriteMacInt32(param + csConnectFlags, (1<saveData; - break; - case kDisplayModeIDFindFirstResolution: - work_id = APPLE_ID_MIN; - while (!has_mode(work_id)) - work_id ++; - break; - default: - if (!has_mode(work_id)) - return paramErr; - work_id++; - while (!has_mode(work_id)) { - work_id++; - if (work_id > APPLE_ID_MAX) { - WriteMacInt32(param + csRIDisplayModeID, kDisplayModeIDNoMoreResolutions); - return noErr; - } - } - break; - } - WriteMacInt32(param + csRIDisplayModeID, work_id); - WriteMacInt16(param + csMaxDepthMode, max_depth(work_id)); - switch (work_id) { - case APPLE_640x480: - WriteMacInt32(param + csHorizontalPixels, 640); - WriteMacInt32(param + csVerticalLines, 480); - WriteMacInt32(param + csRefreshRate, 75<<16); - break; - case APPLE_W_640x480: - WriteMacInt32(param + csHorizontalPixels, 640); - WriteMacInt32(param + csVerticalLines, 480); - WriteMacInt32(param + csRefreshRate, 60<<16); - break; - case APPLE_800x600: - WriteMacInt32(param + csHorizontalPixels, 800); - WriteMacInt32(param + csVerticalLines, 600); - WriteMacInt32(param + csRefreshRate, 75<<16); - break; - case APPLE_W_800x600: - WriteMacInt32(param + csHorizontalPixels, 800); - WriteMacInt32(param + csVerticalLines, 600); - WriteMacInt32(param + csRefreshRate, 60<<16); - break; - case APPLE_1024x768: - WriteMacInt32(param + csHorizontalPixels, 1024); - WriteMacInt32(param + csVerticalLines, 768); - WriteMacInt32(param + csRefreshRate, 75<<16); - break; - case APPLE_1152x768: - WriteMacInt32(param + csHorizontalPixels, 1152); - WriteMacInt32(param + csVerticalLines, 768); - WriteMacInt32(param + csRefreshRate, 75<<16); - break; - case APPLE_1152x900: - WriteMacInt32(param + csHorizontalPixels, 1152); - WriteMacInt32(param + csVerticalLines, 900); - WriteMacInt32(param + csRefreshRate, 75<<16); - break; - case APPLE_1280x1024: - WriteMacInt32(param + csHorizontalPixels, 1280); - WriteMacInt32(param + csVerticalLines, 1024); - WriteMacInt32(param + csRefreshRate, 75<<16); - break; - case APPLE_1600x1200: - WriteMacInt32(param + csHorizontalPixels, 1600); - WriteMacInt32(param + csVerticalLines, 1200); - WriteMacInt32(param + csRefreshRate, 75<<16); - break; - case APPLE_CUSTOM: { - uint32 x, y; - get_size_of_resolution(work_id, x, y); - WriteMacInt32(param + csHorizontalPixels, x); - WriteMacInt32(param + csVerticalLines, y); - WriteMacInt32(param + csRefreshRate, 75<<16); - break; - } - } - return noErr; - } - - case cscGetVideoParameters: // GetVideoParameters - D(bug("GetVideoParameters ID:%08lx Depth:%04x\n", - ReadMacInt32(param + csDisplayModeID), - ReadMacInt16(param + csDepthMode))); - - // find right video mode - for (int i=0; VModes[i].viType!=DIS_INVALID; i++) { - if ((ReadMacInt16(param + csDepthMode) == VModes[i].viAppleMode) && - (ReadMacInt32(param + csDisplayModeID) == VModes[i].viAppleID)) { - uint32 vpb = ReadMacInt32(param + csVPBlockPtr); - WriteMacInt32(vpb + vpBaseOffset, 0); - WriteMacInt16(vpb + vpRowBytes, VModes[i].viRowBytes); - WriteMacInt16(vpb + vpBounds, 0); - WriteMacInt16(vpb + vpBounds + 2, 0); - WriteMacInt16(vpb + vpBounds + 4, VModes[i].viYsize); - WriteMacInt16(vpb + vpBounds + 6, VModes[i].viXsize); - WriteMacInt16(vpb + vpVersion, 0); // Pixel Map version number - WriteMacInt16(vpb + vpPackType, 0); - WriteMacInt32(vpb + vpPackSize, 0); - WriteMacInt32(vpb + vpHRes, 0x00480000); // horiz res of the device (ppi) - WriteMacInt32(vpb + vpVRes, 0x00480000); // vert res of the device (ppi) - switch (VModes[i].viAppleMode) { - case APPLE_1_BIT: - WriteMacInt16(vpb + vpPixelType, 0); - WriteMacInt16(vpb + vpPixelSize, 1); - WriteMacInt16(vpb + vpCmpCount, 1); - WriteMacInt16(vpb + vpCmpSize, 1); - WriteMacInt32(param + csDeviceType, 0); // CLUT - break; - case APPLE_2_BIT: - WriteMacInt16(vpb + vpPixelType, 0); - WriteMacInt16(vpb + vpPixelSize, 2); - WriteMacInt16(vpb + vpCmpCount, 1); - WriteMacInt16(vpb + vpCmpSize, 2); - WriteMacInt32(param + csDeviceType, 0); // CLUT - break; - case APPLE_4_BIT: - WriteMacInt16(vpb + vpPixelType, 0); - WriteMacInt16(vpb + vpPixelSize, 4); - WriteMacInt16(vpb + vpCmpCount, 1); - WriteMacInt16(vpb + vpCmpSize, 4); - WriteMacInt32(param + csDeviceType, 0); // CLUT - break; - case APPLE_8_BIT: - WriteMacInt16(vpb + vpPixelType, 0); - WriteMacInt16(vpb + vpPixelSize, 8); - WriteMacInt16(vpb + vpCmpCount, 1); - WriteMacInt16(vpb + vpCmpSize, 8); - WriteMacInt32(param + csDeviceType, 0); // CLUT - break; - case APPLE_16_BIT: - WriteMacInt16(vpb + vpPixelType, 0x10); - WriteMacInt16(vpb + vpPixelSize, 16); - WriteMacInt16(vpb + vpCmpCount, 3); - WriteMacInt16(vpb + vpCmpSize, 5); - WriteMacInt32(param + csDeviceType, 2); // DIRECT - break; - case APPLE_32_BIT: - WriteMacInt16(vpb + vpPixelType, 0x10); - WriteMacInt16(vpb + vpPixelSize, 32); - WriteMacInt16(vpb + vpCmpCount, 3); - WriteMacInt16(vpb + vpCmpSize, 8); - WriteMacInt32(param + csDeviceType, 2); // DIRECT - break; - } - WriteMacInt32(param + csPageCount, 1); - return noErr; - } - } - return paramErr; - - case cscGetModeTiming: - D(bug("GetModeTiming mode %08lx\n", ReadMacInt32(param + csTimingMode))); - WriteMacInt32(param + csTimingFormat, kDeclROMtables); - WriteMacInt32(param + csTimingFlags, (1<cursorHardware); - return noErr; - - case cscGetHardwareCursorDrawState: - D(bug("GetHardwareCursorDrawState\n")); - - if (!csSave->cursorHardware) - return statusErr; - - WriteMacInt32(param + csCursorX, csSave->cursorX); - WriteMacInt32(param + csCursorY, csSave->cursorY); - WriteMacInt32(param + csCursorVisible, csSave->cursorVisible); - WriteMacInt32(param + csCursorSet, csSave->cursorSet); - return noErr; - - default: - D(bug(" unknown status code %d\n", code)); - return statusErr; - } -} - - -/* - * Video driver close routine - */ - -static int16 VideoClose(uint32 pb, VidLocals *csSave) -{ - D(bug("VideoClose\n")); - - // Delete interrupt service - csSave->interruptsEnabled = false; - VSLDisposeInterruptService(csSave->vslServiceID); - - return noErr; -} - - -/* - * Native (PCI) driver entry - */ - -int16 VideoDoDriverIO(uint32 spaceID, uint32 commandID, uint32 commandContents, uint32 commandCode, uint32 commandKind) -{ -// D(bug("VideoDoDriverIO space %08x, command %08x, contents %08x, code %d, kind %d\n", spaceID, commandID, commandContents, commandCode, commandKind)); - int16 err = noErr; - - switch (commandCode) { - case kInitializeCommand: - case kReplaceCommand: - if (private_data != NULL) { // Might be left over from a reboot - if (private_data->gammaTable) - Mac_sysfree(private_data->gammaTable); - if (private_data->regEntryID) - Mac_sysfree(private_data->regEntryID); - } - delete private_data; - - iocic_tvect = FindLibSymbol("\021DriverServicesLib", "\023IOCommandIsComplete"); - D(bug("IOCommandIsComplete TVECT at %08lx\n", iocic_tvect)); - if (iocic_tvect == 0) { - printf("FATAL: VideoDoDriverIO(): Can't find IOCommandIsComplete()\n"); - err = -1; - break; - } - vslnewis_tvect = FindLibSymbol("\020VideoServicesLib", "\026VSLNewInterruptService"); - D(bug("VSLNewInterruptService TVECT at %08lx\n", vslnewis_tvect)); - if (vslnewis_tvect == 0) { - printf("FATAL: VideoDoDriverIO(): Can't find VSLNewInterruptService()\n"); - err = -1; - break; - } - vsldisposeis_tvect = FindLibSymbol("\020VideoServicesLib", "\032VSLDisposeInterruptService"); - D(bug("VSLDisposeInterruptService TVECT at %08lx\n", vsldisposeis_tvect)); - if (vsldisposeis_tvect == 0) { - printf("FATAL: VideoDoDriverIO(): Can't find VSLDisposeInterruptService()\n"); - err = -1; - break; - } - vsldois_tvect = FindLibSymbol("\020VideoServicesLib", "\025VSLDoInterruptService"); - D(bug("VSLDoInterruptService TVECT at %08lx\n", vsldois_tvect)); - if (vsldois_tvect == 0) { - printf("FATAL: VideoDoDriverIO(): Can't find VSLDoInterruptService()\n"); - err = -1; - break; - } - nqdmisc_tvect = FindLibSymbol("\014InterfaceLib", "\007NQDMisc"); - D(bug("NQDMisc TVECT at %08lx\n", nqdmisc_tvect)); - if (nqdmisc_tvect == 0) { - printf("FATAL: VideoDoDriverIO(): Can't find NQDMisc()\n"); - err = -1; - break; - } - - private_data = new VidLocals; - private_data->gammaTable = 0; - private_data->regEntryID = Mac_sysalloc(sizeof(RegEntryID)); - if (private_data->regEntryID == 0) { - printf("FATAL: VideoDoDriverIO(): Can't allocate service owner\n"); - err = -1; - break; - } - Mac2Mac_memcpy(private_data->regEntryID, commandContents + 2, 16); // DriverInitInfo.deviceEntry - private_data->interruptsEnabled = false; // Disable interrupts - break; - - case kFinalizeCommand: - case kSupersededCommand: - if (private_data != NULL) { - if (private_data->gammaTable) - Mac_sysfree(private_data->gammaTable); - if (private_data->regEntryID) - Mac_sysfree(private_data->regEntryID); - } - delete private_data; - private_data = NULL; - break; - - case kOpenCommand: - err = VideoOpen(commandContents, private_data); - break; - - case kCloseCommand: - err = VideoClose(commandContents, private_data); - break; - - case kControlCommand: - err = VideoControl(commandContents, private_data); - break; - - case kStatusCommand: - err = VideoStatus(commandContents, private_data); - break; - - case kReadCommand: - case kWriteCommand: - break; - - case kKillIOCommand: - err = abortErr; - break; - - default: - err = paramErr; - break; - } - - if (commandKind == kImmediateIOCommandKind) - return err; - else - return IOCommandIsComplete(commandID, err); -} diff --git a/SheepShaver/src/xpram.cpp b/SheepShaver/src/xpram.cpp deleted file mode 120000 index 17fe090f..00000000 --- a/SheepShaver/src/xpram.cpp +++ /dev/null @@ -1 +0,0 @@ -../../BasiliskII/src/xpram.cpp \ No newline at end of file diff --git a/cxmon/.gitignore b/cxmon/.gitignore deleted file mode 100644 index ab09b307..00000000 --- a/cxmon/.gitignore +++ /dev/null @@ -1,26 +0,0 @@ -# Object files -*.o - -# Executables and libraries -src/cxmon -src/disass/libdisass.a - -# Autoconf generated files -.deps -Makefile -Makefile.in -aclocal.m4 -autom4te.cache -compile -config.guess -config.h -config.h.in -config.log -config.status -config.sub -configure -cxmon.spec -depcomp -install-sh -missing -stamp-h1 diff --git a/cxmon/AUTHORS b/cxmon/AUTHORS deleted file mode 100644 index ffbd0fa0..00000000 --- a/cxmon/AUTHORS +++ /dev/null @@ -1,8 +0,0 @@ -'mon' was written by - Christian Bauer - Marc Hellwig - -with contributions from - Gwenolé Beauchesne (64-bit support and PPC extensions) - -The 680x0 and 80x86 disassemblers are taken from GNU binutils. diff --git a/cxmon/COPYING b/cxmon/COPYING deleted file mode 100644 index 60549be5..00000000 --- a/cxmon/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) 19yy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/cxmon/ChangeLog b/cxmon/ChangeLog deleted file mode 100644 index df26a0ef..00000000 --- a/cxmon/ChangeLog +++ /dev/null @@ -1,20 +0,0 @@ -V3.2 - 64-bit fixes to 680x0 disassembler, added AltiVec instructions to PPC - disassembler, fixes to Z80 disassembler (hl->ix/iy and relative jumps) -V3.1 - Make LowMem globals as predefined variables, fix 64-bit support, enable - x86-64 disassembler with "d8664" command, removed input line length - restrictions -V3.0 - Replaced 680x0 and 80x86 disassemblers with the ones from GNU binutils, - added symbolic display of MacOS low memory globals to PPC disassembler, - MacOS features in PPC disassembler are controlled by "-m" argument, - real memory mode is entered by "-r" argument, extended 8080 disassembler - to Z80, name changed from "mon" to "cxmon" -V2.2 - Switched to autoconf/automake, fixed some minor bugs in the PPC - disassembler, commands made modular, added binary dump (b) command -V2.1 - Compiled for BeOS R4, opens Terminal window when started from Tracker, - implemented 8080 disassembler, included Unix makefile -V2.0 - Unified PPC and x86 release -V1.5 - Non-interactive mode, real mode -V1.4 - Implemented 6502 and 680x0 disassemblers -V1.3 - Now uses libreadline - Disassembler: prints SPR names instead of numbers, fixed bugs -V1.0 - Initial release diff --git a/cxmon/INSTALL b/cxmon/INSTALL deleted file mode 100644 index b42a17ac..00000000 --- a/cxmon/INSTALL +++ /dev/null @@ -1,182 +0,0 @@ -Basic Installation -================== - - These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, a file -`config.cache' that saves the results of its tests to speed up -reconfiguring, and a file `config.log' containing compiler output -(useful mainly for debugging `configure'). - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If at some point `config.cache' -contains results you don't want to keep, you may remove or edit it. - - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change -it or regenerate `configure' using a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. You can give `configure' -initial values for variables by setting them in the environment. Using -a Bourne-compatible shell, you can do that on the command line like -this: - CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure - -Or on systems that have the `env' program, you can do it like this: - env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not supports the `VPATH' -variable, you have to compile the package for one architecture at a time -in the source code directory. After you have installed the package for -one architecture, use `make distclean' before reconfiguring for another -architecture. - -Installation Names -================== - - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - - There may be some features `configure' can not figure out -automatically, but needs to determine by the type of host the package -will run on. Usually `configure' can figure that out, but if it prints -a message saying it can not guess the host type, give it the -`--host=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name with three fields: - CPU-COMPANY-SYSTEM - -See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the host type. - - If you are building compiler tools for cross-compiling, you can also -use the `--target=TYPE' option to select the type of system they will -produce code for and the `--build=TYPE' option to select the type of -system on which you are compiling the package. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Operation Controls -================== - - `configure' recognizes the following options to control how it -operates. - -`--cache-file=FILE' - Use and save the results of the tests in FILE instead of - `./config.cache'. Set FILE to `/dev/null' to disable caching, for - debugging `configure'. - -`--help' - Print a summary of the options to `configure', and exit. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--version' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`configure' also accepts some other, not widely useful, options. diff --git a/cxmon/Makefile.am b/cxmon/Makefile.am deleted file mode 100644 index 4e8b8b26..00000000 --- a/cxmon/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -## Process this file with automake to produce Makefile.in -SUBDIRS = src - -# Manpages -man_MANS = cxmon.1 - -EXTRA_DIST = cxmon.1 bootstrap - -dist-hook: cxmon.spec - cp cxmon.spec $(distdir) - -# Rule to build tar-gzipped distribution package -$(PACKAGE)-$(VERSION).tar.gz: dist - -# Rule to build RPM distribution package -rpm: $(PACKAGE)-$(VERSION).tar.gz - rpm -ta --clean $(PACKAGE)-$(VERSION).tar.gz diff --git a/cxmon/README b/cxmon/README deleted file mode 100644 index 44ab37f6..00000000 --- a/cxmon/README +++ /dev/null @@ -1,437 +0,0 @@ - - cxmon, Version 3.2 - A command-line file manipulation tool and disassembler - - Copyright (C) 1997-2007 Christian Bauer, Marc Hellwig - GNU binutils disassemblers Copyright (C) 1988, 89, 91, 93, 94, 95, 96, 97, 1998 - Free Software Foundation, Inc. - - -License -------- - -cxmon is available under the terms of the GNU General Public License. See the -file "COPYING" that is included in the distribution for details. - - -Overview --------- - -cxmon is an interactive command-driven file manipulation tool that is -inspired by the "Amiga Monitor" by Timo Rossi. It has commands and features -similar to a machine code monitor/debugger, but it lacks any functions for -running/tracing code. There are, however, built-in PowerPC, 680x0, 80x86, -x86-64, 6502 and Z80 disassemblers and special support for disassembling -MacOS code. By default, cxmon operates on a fixed-size (but adjustable) -memory buffer with adresses starting at 0. - - -Installation ------------- - -Please consult the file "INSTALL" for installation instructions. - - -Usage ------ - -cxmon can be started from the Shell or from the Tracker (BeOS), but command -line history doesn't work when started from the Tracker. - -Options: - -m enables symbolic MacOS A-Trap and low memory globals display in the - 680x0 disassembler - -r makes cxmon operate in real (virtual) memory space instead of an - allocated buffer - -If no additional command line arguments are given, cxmon enters interactive -mode. Otherwise, all remaining arguments are interpreted and executed as cxmon -commands. - -The default buffer size is 1MB. - -The cxmon command prompt looks like this: - - [00000000]-> - -The number in brackets is the value of "." (the "current address", see the -section on expressions). You can get a short command overview by entering -"h". - -Commands that create a longer output can be interrupted with Ctrl-C. - -To quit cxmon, enter the command "x". - - -Constants, variables and expressions ------------------------------------- - -The default number base is hexadecimal. Decimal numbers must be prefixed with -"_". Hexadecimal numbers may also be prefixed with "$" for clarity. Numbers -can also be entered as ASCII characters enclosed in single quotes (e.g. 'BAPP' -is the same as $42415050). All numbers are 32-bit values (one word). - -With the "set" command, variables can be defined that hold 32-bit integer -values. A variable is referred to by its name. Variable names may be arbitrary -combinations of digits and letters (they may also start with a digit) that -are not also valid hexadecimal numbers. Names are case-sensitive. - -cxmon accepts expressions in all places where you have to specify a number. -The following operators are available and have the same meaning and -precedence as in the C programming language: - - ~ complement - + unary plus - - unary minus - * multiplication - / integer division - % modulo - + addition - - subtraction - << shift left - >> shift right - & bitwise AND - ^ bitwise exclusive OR - | bitwise inclusive OR - -Parentheses may be used to change the evaluation order of sub-expressions. - -There are two special symbols that can be used in expressions: - - . represents the "current address" (the value of "." is also displayed in - the command prompt). What exactly the current address is, depends on the - command last executed. The display commands set "." to the address after - the last address displayed, the "hunt" commands sets "." to the address - of the first found occurence of the search string, etc. - : is used by the "apply" ("y") command and holds the value of the byte/ - half-word/word at the current address. - -The "modify" (":"), "fill" ("f") and "hunt" ("h") commands require you to -specify a byte string. Byte strings consist of an arbitrary number of byte -values and ASCII strings separated by commas. Examples: - - "string" - 12,34,56,78,9a,bc,de,f0 - "this",0a,"is a string",0a,"with","newlines",_10 - - -The buffer ----------- - -Those cxmon commands that operate on "memory" operate on a buffer allocated -by cxmon whose size is adjustable with the "@" command. The default buffer -size is 1MB. The buffer is an array of bytes where each byte has a 32-bit -integer address. Addresses start at 0 and are taken modulo the buffer size -(i.e. for the default 1MB buffer, addresses 0 and 100000 refer to the same -byte). - -The buffer is the working area of cxmon where you load files into, manipulate -them, and write files back from. Arbitraty portions of the buffer may be used -as scratch space. - - -Commands --------- - -The following commands are available in cxmon ('[]' marks a parameter than -can be left out): - - - x Quit cxmon - -quits cxmon and returns to the shell. - - - h Show help text - -displays a short overview of commands. - - - ?? Show list of commands - -displays a short list of available commands. - - - ver Show version - -shows the version number of cxmon. - - - ? expression Calculate expression - -displays the value of the given expression in hex, decimal, and ASCII -characters. If the value is negative, it is displayed as a signed and unsigned -number. - - - @ [size] Reallocate buffer - -changes the size of the buffer to the given number of bytes while preserving -the contents of the buffer. If the "size" argument is omitted, the current -buffer size is displayed. - - - i [start [end]] ASCII memory dump - -displays the buffer contents from address "start" to address "end" as ASCII -characters. Entering "i" without arguments is equivalent to "i .". The value -of "." is set to the address after the last address displayed. - - - b [start [end]] Binary memory dump - -displays the buffer contents from address "start" to address "end" in a binary -format. Entering "b" without arguments is equivalent to "b .". The value of -"." is set to the address after the last address displayed. - - - m [start [end]] Hex/ASCII memory dump - -displays the buffer contents from address "start" to address "end" as hex -words and ASCII characters. Entering "m" without arguments is equivalent to -"m .". The value of "." is set to the address after the last address displayed. - - - d [start [end]] Disassemble PowerPC code - -disassembles the buffer contents from address "start" to address "end". -Entering "d" without arguments is equivalent to "d .". The value of "." is -set to the address after the last address displayed. - - - d65 [start [end]] Disassemble 6502 code - -disassembles the buffer contents from address "start" to address "end". -Entering "d65" without arguments is equivalent to "d65 .". The value of -"." is set to the address after the last address displayed. - - - d68 [start [end]] Disassemble 680x0 code - -disassembles the buffer contents from address "start" to address "end". -Entering "d68" without arguments is equivalent to "d68 .". The value of -"." is set to the address after the last address displayed. - - - d80 [start [end]] Disassemble Z80 code - -disassembles the buffer contents from address "start" to address "end". -Entering "d80" without arguments is equivalent to "d80 .". The value of -"." is set to the address after the last address displayed. - - - d86 [start [end]] Disassemble 80x86 (32-bit) code - -disassembles the buffer contents from address "start" to address "end". -Entering "d86" without arguments is equivalent to "d86 .". The value of -"." is set to the address after the last address displayed. - - - d8086 [start [end]] Disassemble 80x86 (16-bit) code - -disassembles the buffer contents from address "start" to address "end". -Entering "d8086" without arguments is equivalent to "d8086 .". The value -of "." is set to the address after the last address displayed. - - - d8664 [start [end]] Disassemble x86-64 code - -disassembles the buffer contents from address "start" to address "end". -Entering "d8086" without arguments is equivalent to "d8086 .". The value -of "." is set to the address after the last address displayed. - - - : start string Modify memory - -puts the specified byte string at the address "start" into the buffer. The -value of "." is set to the address after the last address modified. - - - f start end string Fill memory - -fill the buffer in the range from "start" to (and including) "end" with the -given byte string. - - - y[b|h|w] start end expr Apply expression to memory - -works like the "fill" ("f") command, but it doesn't fill with a byte string -but with the value of an expression that is re-evaluated for each buffer -location to be filled. The command comes in three flavors: "y"/"yb" works on -bytes (8-bit), "yh" on half-words (16-bit) and "yw" on words (32-bit). The -value of "." is the current address to be modified, the value of ":" holds -the contents of this address before modification. - -Examples: - yw 0 fff :<<8 shifts all words in the address range 0..fff to the left - by 8 bits (you can use this to convert bitmap data from - ARGB to RGBA format, for example) - y 0 1234 ~: inverts all bytes in the address range 0..1234 - yh 2 ff 20000/. creates a table of the fractional parts of the reciprocals - of 1..7f - - - t start end dest Transfer memory - -transfers the buffer contents from "start" to (and including) "end" to "dest". -Source and destination may overlap. - - - c start end dest Compare memory - -compares the buffer contents in the range from "start" to (and including) -"end" with the contents at "dest". The addresses of all different bytes and -the total number of differences (decimal) are printed. - - - h start end string Search for byte string - -searches for the given byte string in the buffer starting at "start" up to -(and including) "end". The addresses and the total number of occurrences are -displayed. The value of "." is set to the address of the first occurrence. - - - \ "command" Execute shell command - -executes the given shell command which must be enclosed in quotes. - - - ls [args] List directory contents - -works as the shell command "ls". - - - rm [args] Remove file(s) - -works as the shell command "rm". - - - cp [args] Copy file(s) - -works as the shell command "cp". - - - mv [args] Move file(s) - -works as the shell command "mv". - - - cd directory Change current directory - -works as the shell command "cd". The name of the directory doesn't have to be -enclosed in quotes. - - - o ["file"] Redirect output - -When a file name is specified, all following output is redirected to this -file. The file name must be enclosed in quotation marks even if it contains -no spaces. Entering "o" without parameters closes the file and directs the -output into the terminal window again. - - - [ start "file" Load data from file - -loads the contents of the specified file into the buffer starting from address -"start". The file name must be enclosed in quotation marks even if it contains -no spaces. The value of "." is set to the address after the last address -affected by the load. - - - ] start size "file" Save data to file - -writes "size" number of bytes of the buffer from "start" to the specified file. -The file name must be enclosed in quotation marks even if it contains no spaces. - - - set [var[=value]] Set/clear/show variables - -If no arguments are given, all currently defined variables are displayed. -Otherwise, the value of "var" is set to the specified value. If "=value" -is omitted, the variable "var" is cleared. - - - cv Clear all variables - -clears all currently defined variables. - - -Examples --------- - -Here are some simple examples for what is possible with cxmon. - -Join "file1" and "file2" to "file3": - - [ 0 "file1" - [ . "file2" - ] 0 . "file3" - -Remove the first 24 bytes (e.g. an unneeded header) of a file: - - [ 0 "file" - ] 18 .-18 "file" - -Load the cxmon executable and search for PowerPC "nop" commands: - - [ 0 "cxmon" - h 0 . 60,00,00,00 - -Create a modified version of cxmon so that the prompt has " $" instead of -"->": - - [ 0 "cxmon" - set size=. - h 0 . "->" - : . " $" - ] 0 size "cxmon1" - -Convert a binary file which contains 16-bit numbers in little-endian format -to big-endian format (or vice-versa): - - [ 0 "file" - yh 0 .-1 :>>8|:<<8 - ] 0 . "file" - -Load a BeBox boot ROM image and start disassembling the system reset handler: - - [ 0 "bootnub.image" - d 100 - - -Using cxmon in your own programs --------------------------------- - -cxmon provides a simple interface for integration in other programs. It can, -for example, be used as a monitor/debugger for an emulator (it is used in -Basilisk II in this way). - -Here's how to do it (all functions are defined in the mon.h header file): - - 1. Link all the cxmon object files, except main.o, to your program. - 2. In your program, call mon_init() before using any other cxmon functions. - 3. After calling mon_init(), set the mon_read_byte and mon_write_byte - function pointers to the routines used for accessing memory. - 4. You can use mon_add_command() to add new commands to cxmon by specifying - the command name, function and help text. From within your command - function, you can use mon_get_token() and mon_expression() to parse the - arguments and the mon_read/write_*() functions to access memory. - 5. To enter cxmon, call the mon() function like this: - - char *args[3] = {"mon", "-r", NULL}; - mon(2, args); - - 6. If you're done with cxmon, call mon_exit(). - - -History -------- - -Please consult the file "ChangeLog" for the release history. - - -Christian Bauer -www.cebix.net - -Marc Hellwig - diff --git a/cxmon/bootstrap b/cxmon/bootstrap deleted file mode 100755 index 0fb6c4f8..00000000 --- a/cxmon/bootstrap +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -autoreconf --install diff --git a/cxmon/configure.ac b/cxmon/configure.ac deleted file mode 100644 index f93e6c85..00000000 --- a/cxmon/configure.ac +++ /dev/null @@ -1,47 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -dnl Written by Christian Bauer - -AC_PREREQ(2.69) -AC_INIT([cxmon], [3.2], [cb@cebix.net], [cxmon]) -AC_CONFIG_SRCDIR([src/mon.cpp]) -AM_INIT_AUTOMAKE([1.12 foreign]) - -AM_CONFIG_HEADER(config.h) - -dnl Checks for programs. -AC_PROG_CC -AC_PROG_CPP -AC_PROG_CXX -AC_PROG_CXXCPP -AC_PROG_INSTALL -AC_PROG_RANLIB - -dnl Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS(unistd.h readline.h history.h readline/readline.h readline/history.h) - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_CHECK_SIZEOF(short, 2) -AC_CHECK_SIZEOF(int, 4) -AC_CHECK_SIZEOF(long, 4) -AC_CHECK_SIZEOF(long long, 8) -AC_CHECK_SIZEOF(void *, 4) - -dnl Checks for libraries. -AC_SEARCH_LIBS([tgetent], [ncurses termcap termlib terminfo Hcurses curses], [], [ - AC_MSG_ERROR([unable to find the tgetent() function]) -]) -AC_SEARCH_LIBS([readline], [readline], [], [ - AC_MSG_ERROR([unable to find the readline() function]) -]) - -dnl Generate Makefile. -AC_OUTPUT([ -Makefile -cxmon.spec -src/Makefile -src/disass/Makefile -]) - -dnl Print summary. -echo "Configuration done. Now type \"make\"." diff --git a/cxmon/cxmon.1 b/cxmon/cxmon.1 deleted file mode 100644 index 7e0ef360..00000000 --- a/cxmon/cxmon.1 +++ /dev/null @@ -1,56 +0,0 @@ -.TH cxmon 1 "January, 2007" -.SH NAME -cxmon \- a command-line file manipulation tool and disassembler -.SH SYNOPSIS -.B cxmon -[\-m] [\-r] -.RI [ commands\&... ] -.SH DESCRIPTION -.B cxmon -is an interactive command-driven file manipulation tool that is inspired by -the "Amiga Monitor" by Timo Rossi. It has commands and features similar to a -machine code monitor/debugger, but it lacks any functions for running/tracing -code. There are, however, built-in PowerPC, 680x0, 80x86, 6502 and Z80 -disassemblers and special support for disassembling MacOS code. By default, -cxmon operates on a fixed-size (but adjustable) memory buffer with adresses -starting at 0. -.PP -Type "h" to get a list of supported commands. -.PP -For more information, see the included "README" file. -.SH OPTIONS -.TP -.B \-m -enables symbolic MacOS A-Trap and low memory globals display in the 680x0 -disassembler -.TP -.B \-r -makes cxmon operate in real (virtual) memory space instead of an allocated -buffer -.PP -If no additional command line arguments are given, cxmon enters interactive -mode. Otherwise, all remaining arguments are interpreted and executed as cxmon -commands. -.SH AUTHORS -Christian Bauer -.br -Marc Hellwig -.SH COPYRIGHT -Copyright \(co 1997-2007 Christian Bauer, Marc Hellwig -.br -GNU binutils disassemblers Copyright \(co 1988, 89, 91, 93, 94, 95, 96, 97, 1998 -Free Software Foundation, Inc. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. diff --git a/cxmon/cxmon.spec.in b/cxmon/cxmon.spec.in deleted file mode 100644 index 6b1cfd33..00000000 --- a/cxmon/cxmon.spec.in +++ /dev/null @@ -1,42 +0,0 @@ -%define name @PACKAGE@ -%define version @VERSION@ -%define release 1 - -Summary: Command-line file manipulation tool and disassembler -Name: %{name} -Version: %{version} -Release: %{release} -License: GPL -Group: Utilities/File -Source0: %{name}-%{version}.tar.gz -URL: http://cxmon.cebix.net/ -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -Prefix: %{_prefix} - -%description -cxmon is an interactive command-driven file manipulation tool that is -inspired by the "Amiga Monitor" by Timo Rossi. It has commands and features -similar to a machine code monitor/debugger, but it lacks any functions for -running/tracing code. There are, however, built-in PowerPC, 680x0, 80x86, -x86-64, 6502 and Z80 disassemblers and special support for disassembling -MacOS code. - -%prep -%setup -q - -%build -%configure -make - -%install -rm -rf ${RPM_BUILD_ROOT} -%makeinstall - -%clean -rm -rf ${RPM_BUILD_ROOT} - -%files -%defattr(-,root,root) -%doc AUTHORS ChangeLog COPYING README -%{_bindir}/* -%{_mandir}/man1/* diff --git a/cxmon/src/Makefile.am b/cxmon/src/Makefile.am deleted file mode 100644 index 0b865b2d..00000000 --- a/cxmon/src/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -## Process this file with automake to produce Makefile.in - -SUBDIRS = disass - -bin_PROGRAMS = cxmon -cxmon_SOURCES = main.cpp mon.cpp mon.h mon_6502.cpp mon_z80.cpp mon_atraps.h \ - mon_cmd.cpp mon_cmd.h mon_disass.cpp mon_disass.h mon_lowmem.cpp mon_lowmem.h \ - mon_ppc.cpp sysdeps.h - -cxmon_LDADD = disass/libdisass.a diff --git a/cxmon/src/disass/Makefile.am b/cxmon/src/disass/Makefile.am deleted file mode 100644 index 80a908fb..00000000 --- a/cxmon/src/disass/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -## Process this file with automake to produce Makefile.in - -noinst_LIBRARIES = libdisass.a -libdisass_a_SOURCES = ansidecl.h bfd.h dis-asm.h floatformat.c floatformat.h \ - i386-dis.c m68k-dis.c m68k-opc.c m68k.h opintl.h - -# Extra includes, for -CPPFLAGS = -I$(srcdir)/.. diff --git a/cxmon/src/disass/ansidecl.h b/cxmon/src/disass/ansidecl.h deleted file mode 100644 index 9a7c5777..00000000 --- a/cxmon/src/disass/ansidecl.h +++ /dev/null @@ -1,295 +0,0 @@ -/* ANSI and traditional C compatability macros - Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. - This file is part of the GNU C Library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* ANSI and traditional C compatibility macros - - ANSI C is assumed if __STDC__ is #defined. - - Macro ANSI C definition Traditional C definition - ----- ---- - ---------- ----------- - ---------- - ANSI_PROTOTYPES 1 not defined - PTR `void *' `char *' - PTRCONST `void *const' `char *' - LONG_DOUBLE `long double' `double' - const not defined `' - volatile not defined `' - signed not defined `' - VA_START(ap, var) va_start(ap, var) va_start(ap) - - Note that it is safe to write "void foo();" indicating a function - with no return value, in all K+R compilers we have been able to test. - - For declaring functions with prototypes, we also provide these: - - PARAMS ((prototype)) - -- for functions which take a fixed number of arguments. Use this - when declaring the function. When defining the function, write a - K+R style argument list. For example: - - char *strcpy PARAMS ((char *dest, char *source)); - ... - char * - strcpy (dest, source) - char *dest; - char *source; - { ... } - - - VPARAMS ((prototype, ...)) - -- for functions which take a variable number of arguments. Use - PARAMS to declare the function, VPARAMS to define it. For example: - - int printf PARAMS ((const char *format, ...)); - ... - int - printf VPARAMS ((const char *format, ...)) - { - ... - } - - For writing functions which take variable numbers of arguments, we - also provide the VA_OPEN, VA_CLOSE, and VA_FIXEDARG macros. These - hide the differences between K+R and C89 more - thoroughly than the simple VA_START() macro mentioned above. - - VA_OPEN and VA_CLOSE are used *instead of* va_start and va_end. - Immediately after VA_OPEN, put a sequence of VA_FIXEDARG calls - corresponding to the list of fixed arguments. Then use va_arg - normally to get the variable arguments, or pass your va_list object - around. You do not declare the va_list yourself; VA_OPEN does it - for you. - - Here is a complete example: - - int - printf VPARAMS ((const char *format, ...)) - { - int result; - - VA_OPEN (ap, format); - VA_FIXEDARG (ap, const char *, format); - - result = vfprintf (stdout, format, ap); - VA_CLOSE (ap); - - return result; - } - - - You can declare variables either before or after the VA_OPEN, - VA_FIXEDARG sequence. Also, VA_OPEN and VA_CLOSE are the beginning - and end of a block. They must appear at the same nesting level, - and any variables declared after VA_OPEN go out of scope at - VA_CLOSE. Unfortunately, with a K+R compiler, that includes the - argument list. You can have multiple instances of VA_OPEN/VA_CLOSE - pairs in a single function in case you need to traverse the - argument list more than once. - - For ease of writing code which uses GCC extensions but needs to be - portable to other compilers, we provide the GCC_VERSION macro that - simplifies testing __GNUC__ and __GNUC_MINOR__ together, and various - wrappers around __attribute__. Also, __extension__ will be #defined - to nothing if it doesn't work. See below. - - This header also defines a lot of obsolete macros: - CONST, VOLATILE, SIGNED, PROTO, EXFUN, DEFUN, DEFUN_VOID, - AND, DOTS, NOARGS. Don't use them. */ - -#ifndef _ANSIDECL_H -#define _ANSIDECL_H 1 - -/* Every source file includes this file, - so they will all get the switch for lint. */ -/* LINTLIBRARY */ - -/* Using MACRO(x,y) in cpp #if conditionals does not work with some - older preprocessors. Thus we can't define something like this: - -#define HAVE_GCC_VERSION(MAJOR, MINOR) \ - (__GNUC__ > (MAJOR) || (__GNUC__ == (MAJOR) && __GNUC_MINOR__ >= (MINOR))) - -and then test "#if HAVE_GCC_VERSION(2,7)". - -So instead we use the macro below and test it against specific values. */ - -/* This macro simplifies testing whether we are using gcc, and if it - is of a particular minimum version. (Both major & minor numbers are - significant.) This macro will evaluate to 0 if we are not using - gcc at all. */ -#ifndef GCC_VERSION -#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) -#endif /* GCC_VERSION */ - -#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32) -/* All known AIX compilers implement these things (but don't always - define __STDC__). The RISC/OS MIPS compiler defines these things - in SVR4 mode, but does not define __STDC__. */ - -#define ANSI_PROTOTYPES 1 -#define PTR void * -#define PTRCONST void *const -#define LONG_DOUBLE long double - -#define PARAMS(ARGS) ARGS -#define VPARAMS(ARGS) ARGS -#define VA_START(VA_LIST, VAR) va_start(VA_LIST, VAR) - -/* variadic function helper macros */ -/* "struct Qdmy" swallows the semicolon after VA_OPEN/VA_FIXEDARG's - use without inhibiting further decls and without declaring an - actual variable. */ -#define VA_OPEN(AP, VAR) { va_list AP; va_start(AP, VAR); { struct Qdmy -#define VA_CLOSE(AP) } va_end(AP); } -#define VA_FIXEDARG(AP, T, N) struct Qdmy - -#undef const -#undef volatile -#undef signed - -/* inline requires special treatment; it's in C99, and GCC >=2.7 supports - it too, but it's not in C89. */ -#undef inline -#if __STDC_VERSION__ > 199901L -/* it's a keyword */ -#else -# if GCC_VERSION >= 2007 -# define inline __inline__ /* __inline__ prevents -pedantic warnings */ -# else -# define inline /* nothing */ -# endif -#endif - -/* These are obsolete. Do not use. */ -#ifndef IN_GCC -#define CONST const -#define VOLATILE volatile -#define SIGNED signed - -#define PROTO(type, name, arglist) type name arglist -#define EXFUN(name, proto) name proto -#define DEFUN(name, arglist, args) name(args) -#define DEFUN_VOID(name) name(void) -#define AND , -#define DOTS , ... -#define NOARGS void -#endif /* ! IN_GCC */ - -#else /* Not ANSI C. */ - -#undef ANSI_PROTOTYPES -#define PTR char * -#define PTRCONST PTR -#define LONG_DOUBLE double - -#define PARAMS(args) () -#define VPARAMS(args) (va_alist) va_dcl -#define VA_START(va_list, var) va_start(va_list) - -#define VA_OPEN(AP, VAR) { va_list AP; va_start(AP); { struct Qdmy -#define VA_CLOSE(AP) } va_end(AP); } -#define VA_FIXEDARG(AP, TYPE, NAME) TYPE NAME = va_arg(AP, TYPE) - -/* some systems define these in header files for non-ansi mode */ -#undef const -#undef volatile -#undef signed -#undef inline -#define const -#define volatile -#define signed -#define inline - -#ifndef IN_GCC -#define CONST -#define VOLATILE -#define SIGNED - -#define PROTO(type, name, arglist) type name () -#define EXFUN(name, proto) name() -#define DEFUN(name, arglist, args) name arglist args; -#define DEFUN_VOID(name) name() -#define AND ; -#define DOTS -#define NOARGS -#endif /* ! IN_GCC */ - -#endif /* ANSI C. */ - -/* Define macros for some gcc attributes. This permits us to use the - macros freely, and know that they will come into play for the - version of gcc in which they are supported. */ - -#if (GCC_VERSION < 2007) -# define __attribute__(x) -#endif - -/* Attribute __malloc__ on functions was valid as of gcc 2.96. */ -#ifndef ATTRIBUTE_MALLOC -# if (GCC_VERSION >= 2096) -# define ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) -# else -# define ATTRIBUTE_MALLOC -# endif /* GNUC >= 2.96 */ -#endif /* ATTRIBUTE_MALLOC */ - -/* Attributes on labels were valid as of gcc 2.93. */ -#ifndef ATTRIBUTE_UNUSED_LABEL -# if (GCC_VERSION >= 2093) -# define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED -# else -# define ATTRIBUTE_UNUSED_LABEL -# endif /* GNUC >= 2.93 */ -#endif /* ATTRIBUTE_UNUSED_LABEL */ - -#ifndef ATTRIBUTE_UNUSED -#define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) -#endif /* ATTRIBUTE_UNUSED */ - -#ifndef ATTRIBUTE_NORETURN -#define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) -#endif /* ATTRIBUTE_NORETURN */ - -#ifndef ATTRIBUTE_PRINTF -#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) -#define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2) -#define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3) -#define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4) -#define ATTRIBUTE_PRINTF_4 ATTRIBUTE_PRINTF(4, 5) -#define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6) -#endif /* ATTRIBUTE_PRINTF */ - -/* We use __extension__ in some places to suppress -pedantic warnings - about GCC extensions. This feature didn't work properly before - gcc 2.8. */ -#if GCC_VERSION < 2008 -#define __extension__ -#endif - -/* Bootstrap support: Adjust certain macros defined by Autoconf, - which are only valid for the stage1 compiler. If we detect - a modern version of GCC, we are probably in stage2 or beyond, - so unconditionally reset the values. Note that const, inline, - etc. have been dealt with above. */ -#if (GCC_VERSION >= 2007) -# ifndef HAVE_LONG_DOUBLE -# define HAVE_LONG_DOUBLE 1 -# endif -#endif /* GCC >= 2.7 */ - -#endif /* ansidecl.h */ diff --git a/cxmon/src/disass/bfd.h b/cxmon/src/disass/bfd.h deleted file mode 100644 index dbb9a882..00000000 --- a/cxmon/src/disass/bfd.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * bfd.h - Dummy bfd library header file - */ - -#include "sysdeps.h" -#include "ansidecl.h" - -enum bfd_flavour { - bfd_target_unknown_flavour -}; - -enum bfd_endian { - BFD_ENDIAN_BIG, - BFD_ENDIAN_LITTLE, - BFD_ENDIAN_UNKNOWN -}; - -enum bfd_architecture { - bfd_arch_unknown, - bfd_arch_m68k, -#define bfd_mach_m68000 1 -#define bfd_mach_m68008 2 -#define bfd_mach_m68010 3 -#define bfd_mach_m68020 4 -#define bfd_mach_m68030 5 -#define bfd_mach_m68040 6 -#define bfd_mach_m68060 7 - bfd_arch_i386 -#define bfd_mach_i386_i386 0 -#define bfd_mach_i386_i8086 1 -#define bfd_mach_i386_i386_intel_syntax 2 -#define bfd_mach_x86_64 3 -#define bfd_mach_x86_64_intel_syntax 4 -}; - -typedef struct symbol_cache_entry { - CONST char *name; -} asymbol; - -typedef uint64 bfd_vma; -typedef int64 bfd_signed_vma; -typedef unsigned char bfd_byte; - -typedef struct _bfd bfd; -struct _bfd; - -#if SIZEOF_LONG == 8 -#define BFD_HOST_64BIT_LONG 1 -#endif - -// 64-bit vma -#define BFD64 - -#ifndef fprintf_vma -#if BFD_HOST_64BIT_LONG -#define sprintf_vma(s,x) sprintf (s, "%016lx", x) -#define fprintf_vma(f,x) fprintf (f, "%016lx", x) -#else -#define _bfd_int64_low(x) ((unsigned long) (((x) & 0xffffffff))) -#define _bfd_int64_high(x) ((unsigned long) (((x) >> 32) & 0xffffffff)) -#define fprintf_vma(s,x) \ - fprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x)) -#define sprintf_vma(s,x) \ - sprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x)) -#endif -#endif diff --git a/cxmon/src/disass/dis-asm.h b/cxmon/src/disass/dis-asm.h deleted file mode 100644 index 3d2461c0..00000000 --- a/cxmon/src/disass/dis-asm.h +++ /dev/null @@ -1,315 +0,0 @@ -/* Interface between the opcode library and its callers. - - Copyright 2001, 2002 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Written by Cygnus Support, 1993. - - The opcode library (libopcodes.a) provides instruction decoders for - a large variety of instruction sets, callable with an identical - interface, for making instruction-processing programs more independent - of the instruction set being processed. */ - -#ifndef DIS_ASM_H -#define DIS_ASM_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include "bfd.h" - -typedef int (*fprintf_ftype) PARAMS((PTR, const char*, ...)); - -enum dis_insn_type { - dis_noninsn, /* Not a valid instruction */ - dis_nonbranch, /* Not a branch instruction */ - dis_branch, /* Unconditional branch */ - dis_condbranch, /* Conditional branch */ - dis_jsr, /* Jump to subroutine */ - dis_condjsr, /* Conditional jump to subroutine */ - dis_dref, /* Data reference instruction */ - dis_dref2 /* Two data references in instruction */ -}; - -/* This struct is passed into the instruction decoding routine, - and is passed back out into each callback. The various fields are used - for conveying information from your main routine into your callbacks, - for passing information into the instruction decoders (such as the - addresses of the callback functions), or for passing information - back from the instruction decoders to their callers. - - It must be initialized before it is first passed; this can be done - by hand, or using one of the initialization macros below. */ - -typedef struct disassemble_info { - fprintf_ftype fprintf_func; - PTR stream; - PTR application_data; - - /* Target description. We could replace this with a pointer to the bfd, - but that would require one. There currently isn't any such requirement - so to avoid introducing one we record these explicitly. */ - /* The bfd_flavour. This can be bfd_target_unknown_flavour. */ - enum bfd_flavour flavour; - /* The bfd_arch value. */ - enum bfd_architecture arch; - /* The bfd_mach value. */ - unsigned long mach; - /* Endianness (for bi-endian cpus). Mono-endian cpus can ignore this. */ - enum bfd_endian endian; - /* An arch/mach-specific bitmask of selected instruction subsets, mainly - for processors with run-time-switchable instruction sets. The default, - zero, means that there is no constraint. CGEN-based opcodes ports - may use ISA_foo masks. */ - unsigned long insn_sets; - - /* An array of pointers to symbols either at the location being disassembled - or at the start of the function being disassembled. The array is sorted - so that the first symbol is intended to be the one used. The others are - present for any misc. purposes. This is not set reliably, but if it is - not NULL, it is correct. */ - asymbol **symbols; - /* Number of symbols in array. */ - int num_symbols; - - /* For use by the disassembler. - The top 16 bits are reserved for public use (and are documented here). - The bottom 16 bits are for the internal use of the disassembler. */ - unsigned long flags; -#define INSN_HAS_RELOC 0x80000000 - PTR private_data; - - /* Function used to get bytes to disassemble. MEMADDR is the - address of the stuff to be disassembled, MYADDR is the address to - put the bytes in, and LENGTH is the number of bytes to read. - INFO is a pointer to this struct. - Returns an errno value or 0 for success. */ - int (*read_memory_func) - PARAMS ((bfd_vma memaddr, bfd_byte *myaddr, unsigned int length, - struct disassemble_info *info)); - - /* Function which should be called if we get an error that we can't - recover from. STATUS is the errno value from read_memory_func and - MEMADDR is the address that we were trying to read. INFO is a - pointer to this struct. */ - void (*memory_error_func) - PARAMS ((int status, bfd_vma memaddr, struct disassemble_info *info)); - - /* Function called to print ADDR. */ - void (*print_address_func) - PARAMS ((bfd_vma addr, struct disassemble_info *info)); - - /* Function called to determine if there is a symbol at the given ADDR. - If there is, the function returns 1, otherwise it returns 0. - This is used by ports which support an overlay manager where - the overlay number is held in the top part of an address. In - some circumstances we want to include the overlay number in the - address, (normally because there is a symbol associated with - that address), but sometimes we want to mask out the overlay bits. */ - int (* symbol_at_address_func) - PARAMS ((bfd_vma addr, struct disassemble_info * info)); - - /* These are for buffer_read_memory. */ - bfd_byte *buffer; - bfd_vma buffer_vma; - unsigned int buffer_length; - - /* This variable may be set by the instruction decoder. It suggests - the number of bytes objdump should display on a single line. If - the instruction decoder sets this, it should always set it to - the same value in order to get reasonable looking output. */ - int bytes_per_line; - - /* the next two variables control the way objdump displays the raw data */ - /* For example, if bytes_per_line is 8 and bytes_per_chunk is 4, the */ - /* output will look like this: - 00: 00000000 00000000 - with the chunks displayed according to "display_endian". */ - int bytes_per_chunk; - enum bfd_endian display_endian; - - /* Number of octets per incremented target address - Normally one, but some DSPs have byte sizes of 16 or 32 bits. */ - unsigned int octets_per_byte; - - /* Results from instruction decoders. Not all decoders yet support - this information. This info is set each time an instruction is - decoded, and is only valid for the last such instruction. - - To determine whether this decoder supports this information, set - insn_info_valid to 0, decode an instruction, then check it. */ - - char insn_info_valid; /* Branch info has been set. */ - char branch_delay_insns; /* How many sequential insn's will run before - a branch takes effect. (0 = normal) */ - char data_size; /* Size of data reference in insn, in bytes */ - enum dis_insn_type insn_type; /* Type of instruction */ - bfd_vma target; /* Target address of branch or dref, if known; - zero if unknown. */ - bfd_vma target2; /* Second target address for dref2 */ - - /* Command line options specific to the target disassembler. */ - char * disassembler_options; - -} disassemble_info; - - -/* Standard disassemblers. Disassemble one instruction at the given - target address. Return number of octets processed. */ -typedef int (*disassembler_ftype) - PARAMS((bfd_vma, disassemble_info *)); - -extern int print_insn_big_mips PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_little_mips PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_i386 PARAMS ((bfd_vma, disassemble_info *)); -extern int print_insn_i386_att PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_i386_intel PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_ia64 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_i370 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_m68hc11 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_m68hc12 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_m68k PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_z8001 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_z8002 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_h8300 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_h8300h PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_h8300s PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_h8500 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_alpha PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_big_arm PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_little_arm PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_sparc PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_big_a29k PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_little_a29k PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_avr PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_d10v PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_d30v PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_dlx PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_fr30 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_hppa PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_i860 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_i960 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_m32r PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_m88k PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_mcore PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_mmix PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_mn10200 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_mn10300 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_ns32k PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_openrisc PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_big_or32 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_little_or32 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_pdp11 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_pj PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_big_powerpc PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_little_powerpc PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_rs6000 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_s390 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_sh PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_tic30 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_tic54x PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_tic80 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_v850 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_vax PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_w65 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_xstormy16 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_sh64 PARAMS ((bfd_vma, disassemble_info *)); -extern int print_insn_sh64x_media PARAMS ((bfd_vma, disassemble_info *)); -extern int print_insn_frv PARAMS ((bfd_vma, disassemble_info *)); - -extern disassembler_ftype arc_get_disassembler PARAMS ((void *)); -extern disassembler_ftype cris_get_disassembler PARAMS ((bfd *)); - -extern void print_arm_disassembler_options PARAMS ((FILE *)); -extern void parse_arm_disassembler_option PARAMS ((char *)); -extern int get_arm_regname_num_options PARAMS ((void)); -extern int set_arm_regname_option PARAMS ((int)); -extern int get_arm_regnames PARAMS ((int, const char **, const char **, const char ***)); - -/* Fetch the disassembler for a given BFD, if that support is available. */ -extern disassembler_ftype disassembler PARAMS ((bfd *)); - -/* Document any target specific options available from the disassembler. */ -extern void disassembler_usage PARAMS ((FILE *)); - - -/* This block of definitions is for particular callers who read instructions - into a buffer before calling the instruction decoder. */ - -/* Here is a function which callers may wish to use for read_memory_func. - It gets bytes from a buffer. */ -extern int buffer_read_memory - PARAMS ((bfd_vma, bfd_byte *, unsigned int, struct disassemble_info *)); - -/* This function goes with buffer_read_memory. - It prints a message using info->fprintf_func and info->stream. */ -extern void perror_memory PARAMS ((int, bfd_vma, struct disassemble_info *)); - - -/* Just print the address in hex. This is included for completeness even - though both GDB and objdump provide their own (to print symbolic - addresses). */ -extern void generic_print_address - PARAMS ((bfd_vma, struct disassemble_info *)); - -/* Always true. */ -extern int generic_symbol_at_address - PARAMS ((bfd_vma, struct disassemble_info *)); - -/* Macro to initialize a disassemble_info struct. This should be called - by all applications creating such a struct. */ -#define INIT_DISASSEMBLE_INFO(INFO, STREAM, FPRINTF_FUNC) \ - (INFO).flavour = bfd_target_unknown_flavour, \ - (INFO).arch = bfd_arch_unknown, \ - (INFO).mach = 0, \ - (INFO).insn_sets = 0, \ - (INFO).endian = BFD_ENDIAN_UNKNOWN, \ - (INFO).octets_per_byte = 1, \ - INIT_DISASSEMBLE_INFO_NO_ARCH(INFO, STREAM, FPRINTF_FUNC) - -/* Call this macro to initialize only the internal variables for the - disassembler. Architecture dependent things such as byte order, or machine - variant are not touched by this macro. This makes things much easier for - GDB which must initialize these things separately. */ - -#define INIT_DISASSEMBLE_INFO_NO_ARCH(INFO, STREAM, FPRINTF_FUNC) \ - (INFO).fprintf_func = (fprintf_ftype)(FPRINTF_FUNC), \ - (INFO).stream = (PTR)(STREAM), \ - (INFO).symbols = NULL, \ - (INFO).num_symbols = 0, \ - (INFO).private_data = NULL, \ - (INFO).buffer = NULL, \ - (INFO).buffer_vma = 0, \ - (INFO).buffer_length = 0, \ - (INFO).read_memory_func = buffer_read_memory, \ - (INFO).memory_error_func = perror_memory, \ - (INFO).print_address_func = generic_print_address, \ - (INFO).symbol_at_address_func = generic_symbol_at_address, \ - (INFO).flags = 0, \ - (INFO).bytes_per_line = 0, \ - (INFO).bytes_per_chunk = 0, \ - (INFO).display_endian = BFD_ENDIAN_UNKNOWN, \ - (INFO).disassembler_options = NULL, \ - (INFO).insn_info_valid = 0 - -#ifdef __cplusplus -}; -#endif - -#endif /* ! defined (DIS_ASM_H) */ diff --git a/cxmon/src/disass/floatformat.c b/cxmon/src/disass/floatformat.c deleted file mode 100644 index 7f6086f4..00000000 --- a/cxmon/src/disass/floatformat.c +++ /dev/null @@ -1,401 +0,0 @@ -/* IEEE floating point support routines, for GDB, the GNU Debugger. - Copyright (C) 1991, 1994 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "floatformat.h" -#include /* ldexp */ -#ifdef __STDC__ -#include -extern void *memcpy (void *s1, const void *s2, size_t n); -extern void *memset (void *s, int c, size_t n); -#else -extern char *memcpy (); -extern char *memset (); -#endif - -/* The odds that CHAR_BIT will be anything but 8 are low enough that I'm not - going to bother with trying to muck around with whether it is defined in - a system header, what we do if not, etc. */ -#define FLOATFORMAT_CHAR_BIT 8 - -/* floatformats for IEEE single and double, big and little endian. */ -const struct floatformat floatformat_ieee_single_big = -{ - floatformat_big, 32, 0, 1, 8, 127, 255, 9, 23, floatformat_intbit_no -}; -const struct floatformat floatformat_ieee_single_little = -{ - floatformat_little, 32, 0, 1, 8, 127, 255, 9, 23, floatformat_intbit_no -}; -const struct floatformat floatformat_ieee_double_big = -{ - floatformat_big, 64, 0, 1, 11, 1023, 2047, 12, 52, floatformat_intbit_no -}; -const struct floatformat floatformat_ieee_double_little = -{ - floatformat_little, 64, 0, 1, 11, 1023, 2047, 12, 52, floatformat_intbit_no -}; - -/* floatformat for IEEE double, little endian byte order, with big endian word - ordering, as on the ARM. */ - -const struct floatformat floatformat_ieee_double_littlebyte_bigword = -{ - floatformat_littlebyte_bigword, 64, 0, 1, 11, 1023, 2047, 12, 52, floatformat_intbit_no -}; - -const struct floatformat floatformat_i387_ext = -{ - floatformat_little, 80, 0, 1, 15, 0x3fff, 0x7fff, 16, 64, - floatformat_intbit_yes -}; -const struct floatformat floatformat_m68881_ext = -{ - /* Note that the bits from 16 to 31 are unused. */ - floatformat_big, 96, 0, 1, 15, 0x3fff, 0x7fff, 32, 64, floatformat_intbit_yes -}; -const struct floatformat floatformat_i960_ext = -{ - /* Note that the bits from 0 to 15 are unused. */ - floatformat_little, 96, 16, 17, 15, 0x3fff, 0x7fff, 32, 64, - floatformat_intbit_yes -}; -const struct floatformat floatformat_m88110_ext = -{ -#ifdef HARRIS_FLOAT_FORMAT - /* Harris uses raw format 128 bytes long, but the number is just an ieee - double, and the last 64 bits are wasted. */ - floatformat_big,128, 0, 1, 11, 0x3ff, 0x7ff, 12, 52, - floatformat_intbit_no -#else - floatformat_big, 80, 0, 1, 15, 0x3fff, 0x7fff, 16, 64, - floatformat_intbit_yes -#endif /* HARRIS_FLOAT_FORMAT */ -}; -const struct floatformat floatformat_arm_ext = -{ - /* Bits 1 to 16 are unused. */ - floatformat_big, 96, 0, 17, 15, 0x3fff, 0x7fff, 32, 64, - floatformat_intbit_yes -}; - -static unsigned long get_field PARAMS ((unsigned char *, - enum floatformat_byteorders, - unsigned int, - unsigned int, - unsigned int)); - -/* Extract a field which starts at START and is LEN bytes long. DATA and - TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER. */ -static unsigned long -get_field (data, order, total_len, start, len) - unsigned char *data; - enum floatformat_byteorders order; - unsigned int total_len; - unsigned int start; - unsigned int len; -{ - unsigned long result; - unsigned int cur_byte; - int cur_bitshift; - - /* Start at the least significant part of the field. */ - cur_byte = (start + len) / FLOATFORMAT_CHAR_BIT; - if (order == floatformat_little) - cur_byte = (total_len / FLOATFORMAT_CHAR_BIT) - cur_byte - 1; - cur_bitshift = - ((start + len) % FLOATFORMAT_CHAR_BIT) - FLOATFORMAT_CHAR_BIT; - result = *(data + cur_byte) >> (-cur_bitshift); - cur_bitshift += FLOATFORMAT_CHAR_BIT; - if (order == floatformat_little) - ++cur_byte; - else - --cur_byte; - - /* Move towards the most significant part of the field. */ - while (cur_bitshift < len) - { - if (len - cur_bitshift < FLOATFORMAT_CHAR_BIT) - /* This is the last byte; zero out the bits which are not part of - this field. */ - result |= - (*(data + cur_byte) & ((1 << (len - cur_bitshift)) - 1)) - << cur_bitshift; - else - result |= *(data + cur_byte) << cur_bitshift; - cur_bitshift += FLOATFORMAT_CHAR_BIT; - if (order == floatformat_little) - ++cur_byte; - else - --cur_byte; - } - return result; -} - -#ifndef min -#define min(a, b) ((a) < (b) ? (a) : (b)) -#endif - -/* Convert from FMT to a double. - FROM is the address of the extended float. - Store the double in *TO. */ - -void -floatformat_to_double (fmt, from, to) - const struct floatformat *fmt; - char *from; - double *to; -{ - unsigned char *ufrom = (unsigned char *)from; - double dto; - long exponent; - unsigned long mant; - unsigned int mant_bits, mant_off; - int mant_bits_left; - int special_exponent; /* It's a NaN, denorm or zero */ - - exponent = get_field (ufrom, fmt->byteorder, fmt->totalsize, - fmt->exp_start, fmt->exp_len); - /* Note that if exponent indicates a NaN, we can't really do anything useful - (not knowing if the host has NaN's, or how to build one). So it will - end up as an infinity or something close; that is OK. */ - - mant_bits_left = fmt->man_len; - mant_off = fmt->man_start; - dto = 0.0; - - special_exponent = exponent == 0 || exponent == fmt->exp_nan; - - /* Don't bias zero's, denorms or NaNs. */ - if (!special_exponent) - exponent -= fmt->exp_bias; - - /* Build the result algebraically. Might go infinite, underflow, etc; - who cares. */ - - /* If this format uses a hidden bit, explicitly add it in now. Otherwise, - increment the exponent by one to account for the integer bit. */ - - if (!special_exponent) - if (fmt->intbit == floatformat_intbit_no) - dto = ldexp (1.0, exponent); - else - exponent++; - - while (mant_bits_left > 0) - { - mant_bits = min (mant_bits_left, 32); - - mant = get_field (ufrom, fmt->byteorder, fmt->totalsize, - mant_off, mant_bits); - - dto += ldexp ((double)mant, exponent - mant_bits); - exponent -= mant_bits; - mant_off += mant_bits; - mant_bits_left -= mant_bits; - } - - /* Negate it if negative. */ - if (get_field (ufrom, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1)) - dto = -dto; - *to = dto; -} - -static void put_field PARAMS ((unsigned char *, enum floatformat_byteorders, - unsigned int, - unsigned int, - unsigned int, - unsigned long)); - -/* Set a field which starts at START and is LEN bytes long. DATA and - TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER. */ -static void -put_field (data, order, total_len, start, len, stuff_to_put) - unsigned char *data; - enum floatformat_byteorders order; - unsigned int total_len; - unsigned int start; - unsigned int len; - unsigned long stuff_to_put; -{ - unsigned int cur_byte; - int cur_bitshift; - - /* Start at the least significant part of the field. */ - cur_byte = (start + len) / FLOATFORMAT_CHAR_BIT; - if (order == floatformat_little) - cur_byte = (total_len / FLOATFORMAT_CHAR_BIT) - cur_byte - 1; - cur_bitshift = - ((start + len) % FLOATFORMAT_CHAR_BIT) - FLOATFORMAT_CHAR_BIT; - *(data + cur_byte) &= - ~(((1 << ((start + len) % FLOATFORMAT_CHAR_BIT)) - 1) << (-cur_bitshift)); - *(data + cur_byte) |= - (stuff_to_put & ((1 << FLOATFORMAT_CHAR_BIT) - 1)) << (-cur_bitshift); - cur_bitshift += FLOATFORMAT_CHAR_BIT; - if (order == floatformat_little) - ++cur_byte; - else - --cur_byte; - - /* Move towards the most significant part of the field. */ - while (cur_bitshift < len) - { - if (len - cur_bitshift < FLOATFORMAT_CHAR_BIT) - { - /* This is the last byte. */ - *(data + cur_byte) &= - ~((1 << (len - cur_bitshift)) - 1); - *(data + cur_byte) |= (stuff_to_put >> cur_bitshift); - } - else - *(data + cur_byte) = ((stuff_to_put >> cur_bitshift) - & ((1 << FLOATFORMAT_CHAR_BIT) - 1)); - cur_bitshift += FLOATFORMAT_CHAR_BIT; - if (order == floatformat_little) - ++cur_byte; - else - --cur_byte; - } -} - -/* The converse: convert the double *FROM to an extended float - and store where TO points. Neither FROM nor TO have any alignment - restrictions. */ - -void -floatformat_from_double (fmt, from, to) - CONST struct floatformat *fmt; - double *from; - char *to; -{ - double dfrom; - int exponent; - double mant; - unsigned int mant_bits, mant_off; - int mant_bits_left; - unsigned char *uto = (unsigned char *)to; - - memcpy (&dfrom, from, sizeof (dfrom)); - memset (uto, 0, fmt->totalsize / FLOATFORMAT_CHAR_BIT); - if (dfrom == 0) - return; /* Result is zero */ - if (dfrom != dfrom) - { - /* From is NaN */ - put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start, - fmt->exp_len, fmt->exp_nan); - /* Be sure it's not infinity, but NaN value is irrel */ - put_field (uto, fmt->byteorder, fmt->totalsize, fmt->man_start, - 32, 1); - return; - } - - /* If negative, set the sign bit. */ - if (dfrom < 0) - { - put_field (uto, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1, 1); - dfrom = -dfrom; - } - - /* How to tell an infinity from an ordinary number? FIXME-someday */ - - mant = frexp (dfrom, &exponent); - put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start, fmt->exp_len, - exponent + fmt->exp_bias - 1); - - mant_bits_left = fmt->man_len; - mant_off = fmt->man_start; - while (mant_bits_left > 0) - { - unsigned long mant_long; - mant_bits = mant_bits_left < 32 ? mant_bits_left : 32; - - mant *= 4294967296.0; - mant_long = (unsigned long)mant; - mant -= mant_long; - - /* If the integer bit is implicit, then we need to discard it. - If we are discarding a zero, we should be (but are not) creating - a denormalized number which means adjusting the exponent - (I think). */ - if (mant_bits_left == fmt->man_len - && fmt->intbit == floatformat_intbit_no) - { - mant_long &= 0x7fffffff; - mant_bits -= 1; - } - else if (mant_bits < 32) - { - /* The bits we want are in the most significant MANT_BITS bits of - mant_long. Move them to the least significant. */ - mant_long >>= 32 - mant_bits; - } - - put_field (uto, fmt->byteorder, fmt->totalsize, - mant_off, mant_bits, mant_long); - mant_off += mant_bits; - mant_bits_left -= mant_bits; - } -} - - -#ifdef IEEE_DEBUG - -/* This is to be run on a host which uses IEEE floating point. */ - -void -ieee_test (n) - double n; -{ - double result; - char exten[16]; - - floatformat_to_double (&floatformat_ieee_double_big, &n, &result); - if (n != result) - printf ("Differ(to): %.20g -> %.20g\n", n, result); - floatformat_from_double (&floatformat_ieee_double_big, &n, &result); - if (n != result) - printf ("Differ(from): %.20g -> %.20g\n", n, result); - - floatformat_from_double (&floatformat_m68881_ext, &n, exten); - floatformat_to_double (&floatformat_m68881_ext, exten, &result); - if (n != result) - printf ("Differ(to+from): %.20g -> %.20g\n", n, result); - -#if IEEE_DEBUG > 1 - /* This is to be run on a host which uses 68881 format. */ - { - long double ex = *(long double *)exten; - if (ex != n) - printf ("Differ(from vs. extended): %.20g\n", n); - } -#endif -} - -int -main () -{ - ieee_test (0.5); - ieee_test (256.0); - ieee_test (0.12345); - ieee_test (234235.78907234); - ieee_test (-512.0); - ieee_test (-0.004321); - return 0; -} -#endif diff --git a/cxmon/src/disass/floatformat.h b/cxmon/src/disass/floatformat.h deleted file mode 100644 index 90daca21..00000000 --- a/cxmon/src/disass/floatformat.h +++ /dev/null @@ -1,111 +0,0 @@ -/* IEEE floating point support declarations, for GDB, the GNU Debugger. - Copyright (C) 1991 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#if !defined (FLOATFORMAT_H) -#define FLOATFORMAT_H 1 - -#include "ansidecl.h" - -/* A floatformat consists of a sign bit, an exponent and a mantissa. Once the - bytes are concatenated according to the byteorder flag, then each of those - fields is contiguous. We number the bits with 0 being the most significant - (i.e. BITS_BIG_ENDIAN type numbering), and specify which bits each field - contains with the *_start and *_len fields. */ - -/* What is the order of the bytes. */ - -enum floatformat_byteorders { - - /* Standard little endian byte order. - EX: 1.2345678e10 => 00 00 80 c5 e0 fe 06 42 */ - - floatformat_little, - - /* Standard big endian byte order. - EX: 1.2345678e10 => 42 06 fe e0 c5 80 00 00 */ - - floatformat_big, - - /* Little endian byte order but big endian word order. - EX: 1.2345678e10 => e0 fe 06 42 00 00 80 c5 */ - - floatformat_littlebyte_bigword - -}; - -enum floatformat_intbit { floatformat_intbit_yes, floatformat_intbit_no }; - -struct floatformat -{ - enum floatformat_byteorders byteorder; - unsigned int totalsize; /* Total size of number in bits */ - - /* Sign bit is always one bit long. 1 means negative, 0 means positive. */ - unsigned int sign_start; - - unsigned int exp_start; - unsigned int exp_len; - /* Amount added to "true" exponent. 0x3fff for many IEEE extendeds. */ - unsigned int exp_bias; - /* Exponent value which indicates NaN. This is the actual value stored in - the float, not adjusted by the exp_bias. This usually consists of all - one bits. */ - unsigned int exp_nan; - - unsigned int man_start; - unsigned int man_len; - - /* Is the integer bit explicit or implicit? */ - enum floatformat_intbit intbit; -}; - -/* floatformats for IEEE single and double, big and little endian. */ - -extern const struct floatformat floatformat_ieee_single_big; -extern const struct floatformat floatformat_ieee_single_little; -extern const struct floatformat floatformat_ieee_double_big; -extern const struct floatformat floatformat_ieee_double_little; - -/* floatformat for ARM IEEE double, little endian bytes and big endian words */ - -extern const struct floatformat floatformat_ieee_double_littlebyte_bigword; - -/* floatformats for various extendeds. */ - -extern const struct floatformat floatformat_i387_ext; -extern const struct floatformat floatformat_m68881_ext; -extern const struct floatformat floatformat_i960_ext; -extern const struct floatformat floatformat_m88110_ext; -extern const struct floatformat floatformat_arm_ext; - -/* Convert from FMT to a double. - FROM is the address of the extended float. - Store the double in *TO. */ - -extern void -floatformat_to_double PARAMS ((const struct floatformat *, char *, double *)); - -/* The converse: convert the double *FROM to FMT - and store where TO points. */ - -extern void -floatformat_from_double PARAMS ((const struct floatformat *, - double *, char *)); - -#endif /* defined (FLOATFORMAT_H) */ diff --git a/cxmon/src/disass/i386-dis.c b/cxmon/src/disass/i386-dis.c deleted file mode 100644 index e417212e..00000000 --- a/cxmon/src/disass/i386-dis.c +++ /dev/null @@ -1,4146 +0,0 @@ -/* Print i386 instructions for GDB, the GNU debugger. - Copyright 1988, 1989, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2001 - Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* - * 80386 instruction printer by Pace Willisson (pace@prep.ai.mit.edu) - * July 1988 - * modified by John Hassey (hassey@dg-rtp.dg.com) - * x86-64 support added by Jan Hubicka (jh@suse.cz) - */ - -/* - * The main tables describing the instructions is essentially a copy - * of the "Opcode Map" chapter (Appendix A) of the Intel 80386 - * Programmers Manual. Usually, there is a capital letter, followed - * by a small letter. The capital letter tell the addressing mode, - * and the small letter tells about the operand size. Refer to - * the Intel manual for details. - */ - -#include "dis-asm.h" -#include "opintl.h" - -#define MAXLEN 20 - -#include - -#ifndef UNIXWARE_COMPAT -/* Set non-zero for broken, compatible instructions. Set to zero for - non-broken opcodes. */ -#define UNIXWARE_COMPAT 1 -#endif - -static int fetch_data PARAMS ((struct disassemble_info *, bfd_byte *)); -static void ckprefix PARAMS ((void)); -static const char *prefix_name PARAMS ((int, int)); -static int print_insn PARAMS ((bfd_vma, disassemble_info *)); -static void dofloat PARAMS ((int)); -static void OP_ST PARAMS ((int, int)); -static void OP_STi PARAMS ((int, int)); -static int putop PARAMS ((const char *, int)); -static void oappend PARAMS ((const char *)); -static void append_seg PARAMS ((void)); -static void OP_indirE PARAMS ((int, int)); -static void print_operand_value PARAMS ((char *, int, bfd_vma)); -static void OP_E PARAMS ((int, int)); -static void OP_G PARAMS ((int, int)); -static bfd_vma get64 PARAMS ((void)); -static bfd_signed_vma get32 PARAMS ((void)); -static bfd_signed_vma get32s PARAMS ((void)); -static int get16 PARAMS ((void)); -static void set_op PARAMS ((bfd_vma, int)); -static void OP_REG PARAMS ((int, int)); -static void OP_IMREG PARAMS ((int, int)); -static void OP_I PARAMS ((int, int)); -static void OP_I64 PARAMS ((int, int)); -static void OP_sI PARAMS ((int, int)); -static void OP_J PARAMS ((int, int)); -static void OP_SEG PARAMS ((int, int)); -static void OP_DIR PARAMS ((int, int)); -static void OP_OFF PARAMS ((int, int)); -static void OP_OFF64 PARAMS ((int, int)); -static void ptr_reg PARAMS ((int, int)); -static void OP_ESreg PARAMS ((int, int)); -static void OP_DSreg PARAMS ((int, int)); -static void OP_C PARAMS ((int, int)); -static void OP_D PARAMS ((int, int)); -static void OP_T PARAMS ((int, int)); -static void OP_Rd PARAMS ((int, int)); -static void OP_MMX PARAMS ((int, int)); -static void OP_XMM PARAMS ((int, int)); -static void OP_EM PARAMS ((int, int)); -static void OP_EX PARAMS ((int, int)); -static void OP_MS PARAMS ((int, int)); -static void OP_XS PARAMS ((int, int)); -static void OP_3DNowSuffix PARAMS ((int, int)); -static void OP_SIMD_Suffix PARAMS ((int, int)); -static void SIMD_Fixup PARAMS ((int, int)); -static void BadOp PARAMS ((void)); - -struct dis_private { - /* Points to first byte not fetched. */ - bfd_byte *max_fetched; - bfd_byte the_buffer[MAXLEN]; - bfd_vma insn_start; - int orig_sizeflag; - jmp_buf bailout; -}; - -/* The opcode for the fwait instruction, which we treat as a prefix - when we can. */ -#define FWAIT_OPCODE (0x9b) - -/* Set to 1 for 64bit mode disassembly. */ -static int mode_64bit; - -/* Flags for the prefixes for the current instruction. See below. */ -static int prefixes; - -/* REX prefix the current instruction. See below. */ -static int rex; -/* Bits of REX we've already used. */ -static int rex_used; -#define REX_MODE64 8 -#define REX_EXTX 4 -#define REX_EXTY 2 -#define REX_EXTZ 1 -/* Mark parts used in the REX prefix. When we are testing for - empty prefix (for 8bit register REX extension), just mask it - out. Otherwise test for REX bit is excuse for existence of REX - only in case value is nonzero. */ -#define USED_REX(value) \ - { \ - if (value) \ - rex_used |= (rex & value) ? (value) | 0x40 : 0; \ - else \ - rex_used |= 0x40; \ - } - -/* Flags for prefixes which we somehow handled when printing the - current instruction. */ -static int used_prefixes; - -/* Flags stored in PREFIXES. */ -#define PREFIX_REPZ 1 -#define PREFIX_REPNZ 2 -#define PREFIX_LOCK 4 -#define PREFIX_CS 8 -#define PREFIX_SS 0x10 -#define PREFIX_DS 0x20 -#define PREFIX_ES 0x40 -#define PREFIX_FS 0x80 -#define PREFIX_GS 0x100 -#define PREFIX_DATA 0x200 -#define PREFIX_ADDR 0x400 -#define PREFIX_FWAIT 0x800 - -/* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive) - to ADDR (exclusive) are valid. Returns 1 for success, longjmps - on error. */ -#define FETCH_DATA(info, addr) \ - ((addr) <= ((struct dis_private *) (info->private_data))->max_fetched \ - ? 1 : fetch_data ((info), (addr))) - -static int -fetch_data (info, addr) - struct disassemble_info *info; - bfd_byte *addr; -{ - int status; - struct dis_private *priv = (struct dis_private *) info->private_data; - bfd_vma start = priv->insn_start + (priv->max_fetched - priv->the_buffer); - - status = (*info->read_memory_func) (start, - priv->max_fetched, - addr - priv->max_fetched, - info); - if (status != 0) - { - /* If we did manage to read at least one byte, then - print_insn_i386 will do something sensible. Otherwise, print - an error. We do that here because this is where we know - STATUS. */ - if (priv->max_fetched == priv->the_buffer) - (*info->memory_error_func) (status, start, info); - longjmp (priv->bailout, 1); - } - else - priv->max_fetched = addr; - return 1; -} - -#define XX NULL, 0 - -#define Eb OP_E, b_mode -#define Ev OP_E, v_mode -#define Ed OP_E, d_mode -#define Edq OP_E, dq_mode -#define indirEb OP_indirE, b_mode -#define indirEv OP_indirE, v_mode -#define Ew OP_E, w_mode -#define Ma OP_E, v_mode -#define M OP_E, 0 /* lea, lgdt, etc. */ -#define Mp OP_E, 0 /* 32 or 48 bit memory operand for LDS, LES etc */ -#define Gb OP_G, b_mode -#define Gv OP_G, v_mode -#define Gd OP_G, d_mode -#define Gw OP_G, w_mode -#define Rd OP_Rd, d_mode -#define Rm OP_Rd, m_mode -#define Ib OP_I, b_mode -#define sIb OP_sI, b_mode /* sign extened byte */ -#define Iv OP_I, v_mode -#define Iq OP_I, q_mode -#define Iv64 OP_I64, v_mode -#define Iw OP_I, w_mode -#define Jb OP_J, b_mode -#define Jv OP_J, v_mode -#define Cm OP_C, m_mode -#define Dm OP_D, m_mode -#define Td OP_T, d_mode - -#define RMeAX OP_REG, eAX_reg -#define RMeBX OP_REG, eBX_reg -#define RMeCX OP_REG, eCX_reg -#define RMeDX OP_REG, eDX_reg -#define RMeSP OP_REG, eSP_reg -#define RMeBP OP_REG, eBP_reg -#define RMeSI OP_REG, eSI_reg -#define RMeDI OP_REG, eDI_reg -#define RMrAX OP_REG, rAX_reg -#define RMrBX OP_REG, rBX_reg -#define RMrCX OP_REG, rCX_reg -#define RMrDX OP_REG, rDX_reg -#define RMrSP OP_REG, rSP_reg -#define RMrBP OP_REG, rBP_reg -#define RMrSI OP_REG, rSI_reg -#define RMrDI OP_REG, rDI_reg -#define RMAL OP_REG, al_reg -#define RMAL OP_REG, al_reg -#define RMCL OP_REG, cl_reg -#define RMDL OP_REG, dl_reg -#define RMBL OP_REG, bl_reg -#define RMAH OP_REG, ah_reg -#define RMCH OP_REG, ch_reg -#define RMDH OP_REG, dh_reg -#define RMBH OP_REG, bh_reg -#define RMAX OP_REG, ax_reg -#define RMDX OP_REG, dx_reg - -#define eAX OP_IMREG, eAX_reg -#define eBX OP_IMREG, eBX_reg -#define eCX OP_IMREG, eCX_reg -#define eDX OP_IMREG, eDX_reg -#define eSP OP_IMREG, eSP_reg -#define eBP OP_IMREG, eBP_reg -#define eSI OP_IMREG, eSI_reg -#define eDI OP_IMREG, eDI_reg -#define AL OP_IMREG, al_reg -#define AL OP_IMREG, al_reg -#define CL OP_IMREG, cl_reg -#define DL OP_IMREG, dl_reg -#define BL OP_IMREG, bl_reg -#define AH OP_IMREG, ah_reg -#define CH OP_IMREG, ch_reg -#define DH OP_IMREG, dh_reg -#define BH OP_IMREG, bh_reg -#define AX OP_IMREG, ax_reg -#define DX OP_IMREG, dx_reg -#define indirDX OP_IMREG, indir_dx_reg - -#define Sw OP_SEG, w_mode -#define Ap OP_DIR, 0 -#define Ob OP_OFF, b_mode -#define Ob64 OP_OFF64, b_mode -#define Ov OP_OFF, v_mode -#define Ov64 OP_OFF64, v_mode -#define Xb OP_DSreg, eSI_reg -#define Xv OP_DSreg, eSI_reg -#define Yb OP_ESreg, eDI_reg -#define Yv OP_ESreg, eDI_reg -#define DSBX OP_DSreg, eBX_reg - -#define es OP_REG, es_reg -#define ss OP_REG, ss_reg -#define cs OP_REG, cs_reg -#define ds OP_REG, ds_reg -#define fs OP_REG, fs_reg -#define gs OP_REG, gs_reg - -#define MX OP_MMX, 0 -#define XM OP_XMM, 0 -#define EM OP_EM, v_mode -#define EX OP_EX, v_mode -#define MS OP_MS, v_mode -#define XS OP_XS, v_mode -#define None OP_E, 0 -#define OPSUF OP_3DNowSuffix, 0 -#define OPSIMD OP_SIMD_Suffix, 0 - -#define cond_jump_flag NULL, cond_jump_mode -#define loop_jcxz_flag NULL, loop_jcxz_mode - -/* bits in sizeflag */ -#define SUFFIX_ALWAYS 4 -#define AFLAG 2 -#define DFLAG 1 - -#define b_mode 1 /* byte operand */ -#define v_mode 2 /* operand size depends on prefixes */ -#define w_mode 3 /* word operand */ -#define d_mode 4 /* double word operand */ -#define q_mode 5 /* quad word operand */ -#define x_mode 6 -#define m_mode 7 /* d_mode in 32bit, q_mode in 64bit mode. */ -#define cond_jump_mode 8 -#define loop_jcxz_mode 9 -#define dq_mode 10 /* operand size depends on REX prefixes. */ - -#define es_reg 100 -#define cs_reg 101 -#define ss_reg 102 -#define ds_reg 103 -#define fs_reg 104 -#define gs_reg 105 - -#define eAX_reg 108 -#define eCX_reg 109 -#define eDX_reg 110 -#define eBX_reg 111 -#define eSP_reg 112 -#define eBP_reg 113 -#define eSI_reg 114 -#define eDI_reg 115 - -#define al_reg 116 -#define cl_reg 117 -#define dl_reg 118 -#define bl_reg 119 -#define ah_reg 120 -#define ch_reg 121 -#define dh_reg 122 -#define bh_reg 123 - -#define ax_reg 124 -#define cx_reg 125 -#define dx_reg 126 -#define bx_reg 127 -#define sp_reg 128 -#define bp_reg 129 -#define si_reg 130 -#define di_reg 131 - -#define rAX_reg 132 -#define rCX_reg 133 -#define rDX_reg 134 -#define rBX_reg 135 -#define rSP_reg 136 -#define rBP_reg 137 -#define rSI_reg 138 -#define rDI_reg 139 - -#define indir_dx_reg 150 - -#define FLOATCODE 1 -#define USE_GROUPS 2 -#define USE_PREFIX_USER_TABLE 3 -#define X86_64_SPECIAL 4 - -#define FLOAT NULL, NULL, FLOATCODE, NULL, 0, NULL, 0 - -#define GRP1b NULL, NULL, USE_GROUPS, NULL, 0, NULL, 0 -#define GRP1S NULL, NULL, USE_GROUPS, NULL, 1, NULL, 0 -#define GRP1Ss NULL, NULL, USE_GROUPS, NULL, 2, NULL, 0 -#define GRP2b NULL, NULL, USE_GROUPS, NULL, 3, NULL, 0 -#define GRP2S NULL, NULL, USE_GROUPS, NULL, 4, NULL, 0 -#define GRP2b_one NULL, NULL, USE_GROUPS, NULL, 5, NULL, 0 -#define GRP2S_one NULL, NULL, USE_GROUPS, NULL, 6, NULL, 0 -#define GRP2b_cl NULL, NULL, USE_GROUPS, NULL, 7, NULL, 0 -#define GRP2S_cl NULL, NULL, USE_GROUPS, NULL, 8, NULL, 0 -#define GRP3b NULL, NULL, USE_GROUPS, NULL, 9, NULL, 0 -#define GRP3S NULL, NULL, USE_GROUPS, NULL, 10, NULL, 0 -#define GRP4 NULL, NULL, USE_GROUPS, NULL, 11, NULL, 0 -#define GRP5 NULL, NULL, USE_GROUPS, NULL, 12, NULL, 0 -#define GRP6 NULL, NULL, USE_GROUPS, NULL, 13, NULL, 0 -#define GRP7 NULL, NULL, USE_GROUPS, NULL, 14, NULL, 0 -#define GRP8 NULL, NULL, USE_GROUPS, NULL, 15, NULL, 0 -#define GRP9 NULL, NULL, USE_GROUPS, NULL, 16, NULL, 0 -#define GRP10 NULL, NULL, USE_GROUPS, NULL, 17, NULL, 0 -#define GRP11 NULL, NULL, USE_GROUPS, NULL, 18, NULL, 0 -#define GRP12 NULL, NULL, USE_GROUPS, NULL, 19, NULL, 0 -#define GRP13 NULL, NULL, USE_GROUPS, NULL, 20, NULL, 0 -#define GRP14 NULL, NULL, USE_GROUPS, NULL, 21, NULL, 0 -#define GRPAMD NULL, NULL, USE_GROUPS, NULL, 22, NULL, 0 - -#define PREGRP0 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 0, NULL, 0 -#define PREGRP1 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 1, NULL, 0 -#define PREGRP2 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 2, NULL, 0 -#define PREGRP3 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 3, NULL, 0 -#define PREGRP4 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 4, NULL, 0 -#define PREGRP5 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 5, NULL, 0 -#define PREGRP6 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 6, NULL, 0 -#define PREGRP7 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 7, NULL, 0 -#define PREGRP8 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 8, NULL, 0 -#define PREGRP9 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 9, NULL, 0 -#define PREGRP10 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 10, NULL, 0 -#define PREGRP11 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 11, NULL, 0 -#define PREGRP12 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 12, NULL, 0 -#define PREGRP13 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 13, NULL, 0 -#define PREGRP14 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 14, NULL, 0 -#define PREGRP15 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 15, NULL, 0 -#define PREGRP16 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 16, NULL, 0 -#define PREGRP17 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 17, NULL, 0 -#define PREGRP18 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 18, NULL, 0 -#define PREGRP19 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 19, NULL, 0 -#define PREGRP20 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 20, NULL, 0 -#define PREGRP21 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 21, NULL, 0 -#define PREGRP22 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 22, NULL, 0 -#define PREGRP23 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 23, NULL, 0 -#define PREGRP24 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 24, NULL, 0 -#define PREGRP25 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 25, NULL, 0 -#define PREGRP26 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 26, NULL, 0 - -#define X86_64_0 NULL, NULL, X86_64_SPECIAL, NULL, 0, NULL, 0 - -typedef void (*op_rtn) PARAMS ((int bytemode, int sizeflag)); - -struct dis386 { - const char *name; - op_rtn op1; - int bytemode1; - op_rtn op2; - int bytemode2; - op_rtn op3; - int bytemode3; -}; - -/* Upper case letters in the instruction names here are macros. - 'A' => print 'b' if no register operands or suffix_always is true - 'B' => print 'b' if suffix_always is true - 'E' => print 'e' if 32-bit form of jcxz - 'F' => print 'w' or 'l' depending on address size prefix (loop insns) - 'H' => print ",pt" or ",pn" branch hint - 'L' => print 'l' if suffix_always is true - 'N' => print 'n' if instruction has no wait "prefix" - 'O' => print 'd', or 'o' - 'P' => print 'w', 'l' or 'q' if instruction has an operand size prefix, - . or suffix_always is true. print 'q' if rex prefix is present. - 'Q' => print 'w', 'l' or 'q' if no register operands or suffix_always - . is true - 'R' => print 'w', 'l' or 'q' ("wd" or "dq" in intel mode) - 'S' => print 'w', 'l' or 'q' if suffix_always is true - 'T' => print 'q' in 64bit mode and behave as 'P' otherwise - 'U' => print 'q' in 64bit mode and behave as 'Q' otherwise - 'X' => print 's', 'd' depending on data16 prefix (for XMM) - 'W' => print 'b' or 'w' ("w" or "de" in intel mode) - 'Y' => 'q' if instruction has an REX 64bit overwrite prefix - - Many of the above letters print nothing in Intel mode. See "putop" - for the details. - - Braces '{' and '}', and vertical bars '|', indicate alternative - mnemonic strings for AT&T, Intel, X86_64 AT&T, and X86_64 Intel - modes. In cases where there are only two alternatives, the X86_64 - instruction is reserved, and "(bad)" is printed. -*/ - -static const struct dis386 dis386[] = { - /* 00 */ - { "addB", Eb, Gb, XX }, - { "addS", Ev, Gv, XX }, - { "addB", Gb, Eb, XX }, - { "addS", Gv, Ev, XX }, - { "addB", AL, Ib, XX }, - { "addS", eAX, Iv, XX }, - { "push{T|}", es, XX, XX }, - { "pop{T|}", es, XX, XX }, - /* 08 */ - { "orB", Eb, Gb, XX }, - { "orS", Ev, Gv, XX }, - { "orB", Gb, Eb, XX }, - { "orS", Gv, Ev, XX }, - { "orB", AL, Ib, XX }, - { "orS", eAX, Iv, XX }, - { "push{T|}", cs, XX, XX }, - { "(bad)", XX, XX, XX }, /* 0x0f extended opcode escape */ - /* 10 */ - { "adcB", Eb, Gb, XX }, - { "adcS", Ev, Gv, XX }, - { "adcB", Gb, Eb, XX }, - { "adcS", Gv, Ev, XX }, - { "adcB", AL, Ib, XX }, - { "adcS", eAX, Iv, XX }, - { "push{T|}", ss, XX, XX }, - { "popT|}", ss, XX, XX }, - /* 18 */ - { "sbbB", Eb, Gb, XX }, - { "sbbS", Ev, Gv, XX }, - { "sbbB", Gb, Eb, XX }, - { "sbbS", Gv, Ev, XX }, - { "sbbB", AL, Ib, XX }, - { "sbbS", eAX, Iv, XX }, - { "push{T|}", ds, XX, XX }, - { "pop{T|}", ds, XX, XX }, - /* 20 */ - { "andB", Eb, Gb, XX }, - { "andS", Ev, Gv, XX }, - { "andB", Gb, Eb, XX }, - { "andS", Gv, Ev, XX }, - { "andB", AL, Ib, XX }, - { "andS", eAX, Iv, XX }, - { "(bad)", XX, XX, XX }, /* SEG ES prefix */ - { "daa{|}", XX, XX, XX }, - /* 28 */ - { "subB", Eb, Gb, XX }, - { "subS", Ev, Gv, XX }, - { "subB", Gb, Eb, XX }, - { "subS", Gv, Ev, XX }, - { "subB", AL, Ib, XX }, - { "subS", eAX, Iv, XX }, - { "(bad)", XX, XX, XX }, /* SEG CS prefix */ - { "das{|}", XX, XX, XX }, - /* 30 */ - { "xorB", Eb, Gb, XX }, - { "xorS", Ev, Gv, XX }, - { "xorB", Gb, Eb, XX }, - { "xorS", Gv, Ev, XX }, - { "xorB", AL, Ib, XX }, - { "xorS", eAX, Iv, XX }, - { "(bad)", XX, XX, XX }, /* SEG SS prefix */ - { "aaa{|}", XX, XX, XX }, - /* 38 */ - { "cmpB", Eb, Gb, XX }, - { "cmpS", Ev, Gv, XX }, - { "cmpB", Gb, Eb, XX }, - { "cmpS", Gv, Ev, XX }, - { "cmpB", AL, Ib, XX }, - { "cmpS", eAX, Iv, XX }, - { "(bad)", XX, XX, XX }, /* SEG DS prefix */ - { "aas{|}", XX, XX, XX }, - /* 40 */ - { "inc{S|}", RMeAX, XX, XX }, - { "inc{S|}", RMeCX, XX, XX }, - { "inc{S|}", RMeDX, XX, XX }, - { "inc{S|}", RMeBX, XX, XX }, - { "inc{S|}", RMeSP, XX, XX }, - { "inc{S|}", RMeBP, XX, XX }, - { "inc{S|}", RMeSI, XX, XX }, - { "inc{S|}", RMeDI, XX, XX }, - /* 48 */ - { "dec{S|}", RMeAX, XX, XX }, - { "dec{S|}", RMeCX, XX, XX }, - { "dec{S|}", RMeDX, XX, XX }, - { "dec{S|}", RMeBX, XX, XX }, - { "dec{S|}", RMeSP, XX, XX }, - { "dec{S|}", RMeBP, XX, XX }, - { "dec{S|}", RMeSI, XX, XX }, - { "dec{S|}", RMeDI, XX, XX }, - /* 50 */ - { "pushS", RMrAX, XX, XX }, - { "pushS", RMrCX, XX, XX }, - { "pushS", RMrDX, XX, XX }, - { "pushS", RMrBX, XX, XX }, - { "pushS", RMrSP, XX, XX }, - { "pushS", RMrBP, XX, XX }, - { "pushS", RMrSI, XX, XX }, - { "pushS", RMrDI, XX, XX }, - /* 58 */ - { "popS", RMrAX, XX, XX }, - { "popS", RMrCX, XX, XX }, - { "popS", RMrDX, XX, XX }, - { "popS", RMrBX, XX, XX }, - { "popS", RMrSP, XX, XX }, - { "popS", RMrBP, XX, XX }, - { "popS", RMrSI, XX, XX }, - { "popS", RMrDI, XX, XX }, - /* 60 */ - { "pusha{P|}", XX, XX, XX }, - { "popa{P|}", XX, XX, XX }, - { "bound{S|}", Gv, Ma, XX }, - { X86_64_0 }, - { "(bad)", XX, XX, XX }, /* seg fs */ - { "(bad)", XX, XX, XX }, /* seg gs */ - { "(bad)", XX, XX, XX }, /* op size prefix */ - { "(bad)", XX, XX, XX }, /* adr size prefix */ - /* 68 */ - { "pushT", Iq, XX, XX }, - { "imulS", Gv, Ev, Iv }, - { "pushT", sIb, XX, XX }, - { "imulS", Gv, Ev, sIb }, - { "ins{b||b|}", Yb, indirDX, XX }, - { "ins{R||R|}", Yv, indirDX, XX }, - { "outs{b||b|}", indirDX, Xb, XX }, - { "outs{R||R|}", indirDX, Xv, XX }, - /* 70 */ - { "joH", Jb, XX, cond_jump_flag }, - { "jnoH", Jb, XX, cond_jump_flag }, - { "jbH", Jb, XX, cond_jump_flag }, - { "jaeH", Jb, XX, cond_jump_flag }, - { "jeH", Jb, XX, cond_jump_flag }, - { "jneH", Jb, XX, cond_jump_flag }, - { "jbeH", Jb, XX, cond_jump_flag }, - { "jaH", Jb, XX, cond_jump_flag }, - /* 78 */ - { "jsH", Jb, XX, cond_jump_flag }, - { "jnsH", Jb, XX, cond_jump_flag }, - { "jpH", Jb, XX, cond_jump_flag }, - { "jnpH", Jb, XX, cond_jump_flag }, - { "jlH", Jb, XX, cond_jump_flag }, - { "jgeH", Jb, XX, cond_jump_flag }, - { "jleH", Jb, XX, cond_jump_flag }, - { "jgH", Jb, XX, cond_jump_flag }, - /* 80 */ - { GRP1b }, - { GRP1S }, - { "(bad)", XX, XX, XX }, - { GRP1Ss }, - { "testB", Eb, Gb, XX }, - { "testS", Ev, Gv, XX }, - { "xchgB", Eb, Gb, XX }, - { "xchgS", Ev, Gv, XX }, - /* 88 */ - { "movB", Eb, Gb, XX }, - { "movS", Ev, Gv, XX }, - { "movB", Gb, Eb, XX }, - { "movS", Gv, Ev, XX }, - { "movQ", Ev, Sw, XX }, - { "leaS", Gv, M, XX }, - { "movQ", Sw, Ev, XX }, - { "popU", Ev, XX, XX }, - /* 90 */ - { "nop", XX, XX, XX }, - /* FIXME: NOP with REPz prefix is called PAUSE. */ - { "xchgS", RMeCX, eAX, XX }, - { "xchgS", RMeDX, eAX, XX }, - { "xchgS", RMeBX, eAX, XX }, - { "xchgS", RMeSP, eAX, XX }, - { "xchgS", RMeBP, eAX, XX }, - { "xchgS", RMeSI, eAX, XX }, - { "xchgS", RMeDI, eAX, XX }, - /* 98 */ - { "cW{tR||tR|}", XX, XX, XX }, - { "cR{tO||tO|}", XX, XX, XX }, - { "lcall{T|}", Ap, XX, XX }, - { "(bad)", XX, XX, XX }, /* fwait */ - { "pushfT", XX, XX, XX }, - { "popfT", XX, XX, XX }, - { "sahf{|}", XX, XX, XX }, - { "lahf{|}", XX, XX, XX }, - /* a0 */ - { "movB", AL, Ob64, XX }, - { "movS", eAX, Ov64, XX }, - { "movB", Ob64, AL, XX }, - { "movS", Ov64, eAX, XX }, - { "movs{b||b|}", Yb, Xb, XX }, - { "movs{R||R|}", Yv, Xv, XX }, - { "cmps{b||b|}", Xb, Yb, XX }, - { "cmps{R||R|}", Xv, Yv, XX }, - /* a8 */ - { "testB", AL, Ib, XX }, - { "testS", eAX, Iv, XX }, - { "stosB", Yb, AL, XX }, - { "stosS", Yv, eAX, XX }, - { "lodsB", AL, Xb, XX }, - { "lodsS", eAX, Xv, XX }, - { "scasB", AL, Yb, XX }, - { "scasS", eAX, Yv, XX }, - /* b0 */ - { "movB", RMAL, Ib, XX }, - { "movB", RMCL, Ib, XX }, - { "movB", RMDL, Ib, XX }, - { "movB", RMBL, Ib, XX }, - { "movB", RMAH, Ib, XX }, - { "movB", RMCH, Ib, XX }, - { "movB", RMDH, Ib, XX }, - { "movB", RMBH, Ib, XX }, - /* b8 */ - { "movS", RMeAX, Iv64, XX }, - { "movS", RMeCX, Iv64, XX }, - { "movS", RMeDX, Iv64, XX }, - { "movS", RMeBX, Iv64, XX }, - { "movS", RMeSP, Iv64, XX }, - { "movS", RMeBP, Iv64, XX }, - { "movS", RMeSI, Iv64, XX }, - { "movS", RMeDI, Iv64, XX }, - /* c0 */ - { GRP2b }, - { GRP2S }, - { "retT", Iw, XX, XX }, - { "retT", XX, XX, XX }, - { "les{S|}", Gv, Mp, XX }, - { "ldsS", Gv, Mp, XX }, - { "movA", Eb, Ib, XX }, - { "movQ", Ev, Iv, XX }, - /* c8 */ - { "enterT", Iw, Ib, XX }, - { "leaveT", XX, XX, XX }, - { "lretP", Iw, XX, XX }, - { "lretP", XX, XX, XX }, - { "int3", XX, XX, XX }, - { "int", Ib, XX, XX }, - { "into{|}", XX, XX, XX }, - { "iretP", XX, XX, XX }, - /* d0 */ - { GRP2b_one }, - { GRP2S_one }, - { GRP2b_cl }, - { GRP2S_cl }, - { "aam{|}", sIb, XX, XX }, - { "aad{|}", sIb, XX, XX }, - { "(bad)", XX, XX, XX }, - { "xlat", DSBX, XX, XX }, - /* d8 */ - { FLOAT }, - { FLOAT }, - { FLOAT }, - { FLOAT }, - { FLOAT }, - { FLOAT }, - { FLOAT }, - { FLOAT }, - /* e0 */ - { "loopneFH", Jb, XX, loop_jcxz_flag }, - { "loopeFH", Jb, XX, loop_jcxz_flag }, - { "loopFH", Jb, XX, loop_jcxz_flag }, - { "jEcxzH", Jb, XX, loop_jcxz_flag }, - { "inB", AL, Ib, XX }, - { "inS", eAX, Ib, XX }, - { "outB", Ib, AL, XX }, - { "outS", Ib, eAX, XX }, - /* e8 */ - { "callT", Jv, XX, XX }, - { "jmpT", Jv, XX, XX }, - { "ljmp{T|}", Ap, XX, XX }, - { "jmp", Jb, XX, XX }, - { "inB", AL, indirDX, XX }, - { "inS", eAX, indirDX, XX }, - { "outB", indirDX, AL, XX }, - { "outS", indirDX, eAX, XX }, - /* f0 */ - { "(bad)", XX, XX, XX }, /* lock prefix */ - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, /* repne */ - { "(bad)", XX, XX, XX }, /* repz */ - { "hlt", XX, XX, XX }, - { "cmc", XX, XX, XX }, - { GRP3b }, - { GRP3S }, - /* f8 */ - { "clc", XX, XX, XX }, - { "stc", XX, XX, XX }, - { "cli", XX, XX, XX }, - { "sti", XX, XX, XX }, - { "cld", XX, XX, XX }, - { "std", XX, XX, XX }, - { GRP4 }, - { GRP5 }, -}; - -static const struct dis386 dis386_twobyte[] = { - /* 00 */ - { GRP6 }, - { GRP7 }, - { "larS", Gv, Ew, XX }, - { "lslS", Gv, Ew, XX }, - { "(bad)", XX, XX, XX }, - { "syscall", XX, XX, XX }, - { "clts", XX, XX, XX }, - { "sysretP", XX, XX, XX }, - /* 08 */ - { "invd", XX, XX, XX }, - { "wbinvd", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "ud2a", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { GRPAMD }, - { "femms", XX, XX, XX }, - { "", MX, EM, OPSUF }, /* See OP_3DNowSuffix. */ - /* 10 */ - { PREGRP8 }, - { PREGRP9 }, - { "movlpX", XM, EX, SIMD_Fixup, 'h' }, /* really only 2 operands */ - { "movlpX", EX, XM, SIMD_Fixup, 'h' }, - { "unpcklpX", XM, EX, XX }, - { "unpckhpX", XM, EX, XX }, - { "movhpX", XM, EX, SIMD_Fixup, 'l' }, - { "movhpX", EX, XM, SIMD_Fixup, 'l' }, - /* 18 */ - { GRP14 }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - /* 20 */ - { "movL", Rm, Cm, XX }, - { "movL", Rm, Dm, XX }, - { "movL", Cm, Rm, XX }, - { "movL", Dm, Rm, XX }, - { "movL", Rd, Td, XX }, - { "(bad)", XX, XX, XX }, - { "movL", Td, Rd, XX }, - { "(bad)", XX, XX, XX }, - /* 28 */ - { "movapX", XM, EX, XX }, - { "movapX", EX, XM, XX }, - { PREGRP2 }, - { "movntpX", Ev, XM, XX }, - { PREGRP4 }, - { PREGRP3 }, - { "ucomisX", XM,EX, XX }, - { "comisX", XM,EX, XX }, - /* 30 */ - { "wrmsr", XX, XX, XX }, - { "rdtsc", XX, XX, XX }, - { "rdmsr", XX, XX, XX }, - { "rdpmc", XX, XX, XX }, - { "sysenter", XX, XX, XX }, - { "sysexit", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - /* 38 */ - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - /* 40 */ - { "cmovo", Gv, Ev, XX }, - { "cmovno", Gv, Ev, XX }, - { "cmovb", Gv, Ev, XX }, - { "cmovae", Gv, Ev, XX }, - { "cmove", Gv, Ev, XX }, - { "cmovne", Gv, Ev, XX }, - { "cmovbe", Gv, Ev, XX }, - { "cmova", Gv, Ev, XX }, - /* 48 */ - { "cmovs", Gv, Ev, XX }, - { "cmovns", Gv, Ev, XX }, - { "cmovp", Gv, Ev, XX }, - { "cmovnp", Gv, Ev, XX }, - { "cmovl", Gv, Ev, XX }, - { "cmovge", Gv, Ev, XX }, - { "cmovle", Gv, Ev, XX }, - { "cmovg", Gv, Ev, XX }, - /* 50 */ - { "movmskpX", Gd, XS, XX }, - { PREGRP13 }, - { PREGRP12 }, - { PREGRP11 }, - { "andpX", XM, EX, XX }, - { "andnpX", XM, EX, XX }, - { "orpX", XM, EX, XX }, - { "xorpX", XM, EX, XX }, - /* 58 */ - { PREGRP0 }, - { PREGRP10 }, - { PREGRP17 }, - { PREGRP16 }, - { PREGRP14 }, - { PREGRP7 }, - { PREGRP5 }, - { PREGRP6 }, - /* 60 */ - { "punpcklbw", MX, EM, XX }, - { "punpcklwd", MX, EM, XX }, - { "punpckldq", MX, EM, XX }, - { "packsswb", MX, EM, XX }, - { "pcmpgtb", MX, EM, XX }, - { "pcmpgtw", MX, EM, XX }, - { "pcmpgtd", MX, EM, XX }, - { "packuswb", MX, EM, XX }, - /* 68 */ - { "punpckhbw", MX, EM, XX }, - { "punpckhwd", MX, EM, XX }, - { "punpckhdq", MX, EM, XX }, - { "packssdw", MX, EM, XX }, - { PREGRP26 }, - { PREGRP24 }, - { "movd", MX, Edq, XX }, - { PREGRP19 }, - /* 70 */ - { PREGRP22 }, - { GRP10 }, - { GRP11 }, - { GRP12 }, - { "pcmpeqb", MX, EM, XX }, - { "pcmpeqw", MX, EM, XX }, - { "pcmpeqd", MX, EM, XX }, - { "emms", XX, XX, XX }, - /* 78 */ - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { PREGRP23 }, - { PREGRP20 }, - /* 80 */ - { "joH", Jv, XX, cond_jump_flag }, - { "jnoH", Jv, XX, cond_jump_flag }, - { "jbH", Jv, XX, cond_jump_flag }, - { "jaeH", Jv, XX, cond_jump_flag }, - { "jeH", Jv, XX, cond_jump_flag }, - { "jneH", Jv, XX, cond_jump_flag }, - { "jbeH", Jv, XX, cond_jump_flag }, - { "jaH", Jv, XX, cond_jump_flag }, - /* 88 */ - { "jsH", Jv, XX, cond_jump_flag }, - { "jnsH", Jv, XX, cond_jump_flag }, - { "jpH", Jv, XX, cond_jump_flag }, - { "jnpH", Jv, XX, cond_jump_flag }, - { "jlH", Jv, XX, cond_jump_flag }, - { "jgeH", Jv, XX, cond_jump_flag }, - { "jleH", Jv, XX, cond_jump_flag }, - { "jgH", Jv, XX, cond_jump_flag }, - /* 90 */ - { "seto", Eb, XX, XX }, - { "setno", Eb, XX, XX }, - { "setb", Eb, XX, XX }, - { "setae", Eb, XX, XX }, - { "sete", Eb, XX, XX }, - { "setne", Eb, XX, XX }, - { "setbe", Eb, XX, XX }, - { "seta", Eb, XX, XX }, - /* 98 */ - { "sets", Eb, XX, XX }, - { "setns", Eb, XX, XX }, - { "setp", Eb, XX, XX }, - { "setnp", Eb, XX, XX }, - { "setl", Eb, XX, XX }, - { "setge", Eb, XX, XX }, - { "setle", Eb, XX, XX }, - { "setg", Eb, XX, XX }, - /* a0 */ - { "pushT", fs, XX, XX }, - { "popT", fs, XX, XX }, - { "cpuid", XX, XX, XX }, - { "btS", Ev, Gv, XX }, - { "shldS", Ev, Gv, Ib }, - { "shldS", Ev, Gv, CL }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - /* a8 */ - { "pushT", gs, XX, XX }, - { "popT", gs, XX, XX }, - { "rsm", XX, XX, XX }, - { "btsS", Ev, Gv, XX }, - { "shrdS", Ev, Gv, Ib }, - { "shrdS", Ev, Gv, CL }, - { GRP13 }, - { "imulS", Gv, Ev, XX }, - /* b0 */ - { "cmpxchgB", Eb, Gb, XX }, - { "cmpxchgS", Ev, Gv, XX }, - { "lssS", Gv, Mp, XX }, - { "btrS", Ev, Gv, XX }, - { "lfsS", Gv, Mp, XX }, - { "lgsS", Gv, Mp, XX }, - { "movz{bR|x|bR|x}", Gv, Eb, XX }, - { "movz{wR|x|wR|x}", Gv, Ew, XX }, /* yes, there really is movzww ! */ - /* b8 */ - { "(bad)", XX, XX, XX }, - { "ud2b", XX, XX, XX }, - { GRP8 }, - { "btcS", Ev, Gv, XX }, - { "bsfS", Gv, Ev, XX }, - { "bsrS", Gv, Ev, XX }, - { "movs{bR|x|bR|x}", Gv, Eb, XX }, - { "movs{wR|x|wR|x}", Gv, Ew, XX }, /* yes, there really is movsww ! */ - /* c0 */ - { "xaddB", Eb, Gb, XX }, - { "xaddS", Ev, Gv, XX }, - { PREGRP1 }, - { "movntiS", Ev, Gv, XX }, - { "pinsrw", MX, Ed, Ib }, - { "pextrw", Gd, MS, Ib }, - { "shufpX", XM, EX, Ib }, - { GRP9 }, - /* c8 */ - { "bswap", RMeAX, XX, XX }, - { "bswap", RMeCX, XX, XX }, - { "bswap", RMeDX, XX, XX }, - { "bswap", RMeBX, XX, XX }, - { "bswap", RMeSP, XX, XX }, - { "bswap", RMeBP, XX, XX }, - { "bswap", RMeSI, XX, XX }, - { "bswap", RMeDI, XX, XX }, - /* d0 */ - { "(bad)", XX, XX, XX }, - { "psrlw", MX, EM, XX }, - { "psrld", MX, EM, XX }, - { "psrlq", MX, EM, XX }, - { "paddq", MX, EM, XX }, - { "pmullw", MX, EM, XX }, - { PREGRP21 }, - { "pmovmskb", Gd, MS, XX }, - /* d8 */ - { "psubusb", MX, EM, XX }, - { "psubusw", MX, EM, XX }, - { "pminub", MX, EM, XX }, - { "pand", MX, EM, XX }, - { "paddusb", MX, EM, XX }, - { "paddusw", MX, EM, XX }, - { "pmaxub", MX, EM, XX }, - { "pandn", MX, EM, XX }, - /* e0 */ - { "pavgb", MX, EM, XX }, - { "psraw", MX, EM, XX }, - { "psrad", MX, EM, XX }, - { "pavgw", MX, EM, XX }, - { "pmulhuw", MX, EM, XX }, - { "pmulhw", MX, EM, XX }, - { PREGRP15 }, - { PREGRP25 }, - /* e8 */ - { "psubsb", MX, EM, XX }, - { "psubsw", MX, EM, XX }, - { "pminsw", MX, EM, XX }, - { "por", MX, EM, XX }, - { "paddsb", MX, EM, XX }, - { "paddsw", MX, EM, XX }, - { "pmaxsw", MX, EM, XX }, - { "pxor", MX, EM, XX }, - /* f0 */ - { "(bad)", XX, XX, XX }, - { "psllw", MX, EM, XX }, - { "pslld", MX, EM, XX }, - { "psllq", MX, EM, XX }, - { "pmuludq", MX, EM, XX }, - { "pmaddwd", MX, EM, XX }, - { "psadbw", MX, EM, XX }, - { PREGRP18 }, - /* f8 */ - { "psubb", MX, EM, XX }, - { "psubw", MX, EM, XX }, - { "psubd", MX, EM, XX }, - { "psubq", MX, EM, XX }, - { "paddb", MX, EM, XX }, - { "paddw", MX, EM, XX }, - { "paddd", MX, EM, XX }, - { "(bad)", XX, XX, XX } -}; - -static const unsigned char onebyte_has_modrm[256] = { - /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ - /* ------------------------------- */ - /* 00 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 00 */ - /* 10 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 10 */ - /* 20 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 20 */ - /* 30 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 30 */ - /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 40 */ - /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 50 */ - /* 60 */ 0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0, /* 60 */ - /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 70 */ - /* 80 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 80 */ - /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 90 */ - /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* a0 */ - /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* b0 */ - /* c0 */ 1,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0, /* c0 */ - /* d0 */ 1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* d0 */ - /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* e0 */ - /* f0 */ 0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1 /* f0 */ - /* ------------------------------- */ - /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ -}; - -static const unsigned char twobyte_has_modrm[256] = { - /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ - /* ------------------------------- */ - /* 00 */ 1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,1, /* 0f */ - /* 10 */ 1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0, /* 1f */ - /* 20 */ 1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1, /* 2f */ - /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */ - /* 40 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 4f */ - /* 50 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 5f */ - /* 60 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 6f */ - /* 70 */ 1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1, /* 7f */ - /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */ - /* 90 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 9f */ - /* a0 */ 0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1, /* af */ - /* b0 */ 1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1, /* bf */ - /* c0 */ 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, /* cf */ - /* d0 */ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* df */ - /* e0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ef */ - /* f0 */ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 /* ff */ - /* ------------------------------- */ - /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ -}; - -static const unsigned char twobyte_uses_SSE_prefix[256] = { - /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ - /* ------------------------------- */ - /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */ - /* 10 */ 1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1f */ - /* 20 */ 0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0, /* 2f */ - /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */ - /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */ - /* 50 */ 0,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* 5f */ - /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1, /* 6f */ - /* 70 */ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1, /* 7f */ - /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */ - /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */ - /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */ - /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */ - /* c0 */ 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */ - /* d0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* df */ - /* e0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* ef */ - /* f0 */ 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0 /* ff */ - /* ------------------------------- */ - /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ -}; - -static char obuf[100]; -static char *obufp; -static char scratchbuf[100]; -static unsigned char *start_codep; -static unsigned char *insn_codep; -static unsigned char *codep; -static disassemble_info *the_info; -static int mod; -static int rm; -static int reg; -static unsigned char need_modrm; - -/* If we are accessing mod/rm/reg without need_modrm set, then the - values are stale. Hitting this abort likely indicates that you - need to update onebyte_has_modrm or twobyte_has_modrm. */ -#define MODRM_CHECK if (!need_modrm) abort () - -static const char **names64; -static const char **names32; -static const char **names16; -static const char **names8; -static const char **names8rex; -static const char **names_seg; -static const char **index16; - -static const char *intel_names64[] = { - "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi", - "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15" -}; -static const char *intel_names32[] = { - "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi", - "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d" -}; -static const char *intel_names16[] = { - "ax", "cx", "dx", "bx", "sp", "bp", "si", "di", - "r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w" -}; -static const char *intel_names8[] = { - "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh", -}; -static const char *intel_names8rex[] = { - "al", "cl", "dl", "bl", "spl", "bpl", "sil", "dil", - "r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b", "r15b" -}; -static const char *intel_names_seg[] = { - "es", "cs", "ss", "ds", "fs", "gs", "?", "?", -}; -static const char *intel_index16[] = { - "bx+si", "bx+di", "bp+si", "bp+di", "si", "di", "bp", "bx" -}; - -static const char *att_names64[] = { - "%rax", "%rcx", "%rdx", "%rbx", "%rsp", "%rbp", "%rsi", "%rdi", - "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15" -}; -static const char *att_names32[] = { - "%eax", "%ecx", "%edx", "%ebx", "%esp", "%ebp", "%esi", "%edi", - "%r8d", "%r9d", "%r10d", "%r11d", "%r12d", "%r13d", "%r14d", "%r15d" -}; -static const char *att_names16[] = { - "%ax", "%cx", "%dx", "%bx", "%sp", "%bp", "%si", "%di", - "%r8w", "%r9w", "%r10w", "%r11w", "%r12w", "%r13w", "%r14w", "%r15w" -}; -static const char *att_names8[] = { - "%al", "%cl", "%dl", "%bl", "%ah", "%ch", "%dh", "%bh", -}; -static const char *att_names8rex[] = { - "%al", "%cl", "%dl", "%bl", "%spl", "%bpl", "%sil", "%dil", - "%r8b", "%r9b", "%r10b", "%r11b", "%r12b", "%r13b", "%r14b", "%r15b" -}; -static const char *att_names_seg[] = { - "%es", "%cs", "%ss", "%ds", "%fs", "%gs", "%?", "%?", -}; -static const char *att_index16[] = { - "%bx,%si", "%bx,%di", "%bp,%si", "%bp,%di", "%si", "%di", "%bp", "%bx" -}; - -static const struct dis386 grps[][8] = { - /* GRP1b */ - { - { "addA", Eb, Ib, XX }, - { "orA", Eb, Ib, XX }, - { "adcA", Eb, Ib, XX }, - { "sbbA", Eb, Ib, XX }, - { "andA", Eb, Ib, XX }, - { "subA", Eb, Ib, XX }, - { "xorA", Eb, Ib, XX }, - { "cmpA", Eb, Ib, XX } - }, - /* GRP1S */ - { - { "addQ", Ev, Iv, XX }, - { "orQ", Ev, Iv, XX }, - { "adcQ", Ev, Iv, XX }, - { "sbbQ", Ev, Iv, XX }, - { "andQ", Ev, Iv, XX }, - { "subQ", Ev, Iv, XX }, - { "xorQ", Ev, Iv, XX }, - { "cmpQ", Ev, Iv, XX } - }, - /* GRP1Ss */ - { - { "addQ", Ev, sIb, XX }, - { "orQ", Ev, sIb, XX }, - { "adcQ", Ev, sIb, XX }, - { "sbbQ", Ev, sIb, XX }, - { "andQ", Ev, sIb, XX }, - { "subQ", Ev, sIb, XX }, - { "xorQ", Ev, sIb, XX }, - { "cmpQ", Ev, sIb, XX } - }, - /* GRP2b */ - { - { "rolA", Eb, Ib, XX }, - { "rorA", Eb, Ib, XX }, - { "rclA", Eb, Ib, XX }, - { "rcrA", Eb, Ib, XX }, - { "shlA", Eb, Ib, XX }, - { "shrA", Eb, Ib, XX }, - { "(bad)", XX, XX, XX }, - { "sarA", Eb, Ib, XX }, - }, - /* GRP2S */ - { - { "rolQ", Ev, Ib, XX }, - { "rorQ", Ev, Ib, XX }, - { "rclQ", Ev, Ib, XX }, - { "rcrQ", Ev, Ib, XX }, - { "shlQ", Ev, Ib, XX }, - { "shrQ", Ev, Ib, XX }, - { "(bad)", XX, XX, XX }, - { "sarQ", Ev, Ib, XX }, - }, - /* GRP2b_one */ - { - { "rolA", Eb, XX, XX }, - { "rorA", Eb, XX, XX }, - { "rclA", Eb, XX, XX }, - { "rcrA", Eb, XX, XX }, - { "shlA", Eb, XX, XX }, - { "shrA", Eb, XX, XX }, - { "(bad)", XX, XX, XX }, - { "sarA", Eb, XX, XX }, - }, - /* GRP2S_one */ - { - { "rolQ", Ev, XX, XX }, - { "rorQ", Ev, XX, XX }, - { "rclQ", Ev, XX, XX }, - { "rcrQ", Ev, XX, XX }, - { "shlQ", Ev, XX, XX }, - { "shrQ", Ev, XX, XX }, - { "(bad)", XX, XX, XX}, - { "sarQ", Ev, XX, XX }, - }, - /* GRP2b_cl */ - { - { "rolA", Eb, CL, XX }, - { "rorA", Eb, CL, XX }, - { "rclA", Eb, CL, XX }, - { "rcrA", Eb, CL, XX }, - { "shlA", Eb, CL, XX }, - { "shrA", Eb, CL, XX }, - { "(bad)", XX, XX, XX }, - { "sarA", Eb, CL, XX }, - }, - /* GRP2S_cl */ - { - { "rolQ", Ev, CL, XX }, - { "rorQ", Ev, CL, XX }, - { "rclQ", Ev, CL, XX }, - { "rcrQ", Ev, CL, XX }, - { "shlQ", Ev, CL, XX }, - { "shrQ", Ev, CL, XX }, - { "(bad)", XX, XX, XX }, - { "sarQ", Ev, CL, XX } - }, - /* GRP3b */ - { - { "testA", Eb, Ib, XX }, - { "(bad)", Eb, XX, XX }, - { "notA", Eb, XX, XX }, - { "negA", Eb, XX, XX }, - { "mulA", Eb, XX, XX }, /* Don't print the implicit %al register, */ - { "imulA", Eb, XX, XX }, /* to distinguish these opcodes from other */ - { "divA", Eb, XX, XX }, /* mul/imul opcodes. Do the same for div */ - { "idivA", Eb, XX, XX } /* and idiv for consistency. */ - }, - /* GRP3S */ - { - { "testQ", Ev, Iv, XX }, - { "(bad)", XX, XX, XX }, - { "notQ", Ev, XX, XX }, - { "negQ", Ev, XX, XX }, - { "mulQ", Ev, XX, XX }, /* Don't print the implicit register. */ - { "imulQ", Ev, XX, XX }, - { "divQ", Ev, XX, XX }, - { "idivQ", Ev, XX, XX }, - }, - /* GRP4 */ - { - { "incA", Eb, XX, XX }, - { "decA", Eb, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - }, - /* GRP5 */ - { - { "incQ", Ev, XX, XX }, - { "decQ", Ev, XX, XX }, - { "callT", indirEv, XX, XX }, - { "lcallT", indirEv, XX, XX }, - { "jmpT", indirEv, XX, XX }, - { "ljmpT", indirEv, XX, XX }, - { "pushU", Ev, XX, XX }, - { "(bad)", XX, XX, XX }, - }, - /* GRP6 */ - { - { "sldtQ", Ev, XX, XX }, - { "strQ", Ev, XX, XX }, - { "lldt", Ew, XX, XX }, - { "ltr", Ew, XX, XX }, - { "verr", Ew, XX, XX }, - { "verw", Ew, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX } - }, - /* GRP7 */ - { - { "sgdtQ", M, XX, XX }, - { "sidtQ", M, XX, XX }, - { "lgdtQ", M, XX, XX }, - { "lidtQ", M, XX, XX }, - { "smswQ", Ev, XX, XX }, - { "(bad)", XX, XX, XX }, - { "lmsw", Ew, XX, XX }, - { "invlpg", Ew, XX, XX }, - }, - /* GRP8 */ - { - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "btQ", Ev, Ib, XX }, - { "btsQ", Ev, Ib, XX }, - { "btrQ", Ev, Ib, XX }, - { "btcQ", Ev, Ib, XX }, - }, - /* GRP9 */ - { - { "(bad)", XX, XX, XX }, - { "cmpxchg8b", Ev, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - }, - /* GRP10 */ - { - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "psrlw", MS, Ib, XX }, - { "(bad)", XX, XX, XX }, - { "psraw", MS, Ib, XX }, - { "(bad)", XX, XX, XX }, - { "psllw", MS, Ib, XX }, - { "(bad)", XX, XX, XX }, - }, - /* GRP11 */ - { - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "psrld", MS, Ib, XX }, - { "(bad)", XX, XX, XX }, - { "psrad", MS, Ib, XX }, - { "(bad)", XX, XX, XX }, - { "pslld", MS, Ib, XX }, - { "(bad)", XX, XX, XX }, - }, - /* GRP12 */ - { - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "psrlq", MS, Ib, XX }, - { "psrldq", MS, Ib, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "psllq", MS, Ib, XX }, - { "pslldq", MS, Ib, XX }, - }, - /* GRP13 */ - { - { "fxsave", Ev, XX, XX }, - { "fxrstor", Ev, XX, XX }, - { "ldmxcsr", Ev, XX, XX }, - { "stmxcsr", Ev, XX, XX }, - { "(bad)", XX, XX, XX }, - { "lfence", None, XX, XX }, - { "mfence", None, XX, XX }, - { "sfence", None, XX, XX }, - /* FIXME: the sfence with memory operand is clflush! */ - }, - /* GRP14 */ - { - { "prefetchnta", Ev, XX, XX }, - { "prefetcht0", Ev, XX, XX }, - { "prefetcht1", Ev, XX, XX }, - { "prefetcht2", Ev, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - }, - /* GRPAMD */ - { - { "prefetch", Eb, XX, XX }, - { "prefetchw", Eb, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - } -}; - -static const struct dis386 prefix_user_table[][4] = { - /* PREGRP0 */ - { - { "addps", XM, EX, XX }, - { "addss", XM, EX, XX }, - { "addpd", XM, EX, XX }, - { "addsd", XM, EX, XX }, - }, - /* PREGRP1 */ - { - { "", XM, EX, OPSIMD }, /* See OP_SIMD_SUFFIX. */ - { "", XM, EX, OPSIMD }, - { "", XM, EX, OPSIMD }, - { "", XM, EX, OPSIMD }, - }, - /* PREGRP2 */ - { - { "cvtpi2ps", XM, EM, XX }, - { "cvtsi2ssY", XM, Ev, XX }, - { "cvtpi2pd", XM, EM, XX }, - { "cvtsi2sdY", XM, Ev, XX }, - }, - /* PREGRP3 */ - { - { "cvtps2pi", MX, EX, XX }, - { "cvtss2siY", Gv, EX, XX }, - { "cvtpd2pi", MX, EX, XX }, - { "cvtsd2siY", Gv, EX, XX }, - }, - /* PREGRP4 */ - { - { "cvttps2pi", MX, EX, XX }, - { "cvttss2siY", Gv, EX, XX }, - { "cvttpd2pi", MX, EX, XX }, - { "cvttsd2siY", Gv, EX, XX }, - }, - /* PREGRP5 */ - { - { "divps", XM, EX, XX }, - { "divss", XM, EX, XX }, - { "divpd", XM, EX, XX }, - { "divsd", XM, EX, XX }, - }, - /* PREGRP6 */ - { - { "maxps", XM, EX, XX }, - { "maxss", XM, EX, XX }, - { "maxpd", XM, EX, XX }, - { "maxsd", XM, EX, XX }, - }, - /* PREGRP7 */ - { - { "minps", XM, EX, XX }, - { "minss", XM, EX, XX }, - { "minpd", XM, EX, XX }, - { "minsd", XM, EX, XX }, - }, - /* PREGRP8 */ - { - { "movups", XM, EX, XX }, - { "movss", XM, EX, XX }, - { "movupd", XM, EX, XX }, - { "movsd", XM, EX, XX }, - }, - /* PREGRP9 */ - { - { "movups", EX, XM, XX }, - { "movss", EX, XM, XX }, - { "movupd", EX, XM, XX }, - { "movsd", EX, XM, XX }, - }, - /* PREGRP10 */ - { - { "mulps", XM, EX, XX }, - { "mulss", XM, EX, XX }, - { "mulpd", XM, EX, XX }, - { "mulsd", XM, EX, XX }, - }, - /* PREGRP11 */ - { - { "rcpps", XM, EX, XX }, - { "rcpss", XM, EX, XX }, - { "(bad)", XM, EX, XX }, - { "(bad)", XM, EX, XX }, - }, - /* PREGRP12 */ - { - { "rsqrtps", XM, EX, XX }, - { "rsqrtss", XM, EX, XX }, - { "(bad)", XM, EX, XX }, - { "(bad)", XM, EX, XX }, - }, - /* PREGRP13 */ - { - { "sqrtps", XM, EX, XX }, - { "sqrtss", XM, EX, XX }, - { "sqrtpd", XM, EX, XX }, - { "sqrtsd", XM, EX, XX }, - }, - /* PREGRP14 */ - { - { "subps", XM, EX, XX }, - { "subss", XM, EX, XX }, - { "subpd", XM, EX, XX }, - { "subsd", XM, EX, XX }, - }, - /* PREGRP15 */ - { - { "(bad)", XM, EX, XX }, - { "cvtdq2pd", XM, EX, XX }, - { "cvttpd2dq", XM, EX, XX }, - { "cvtpd2dq", XM, EX, XX }, - }, - /* PREGRP16 */ - { - { "cvtdq2ps", XM, EX, XX }, - { "cvttps2dq",XM, EX, XX }, - { "cvtps2dq",XM, EX, XX }, - { "(bad)", XM, EX, XX }, - }, - /* PREGRP17 */ - { - { "cvtps2pd", XM, EX, XX }, - { "cvtss2sd", XM, EX, XX }, - { "cvtpd2ps", XM, EX, XX }, - { "cvtsd2ss", XM, EX, XX }, - }, - /* PREGRP18 */ - { - { "maskmovq", MX, MS, XX }, - { "(bad)", XM, EX, XX }, - { "maskmovdqu", XM, EX, XX }, - { "(bad)", XM, EX, XX }, - }, - /* PREGRP19 */ - { - { "movq", MX, EM, XX }, - { "movdqu", XM, EX, XX }, - { "movdqa", XM, EX, XX }, - { "(bad)", XM, EX, XX }, - }, - /* PREGRP20 */ - { - { "movq", EM, MX, XX }, - { "movdqu", EX, XM, XX }, - { "movdqa", EX, XM, XX }, - { "(bad)", EX, XM, XX }, - }, - /* PREGRP21 */ - { - { "(bad)", EX, XM, XX }, - { "movq2dq", XM, MS, XX }, - { "movq", EX, XM, XX }, - { "movdq2q", MX, XS, XX }, - }, - /* PREGRP22 */ - { - { "pshufw", MX, EM, Ib }, - { "pshufhw", XM, EX, Ib }, - { "pshufd", XM, EX, Ib }, - { "pshuflw", XM, EX, Ib }, - }, - /* PREGRP23 */ - { - { "movd", Edq, MX, XX }, - { "movq", XM, EX, XX }, - { "movd", Edq, XM, XX }, - { "(bad)", Ed, XM, XX }, - }, - /* PREGRP24 */ - { - { "(bad)", MX, EX, XX }, - { "(bad)", XM, EX, XX }, - { "punpckhqdq", XM, EX, XX }, - { "(bad)", XM, EX, XX }, - }, - /* PREGRP25 */ - { - { "movntq", Ev, MX, XX }, - { "(bad)", Ev, XM, XX }, - { "movntdq", Ev, XM, XX }, - { "(bad)", Ev, XM, XX }, - }, - /* PREGRP26 */ - { - { "(bad)", MX, EX, XX }, - { "(bad)", XM, EX, XX }, - { "punpcklqdq", XM, EX, XX }, - { "(bad)", XM, EX, XX }, - }, -}; - -static const struct dis386 x86_64_table[][2] = { - { - { "arpl", Ew, Gw, XX }, - { "movs{||lq|xd}", Gv, Ed, XX }, - }, -}; - -#define INTERNAL_DISASSEMBLER_ERROR _("") - -static void -ckprefix () -{ - int newrex; - rex = 0; - prefixes = 0; - used_prefixes = 0; - rex_used = 0; - while (1) - { - FETCH_DATA (the_info, codep + 1); - newrex = 0; - switch (*codep) - { - /* REX prefixes family. */ - case 0x40: - case 0x41: - case 0x42: - case 0x43: - case 0x44: - case 0x45: - case 0x46: - case 0x47: - case 0x48: - case 0x49: - case 0x4a: - case 0x4b: - case 0x4c: - case 0x4d: - case 0x4e: - case 0x4f: - if (mode_64bit) - newrex = *codep; - else - return; - break; - case 0xf3: - prefixes |= PREFIX_REPZ; - break; - case 0xf2: - prefixes |= PREFIX_REPNZ; - break; - case 0xf0: - prefixes |= PREFIX_LOCK; - break; - case 0x2e: - prefixes |= PREFIX_CS; - break; - case 0x36: - prefixes |= PREFIX_SS; - break; - case 0x3e: - prefixes |= PREFIX_DS; - break; - case 0x26: - prefixes |= PREFIX_ES; - break; - case 0x64: - prefixes |= PREFIX_FS; - break; - case 0x65: - prefixes |= PREFIX_GS; - break; - case 0x66: - prefixes |= PREFIX_DATA; - break; - case 0x67: - prefixes |= PREFIX_ADDR; - break; - case FWAIT_OPCODE: - /* fwait is really an instruction. If there are prefixes - before the fwait, they belong to the fwait, *not* to the - following instruction. */ - if (prefixes) - { - prefixes |= PREFIX_FWAIT; - codep++; - return; - } - prefixes = PREFIX_FWAIT; - break; - default: - return; - } - /* Rex is ignored when followed by another prefix. */ - if (rex) - { - oappend (prefix_name (rex, 0)); - oappend (" "); - } - rex = newrex; - codep++; - } -} - -/* Return the name of the prefix byte PREF, or NULL if PREF is not a - prefix byte. */ - -static const char * -prefix_name (pref, sizeflag) - int pref; - int sizeflag; -{ - switch (pref) - { - /* REX prefixes family. */ - case 0x40: - return "rex"; - case 0x41: - return "rexZ"; - case 0x42: - return "rexY"; - case 0x43: - return "rexYZ"; - case 0x44: - return "rexX"; - case 0x45: - return "rexXZ"; - case 0x46: - return "rexXY"; - case 0x47: - return "rexXYZ"; - case 0x48: - return "rex64"; - case 0x49: - return "rex64Z"; - case 0x4a: - return "rex64Y"; - case 0x4b: - return "rex64YZ"; - case 0x4c: - return "rex64X"; - case 0x4d: - return "rex64XZ"; - case 0x4e: - return "rex64XY"; - case 0x4f: - return "rex64XYZ"; - case 0xf3: - return "repz"; - case 0xf2: - return "repnz"; - case 0xf0: - return "lock"; - case 0x2e: - return "cs"; - case 0x36: - return "ss"; - case 0x3e: - return "ds"; - case 0x26: - return "es"; - case 0x64: - return "fs"; - case 0x65: - return "gs"; - case 0x66: - return (sizeflag & DFLAG) ? "data16" : "data32"; - case 0x67: - if (mode_64bit) - return (sizeflag & AFLAG) ? "addr32" : "addr64"; - else - return ((sizeflag & AFLAG) && !mode_64bit) ? "addr16" : "addr32"; - case FWAIT_OPCODE: - return "fwait"; - default: - return NULL; - } -} - -static char op1out[100], op2out[100], op3out[100]; -static int op_ad, op_index[3]; -static bfd_vma op_address[3]; -static bfd_vma op_riprel[3]; -static bfd_vma start_pc; - -/* - * On the 386's of 1988, the maximum length of an instruction is 15 bytes. - * (see topic "Redundant prefixes" in the "Differences from 8086" - * section of the "Virtual 8086 Mode" chapter.) - * 'pc' should be the address of this instruction, it will - * be used to print the target address if this is a relative jump or call - * The function returns the length of this instruction in bytes. - */ - -static char intel_syntax; -static char open_char; -static char close_char; -static char separator_char; -static char scale_char; - -/* Here for backwards compatibility. When gdb stops using - print_insn_i386_att and print_insn_i386_intel these functions can - disappear, and print_insn_i386 be merged into print_insn. */ -int -print_insn_i386_att (pc, info) - bfd_vma pc; - disassemble_info *info; -{ - intel_syntax = 0; - - return print_insn (pc, info); -} - -int -print_insn_i386_intel (pc, info) - bfd_vma pc; - disassemble_info *info; -{ - intel_syntax = 1; - - return print_insn (pc, info); -} - -int -print_insn_i386 (pc, info) - bfd_vma pc; - disassemble_info *info; -{ - intel_syntax = -1; - - return print_insn (pc, info); -} - -static int -print_insn (pc, info) - bfd_vma pc; - disassemble_info *info; -{ - const struct dis386 *dp; - int i; - int two_source_ops; - char *first, *second, *third; - int needcomma; - unsigned char uses_SSE_prefix; - int sizeflag; - const char *p; - struct dis_private priv; - - mode_64bit = (info->mach == bfd_mach_x86_64_intel_syntax - || info->mach == bfd_mach_x86_64); - - if (intel_syntax == -1) - intel_syntax = (info->mach == bfd_mach_i386_i386_intel_syntax - || info->mach == bfd_mach_x86_64_intel_syntax); - - if (info->mach == bfd_mach_i386_i386 - || info->mach == bfd_mach_x86_64 - || info->mach == bfd_mach_i386_i386_intel_syntax - || info->mach == bfd_mach_x86_64_intel_syntax) - priv.orig_sizeflag = AFLAG | DFLAG; - else if (info->mach == bfd_mach_i386_i8086) - priv.orig_sizeflag = 0; - else - abort (); - - for (p = info->disassembler_options; p != NULL; ) - { - if (strncmp (p, "x86-64", 6) == 0) - { - mode_64bit = 1; - priv.orig_sizeflag = AFLAG | DFLAG; - } - else if (strncmp (p, "i386", 4) == 0) - { - mode_64bit = 0; - priv.orig_sizeflag = AFLAG | DFLAG; - } - else if (strncmp (p, "i8086", 5) == 0) - { - mode_64bit = 0; - priv.orig_sizeflag = 0; - } - else if (strncmp (p, "intel", 5) == 0) - { - intel_syntax = 1; - } - else if (strncmp (p, "att", 3) == 0) - { - intel_syntax = 0; - } - else if (strncmp (p, "addr", 4) == 0) - { - if (p[4] == '1' && p[5] == '6') - priv.orig_sizeflag &= ~AFLAG; - else if (p[4] == '3' && p[5] == '2') - priv.orig_sizeflag |= AFLAG; - } - else if (strncmp (p, "data", 4) == 0) - { - if (p[4] == '1' && p[5] == '6') - priv.orig_sizeflag &= ~DFLAG; - else if (p[4] == '3' && p[5] == '2') - priv.orig_sizeflag |= DFLAG; - } - else if (strncmp (p, "suffix", 6) == 0) - priv.orig_sizeflag |= SUFFIX_ALWAYS; - - p = strchr (p, ','); - if (p != NULL) - p++; - } - - if (intel_syntax) - { - names64 = intel_names64; - names32 = intel_names32; - names16 = intel_names16; - names8 = intel_names8; - names8rex = intel_names8rex; - names_seg = intel_names_seg; - index16 = intel_index16; - open_char = '['; - close_char = ']'; - separator_char = '+'; - scale_char = '*'; - } - else - { - names64 = att_names64; - names32 = att_names32; - names16 = att_names16; - names8 = att_names8; - names8rex = att_names8rex; - names_seg = att_names_seg; - index16 = att_index16; - open_char = '('; - close_char = ')'; - separator_char = ','; - scale_char = ','; - } - - /* The output looks better if we put 7 bytes on a line, since that - puts most long word instructions on a single line. */ - info->bytes_per_line = 7; - - info->private_data = (PTR) &priv; - priv.max_fetched = priv.the_buffer; - priv.insn_start = pc; - - obuf[0] = 0; - op1out[0] = 0; - op2out[0] = 0; - op3out[0] = 0; - - op_index[0] = op_index[1] = op_index[2] = -1; - - the_info = info; - start_pc = pc; - start_codep = priv.the_buffer; - codep = priv.the_buffer; - - if (setjmp (priv.bailout) != 0) - { - const char *name; - - /* Getting here means we tried for data but didn't get it. That - means we have an incomplete instruction of some sort. Just - print the first byte as a prefix or a .byte pseudo-op. */ - if (codep > priv.the_buffer) - { - name = prefix_name (priv.the_buffer[0], priv.orig_sizeflag); - if (name != NULL) - (*info->fprintf_func) (info->stream, "%s", name); - else - { - /* Just print the first byte as a .byte instruction. */ - (*info->fprintf_func) (info->stream, ".byte 0x%x", - (unsigned int) priv.the_buffer[0]); - } - - return 1; - } - - return -1; - } - - obufp = obuf; - ckprefix (); - - insn_codep = codep; - sizeflag = priv.orig_sizeflag; - - FETCH_DATA (info, codep + 1); - two_source_ops = (*codep == 0x62) || (*codep == 0xc8); - - if ((prefixes & PREFIX_FWAIT) - && ((*codep < 0xd8) || (*codep > 0xdf))) - { - const char *name; - - /* fwait not followed by floating point instruction. Print the - first prefix, which is probably fwait itself. */ - name = prefix_name (priv.the_buffer[0], priv.orig_sizeflag); - if (name == NULL) - name = INTERNAL_DISASSEMBLER_ERROR; - (*info->fprintf_func) (info->stream, "%s", name); - return 1; - } - - if (*codep == 0x0f) - { - FETCH_DATA (info, codep + 2); - dp = &dis386_twobyte[*++codep]; - need_modrm = twobyte_has_modrm[*codep]; - uses_SSE_prefix = twobyte_uses_SSE_prefix[*codep]; - } - else - { - dp = &dis386[*codep]; - need_modrm = onebyte_has_modrm[*codep]; - uses_SSE_prefix = 0; - } - codep++; - - if (!uses_SSE_prefix && (prefixes & PREFIX_REPZ)) - { - oappend ("repz "); - used_prefixes |= PREFIX_REPZ; - } - if (!uses_SSE_prefix && (prefixes & PREFIX_REPNZ)) - { - oappend ("repnz "); - used_prefixes |= PREFIX_REPNZ; - } - if (prefixes & PREFIX_LOCK) - { - oappend ("lock "); - used_prefixes |= PREFIX_LOCK; - } - - if (prefixes & PREFIX_ADDR) - { - sizeflag ^= AFLAG; - if (dp->bytemode3 != loop_jcxz_mode || intel_syntax) - { - if ((sizeflag & AFLAG) || mode_64bit) - oappend ("addr32 "); - else - oappend ("addr16 "); - used_prefixes |= PREFIX_ADDR; - } - } - - if (!uses_SSE_prefix && (prefixes & PREFIX_DATA)) - { - sizeflag ^= DFLAG; - if (dp->bytemode3 == cond_jump_mode - && dp->bytemode1 == v_mode - && !intel_syntax) - { - if (sizeflag & DFLAG) - oappend ("data32 "); - else - oappend ("data16 "); - used_prefixes |= PREFIX_DATA; - } - } - - if (need_modrm) - { - FETCH_DATA (info, codep + 1); - mod = (*codep >> 6) & 3; - reg = (*codep >> 3) & 7; - rm = *codep & 7; - } - - if (dp->name == NULL && dp->bytemode1 == FLOATCODE) - { - dofloat (sizeflag); - } - else - { - int index; - if (dp->name == NULL) - { - switch (dp->bytemode1) - { - case USE_GROUPS: - dp = &grps[dp->bytemode2][reg]; - break; - - case USE_PREFIX_USER_TABLE: - index = 0; - used_prefixes |= (prefixes & PREFIX_REPZ); - if (prefixes & PREFIX_REPZ) - index = 1; - else - { - used_prefixes |= (prefixes & PREFIX_DATA); - if (prefixes & PREFIX_DATA) - index = 2; - else - { - used_prefixes |= (prefixes & PREFIX_REPNZ); - if (prefixes & PREFIX_REPNZ) - index = 3; - } - } - dp = &prefix_user_table[dp->bytemode2][index]; - break; - - case X86_64_SPECIAL: - dp = &x86_64_table[dp->bytemode2][mode_64bit]; - break; - - default: - oappend (INTERNAL_DISASSEMBLER_ERROR); - break; - } - } - - if (putop (dp->name, sizeflag) == 0) - { - obufp = op1out; - op_ad = 2; - if (dp->op1) - (*dp->op1) (dp->bytemode1, sizeflag); - - obufp = op2out; - op_ad = 1; - if (dp->op2) - (*dp->op2) (dp->bytemode2, sizeflag); - - obufp = op3out; - op_ad = 0; - if (dp->op3) - (*dp->op3) (dp->bytemode3, sizeflag); - } - } - - /* See if any prefixes were not used. If so, print the first one - separately. If we don't do this, we'll wind up printing an - instruction stream which does not precisely correspond to the - bytes we are disassembling. */ - if ((prefixes & ~used_prefixes) != 0) - { - const char *name; - - name = prefix_name (priv.the_buffer[0], priv.orig_sizeflag); - if (name == NULL) - name = INTERNAL_DISASSEMBLER_ERROR; - (*info->fprintf_func) (info->stream, "%s", name); - return 1; - } - if (rex & ~rex_used) - { - const char *name; - name = prefix_name (rex | 0x40, priv.orig_sizeflag); - if (name == NULL) - name = INTERNAL_DISASSEMBLER_ERROR; - (*info->fprintf_func) (info->stream, "%s ", name); - } - - obufp = obuf + strlen (obuf); - for (i = strlen (obuf); i < 6; i++) - oappend (" "); - oappend (" "); - (*info->fprintf_func) (info->stream, "%s", obuf); - - /* The enter and bound instructions are printed with operands in the same - order as the intel book; everything else is printed in reverse order. */ - if (intel_syntax || two_source_ops) - { - first = op1out; - second = op2out; - third = op3out; - op_ad = op_index[0]; - op_index[0] = op_index[2]; - op_index[2] = op_ad; - } - else - { - first = op3out; - second = op2out; - third = op1out; - } - needcomma = 0; - if (*first) - { - if (op_index[0] != -1 && !op_riprel[0]) - (*info->print_address_func) ((bfd_vma) op_address[op_index[0]], info); - else - (*info->fprintf_func) (info->stream, "%s", first); - needcomma = 1; - } - if (*second) - { - if (needcomma) - (*info->fprintf_func) (info->stream, ","); - if (op_index[1] != -1 && !op_riprel[1]) - (*info->print_address_func) ((bfd_vma) op_address[op_index[1]], info); - else - (*info->fprintf_func) (info->stream, "%s", second); - needcomma = 1; - } - if (*third) - { - if (needcomma) - (*info->fprintf_func) (info->stream, ","); - if (op_index[2] != -1 && !op_riprel[2]) - (*info->print_address_func) ((bfd_vma) op_address[op_index[2]], info); - else - (*info->fprintf_func) (info->stream, "%s", third); - } - for (i = 0; i < 3; i++) - if (op_index[i] != -1 && op_riprel[i]) - { - (*info->fprintf_func) (info->stream, " # "); - (*info->print_address_func) ((bfd_vma) (start_pc + codep - start_codep - + op_address[op_index[i]]), info); - } - return codep - priv.the_buffer; -} - -static const char *float_mem[] = { - /* d8 */ - "fadd{s||s|}", - "fmul{s||s|}", - "fcom{s||s|}", - "fcomp{s||s|}", - "fsub{s||s|}", - "fsubr{s||s|}", - "fdiv{s||s|}", - "fdivr{s||s|}", - /* d9 */ - "fld{s||s|}", - "(bad)", - "fst{s||s|}", - "fstp{s||s|}", - "fldenv", - "fldcw", - "fNstenv", - "fNstcw", - /* da */ - "fiadd{l||l|}", - "fimul{l||l|}", - "ficom{l||l|}", - "ficomp{l||l|}", - "fisub{l||l|}", - "fisubr{l||l|}", - "fidiv{l||l|}", - "fidivr{l||l|}", - /* db */ - "fild{l||l|}", - "(bad)", - "fist{l||l|}", - "fistp{l||l|}", - "(bad)", - "fld{t||t|}", - "(bad)", - "fstp{t||t|}", - /* dc */ - "fadd{l||l|}", - "fmul{l||l|}", - "fcom{l||l|}", - "fcomp{l||l|}", - "fsub{l||l|}", - "fsubr{l||l|}", - "fdiv{l||l|}", - "fdivr{l||l|}", - /* dd */ - "fld{l||l|}", - "(bad)", - "fst{l||l|}", - "fstp{l||l|}", - "frstor", - "(bad)", - "fNsave", - "fNstsw", - /* de */ - "fiadd", - "fimul", - "ficom", - "ficomp", - "fisub", - "fisubr", - "fidiv", - "fidivr", - /* df */ - "fild", - "(bad)", - "fist", - "fistp", - "fbld", - "fild{ll||ll|}", - "fbstp", - "fistpll", -}; - -#define ST OP_ST, 0 -#define STi OP_STi, 0 - -#define FGRPd9_2 NULL, NULL, 0, NULL, 0, NULL, 0 -#define FGRPd9_4 NULL, NULL, 1, NULL, 0, NULL, 0 -#define FGRPd9_5 NULL, NULL, 2, NULL, 0, NULL, 0 -#define FGRPd9_6 NULL, NULL, 3, NULL, 0, NULL, 0 -#define FGRPd9_7 NULL, NULL, 4, NULL, 0, NULL, 0 -#define FGRPda_5 NULL, NULL, 5, NULL, 0, NULL, 0 -#define FGRPdb_4 NULL, NULL, 6, NULL, 0, NULL, 0 -#define FGRPde_3 NULL, NULL, 7, NULL, 0, NULL, 0 -#define FGRPdf_4 NULL, NULL, 8, NULL, 0, NULL, 0 - -static const struct dis386 float_reg[][8] = { - /* d8 */ - { - { "fadd", ST, STi, XX }, - { "fmul", ST, STi, XX }, - { "fcom", STi, XX, XX }, - { "fcomp", STi, XX, XX }, - { "fsub", ST, STi, XX }, - { "fsubr", ST, STi, XX }, - { "fdiv", ST, STi, XX }, - { "fdivr", ST, STi, XX }, - }, - /* d9 */ - { - { "fld", STi, XX, XX }, - { "fxch", STi, XX, XX }, - { FGRPd9_2 }, - { "(bad)", XX, XX, XX }, - { FGRPd9_4 }, - { FGRPd9_5 }, - { FGRPd9_6 }, - { FGRPd9_7 }, - }, - /* da */ - { - { "fcmovb", ST, STi, XX }, - { "fcmove", ST, STi, XX }, - { "fcmovbe",ST, STi, XX }, - { "fcmovu", ST, STi, XX }, - { "(bad)", XX, XX, XX }, - { FGRPda_5 }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - }, - /* db */ - { - { "fcmovnb",ST, STi, XX }, - { "fcmovne",ST, STi, XX }, - { "fcmovnbe",ST, STi, XX }, - { "fcmovnu",ST, STi, XX }, - { FGRPdb_4 }, - { "fucomi", ST, STi, XX }, - { "fcomi", ST, STi, XX }, - { "(bad)", XX, XX, XX }, - }, - /* dc */ - { - { "fadd", STi, ST, XX }, - { "fmul", STi, ST, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, -#if UNIXWARE_COMPAT - { "fsub", STi, ST, XX }, - { "fsubr", STi, ST, XX }, - { "fdiv", STi, ST, XX }, - { "fdivr", STi, ST, XX }, -#else - { "fsubr", STi, ST, XX }, - { "fsub", STi, ST, XX }, - { "fdivr", STi, ST, XX }, - { "fdiv", STi, ST, XX }, -#endif - }, - /* dd */ - { - { "ffree", STi, XX, XX }, - { "(bad)", XX, XX, XX }, - { "fst", STi, XX, XX }, - { "fstp", STi, XX, XX }, - { "fucom", STi, XX, XX }, - { "fucomp", STi, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - }, - /* de */ - { - { "faddp", STi, ST, XX }, - { "fmulp", STi, ST, XX }, - { "(bad)", XX, XX, XX }, - { FGRPde_3 }, -#if UNIXWARE_COMPAT - { "fsubp", STi, ST, XX }, - { "fsubrp", STi, ST, XX }, - { "fdivp", STi, ST, XX }, - { "fdivrp", STi, ST, XX }, -#else - { "fsubrp", STi, ST, XX }, - { "fsubp", STi, ST, XX }, - { "fdivrp", STi, ST, XX }, - { "fdivp", STi, ST, XX }, -#endif - }, - /* df */ - { - { "ffreep", STi, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { "(bad)", XX, XX, XX }, - { FGRPdf_4 }, - { "fucomip",ST, STi, XX }, - { "fcomip", ST, STi, XX }, - { "(bad)", XX, XX, XX }, - }, -}; - -static char *fgrps[][8] = { - /* d9_2 0 */ - { - "fnop","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)", - }, - - /* d9_4 1 */ - { - "fchs","fabs","(bad)","(bad)","ftst","fxam","(bad)","(bad)", - }, - - /* d9_5 2 */ - { - "fld1","fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz","(bad)", - }, - - /* d9_6 3 */ - { - "f2xm1","fyl2x","fptan","fpatan","fxtract","fprem1","fdecstp","fincstp", - }, - - /* d9_7 4 */ - { - "fprem","fyl2xp1","fsqrt","fsincos","frndint","fscale","fsin","fcos", - }, - - /* da_5 5 */ - { - "(bad)","fucompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)", - }, - - /* db_4 6 */ - { - "feni(287 only)","fdisi(287 only)","fNclex","fNinit", - "fNsetpm(287 only)","(bad)","(bad)","(bad)", - }, - - /* de_3 7 */ - { - "(bad)","fcompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)", - }, - - /* df_4 8 */ - { - "fNstsw","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)", - }, -}; - -static void -dofloat (sizeflag) - int sizeflag; -{ - const struct dis386 *dp; - unsigned char floatop; - - floatop = codep[-1]; - - if (mod != 3) - { - putop (float_mem[(floatop - 0xd8) * 8 + reg], sizeflag); - obufp = op1out; - if (floatop == 0xdb) - OP_E (x_mode, sizeflag); - else if (floatop == 0xdd) - OP_E (d_mode, sizeflag); - else - OP_E (v_mode, sizeflag); - return; - } - /* Skip mod/rm byte. */ - MODRM_CHECK; - codep++; - - dp = &float_reg[floatop - 0xd8][reg]; - if (dp->name == NULL) - { - putop (fgrps[dp->bytemode1][rm], sizeflag); - - /* Instruction fnstsw is only one with strange arg. */ - if (floatop == 0xdf && codep[-1] == 0xe0) - strcpy (op1out, names16[0]); - } - else - { - putop (dp->name, sizeflag); - - obufp = op1out; - if (dp->op1) - (*dp->op1) (dp->bytemode1, sizeflag); - obufp = op2out; - if (dp->op2) - (*dp->op2) (dp->bytemode2, sizeflag); - } -} - -static void -OP_ST (bytemode, sizeflag) - int bytemode ATTRIBUTE_UNUSED; - int sizeflag ATTRIBUTE_UNUSED; -{ - oappend ("%st"); -} - -static void -OP_STi (bytemode, sizeflag) - int bytemode ATTRIBUTE_UNUSED; - int sizeflag ATTRIBUTE_UNUSED; -{ - sprintf (scratchbuf, "%%st(%d)", rm); - oappend (scratchbuf + intel_syntax); -} - -/* Capital letters in template are macros. */ -static int -putop (template, sizeflag) - const char *template; - int sizeflag; -{ - const char *p; - int alt; - - for (p = template; *p; p++) - { - switch (*p) - { - default: - *obufp++ = *p; - break; - case '{': - alt = 0; - if (intel_syntax) - alt += 1; - if (mode_64bit) - alt += 2; - while (alt != 0) - { - while (*++p != '|') - { - if (*p == '}') - { - /* Alternative not valid. */ - strcpy (obuf, "(bad)"); - obufp = obuf + 5; - return 1; - } - else if (*p == '\0') - abort (); - } - alt--; - } - break; - case '|': - while (*++p != '}') - { - if (*p == '\0') - abort (); - } - break; - case '}': - break; - case 'A': - if (intel_syntax) - break; - if (mod != 3 || (sizeflag & SUFFIX_ALWAYS)) - *obufp++ = 'b'; - break; - case 'B': - if (intel_syntax) - break; - if (sizeflag & SUFFIX_ALWAYS) - *obufp++ = 'b'; - break; - case 'E': /* For jcxz/jecxz */ - if (mode_64bit) - { - if (sizeflag & AFLAG) - *obufp++ = 'r'; - else - *obufp++ = 'e'; - } - else - if (sizeflag & AFLAG) - *obufp++ = 'e'; - used_prefixes |= (prefixes & PREFIX_ADDR); - break; - case 'F': - if (intel_syntax) - break; - if ((prefixes & PREFIX_ADDR) || (sizeflag & SUFFIX_ALWAYS)) - { - if (sizeflag & AFLAG) - *obufp++ = mode_64bit ? 'q' : 'l'; - else - *obufp++ = mode_64bit ? 'l' : 'w'; - used_prefixes |= (prefixes & PREFIX_ADDR); - } - break; - case 'H': - if (intel_syntax) - break; - if ((prefixes & (PREFIX_CS | PREFIX_DS)) == PREFIX_CS - || (prefixes & (PREFIX_CS | PREFIX_DS)) == PREFIX_DS) - { - used_prefixes |= prefixes & (PREFIX_CS | PREFIX_DS); - *obufp++ = ','; - *obufp++ = 'p'; - if (prefixes & PREFIX_DS) - *obufp++ = 't'; - else - *obufp++ = 'n'; - } - break; - case 'L': - if (intel_syntax) - break; - if (sizeflag & SUFFIX_ALWAYS) - *obufp++ = 'l'; - break; - case 'N': - if ((prefixes & PREFIX_FWAIT) == 0) - *obufp++ = 'n'; - else - used_prefixes |= PREFIX_FWAIT; - break; - case 'O': - USED_REX (REX_MODE64); - if (rex & REX_MODE64) - *obufp++ = 'o'; - else - *obufp++ = 'd'; - break; - case 'T': - if (intel_syntax) - break; - if (mode_64bit) - { - *obufp++ = 'q'; - break; - } - /* Fall through. */ - case 'P': - if (intel_syntax) - break; - if ((prefixes & PREFIX_DATA) - || (rex & REX_MODE64) - || (sizeflag & SUFFIX_ALWAYS)) - { - USED_REX (REX_MODE64); - if (rex & REX_MODE64) - *obufp++ = 'q'; - else - { - if (sizeflag & DFLAG) - *obufp++ = 'l'; - else - *obufp++ = 'w'; - used_prefixes |= (prefixes & PREFIX_DATA); - } - } - break; - case 'U': - if (intel_syntax) - break; - if (mode_64bit) - { - *obufp++ = 'q'; - break; - } - /* Fall through. */ - case 'Q': - if (intel_syntax) - break; - USED_REX (REX_MODE64); - if (mod != 3 || (sizeflag & SUFFIX_ALWAYS)) - { - if (rex & REX_MODE64) - *obufp++ = 'q'; - else - { - if (sizeflag & DFLAG) - *obufp++ = 'l'; - else - *obufp++ = 'w'; - used_prefixes |= (prefixes & PREFIX_DATA); - } - } - break; - case 'R': - USED_REX (REX_MODE64); - if (intel_syntax) - { - if (rex & REX_MODE64) - { - *obufp++ = 'q'; - *obufp++ = 't'; - } - else if (sizeflag & DFLAG) - { - *obufp++ = 'd'; - *obufp++ = 'q'; - } - else - { - *obufp++ = 'w'; - *obufp++ = 'd'; - } - } - else - { - if (rex & REX_MODE64) - *obufp++ = 'q'; - else if (sizeflag & DFLAG) - *obufp++ = 'l'; - else - *obufp++ = 'w'; - } - if (!(rex & REX_MODE64)) - used_prefixes |= (prefixes & PREFIX_DATA); - break; - case 'S': - if (intel_syntax) - break; - if (sizeflag & SUFFIX_ALWAYS) - { - if (rex & REX_MODE64) - *obufp++ = 'q'; - else - { - if (sizeflag & DFLAG) - *obufp++ = 'l'; - else - *obufp++ = 'w'; - used_prefixes |= (prefixes & PREFIX_DATA); - } - } - break; - case 'X': - if (prefixes & PREFIX_DATA) - *obufp++ = 'd'; - else - *obufp++ = 's'; - used_prefixes |= (prefixes & PREFIX_DATA); - break; - case 'Y': - if (intel_syntax) - break; - if (rex & REX_MODE64) - { - USED_REX (REX_MODE64); - *obufp++ = 'q'; - } - break; - /* implicit operand size 'l' for i386 or 'q' for x86-64 */ - case 'W': - /* operand size flag for cwtl, cbtw */ - USED_REX (0); - if (rex) - *obufp++ = 'l'; - else if (sizeflag & DFLAG) - *obufp++ = 'w'; - else - *obufp++ = 'b'; - if (intel_syntax) - { - if (rex) - { - *obufp++ = 'q'; - *obufp++ = 'e'; - } - if (sizeflag & DFLAG) - { - *obufp++ = 'd'; - *obufp++ = 'e'; - } - else - { - *obufp++ = 'w'; - } - } - if (!rex) - used_prefixes |= (prefixes & PREFIX_DATA); - break; - } - } - *obufp = 0; - return 0; -} - -static void -oappend (s) - const char *s; -{ - strcpy (obufp, s); - obufp += strlen (s); -} - -static void -append_seg () -{ - if (prefixes & PREFIX_CS) - { - used_prefixes |= PREFIX_CS; - oappend ("%cs:" + intel_syntax); - } - if (prefixes & PREFIX_DS) - { - used_prefixes |= PREFIX_DS; - oappend ("%ds:" + intel_syntax); - } - if (prefixes & PREFIX_SS) - { - used_prefixes |= PREFIX_SS; - oappend ("%ss:" + intel_syntax); - } - if (prefixes & PREFIX_ES) - { - used_prefixes |= PREFIX_ES; - oappend ("%es:" + intel_syntax); - } - if (prefixes & PREFIX_FS) - { - used_prefixes |= PREFIX_FS; - oappend ("%fs:" + intel_syntax); - } - if (prefixes & PREFIX_GS) - { - used_prefixes |= PREFIX_GS; - oappend ("%gs:" + intel_syntax); - } -} - -static void -OP_indirE (bytemode, sizeflag) - int bytemode; - int sizeflag; -{ - if (!intel_syntax) - oappend ("*"); - OP_E (bytemode, sizeflag); -} - -static void -print_operand_value (buf, hex, disp) - char *buf; - int hex; - bfd_vma disp; -{ - if (mode_64bit) - { - if (hex) - { - char tmp[30]; - int i; - buf[0] = '0'; - buf[1] = 'x'; - sprintf_vma (tmp, disp); - for (i = 0; tmp[i] == '0' && tmp[i + 1]; i++); - strcpy (buf + 2, tmp + i); - } - else - { - bfd_signed_vma v = disp; - char tmp[30]; - int i; - if (v < 0) - { - *(buf++) = '-'; - v = -disp; - /* Check for possible overflow on 0x8000000000000000. */ - if (v < 0) - { - strcpy (buf, "9223372036854775808"); - return; - } - } - if (!v) - { - strcpy (buf, "0"); - return; - } - - i = 0; - tmp[29] = 0; - while (v) - { - tmp[28 - i] = (v % 10) + '0'; - v /= 10; - i++; - } - strcpy (buf, tmp + 29 - i); - } - } - else - { - if (hex) - sprintf (buf, "0x%x", (unsigned int) disp); - else - sprintf (buf, "%d", (int) disp); - } -} - -static void -OP_E (bytemode, sizeflag) - int bytemode; - int sizeflag; -{ - bfd_vma disp; - int add = 0; - int riprel = 0; - USED_REX (REX_EXTZ); - if (rex & REX_EXTZ) - add += 8; - - /* Skip mod/rm byte. */ - MODRM_CHECK; - codep++; - - if (mod == 3) - { - switch (bytemode) - { - case b_mode: - USED_REX (0); - if (rex) - oappend (names8rex[rm + add]); - else - oappend (names8[rm + add]); - break; - case w_mode: - oappend (names16[rm + add]); - break; - case d_mode: - oappend (names32[rm + add]); - break; - case q_mode: - oappend (names64[rm + add]); - break; - case m_mode: - if (mode_64bit) - oappend (names64[rm + add]); - else - oappend (names32[rm + add]); - break; - case v_mode: - case dq_mode: - USED_REX (REX_MODE64); - if (rex & REX_MODE64) - oappend (names64[rm + add]); - else if ((sizeflag & DFLAG) || bytemode == dq_mode) - oappend (names32[rm + add]); - else - oappend (names16[rm + add]); - used_prefixes |= (prefixes & PREFIX_DATA); - break; - case 0: - if (!(codep[-2] == 0xAE && codep[-1] == 0xF8 /* sfence */) - && !(codep[-2] == 0xAE && codep[-1] == 0xF0 /* mfence */) - && !(codep[-2] == 0xAE && codep[-1] == 0xe8 /* lfence */)) - BadOp (); /* bad sfence,lea,lds,les,lfs,lgs,lss modrm */ - break; - default: - oappend (INTERNAL_DISASSEMBLER_ERROR); - break; - } - return; - } - - disp = 0; - append_seg (); - - if ((sizeflag & AFLAG) || mode_64bit) /* 32 bit address mode */ - { - int havesib; - int havebase; - int base; - int index = 0; - int scale = 0; - - havesib = 0; - havebase = 1; - base = rm; - - if (base == 4) - { - havesib = 1; - FETCH_DATA (the_info, codep + 1); - scale = (*codep >> 6) & 3; - index = (*codep >> 3) & 7; - base = *codep & 7; - USED_REX (REX_EXTY); - USED_REX (REX_EXTZ); - if (rex & REX_EXTY) - index += 8; - if (rex & REX_EXTZ) - base += 8; - codep++; - } - - switch (mod) - { - case 0: - if ((base & 7) == 5) - { - havebase = 0; - if (mode_64bit && !havesib && (sizeflag & AFLAG)) - riprel = 1; - disp = get32s (); - } - break; - case 1: - FETCH_DATA (the_info, codep + 1); - disp = *codep++; - if ((disp & 0x80) != 0) - disp -= 0x100; - break; - case 2: - disp = get32s (); - break; - } - - if (!intel_syntax) - if (mod != 0 || (base & 7) == 5) - { - print_operand_value (scratchbuf, !riprel, disp); - oappend (scratchbuf); - if (riprel) - { - set_op (disp, 1); - oappend ("(%rip)"); - } - } - - if (havebase || (havesib && (index != 4 || scale != 0))) - { - if (intel_syntax) - { - switch (bytemode) - { - case b_mode: - oappend ("BYTE PTR "); - break; - case w_mode: - oappend ("WORD PTR "); - break; - case v_mode: - oappend ("DWORD PTR "); - break; - case d_mode: - oappend ("QWORD PTR "); - break; - case m_mode: - if (mode_64bit) - oappend ("DWORD PTR "); - else - oappend ("QWORD PTR "); - break; - case x_mode: - oappend ("XWORD PTR "); - break; - default: - break; - } - } - *obufp++ = open_char; - if (intel_syntax && riprel) - oappend ("rip + "); - *obufp = '\0'; - USED_REX (REX_EXTZ); - if (!havesib && (rex & REX_EXTZ)) - base += 8; - if (havebase) - oappend (mode_64bit && (sizeflag & AFLAG) - ? names64[base] : names32[base]); - if (havesib) - { - if (index != 4) - { - if (intel_syntax) - { - if (havebase) - { - *obufp++ = separator_char; - *obufp = '\0'; - } - sprintf (scratchbuf, "%s", - mode_64bit && (sizeflag & AFLAG) - ? names64[index] : names32[index]); - } - else - sprintf (scratchbuf, ",%s", - mode_64bit && (sizeflag & AFLAG) - ? names64[index] : names32[index]); - oappend (scratchbuf); - } - if (!intel_syntax - || (intel_syntax - && bytemode != b_mode - && bytemode != w_mode - && bytemode != v_mode)) - { - *obufp++ = scale_char; - *obufp = '\0'; - sprintf (scratchbuf, "%d", 1 << scale); - oappend (scratchbuf); - } - } - if (intel_syntax) - if (mod != 0 || (base & 7) == 5) - { - /* Don't print zero displacements. */ - if (disp != 0) - { - if ((bfd_signed_vma) disp > 0) - { - *obufp++ = '+'; - *obufp = '\0'; - } - - print_operand_value (scratchbuf, 0, disp); - oappend (scratchbuf); - } - } - - *obufp++ = close_char; - *obufp = '\0'; - } - else if (intel_syntax) - { - if (mod != 0 || (base & 7) == 5) - { - if (prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS - | PREFIX_ES | PREFIX_FS | PREFIX_GS)) - ; - else - { - oappend (names_seg[ds_reg - es_reg]); - oappend (":"); - } - print_operand_value (scratchbuf, 1, disp); - oappend (scratchbuf); - } - } - } - else - { /* 16 bit address mode */ - switch (mod) - { - case 0: - if ((rm & 7) == 6) - { - disp = get16 (); - if ((disp & 0x8000) != 0) - disp -= 0x10000; - } - break; - case 1: - FETCH_DATA (the_info, codep + 1); - disp = *codep++; - if ((disp & 0x80) != 0) - disp -= 0x100; - break; - case 2: - disp = get16 (); - if ((disp & 0x8000) != 0) - disp -= 0x10000; - break; - } - - if (!intel_syntax) - if (mod != 0 || (rm & 7) == 6) - { - print_operand_value (scratchbuf, 0, disp); - oappend (scratchbuf); - } - - if (mod != 0 || (rm & 7) != 6) - { - *obufp++ = open_char; - *obufp = '\0'; - oappend (index16[rm + add]); - *obufp++ = close_char; - *obufp = '\0'; - } - } -} - -static void -OP_G (bytemode, sizeflag) - int bytemode; - int sizeflag; -{ - int add = 0; - USED_REX (REX_EXTX); - if (rex & REX_EXTX) - add += 8; - switch (bytemode) - { - case b_mode: - USED_REX (0); - if (rex) - oappend (names8rex[reg + add]); - else - oappend (names8[reg + add]); - break; - case w_mode: - oappend (names16[reg + add]); - break; - case d_mode: - oappend (names32[reg + add]); - break; - case q_mode: - oappend (names64[reg + add]); - break; - case v_mode: - USED_REX (REX_MODE64); - if (rex & REX_MODE64) - oappend (names64[reg + add]); - else if (sizeflag & DFLAG) - oappend (names32[reg + add]); - else - oappend (names16[reg + add]); - used_prefixes |= (prefixes & PREFIX_DATA); - break; - default: - oappend (INTERNAL_DISASSEMBLER_ERROR); - break; - } -} - -static bfd_vma -get64 () -{ - bfd_vma x; -#ifdef BFD64 - unsigned int a; - unsigned int b; - - FETCH_DATA (the_info, codep + 8); - a = *codep++ & 0xff; - a |= (*codep++ & 0xff) << 8; - a |= (*codep++ & 0xff) << 16; - a |= (*codep++ & 0xff) << 24; - b = *codep++ & 0xff; - b |= (*codep++ & 0xff) << 8; - b |= (*codep++ & 0xff) << 16; - b |= (*codep++ & 0xff) << 24; - x = a + ((bfd_vma) b << 32); -#else - abort (); - x = 0; -#endif - return x; -} - -static bfd_signed_vma -get32 () -{ - bfd_signed_vma x = 0; - - FETCH_DATA (the_info, codep + 4); - x = *codep++ & (bfd_signed_vma) 0xff; - x |= (*codep++ & (bfd_signed_vma) 0xff) << 8; - x |= (*codep++ & (bfd_signed_vma) 0xff) << 16; - x |= (*codep++ & (bfd_signed_vma) 0xff) << 24; - return x; -} - -static bfd_signed_vma -get32s () -{ - bfd_signed_vma x = 0; - - FETCH_DATA (the_info, codep + 4); - x = *codep++ & (bfd_signed_vma) 0xff; - x |= (*codep++ & (bfd_signed_vma) 0xff) << 8; - x |= (*codep++ & (bfd_signed_vma) 0xff) << 16; - x |= (*codep++ & (bfd_signed_vma) 0xff) << 24; - - x = (x ^ ((bfd_signed_vma) 1 << 31)) - ((bfd_signed_vma) 1 << 31); - - return x; -} - -static int -get16 () -{ - int x = 0; - - FETCH_DATA (the_info, codep + 2); - x = *codep++ & 0xff; - x |= (*codep++ & 0xff) << 8; - return x; -} - -static void -set_op (op, riprel) - bfd_vma op; - int riprel; -{ - op_index[op_ad] = op_ad; - if (mode_64bit) - { - op_address[op_ad] = op; - op_riprel[op_ad] = riprel; - } - else - { - /* Mask to get a 32-bit address. */ - op_address[op_ad] = op & 0xffffffff; - op_riprel[op_ad] = riprel & 0xffffffff; - } -} - -static void -OP_REG (code, sizeflag) - int code; - int sizeflag; -{ - const char *s; - int add = 0; - USED_REX (REX_EXTZ); - if (rex & REX_EXTZ) - add = 8; - - switch (code) - { - case indir_dx_reg: - if (intel_syntax) - s = "[dx]"; - else - s = "(%dx)"; - break; - case ax_reg: case cx_reg: case dx_reg: case bx_reg: - case sp_reg: case bp_reg: case si_reg: case di_reg: - s = names16[code - ax_reg + add]; - break; - case es_reg: case ss_reg: case cs_reg: - case ds_reg: case fs_reg: case gs_reg: - s = names_seg[code - es_reg + add]; - break; - case al_reg: case ah_reg: case cl_reg: case ch_reg: - case dl_reg: case dh_reg: case bl_reg: case bh_reg: - USED_REX (0); - if (rex) - s = names8rex[code - al_reg + add]; - else - s = names8[code - al_reg]; - break; - case rAX_reg: case rCX_reg: case rDX_reg: case rBX_reg: - case rSP_reg: case rBP_reg: case rSI_reg: case rDI_reg: - if (mode_64bit) - { - s = names64[code - rAX_reg + add]; - break; - } - code += eAX_reg - rAX_reg; - /* Fall through. */ - case eAX_reg: case eCX_reg: case eDX_reg: case eBX_reg: - case eSP_reg: case eBP_reg: case eSI_reg: case eDI_reg: - USED_REX (REX_MODE64); - if (rex & REX_MODE64) - s = names64[code - eAX_reg + add]; - else if (sizeflag & DFLAG) - s = names32[code - eAX_reg + add]; - else - s = names16[code - eAX_reg + add]; - used_prefixes |= (prefixes & PREFIX_DATA); - break; - default: - s = INTERNAL_DISASSEMBLER_ERROR; - break; - } - oappend (s); -} - -static void -OP_IMREG (code, sizeflag) - int code; - int sizeflag; -{ - const char *s; - - switch (code) - { - case indir_dx_reg: - if (intel_syntax) - s = "[dx]"; - else - s = "(%dx)"; - break; - case ax_reg: case cx_reg: case dx_reg: case bx_reg: - case sp_reg: case bp_reg: case si_reg: case di_reg: - s = names16[code - ax_reg]; - break; - case es_reg: case ss_reg: case cs_reg: - case ds_reg: case fs_reg: case gs_reg: - s = names_seg[code - es_reg]; - break; - case al_reg: case ah_reg: case cl_reg: case ch_reg: - case dl_reg: case dh_reg: case bl_reg: case bh_reg: - USED_REX (0); - if (rex) - s = names8rex[code - al_reg]; - else - s = names8[code - al_reg]; - break; - case eAX_reg: case eCX_reg: case eDX_reg: case eBX_reg: - case eSP_reg: case eBP_reg: case eSI_reg: case eDI_reg: - USED_REX (REX_MODE64); - if (rex & REX_MODE64) - s = names64[code - eAX_reg]; - else if (sizeflag & DFLAG) - s = names32[code - eAX_reg]; - else - s = names16[code - eAX_reg]; - used_prefixes |= (prefixes & PREFIX_DATA); - break; - default: - s = INTERNAL_DISASSEMBLER_ERROR; - break; - } - oappend (s); -} - -static void -OP_I (bytemode, sizeflag) - int bytemode; - int sizeflag; -{ - bfd_signed_vma op; - bfd_signed_vma mask = -1; - - switch (bytemode) - { - case b_mode: - FETCH_DATA (the_info, codep + 1); - op = *codep++; - mask = 0xff; - break; - case q_mode: - if (mode_64bit) - { - op = get32s (); - break; - } - /* Fall through. */ - case v_mode: - USED_REX (REX_MODE64); - if (rex & REX_MODE64) - op = get32s (); - else if (sizeflag & DFLAG) - { - op = get32 (); - mask = 0xffffffff; - } - else - { - op = get16 (); - mask = 0xfffff; - } - used_prefixes |= (prefixes & PREFIX_DATA); - break; - case w_mode: - mask = 0xfffff; - op = get16 (); - break; - default: - oappend (INTERNAL_DISASSEMBLER_ERROR); - return; - } - - op &= mask; - scratchbuf[0] = '$'; - print_operand_value (scratchbuf + 1, 1, op); - oappend (scratchbuf + intel_syntax); - scratchbuf[0] = '\0'; -} - -static void -OP_I64 (bytemode, sizeflag) - int bytemode; - int sizeflag; -{ - bfd_signed_vma op; - bfd_signed_vma mask = -1; - - if (!mode_64bit) - { - OP_I (bytemode, sizeflag); - return; - } - - switch (bytemode) - { - case b_mode: - FETCH_DATA (the_info, codep + 1); - op = *codep++; - mask = 0xff; - break; - case v_mode: - USED_REX (REX_MODE64); - if (rex & REX_MODE64) - op = get64 (); - else if (sizeflag & DFLAG) - { - op = get32 (); - mask = 0xffffffff; - } - else - { - op = get16 (); - mask = 0xfffff; - } - used_prefixes |= (prefixes & PREFIX_DATA); - break; - case w_mode: - mask = 0xfffff; - op = get16 (); - break; - default: - oappend (INTERNAL_DISASSEMBLER_ERROR); - return; - } - - op &= mask; - scratchbuf[0] = '$'; - print_operand_value (scratchbuf + 1, 1, op); - oappend (scratchbuf + intel_syntax); - scratchbuf[0] = '\0'; -} - -static void -OP_sI (bytemode, sizeflag) - int bytemode; - int sizeflag; -{ - bfd_signed_vma op; - bfd_signed_vma mask = -1; - - switch (bytemode) - { - case b_mode: - FETCH_DATA (the_info, codep + 1); - op = *codep++; - if ((op & 0x80) != 0) - op -= 0x100; - mask = 0xffffffff; - break; - case v_mode: - USED_REX (REX_MODE64); - if (rex & REX_MODE64) - op = get32s (); - else if (sizeflag & DFLAG) - { - op = get32s (); - mask = 0xffffffff; - } - else - { - mask = 0xffffffff; - op = get16 (); - if ((op & 0x8000) != 0) - op -= 0x10000; - } - used_prefixes |= (prefixes & PREFIX_DATA); - break; - case w_mode: - op = get16 (); - mask = 0xffffffff; - if ((op & 0x8000) != 0) - op -= 0x10000; - break; - default: - oappend (INTERNAL_DISASSEMBLER_ERROR); - return; - } - - scratchbuf[0] = '$'; - print_operand_value (scratchbuf + 1, 1, op); - oappend (scratchbuf + intel_syntax); -} - -static void -OP_J (bytemode, sizeflag) - int bytemode; - int sizeflag; -{ - bfd_vma disp; - bfd_vma mask = -1; - - switch (bytemode) - { - case b_mode: - FETCH_DATA (the_info, codep + 1); - disp = *codep++; - if ((disp & 0x80) != 0) - disp -= 0x100; - break; - case v_mode: - if (sizeflag & DFLAG) - disp = get32s (); - else - { - disp = get16 (); - /* For some reason, a data16 prefix on a jump instruction - means that the pc is masked to 16 bits after the - displacement is added! */ - mask = 0xffff; - } - break; - default: - oappend (INTERNAL_DISASSEMBLER_ERROR); - return; - } - disp = (start_pc + codep - start_codep + disp) & mask; - set_op (disp, 0); - print_operand_value (scratchbuf, 1, disp); - oappend (scratchbuf); -} - -static void -OP_SEG (dummy, sizeflag) - int dummy ATTRIBUTE_UNUSED; - int sizeflag ATTRIBUTE_UNUSED; -{ - oappend (names_seg[reg]); -} - -static void -OP_DIR (dummy, sizeflag) - int dummy ATTRIBUTE_UNUSED; - int sizeflag; -{ - int seg, offset; - - if (sizeflag & DFLAG) - { - offset = get32 (); - seg = get16 (); - } - else - { - offset = get16 (); - seg = get16 (); - } - used_prefixes |= (prefixes & PREFIX_DATA); - if (intel_syntax) - sprintf (scratchbuf, "0x%x,0x%x", seg, offset); - else - sprintf (scratchbuf, "$0x%x,$0x%x", seg, offset); - oappend (scratchbuf); -} - -static void -OP_OFF (bytemode, sizeflag) - int bytemode ATTRIBUTE_UNUSED; - int sizeflag; -{ - bfd_vma off; - - append_seg (); - - if ((sizeflag & AFLAG) || mode_64bit) - off = get32 (); - else - off = get16 (); - - if (intel_syntax) - { - if (!(prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS - | PREFIX_ES | PREFIX_FS | PREFIX_GS))) - { - oappend (names_seg[ds_reg - es_reg]); - oappend (":"); - } - } - print_operand_value (scratchbuf, 1, off); - oappend (scratchbuf); -} - -static void -OP_OFF64 (bytemode, sizeflag) - int bytemode ATTRIBUTE_UNUSED; - int sizeflag ATTRIBUTE_UNUSED; -{ - bfd_vma off; - - if (!mode_64bit) - { - OP_OFF (bytemode, sizeflag); - return; - } - - append_seg (); - - off = get64 (); - - if (intel_syntax) - { - if (!(prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS - | PREFIX_ES | PREFIX_FS | PREFIX_GS))) - { - oappend (names_seg[ds_reg - es_reg]); - oappend (":"); - } - } - print_operand_value (scratchbuf, 1, off); - oappend (scratchbuf); -} - -static void -ptr_reg (code, sizeflag) - int code; - int sizeflag; -{ - const char *s; - if (intel_syntax) - oappend ("["); - else - oappend ("("); - - USED_REX (REX_MODE64); - if (rex & REX_MODE64) - { - if (!(sizeflag & AFLAG)) - s = names32[code - eAX_reg]; - else - s = names64[code - eAX_reg]; - } - else if (sizeflag & AFLAG) - s = names32[code - eAX_reg]; - else - s = names16[code - eAX_reg]; - oappend (s); - if (intel_syntax) - oappend ("]"); - else - oappend (")"); -} - -static void -OP_ESreg (code, sizeflag) - int code; - int sizeflag; -{ - oappend ("%es:" + intel_syntax); - ptr_reg (code, sizeflag); -} - -static void -OP_DSreg (code, sizeflag) - int code; - int sizeflag; -{ - if ((prefixes - & (PREFIX_CS - | PREFIX_DS - | PREFIX_SS - | PREFIX_ES - | PREFIX_FS - | PREFIX_GS)) == 0) - prefixes |= PREFIX_DS; - append_seg (); - ptr_reg (code, sizeflag); -} - -static void -OP_C (dummy, sizeflag) - int dummy ATTRIBUTE_UNUSED; - int sizeflag ATTRIBUTE_UNUSED; -{ - int add = 0; - USED_REX (REX_EXTX); - if (rex & REX_EXTX) - add = 8; - sprintf (scratchbuf, "%%cr%d", reg + add); - oappend (scratchbuf + intel_syntax); -} - -static void -OP_D (dummy, sizeflag) - int dummy ATTRIBUTE_UNUSED; - int sizeflag ATTRIBUTE_UNUSED; -{ - int add = 0; - USED_REX (REX_EXTX); - if (rex & REX_EXTX) - add = 8; - if (intel_syntax) - sprintf (scratchbuf, "db%d", reg + add); - else - sprintf (scratchbuf, "%%db%d", reg + add); - oappend (scratchbuf); -} - -static void -OP_T (dummy, sizeflag) - int dummy ATTRIBUTE_UNUSED; - int sizeflag ATTRIBUTE_UNUSED; -{ - sprintf (scratchbuf, "%%tr%d", reg); - oappend (scratchbuf + intel_syntax); -} - -static void -OP_Rd (bytemode, sizeflag) - int bytemode; - int sizeflag; -{ - if (mod == 3) - OP_E (bytemode, sizeflag); - else - BadOp (); -} - -static void -OP_MMX (bytemode, sizeflag) - int bytemode ATTRIBUTE_UNUSED; - int sizeflag ATTRIBUTE_UNUSED; -{ - int add = 0; - USED_REX (REX_EXTX); - if (rex & REX_EXTX) - add = 8; - used_prefixes |= (prefixes & PREFIX_DATA); - if (prefixes & PREFIX_DATA) - sprintf (scratchbuf, "%%xmm%d", reg + add); - else - sprintf (scratchbuf, "%%mm%d", reg + add); - oappend (scratchbuf + intel_syntax); -} - -static void -OP_XMM (bytemode, sizeflag) - int bytemode ATTRIBUTE_UNUSED; - int sizeflag ATTRIBUTE_UNUSED; -{ - int add = 0; - USED_REX (REX_EXTX); - if (rex & REX_EXTX) - add = 8; - sprintf (scratchbuf, "%%xmm%d", reg + add); - oappend (scratchbuf + intel_syntax); -} - -static void -OP_EM (bytemode, sizeflag) - int bytemode; - int sizeflag; -{ - int add = 0; - if (mod != 3) - { - OP_E (bytemode, sizeflag); - return; - } - USED_REX (REX_EXTZ); - if (rex & REX_EXTZ) - add = 8; - - /* Skip mod/rm byte. */ - MODRM_CHECK; - codep++; - used_prefixes |= (prefixes & PREFIX_DATA); - if (prefixes & PREFIX_DATA) - sprintf (scratchbuf, "%%xmm%d", rm + add); - else - sprintf (scratchbuf, "%%mm%d", rm + add); - oappend (scratchbuf + intel_syntax); -} - -static void -OP_EX (bytemode, sizeflag) - int bytemode; - int sizeflag; -{ - int add = 0; - if (mod != 3) - { - OP_E (bytemode, sizeflag); - return; - } - USED_REX (REX_EXTZ); - if (rex & REX_EXTZ) - add = 8; - - /* Skip mod/rm byte. */ - MODRM_CHECK; - codep++; - sprintf (scratchbuf, "%%xmm%d", rm + add); - oappend (scratchbuf + intel_syntax); -} - -static void -OP_MS (bytemode, sizeflag) - int bytemode; - int sizeflag; -{ - if (mod == 3) - OP_EM (bytemode, sizeflag); - else - BadOp (); -} - -static void -OP_XS (bytemode, sizeflag) - int bytemode; - int sizeflag; -{ - if (mod == 3) - OP_EX (bytemode, sizeflag); - else - BadOp (); -} - -static const char *Suffix3DNow[] = { -/* 00 */ NULL, NULL, NULL, NULL, -/* 04 */ NULL, NULL, NULL, NULL, -/* 08 */ NULL, NULL, NULL, NULL, -/* 0C */ "pi2fw", "pi2fd", NULL, NULL, -/* 10 */ NULL, NULL, NULL, NULL, -/* 14 */ NULL, NULL, NULL, NULL, -/* 18 */ NULL, NULL, NULL, NULL, -/* 1C */ "pf2iw", "pf2id", NULL, NULL, -/* 20 */ NULL, NULL, NULL, NULL, -/* 24 */ NULL, NULL, NULL, NULL, -/* 28 */ NULL, NULL, NULL, NULL, -/* 2C */ NULL, NULL, NULL, NULL, -/* 30 */ NULL, NULL, NULL, NULL, -/* 34 */ NULL, NULL, NULL, NULL, -/* 38 */ NULL, NULL, NULL, NULL, -/* 3C */ NULL, NULL, NULL, NULL, -/* 40 */ NULL, NULL, NULL, NULL, -/* 44 */ NULL, NULL, NULL, NULL, -/* 48 */ NULL, NULL, NULL, NULL, -/* 4C */ NULL, NULL, NULL, NULL, -/* 50 */ NULL, NULL, NULL, NULL, -/* 54 */ NULL, NULL, NULL, NULL, -/* 58 */ NULL, NULL, NULL, NULL, -/* 5C */ NULL, NULL, NULL, NULL, -/* 60 */ NULL, NULL, NULL, NULL, -/* 64 */ NULL, NULL, NULL, NULL, -/* 68 */ NULL, NULL, NULL, NULL, -/* 6C */ NULL, NULL, NULL, NULL, -/* 70 */ NULL, NULL, NULL, NULL, -/* 74 */ NULL, NULL, NULL, NULL, -/* 78 */ NULL, NULL, NULL, NULL, -/* 7C */ NULL, NULL, NULL, NULL, -/* 80 */ NULL, NULL, NULL, NULL, -/* 84 */ NULL, NULL, NULL, NULL, -/* 88 */ NULL, NULL, "pfnacc", NULL, -/* 8C */ NULL, NULL, "pfpnacc", NULL, -/* 90 */ "pfcmpge", NULL, NULL, NULL, -/* 94 */ "pfmin", NULL, "pfrcp", "pfrsqrt", -/* 98 */ NULL, NULL, "pfsub", NULL, -/* 9C */ NULL, NULL, "pfadd", NULL, -/* A0 */ "pfcmpgt", NULL, NULL, NULL, -/* A4 */ "pfmax", NULL, "pfrcpit1", "pfrsqit1", -/* A8 */ NULL, NULL, "pfsubr", NULL, -/* AC */ NULL, NULL, "pfacc", NULL, -/* B0 */ "pfcmpeq", NULL, NULL, NULL, -/* B4 */ "pfmul", NULL, "pfrcpit2", "pfmulhrw", -/* B8 */ NULL, NULL, NULL, "pswapd", -/* BC */ NULL, NULL, NULL, "pavgusb", -/* C0 */ NULL, NULL, NULL, NULL, -/* C4 */ NULL, NULL, NULL, NULL, -/* C8 */ NULL, NULL, NULL, NULL, -/* CC */ NULL, NULL, NULL, NULL, -/* D0 */ NULL, NULL, NULL, NULL, -/* D4 */ NULL, NULL, NULL, NULL, -/* D8 */ NULL, NULL, NULL, NULL, -/* DC */ NULL, NULL, NULL, NULL, -/* E0 */ NULL, NULL, NULL, NULL, -/* E4 */ NULL, NULL, NULL, NULL, -/* E8 */ NULL, NULL, NULL, NULL, -/* EC */ NULL, NULL, NULL, NULL, -/* F0 */ NULL, NULL, NULL, NULL, -/* F4 */ NULL, NULL, NULL, NULL, -/* F8 */ NULL, NULL, NULL, NULL, -/* FC */ NULL, NULL, NULL, NULL, -}; - -static void -OP_3DNowSuffix (bytemode, sizeflag) - int bytemode ATTRIBUTE_UNUSED; - int sizeflag ATTRIBUTE_UNUSED; -{ - const char *mnemonic; - - FETCH_DATA (the_info, codep + 1); - /* AMD 3DNow! instructions are specified by an opcode suffix in the - place where an 8-bit immediate would normally go. ie. the last - byte of the instruction. */ - obufp = obuf + strlen (obuf); - mnemonic = Suffix3DNow[*codep++ & 0xff]; - if (mnemonic) - oappend (mnemonic); - else - { - /* Since a variable sized modrm/sib chunk is between the start - of the opcode (0x0f0f) and the opcode suffix, we need to do - all the modrm processing first, and don't know until now that - we have a bad opcode. This necessitates some cleaning up. */ - op1out[0] = '\0'; - op2out[0] = '\0'; - BadOp (); - } -} - -static const char *simd_cmp_op[] = { - "eq", - "lt", - "le", - "unord", - "neq", - "nlt", - "nle", - "ord" -}; - -static void -OP_SIMD_Suffix (bytemode, sizeflag) - int bytemode ATTRIBUTE_UNUSED; - int sizeflag ATTRIBUTE_UNUSED; -{ - unsigned int cmp_type; - - FETCH_DATA (the_info, codep + 1); - obufp = obuf + strlen (obuf); - cmp_type = *codep++ & 0xff; - if (cmp_type < 8) - { - char suffix1 = 'p', suffix2 = 's'; - used_prefixes |= (prefixes & PREFIX_REPZ); - if (prefixes & PREFIX_REPZ) - suffix1 = 's'; - else - { - used_prefixes |= (prefixes & PREFIX_DATA); - if (prefixes & PREFIX_DATA) - suffix2 = 'd'; - else - { - used_prefixes |= (prefixes & PREFIX_REPNZ); - if (prefixes & PREFIX_REPNZ) - suffix1 = 's', suffix2 = 'd'; - } - } - sprintf (scratchbuf, "cmp%s%c%c", - simd_cmp_op[cmp_type], suffix1, suffix2); - used_prefixes |= (prefixes & PREFIX_REPZ); - oappend (scratchbuf); - } - else - { - /* We have a bad extension byte. Clean up. */ - op1out[0] = '\0'; - op2out[0] = '\0'; - BadOp (); - } -} - -static void -SIMD_Fixup (extrachar, sizeflag) - int extrachar; - int sizeflag ATTRIBUTE_UNUSED; -{ - /* Change movlps/movhps to movhlps/movlhps for 2 register operand - forms of these instructions. */ - if (mod == 3) - { - char *p = obuf + strlen (obuf); - *(p + 1) = '\0'; - *p = *(p - 1); - *(p - 1) = *(p - 2); - *(p - 2) = *(p - 3); - *(p - 3) = extrachar; - } -} - -static void -BadOp (void) -{ - /* Throw away prefixes and 1st. opcode byte. */ - codep = insn_codep + 1; - oappend ("(bad)"); -} diff --git a/cxmon/src/disass/m68k-dis.c b/cxmon/src/disass/m68k-dis.c deleted file mode 100644 index 3e10c8c2..00000000 --- a/cxmon/src/disass/m68k-dis.c +++ /dev/null @@ -1,1248 +0,0 @@ -/* Print Motorola 68k instructions. - Copyright 1986, 87, 89, 91, 92, 93, 94, 95, 96, 97, 1998 - Free Software Foundation, Inc. - -This file is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include -#include "dis-asm.h" -#include "floatformat.h" -#include "opintl.h" - -#include "m68k.h" - -/* Local function prototypes */ - -static int -fetch_data PARAMS ((struct disassemble_info *, bfd_byte *)); - -static void -dummy_print_address PARAMS ((bfd_vma, struct disassemble_info *)); - -static int -fetch_arg PARAMS ((unsigned char *, int, int, disassemble_info *)); - -static void -print_base PARAMS ((int, bfd_vma, disassemble_info*)); - -static unsigned char * -print_indexed PARAMS ((int, unsigned char *, bfd_vma, disassemble_info *)); - -static int -print_insn_arg PARAMS ((const char *, unsigned char *, unsigned char *, - bfd_vma, disassemble_info *)); - -CONST char * CONST fpcr_names[] = { - "", "fpiar", "fpsr", "fpiar/fpsr", "fpcr", - "fpiar/fpcr", "fpsr/fpcr", "fpiar/fpsr/fpcr"}; - -static char *const reg_names[] = { - "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", - "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", - "sr", "pc"}; - -/* Sign-extend an (unsigned char). */ -#if __STDC__ == 1 -#define COERCE_SIGNED_CHAR(ch) ((signed char)(ch)) -#else -#define COERCE_SIGNED_CHAR(ch) ((int)(((ch) ^ 0x80) & 0xFF) - 128) -#endif - -/* Get a 1 byte signed integer. */ -#define NEXTBYTE(p) (p += 2, FETCH_DATA (info, p), COERCE_SIGNED_CHAR(p[-1])) - -/* Get a 2 byte signed integer. */ -#define COERCE16(x) ((int) (((x) ^ 0x8000) - 0x8000)) -#define NEXTWORD(p) \ - (p += 2, FETCH_DATA (info, p), \ - COERCE16 ((p[-2] << 8) + p[-1])) - -/* Get a 4 byte signed integer. */ -#define COERCE32(x) ((bfd_signed_vma) ((x) ^ 0x80000000) - 0x80000000) -#define NEXTLONG(p) \ - (p += 4, FETCH_DATA (info, p), \ - (COERCE32 ((((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1]))) - -/* Get a 4 byte unsigned integer. */ -#define NEXTULONG(p) \ - (p += 4, FETCH_DATA (info, p), \ - (unsigned int) ((((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1])) - -/* Get a single precision float. */ -#define NEXTSINGLE(val, p) \ - (p += 4, FETCH_DATA (info, p), \ - floatformat_to_double (&floatformat_ieee_single_big, (char *) p - 4, &val)) - -/* Get a double precision float. */ -#define NEXTDOUBLE(val, p) \ - (p += 8, FETCH_DATA (info, p), \ - floatformat_to_double (&floatformat_ieee_double_big, (char *) p - 8, &val)) - -/* Get an extended precision float. */ -#define NEXTEXTEND(val, p) \ - (p += 12, FETCH_DATA (info, p), \ - floatformat_to_double (&floatformat_m68881_ext, (char *) p - 12, &val)) - -/* Need a function to convert from packed to double - precision. Actually, it's easier to print a - packed number than a double anyway, so maybe - there should be a special case to handle this... */ -#define NEXTPACKED(p) \ - (p += 12, FETCH_DATA (info, p), 0.0) - - -/* Maximum length of an instruction. */ -#define MAXLEN 22 - -#include - -struct private -{ - /* Points to first byte not fetched. */ - bfd_byte *max_fetched; - bfd_byte the_buffer[MAXLEN]; - bfd_vma insn_start; - jmp_buf bailout; -}; - -/* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive) - to ADDR (exclusive) are valid. Returns 1 for success, longjmps - on error. */ -#define FETCH_DATA(info, addr) \ - ((addr) <= ((struct private *)(info->private_data))->max_fetched \ - ? 1 : fetch_data ((info), (addr))) - -static int -fetch_data (info, addr) - struct disassemble_info *info; - bfd_byte *addr; -{ - int status; - struct private *priv = (struct private *)info->private_data; - bfd_vma start = priv->insn_start + (priv->max_fetched - priv->the_buffer); - - status = (*info->read_memory_func) (start, - priv->max_fetched, - addr - priv->max_fetched, - info); - if (status != 0) - { - (*info->memory_error_func) (status, start, info); - longjmp (priv->bailout, 1); - } - else - priv->max_fetched = addr; - return 1; -} - -/* This function is used to print to the bit-bucket. */ -static int -#ifdef __STDC__ -dummy_printer (FILE * file, const char * format, ...) -#else -dummy_printer (file) FILE *file; -#endif - { return 0; } - -static void -dummy_print_address (vma, info) - bfd_vma vma; - struct disassemble_info *info; -{ -} - -/* Print the m68k instruction at address MEMADDR in debugged memory, - on INFO->STREAM. Returns length of the instruction, in bytes. */ - -int -print_insn_m68k (memaddr, info) - bfd_vma memaddr; - disassemble_info *info; -{ - register int i; - register unsigned char *p; - unsigned char *save_p; - register const char *d; - register unsigned long bestmask; - const struct m68k_opcode *best = 0; - unsigned int arch_mask; - struct private priv; - bfd_byte *buffer = priv.the_buffer; - fprintf_ftype save_printer = info->fprintf_func; - void (*save_print_address) PARAMS((bfd_vma, struct disassemble_info*)) - = info->print_address_func; - int major_opcode; - static int numopcodes[16]; - static const struct m68k_opcode **opcodes[16]; - - if (!opcodes[0]) - { - /* Speed up the matching by sorting the opcode table on the upper - four bits of the opcode. */ - const struct m68k_opcode **opc_pointer[16]; - - /* First count how many opcodes are in each of the sixteen buckets. */ - for (i = 0; i < m68k_numopcodes; i++) - numopcodes[(m68k_opcodes[i].opcode >> 28) & 15]++; - - /* Then create a sorted table of pointers that point into the - unsorted table. */ - opc_pointer[0] = ((const struct m68k_opcode **) - malloc (sizeof (struct m68k_opcode *) - * m68k_numopcodes)); - opcodes[0] = opc_pointer[0]; - for (i = 1; i < 16; i++) - { - opc_pointer[i] = opc_pointer[i - 1] + numopcodes[i - 1]; - opcodes[i] = opc_pointer[i]; - } - - for (i = 0; i < m68k_numopcodes; i++) - *opc_pointer[(m68k_opcodes[i].opcode >> 28) & 15]++ = &m68k_opcodes[i]; - - } - - info->private_data = (PTR) &priv; - /* Tell objdump to use two bytes per chunk and six bytes per line for - displaying raw data. */ - info->bytes_per_chunk = 2; - info->bytes_per_line = 6; - info->display_endian = BFD_ENDIAN_BIG; - priv.max_fetched = priv.the_buffer; - priv.insn_start = memaddr; - if (setjmp (priv.bailout) != 0) - /* Error return. */ - return -1; - - switch (info->mach) - { - default: - case 0: - arch_mask = (unsigned int) -1; - break; - case bfd_mach_m68000: - arch_mask = m68000; - break; - case bfd_mach_m68008: - arch_mask = m68008; - break; - case bfd_mach_m68010: - arch_mask = m68010; - break; - case bfd_mach_m68020: - arch_mask = m68020; - break; - case bfd_mach_m68030: - arch_mask = m68030; - break; - case bfd_mach_m68040: - arch_mask = m68040; - break; - case bfd_mach_m68060: - arch_mask = m68060; - break; - } - - arch_mask |= m68881 | m68851; - - bestmask = 0; - FETCH_DATA (info, buffer + 2); - major_opcode = (buffer[0] >> 4) & 15; - for (i = 0; i < numopcodes[major_opcode]; i++) - { - const struct m68k_opcode *opc = opcodes[major_opcode][i]; - unsigned long opcode = opc->opcode; - unsigned long match = opc->match; - - if (((0xff & buffer[0] & (match >> 24)) == (0xff & (opcode >> 24))) - && ((0xff & buffer[1] & (match >> 16)) == (0xff & (opcode >> 16))) - /* Only fetch the next two bytes if we need to. */ - && (((0xffff & match) == 0) - || - (FETCH_DATA (info, buffer + 4) - && ((0xff & buffer[2] & (match >> 8)) == (0xff & (opcode >> 8))) - && ((0xff & buffer[3] & match) == (0xff & opcode))) - ) - && (opc->arch & arch_mask) != 0) - { - /* Don't use for printout the variants of divul and divsl - that have the same register number in two places. - The more general variants will match instead. */ - for (d = opc->args; *d; d += 2) - if (d[1] == 'D') - break; - - /* Don't use for printout the variants of most floating - point coprocessor instructions which use the same - register number in two places, as above. */ - if (*d == '\0') - for (d = opc->args; *d; d += 2) - if (d[1] == 't') - break; - - /* Don't match fmovel with more than one register; wait for - fmoveml. */ - if (*d == '\0') - { - for (d = opc->args; *d; d += 2) - { - if (d[0] == 's' && d[1] == '8') - { - int val; - - val = fetch_arg (buffer, d[1], 3, info); - if ((val & (val - 1)) != 0) - break; - } - } - } - - if (*d == '\0' && match > bestmask) - { - best = opc; - bestmask = match; - } - } - } - - if (best == 0) - goto invalid; - - /* Point at first word of argument data, - and at descriptor for first argument. */ - p = buffer + 2; - - /* Figure out how long the fixed-size portion of the instruction is. - The only place this is stored in the opcode table is - in the arguments--look for arguments which specify fields in the 2nd - or 3rd words of the instruction. */ - for (d = best->args; *d; d += 2) - { - /* I don't think it is necessary to be checking d[0] here; I suspect - all this could be moved to the case statement below. */ - if (d[0] == '#') - { - if (d[1] == 'l' && p - buffer < 6) - p = buffer + 6; - else if (p - buffer < 4 && d[1] != 'C' && d[1] != '8' ) - p = buffer + 4; - } - if ((d[0] == 'L' || d[0] == 'l') && d[1] == 'w' && p - buffer < 4) - p = buffer + 4; - switch (d[1]) - { - case '1': - case '2': - case '3': - case '7': - case '8': - case '9': - case 'i': - if (p - buffer < 4) - p = buffer + 4; - break; - case '4': - case '5': - case '6': - if (p - buffer < 6) - p = buffer + 6; - break; - default: - break; - } - } - - /* pflusha is an exceptions. It takes no arguments but is two words - long. Recognize it by looking at the lower 16 bits of the mask. */ - if (p - buffer < 4 && (best->match & 0xFFFF) != 0) - p = buffer + 4; - - /* lpstop is another exception. It takes a one word argument but is - three words long. */ - if (p - buffer < 6 - && (best->match & 0xffff) == 0xffff - && best->args[0] == '#' - && best->args[1] == 'w') - { - /* Copy the one word argument into the usual location for a one - word argument, to simplify printing it. We can get away with - this because we know exactly what the second word is, and we - aren't going to print anything based on it. */ - p = buffer + 6; - FETCH_DATA (info, p); - buffer[2] = buffer[4]; - buffer[3] = buffer[5]; - } - - FETCH_DATA (info, p); - - d = best->args; - - /* We can the operands twice. The first time we don't print anything, - but look for errors. */ - - save_p = p; - info->print_address_func = dummy_print_address; - info->fprintf_func = (fprintf_ftype)dummy_printer; - for ( ; *d; d += 2) - { - int eaten = print_insn_arg (d, buffer, p, memaddr + (p - buffer), info); - if (eaten >= 0) - p += eaten; - else if (eaten == -1) - goto invalid; - else - { - (*info->fprintf_func)(info->stream, - /* xgettext:c-format */ - _("\n"), - best->name, - best->args); - goto invalid; - } - - } - p = save_p; - info->fprintf_func = save_printer; - info->print_address_func = save_print_address; - - d = best->args; - - (*info->fprintf_func) (info->stream, "%s", best->name); - - if (*d) - (*info->fprintf_func) (info->stream, "\t"); - - while (*d) - { - p += print_insn_arg (d, buffer, p, memaddr + (p - buffer), info); - d += 2; - if (*d && *(d - 2) != 'I' && *d != 'k') - (*info->fprintf_func) (info->stream, ","); - } - return p - buffer; - -invalid: { - extern void print_68k_invalid_opcode(unsigned long, struct disassemble_info *); - - /* Handle undefined instructions. */ - info->fprintf_func = save_printer; - info->print_address_func = save_print_address; - print_68k_invalid_opcode((buffer[0] << 8) | buffer[1], info); - return 2; - } -} - -/* Returns number of bytes "eaten" by the operand, or - return -1 if an invalid operand was found, or -2 if - an opcode tabe error was found. */ - -static int -print_insn_arg (d, buffer, p0, addr, info) - const char *d; - unsigned char *buffer; - unsigned char *p0; - bfd_vma addr; /* PC for this arg to be relative to */ - disassemble_info *info; -{ - register int val = 0; - register int place = d[1]; - register unsigned char *p = p0; - int regno; - register CONST char *regname; - register unsigned char *p1; - double flval; - int flt_p; - bfd_signed_vma disp; - unsigned int uval; - - switch (*d) - { - case 'c': /* cache identifier */ - { - static char *const cacheFieldName[] = { "nc", "dc", "ic", "bc" }; - val = fetch_arg (buffer, place, 2, info); - (*info->fprintf_func) (info->stream, cacheFieldName[val]); - break; - } - - case 'a': /* address register indirect only. Cf. case '+'. */ - { - (*info->fprintf_func) - (info->stream, - "(%s)", - reg_names [fetch_arg (buffer, place, 3, info) + 8]); - break; - } - - case '_': /* 32-bit absolute address for move16. */ - { - uval = NEXTULONG (p); - (*info->print_address_func) (uval, info); - break; - } - - case 'C': - (*info->fprintf_func) (info->stream, "ccr"); - break; - - case 'S': - (*info->fprintf_func) (info->stream, "sr"); - break; - - case 'U': - (*info->fprintf_func) (info->stream, "usp"); - break; - - case 'J': - { - static const struct { char *name; int value; } names[] - = {{"sfc", 0x000}, {"dfc", 0x001}, {"cacr", 0x002}, - {"tc", 0x003}, {"itt0",0x004}, {"itt1", 0x005}, - {"dtt0",0x006}, {"dtt1",0x007}, {"buscr",0x008}, - {"usp", 0x800}, {"vbr", 0x801}, {"caar", 0x802}, - {"msp", 0x803}, {"isp", 0x804}, - - /* Should we be calling this psr like we do in case 'Y'? */ - {"mmusr",0x805}, - - {"urp", 0x806}, {"srp", 0x807}, {"pcr", 0x808}}; - - val = fetch_arg (buffer, place, 12, info); - for (regno = sizeof names / sizeof names[0] - 1; regno >= 0; regno--) - if (names[regno].value == val) - { - (*info->fprintf_func) (info->stream, "%s", names[regno].name); - break; - } - if (regno < 0) - (*info->fprintf_func) (info->stream, "$%04x", val); - } - break; - - case 'Q': - val = fetch_arg (buffer, place, 3, info); - /* 0 means 8, except for the bkpt instruction... */ - if (val == 0 && d[1] != 's') - val = 8; - (*info->fprintf_func) (info->stream, "#%d", val); - break; - - case 'M': - val = fetch_arg (buffer, place, 8, info); - if (val & 0x80) - val = val - 0x100; - (*info->fprintf_func) (info->stream, "#$%02x", val); - break; - - case 'T': - val = fetch_arg (buffer, place, 4, info); - (*info->fprintf_func) (info->stream, "#$%08x", val); - break; - - case 'D': - (*info->fprintf_func) (info->stream, "%s", - reg_names[fetch_arg (buffer, place, 3, info)]); - break; - - case 'A': - (*info->fprintf_func) - (info->stream, "%s", - reg_names[fetch_arg (buffer, place, 3, info) + 010]); - break; - - case 'R': - (*info->fprintf_func) - (info->stream, "%s", - reg_names[fetch_arg (buffer, place, 4, info)]); - break; - - case 'r': - regno = fetch_arg (buffer, place, 4, info); - (*info->fprintf_func) (info->stream, "(%s)", reg_names[regno]); - break; - - case 'F': - (*info->fprintf_func) - (info->stream, "fp%d", - fetch_arg (buffer, place, 3, info)); - break; - - case 'O': - val = fetch_arg (buffer, place, 6, info); - if (val & 0x20) - (*info->fprintf_func) (info->stream, "%s", reg_names [val & 7]); - else - (*info->fprintf_func) (info->stream, "%d", val); - break; - - case '+': - (*info->fprintf_func) - (info->stream, "(%s)+", - reg_names[fetch_arg (buffer, place, 3, info) + 8]); - break; - - case '-': - (*info->fprintf_func) - (info->stream, "-(%s)", - reg_names[fetch_arg (buffer, place, 3, info) + 8]); - break; - - case 'k': - if (place == 'k') - (*info->fprintf_func) - (info->stream, "{%s}", - reg_names[fetch_arg (buffer, place, 3, info)]); - else if (place == 'C') - { - val = fetch_arg (buffer, place, 7, info); - if ( val > 63 ) /* This is a signed constant. */ - val -= 128; - (*info->fprintf_func) (info->stream, "{#%d}", val); - } - else - return -2; - break; - - case '#': - case '^': - p1 = buffer + (*d == '#' ? 2 : 4); - if (place == 's') - val = fetch_arg (buffer, place, 4, info); - else if (place == 'C') - val = fetch_arg (buffer, place, 7, info); - else if (place == '8') - val = fetch_arg (buffer, place, 3, info); - else if (place == '3') - val = fetch_arg (buffer, place, 8, info); - else if (place == 'b') { - val = NEXTBYTE (p1); - (*info->fprintf_func) (info->stream, "#$%02x", val & 0xff); - break; - } - else if (place == 'w' || place == 'W') { - val = NEXTWORD (p1); - (*info->fprintf_func) (info->stream, "#$%04x", val & 0xffff); - break; - } - else if (place == 'l') { - val = NEXTLONG (p1); - (*info->fprintf_func) (info->stream, "#$%08x", val); - break; - } - else - return -2; - (*info->fprintf_func) (info->stream, "#%d", val); - break; - - case 'B': - if (place == 'b') - disp = NEXTBYTE (p); - else if (place == 'B') - disp = COERCE_SIGNED_CHAR(buffer[1]); - else if (place == 'w' || place == 'W') - disp = NEXTWORD (p); - else if (place == 'l' || place == 'L' || place == 'C') - disp = NEXTLONG (p); - else if (place == 'g') - { - disp = NEXTBYTE (buffer); - if (disp == 0) - disp = NEXTWORD (p); - else if (disp == -1) - disp = NEXTLONG (p); - } - else if (place == 'c') - { - if (buffer[1] & 0x40) /* If bit six is one, long offset */ - disp = NEXTLONG (p); - else - disp = NEXTWORD (p); - } - else - return -2; - - (*info->print_address_func) (addr + disp, info); - break; - - case 'd': - val = NEXTWORD (p); - (*info->fprintf_func) - (info->stream, "($%04x,%s)", - val, reg_names[fetch_arg (buffer, place, 3, info) + 8]); - break; - - case 's': - (*info->fprintf_func) (info->stream, "%s", - fpcr_names[fetch_arg (buffer, place, 3, info)]); - break; - - case 'I': - /* Get coprocessor ID... */ - val = fetch_arg (buffer, 'd', 3, info); - - if (val != 1) /* Unusual coprocessor ID? */ - (*info->fprintf_func) (info->stream, "(cpid=%d) ", val); - break; - - case '*': - case '~': - case '%': - case ';': - case '@': - case '!': - case '$': - case '?': - case '/': - case '&': - case '|': - case '<': - case '>': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'v': - - if (place == 'd') - { - val = fetch_arg (buffer, 'x', 6, info); - val = ((val & 7) << 3) + ((val >> 3) & 7); - } - else - val = fetch_arg (buffer, 's', 6, info); - - /* Get register number assuming address register. */ - regno = (val & 7) + 8; - regname = reg_names[regno]; - switch (val >> 3) - { - case 0: - (*info->fprintf_func) (info->stream, "%s", reg_names[val]); - break; - - case 1: - (*info->fprintf_func) (info->stream, "%s", regname); - break; - - case 2: - (*info->fprintf_func) (info->stream, "(%s)", regname); - break; - - case 3: - (*info->fprintf_func) (info->stream, "(%s)+", regname); - break; - - case 4: - (*info->fprintf_func) (info->stream, "-(%s)", regname); - break; - - case 5: - val = NEXTWORD (p); - (*info->fprintf_func) (info->stream, "($%04x,%s)", val, regname); - break; - - case 6: - p = print_indexed (regno, p, addr, info); - break; - - case 7: - switch (val & 7) - { - case 0: - val = NEXTWORD (p); - (*info->print_address_func) (val, info); - break; - - case 1: - uval = NEXTULONG (p); - (*info->print_address_func) (uval, info); - break; - - case 2: - val = NEXTWORD (p); - (*info->fprintf_func) (info->stream, "("); - (*info->print_address_func) (addr + val, info); - (*info->fprintf_func) (info->stream, ",pc)"); - break; - - case 3: - p = print_indexed (-1, p, addr, info); - break; - - case 4: - switch( place ) - { - case 'b': - val = NEXTBYTE (p); - (*info->fprintf_func) (info->stream, "#$%02x", val & 0xff); - goto imm_printed; - - case 'w': - val = NEXTWORD (p); - (*info->fprintf_func) (info->stream, "#$%04x", val & 0xffff); - goto imm_printed; - - case 'l': - val = NEXTLONG (p); - (*info->fprintf_func) (info->stream, "#$%08x", val); - goto imm_printed; - - case 'f': - NEXTSINGLE(flval, p); - break; - - case 'F': - NEXTDOUBLE(flval, p); - break; - - case 'x': - NEXTEXTEND(flval, p); - break; - - case 'p': - flval = NEXTPACKED(p); - break; - - default: - return -1; - } - (*info->fprintf_func) (info->stream, "#%g", flval); -imm_printed: - break; - - default: - return -1; - } - } - break; - - case 'L': - case 'l': - if (place == 'w') - { - char doneany; - p1 = buffer + 2; - val = NEXTWORD (p1); - /* Move the pointer ahead if this point is farther ahead - than the last. */ - p = p1 > p ? p1 : p; - if (val == 0) - { - (*info->fprintf_func) (info->stream, "#0"); - break; - } - if (*d == 'l') - { - register int newval = 0; - for (regno = 0; regno < 16; ++regno) - if (val & (0x8000 >> regno)) - newval |= 1 << regno; - val = newval; - } - val &= 0xffff; - doneany = 0; - for (regno = 0; regno < 16; ++regno) - if (val & (1 << regno)) - { - int first_regno; - if (doneany) - (*info->fprintf_func) (info->stream, "/"); - doneany = 1; - (*info->fprintf_func) (info->stream, "%s", reg_names[regno]); - first_regno = regno; - while (val & (1 << (regno + 1))) - ++regno; - if (regno > first_regno) - (*info->fprintf_func) (info->stream, "-%s", - reg_names[regno]); - } - } - else if (place == '3') - { - /* `fmovem' insn. */ - char doneany; - val = fetch_arg (buffer, place, 8, info); - if (val == 0) - { - (*info->fprintf_func) (info->stream, "#0"); - break; - } - if (*d == 'l') - { - register int newval = 0; - for (regno = 0; regno < 8; ++regno) - if (val & (0x80 >> regno)) - newval |= 1 << regno; - val = newval; - } - val &= 0xff; - doneany = 0; - for (regno = 0; regno < 8; ++regno) - if (val & (1 << regno)) - { - int first_regno; - if (doneany) - (*info->fprintf_func) (info->stream, "/"); - doneany = 1; - (*info->fprintf_func) (info->stream, "fp%d", regno); - first_regno = regno; - while (val & (1 << (regno + 1))) - ++regno; - if (regno > first_regno) - (*info->fprintf_func) (info->stream, "-fp%d", regno); - } - } - else if (place == '8') - { - /* fmoveml for FP status registers */ - (*info->fprintf_func) (info->stream, "%s", - fpcr_names[fetch_arg (buffer, place, 3, - info)]); - } - else - return -2; - break; - - case 'X': - place = '8'; - case 'Y': - case 'Z': - case 'W': - case '0': - case '1': - case '2': - case '3': - { - int val = fetch_arg (buffer, place, 5, info); - char *name = 0; - switch (val) - { - case 2: name = "tt0"; break; - case 3: name = "tt1"; break; - case 0x10: name = "tc"; break; - case 0x11: name = "drp"; break; - case 0x12: name = "srp"; break; - case 0x13: name = "crp"; break; - case 0x14: name = "cal"; break; - case 0x15: name = "val"; break; - case 0x16: name = "scc"; break; - case 0x17: name = "ac"; break; - case 0x18: name = "psr"; break; - case 0x19: name = "pcsr"; break; - case 0x1c: - case 0x1d: - { - int break_reg = ((buffer[3] >> 2) & 7); - (*info->fprintf_func) - (info->stream, val == 0x1c ? "bad%d" : "bac%d", - break_reg); - } - break; - default: - (*info->fprintf_func) (info->stream, "", val); - } - if (name) - (*info->fprintf_func) (info->stream, "%s", name); - } - break; - - case 'f': - { - int fc = fetch_arg (buffer, place, 5, info); - if (fc == 1) - (*info->fprintf_func) (info->stream, "dfc"); - else if (fc == 0) - (*info->fprintf_func) (info->stream, "sfc"); - else - /* xgettext:c-format */ - (*info->fprintf_func) (info->stream, _(""), fc); - } - break; - - case 'V': - (*info->fprintf_func) (info->stream, "val"); - break; - - case 't': - { - int level = fetch_arg (buffer, place, 3, info); - (*info->fprintf_func) (info->stream, "%d", level); - } - break; - - default: - return -2; - } - - return p - p0; -} - -/* Fetch BITS bits from a position in the instruction specified by CODE. - CODE is a "place to put an argument", or 'x' for a destination - that is a general address (mode and register). - BUFFER contains the instruction. */ - -static int -fetch_arg (buffer, code, bits, info) - unsigned char *buffer; - int code; - int bits; - disassemble_info *info; -{ - register int val = 0; - switch (code) - { - case 's': - val = buffer[1]; - break; - - case 'd': /* Destination, for register or quick. */ - val = (buffer[0] << 8) + buffer[1]; - val >>= 9; - break; - - case 'x': /* Destination, for general arg */ - val = (buffer[0] << 8) + buffer[1]; - val >>= 6; - break; - - case 'k': - FETCH_DATA (info, buffer + 3); - val = (buffer[3] >> 4); - break; - - case 'C': - FETCH_DATA (info, buffer + 3); - val = buffer[3]; - break; - - case '1': - FETCH_DATA (info, buffer + 3); - val = (buffer[2] << 8) + buffer[3]; - val >>= 12; - break; - - case '2': - FETCH_DATA (info, buffer + 3); - val = (buffer[2] << 8) + buffer[3]; - val >>= 6; - break; - - case '3': - case 'j': - FETCH_DATA (info, buffer + 3); - val = (buffer[2] << 8) + buffer[3]; - break; - - case '4': - FETCH_DATA (info, buffer + 5); - val = (buffer[4] << 8) + buffer[5]; - val >>= 12; - break; - - case '5': - FETCH_DATA (info, buffer + 5); - val = (buffer[4] << 8) + buffer[5]; - val >>= 6; - break; - - case '6': - FETCH_DATA (info, buffer + 5); - val = (buffer[4] << 8) + buffer[5]; - break; - - case '7': - FETCH_DATA (info, buffer + 3); - val = (buffer[2] << 8) + buffer[3]; - val >>= 7; - break; - - case '8': - FETCH_DATA (info, buffer + 3); - val = (buffer[2] << 8) + buffer[3]; - val >>= 10; - break; - - case '9': - FETCH_DATA (info, buffer + 3); - val = (buffer[2] << 8) + buffer[3]; - val >>= 5; - break; - - case 'e': - val = (buffer[1] >> 6); - break; - - default: - abort (); - } - - switch (bits) - { - case 2: - return val & 3; - case 3: - return val & 7; - case 4: - return val & 017; - case 5: - return val & 037; - case 6: - return val & 077; - case 7: - return val & 0177; - case 8: - return val & 0377; - case 12: - return val & 07777; - default: - abort (); - } -} - -/* Print an indexed argument. The base register is BASEREG (-1 for pc). - P points to extension word, in buffer. - ADDR is the nominal core address of that extension word. */ - -static unsigned char * -print_indexed (basereg, p, addr, info) - int basereg; - unsigned char *p; - bfd_vma addr; - disassemble_info *info; -{ - register int word; - static char *const scales[] = {"", "*2", "*4", "*8"}; - bfd_vma base_disp; - bfd_vma outer_disp; - char buf[40]; - char vmabuf[50]; - - word = NEXTWORD (p); - - /* Generate the text for the index register. - Where this will be output is not yet determined. */ - sprintf (buf, "%s.%c%s", - reg_names[(word >> 12) & 0xf], - (word & 0x800) ? 'l' : 'w', - scales[(word >> 9) & 3]); - - /* Handle the 68000 style of indexing. */ - - if ((word & 0x100) == 0) - { - base_disp = word & 0xff; - if ((base_disp & 0x80) != 0) - base_disp -= 0x100; - if (basereg == -1) - base_disp += addr; - (*info->fprintf_func) (info->stream, "(", buf); - print_base (basereg, base_disp, info); - (*info->fprintf_func) (info->stream, ",%s)", buf); - return p; - } - - /* Handle the generalized kind. */ - /* First, compute the displacement to add to the base register. */ - - if (word & 0200) - { - if (basereg == -1) - basereg = -3; - else - basereg = -2; - } - if (word & 0100) - buf[0] = '\0'; - base_disp = 0; - switch ((word >> 4) & 3) - { - case 2: - base_disp = NEXTWORD (p); - break; - case 3: - base_disp = NEXTLONG (p); - } - if (basereg == -1) - base_disp += addr; - - /* Handle single-level case (not indirect) */ - - if ((word & 7) == 0) - { - (*info->fprintf_func) (info->stream, "("); - print_base (basereg, base_disp, info); - if (buf[0] != '\0') - (*info->fprintf_func) (info->stream, ",%s", buf); - (*info->fprintf_func) (info->stream, ")"); - return p; - } - - /* Two level. Compute displacement to add after indirection. */ - - outer_disp = 0; - switch (word & 3) - { - case 2: - outer_disp = NEXTWORD (p); - break; - case 3: - outer_disp = NEXTLONG (p); - } - - (*info->fprintf_func) (info->stream, "(["); - print_base (basereg, base_disp, info); - if ((word & 4) == 0 && buf[0] != '\0') - { - (*info->fprintf_func) (info->stream, ",%s", buf); - buf[0] = '\0'; - } - if (outer_disp) - (*info->fprintf_func) (info->stream, "],$%08x", (uint32)outer_disp); - else - (*info->fprintf_func) (info->stream, "]"); - if (buf[0] != '\0') - (*info->fprintf_func) (info->stream, ",%s", buf); - (*info->fprintf_func) (info->stream, ")"); - - return p; -} - -/* Print a base register REGNO and displacement DISP, on INFO->STREAM. - REGNO = -1 for pc, -2 for none (suppressed). */ - -static void -print_base (regno, disp, info) - int regno; - bfd_vma disp; - disassemble_info *info; -{ - if (regno == -1) { - (*info->print_address_func) (disp, info); - (*info->fprintf_func) (info->stream, ",pc"); - } - else { - if (regno == -3) { - (*info->print_address_func) (disp, info); - (*info->fprintf_func) (info->stream, ",zpc"); - } - else if (regno == -2) - (*info->print_address_func) (disp, info); - else - (*info->fprintf_func) (info->stream, "$%08x,%s", (uint32)disp, reg_names[regno]); - } -} diff --git a/cxmon/src/disass/m68k-opc.c b/cxmon/src/disass/m68k-opc.c deleted file mode 100644 index 751eae60..00000000 --- a/cxmon/src/disass/m68k-opc.c +++ /dev/null @@ -1,2066 +0,0 @@ -/* Opcode table for m680[012346]0/m6888[12]/m68851/mcf5200. - Copyright 1989, 91, 92, 93, 94, 95, 96, 97, 98, 1999 - Free Software Foundation. - -This file is part of GDB, GAS, and the GNU binutils. - -GDB, GAS, and the GNU binutils are free software; you can redistribute -them and/or modify them under the terms of the GNU General Public -License as published by the Free Software Foundation; either version -1, or (at your option) any later version. - -GDB, GAS, and the GNU binutils are distributed in the hope that they -will be useful, but WITHOUT ANY WARRANTY; without even the implied -warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See -the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this file; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ - -#include "ansidecl.h" -#include "m68k.h" - -#define one(x) ((unsigned int) (x) << 16) -#define two(x, y) (((unsigned int) (x) << 16) + (y)) - -/* The assembler requires that all instances of the same mnemonic must - be consecutive. If they aren't, the assembler will bomb at - runtime. */ - -const struct m68k_opcode m68k_opcodes[] = -{ -{"abcd", one(0140400), one(0170770), "DsDd", m68000up }, -{"abcd", one(0140410), one(0170770), "-s-d", m68000up }, - -{"adda.w", one(0150300), one(0170700), "*wAd", m68000up }, -{"adda.l", one(0150700), one(0170700), "*lAd", m68000up | mcf5200 }, - -{"addi.b", one(0003000), one(0177700), "#b$s", m68000up }, -{"addi.w", one(0003100), one(0177700), "#w$s", m68000up }, -{"addi.l", one(0003200), one(0177700), "#l$s", m68000up }, -{"addi.l", one(0003200), one(0177700), "#lDs", mcf5200 }, - -{"addq.b", one(0050000), one(0170700), "Qd$b", m68000up }, -{"addq.w", one(0050100), one(0170700), "Qd%w", m68000up }, -{"addq.l", one(0050200), one(0170700), "Qd%l", m68000up | mcf5200 }, - -/* The add opcode can generate the adda, addi, and addq instructions. */ -{"add.b", one(0050000), one(0170700), "Qd$b", m68000up }, -{"add.b", one(0003000), one(0177700), "#b$s", m68000up }, -{"add.b", one(0150000), one(0170700), ";bDd", m68000up }, -{"add.b", one(0150400), one(0170700), "Dd~b", m68000up }, -{"add.w", one(0050100), one(0170700), "Qd%w", m68000up }, -{"add.w", one(0150300), one(0170700), "*wAd", m68000up }, -{"add.w", one(0003100), one(0177700), "#w$s", m68000up }, -{"add.w", one(0150100), one(0170700), "*wDd", m68000up }, -{"add.w", one(0150500), one(0170700), "Dd~w", m68000up }, -{"add.l", one(0050200), one(0170700), "Qd%l", m68000up | mcf5200 }, -{"add.l", one(0003200), one(0177700), "#l$s", m68000up }, -{"add.l", one(0003200), one(0177700), "#lDs", mcf5200 }, -{"add.l", one(0150700), one(0170700), "*lAd", m68000up | mcf5200 }, -{"add.l", one(0150200), one(0170700), "*lDd", m68000up | mcf5200 }, -{"add.l", one(0150600), one(0170700), "Dd~l", m68000up | mcf5200 }, - -{"addx.b", one(0150400), one(0170770), "DsDd", m68000up }, -{"addx.b", one(0150410), one(0170770), "-s-d", m68000up }, -{"addx.w", one(0150500), one(0170770), "DsDd", m68000up }, -{"addx.w", one(0150510), one(0170770), "-s-d", m68000up }, -{"addx.l", one(0150600), one(0170770), "DsDd", m68000up | mcf5200 }, -{"addx.l", one(0150610), one(0170770), "-s-d", m68000up }, - -{"andi.b", one(0001000), one(0177700), "#b$s", m68000up }, -{"andi.w", one(0001100), one(0177700), "#w$s", m68000up }, -{"andi.l", one(0001200), one(0177700), "#l$s", m68000up }, -{"andi.l", one(0001200), one(0177700), "#lDs", mcf5200 }, -{"andi", one(0001100), one(0177700), "#w$s", m68000up }, -{"andi", one(0001074), one(0177777), "#bCs", m68000up }, -{"andi", one(0001174), one(0177777), "#wSs", m68000up }, - -/* The and opcode can generate the andi instruction. */ -{"and.b", one(0001000), one(0177700), "#b$s", m68000up }, -{"and.b", one(0140000), one(0170700), ";bDd", m68000up }, -{"and.b", one(0140400), one(0170700), "Dd~b", m68000up }, -{"and.w", one(0001100), one(0177700), "#w$s", m68000up }, -{"and.w", one(0140100), one(0170700), ";wDd", m68000up }, -{"and.w", one(0140500), one(0170700), "Dd~w", m68000up }, -{"and.l", one(0001200), one(0177700), "#l$s", m68000up }, -{"and.l", one(0001200), one(0177700), "#lDs", mcf5200 }, -{"and.l", one(0140200), one(0170700), ";lDd", m68000up | mcf5200 }, -{"and.l", one(0140600), one(0170700), "Dd~l", m68000up | mcf5200 }, -{"and", one(0001100), one(0177700), "#w$w", m68000up }, -{"and", one(0001074), one(0177777), "#bCs", m68000up }, -{"and", one(0001174), one(0177777), "#wSs", m68000up }, -{"and", one(0140100), one(0170700), ";wDd", m68000up }, -{"and", one(0140500), one(0170700), "Dd~w", m68000up }, - -{"asl.b", one(0160400), one(0170770), "QdDs", m68000up }, -{"asl.b", one(0160440), one(0170770), "DdDs", m68000up }, -{"asl.w", one(0160500), one(0170770), "QdDs", m68000up }, -{"asl.w", one(0160540), one(0170770), "DdDs", m68000up }, -{"asl.w", one(0160700), one(0177700), "~s", m68000up }, -{"asl.l", one(0160600), one(0170770), "QdDs", m68000up | mcf5200 }, -{"asl.l", one(0160640), one(0170770), "DdDs", m68000up | mcf5200 }, - -{"asr.b", one(0160000), one(0170770), "QdDs", m68000up }, -{"asr.b", one(0160040), one(0170770), "DdDs", m68000up }, -{"asr.w", one(0160100), one(0170770), "QdDs", m68000up }, -{"asr.w", one(0160140), one(0170770), "DdDs", m68000up }, -{"asr.w", one(0160300), one(0177700), "~s", m68000up }, -{"asr.l", one(0160200), one(0170770), "QdDs", m68000up | mcf5200 }, -{"asr.l", one(0160240), one(0170770), "DdDs", m68000up | mcf5200 }, - -{"bhi", one(0061000), one(0177777), "BW", m68000up | mcf5200 }, -{"bls", one(0061400), one(0177777), "BW", m68000up | mcf5200 }, -{"bcc", one(0062000), one(0177777), "BW", m68000up | mcf5200 }, -{"bcs", one(0062400), one(0177777), "BW", m68000up | mcf5200 }, -{"bne", one(0063000), one(0177777), "BW", m68000up | mcf5200 }, -{"beq", one(0063400), one(0177777), "BW", m68000up | mcf5200 }, -{"bvc", one(0064000), one(0177777), "BW", m68000up | mcf5200 }, -{"bvs", one(0064400), one(0177777), "BW", m68000up | mcf5200 }, -{"bpl", one(0065000), one(0177777), "BW", m68000up | mcf5200 }, -{"bmi", one(0065400), one(0177777), "BW", m68000up | mcf5200 }, -{"bge", one(0066000), one(0177777), "BW", m68000up | mcf5200 }, -{"blt", one(0066400), one(0177777), "BW", m68000up | mcf5200 }, -{"bgt", one(0067000), one(0177777), "BW", m68000up | mcf5200 }, -{"ble", one(0067400), one(0177777), "BW", m68000up | mcf5200 }, - -{"bhi.l", one(0061377), one(0177777), "BL", m68020up | cpu32 }, -{"bls.l", one(0061777), one(0177777), "BL", m68020up | cpu32 }, -{"bcc.l", one(0062377), one(0177777), "BL", m68020up | cpu32 }, -{"bcs.l", one(0062777), one(0177777), "BL", m68020up | cpu32 }, -{"bne.l", one(0063377), one(0177777), "BL", m68020up | cpu32 }, -{"beq.l", one(0063777), one(0177777), "BL", m68020up | cpu32 }, -{"bvc.l", one(0064377), one(0177777), "BL", m68020up | cpu32 }, -{"bvs.l", one(0064777), one(0177777), "BL", m68020up | cpu32 }, -{"bpl.l", one(0065377), one(0177777), "BL", m68020up | cpu32 }, -{"bmi.l", one(0065777), one(0177777), "BL", m68020up | cpu32 }, -{"bge.l", one(0066377), one(0177777), "BL", m68020up | cpu32 }, -{"blt.l", one(0066777), one(0177777), "BL", m68020up | cpu32 }, -{"bgt.l", one(0067377), one(0177777), "BL", m68020up | cpu32 }, -{"ble.l", one(0067777), one(0177777), "BL", m68020up | cpu32 }, - -{"bhi.s", one(0061000), one(0177400), "BB", m68000up | mcf5200 }, -{"bls.s", one(0061400), one(0177400), "BB", m68000up | mcf5200 }, -{"bcc.s", one(0062000), one(0177400), "BB", m68000up | mcf5200 }, -{"bcs.s", one(0062400), one(0177400), "BB", m68000up | mcf5200 }, -{"bne.s", one(0063000), one(0177400), "BB", m68000up | mcf5200 }, -{"beq.s", one(0063400), one(0177400), "BB", m68000up | mcf5200 }, -{"bvc.s", one(0064000), one(0177400), "BB", m68000up | mcf5200 }, -{"bvs.s", one(0064400), one(0177400), "BB", m68000up | mcf5200 }, -{"bpl.s", one(0065000), one(0177400), "BB", m68000up | mcf5200 }, -{"bmi.s", one(0065400), one(0177400), "BB", m68000up | mcf5200 }, -{"bge.s", one(0066000), one(0177400), "BB", m68000up | mcf5200 }, -{"blt.s", one(0066400), one(0177400), "BB", m68000up | mcf5200 }, -{"bgt.s", one(0067000), one(0177400), "BB", m68000up | mcf5200 }, -{"ble.s", one(0067400), one(0177400), "BB", m68000up | mcf5200 }, - -{"jhi", one(0061000), one(0177400), "Bg", m68000up | mcf5200 }, -{"jls", one(0061400), one(0177400), "Bg", m68000up | mcf5200 }, -{"jcc", one(0062000), one(0177400), "Bg", m68000up | mcf5200 }, -{"jcs", one(0062400), one(0177400), "Bg", m68000up | mcf5200 }, -{"jne", one(0063000), one(0177400), "Bg", m68000up | mcf5200 }, -{"jeq", one(0063400), one(0177400), "Bg", m68000up | mcf5200 }, -{"jvc", one(0064000), one(0177400), "Bg", m68000up | mcf5200 }, -{"jvs", one(0064400), one(0177400), "Bg", m68000up | mcf5200 }, -{"jpl", one(0065000), one(0177400), "Bg", m68000up | mcf5200 }, -{"jmi", one(0065400), one(0177400), "Bg", m68000up | mcf5200 }, -{"jge", one(0066000), one(0177400), "Bg", m68000up | mcf5200 }, -{"jlt", one(0066400), one(0177400), "Bg", m68000up | mcf5200 }, -{"jgt", one(0067000), one(0177400), "Bg", m68000up | mcf5200 }, -{"jle", one(0067400), one(0177400), "Bg", m68000up | mcf5200 }, - -{"bchg", one(0000500), one(0170700), "Dd$s", m68000up | mcf5200 }, -{"bchg", one(0004100), one(0177700), "#b$s", m68000up }, -{"bchg", one(0004100), one(0177700), "#bqs", mcf5200 }, - -{"bclr", one(0000600), one(0170700), "Dd$s", m68000up }, -{"bclr", one(0000600), one(0170700), "Ddvs", mcf5200 }, -{"bclr", one(0004200), one(0177700), "#b$s", m68000up }, -{"bclr", one(0004200), one(0177700), "#bqs", mcf5200 }, - -{"bfchg", two(0165300, 0), two(0177700, 0170000), "?sO2O3", m68020up }, -{"bfclr", two(0166300, 0), two(0177700, 0170000), "?sO2O3", m68020up }, -{"bfexts", two(0165700, 0), two(0177700, 0100000), "/sO2O3D1", m68020up }, -{"bfextu", two(0164700, 0), two(0177700, 0100000), "/sO2O3D1", m68020up }, -{"bfffo", two(0166700, 0), two(0177700, 0100000), "/sO2O3D1", m68020up }, -{"bfins", two(0167700, 0), two(0177700, 0100000), "D1?sO2O3", m68020up }, -{"bfset", two(0167300, 0), two(0177700, 0170000), "?sO2O3", m68020up }, -{"bftst", two(0164300, 0), two(0177700, 0170000), "/sO2O3", m68020up }, - -{"bgnd", one(0045372), one(0177777), "", cpu32 }, - -{"bkpt", one(0044110), one(0177770), "ts", m68010up }, - -{"bra", one(0060000), one(0177777), "BW", m68000up | mcf5200 }, -{"bra.l", one(0060377), one(0177777), "BL", m68020up | cpu32 }, -{"bra.s", one(0060000), one(0177400), "BB", m68000up | mcf5200 }, - -{"bset", one(0000700), one(0170700), "Dd$s", m68000up }, -{"bset", one(0000700), one(0170700), "Ddvs", mcf5200 }, -{"bset", one(0004300), one(0177700), "#b$s", m68000up }, -{"bset", one(0004300), one(0177700), "#bqs", mcf5200 }, - -{"bsr", one(0060400), one(0177777), "BW", m68000up | mcf5200 }, -{"bsr.l", one(0060777), one(0177777), "BL", m68020up | cpu32 }, -{"bsr.s", one(0060400), one(0177400), "BB", m68000up | mcf5200 }, - -{"btst", one(0000400), one(0170700), "Dd;b", m68000up | mcf5200 }, -{"btst", one(0004000), one(0177700), "#b@s", m68000up }, -{"btst", one(0004000), one(0177700), "#bqs", mcf5200 }, - -{"callm", one(0003300), one(0177700), "#b!s", m68020 }, - -{"cas2.w", two(0006374,0), two(0177777,0007070), "D3D6D2D5r1r4", m68020up }, -{"cas2.w", two(0006374,0), two(0177777,0007070), "D3D6D2D5R1R4", m68020up }, -{"cas2.l", two(0007374,0), two(0177777,0007070), "D3D6D2D5r1r4", m68020up }, -{"cas2.l", two(0007374,0), two(0177777,0007070), "D3D6D2D5R1R4", m68020up }, - -{"cas.b", two(0005300, 0), two(0177700, 0177070), "D3D2~s", m68020up }, -{"cas.w", two(0006300, 0), two(0177700, 0177070), "D3D2~s", m68020up }, -{"cas.l", two(0007300, 0), two(0177700, 0177070), "D3D2~s", m68020up }, - -{"chk2.b", two(0000300,0004000), two(0177700,07777), "!sR1", m68020up | cpu32 }, -{"chk2.w", two(0001300,0004000), two(0177700,07777), "!sR1", m68020up | cpu32 }, -{"chk2.l", two(0002300,0004000), two(0177700,07777), "!sR1", m68020up | cpu32 }, - -{"chk.l", one(0040400), one(0170700), ";lDd", m68000up }, -{"chk.w", one(0040600), one(0170700), ";wDd", m68000up }, - -#define SCOPE_LINE (0x1 << 3) -#define SCOPE_PAGE (0x2 << 3) -#define SCOPE_ALL (0x3 << 3) - -{"cinva", one(0xf400|SCOPE_ALL), one(0xff38), "ce", m68040up }, -{"cinvl", one(0xf400|SCOPE_LINE), one(0xff38), "ceas", m68040up }, -{"cinvp", one(0xf400|SCOPE_PAGE), one(0xff38), "ceas", m68040up }, - -{"cpusha", one(0xf420|SCOPE_ALL), one(0xff38), "ce", m68040up }, -{"cpushl", one(0xf420|SCOPE_LINE), one(0xff38), "ceas", m68040up }, -{"cpushl", one(0x04e8), one(0xfff8), "as", mcf5200 }, -{"cpushp", one(0xf420|SCOPE_PAGE), one(0xff38), "ceas", m68040up }, - -#undef SCOPE_LINE -#undef SCOPE_PAGE -#undef SCOPE_ALL - -{"clr.b", one(0041000), one(0177700), "$s", m68000up | mcf5200 }, -{"clr.w", one(0041100), one(0177700), "$s", m68000up | mcf5200 }, -{"clr.l", one(0041200), one(0177700), "$s", m68000up | mcf5200 }, - -{"cmp2.b", two(0000300,0), two(0177700,07777), "!sR1", m68020up | cpu32 }, -{"cmp2.w", two(0001300,0), two(0177700,07777), "!sR1", m68020up | cpu32 }, -{"cmp2.l", two(0002300,0), two(0177700,07777), "!sR1", m68020up | cpu32 }, - -{"cmpa.w", one(0130300), one(0170700), "*wAd", m68000up }, -{"cmpa.l", one(0130700), one(0170700), "*lAd", m68000up | mcf5200 }, - -{"cmpi.b", one(0006000), one(0177700), "#b;s", m68000up }, -{"cmpi.w", one(0006100), one(0177700), "#w;s", m68000up }, -{"cmpi.l", one(0006200), one(0177700), "#l;s", m68000up }, -{"cmpi.l", one(0006200), one(0177700), "#lDs", mcf5200 }, - -{"cmpm.b", one(0130410), one(0170770), "+s+d", m68000up }, -{"cmpm.w", one(0130510), one(0170770), "+s+d", m68000up }, -{"cmpm.l", one(0130610), one(0170770), "+s+d", m68000up }, - -/* The cmp opcode can generate the cmpa, cmpm, and cmpi instructions. */ -{"cmp.b", one(0006000), one(0177700), "#b;s", m68000up }, -{"cmp.b", one(0130410), one(0170770), "+s+d", m68000up }, -{"cmp.b", one(0130000), one(0170700), ";bDd", m68000up }, -{"cmp.w", one(0130300), one(0170700), "*wAd", m68000up }, -{"cmp.w", one(0006100), one(0177700), "#w;s", m68000up }, -{"cmp.w", one(0130510), one(0170770), "+s+d", m68000up }, -{"cmp.w", one(0130100), one(0170700), "*wDd", m68000up }, -{"cmp.l", one(0130700), one(0170700), "*lAd", m68000up | mcf5200 }, -{"cmp.l", one(0006200), one(0177700), "#l;s", m68000up }, -{"cmp.l", one(0006200), one(0177700), "#lDs", mcf5200 }, -{"cmp.l", one(0130610), one(0170770), "+s+d", m68000up }, -{"cmp.l", one(0130200), one(0170700), "*lDd", m68000up | mcf5200 }, - -{"dbcc", one(0052310), one(0177770), "DsBw", m68000up }, -{"dbcs", one(0052710), one(0177770), "DsBw", m68000up }, -{"dbeq", one(0053710), one(0177770), "DsBw", m68000up }, -{"dbf", one(0050710), one(0177770), "DsBw", m68000up }, -{"dbge", one(0056310), one(0177770), "DsBw", m68000up }, -{"dbgt", one(0057310), one(0177770), "DsBw", m68000up }, -{"dbhi", one(0051310), one(0177770), "DsBw", m68000up }, -{"dble", one(0057710), one(0177770), "DsBw", m68000up }, -{"dbls", one(0051710), one(0177770), "DsBw", m68000up }, -{"dblt", one(0056710), one(0177770), "DsBw", m68000up }, -{"dbmi", one(0055710), one(0177770), "DsBw", m68000up }, -{"dbne", one(0053310), one(0177770), "DsBw", m68000up }, -{"dbpl", one(0055310), one(0177770), "DsBw", m68000up }, -{"dbt", one(0050310), one(0177770), "DsBw", m68000up }, -{"dbvc", one(0054310), one(0177770), "DsBw", m68000up }, -{"dbvs", one(0054710), one(0177770), "DsBw", m68000up }, - -{"divs.w", one(0100700), one(0170700), ";wDd", m68000up }, - -{"divs.l", two(0046100,0006000),two(0177700,0107770),";lD3D1", m68020up|cpu32 }, -{"divs.l", two(0046100,0004000),two(0177700,0107770),";lDD", m68020up|cpu32 }, - -{"divsl.l", two(0046100,0004000),two(0177700,0107770),";lD3D1",m68020up|cpu32 }, -{"divsl.l", two(0046100,0004000),two(0177700,0107770),";lDD", m68020up|cpu32 }, - -{"divu.w", one(0100300), one(0170700), ";wDd", m68000up }, - -{"divu.l", two(0046100,0002000),two(0177700,0107770),";lD3D1", m68020up|cpu32 }, -{"divu.l", two(0046100,0000000),two(0177700,0107770),";lDD", m68020up|cpu32 }, - -{"divul.l", two(0046100,0000000),two(0177700,0107770),";lD3D1",m68020up|cpu32 }, -{"divul.l", two(0046100,0000000),two(0177700,0107770),";lDD", m68020up|cpu32 }, - -{"eori.b", one(0005000), one(0177700), "#b$s", m68000up }, -{"eori.w", one(0005100), one(0177700), "#w$s", m68000up }, -{"eori.l", one(0005200), one(0177700), "#l$s", m68000up }, -{"eori.l", one(0005200), one(0177700), "#lDs", mcf5200 }, -{"eori", one(0005074), one(0177777), "#bCs", m68000up }, -{"eori", one(0005174), one(0177777), "#wSs", m68000up }, -{"eori", one(0005100), one(0177700), "#w$s", m68000up }, - -/* The eor opcode can generate the eori instruction. */ -{"eor.b", one(0005000), one(0177700), "#b$s", m68000up }, -{"eor.b", one(0130400), one(0170700), "Dd$s", m68000up }, -{"eor.w", one(0005100), one(0177700), "#w$s", m68000up }, -{"eor.w", one(0130500), one(0170700), "Dd$s", m68000up }, -{"eor.l", one(0005200), one(0177700), "#l$s", m68000up }, -{"eor.l", one(0005200), one(0177700), "#lDs", mcf5200 }, -{"eor.l", one(0130600), one(0170700), "Dd$s", m68000up | mcf5200 }, -{"eor", one(0005074), one(0177777), "#bCs", m68000up }, -{"eor", one(0005174), one(0177777), "#wSs", m68000up }, -{"eor", one(0005100), one(0177700), "#w$s", m68000up }, -{"eor", one(0130500), one(0170700), "Dd$s", m68000up }, - -{"exg", one(0140500), one(0170770), "DdDs", m68000up }, -{"exg", one(0140510), one(0170770), "AdAs", m68000up }, -{"exg", one(0140610), one(0170770), "DdAs", m68000up }, -{"exg", one(0140610), one(0170770), "AsDd", m68000up }, - -{"ext.w", one(0044200), one(0177770), "Ds", m68000up|mcf5200 }, -{"ext.l", one(0044300), one(0177770), "Ds", m68000up|mcf5200 }, -{"extb.l", one(0044700), one(0177770), "Ds", m68020up|cpu32|mcf5200 }, - -/* float stuff starts here */ - -{"fabs.b", two(0xF000, 0x5818), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"fabs.d", two(0xF000, 0x5418), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"fabs.l", two(0xF000, 0x4018), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"fabs.p", two(0xF000, 0x4C18), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"fabs.s", two(0xF000, 0x4418), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"fabs.w", two(0xF000, 0x5018), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"fabs.x", two(0xF000, 0x0018), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"fabs.x", two(0xF000, 0x4818), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"fabs.x", two(0xF000, 0x0018), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"fsabs.b", two(0xF000, 0x5858), two(0xF1C0, 0xFC7F), "Ii;bF7", m68040up }, -{"fsabs.d", two(0xF000, 0x5458), two(0xF1C0, 0xFC7F), "Ii;FF7", m68040up }, -{"fsabs.l", two(0xF000, 0x4058), two(0xF1C0, 0xFC7F), "Ii;lF7", m68040up }, -{"fsabs.p", two(0xF000, 0x4C58), two(0xF1C0, 0xFC7F), "Ii;pF7", m68040up }, -{"fsabs.s", two(0xF000, 0x4458), two(0xF1C0, 0xFC7F), "Ii;fF7", m68040up }, -{"fsabs.w", two(0xF000, 0x5058), two(0xF1C0, 0xFC7F), "Ii;wF7", m68040up }, -{"fsabs.x", two(0xF000, 0x0058), two(0xF1C0, 0xE07F), "IiF8F7", m68040up }, -{"fsabs.x", two(0xF000, 0x4858), two(0xF1C0, 0xFC7F), "Ii;xF7", m68040up }, -{"fsabs.x", two(0xF000, 0x0058), two(0xF1C0, 0xE07F), "IiFt", m68040up }, - -{"fdabs.b", two(0xF000, 0x585c), two(0xF1C0, 0xFC7F), "Ii;bF7", m68040up}, -{"fdabs.d", two(0xF000, 0x545c), two(0xF1C0, 0xFC7F), "Ii;FF7", m68040up}, -{"fdabs.l", two(0xF000, 0x405c), two(0xF1C0, 0xFC7F), "Ii;lF7", m68040up}, -{"fdabs.p", two(0xF000, 0x4C5c), two(0xF1C0, 0xFC7F), "Ii;pF7", m68040up}, -{"fdabs.s", two(0xF000, 0x445c), two(0xF1C0, 0xFC7F), "Ii;fF7", m68040up}, -{"fdabs.w", two(0xF000, 0x505c), two(0xF1C0, 0xFC7F), "Ii;wF7", m68040up}, -{"fdabs.x", two(0xF000, 0x005c), two(0xF1C0, 0xE07F), "IiF8F7", m68040up}, -{"fdabs.x", two(0xF000, 0x485c), two(0xF1C0, 0xFC7F), "Ii;xF7", m68040up}, -{"fdabs.x", two(0xF000, 0x005c), two(0xF1C0, 0xE07F), "IiFt", m68040up}, - -{"facos.b", two(0xF000, 0x581C), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"facos.d", two(0xF000, 0x541C), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"facos.l", two(0xF000, 0x401C), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"facos.p", two(0xF000, 0x4C1C), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"facos.s", two(0xF000, 0x441C), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"facos.w", two(0xF000, 0x501C), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"facos.x", two(0xF000, 0x001C), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"facos.x", two(0xF000, 0x481C), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"facos.x", two(0xF000, 0x001C), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"fadd.b", two(0xF000, 0x5822), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"fadd.d", two(0xF000, 0x5422), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"fadd.l", two(0xF000, 0x4022), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"fadd.p", two(0xF000, 0x4C22), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"fadd.s", two(0xF000, 0x4422), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"fadd.w", two(0xF000, 0x5022), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"fadd.x", two(0xF000, 0x0022), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"fadd.x", two(0xF000, 0x4822), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, - -{"fsadd.b", two(0xF000, 0x5862), two(0xF1C0, 0xFC7F), "Ii;bF7", m68040up }, -{"fsadd.d", two(0xF000, 0x5462), two(0xF1C0, 0xFC7F), "Ii;FF7", m68040up }, -{"fsadd.l", two(0xF000, 0x4062), two(0xF1C0, 0xFC7F), "Ii;lF7", m68040up }, -{"fsadd.p", two(0xF000, 0x4C62), two(0xF1C0, 0xFC7F), "Ii;pF7", m68040up }, -{"fsadd.s", two(0xF000, 0x4462), two(0xF1C0, 0xFC7F), "Ii;fF7", m68040up }, -{"fsadd.w", two(0xF000, 0x5062), two(0xF1C0, 0xFC7F), "Ii;wF7", m68040up }, -{"fsadd.x", two(0xF000, 0x0062), two(0xF1C0, 0xE07F), "IiF8F7", m68040up }, -{"fsadd.x", two(0xF000, 0x4862), two(0xF1C0, 0xFC7F), "Ii;xF7", m68040up }, - -{"fdadd.b", two(0xF000, 0x5866), two(0xF1C0, 0xFC7F), "Ii;bF7", m68040up }, -{"fdadd.d", two(0xF000, 0x5466), two(0xF1C0, 0xFC7F), "Ii;FF7", m68040up }, -{"fdadd.l", two(0xF000, 0x4066), two(0xF1C0, 0xFC7F), "Ii;lF7", m68040up }, -{"fdadd.p", two(0xF000, 0x4C66), two(0xF1C0, 0xFC7F), "Ii;pF7", m68040up }, -{"fdadd.s", two(0xF000, 0x4466), two(0xF1C0, 0xFC7F), "Ii;fF7", m68040up }, -{"fdadd.w", two(0xF000, 0x5066), two(0xF1C0, 0xFC7F), "Ii;wF7", m68040up }, -{"fdadd.x", two(0xF000, 0x0066), two(0xF1C0, 0xE07F), "IiF8F7", m68040up }, -{"fdadd.x", two(0xF000, 0x4866), two(0xF1C0, 0xFC7F), "Ii;xF7", m68040up }, - -{"fasin.b", two(0xF000, 0x580C), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"fasin.d", two(0xF000, 0x540C), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"fasin.l", two(0xF000, 0x400C), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"fasin.p", two(0xF000, 0x4C0C), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"fasin.s", two(0xF000, 0x440C), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"fasin.w", two(0xF000, 0x500C), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"fasin.x", two(0xF000, 0x000C), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"fasin.x", two(0xF000, 0x480C), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"fasin.x", two(0xF000, 0x000C), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"fatan.b", two(0xF000, 0x580A), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"fatan.d", two(0xF000, 0x540A), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"fatan.l", two(0xF000, 0x400A), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"fatan.p", two(0xF000, 0x4C0A), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"fatan.s", two(0xF000, 0x440A), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"fatan.w", two(0xF000, 0x500A), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"fatan.x", two(0xF000, 0x000A), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"fatan.x", two(0xF000, 0x480A), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"fatan.x", two(0xF000, 0x000A), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"fatanh.b", two(0xF000, 0x580D), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"fatanh.d", two(0xF000, 0x540D), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"fatanh.l", two(0xF000, 0x400D), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"fatanh.p", two(0xF000, 0x4C0D), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"fatanh.s", two(0xF000, 0x440D), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"fatanh.w", two(0xF000, 0x500D), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"fatanh.x", two(0xF000, 0x000D), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"fatanh.x", two(0xF000, 0x480D), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"fatanh.x", two(0xF000, 0x000D), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"fbeq", one(0xF081), one(0xF1FF), "IdBW", mfloat }, -{"fbf", one(0xF080), one(0xF1FF), "IdBW", mfloat }, -{"fbge", one(0xF093), one(0xF1FF), "IdBW", mfloat }, -{"fbgl", one(0xF096), one(0xF1FF), "IdBW", mfloat }, -{"fbgle", one(0xF097), one(0xF1FF), "IdBW", mfloat }, -{"fbgt", one(0xF092), one(0xF1FF), "IdBW", mfloat }, -{"fble", one(0xF095), one(0xF1FF), "IdBW", mfloat }, -{"fblt", one(0xF094), one(0xF1FF), "IdBW", mfloat }, -{"fbne", one(0xF08E), one(0xF1FF), "IdBW", mfloat }, -{"fbnge", one(0xF09C), one(0xF1FF), "IdBW", mfloat }, -{"fbngl", one(0xF099), one(0xF1FF), "IdBW", mfloat }, -{"fbngle", one(0xF098), one(0xF1FF), "IdBW", mfloat }, -{"fbngt", one(0xF09D), one(0xF1FF), "IdBW", mfloat }, -{"fbnle", one(0xF09A), one(0xF1FF), "IdBW", mfloat }, -{"fbnlt", one(0xF09B), one(0xF1FF), "IdBW", mfloat }, -{"fboge", one(0xF083), one(0xF1FF), "IdBW", mfloat }, -{"fbogl", one(0xF086), one(0xF1FF), "IdBW", mfloat }, -{"fbogt", one(0xF082), one(0xF1FF), "IdBW", mfloat }, -{"fbole", one(0xF085), one(0xF1FF), "IdBW", mfloat }, -{"fbolt", one(0xF084), one(0xF1FF), "IdBW", mfloat }, -{"fbor", one(0xF087), one(0xF1FF), "IdBW", mfloat }, -{"fbseq", one(0xF091), one(0xF1FF), "IdBW", mfloat }, -{"fbsf", one(0xF090), one(0xF1FF), "IdBW", mfloat }, -{"fbsne", one(0xF09E), one(0xF1FF), "IdBW", mfloat }, -{"fbst", one(0xF09F), one(0xF1FF), "IdBW", mfloat }, -{"fbt", one(0xF08F), one(0xF1FF), "IdBW", mfloat }, -{"fbueq", one(0xF089), one(0xF1FF), "IdBW", mfloat }, -{"fbuge", one(0xF08B), one(0xF1FF), "IdBW", mfloat }, -{"fbugt", one(0xF08A), one(0xF1FF), "IdBW", mfloat }, -{"fbule", one(0xF08D), one(0xF1FF), "IdBW", mfloat }, -{"fbult", one(0xF08C), one(0xF1FF), "IdBW", mfloat }, -{"fbun", one(0xF088), one(0xF1FF), "IdBW", mfloat }, - -{"fbeq.l", one(0xF0C1), one(0xF1FF), "IdBC", mfloat }, -{"fbf.l", one(0xF0C0), one(0xF1FF), "IdBC", mfloat }, -{"fbge.l", one(0xF0D3), one(0xF1FF), "IdBC", mfloat }, -{"fbgl.l", one(0xF0D6), one(0xF1FF), "IdBC", mfloat }, -{"fbgle.l", one(0xF0D7), one(0xF1FF), "IdBC", mfloat }, -{"fbgt.l", one(0xF0D2), one(0xF1FF), "IdBC", mfloat }, -{"fble.l", one(0xF0D5), one(0xF1FF), "IdBC", mfloat }, -{"fblt.l", one(0xF0D4), one(0xF1FF), "IdBC", mfloat }, -{"fbne.l", one(0xF0CE), one(0xF1FF), "IdBC", mfloat }, -{"fbnge.l", one(0xF0DC), one(0xF1FF), "IdBC", mfloat }, -{"fbngl.l", one(0xF0D9), one(0xF1FF), "IdBC", mfloat }, -{"fbngle.l", one(0xF0D8), one(0xF1FF), "IdBC", mfloat }, -{"fbngt.l", one(0xF0DD), one(0xF1FF), "IdBC", mfloat }, -{"fbnle.l", one(0xF0DA), one(0xF1FF), "IdBC", mfloat }, -{"fbnlt.l", one(0xF0DB), one(0xF1FF), "IdBC", mfloat }, -{"fboge.l", one(0xF0C3), one(0xF1FF), "IdBC", mfloat }, -{"fbogl.l", one(0xF0C6), one(0xF1FF), "IdBC", mfloat }, -{"fbogt.l", one(0xF0C2), one(0xF1FF), "IdBC", mfloat }, -{"fbole.l", one(0xF0C5), one(0xF1FF), "IdBC", mfloat }, -{"fbolt.l", one(0xF0C4), one(0xF1FF), "IdBC", mfloat }, -{"fbor.l", one(0xF0C7), one(0xF1FF), "IdBC", mfloat }, -{"fbseq.l", one(0xF0D1), one(0xF1FF), "IdBC", mfloat }, -{"fbsf.l", one(0xF0D0), one(0xF1FF), "IdBC", mfloat }, -{"fbsne.l", one(0xF0DE), one(0xF1FF), "IdBC", mfloat }, -{"fbst.l", one(0xF0DF), one(0xF1FF), "IdBC", mfloat }, -{"fbt.l", one(0xF0CF), one(0xF1FF), "IdBC", mfloat }, -{"fbueq.l", one(0xF0C9), one(0xF1FF), "IdBC", mfloat }, -{"fbuge.l", one(0xF0CB), one(0xF1FF), "IdBC", mfloat }, -{"fbugt.l", one(0xF0CA), one(0xF1FF), "IdBC", mfloat }, -{"fbule.l", one(0xF0CD), one(0xF1FF), "IdBC", mfloat }, -{"fbult.l", one(0xF0CC), one(0xF1FF), "IdBC", mfloat }, -{"fbun.l", one(0xF0C8), one(0xF1FF), "IdBC", mfloat }, - -{"fjeq", one(0xF081), one(0xF1BF), "IdBc", mfloat }, -{"fjf", one(0xF080), one(0xF1BF), "IdBc", mfloat }, -{"fjge", one(0xF093), one(0xF1BF), "IdBc", mfloat }, -{"fjgl", one(0xF096), one(0xF1BF), "IdBc", mfloat }, -{"fjgle", one(0xF097), one(0xF1BF), "IdBc", mfloat }, -{"fjgt", one(0xF092), one(0xF1BF), "IdBc", mfloat }, -{"fjle", one(0xF095), one(0xF1BF), "IdBc", mfloat }, -{"fjlt", one(0xF094), one(0xF1BF), "IdBc", mfloat }, -{"fjne", one(0xF08E), one(0xF1BF), "IdBc", mfloat }, -{"fjnge", one(0xF09C), one(0xF1BF), "IdBc", mfloat }, -{"fjngl", one(0xF099), one(0xF1BF), "IdBc", mfloat }, -{"fjngle", one(0xF098), one(0xF1BF), "IdBc", mfloat }, -{"fjngt", one(0xF09D), one(0xF1BF), "IdBc", mfloat }, -{"fjnle", one(0xF09A), one(0xF1BF), "IdBc", mfloat }, -{"fjnlt", one(0xF09B), one(0xF1BF), "IdBc", mfloat }, -{"fjoge", one(0xF083), one(0xF1BF), "IdBc", mfloat }, -{"fjogl", one(0xF086), one(0xF1BF), "IdBc", mfloat }, -{"fjogt", one(0xF082), one(0xF1BF), "IdBc", mfloat }, -{"fjole", one(0xF085), one(0xF1BF), "IdBc", mfloat }, -{"fjolt", one(0xF084), one(0xF1BF), "IdBc", mfloat }, -{"fjor", one(0xF087), one(0xF1BF), "IdBc", mfloat }, -{"fjseq", one(0xF091), one(0xF1BF), "IdBc", mfloat }, -{"fjsf", one(0xF090), one(0xF1BF), "IdBc", mfloat }, -{"fjsne", one(0xF09E), one(0xF1BF), "IdBc", mfloat }, -{"fjst", one(0xF09F), one(0xF1BF), "IdBc", mfloat }, -{"fjt", one(0xF08F), one(0xF1BF), "IdBc", mfloat }, -{"fjueq", one(0xF089), one(0xF1BF), "IdBc", mfloat }, -{"fjuge", one(0xF08B), one(0xF1BF), "IdBc", mfloat }, -{"fjugt", one(0xF08A), one(0xF1BF), "IdBc", mfloat }, -{"fjule", one(0xF08D), one(0xF1BF), "IdBc", mfloat }, -{"fjult", one(0xF08C), one(0xF1BF), "IdBc", mfloat }, -{"fjun", one(0xF088), one(0xF1BF), "IdBc", mfloat }, - -{"fcmp.b", two(0xF000, 0x5838), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"fcmp.d", two(0xF000, 0x5438), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"fcmp.l", two(0xF000, 0x4038), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"fcmp.p", two(0xF000, 0x4C38), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"fcmp.s", two(0xF000, 0x4438), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"fcmp.w", two(0xF000, 0x5038), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"fcmp.x", two(0xF000, 0x0038), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"fcmp.x", two(0xF000, 0x4838), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, - -{"fcos.b", two(0xF000, 0x581D), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"fcos.d", two(0xF000, 0x541D), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"fcos.l", two(0xF000, 0x401D), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"fcos.p", two(0xF000, 0x4C1D), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"fcos.s", two(0xF000, 0x441D), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"fcos.w", two(0xF000, 0x501D), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"fcos.x", two(0xF000, 0x001D), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"fcos.x", two(0xF000, 0x481D), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"fcos.x", two(0xF000, 0x001D), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"fcosh.b", two(0xF000, 0x5819), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"fcosh.d", two(0xF000, 0x5419), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"fcosh.l", two(0xF000, 0x4019), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"fcosh.p", two(0xF000, 0x4C19), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"fcosh.s", two(0xF000, 0x4419), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"fcosh.w", two(0xF000, 0x5019), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"fcosh.x", two(0xF000, 0x0019), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"fcosh.x", two(0xF000, 0x4819), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"fcosh.x", two(0xF000, 0x0019), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"fdbeq", two(0xF048, 0x0001), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbf", two(0xF048, 0x0000), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbge", two(0xF048, 0x0013), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbgl", two(0xF048, 0x0016), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbgle", two(0xF048, 0x0017), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbgt", two(0xF048, 0x0012), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdble", two(0xF048, 0x0015), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdblt", two(0xF048, 0x0014), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbne", two(0xF048, 0x000E), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbnge", two(0xF048, 0x001C), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbngl", two(0xF048, 0x0019), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbngle", two(0xF048, 0x0018), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbngt", two(0xF048, 0x001D), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbnle", two(0xF048, 0x001A), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbnlt", two(0xF048, 0x001B), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdboge", two(0xF048, 0x0003), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbogl", two(0xF048, 0x0006), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbogt", two(0xF048, 0x0002), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbole", two(0xF048, 0x0005), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbolt", two(0xF048, 0x0004), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbor", two(0xF048, 0x0007), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbseq", two(0xF048, 0x0011), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbsf", two(0xF048, 0x0010), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbsne", two(0xF048, 0x001E), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbst", two(0xF048, 0x001F), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbt", two(0xF048, 0x000F), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbueq", two(0xF048, 0x0009), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbuge", two(0xF048, 0x000B), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbugt", two(0xF048, 0x000A), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbule", two(0xF048, 0x000D), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbult", two(0xF048, 0x000C), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, -{"fdbun", two(0xF048, 0x0008), two(0xF1F8, 0xFFFF), "IiDsBw", mfloat }, - -{"fdiv.b", two(0xF000, 0x5820), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"fdiv.d", two(0xF000, 0x5420), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"fdiv.l", two(0xF000, 0x4020), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"fdiv.p", two(0xF000, 0x4C20), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"fdiv.s", two(0xF000, 0x4420), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"fdiv.w", two(0xF000, 0x5020), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"fdiv.x", two(0xF000, 0x0020), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"fdiv.x", two(0xF000, 0x4820), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, - -{"fsdiv.b", two(0xF000, 0x5860), two(0xF1C0, 0xFC7F), "Ii;bF7", m68040up }, -{"fsdiv.d", two(0xF000, 0x5460), two(0xF1C0, 0xFC7F), "Ii;FF7", m68040up }, -{"fsdiv.l", two(0xF000, 0x4060), two(0xF1C0, 0xFC7F), "Ii;lF7", m68040up }, -{"fsdiv.p", two(0xF000, 0x4C60), two(0xF1C0, 0xFC7F), "Ii;pF7", m68040up }, -{"fsdiv.s", two(0xF000, 0x4460), two(0xF1C0, 0xFC7F), "Ii;fF7", m68040up }, -{"fsdiv.w", two(0xF000, 0x5060), two(0xF1C0, 0xFC7F), "Ii;wF7", m68040up }, -{"fsdiv.x", two(0xF000, 0x0060), two(0xF1C0, 0xE07F), "IiF8F7", m68040up }, -{"fsdiv.x", two(0xF000, 0x4860), two(0xF1C0, 0xFC7F), "Ii;xF7", m68040up }, - -{"fddiv.b", two(0xF000, 0x5864), two(0xF1C0, 0xFC7F), "Ii;bF7", m68040up }, -{"fddiv.d", two(0xF000, 0x5464), two(0xF1C0, 0xFC7F), "Ii;FF7", m68040up }, -{"fddiv.l", two(0xF000, 0x4064), two(0xF1C0, 0xFC7F), "Ii;lF7", m68040up }, -{"fddiv.p", two(0xF000, 0x4C64), two(0xF1C0, 0xFC7F), "Ii;pF7", m68040up }, -{"fddiv.s", two(0xF000, 0x4464), two(0xF1C0, 0xFC7F), "Ii;fF7", m68040up }, -{"fddiv.w", two(0xF000, 0x5064), two(0xF1C0, 0xFC7F), "Ii;wF7", m68040up }, -{"fddiv.x", two(0xF000, 0x0064), two(0xF1C0, 0xE07F), "IiF8F7", m68040up }, -{"fddiv.x", two(0xF000, 0x4864), two(0xF1C0, 0xFC7F), "Ii;xF7", m68040up }, - -{"fetox.b", two(0xF000, 0x5810), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"fetox.d", two(0xF000, 0x5410), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"fetox.l", two(0xF000, 0x4010), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"fetox.p", two(0xF000, 0x4C10), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"fetox.s", two(0xF000, 0x4410), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"fetox.w", two(0xF000, 0x5010), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"fetox.x", two(0xF000, 0x0010), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"fetox.x", two(0xF000, 0x4810), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"fetox.x", two(0xF000, 0x0010), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"fetoxm1.b", two(0xF000, 0x5808), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"fetoxm1.d", two(0xF000, 0x5408), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"fetoxm1.l", two(0xF000, 0x4008), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"fetoxm1.p", two(0xF000, 0x4C08), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"fetoxm1.s", two(0xF000, 0x4408), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"fetoxm1.w", two(0xF000, 0x5008), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"fetoxm1.x", two(0xF000, 0x0008), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"fetoxm1.x", two(0xF000, 0x4808), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"fetoxm1.x", two(0xF000, 0x0008), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"fgetexp.b", two(0xF000, 0x581E), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"fgetexp.d", two(0xF000, 0x541E), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"fgetexp.l", two(0xF000, 0x401E), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"fgetexp.p", two(0xF000, 0x4C1E), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"fgetexp.s", two(0xF000, 0x441E), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"fgetexp.w", two(0xF000, 0x501E), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"fgetexp.x", two(0xF000, 0x001E), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"fgetexp.x", two(0xF000, 0x481E), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"fgetexp.x", two(0xF000, 0x001E), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"fgetman.b", two(0xF000, 0x581F), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"fgetman.d", two(0xF000, 0x541F), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"fgetman.l", two(0xF000, 0x401F), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"fgetman.p", two(0xF000, 0x4C1F), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"fgetman.s", two(0xF000, 0x441F), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"fgetman.w", two(0xF000, 0x501F), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"fgetman.x", two(0xF000, 0x001F), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"fgetman.x", two(0xF000, 0x481F), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"fgetman.x", two(0xF000, 0x001F), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"fint.b", two(0xF000, 0x5801), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"fint.d", two(0xF000, 0x5401), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"fint.l", two(0xF000, 0x4001), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"fint.p", two(0xF000, 0x4C01), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"fint.s", two(0xF000, 0x4401), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"fint.w", two(0xF000, 0x5001), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"fint.x", two(0xF000, 0x0001), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"fint.x", two(0xF000, 0x4801), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"fint.x", two(0xF000, 0x0001), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"fintrz.b", two(0xF000, 0x5803), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"fintrz.d", two(0xF000, 0x5403), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"fintrz.l", two(0xF000, 0x4003), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"fintrz.p", two(0xF000, 0x4C03), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"fintrz.s", two(0xF000, 0x4403), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"fintrz.w", two(0xF000, 0x5003), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"fintrz.x", two(0xF000, 0x0003), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"fintrz.x", two(0xF000, 0x4803), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"fintrz.x", two(0xF000, 0x0003), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"flog10.b", two(0xF000, 0x5815), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"flog10.d", two(0xF000, 0x5415), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"flog10.l", two(0xF000, 0x4015), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"flog10.p", two(0xF000, 0x4C15), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"flog10.s", two(0xF000, 0x4415), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"flog10.w", two(0xF000, 0x5015), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"flog10.x", two(0xF000, 0x0015), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"flog10.x", two(0xF000, 0x4815), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"flog10.x", two(0xF000, 0x0015), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"flog2.b", two(0xF000, 0x5816), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"flog2.d", two(0xF000, 0x5416), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"flog2.l", two(0xF000, 0x4016), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"flog2.p", two(0xF000, 0x4C16), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"flog2.s", two(0xF000, 0x4416), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"flog2.w", two(0xF000, 0x5016), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"flog2.x", two(0xF000, 0x0016), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"flog2.x", two(0xF000, 0x4816), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"flog2.x", two(0xF000, 0x0016), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"flogn.b", two(0xF000, 0x5814), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"flogn.d", two(0xF000, 0x5414), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"flogn.l", two(0xF000, 0x4014), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"flogn.p", two(0xF000, 0x4C14), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"flogn.s", two(0xF000, 0x4414), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"flogn.w", two(0xF000, 0x5014), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"flogn.x", two(0xF000, 0x0014), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"flogn.x", two(0xF000, 0x4814), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"flogn.x", two(0xF000, 0x0014), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"flognp1.b", two(0xF000, 0x5806), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"flognp1.d", two(0xF000, 0x5406), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"flognp1.l", two(0xF000, 0x4006), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"flognp1.p", two(0xF000, 0x4C06), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"flognp1.s", two(0xF000, 0x4406), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"flognp1.w", two(0xF000, 0x5006), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"flognp1.x", two(0xF000, 0x0006), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"flognp1.x", two(0xF000, 0x4806), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"flognp1.x", two(0xF000, 0x0006), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"fmod.b", two(0xF000, 0x5821), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"fmod.d", two(0xF000, 0x5421), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"fmod.l", two(0xF000, 0x4021), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"fmod.p", two(0xF000, 0x4C21), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"fmod.s", two(0xF000, 0x4421), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"fmod.w", two(0xF000, 0x5021), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"fmod.x", two(0xF000, 0x0021), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"fmod.x", two(0xF000, 0x4821), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, - -{"fmove.b", two(0xF000, 0x5800), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"fmove.b", two(0xF000, 0x7800), two(0xF1C0, 0xFC7F), "IiF7$b", mfloat }, -{"fmove.d", two(0xF000, 0x5400), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"fmove.d", two(0xF000, 0x7400), two(0xF1C0, 0xFC7F), "IiF7~F", mfloat }, -{"fmove.l", two(0xF000, 0x4000), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"fmove.l", two(0xF000, 0x6000), two(0xF1C0, 0xFC7F), "IiF7$l", mfloat }, -/* FIXME: the next two variants should not permit moving an address - register to anything but the floating point instruction register. */ -{"fmove.l", two(0xF000, 0xA000), two(0xF1C0, 0xE3FF), "Iis8%s", mfloat }, -{"fmove.l", two(0xF000, 0x8000), two(0xF1C0, 0xE3FF), "Ii*ls8", mfloat }, -{"fmove.p", two(0xF000, 0x4C00), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"fmove.p", two(0xF000, 0x6C00), two(0xF1C0, 0xFC00), "IiF7~pkC", mfloat }, -{"fmove.p", two(0xF000, 0x7C00), two(0xF1C0, 0xFC0F), "IiF7~pDk", mfloat }, -{"fmove.s", two(0xF000, 0x4400), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"fmove.s", two(0xF000, 0x6400), two(0xF1C0, 0xFC7F), "IiF7$f", mfloat }, -{"fmove.w", two(0xF000, 0x5000), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"fmove.w", two(0xF000, 0x7000), two(0xF1C0, 0xFC7F), "IiF7$w", mfloat }, -{"fmove.x", two(0xF000, 0x0000), two(0xF1FF, 0xE07F), "IiF8F7", mfloat }, -{"fmove.x", two(0xF000, 0x4800), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"fmove.x", two(0xF000, 0x6800), two(0xF1C0, 0xFC7F), "IiF7~x", mfloat }, - -{"fsmove.b", two(0xF000, 0x5840), two(0xF1C0, 0xFC7F), "Ii;bF7", m68040up }, -{"fsmove.d", two(0xF000, 0x5440), two(0xF1C0, 0xFC7F), "Ii;FF7", m68040up }, -{"fsmove.l", two(0xF000, 0x4040), two(0xF1C0, 0xFC7F), "Ii;lF7", m68040up }, -{"fsmove.s", two(0xF000, 0x4440), two(0xF1C0, 0xFC7F), "Ii;fF7", m68040up }, -{"fsmove.w", two(0xF000, 0x5040), two(0xF1C0, 0xFC7F), "Ii;wF7", m68040up }, -{"fsmove.x", two(0xF000, 0x0040), two(0xF1C0, 0xE07F), "IiF8F7", m68040up }, -{"fsmove.x", two(0xF000, 0x4840), two(0xF1C0, 0xFC7F), "Ii;xF7", m68040up }, -{"fsmove.p", two(0xF000, 0x4C40), two(0xF1C0, 0xFC7F), "Ii;pF7", m68040up }, - -{"fdmove.b", two(0xF000, 0x5844), two(0xF1C0, 0xFC7F), "Ii;bF7", m68040up }, -{"fdmove.d", two(0xF000, 0x5444), two(0xF1C0, 0xFC7F), "Ii;FF7", m68040up }, -{"fdmove.l", two(0xF000, 0x4044), two(0xF1C0, 0xFC7F), "Ii;lF7", m68040up }, -{"fdmove.s", two(0xF000, 0x4444), two(0xF1C0, 0xFC7F), "Ii;fF7", m68040up }, -{"fdmove.w", two(0xF000, 0x5044), two(0xF1C0, 0xFC7F), "Ii;wF7", m68040up }, -{"fdmove.x", two(0xF000, 0x0044), two(0xF1C0, 0xE07F), "IiF8F7", m68040up }, -{"fdmove.x", two(0xF000, 0x4844), two(0xF1C0, 0xFC7F), "Ii;xF7", m68040up }, -{"fdmove.p", two(0xF000, 0x4C44), two(0xF1C0, 0xFC7F), "Ii;pF7", m68040up }, - -{"fmovecr.x", two(0xF000, 0x5C00), two(0xF1FF, 0xFC00), "Ii#CF7", mfloat }, - -{"fmovem.x", two(0xF000, 0xF800), two(0xF1C0, 0xFF8F), "IiDk&s", mfloat }, -{"fmovem.x", two(0xF020, 0xE800), two(0xF1F8, 0xFF8F), "IiDk-s", mfloat }, -{"fmovem.x", two(0xF000, 0xD800), two(0xF1C0, 0xFF8F), "Ii&sDk", mfloat }, -{"fmovem.x", two(0xF018, 0xD800), two(0xF1F8, 0xFF8F), "Ii+sDk", mfloat }, -{"fmovem.x", two(0xF000, 0xF000), two(0xF1C0, 0xFF00), "Idl3&s", mfloat }, -{"fmovem.x", two(0xF000, 0xF000), two(0xF1C0, 0xFF00), "Id#3&s", mfloat }, -{"fmovem.x", two(0xF000, 0xD000), two(0xF1C0, 0xFF00), "Id&sl3", mfloat }, -{"fmovem.x", two(0xF000, 0xD000), two(0xF1C0, 0xFF00), "Id&s#3", mfloat }, -{"fmovem.x", two(0xF020, 0xE000), two(0xF1F8, 0xFF00), "IdL3-s", mfloat }, -{"fmovem.x", two(0xF020, 0xE000), two(0xF1F8, 0xFF00), "Id#3-s", mfloat }, -{"fmovem.x", two(0xF018, 0xD000), two(0xF1F8, 0xFF00), "Id+sl3", mfloat }, -{"fmovem.x", two(0xF018, 0xD000), two(0xF1F8, 0xFF00), "Id+s#3", mfloat }, - -{"fmovem.l", two(0xF000, 0xA000), two(0xF1C0, 0xE3FF), "Iis8%s", mfloat }, -{"fmovem.l", two(0xF000, 0xA000), two(0xF1C0, 0xE3FF), "IiL8~s", mfloat }, -/* FIXME: In the next instruction, we should only permit %dn if the - target is a single register. We should only permit %an if the - target is a single %fpiar. */ -{"fmovem.l", two(0xF000, 0x8000), two(0xF1C0, 0xE3FF), "Ii*lL8", mfloat }, - -{"fmovem", two(0xF020, 0xE000), two(0xF1F8, 0xFF00), "IdL3-s", mfloat }, -{"fmovem", two(0xF000, 0xF000), two(0xF1C0, 0xFF00), "Idl3&s", mfloat }, -{"fmovem", two(0xF018, 0xD000), two(0xF1F8, 0xFF00), "Id+sl3", mfloat }, -{"fmovem", two(0xF000, 0xD000), two(0xF1C0, 0xFF00), "Id&sl3", mfloat }, -{"fmovem", two(0xF020, 0xE000), two(0xF1F8, 0xFF00), "Id#3-s", mfloat }, -{"fmovem", two(0xF020, 0xE800), two(0xF1F8, 0xFF8F), "IiDk-s", mfloat }, -{"fmovem", two(0xF000, 0xF000), two(0xF1C0, 0xFF00), "Id#3&s", mfloat }, -{"fmovem", two(0xF000, 0xF800), two(0xF1C0, 0xFF8F), "IiDk&s", mfloat }, -{"fmovem", two(0xF018, 0xD000), two(0xF1F8, 0xFF00), "Id+s#3", mfloat }, -{"fmovem", two(0xF018, 0xD800), two(0xF1F8, 0xFF8F), "Ii+sDk", mfloat }, -{"fmovem", two(0xF000, 0xD000), two(0xF1C0, 0xFF00), "Id&s#3", mfloat }, -{"fmovem", two(0xF000, 0xD800), two(0xF1C0, 0xFF8F), "Ii&sDk", mfloat }, -{"fmovem", two(0xF000, 0xA000), two(0xF1C0, 0xE3FF), "Iis8%s", mfloat }, -{"fmovem", two(0xF000, 0x8000), two(0xF1C0, 0xE3FF), "Ii*ss8", mfloat }, -{"fmovem", two(0xF000, 0xA000), two(0xF1C0, 0xE3FF), "IiL8~s", mfloat }, -{"fmovem", two(0xF000, 0x8000), two(0xF2C0, 0xE3FF), "Ii*sL8", mfloat }, - -{"fmul.b", two(0xF000, 0x5823), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"fmul.d", two(0xF000, 0x5423), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"fmul.l", two(0xF000, 0x4023), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"fmul.p", two(0xF000, 0x4C23), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"fmul.s", two(0xF000, 0x4423), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"fmul.w", two(0xF000, 0x5023), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"fmul.x", two(0xF000, 0x0023), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"fmul.x", two(0xF000, 0x4823), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, - -{"fsmul.b", two(0xF000, 0x5863), two(0xF1C0, 0xFC7F), "Ii;bF7", m68040up }, -{"fsmul.d", two(0xF000, 0x5463), two(0xF1C0, 0xFC7F), "Ii;FF7", m68040up }, -{"fsmul.l", two(0xF000, 0x4063), two(0xF1C0, 0xFC7F), "Ii;lF7", m68040up }, -{"fsmul.p", two(0xF000, 0x4C63), two(0xF1C0, 0xFC7F), "Ii;pF7", m68040up }, -{"fsmul.s", two(0xF000, 0x4463), two(0xF1C0, 0xFC7F), "Ii;fF7", m68040up }, -{"fsmul.w", two(0xF000, 0x5063), two(0xF1C0, 0xFC7F), "Ii;wF7", m68040up }, -{"fsmul.x", two(0xF000, 0x0063), two(0xF1C0, 0xE07F), "IiF8F7", m68040up }, -{"fsmul.x", two(0xF000, 0x4863), two(0xF1C0, 0xFC7F), "Ii;xF7", m68040up }, - -{"fdmul.b", two(0xF000, 0x5867), two(0xF1C0, 0xFC7F), "Ii;bF7", m68040up }, -{"fdmul.d", two(0xF000, 0x5467), two(0xF1C0, 0xFC7F), "Ii;FF7", m68040up }, -{"fdmul.l", two(0xF000, 0x4067), two(0xF1C0, 0xFC7F), "Ii;lF7", m68040up }, -{"fdmul.p", two(0xF000, 0x4C67), two(0xF1C0, 0xFC7F), "Ii;pF7", m68040up }, -{"fdmul.s", two(0xF000, 0x4467), two(0xF1C0, 0xFC7F), "Ii;fF7", m68040up }, -{"fdmul.w", two(0xF000, 0x5067), two(0xF1C0, 0xFC7F), "Ii;wF7", m68040up }, -{"fdmul.x", two(0xF000, 0x0067), two(0xF1C0, 0xE07F), "IiF8F7", m68040up }, -{"fdmul.x", two(0xF000, 0x4867), two(0xF1C0, 0xFC7F), "Ii;xF7", m68040up }, - -{"fneg.b", two(0xF000, 0x581A), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"fneg.d", two(0xF000, 0x541A), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"fneg.l", two(0xF000, 0x401A), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"fneg.p", two(0xF000, 0x4C1A), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"fneg.s", two(0xF000, 0x441A), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"fneg.w", two(0xF000, 0x501A), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"fneg.x", two(0xF000, 0x001A), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"fneg.x", two(0xF000, 0x481A), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"fneg.x", two(0xF000, 0x001A), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"fsneg.b", two(0xF000, 0x585A), two(0xF1C0, 0xFC7F), "Ii;bF7", m68040up }, -{"fsneg.d", two(0xF000, 0x545A), two(0xF1C0, 0xFC7F), "Ii;FF7", m68040up }, -{"fsneg.l", two(0xF000, 0x405A), two(0xF1C0, 0xFC7F), "Ii;lF7", m68040up }, -{"fsneg.p", two(0xF000, 0x4C5A), two(0xF1C0, 0xFC7F), "Ii;pF7", m68040up }, -{"fsneg.s", two(0xF000, 0x445A), two(0xF1C0, 0xFC7F), "Ii;fF7", m68040up }, -{"fsneg.w", two(0xF000, 0x505A), two(0xF1C0, 0xFC7F), "Ii;wF7", m68040up }, -{"fsneg.x", two(0xF000, 0x005A), two(0xF1C0, 0xE07F), "IiF8F7", m68040up }, -{"fsneg.x", two(0xF000, 0x485A), two(0xF1C0, 0xFC7F), "Ii;xF7", m68040up }, -{"fsneg.x", two(0xF000, 0x005A), two(0xF1C0, 0xE07F), "IiFt", m68040up }, - -{"fdneg.b", two(0xF000, 0x585E), two(0xF1C0, 0xFC7F), "Ii;bF7", m68040up }, -{"fdneg.d", two(0xF000, 0x545E), two(0xF1C0, 0xFC7F), "Ii;FF7", m68040up }, -{"fdneg.l", two(0xF000, 0x405E), two(0xF1C0, 0xFC7F), "Ii;lF7", m68040up }, -{"fdneg.p", two(0xF000, 0x4C5E), two(0xF1C0, 0xFC7F), "Ii;pF7", m68040up }, -{"fdneg.s", two(0xF000, 0x445E), two(0xF1C0, 0xFC7F), "Ii;fF7", m68040up }, -{"fdneg.w", two(0xF000, 0x505E), two(0xF1C0, 0xFC7F), "Ii;wF7", m68040up }, -{"fdneg.x", two(0xF000, 0x005E), two(0xF1C0, 0xE07F), "IiF8F7", m68040up }, -{"fdneg.x", two(0xF000, 0x485E), two(0xF1C0, 0xFC7F), "Ii;xF7", m68040up }, -{"fdneg.x", two(0xF000, 0x005E), two(0xF1C0, 0xE07F), "IiFt", m68040up }, - -{"fnop", two(0xF280, 0x0000), two(0xFFFF, 0xFFFF), "Ii", mfloat }, - -{"frem.b", two(0xF000, 0x5825), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"frem.d", two(0xF000, 0x5425), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"frem.l", two(0xF000, 0x4025), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"frem.p", two(0xF000, 0x4C25), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"frem.s", two(0xF000, 0x4425), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"frem.w", two(0xF000, 0x5025), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"frem.x", two(0xF000, 0x0025), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"frem.x", two(0xF000, 0x4825), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, - -{"frestore", one(0xF140), one(0xF1C0), "Ids", mfloat }, - -{"fscale.b", two(0xF000, 0x5826), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"fscale.d", two(0xF000, 0x5426), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"fscale.l", two(0xF000, 0x4026), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"fscale.p", two(0xF000, 0x4C26), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"fscale.s", two(0xF000, 0x4426), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"fscale.w", two(0xF000, 0x5026), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"fscale.x", two(0xF000, 0x0026), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"fscale.x", two(0xF000, 0x4826), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, - -/* $ is necessary to prevent the assembler from using PC-relative. - If @ were used, "label: fseq label" could produce "ftrapeq", - because "label" became "pc@label". */ -{"fseq", two(0xF040, 0x0001), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsf", two(0xF040, 0x0000), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsge", two(0xF040, 0x0013), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsgl", two(0xF040, 0x0016), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsgle", two(0xF040, 0x0017), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsgt", two(0xF040, 0x0012), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsle", two(0xF040, 0x0015), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fslt", two(0xF040, 0x0014), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsne", two(0xF040, 0x000E), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsnge", two(0xF040, 0x001C), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsngl", two(0xF040, 0x0019), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsngle", two(0xF040, 0x0018), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsngt", two(0xF040, 0x001D), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsnle", two(0xF040, 0x001A), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsnlt", two(0xF040, 0x001B), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsoge", two(0xF040, 0x0003), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsogl", two(0xF040, 0x0006), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsogt", two(0xF040, 0x0002), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsole", two(0xF040, 0x0005), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsolt", two(0xF040, 0x0004), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsor", two(0xF040, 0x0007), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsseq", two(0xF040, 0x0011), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fssf", two(0xF040, 0x0010), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fssne", two(0xF040, 0x001E), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsst", two(0xF040, 0x001F), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fst", two(0xF040, 0x000F), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsueq", two(0xF040, 0x0009), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsuge", two(0xF040, 0x000B), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsugt", two(0xF040, 0x000A), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsule", two(0xF040, 0x000D), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsult", two(0xF040, 0x000C), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, -{"fsun", two(0xF040, 0x0008), two(0xF1C0, 0xFFFF), "Ii$s", mfloat }, - -{"fsgldiv.b", two(0xF000, 0x5824), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"fsgldiv.d", two(0xF000, 0x5424), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"fsgldiv.l", two(0xF000, 0x4024), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"fsgldiv.p", two(0xF000, 0x4C24), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"fsgldiv.s", two(0xF000, 0x4424), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"fsgldiv.w", two(0xF000, 0x5024), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"fsgldiv.x", two(0xF000, 0x0024), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"fsgldiv.x", two(0xF000, 0x4824), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"fsgldiv.x", two(0xF000, 0x0024), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"fsglmul.b", two(0xF000, 0x5827), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"fsglmul.d", two(0xF000, 0x5427), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"fsglmul.l", two(0xF000, 0x4027), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"fsglmul.p", two(0xF000, 0x4C27), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"fsglmul.s", two(0xF000, 0x4427), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"fsglmul.w", two(0xF000, 0x5027), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"fsglmul.x", two(0xF000, 0x0027), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"fsglmul.x", two(0xF000, 0x4827), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"fsglmul.x", two(0xF000, 0x0027), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"fsin.b", two(0xF000, 0x580E), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"fsin.d", two(0xF000, 0x540E), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"fsin.l", two(0xF000, 0x400E), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"fsin.p", two(0xF000, 0x4C0E), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"fsin.s", two(0xF000, 0x440E), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"fsin.w", two(0xF000, 0x500E), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"fsin.x", two(0xF000, 0x000E), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"fsin.x", two(0xF000, 0x480E), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"fsin.x", two(0xF000, 0x000E), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"fsincos.b", two(0xF000, 0x5830), two(0xF1C0, 0xFC78), "Ii;bF3F7", mfloat }, -{"fsincos.d", two(0xF000, 0x5430), two(0xF1C0, 0xFC78), "Ii;FF3F7", mfloat }, -{"fsincos.l", two(0xF000, 0x4030), two(0xF1C0, 0xFC78), "Ii;lF3F7", mfloat }, -{"fsincos.p", two(0xF000, 0x4C30), two(0xF1C0, 0xFC78), "Ii;pF3F7", mfloat }, -{"fsincos.s", two(0xF000, 0x4430), two(0xF1C0, 0xFC78), "Ii;fF3F7", mfloat }, -{"fsincos.w", two(0xF000, 0x5030), two(0xF1C0, 0xFC78), "Ii;wF3F7", mfloat }, -{"fsincos.x", two(0xF000, 0x0030), two(0xF1C0, 0xE078), "IiF8F3F7", mfloat }, -{"fsincos.x", two(0xF000, 0x4830), two(0xF1C0, 0xFC78), "Ii;xF3F7", mfloat }, - -{"fsinh.b", two(0xF000, 0x5802), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"fsinh.d", two(0xF000, 0x5402), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"fsinh.l", two(0xF000, 0x4002), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"fsinh.p", two(0xF000, 0x4C02), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"fsinh.s", two(0xF000, 0x4402), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"fsinh.w", two(0xF000, 0x5002), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"fsinh.x", two(0xF000, 0x0002), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"fsinh.x", two(0xF000, 0x4802), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"fsinh.x", two(0xF000, 0x0002), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"fsqrt.b", two(0xF000, 0x5804), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"fsqrt.d", two(0xF000, 0x5404), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"fsqrt.l", two(0xF000, 0x4004), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"fsqrt.p", two(0xF000, 0x4C04), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"fsqrt.s", two(0xF000, 0x4404), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"fsqrt.w", two(0xF000, 0x5004), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"fsqrt.x", two(0xF000, 0x0004), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"fsqrt.x", two(0xF000, 0x4804), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"fsqrt.x", two(0xF000, 0x0004), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"fssqrt.b", two(0xF000, 0x5841), two(0xF1C0, 0xFC7F), "Ii;bF7", m68040up }, -{"fssqrt.d", two(0xF000, 0x5441), two(0xF1C0, 0xFC7F), "Ii;FF7", m68040up }, -{"fssqrt.l", two(0xF000, 0x4041), two(0xF1C0, 0xFC7F), "Ii;lF7", m68040up }, -{"fssqrt.p", two(0xF000, 0x4C41), two(0xF1C0, 0xFC7F), "Ii;pF7", m68040up }, -{"fssqrt.s", two(0xF000, 0x4441), two(0xF1C0, 0xFC7F), "Ii;fF7", m68040up }, -{"fssqrt.w", two(0xF000, 0x5041), two(0xF1C0, 0xFC7F), "Ii;wF7", m68040up }, -{"fssqrt.x", two(0xF000, 0x0041), two(0xF1C0, 0xE07F), "IiF8F7", m68040up }, -{"fssqrt.x", two(0xF000, 0x4841), two(0xF1C0, 0xFC7F), "Ii;xF7", m68040up }, -{"fssqrt.x", two(0xF000, 0x0041), two(0xF1C0, 0xE07F), "IiFt", m68040up }, - -{"fdsqrt.b", two(0xF000, 0x5845), two(0xF1C0, 0xFC7F), "Ii;bF7", m68040up }, -{"fdsqrt.d", two(0xF000, 0x5445), two(0xF1C0, 0xFC7F), "Ii;FF7", m68040up }, -{"fdsqrt.l", two(0xF000, 0x4045), two(0xF1C0, 0xFC7F), "Ii;lF7", m68040up }, -{"fdsqrt.p", two(0xF000, 0x4C45), two(0xF1C0, 0xFC7F), "Ii;pF7", m68040up }, -{"fdsqrt.s", two(0xF000, 0x4445), two(0xF1C0, 0xFC7F), "Ii;fF7", m68040up }, -{"fdsqrt.w", two(0xF000, 0x5045), two(0xF1C0, 0xFC7F), "Ii;wF7", m68040up }, -{"fdsqrt.x", two(0xF000, 0x0045), two(0xF1C0, 0xE07F), "IiF8F7", m68040up }, -{"fdsqrt.x", two(0xF000, 0x4845), two(0xF1C0, 0xFC7F), "Ii;xF7", m68040up }, -{"fdsqrt.x", two(0xF000, 0x0045), two(0xF1C0, 0xE07F), "IiFt", m68040up }, - -{"fsub.b", two(0xF000, 0x5828), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"fsub.d", two(0xF000, 0x5428), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"fsub.l", two(0xF000, 0x4028), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"fsub.p", two(0xF000, 0x4C28), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"fsub.s", two(0xF000, 0x4428), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"fsub.w", two(0xF000, 0x5028), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"fsub.x", two(0xF000, 0x0028), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"fsub.x", two(0xF000, 0x4828), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"fsub.x", two(0xF000, 0x0028), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"fssub.b", two(0xF000, 0x5868), two(0xF1C0, 0xFC7F), "Ii;bF7", m68040up }, -{"fssub.d", two(0xF000, 0x5468), two(0xF1C0, 0xFC7F), "Ii;FF7", m68040up }, -{"fssub.l", two(0xF000, 0x4068), two(0xF1C0, 0xFC7F), "Ii;lF7", m68040up }, -{"fssub.p", two(0xF000, 0x4C68), two(0xF1C0, 0xFC7F), "Ii;pF7", m68040up }, -{"fssub.s", two(0xF000, 0x4468), two(0xF1C0, 0xFC7F), "Ii;fF7", m68040up }, -{"fssub.w", two(0xF000, 0x5068), two(0xF1C0, 0xFC7F), "Ii;wF7", m68040up }, -{"fssub.x", two(0xF000, 0x0068), two(0xF1C0, 0xE07F), "IiF8F7", m68040up }, -{"fssub.x", two(0xF000, 0x4868), two(0xF1C0, 0xFC7F), "Ii;xF7", m68040up }, -{"fssub.x", two(0xF000, 0x0068), two(0xF1C0, 0xE07F), "IiFt", m68040up }, - -{"fdsub.b", two(0xF000, 0x586c), two(0xF1C0, 0xFC7F), "Ii;bF7", m68040up }, -{"fdsub.d", two(0xF000, 0x546c), two(0xF1C0, 0xFC7F), "Ii;FF7", m68040up }, -{"fdsub.l", two(0xF000, 0x406c), two(0xF1C0, 0xFC7F), "Ii;lF7", m68040up }, -{"fdsub.p", two(0xF000, 0x4C6c), two(0xF1C0, 0xFC7F), "Ii;pF7", m68040up }, -{"fdsub.s", two(0xF000, 0x446c), two(0xF1C0, 0xFC7F), "Ii;fF7", m68040up }, -{"fdsub.w", two(0xF000, 0x506c), two(0xF1C0, 0xFC7F), "Ii;wF7", m68040up }, -{"fdsub.x", two(0xF000, 0x006c), two(0xF1C0, 0xE07F), "IiF8F7", m68040up }, -{"fdsub.x", two(0xF000, 0x486c), two(0xF1C0, 0xFC7F), "Ii;xF7", m68040up }, -{"fdsub.x", two(0xF000, 0x006c), two(0xF1C0, 0xE07F), "IiFt", m68040up }, - -{"ftan.b", two(0xF000, 0x580F), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"ftan.d", two(0xF000, 0x540F), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"ftan.l", two(0xF000, 0x400F), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"ftan.p", two(0xF000, 0x4C0F), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"ftan.s", two(0xF000, 0x440F), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"ftan.w", two(0xF000, 0x500F), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"ftan.x", two(0xF000, 0x000F), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"ftan.x", two(0xF000, 0x480F), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"ftan.x", two(0xF000, 0x000F), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"ftanh.b", two(0xF000, 0x5809), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"ftanh.d", two(0xF000, 0x5409), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"ftanh.l", two(0xF000, 0x4009), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"ftanh.p", two(0xF000, 0x4C09), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"ftanh.s", two(0xF000, 0x4409), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"ftanh.w", two(0xF000, 0x5009), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"ftanh.x", two(0xF000, 0x0009), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"ftanh.x", two(0xF000, 0x4809), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"ftanh.x", two(0xF000, 0x0009), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"ftentox.b", two(0xF000, 0x5812), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"ftentox.d", two(0xF000, 0x5412), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"ftentox.l", two(0xF000, 0x4012), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"ftentox.p", two(0xF000, 0x4C12), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"ftentox.s", two(0xF000, 0x4412), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"ftentox.w", two(0xF000, 0x5012), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"ftentox.x", two(0xF000, 0x0012), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"ftentox.x", two(0xF000, 0x4812), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"ftentox.x", two(0xF000, 0x0012), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"ftrapeq", two(0xF07C, 0x0001), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapf", two(0xF07C, 0x0000), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapge", two(0xF07C, 0x0013), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapgl", two(0xF07C, 0x0016), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapgle", two(0xF07C, 0x0017), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapgt", two(0xF07C, 0x0012), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftraple", two(0xF07C, 0x0015), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftraplt", two(0xF07C, 0x0014), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapne", two(0xF07C, 0x000E), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapnge", two(0xF07C, 0x001C), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapngl", two(0xF07C, 0x0019), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapngle", two(0xF07C, 0x0018), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapngt", two(0xF07C, 0x001D), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapnle", two(0xF07C, 0x001A), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapnlt", two(0xF07C, 0x001B), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapoge", two(0xF07C, 0x0003), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapogl", two(0xF07C, 0x0006), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapogt", two(0xF07C, 0x0002), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapole", two(0xF07C, 0x0005), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapolt", two(0xF07C, 0x0004), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapor", two(0xF07C, 0x0007), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapseq", two(0xF07C, 0x0011), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapsf", two(0xF07C, 0x0010), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapsne", two(0xF07C, 0x001E), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapst", two(0xF07C, 0x001F), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapt", two(0xF07C, 0x000F), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapueq", two(0xF07C, 0x0009), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapuge", two(0xF07C, 0x000B), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapugt", two(0xF07C, 0x000A), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapule", two(0xF07C, 0x000D), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapult", two(0xF07C, 0x000C), two(0xF1FF, 0xFFFF), "Ii", mfloat }, -{"ftrapun", two(0xF07C, 0x0008), two(0xF1FF, 0xFFFF), "Ii", mfloat }, - -{"ftrapeq.w", two(0xF07A, 0x0001), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapf.w", two(0xF07A, 0x0000), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapge.w", two(0xF07A, 0x0013), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapgl.w", two(0xF07A, 0x0016), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapgle.w", two(0xF07A, 0x0017), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapgt.w", two(0xF07A, 0x0012), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftraple.w", two(0xF07A, 0x0015), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftraplt.w", two(0xF07A, 0x0014), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapne.w", two(0xF07A, 0x000E), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapnge.w", two(0xF07A, 0x001C), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapngl.w", two(0xF07A, 0x0019), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapngle.w", two(0xF07A, 0x0018), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapngt.w", two(0xF07A, 0x001D), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapnle.w", two(0xF07A, 0x001A), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapnlt.w", two(0xF07A, 0x001B), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapoge.w", two(0xF07A, 0x0003), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapogl.w", two(0xF07A, 0x0006), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapogt.w", two(0xF07A, 0x0002), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapole.w", two(0xF07A, 0x0005), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapolt.w", two(0xF07A, 0x0004), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapor.w", two(0xF07A, 0x0007), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapseq.w", two(0xF07A, 0x0011), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapsf.w", two(0xF07A, 0x0010), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapsne.w", two(0xF07A, 0x001E), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapst.w", two(0xF07A, 0x001F), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapt.w", two(0xF07A, 0x000F), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapueq.w", two(0xF07A, 0x0009), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapuge.w", two(0xF07A, 0x000B), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapugt.w", two(0xF07A, 0x000A), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapule.w", two(0xF07A, 0x000D), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapult.w", two(0xF07A, 0x000C), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, -{"ftrapun.w", two(0xF07A, 0x0008), two(0xF1FF, 0xFFFF), "Ii^w", mfloat }, - -{"ftrapeq.l", two(0xF07B, 0x0001), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapf.l", two(0xF07B, 0x0000), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapge.l", two(0xF07B, 0x0013), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapgl.l", two(0xF07B, 0x0016), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapgle.l", two(0xF07B, 0x0017), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapgt.l", two(0xF07B, 0x0012), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftraple.l", two(0xF07B, 0x0015), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftraplt.l", two(0xF07B, 0x0014), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapne.l", two(0xF07B, 0x000E), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapnge.l", two(0xF07B, 0x001C), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapngl.l", two(0xF07B, 0x0019), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapngle.l", two(0xF07B, 0x0018), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapngt.l", two(0xF07B, 0x001D), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapnle.l", two(0xF07B, 0x001A), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapnlt.l", two(0xF07B, 0x001B), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapoge.l", two(0xF07B, 0x0003), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapogl.l", two(0xF07B, 0x0006), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapogt.l", two(0xF07B, 0x0002), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapole.l", two(0xF07B, 0x0005), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapolt.l", two(0xF07B, 0x0004), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapor.l", two(0xF07B, 0x0007), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapseq.l", two(0xF07B, 0x0011), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapsf.l", two(0xF07B, 0x0010), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapsne.l", two(0xF07B, 0x001E), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapst.l", two(0xF07B, 0x001F), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapt.l", two(0xF07B, 0x000F), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapueq.l", two(0xF07B, 0x0009), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapuge.l", two(0xF07B, 0x000B), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapugt.l", two(0xF07B, 0x000A), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapule.l", two(0xF07B, 0x000D), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapult.l", two(0xF07B, 0x000C), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, -{"ftrapun.l", two(0xF07B, 0x0008), two(0xF1FF, 0xFFFF), "Ii^l", mfloat }, - -{"ftst.b", two(0xF000, 0x583A), two(0xF1C0, 0xFC7F), "Ii;b", mfloat }, -{"ftst.d", two(0xF000, 0x543A), two(0xF1C0, 0xFC7F), "Ii;F", mfloat }, -{"ftst.l", two(0xF000, 0x403A), two(0xF1C0, 0xFC7F), "Ii;l", mfloat }, -{"ftst.p", two(0xF000, 0x4C3A), two(0xF1C0, 0xFC7F), "Ii;p", mfloat }, -{"ftst.s", two(0xF000, 0x443A), two(0xF1C0, 0xFC7F), "Ii;f", mfloat }, -{"ftst.w", two(0xF000, 0x503A), two(0xF1C0, 0xFC7F), "Ii;w", mfloat }, -{"ftst.x", two(0xF000, 0x003A), two(0xF1C0, 0xE07F), "IiF8", mfloat }, -{"ftst.x", two(0xF000, 0x483A), two(0xF1C0, 0xFC7F), "Ii;x", mfloat }, - -{"ftwotox.b", two(0xF000, 0x5811), two(0xF1C0, 0xFC7F), "Ii;bF7", mfloat }, -{"ftwotox.d", two(0xF000, 0x5411), two(0xF1C0, 0xFC7F), "Ii;FF7", mfloat }, -{"ftwotox.l", two(0xF000, 0x4011), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, -{"ftwotox.p", two(0xF000, 0x4C11), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, -{"ftwotox.s", two(0xF000, 0x4411), two(0xF1C0, 0xFC7F), "Ii;fF7", mfloat }, -{"ftwotox.w", two(0xF000, 0x5011), two(0xF1C0, 0xFC7F), "Ii;wF7", mfloat }, -{"ftwotox.x", two(0xF000, 0x0011), two(0xF1C0, 0xE07F), "IiF8F7", mfloat }, -{"ftwotox.x", two(0xF000, 0x4811), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat }, -{"ftwotox.x", two(0xF000, 0x0011), two(0xF1C0, 0xE07F), "IiFt", mfloat }, - -{"halt", one(0045310), one(0177777), "", m68060 | mcf5200 }, - -{"illegal", one(0045374), one(0177777), "", m68000up }, - -{"jmp", one(0047300), one(0177700), "!s", m68000up | mcf5200 }, - -{"jra", one(0060000), one(0177400), "Bg", m68000up | mcf5200 }, -{"jra", one(0047300), one(0177700), "!s", m68000up | mcf5200 }, - -{"jsr", one(0047200), one(0177700), "!s", m68000up | mcf5200 }, - -{"jbsr", one(0060400), one(0177400), "Bg", m68000up | mcf5200 }, -{"jbsr", one(0047200), one(0177700), "!s", m68000up | mcf5200 }, - -{"lea", one(0040700), one(0170700), "!sAd", m68000up | mcf5200 }, - -{"lpstop", two(0174000,0000700),two(0177777,0177777),"#w", cpu32|m68060 }, - -{"link.w", one(0047120), one(0177770), "As#w", m68000up | mcf5200 }, -{"link.l", one(0044010), one(0177770), "As#l", m68020up | cpu32 }, -{"link", one(0047120), one(0177770), "As#W", m68000up | mcf5200 }, -{"link", one(0044010), one(0177770), "As#l", m68020up | cpu32 }, - -{"lsl.b", one(0160410), one(0170770), "QdDs", m68000up }, -{"lsl.b", one(0160450), one(0170770), "DdDs", m68000up }, -{"lsl.w", one(0160510), one(0170770), "QdDs", m68000up }, -{"lsl.w", one(0160550), one(0170770), "DdDs", m68000up }, -{"lsl.w", one(0161700), one(0177700), "~s", m68000up }, -{"lsl.l", one(0160610), one(0170770), "QdDs", m68000up | mcf5200 }, -{"lsl.l", one(0160650), one(0170770), "DdDs", m68000up | mcf5200 }, - -{"lsr.b", one(0160010), one(0170770), "QdDs", m68000up }, -{"lsr.b", one(0160050), one(0170770), "DdDs", m68000up }, -{"lsr.w", one(0160110), one(0170770), "QdDs", m68000up }, -{"lsr.w", one(0160150), one(0170770), "DdDs", m68000up }, -{"lsr.w", one(0161300), one(0177700), "~s", m68000up }, -{"lsr.l", one(0160210), one(0170770), "QdDs", m68000up | mcf5200 }, -{"lsr.l", one(0160250), one(0170770), "DdDs", m68000up | mcf5200 }, - -/* NOTE: The mcf5200 family programmer's reference manual does not - indicate the byte form of the movea instruction is invalid (as it - is on 68000 family cpus). However, experiments on the 5202 yeild - unexpected results. The value is copied, but it is not sign extended - (as is done with movea.w) and the top three bytes in the address - register are not disturbed. I don't know if this is the intended - behavior --- it could be a hole in instruction decoding (Motorola - decided not to trap all invalid instructions for performance reasons) - --- but I suspect that it is not. - - I reported this to Motorola ISD Technical Communications Support, - which replied that other coldfire assemblers reject movea.b. For - this reason I've decided to not allow moveab. - - jtc@cygnus.com - 97/01/24 - */ - -{"movea.l", one(0020100), one(0170700), "*lAd", m68000up | mcf5200 }, -{"movea.w", one(0030100), one(0170700), "*wAd", m68000up | mcf5200 }, - -{"movec", one(0047173), one(0177777), "R1Jj", m68010up | mcf5200 }, -{"movec", one(0047173), one(0177777), "R1#j", m68010up | mcf5200 }, -{"movec", one(0047172), one(0177777), "JjR1", m68010up }, -{"movec", one(0047172), one(0177777), "#jR1", m68010up }, - -{"movem.w", one(0044200), one(0177700), "Lw&s", m68000up }, -{"movem.w", one(0044240), one(0177770), "lw-s", m68000up }, -{"movem.w", one(0044200), one(0177700), "#w>s", m68000up }, -{"movem.w", one(0046200), one(0177700), "s", m68000up }, -{"movem.l", one(0046300), one(0177700), "s", m68851 }, - -{"psac", two(0xf040, 0x0007), two(0xffc0, 0xffff), "$s", m68851 }, -{"psas", two(0xf040, 0x0006), two(0xffc0, 0xffff), "$s", m68851 }, -{"psbc", two(0xf040, 0x0001), two(0xffc0, 0xffff), "$s", m68851 }, -{"psbs", two(0xf040, 0x0000), two(0xffc0, 0xffff), "$s", m68851 }, -{"pscc", two(0xf040, 0x000f), two(0xffc0, 0xffff), "$s", m68851 }, -{"pscs", two(0xf040, 0x000e), two(0xffc0, 0xffff), "$s", m68851 }, -{"psgc", two(0xf040, 0x000d), two(0xffc0, 0xffff), "$s", m68851 }, -{"psgs", two(0xf040, 0x000c), two(0xffc0, 0xffff), "$s", m68851 }, -{"psic", two(0xf040, 0x000b), two(0xffc0, 0xffff), "$s", m68851 }, -{"psis", two(0xf040, 0x000a), two(0xffc0, 0xffff), "$s", m68851 }, -{"pslc", two(0xf040, 0x0003), two(0xffc0, 0xffff), "$s", m68851 }, -{"psls", two(0xf040, 0x0002), two(0xffc0, 0xffff), "$s", m68851 }, -{"pssc", two(0xf040, 0x0005), two(0xffc0, 0xffff), "$s", m68851 }, -{"psss", two(0xf040, 0x0004), two(0xffc0, 0xffff), "$s", m68851 }, -{"pswc", two(0xf040, 0x0009), two(0xffc0, 0xffff), "$s", m68851 }, -{"psws", two(0xf040, 0x0008), two(0xffc0, 0xffff), "$s", m68851 }, - -{"ptestr", two(0xf000,0x8210), two(0xffc0, 0xe3f0), "T3&st8", m68030|m68851 }, -{"ptestr", two(0xf000,0x8310), two(0xffc0,0xe310), "T3&st8A9", m68030|m68851 }, -{"ptestr", two(0xf000,0x8208), two(0xffc0,0xe3f8), "D3&st8", m68030|m68851 }, -{"ptestr", two(0xf000,0x8308), two(0xffc0,0xe318), "D3&st8A9", m68030|m68851 }, -{"ptestr", two(0xf000,0x8200), two(0xffc0,0xe3fe), "f3&st8", m68030|m68851 }, -{"ptestr", two(0xf000,0x8300), two(0xffc0,0xe31e), "f3&st8A9", m68030|m68851 }, -{"ptestr", one(0xf568), one(0xfff8), "as", m68040 }, - -{"ptestw", two(0xf000,0x8010), two(0xffc0,0xe3f0), "T3&st8", m68030|m68851 }, -{"ptestw", two(0xf000,0x8110), two(0xffc0,0xe310), "T3&st8A9", m68030|m68851 }, -{"ptestw", two(0xf000,0x8008), two(0xffc0,0xe3f8), "D3&st8", m68030|m68851 }, -{"ptestw", two(0xf000,0x8108), two(0xffc0,0xe318), "D3&st8A9", m68030|m68851 }, -{"ptestw", two(0xf000,0x8000), two(0xffc0,0xe3fe), "f3&st8", m68030|m68851 }, -{"ptestw", two(0xf000,0x8100), two(0xffc0,0xe31e), "f3&st8A9", m68030|m68851 }, -{"ptestw", one(0xf548), one(0xfff8), "as", m68040 }, - -{"ptrapac.w", two(0xf07a, 0x0007), two(0xffff, 0xffff), "#w", m68851 }, -{"ptrapac.l", two(0xf07b, 0x0007), two(0xffff, 0xffff), "#l", m68851 }, -{"ptrapac", two(0xf07c, 0x0007), two(0xffff, 0xffff), "", m68851 }, - -{"ptrapas.w", two(0xf07a, 0x0006), two(0xffff, 0xffff), "#w", m68851 }, -{"ptrapas.l", two(0xf07b, 0x0006), two(0xffff, 0xffff), "#l", m68851 }, -{"ptrapas", two(0xf07c, 0x0006), two(0xffff, 0xffff), "", m68851 }, - -{"ptrapbc.w", two(0xf07a, 0x0001), two(0xffff, 0xffff), "#w", m68851 }, -{"ptrapbc.l", two(0xf07b, 0x0001), two(0xffff, 0xffff), "#l", m68851 }, -{"ptrapbc", two(0xf07c, 0x0001), two(0xffff, 0xffff), "", m68851 }, - -{"ptrapbs.w", two(0xf07a, 0x0000), two(0xffff, 0xffff), "#w", m68851 }, -{"ptrapbs.l", two(0xf07b, 0x0000), two(0xffff, 0xffff), "#l", m68851 }, -{"ptrapbs", two(0xf07c, 0x0000), two(0xffff, 0xffff), "", m68851 }, - -{"ptrapcc.w", two(0xf07a, 0x000f), two(0xffff, 0xffff), "#w", m68851 }, -{"ptrapcc.l", two(0xf07b, 0x000f), two(0xffff, 0xffff), "#l", m68851 }, -{"ptrapcc", two(0xf07c, 0x000f), two(0xffff, 0xffff), "", m68851 }, - -{"ptrapcs.w", two(0xf07a, 0x000e), two(0xffff, 0xffff), "#w", m68851 }, -{"ptrapcs.l", two(0xf07b, 0x000e), two(0xffff, 0xffff), "#l", m68851 }, -{"ptrapcs", two(0xf07c, 0x000e), two(0xffff, 0xffff), "", m68851 }, - -{"ptrapgc.w", two(0xf07a, 0x000d), two(0xffff, 0xffff), "#w", m68851 }, -{"ptrapgc.l", two(0xf07b, 0x000d), two(0xffff, 0xffff), "#l", m68851 }, -{"ptrapgc", two(0xf07c, 0x000d), two(0xffff, 0xffff), "", m68851 }, - -{"ptrapgs.w", two(0xf07a, 0x000c), two(0xffff, 0xffff), "#w", m68851 }, -{"ptrapgs.l", two(0xf07b, 0x000c), two(0xffff, 0xffff), "#l", m68851 }, -{"ptrapgs", two(0xf07c, 0x000c), two(0xffff, 0xffff), "", m68851 }, - -{"ptrapic.w", two(0xf07a, 0x000b), two(0xffff, 0xffff), "#w", m68851 }, -{"ptrapic.l", two(0xf07b, 0x000b), two(0xffff, 0xffff), "#l", m68851 }, -{"ptrapic", two(0xf07c, 0x000b), two(0xffff, 0xffff), "", m68851 }, - -{"ptrapis.w", two(0xf07a, 0x000a), two(0xffff, 0xffff), "#w", m68851 }, -{"ptrapis.l", two(0xf07b, 0x000a), two(0xffff, 0xffff), "#l", m68851 }, -{"ptrapis", two(0xf07c, 0x000a), two(0xffff, 0xffff), "", m68851 }, - -{"ptraplc.w", two(0xf07a, 0x0003), two(0xffff, 0xffff), "#w", m68851 }, -{"ptraplc.l", two(0xf07b, 0x0003), two(0xffff, 0xffff), "#l", m68851 }, -{"ptraplc", two(0xf07c, 0x0003), two(0xffff, 0xffff), "", m68851 }, - -{"ptrapls.w", two(0xf07a, 0x0002), two(0xffff, 0xffff), "#w", m68851 }, -{"ptrapls.l", two(0xf07b, 0x0002), two(0xffff, 0xffff), "#l", m68851 }, -{"ptrapls", two(0xf07c, 0x0002), two(0xffff, 0xffff), "", m68851 }, - -{"ptrapsc.w", two(0xf07a, 0x0005), two(0xffff, 0xffff), "#w", m68851 }, -{"ptrapsc.l", two(0xf07b, 0x0005), two(0xffff, 0xffff), "#l", m68851 }, -{"ptrapsc", two(0xf07c, 0x0005), two(0xffff, 0xffff), "", m68851 }, - -{"ptrapss.w", two(0xf07a, 0x0004), two(0xffff, 0xffff), "#w", m68851 }, -{"ptrapss.l", two(0xf07b, 0x0004), two(0xffff, 0xffff), "#l", m68851 }, -{"ptrapss", two(0xf07c, 0x0004), two(0xffff, 0xffff), "", m68851 }, - -{"ptrapwc.w", two(0xf07a, 0x0009), two(0xffff, 0xffff), "#w", m68851 }, -{"ptrapwc.l", two(0xf07b, 0x0009), two(0xffff, 0xffff), "#l", m68851 }, -{"ptrapwc", two(0xf07c, 0x0009), two(0xffff, 0xffff), "", m68851 }, - -{"ptrapws.w", two(0xf07a, 0x0008), two(0xffff, 0xffff), "#w", m68851 }, -{"ptrapws.l", two(0xf07b, 0x0008), two(0xffff, 0xffff), "#l", m68851 }, -{"ptrapws", two(0xf07c, 0x0008), two(0xffff, 0xffff), "", m68851 }, - -{"pulse", one(0045314), one(0177777), "", m68060 | mcf5200 }, - -{"pvalid", two(0xf000, 0x2800), two(0xffc0, 0xffff), "Vs&s", m68851 }, -{"pvalid", two(0xf000, 0x2c00), two(0xffc0, 0xfff8), "A3&s", m68851 }, - - -{"reset", one(0047160), one(0177777), "", m68000up }, - -{"rol.b", one(0160430), one(0170770), "QdDs", m68000up }, -{"rol.b", one(0160470), one(0170770), "DdDs", m68000up }, -{"rol.w", one(0160530), one(0170770), "QdDs", m68000up }, -{"rol.w", one(0160570), one(0170770), "DdDs", m68000up }, -{"rol.w", one(0163700), one(0177700), "~s", m68000up }, -{"rol.l", one(0160630), one(0170770), "QdDs", m68000up }, -{"rol.l", one(0160670), one(0170770), "DdDs", m68000up }, - -{"ror.b", one(0160030), one(0170770), "QdDs", m68000up }, -{"ror.b", one(0160070), one(0170770), "DdDs", m68000up }, -{"ror.w", one(0160130), one(0170770), "QdDs", m68000up }, -{"ror.w", one(0160170), one(0170770), "DdDs", m68000up }, -{"ror.w", one(0163300), one(0177700), "~s", m68000up }, -{"ror.l", one(0160230), one(0170770), "QdDs", m68000up }, -{"ror.l", one(0160270), one(0170770), "DdDs", m68000up }, - -{"roxl.b", one(0160420), one(0170770), "QdDs", m68000up }, -{"roxl.b", one(0160460), one(0170770), "DdDs", m68000up }, -{"roxl.w", one(0160520), one(0170770), "QdDs", m68000up }, -{"roxl.w", one(0160560), one(0170770), "DdDs", m68000up }, -{"roxl.w", one(0162700), one(0177700), "~s", m68000up }, -{"roxl.l", one(0160620), one(0170770), "QdDs", m68000up }, -{"roxl.l", one(0160660), one(0170770), "DdDs", m68000up }, - -{"roxr.b", one(0160020), one(0170770), "QdDs", m68000up }, -{"roxr.b", one(0160060), one(0170770), "DdDs", m68000up }, -{"roxr.w", one(0160120), one(0170770), "QdDs", m68000up }, -{"roxr.w", one(0160160), one(0170770), "DdDs", m68000up }, -{"roxr.w", one(0162300), one(0177700), "~s", m68000up }, -{"roxr.l", one(0160220), one(0170770), "QdDs", m68000up }, -{"roxr.l", one(0160260), one(0170770), "DdDs", m68000up }, - -{"rtd", one(0047164), one(0177777), "#w", m68010up }, - -{"rte", one(0047163), one(0177777), "", m68000up|mcf5200 }, - -{"rtm", one(0003300), one(0177760), "Rs", m68020 }, - -{"rtr", one(0047167), one(0177777), "", m68000up }, - -{"rts", one(0047165), one(0177777), "", m68000up|mcf5200 }, - -{"sbcd", one(0100400), one(0170770), "DsDd", m68000up }, -{"sbcd", one(0100410), one(0170770), "-s-d", m68000up }, - - -{"scc", one(0052300), one(0177700), "$s", m68000up }, -{"scc", one(0052300), one(0177700), "Ds", mcf5200 }, -{"scs", one(0052700), one(0177700), "$s", m68000up }, -{"scs", one(0052700), one(0177700), "Ds", mcf5200 }, -{"seq", one(0053700), one(0177700), "$s", m68000up }, -{"seq", one(0053700), one(0177700), "Ds", mcf5200 }, -{"sf", one(0050700), one(0177700), "$s", m68000up }, -{"sf", one(0050700), one(0177700), "Ds", mcf5200 }, -{"sge", one(0056300), one(0177700), "$s", m68000up }, -{"sge", one(0056300), one(0177700), "Ds", mcf5200 }, -{"sgt", one(0057300), one(0177700), "$s", m68000up }, -{"sgt", one(0057300), one(0177700), "Ds", mcf5200 }, -{"shi", one(0051300), one(0177700), "$s", m68000up }, -{"shi", one(0051300), one(0177700), "Ds", mcf5200 }, -{"sle", one(0057700), one(0177700), "$s", m68000up }, -{"sle", one(0057700), one(0177700), "Ds", mcf5200 }, -{"sls", one(0051700), one(0177700), "$s", m68000up }, -{"sls", one(0051700), one(0177700), "Ds", mcf5200 }, -{"slt", one(0056700), one(0177700), "$s", m68000up }, -{"slt", one(0056700), one(0177700), "Ds", mcf5200 }, -{"smi", one(0055700), one(0177700), "$s", m68000up }, -{"smi", one(0055700), one(0177700), "Ds", mcf5200 }, -{"sne", one(0053300), one(0177700), "$s", m68000up }, -{"sne", one(0053300), one(0177700), "Ds", mcf5200 }, -{"spl", one(0055300), one(0177700), "$s", m68000up }, -{"spl", one(0055300), one(0177700), "Ds", mcf5200 }, -{"st", one(0050300), one(0177700), "$s", m68000up }, -{"st", one(0050300), one(0177700), "Ds", mcf5200 }, -{"svc", one(0054300), one(0177700), "$s", m68000up }, -{"svc", one(0054300), one(0177700), "Ds", mcf5200 }, -{"svs", one(0054700), one(0177700), "$s", m68000up }, -{"svs", one(0054700), one(0177700), "Ds", mcf5200 }, - -{"stop", one(0047162), one(0177777), "#w", m68000up | mcf5200 }, - -{"suba.l", one(0110700), one(0170700), "*lAd", m68000up | mcf5200 }, -{"suba.w", one(0110300), one(0170700), "*wAd", m68000up }, - -{"subi.b", one(0002000), one(0177700), "#b$s", m68000up }, -{"subi.w", one(0002100), one(0177700), "#w$s", m68000up }, -{"subi.l", one(0002200), one(0177700), "#l$s", m68000up }, -{"subi.l", one(0002200), one(0177700), "#lDs", mcf5200 }, - -{"subq.b", one(0050400), one(0170700), "Qd%s", m68000up }, -{"subq.w", one(0050500), one(0170700), "Qd%s", m68000up }, -{"subq.l", one(0050600), one(0170700), "Qd%s", m68000up | mcf5200 }, - -/* The sub opcode can generate the suba, subi, and subq instructions. */ -{"sub.b", one(0050400), one(0170700), "Qd%s", m68000up }, -{"sub.b", one(0002000), one(0177700), "#b$s", m68000up }, -{"sub.b", one(0110000), one(0170700), ";bDd", m68000up }, -{"sub.b", one(0110400), one(0170700), "Dd~s", m68000up }, -{"sub.w", one(0050500), one(0170700), "Qd%s", m68000up }, -{"sub.w", one(0002100), one(0177700), "#w$s", m68000up }, -{"sub.w", one(0110300), one(0170700), "*wAd", m68000up }, -{"sub.w", one(0110100), one(0170700), "*wDd", m68000up }, -{"sub.w", one(0110500), one(0170700), "Dd~s", m68000up }, -{"sub.l", one(0050600), one(0170700), "Qd%s", m68000up | mcf5200 }, -{"sub.l", one(0002200), one(0177700), "#l$s", m68000up }, -{"sub.l", one(0002200), one(0177700), "#lDs", mcf5200 }, -{"sub.l", one(0110700), one(0170700), "*lAd", m68000up | mcf5200 }, -{"sub.l", one(0110200), one(0170700), "*lDd", m68000up | mcf5200 }, -{"sub.l", one(0110600), one(0170700), "Dd~s", m68000up | mcf5200 }, - -{"subx.b", one(0110400), one(0170770), "DsDd", m68000up }, -{"subx.b", one(0110410), one(0170770), "-s-d", m68000up }, -{"subx.w", one(0110500), one(0170770), "DsDd", m68000up }, -{"subx.w", one(0110510), one(0170770), "-s-d", m68000up }, -{"subx.l", one(0110600), one(0170770), "DsDd", m68000up | mcf5200 }, -{"subx.l", one(0110610), one(0170770), "-s-d", m68000up }, - -{"swap", one(0044100), one(0177770), "Ds", m68000up | mcf5200 }, - -/* swbeg and swbegl are magic constants used on sysV68. The compiler - generates them before a switch table. They tell the debugger and - disassembler that a switch table follows. The parameter is the - number of elements in the table. swbeg means that the entries in - the table are word (2 byte) sized, and swbegl means that the - entries in the table are longword (4 byte) sized. */ -{"swbeg", one(0045374), one(0177777), "#w", m68000up | mcf5200 }, -{"swbeg.l", one(0045375), one(0177777), "#l", m68000up | mcf5200 }, - -{"tas", one(0045300), one(0177700), "$s", m68000up }, - -#define TBL1(name,signed,round,size) \ - {name, two(0174000, (signed<<11)|(!round<<10)|(size<<6)|0000400), \ - two(0177700,0107777), "!sD1", cpu32 }, \ - {name, two(0174000, (signed<<11)|(!round<<10)|(size<<6)), \ - two(0177770,0107770), "DsD3D1", cpu32 } -#define TBL(name1, name2, name3, s, r) \ - TBL1(name1, s, r, 0), TBL1(name2, s, r, 1), TBL1(name3, s, r, 2) -TBL("tbls.b", "tbls.w", "tbls.l", 1, 1), -TBL("tblsn.b", "tblsn.w", "tblsn.l", 1, 0), -TBL("tblu.b", "tblu.w", "tblu.l", 0, 1), -TBL("tblun.b", "tblun.w", "tblun.l", 0, 0), - -{"trap", one(0047100), one(0177760), "Ts", m68000up | mcf5200 }, - -{"trapcc", one(0052374), one(0177777), "", m68020up | cpu32 }, -{"trapcs", one(0052774), one(0177777), "", m68020up | cpu32 }, -{"trapeq", one(0053774), one(0177777), "", m68020up | cpu32 }, -{"trapf", one(0050774), one(0177777), "", m68020up | cpu32 | mcf5200 }, -{"trapge", one(0056374), one(0177777), "", m68020up | cpu32 }, -{"trapgt", one(0057374), one(0177777), "", m68020up | cpu32 }, -{"traphi", one(0051374), one(0177777), "", m68020up | cpu32 }, -{"traple", one(0057774), one(0177777), "", m68020up | cpu32 }, -{"trapls", one(0051774), one(0177777), "", m68020up | cpu32 }, -{"traplt", one(0056774), one(0177777), "", m68020up | cpu32 }, -{"trapmi", one(0055774), one(0177777), "", m68020up | cpu32 }, -{"trapne", one(0053374), one(0177777), "", m68020up | cpu32 }, -{"trappl", one(0055374), one(0177777), "", m68020up | cpu32 }, -{"trapt", one(0050374), one(0177777), "", m68020up | cpu32 }, -{"trapvc", one(0054374), one(0177777), "", m68020up | cpu32 }, -{"trapvs", one(0054774), one(0177777), "", m68020up | cpu32 }, - -{"trapcc.w", one(0052372), one(0177777), "#w", m68020up|cpu32 }, -{"trapcs.w", one(0052772), one(0177777), "#w", m68020up|cpu32 }, -{"trapeq.w", one(0053772), one(0177777), "#w", m68020up|cpu32 }, -{"trapf.w", one(0050772), one(0177777), "#w", m68020up|cpu32|mcf5200}, -{"trapge.w", one(0056372), one(0177777), "#w", m68020up|cpu32 }, -{"trapgt.w", one(0057372), one(0177777), "#w", m68020up|cpu32 }, -{"traphi.w", one(0051372), one(0177777), "#w", m68020up|cpu32 }, -{"traple.w", one(0057772), one(0177777), "#w", m68020up|cpu32 }, -{"trapls.w", one(0051772), one(0177777), "#w", m68020up|cpu32 }, -{"traplt.w", one(0056772), one(0177777), "#w", m68020up|cpu32 }, -{"trapmi.w", one(0055772), one(0177777), "#w", m68020up|cpu32 }, -{"trapne.w", one(0053372), one(0177777), "#w", m68020up|cpu32 }, -{"trappl.w", one(0055372), one(0177777), "#w", m68020up|cpu32 }, -{"trapt.w", one(0050372), one(0177777), "#w", m68020up|cpu32 }, -{"trapvc.w", one(0054372), one(0177777), "#w", m68020up|cpu32 }, -{"trapvs.w", one(0054772), one(0177777), "#w", m68020up|cpu32 }, - -{"trapcc.l", one(0052373), one(0177777), "#l", m68020up|cpu32 }, -{"trapcs.l", one(0052773), one(0177777), "#l", m68020up|cpu32 }, -{"trapeq.l", one(0053773), one(0177777), "#l", m68020up|cpu32 }, -{"trapf.l", one(0050773), one(0177777), "#l", m68020up|cpu32|mcf5200}, -{"trapge.l", one(0056373), one(0177777), "#l", m68020up|cpu32 }, -{"trapgt.l", one(0057373), one(0177777), "#l", m68020up|cpu32 }, -{"traphi.l", one(0051373), one(0177777), "#l", m68020up|cpu32 }, -{"traple.l", one(0057773), one(0177777), "#l", m68020up|cpu32 }, -{"trapls.l", one(0051773), one(0177777), "#l", m68020up|cpu32 }, -{"traplt.l", one(0056773), one(0177777), "#l", m68020up|cpu32 }, -{"trapmi.l", one(0055773), one(0177777), "#l", m68020up|cpu32 }, -{"trapne.l", one(0053373), one(0177777), "#l", m68020up|cpu32 }, -{"trappl.l", one(0055373), one(0177777), "#l", m68020up|cpu32 }, -{"trapt.l", one(0050373), one(0177777), "#l", m68020up|cpu32 }, -{"trapvc.l", one(0054373), one(0177777), "#l", m68020up|cpu32 }, -{"trapvs.l", one(0054773), one(0177777), "#l", m68020up|cpu32 }, - -{"trapv", one(0047166), one(0177777), "", m68000up }, - -{"tst.b", one(0045000), one(0177700), ";b", m68020up|cpu32|mcf5200 }, -{"tst.b", one(0045000), one(0177700), "$b", m68000up }, -{"tst.w", one(0045100), one(0177700), "*w", m68020up|cpu32|mcf5200 }, -{"tst.w", one(0045100), one(0177700), "$w", m68000up }, -{"tst.l", one(0045200), one(0177700), "*l", m68020up|cpu32|mcf5200 }, -{"tst.l", one(0045200), one(0177700), "$l", m68000up }, - -{"unlk", one(0047130), one(0177770), "As", m68000up | mcf5200 }, - -{"unpk", one(0100600), one(0170770), "DsDd#w", m68020up }, -{"unpk", one(0100610), one(0170770), "-s-d#w", m68020up }, - -{"wddata.b", one(0172000), one(0177700), "~s", mcf5200 }, -{"wddata.w", one(0172100), one(0177700), "~s", mcf5200 }, -{"wddata.l", one(0172200), one(0177700), "~s", mcf5200 }, - -}; - -const int m68k_numopcodes = sizeof m68k_opcodes / sizeof m68k_opcodes[0]; - -/* These aliases used to be in the above table, each one duplicating - all of the entries for its primary exactly. This table was - constructed by mechanical processing of the opcode table, with a - small number of tweaks done by hand. There are probably a lot more - aliases above that could be moved down here, except for very minor - differences. */ - -const struct m68k_opcode_alias m68k_opcode_aliases[] = -{ - { "add", "add.w", }, - { "adda", "adda.w", }, - { "addi", "addi.w", }, - { "addq", "addq.w", }, - { "addx", "addx.w", }, - { "asl", "asl.w", }, - { "asr", "asr.w", }, - { "bhi", "bhi.w", }, - { "bls", "bls.w", }, - { "bcc", "bcc.w", }, - { "bcs", "bcs.w", }, - { "bne", "bne.w", }, - { "beq", "beq.w", }, - { "bvc", "bvc.w", }, - { "bvs", "bvs.w", }, - { "bpl", "bpl.w", }, - { "bmi", "bmi.w", }, - { "bge", "bge.w", }, - { "blt", "blt.w", }, - { "bgt", "bgt.w", }, - { "ble", "ble.w", }, - { "bra", "bra.w", }, - { "bsr", "bsr.w", }, - { "bhi.b", "bhi.s", }, - { "bls.b", "bls.s", }, - { "bcc.b", "bcc.s", }, - { "bcs.b", "bcs.s", }, - { "bne.b", "bne.s", }, - { "beq.b", "beq.s", }, - { "bvc.b", "bvc.s", }, - { "bvs.b", "bvs.s", }, - { "bpl.b", "bpl.s", }, - { "bmi.b", "bmi.s", }, - { "bge.b", "bge.s", }, - { "blt.b", "blt.s", }, - { "bgt.b", "bgt.s", }, - { "ble.b", "ble.s", }, - { "bra.b", "bra.s", }, - { "bsr.b", "bsr.s", }, - { "bhs", "bcc.w" }, - { "bhs.s", "bcc.s" }, - { "bhs.b", "bcc.s" }, - { "bhs.w", "bcc.w" }, - { "bhs.l", "bcc.l" }, - { "blo", "bcs.w" }, - { "blo.s", "bcs.s" }, - { "blo.b", "bcs.s" }, - { "blo.w", "bcs.w" }, - { "blo.l", "bcs.l" }, - { "br", "bra.w", }, - { "br.s", "bra.s", }, - { "br.b", "bra.s", }, - { "br.w", "bra.w", }, - { "br.l", "bra.l", }, - { "jfnlt", "bcc", }, /* apparently a sun alias */ - { "jfngt", "ble", }, /* apparently a sun alias */ - { "jfeq", "beq.s", }, /* apparently a sun alias */ - { "bchg.b", "bchg", }, - { "bchg.l", "bchg", }, - { "bclr.b", "bclr", }, - { "bclr.l", "bclr", }, - { "bset.b", "bset", }, - { "bset.l", "bset", }, - { "btst.b", "btst", }, - { "btst.l", "btst", }, - { "cas2", "cas2.w", }, - { "cas", "cas.w", }, - { "chk2", "chk2.w", }, - { "chk", "chk.w", }, - { "clr", "clr.w", }, - { "cmp2", "cmp2.w", }, - { "cmpa", "cmpa.w", }, - { "cmpi", "cmpi.w", }, - { "cmpm", "cmpm.w", }, - { "cmp", "cmp.w", }, - { "dbcc.w", "dbcc", }, - { "dbcs.w", "dbcs", }, - { "dbeq.w", "dbeq", }, - { "dbf.w", "dbf", }, - { "dbge.w", "dbge", }, - { "dbgt.w", "dbgt", }, - { "dbhi.w", "dbhi", }, - { "dble.w", "dble", }, - { "dbls.w", "dbls", }, - { "dblt.w", "dblt", }, - { "dbmi.w", "dbmi", }, - { "dbne.w", "dbne", }, - { "dbpl.w", "dbpl", }, - { "dbt.w", "dbt", }, - { "dbvc.w", "dbvc", }, - { "dbvs.w", "dbvs", }, - { "dbhs", "dbcc", }, - { "dbhs.w", "dbcc", }, - { "dbra", "dbf", }, - { "dbra.w", "dbf", }, - { "tdivs.l", "divs.l", }, - { "divs", "divs.w", }, - { "divu", "divu.w", }, - { "ext", "ext.w", }, - { "extb.w", "ext.w", }, - { "extw.l", "ext.l", }, - { "fbneq", "fbne", }, - { "fbsneq", "fbsne", }, - { "fdbneq", "fdbne", }, - { "fdbsneq", "fdbsne", }, - { "fmovecr", "fmovecrx", }, - { "fmovm", "fmovem", }, - { "fsneq", "fsne", }, - { "fssneq", "fssne", }, - { "ftrapneq", "ftrapne", }, - { "ftrapsneq", "ftrapsne", }, - { "fjneq", "fjne", }, - { "fjsneq", "fjsne", }, - { "jmp.l", "jmp", }, - { "jmp.s", "jmp", }, - { "jsr.l", "jsr", }, - { "jsr.s", "jsr", }, - { "lea.l", "lea", }, - { "lsl", "lsl.w", }, - { "lsr", "lsr.w", }, - { "movea", "movea.w", }, - { "movem", "movem.w", }, - { "movm.l", "movem.l", }, - { "movm.w", "movem.w", }, - { "movm", "movem.w", }, - { "movep", "movep.w", }, - { "movp.w", "movep.w", }, - { "moves", "moves.w" }, - { "muls", "muls.w", }, - { "mulu", "mulu.w", }, - { "nbcd.b", "nbcd" }, - { "neg", "neg.w", }, - { "negx", "negx.w", }, - { "not", "not.w", }, - { "pea.l", "pea", }, - { "rol", "rol.w", }, - { "ror", "ror.w", }, - { "roxl", "roxl.w", }, - { "roxr", "roxr.w", }, - { "sbcd.b", "sbcd", }, - { "scc.b", "scc", }, - { "scs.b", "scs", }, - { "seq.b", "seq", }, - { "sf.b", "sf", }, - { "sge.b", "sge", }, - { "sgt.b", "sgt", }, - { "shi.b", "shi", }, - { "sle.b", "sle", }, - { "sls.b", "sls", }, - { "slt.b", "slt", }, - { "smi.b", "smi", }, - { "sne.b", "sne", }, - { "spl.b", "spl", }, - { "st.b", "st", }, - { "svc.b", "svc", }, - { "svs.b", "svs", }, - { "sfge", "sge", }, - { "sfgt", "sgt", }, - { "sfle", "sle", }, - { "sflt", "slt", }, - { "sfneq", "sne", }, - { "suba", "suba.w", }, - { "subi", "subi.w", }, - { "subq", "subq.w", }, - { "sub", "sub.w", }, - { "subx", "subx.w", }, - { "swap.w", "swap", }, - { "tas.b", "tas", }, - { "tpcc", "trapcc", }, - { "tcc", "trapcc", }, - { "tst", "tst.w", }, - { "jbra", "jra", }, - { "jbhi", "jhi", }, - { "jbls", "jls", }, - { "jbcc", "jcc", }, - { "jbcs", "jcs", }, - { "jbne", "jne", }, - { "jbeq", "jeq", }, - { "jbvc", "jvc", }, - { "jbvs", "jvs", }, - { "jbpl", "jpl", }, - { "jbmi", "jmi", }, - { "jbge", "jge", }, - { "jblt", "jlt", }, - { "jbgt", "jgt", }, - { "jble", "jle", }, - { "movq.l", "moveq", }, - { "moveq.l", "moveq", }, - { "mov.l", "move.l", }, - { "movq", "moveq", }, - { "mova.l", "movea.l", }, - { "mova.w", "movea.w", }, - { "mov.b", "move.b", }, - { "movc", "movec", }, - { "movec.l", "movec", }, - { "movp.l", "movep.l", }, - { "mov.w", "move.w", }, - { "movs.b", "moves.b", }, - { "movs.l", "moves.l", }, - { "movs.w", "moves.w", }, - - { "tdivu.l", "divu.l", }, /* for m68k-svr4 */ - { "fmov.b", "fmove.b", }, - { "fsmov.b", "fsmove.b", }, - { "fdmov.b", "fdmove.b", }, - { "fmov.d", "fmove.d", }, - { "fsmov.d", "fsmove.d", }, - { "fmov.l", "fmove.l", }, - { "fsmov.l", "fsmove.l", }, - { "fdmov.l", "fdmove.l", }, - { "fmov.p", "fmove.p", }, - { "fsmov.p", "fsmove.p", }, - { "fdmov.p", "fdmove.p", }, - { "fmov.s", "fmove.s", }, - { "fsmov.s", "fsmove.s", }, - { "fdmov.s", "fdmove.s", }, - { "fmov.w", "fmove.w", }, - { "fsmov.w", "fsmove.w", }, - { "fdmov.w", "fdmove.w", }, - { "fmov.x", "fmove.x", }, - { "fsmov.x", "fsmove.x", }, - { "fdmov.x", "fdmove.x", }, - { "fmovcr", "fmovecr", }, - { "fmovcr.x", "fmovecr.x", }, - { "ftest.b", "ftst.b", }, - { "ftest.d", "ftst.d", }, - { "ftest.l", "ftst.l", }, - { "ftest.p", "ftst.p", }, - { "ftest.s", "ftst.s", }, - { "ftest.w", "ftst.w", }, - { "ftest.x", "ftst.x", }, -}; - -const int m68k_numaliases = - sizeof m68k_opcode_aliases / sizeof m68k_opcode_aliases[0]; diff --git a/cxmon/src/disass/m68k.h b/cxmon/src/disass/m68k.h deleted file mode 100644 index 4d27d7f7..00000000 --- a/cxmon/src/disass/m68k.h +++ /dev/null @@ -1,315 +0,0 @@ -/* Opcode table header for m680[01234]0/m6888[12]/m68851. - Copyright 1989, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation. - -This file is part of GDB, GAS, and the GNU binutils. - -GDB, GAS, and the GNU binutils are free software; you can redistribute -them and/or modify them under the terms of the GNU General Public -License as published by the Free Software Foundation; either version -1, or (at your option) any later version. - -GDB, GAS, and the GNU binutils are distributed in the hope that they -will be useful, but WITHOUT ANY WARRANTY; without even the implied -warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See -the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this file; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ - -/* These are used as bit flags for the arch field in the m68k_opcode - structure. */ -#define _m68k_undef 0 -#define m68000 0x001 -#define m68008 m68000 /* synonym for -m68000. otherwise unused. */ -#define m68010 0x002 -#define m68020 0x004 -#define m68030 0x008 -#define m68ec030 m68030 /* similar enough to -m68030 to ignore differences; - gas will deal with the few differences. */ -#define m68040 0x010 -/* there is no 68050 */ -#define m68060 0x020 -#define m68881 0x040 -#define m68882 m68881 /* synonym for -m68881. otherwise unused. */ -#define m68851 0x080 -#define cpu32 0x100 /* e.g., 68332 */ -#define mcf5200 0x200 - - /* handy aliases */ -#define m68040up (m68040 | m68060) -#define m68030up (m68030 | m68040up) -#define m68020up (m68020 | m68030up) -#define m68010up (m68010 | cpu32 | m68020up) -#define m68000up (m68000 | m68010up) - -#define mfloat (m68881 | m68882 | m68040 | m68060) -#define mmmu (m68851 | m68030 | m68040 | m68060) - -/* The structure used to hold information for an opcode. */ - -struct m68k_opcode -{ - /* The opcode name. */ - const char *name; - /* The opcode itself. */ - unsigned long opcode; - /* The mask used by the disassembler. */ - unsigned long match; - /* The arguments. */ - const char *args; - /* The architectures which support this opcode. */ - unsigned int arch; -}; - -/* The structure used to hold information for an opcode alias. */ - -struct m68k_opcode_alias -{ - /* The alias name. */ - const char *alias; - /* The instruction for which this is an alias. */ - const char *primary; -}; - -/* We store four bytes of opcode for all opcodes because that is the - most any of them need. The actual length of an instruction is - always at least 2 bytes, and is as much longer as necessary to hold - the operands it has. - - The match field is a mask saying which bits must match particular - opcode in order for an instruction to be an instance of that - opcode. - - The args field is a string containing two characters for each - operand of the instruction. The first specifies the kind of - operand; the second, the place it is stored. */ - -/* Kinds of operands: - Characters used: AaBCcDdFfIJkLlMmnOopQqRrSsTtUVvWXYZ0123|*~%;@!&$?/<>#^+- - - D data register only. Stored as 3 bits. - A address register only. Stored as 3 bits. - a address register indirect only. Stored as 3 bits. - R either kind of register. Stored as 4 bits. - r either kind of register indirect only. Stored as 4 bits. - At the moment, used only for cas2 instruction. - F floating point coprocessor register only. Stored as 3 bits. - O an offset (or width): immediate data 0-31 or data register. - Stored as 6 bits in special format for BF... insns. - + autoincrement only. Stored as 3 bits (number of the address register). - - autodecrement only. Stored as 3 bits (number of the address register). - Q quick immediate data. Stored as 3 bits. - This matches an immediate operand only when value is in range 1 .. 8. - M moveq immediate data. Stored as 8 bits. - This matches an immediate operand only when value is in range -128..127 - T trap vector immediate data. Stored as 4 bits. - - k K-factor for fmove.p instruction. Stored as a 7-bit constant or - a three bit register offset, depending on the field type. - - # immediate data. Stored in special places (b, w or l) - which say how many bits to store. - ^ immediate data for floating point instructions. Special places - are offset by 2 bytes from '#'... - B pc-relative address, converted to an offset - that is treated as immediate data. - d displacement and register. Stores the register as 3 bits - and stores the displacement in the entire second word. - - C the CCR. No need to store it; this is just for filtering validity. - S the SR. No need to store, just as with CCR. - U the USP. No need to store, just as with CCR. - - I Coprocessor ID. Not printed if 1. The Coprocessor ID is always - extracted from the 'd' field of word one, which means that an extended - coprocessor opcode can be skipped using the 'i' place, if needed. - - s System Control register for the floating point coprocessor. - - J Misc register for movec instruction, stored in 'j' format. - Possible values: - 0x000 SFC Source Function Code reg [60, 40, 30, 20, 10] - 0x001 DFC Data Function Code reg [60, 40, 30, 20, 10] - 0x002 CACR Cache Control Register [60, 40, 30, 20] - 0x003 TC MMU Translation Control [60, 40] - 0x004 ITT0 Instruction Transparent - Translation reg 0 [60, 40] - 0x005 ITT1 Instruction Transparent - Translation reg 1 [60, 40] - 0x006 DTT0 Data Transparent - Translation reg 0 [60, 40] - 0x007 DTT1 Data Transparent - Translation reg 1 [60, 40] - 0x008 BUSCR Bus Control Register [60] - 0x800 USP User Stack Pointer [60, 40, 30, 20, 10] - 0x801 VBR Vector Base reg [60, 40, 30, 20, 10] - 0x802 CAAR Cache Address Register [ 30, 20] - 0x803 MSP Master Stack Pointer [ 40, 30, 20] - 0x804 ISP Interrupt Stack Pointer [ 40, 30, 20] - 0x805 MMUSR MMU Status reg [ 40] - 0x806 URP User Root Pointer [60, 40] - 0x807 SRP Supervisor Root Pointer [60, 40] - 0x808 PCR Processor Configuration reg [60] - 0xC00 ROMBAR ROM Base Address Register [520X] - 0xC04 RAMBAR0 RAM Base Address Register 0 [520X] - 0xC05 RAMBAR1 RAM Base Address Register 0 [520X] - 0xC0F MBAR0 RAM Base Address Register 0 [520X] - - L Register list of the type d0-d7/a0-a7 etc. - (New! Improved! Can also hold fp0-fp7, as well!) - The assembler tries to see if the registers match the insn by - looking at where the insn wants them stored. - - l Register list like L, but with all the bits reversed. - Used for going the other way. . . - - c cache identifier which may be "nc" for no cache, "ic" - for instruction cache, "dc" for data cache, or "bc" - for both caches. Used in cinv and cpush. Always - stored in position "d". - - The remainder are all stored as 6 bits using an address mode and a - register number; they differ in which addressing modes they match. - - * all (modes 0-6,7.0-4) - ~ alterable memory (modes 2-6,7.0,7.1) - (not 0,1,7.2-4) - % alterable (modes 0-6,7.0,7.1) - (not 7.2-4) - ; data (modes 0,2-6,7.0-4) - (not 1) - @ data, but not immediate (modes 0,2-6,7.0-3) - (not 1,7.4) - ! control (modes 2,5,6,7.0-3) - (not 0,1,3,4,7.4) - & alterable control (modes 2,5,6,7.0,7.1) - (not 0,1,7.2-4) - $ alterable data (modes 0,2-6,7.0,7.1) - (not 1,7.2-4) - ? alterable control, or data register (modes 0,2,5,6,7.0,7.1) - (not 1,3,4,7.2-4) - / control, or data register (modes 0,2,5,6,7.0-3) - (not 1,3,4,7.4) - > *save operands (modes 2,4,5,6,7.0,7.1) - (not 0,1,3,7.2-4) - < *restore operands (modes 2,3,5,6,7.0-3) - (not 0,1,4,7.4) - - coldfire move operands: - m (modes 0-4) - n (modes 5,7.2) - o (modes 6,7.0,7.1,7.3,7.4) - p (modes 0-5) - - coldfire bset/bclr/btst operands: - q (modes 0,2-5) - v (modes 0,2-5,7.0,7.1) -*/ - -/* For the 68851: */ -/* - I didn't use much imagination in choosing the - following codes, so many of them aren't very - mnemonic. -rab - - 0 32 bit pmmu register - Possible values: - 000 TC Translation Control Register (68030, 68851) - - 1 16 bit pmmu register - 111 AC Access Control (68851) - - 2 8 bit pmmu register - 100 CAL Current Access Level (68851) - 101 VAL Validate Access Level (68851) - 110 SCC Stack Change Control (68851) - - 3 68030-only pmmu registers (32 bit) - 010 TT0 Transparent Translation reg 0 - (aka Access Control reg 0 -- AC0 -- on 68ec030) - 011 TT1 Transparent Translation reg 1 - (aka Access Control reg 1 -- AC1 -- on 68ec030) - - W wide pmmu registers - Possible values: - 001 DRP Dma Root Pointer (68851) - 010 SRP Supervisor Root Pointer (68030, 68851) - 011 CRP Cpu Root Pointer (68030, 68851) - - f function code register (68030, 68851) - 0 SFC - 1 DFC - - V VAL register only (68851) - - X BADx, BACx (16 bit) - 100 BAD Breakpoint Acknowledge Data (68851) - 101 BAC Breakpoint Acknowledge Control (68851) - - Y PSR (68851) (MMUSR on 68030) (ACUSR on 68ec030) - Z PCSR (68851) - - | memory (modes 2-6, 7.*) - - t address test level (68030 only) - Stored as 3 bits, range 0-7. - Also used for breakpoint instruction now. - -*/ - -/* Places to put an operand, for non-general operands: - s source, low bits of first word. - d dest, shifted 9 in first word - 1 second word, shifted 12 - 2 second word, shifted 6 - 3 second word, shifted 0 - 4 third word, shifted 12 - 5 third word, shifted 6 - 6 third word, shifted 0 - 7 second word, shifted 7 - 8 second word, shifted 10 - 9 second word, shifted 5 - D store in both place 1 and place 3; for divul and divsl. - B first word, low byte, for branch displacements - W second word (entire), for branch displacements - L second and third words (entire), for branch displacements - (also overloaded for move16) - b second word, low byte - w second word (entire) [variable word/long branch offset for dbra] - W second word (entire) (must be signed 16 bit value) - l second and third word (entire) - g variable branch offset for bra and similar instructions. - The place to store depends on the magnitude of offset. - t store in both place 7 and place 8; for floating point operations - c branch offset for cpBcc operations. - The place to store is word two if bit six of word one is zero, - and words two and three if bit six of word one is one. - i Increment by two, to skip over coprocessor extended operands. Only - works with the 'I' format. - k Dynamic K-factor field. Bits 6-4 of word 2, used as a register number. - Also used for dynamic fmovem instruction. - C floating point coprocessor constant - 7 bits. Also used for static - K-factors... - j Movec register #, stored in 12 low bits of second word. - - Places to put operand, for general operands: - d destination, shifted 6 bits in first word - b source, at low bit of first word, and immediate uses one byte - w source, at low bit of first word, and immediate uses two bytes - l source, at low bit of first word, and immediate uses four bytes - s source, at low bit of first word. - Used sometimes in contexts where immediate is not allowed anyway. - f single precision float, low bit of 1st word, immediate uses 4 bytes - F double precision float, low bit of 1st word, immediate uses 8 bytes - x extended precision float, low bit of 1st word, immediate uses 12 bytes - p packed float, low bit of 1st word, immediate uses 12 bytes -*/ - -extern const struct m68k_opcode m68k_opcodes[]; -extern const struct m68k_opcode_alias m68k_opcode_aliases[]; - -extern const int m68k_numopcodes, m68k_numaliases; - -/* end of m68k-opcode.h */ diff --git a/cxmon/src/disass/opintl.h b/cxmon/src/disass/opintl.h deleted file mode 100644 index 1e3c318e..00000000 --- a/cxmon/src/disass/opintl.h +++ /dev/null @@ -1,34 +0,0 @@ -/* opintl.h - opcodes specific header for gettext code. - Copyright (C) 1998 Free Software Foundation, Inc. - - Written by Tom Tromey - - This file is part of the opcodes library used by GAS and the GNU binutils. - - You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to the Free - Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ - -#ifdef ENABLE_NLS -# include -# define _(String) dgettext (PACKAGE, String) -# ifdef gettext_noop -# define N_(String) gettext_noop (String) -# else -# define N_(String) (String) -# endif -#else -/* Stubs that do something close enough. */ -# define textdomain(String) (String) -# define gettext(String) (String) -# define dgettext(Domain,Message) (Message) -# define dcgettext(Domain,Message,Type) (Message) -# define bindtextdomain(Domain,Directory) (Domain) -# define _(String) (String) -# define N_(String) (String) -/* In this case we don't care about the value. */ -# ifndef LC_MESSAGES -# define LC_MESSAGES 0 -# endif -#endif diff --git a/cxmon/src/main.cpp b/cxmon/src/main.cpp deleted file mode 100644 index 3f40d8a6..00000000 --- a/cxmon/src/main.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - * main.cpp - Wrapper program for standalone cxmon - * - * cxmon (C) 1997-2004 Christian Bauer, Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" - -#include "mon.h" - - -#ifdef __BEOS__ -#include -#include -#include -#include - -// Detect if program was launched from Shell or Tracker -static bool launched_from_tracker(void) -{ - char *cmd = getenv("_"); - if (cmd == NULL || strlen(cmd) < 7) - return false; - return !strcmp(cmd + strlen(cmd) - 7 , "Tracker"); -} - -// Open Terminal window with given title for stdio, returns false on error -static bool open_stdio(const char *title) -{ - // Create key - char key_name[64]; - bigtime_t t = system_time(); - sprintf(key_name, "%Ld", t); - - // Make pipe names - char out_pipe_name[64], in_pipe_name[64]; - sprintf(out_pipe_name, "/pipe/debug_out_%s", key_name); - sprintf(in_pipe_name, "/pipe/debug_in_%s", key_name); - - // Create semaphore - char sem_name[B_OS_NAME_LENGTH], sem_id_str[B_OS_NAME_LENGTH]; - sprintf(sem_name, "debug_glue_%s", key_name); - sem_id glue_sem = create_sem(0, sem_name); - sprintf(sem_id_str, "%d", glue_sem); - - // Make path for "Terminal" app - char term_path[B_PATH_NAME_LENGTH]; - find_directory(B_BEOS_APPS_DIRECTORY, -1, false, term_path, 1024); - strcat(term_path, "/Terminal"); - - // Load "Terminal" - const char *t_argv[6]; - t_argv[0] = term_path; - t_argv[1] = "-t"; - t_argv[2] = (char *)title; - t_argv[3] = "/bin/debug_glue"; - t_argv[4] = key_name; - t_argv[5] = sem_id_str; - thread_id th = load_image(6, t_argv, (const char **)environ); - if (th < 0) { - delete_sem(glue_sem); - return false; - } - - // Start "Terminal" - resume_thread(th); - status_t err = acquire_sem_etc(glue_sem, 1, B_TIMEOUT, 5000000); - delete_sem(glue_sem); - if (err) - return false; - - // Open input/output pipes - FILE *in = freopen(in_pipe_name, "rb", stdin); - if (in == NULL) - return false; - FILE *out = freopen(out_pipe_name, "wb", stdout); - if (out == NULL) { - fclose(in); - return false; - } - - // Set buffer modes - setvbuf(stdout, NULL, _IOLBF, 0); - return true; -} -#endif - -// Main program -int main(int argc, char **argv) -{ -#ifdef __BEOS__ - // Launched from Tracker? Then open terminal window - if (launched_from_tracker()) { - if (!open_stdio("mon")) - return 1; - } -#endif - - // Execute mon - mon_init(); - mon(argc, argv); - mon_exit(); - return 0; -} diff --git a/cxmon/src/mon.cpp b/cxmon/src/mon.cpp deleted file mode 100644 index f3c6c4e7..00000000 --- a/cxmon/src/mon.cpp +++ /dev/null @@ -1,1255 +0,0 @@ -/* - * mon.cpp - cxmon main program - * - * cxmon (C) 1997-2004 Christian Bauer, Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" - -#include -#include -#include -#include -#include -#include - -#if defined(HAVE_READLINE_H) -extern "C" { -#include -} -#elif defined(HAVE_READLINE_READLINE_H) -extern "C" { -#include -} -#endif - -#if defined(HAVE_HISTORY_H) -extern "C" { -#include -} -#elif defined(HAVE_READLINE_HISTORY_H) -extern "C" { -#include -} -#endif - -#include "mon.h" -#include "mon_cmd.h" -#include "mon_lowmem.h" - -#ifndef VERSION -#define VERSION "3" -#endif - - -// Buffer we're operating on -bool mon_use_real_mem = false; -uint32 mon_mem_size; -static uint8 *mem; - - -// Streams for input, output and error messages -FILE *monin, *monout, *monerr; - -// Input line -static char *input; -static char *in_ptr; -char *mon_args_ptr; - -// Current address, value of '.' in expressions -uintptr mon_dot_address; - -// Current value of ':' in expression -static uint32 colon_value; - - -// Scanner variables -enum Token mon_token; // Last token read -uintptr mon_number; // Contains the number if mon_token==T_NUMBER -char *mon_string; // Contains the string if mon_token==T_STRING -char *mon_name; // Contains the variable name if mon_token==T_NAME - - -// List of installed commands -struct CmdSpec { - const char *name; // Name of command - void (*func)(); // Function that executes this command -}; - -static CmdSpec *cmds; // Array of CmdSpecs -static int num_cmds; // Number of installed commands -static char *cmd_help; // Help text for commands - - -// List of variables -typedef std::map var_map; -static var_map vars; - - -// Prototypes -static void init_abort(); -static void exit_abort(); - -static void read_line(char *prompt); // Scanner -static char get_char(); -static void put_back(char c); -static enum Token get_hex_number(uintptr &i); -static enum Token get_dec_number(uintptr &i); -static enum Token get_char_number(uintptr &i); -static enum Token get_string(char *&str); -static enum Token get_hex_or_name(uintptr &i, char *&name); - -static bool eor_expr(uintptr *number); // Parser -static bool and_expr(uintptr *number); -static bool shift_expr(uintptr *number); -static bool add_expr(uintptr *number); -static bool mul_expr(uintptr *number); -static bool factor(uintptr *number); - - -/* - * Add command to mon - */ - -void mon_add_command(const char *name, void (*func)(), const char *help_text) -{ - num_cmds++; - if (cmds) - cmds = (CmdSpec *)realloc(cmds, num_cmds * sizeof(CmdSpec)); - else - cmds = (CmdSpec *)malloc(sizeof(CmdSpec)); - cmds[num_cmds - 1].name = name; - cmds[num_cmds - 1].func = func; - if (help_text) { - if (cmd_help) { - cmd_help = (char *)realloc(cmd_help, strlen(cmd_help) + strlen(help_text) + 1); - strcat(cmd_help, help_text); - } else - cmd_help = strdup(help_text); - } -} - - -/* - * Print error message - */ - -void mon_error(const char *s) -{ - fprintf(monerr, "*** %s\n", s); -} - - -/* - * CTRL-C pressed? - */ - -static bool was_aborted; -static struct sigaction my_sa; - -#ifdef __BEOS__ -static void handle_abort(int sig, void *arg, vregs *r) -#else -static void handle_abort(int sig) -#endif -{ - was_aborted = true; -} - -static void init_abort() -{ - was_aborted = false; - sigemptyset(&my_sa.sa_mask); -#ifdef __BEOS__ - my_sa.sa_handler = (__signal_func_ptr)handle_abort; - my_sa.sa_userdata = 0; -#else - my_sa.sa_handler = handle_abort; -#endif - my_sa.sa_flags = 0; - sigaction(SIGINT, &my_sa, NULL); -} - -static void exit_abort() -{ - my_sa.sa_handler = SIG_DFL; - sigaction(SIGINT, &my_sa, NULL); -} - -bool mon_aborted() -{ - bool ret = was_aborted; - was_aborted = false; - return ret; -} - - -/* - * Access to buffer - */ - -uint32 (*mon_read_byte)(uintptr adr); - -uint32 mon_read_byte_buffer(uintptr adr) -{ - return mem[adr % mon_mem_size]; -} - -uint32 mon_read_byte_real(uintptr adr) -{ - return *(uint8 *)adr; -} - -void (*mon_write_byte)(uintptr adr, uint32 b); - -void mon_write_byte_buffer(uintptr adr, uint32 b) -{ - mem[adr % mon_mem_size] = b; -} - -void mon_write_byte_real(uintptr adr, uint32 b) -{ - *(uint8 *)adr = b; -} - -uint32 mon_read_half(uintptr adr) -{ - return (mon_read_byte(adr) << 8) | mon_read_byte(adr+1); -} - -void mon_write_half(uintptr adr, uint32 w) -{ - mon_write_byte(adr, w >> 8); - mon_write_byte(adr+1, w); -} - -uint32 mon_read_word(uintptr adr) -{ - return (mon_read_byte(adr) << 24) | (mon_read_byte(adr+1) << 16) | (mon_read_byte(adr+2) << 8) | mon_read_byte(adr+3); -} - -void mon_write_word(uintptr adr, uint32 l) -{ - mon_write_byte(adr, l >> 24); - mon_write_byte(adr+1, l >> 16); - mon_write_byte(adr+2, l >> 8); - mon_write_byte(adr+3, l); -} - - -/* - * Read a line from the keyboard - */ - -static void read_line(char *prompt) -{ -#ifdef HAVE_LIBREADLINE - if (input) - free(input); - input = readline(prompt); - - if (input) { - if (*input) - add_history(input); - } else { - // EOF, quit cxmon - input = (char *)malloc(2); - input[0] = 'x'; - input[1] = 0; - fprintf(monout, "x\n"); - } - - in_ptr = input; -#else - static const unsigned INPUT_LENGTH = 256; - if (!input) - input = (char *)malloc(INPUT_LENGTH); - fprintf(monout, prompt); - fflush(monout); - fgets(in_ptr = input, INPUT_LENGTH, monin); - char *s = strchr(input, '\n'); - if (s != NULL) - *s = 0; -#endif -} - - -/* - * Read a character from the input line - */ - -static char get_char() -{ - return *in_ptr++; -} - - -/* - * Stuff back a character into the input line - */ - -static void put_back(char c) -{ - *(--in_ptr) = c; -} - - -/* - * Scanner: Get a token from the input line - */ - -enum Token mon_get_token() -{ - char c = get_char(); - - // Skip spaces - while (isspace(c)) - c = get_char(); - - switch (c) { - case 0: - return mon_token = T_END; - case '(': - return mon_token = T_LPAREN; - case ')': - return mon_token = T_RPAREN; - case '.': - return mon_token = T_DOT; - case ':': - return mon_token = T_COLON; - case ',': - return mon_token = T_COMMA; - case '+': - return mon_token = T_PLUS; - case '-': - return mon_token = T_MINUS; - case '*': - return mon_token = T_MUL; - case '/': - return mon_token = T_DIV; - case '%': - return mon_token = T_MOD; - case '&': - return mon_token = T_AND; - case '|': - return mon_token = T_OR; - case '^': - return mon_token = T_EOR; - case '<': - if (get_char() == '<') - return mon_token = T_SHIFTL; - else { - mon_error("Unrecognized token"); - return mon_token = T_NULL; - } - case '>': - if (get_char() == '>') - return mon_token = T_SHIFTR; - else { - mon_error("Unrecognized token"); - return mon_token = T_NULL; - } - case '~': - return mon_token = T_NOT; - case '=': - return mon_token = T_ASSIGN; - - case '$': - if ((mon_token = get_hex_number(mon_number)) == T_NULL) - mon_error("'$' must be followed by hexadecimal number"); - return mon_token; - case '_': - if ((mon_token = get_dec_number(mon_number)) == T_NULL) - mon_error("'_' must be followed by decimal number"); - return mon_token; - case '\'': - return mon_token = get_char_number(mon_number); - case '"': - return mon_token = get_string(mon_string); - - default: - if (isalnum(c)) { - put_back(c); - return mon_token = get_hex_or_name(mon_number, mon_name); - } - mon_error("Unrecognized token"); - return mon_token = T_NULL; - } -} - -static enum Token get_hex_number(uintptr &i) -{ - char c = get_char(); - - i = 0; - if (!isxdigit(c)) - return T_NULL; - - do { - c = tolower(c); - if (c < 'a') - i = (i << 4) + (c - '0'); - else - i = (i << 4) + (c - 'a' + 10); - c = get_char(); - } while (isxdigit(c)); - - if (isalnum(c)) - return T_NULL; - else { - put_back(c); - return T_NUMBER; - } -} - -static enum Token get_dec_number(uintptr &i) -{ - char c = get_char(); - - i = 0; - if (!isdigit(c)) - return T_NULL; - - do { - i = (i * 10) + (c - '0'); - c = get_char(); - } while (isdigit(c)); - - if (isalnum(c)) - return T_NULL; - else { - put_back(c); - return T_NUMBER; - } -} - -static enum Token get_char_number(uintptr &i) -{ - char c; - - i = 0; - while ((c = get_char()) != 0) { - if (c == '\'') - return T_NUMBER; - i = (i << 8) + (uint8)c; - } - - mon_error("Unterminated character constant"); - return T_NULL; -} - -static enum Token get_string(char *&str) -{ - // Remember start of string - char *old_in_ptr = in_ptr; - - // Determine string length - char c; - unsigned n = 0; - while ((c = get_char()) != 0) { - n++; - if (c == '"') - break; - } - if (c == 0) { - mon_error("Unterminated string"); - return T_NULL; - } - - // Allocate new buffer (n: size needed including terminating 0) - str = (char *)realloc(str, n); - - // Copy string to buffer - char *p = str; - in_ptr = old_in_ptr; - while (--n) - *p++ = get_char(); - *p++ = 0; - get_char(); // skip closing '"' - return T_STRING; -} - -static enum Token get_hex_or_name(uintptr &i, char *&name) -{ - // Remember start of token - char *old_in_ptr = in_ptr; - - // Try hex number first - if (get_hex_number(i) == T_NUMBER) - return T_NUMBER; - - // Not a hex number, must be a variable name; determine its length - in_ptr = old_in_ptr; - char c = get_char(); - unsigned n = 1; - do { - n++; - c = get_char(); - } while (isalnum(c)); - - // Allocate new buffer (n: size needed including terminating 0) - name = (char *)realloc(name, n); - - // Copy name to buffer - in_ptr = old_in_ptr; - char *p = name; - while (--n) - *p++ = get_char(); - *p = 0; - return T_NAME; -} - - -/* - * expression = eor_expr {OR eor_expr} - * true: OK, false: Error - */ - -bool mon_expression(uintptr *number) -{ - uintptr accu, expr; - - if (!eor_expr(&accu)) - return false; - - for (;;) - switch (mon_token) { - case T_OR: - mon_get_token(); - if (!eor_expr(&expr)) - return false; - accu |= expr; - break; - - default: - *number = accu; - return true; - } -} - - -/* - * eor_expr = and_expr {EOR and_expr} - * true: OK, false: Error - */ - -static bool eor_expr(uintptr *number) -{ - uintptr accu, expr; - - if (!and_expr(&accu)) - return false; - - for (;;) - switch (mon_token) { - case T_EOR: - mon_get_token(); - if (!and_expr(&expr)) - return false; - accu ^= expr; - break; - - default: - *number = accu; - return true; - } -} - - -/* - * and_expr = shift_expr {AND shift_expr} - * true: OK, false: Error - */ - -static bool and_expr(uintptr *number) -{ - uintptr accu, expr; - - if (!shift_expr(&accu)) - return false; - - for (;;) - switch (mon_token) { - case T_AND: - mon_get_token(); - if (!shift_expr(&expr)) - return false; - accu &= expr; - break; - - default: - *number = accu; - return true; - } -} - - -/* - * shift_expr = add_expr {(SHIFTL | SHIFTR) add_expr} - * true: OK, false: Error - */ - -static bool shift_expr(uintptr *number) -{ - uintptr accu, expr; - - if (!add_expr(&accu)) - return false; - - for (;;) - switch (mon_token) { - case T_SHIFTL: - mon_get_token(); - if (!add_expr(&expr)) - return false; - accu <<= expr; - break; - - case T_SHIFTR: - mon_get_token(); - if (!add_expr(&expr)) - return false; - accu >>= expr; - break; - - default: - *number = accu; - return true; - } -} - - -/* - * add_expr = mul_expr {(PLUS | MINUS) mul_expr} - * true: OK, false: Error - */ - -static bool add_expr(uintptr *number) -{ - uintptr accu, expr; - - if (!mul_expr(&accu)) - return false; - - for (;;) - switch (mon_token) { - case T_PLUS: - mon_get_token(); - if (!mul_expr(&expr)) - return false; - accu += expr; - break; - - case T_MINUS: - mon_get_token(); - if (!mul_expr(&expr)) - return false; - accu -= expr; - break; - - default: - *number = accu; - return true; - } -} - - -/* - * mul_expr = factor {(MUL | DIV | MOD) factor} - * true: OK, false: Error - */ - -static bool mul_expr(uintptr *number) -{ - uintptr accu, fact; - - if (!factor(&accu)) - return false; - - for (;;) - switch (mon_token) { - case T_MUL: - mon_get_token(); - if (!factor(&fact)) - return false; - accu *= fact; - break; - - case T_DIV: - mon_get_token(); - if (!factor(&fact)) - return false; - if (fact == 0) { - mon_error("Division by 0"); - return false; - } - accu /= fact; - break; - - case T_MOD: - mon_get_token(); - if (!factor(&fact)) - return false; - if (fact == 0) { - mon_error("Division by 0"); - return false; - } - accu %= fact; - break; - - default: - *number = accu; - return true; - } -} - - -/* - * factor = NUMBER | NAME | DOT | COLON | (PLUS | MINUS | NOT) factor | LPAREN expression RPAREN - * true: OK, false: Error - */ - -static bool factor(uintptr *number) -{ - switch (mon_token) { - case T_NUMBER: - *number = mon_number; - mon_get_token(); - return true; - - case T_NAME:{ - var_map::const_iterator v = vars.find(mon_name); - if (v == vars.end()) - return false; - else { - *number = v->second; - mon_get_token(); - return true; - } - } - - case T_DOT: - *number = mon_dot_address; - mon_get_token(); - return true; - - case T_COLON: - *number = colon_value; - mon_get_token(); - return true; - - case T_PLUS: - mon_get_token(); - return factor(number); - - case T_MINUS: - mon_get_token(); - if (factor(number)) { - *number = -*number; - return true; - } else - return false; - - case T_NOT: - mon_get_token(); - if (factor(number)) { - *number = ~*number; - return true; - } else - return false; - - case T_LPAREN: - mon_get_token(); - if (mon_expression(number)) - if (mon_token == T_RPAREN) { - mon_get_token(); - return true; - } else { - mon_error("Missing ')'"); - return false; - } - else { - mon_error("Error in expression"); - return false; - } - - case T_END: - mon_error("Required argument missing"); - return false; - - default: - mon_error("'(' or number expected"); - return false; - } -} - - -/* - * Set/clear/show variables - * set [var[=value]] - */ - -static void set_var() -{ - if (mon_token == T_END) { - - // Show all variables - if (vars.empty()) - fprintf(monout, "No variables defined\n"); - else { - var_map::const_iterator v = vars.begin(), end = vars.end(); - for (v=vars.begin(); v!=end; ++v) - fprintf(monout, "%s = %08lx\n", v->first.c_str(), v->second); - } - - } else if (mon_token == T_NAME) { - std::string var_name = mon_name; - mon_get_token(); - if (mon_token == T_ASSIGN) { - - // Set variable - uintptr value; - mon_get_token(); - if (!mon_expression(&value)) - return; - if (mon_token != T_END) { - mon_error("Too many arguments"); - return; - } - vars[var_name] = value; - - } else if (mon_token == T_END) { - - // Clear variable - vars.erase(var_name); - - } else - mon_error("'=' expected"); - } else - mon_error("Variable name expected"); -} - - -/* - * Clear all variables - * cv - */ - -static void clear_vars() -{ - vars.clear(); -} - - -/* - * Display help - * h - */ - -static void help_or_hunt() -{ - if (mon_token != T_END) { - hunt(); - return; - } - fprintf(monout, "x Quit mon\n" - "h This help text\n"); - fprintf(monout, cmd_help); -} - - -/* - * Display command list - * ?? - */ - -static void mon_cmd_list() -{ - for (int i=0; i 0) { - if (strcmp(argv[0], "-h") == 0 || strcmp(argv[0], "--help") == 0) { - printf("Usage: %s [-m] [-r] [command...]\n", prg_name); - exit(0); - } else if (strcmp(argv[0], "-m") == 0) - mon_macos_mode = true; - else if (strcmp(argv[0], "-r") == 0) - mon_use_real_mem = true; - else - break; - argc--; argv++; - } - interactive = (argc == 0); - - // Set up memory access functions if not supplied by the user - if (mon_read_byte == NULL) { - if (mon_use_real_mem) - mon_read_byte = mon_read_byte_real; - else - mon_read_byte = mon_read_byte_buffer; - } - if (mon_write_byte == NULL) { - if (mon_use_real_mem) - mon_write_byte = mon_write_byte_real; - else - mon_write_byte = mon_write_byte_buffer; - } - - // Allocate buffer - if (!mon_use_real_mem) { - mon_mem_size = 0x100000; - mem = (uint8 *)malloc(mon_mem_size); - - // Print banner - if (interactive) - fprintf(monerr, "\n *** cxmon V" VERSION " by Christian Bauer and Marc Hellwig ***\n" - " *** Press 'h' for help ***\n\n"); - } - - // Clear variables - vars.clear(); - - // In MacOS mode, pull in the lowmem globals as variables - if (mon_macos_mode) { - const lowmem_info *l = lowmem; - while (l->name) { - vars[l->name] = l->addr; - l++; - } - } - - init_abort(); - - // Read and parse command line - char *cmd = NULL; - while (!done) { - if (interactive) { - char prompt[16]; - sprintf(prompt, "[%0*lx]-> ", int(2 * sizeof(mon_dot_address)), mon_dot_address); - read_line(prompt); - if (!input) { - done = true; - continue; - } - } else { - if (argc == 0) { - done = true; - break; - } else { - unsigned n = strlen(argv[0]) + 1; - input = (char *)realloc(input, n); - strcpy(in_ptr = input, argv[0]); - argc--; - argv++; - } - } - - // Skip leading spaces - char c = get_char(); - while (isspace(c)) - c = get_char(); - put_back(c); - if (!c) - continue; // blank line - - // Read command word - char *p = in_ptr; - while (isgraph(c)) - c = get_char(); - put_back(c); - unsigned n = in_ptr - p; - cmd = (char *)realloc(cmd, n + 1); - memcpy(cmd, p, n); - cmd[n] = 0; - - // Execute command - if (strcmp(cmd, "x") == 0) { // Exit - done = true; - continue; - } - for (int i=0; i - - -/* - * Initialization, deinitialization and invocation - */ - -void mon_init(); -void mon_exit(); -void mon(int argc, char **argv); - - -/* - * Definitions for adding commands to mon - */ - -// Input tokens -enum Token { - T_NULL, // Invalid token - T_END, // End of line - T_NUMBER, // Hexadecimal/decimal number (uint32) - T_STRING, // String enclosed in "" - T_NAME, // Variable name - T_DOT, // '.' - T_COLON, // ':' - T_COMMA, // ',' - T_LPAREN, // '(' - T_RPAREN, // ')' - T_PLUS, // '+' - T_MINUS, // '-' - T_MUL, // '*' - T_DIV, // '/' - T_MOD, // '%' - T_AND, // '&' - T_OR, // '|' - T_EOR, // '^' - T_SHIFTL, // '<<' - T_SHIFTR, // '>>' - T_NOT, // '~' - T_ASSIGN // '=' -}; - -// Scanner variables -extern enum Token mon_token; // Last token read -extern uintptr mon_number; // Contains the number if mon_token==T_NUMBER -extern char *mon_string; // Contains the string if mon_token==T_STRING -extern char *mon_name; // Contains the variable name if mon_token==T_NAME - -// Streams for input, output and error messages -extern FILE *monin, *monout, *monerr; - -// Current address, value of '.' in expressions -extern uintptr mon_dot_address; - -extern bool mon_use_real_mem; // Flag: mon is using real memory -extern uint32 mon_mem_size; // Size of mon buffer (if mon_use_real_mem = false) - -extern bool mon_macos_mode; // Flag: enable features in the disassembler for working with MacOS code - -// Add command to mon -extern void mon_add_command(const char *name, void (*func)(), const char *help_text); - -// Functions for commands -extern void mon_error(const char *s); // Print error message -extern enum Token mon_get_token(); // Get next token -extern bool mon_expression(uintptr *number); // Parse expression -extern bool mon_aborted(); // Check if Ctrl-C was pressed - -// Memory access -extern uint32 (*mon_read_byte)(uintptr adr); -extern void (*mon_write_byte)(uintptr adr, uint32 b); -extern uint32 mon_read_half(uintptr adr); -extern void mon_write_half(uintptr adr, uint32 w); -extern uint32 mon_read_word(uintptr adr); -extern void mon_write_word(uintptr adr, uint32 l); - -#endif diff --git a/cxmon/src/mon_6502.cpp b/cxmon/src/mon_6502.cpp deleted file mode 100644 index 1a2b6a31..00000000 --- a/cxmon/src/mon_6502.cpp +++ /dev/null @@ -1,232 +0,0 @@ -/* - * mon_6502.cpp - 6502 disassembler - * - * cxmon (C) 1997-2004 Christian Bauer, Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" - -#include "mon.h" -#include "mon_disass.h" - - -// Addressing modes -enum AddrMode { - A_IMPL, - A_ACCU, // A - A_IMM, // #zz - A_REL, // Branches - A_ZERO, // zz - A_ZEROX, // zz,x - A_ZEROY, // zz,y - A_ABS, // zzzz - A_ABSX, // zzzz,x - A_ABSY, // zzzz,y - A_IND, // (zzzz) - A_INDX, // (zz,x) - A_INDY // (zz),y -}; - -// Mnemonics -enum Mnemonic { - M_ADC, M_AND, M_ASL, M_BCC, M_BCS, M_BEQ, M_BIT, M_BMI, M_BNE, M_BPL, - M_BRK, M_BVC, M_BVS, M_CLC, M_CLD, M_CLI, M_CLV, M_CMP, M_CPX, M_CPY, - M_DEC, M_DEX, M_DEY, M_EOR, M_INC, M_INX, M_INY, M_JMP, M_JSR, M_LDA, - M_LDX, M_LDY, M_LSR, M_NOP, M_ORA, M_PHA, M_PHP, M_PLA, M_PLP, M_ROL, - M_ROR, M_RTI, M_RTS, M_SBC, M_SEC, M_SED, M_SEI, M_STA, M_STX, M_STY, - M_TAX, M_TAY, M_TSX, M_TXA, M_TXS, M_TYA, - - M_ILLEGAL, // Undocumented opcodes start here - - M_IANC, M_IANE, M_IARR, M_IASR, M_IDCP, M_IISB, M_IJAM, M_INOP, M_ILAS, - M_ILAX, M_ILXA, M_IRLA, M_IRRA, M_ISAX, M_ISBC, M_ISBX, M_ISHA, M_ISHS, - M_ISHX, M_ISHY, M_ISLO, M_ISRE, - - M_MAXIMUM // Highest element -}; - -// Mnemonic for each opcode -static const Mnemonic mnemonic[256] = { - M_BRK , M_ORA , M_IJAM, M_ISLO, M_INOP, M_ORA, M_ASL , M_ISLO, // 00 - M_PHP , M_ORA , M_ASL , M_IANC, M_INOP, M_ORA, M_ASL , M_ISLO, - M_BPL , M_ORA , M_IJAM, M_ISLO, M_INOP, M_ORA, M_ASL , M_ISLO, // 10 - M_CLC , M_ORA , M_INOP, M_ISLO, M_INOP, M_ORA, M_ASL , M_ISLO, - M_JSR , M_AND , M_IJAM, M_IRLA, M_BIT , M_AND, M_ROL , M_IRLA, // 20 - M_PLP , M_AND , M_ROL , M_IANC, M_BIT , M_AND, M_ROL , M_IRLA, - M_BMI , M_AND , M_IJAM, M_IRLA, M_INOP, M_AND, M_ROL , M_IRLA, // 30 - M_SEC , M_AND , M_INOP, M_IRLA, M_INOP, M_AND, M_ROL , M_IRLA, - M_RTI , M_EOR , M_IJAM, M_ISRE, M_INOP, M_EOR, M_LSR , M_ISRE, // 40 - M_PHA , M_EOR , M_LSR , M_IASR, M_JMP , M_EOR, M_LSR , M_ISRE, - M_BVC , M_EOR , M_IJAM, M_ISRE, M_INOP, M_EOR, M_LSR , M_ISRE, // 50 - M_CLI , M_EOR , M_INOP, M_ISRE, M_INOP, M_EOR, M_LSR , M_ISRE, - M_RTS , M_ADC , M_IJAM, M_IRRA, M_INOP, M_ADC, M_ROR , M_IRRA, // 60 - M_PLA , M_ADC , M_ROR , M_IARR, M_JMP , M_ADC, M_ROR , M_IRRA, - M_BVS , M_ADC , M_IJAM, M_IRRA, M_INOP, M_ADC, M_ROR , M_IRRA, // 70 - M_SEI , M_ADC , M_INOP, M_IRRA, M_INOP, M_ADC, M_ROR , M_IRRA, - M_INOP, M_STA , M_INOP, M_ISAX, M_STY , M_STA, M_STX , M_ISAX, // 80 - M_DEY , M_INOP, M_TXA , M_IANE, M_STY , M_STA, M_STX , M_ISAX, - M_BCC , M_STA , M_IJAM, M_ISHA, M_STY , M_STA, M_STX , M_ISAX, // 90 - M_TYA , M_STA , M_TXS , M_ISHS, M_ISHY, M_STA, M_ISHX, M_ISHA, - M_LDY , M_LDA , M_LDX , M_ILAX, M_LDY , M_LDA, M_LDX , M_ILAX, // a0 - M_TAY , M_LDA , M_TAX , M_ILXA, M_LDY , M_LDA, M_LDX , M_ILAX, - M_BCS , M_LDA , M_IJAM, M_ILAX, M_LDY , M_LDA, M_LDX , M_ILAX, // b0 - M_CLV , M_LDA , M_TSX , M_ILAS, M_LDY , M_LDA, M_LDX , M_ILAX, - M_CPY , M_CMP , M_INOP, M_IDCP, M_CPY , M_CMP, M_DEC , M_IDCP, // c0 - M_INY , M_CMP , M_DEX , M_ISBX, M_CPY , M_CMP, M_DEC , M_IDCP, - M_BNE , M_CMP , M_IJAM, M_IDCP, M_INOP, M_CMP, M_DEC , M_IDCP, // d0 - M_CLD , M_CMP , M_INOP, M_IDCP, M_INOP, M_CMP, M_DEC , M_IDCP, - M_CPX , M_SBC , M_INOP, M_IISB, M_CPX , M_SBC, M_INC , M_IISB, // e0 - M_INX , M_SBC , M_NOP , M_ISBC, M_CPX , M_SBC, M_INC , M_IISB, - M_BEQ , M_SBC , M_IJAM, M_IISB, M_INOP, M_SBC, M_INC , M_IISB, // f0 - M_SED , M_SBC , M_INOP, M_IISB, M_INOP, M_SBC, M_INC , M_IISB -}; - -// Addressing mode for each opcode -static const AddrMode adr_mode[256] = { - A_IMPL, A_INDX, A_IMPL, A_INDX, A_ZERO , A_ZERO , A_ZERO , A_ZERO, // 00 - A_IMPL, A_IMM , A_ACCU, A_IMM , A_ABS , A_ABS , A_ABS , A_ABS, - A_REL , A_INDY, A_IMPL, A_INDY, A_ZEROX, A_ZEROX, A_ZEROX, A_ZEROX, // 10 - A_IMPL, A_ABSY, A_IMPL, A_ABSY, A_ABSX , A_ABSX , A_ABSX , A_ABSX, - A_ABS , A_INDX, A_IMPL, A_INDX, A_ZERO , A_ZERO , A_ZERO , A_ZERO, // 20 - A_IMPL, A_IMM , A_ACCU, A_IMM , A_ABS , A_ABS , A_ABS , A_ABS, - A_REL , A_INDY, A_IMPL, A_INDY, A_ZEROX, A_ZEROX, A_ZEROX, A_ZEROX, // 30 - A_IMPL, A_ABSY, A_IMPL, A_ABSY, A_ABSX , A_ABSX , A_ABSX , A_ABSX, - A_IMPL, A_INDX, A_IMPL, A_INDX, A_ZERO , A_ZERO , A_ZERO , A_ZERO, // 40 - A_IMPL, A_IMM , A_ACCU, A_IMM , A_ABS , A_ABS , A_ABS , A_ABS, - A_REL , A_INDY, A_IMPL, A_INDY, A_ZEROX, A_ZEROX, A_ZEROX, A_ZEROX, // 50 - A_IMPL, A_ABSY, A_IMPL, A_ABSY, A_ABSX , A_ABSX , A_ABSX , A_ABSX, - A_IMPL, A_INDX, A_IMPL, A_INDX, A_ZERO , A_ZERO , A_ZERO , A_ZERO, // 60 - A_IMPL, A_IMM , A_ACCU, A_IMM , A_IND , A_ABS , A_ABS , A_ABS, - A_REL , A_INDY, A_IMPL, A_INDY, A_ZEROX, A_ZEROX, A_ZEROX, A_ZEROX, // 70 - A_IMPL, A_ABSY, A_IMPL, A_ABSY, A_ABSX , A_ABSX , A_ABSX , A_ABSX, - A_IMM , A_INDX, A_IMM , A_INDX, A_ZERO , A_ZERO , A_ZERO , A_ZERO, // 80 - A_IMPL, A_IMM , A_IMPL, A_IMM , A_ABS , A_ABS , A_ABS , A_ABS, - A_REL , A_INDY, A_IMPL, A_INDY, A_ZEROX, A_ZEROX, A_ZEROY, A_ZEROY, // 90 - A_IMPL, A_ABSY, A_IMPL, A_ABSY, A_ABSX , A_ABSX , A_ABSY , A_ABSY, - A_IMM , A_INDX, A_IMM , A_INDX, A_ZERO , A_ZERO , A_ZERO , A_ZERO, // a0 - A_IMPL, A_IMM , A_IMPL, A_IMM , A_ABS , A_ABS , A_ABS , A_ABS, - A_REL , A_INDY, A_IMPL, A_INDY, A_ZEROX, A_ZEROX, A_ZEROY, A_ZEROY, // b0 - A_IMPL, A_ABSY, A_IMPL, A_ABSY, A_ABSX , A_ABSX , A_ABSY , A_ABSY, - A_IMM , A_INDX, A_IMM , A_INDX, A_ZERO , A_ZERO , A_ZERO , A_ZERO, // c0 - A_IMPL, A_IMM , A_IMPL, A_IMM , A_ABS , A_ABS , A_ABS , A_ABS, - A_REL , A_INDY, A_IMPL, A_INDY, A_ZEROX, A_ZEROX, A_ZEROX, A_ZEROX, // d0 - A_IMPL, A_ABSY, A_IMPL, A_ABSY, A_ABSX , A_ABSX , A_ABSX , A_ABSX, - A_IMM , A_INDX, A_IMM , A_INDX, A_ZERO , A_ZERO , A_ZERO , A_ZERO, // e0 - A_IMPL, A_IMM , A_IMPL, A_IMM , A_ABS , A_ABS , A_ABS , A_ABS, - A_REL , A_INDY, A_IMPL, A_INDY, A_ZEROX, A_ZEROX, A_ZEROX, A_ZEROX, // f0 - A_IMPL, A_ABSY, A_IMPL, A_ABSY, A_ABSX , A_ABSX , A_ABSX , A_ABSX -}; - -// Chars for each mnemonic -static const char mnem_1[] = "aaabbbbbbbbbbcccccccdddeiiijjllllnopppprrrrssssssstttttt?aaaadijnlllrrsssssssss"; -static const char mnem_2[] = "dnscceimnprvvllllmppeeeonnnmsdddsorhhlloottbeeetttaasxxy?nnrscsaoaaxlrabbhhhhlr"; -static const char mnem_3[] = "cdlcsqtielkcscdivpxycxyrcxypraxyrpaapaplrisccdiaxyxyxasa?cerrpbmpsxaaaxcxasxyoe"; - -// Instruction length for each addressing mode -static const int adr_length[] = {1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 2, 2}; - - -/* - * Disassemble one instruction, return number of bytes - */ - -int disass_6502(FILE *f, uint32 adr, uint8 op, uint8 lo, uint8 hi) -{ - AddrMode mode = adr_mode[op]; - Mnemonic mnem = mnemonic[op]; - - // Display instruction bytes in hex - switch (adr_length[mode]) { - case 1: - fprintf(f, "%02x\t\t", op); - break; - - case 2: - fprintf(f, "%02x %02x\t\t", op, lo); - break; - - case 3: - fprintf(f, "%02x %02x %02x\t", op, lo, hi); - break; - } - - // Tag undocumented opcodes with an asterisk - if (mnem > M_ILLEGAL) - fputc('*', f); - else - fputc(' ', f); - - // Print mnemonic - fprintf(f, "%c%c%c ", mnem_1[mnem], mnem_2[mnem], mnem_3[mnem]); - - // Print argument - switch (mode) { - case A_IMPL: - break; - - case A_ACCU: - fprintf(f, "a"); - break; - - case A_IMM: - fprintf(f, "#$%02x", lo); - break; - - case A_REL: - fprintf(f, "$%04x", (adr + 2) + (int8)lo); - break; - - case A_ZERO: - fprintf(f, "$%02x", lo); - break; - - case A_ZEROX: - fprintf(f, "$%02x,x", lo); - break; - - case A_ZEROY: - fprintf(f, "$%02x,y", lo); - break; - - case A_ABS: - fprintf(f, "$%04x", (hi << 8) | lo); - break; - - case A_ABSX: - fprintf(f, "$%04x,x", (hi << 8) | lo); - break; - - case A_ABSY: - fprintf(f, "$%04x,y", (hi << 8) | lo); - break; - - case A_IND: - fprintf(f, "($%04x)", (hi << 8) | lo); - break; - - case A_INDX: - fprintf(f, "($%02x,x)", lo); - break; - - case A_INDY: - fprintf(f, "($%02x),y", lo); - break; - } - - fputc('\n', f); - return adr_length[mode]; -} diff --git a/cxmon/src/mon_atraps.h b/cxmon/src/mon_atraps.h deleted file mode 100644 index f18c41ce..00000000 --- a/cxmon/src/mon_atraps.h +++ /dev/null @@ -1,1212 +0,0 @@ -/* - * mon_atraps.h - MacOS A-Line trap definitions - * - * cxmon (C) 1997-2004 Christian Bauer, Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef MON_ATRAPS_H -#define MON_ATRAPS_H - -struct atrap_info { - const char *name; - uint16 word; -}; - -// A-Traps in ascending order -static const atrap_info atraps[] = { - {"Open" , 0xA000}, - {"Close" , 0xA001}, - {"Read" , 0xA002}, - {"Write" , 0xA003}, - {"Control" , 0xA004}, - {"Status" , 0xA005}, - {"KillIO" , 0xA006}, - {"GetVolInfo" , 0xA007}, - {"Create" , 0xA008}, - {"Delete" , 0xA009}, - {"OpenRF" , 0xA00A}, - {"Rename" , 0xA00B}, - {"GetFileInfo" , 0xA00C}, - {"SetFileInfo" , 0xA00D}, - {"UnmountVol" , 0xA00E}, - {"MountVol" , 0xA00F}, - {"Allocate" , 0xA010}, - {"GetEOF" , 0xA011}, - {"SetEOF" , 0xA012}, - {"FlushVol" , 0xA013}, - {"GetVol" , 0xA014}, - {"SetVol" , 0xA015}, - {"FInitQueue" , 0xA016}, - {"Eject" , 0xA017}, - {"GetFPos" , 0xA018}, - {"InitZone" , 0xA019}, - {"SetZone" , 0xA01B}, - {"FreeMem" , 0xA01C}, - {"DisposePtr" , 0xA01F}, - {"SetPtrSize" , 0xA020}, - {"GetPtrSize" , 0xA021}, - {"DisposeHandle" , 0xA023}, - {"SetHandleSize" , 0xA024}, - {"GetHandleSize" , 0xA025}, - {"ReallocHandle" , 0xA027}, - {"HLock" , 0xA029}, - {"HUnlock" , 0xA02A}, - {"EmptyHandle" , 0xA02B}, - {"InitApplZone" , 0xA02C}, - {"SetApplLimit" , 0xA02D}, - {"BlockMove" , 0xA02E}, - {"PostEvent" , 0xA02F}, - {"OSEventAvail" , 0xA030}, - {"GetOSEvent" , 0xA031}, - {"FlushEvents" , 0xA032}, - {"VInstall" , 0xA033}, - {"VRemove" , 0xA034}, - {"OffLine" , 0xA035}, - {"MoreMasters" , 0xA036}, - {"ReadParam" , 0xA037}, - {"WriteParam" , 0xA038}, - {"ReadDateTime" , 0xA039}, - {"SetDateTime" , 0xA03A}, - {"Delay" , 0xA03B}, - {"CmpString" , 0xA03C}, - {"DrvrInstall" , 0xA03D}, - {"DrvrRemove" , 0xA03E}, - {"InitUtil" , 0xA03F}, - {"ResrvMem" , 0xA040}, - {"SetFilLock" , 0xA041}, - {"RstFilLock" , 0xA042}, - {"SetFilType" , 0xA043}, - {"SetFPos" , 0xA044}, - {"FlushFile" , 0xA045}, - {"SetTrapAddress" , 0xA047}, - {"HPurge" , 0xA049}, - {"HNoPurge" , 0xA04A}, - {"SetGrowZone" , 0xA04B}, - {"CompactMem" , 0xA04C}, - {"PurgeMem" , 0xA04D}, - {"AddDrive" , 0xA04E}, - {"RDrvrInstall" , 0xA04F}, - {"CompareString" , 0xA050}, - {"ReadXPRam" , 0xA051}, - {"WriteXPRam" , 0xA052}, - {"UprString" , 0xA054}, - {"StripAddress" , 0xA055}, - {"LowerText" , 0xA056}, - {"SetApplBase" , 0xA057}, - {"InsTime" , 0xA058}, - {"RmvTime" , 0xA059}, - {"PrimeTime" , 0xA05A}, - {"PowerOff" , 0xA05B}, - {"MemoryDispatch" , 0xA05C}, - {"SwapMMUMode" , 0xA05D}, - {"NMInstall" , 0xA05E}, - {"NMRemove" , 0xA05F}, - {"FSDispatch" , 0xA060}, - {"MaxBlock" , 0xA061}, - {"MaxApplZone" , 0xA063}, - {"MoveHHi" , 0xA064}, - {"StackSpace" , 0xA065}, - {"HSetRBit" , 0xA067}, - {"HClrRBit" , 0xA068}, - {"HGetState" , 0xA069}, - {"HSetState" , 0xA06A}, - {"TestManager" , 0xA06B}, - {"InitFS" , 0xA06C}, - {"InitEvents" , 0xA06D}, - {"SlotManager" , 0xA06E}, - {"SlotVInstall" , 0xA06F}, - {"SlotVRemove" , 0xA070}, - {"AttachVBL" , 0xA071}, - {"DoVBLTask" , 0xA072}, - {"OSReserved" , 0xA073}, - {"CacheMgr" , 0xA074}, - {"SIntInstall" , 0xA075}, - {"SIntRemove" , 0xA076}, - {"CountADBs" , 0xA077}, - {"GetIndADB" , 0xA078}, - {"GetADBInfo" , 0xA079}, - {"SetADBInfo" , 0xA07A}, - {"ADBReInit" , 0xA07B}, - {"ADBOp" , 0xA07C}, - {"GetDefaultStartup" , 0xA07D}, - {"SetDefaultStartup" , 0xA07E}, - {"InternalWait" , 0xA07F}, - {"GetVideoDefault" , 0xA080}, - {"SetVideoDefault" , 0xA081}, - {"DTInstall" , 0xA082}, - {"SetOSDefault" , 0xA083}, - {"GetOSDefault" , 0xA084}, - {"PMgrOp" , 0xA085}, - {"IOPInfoAccess" , 0xA086}, - {"IOPMsgRequest" , 0xA087}, - {"IOPMoveData" , 0xA088}, - {"SCSIAtomic" , 0xA089}, - {"Sleep" , 0xA08A}, - {"CommToolboxDispatch" , 0xA08B}, - {"Wakeup" , 0xA08C}, - {"DebugUtil" , 0xA08D}, - {"BTreeDispatch" , 0xA08E}, - {"DeferUserFn" , 0xA08F}, - {"SysEnvirons" , 0xA090}, - {"Translate24To32" , 0xA091}, - {"EgretDispatch" , 0xA092}, - {"Microseconds" , 0xA093}, - {"ServerDispatch" , 0xA094}, - {"POGOMPW" , 0xA095}, - {"SharedLibsMPW" , 0xA096}, - {"FPPriv" , 0xA097}, - {"XToolTable" , 0xA099}, - {"vProcHelper" , 0xA09A}, - {"Messager" , 0xA09B}, - {"NewPtrStartup" , 0xA09C}, - {"MoveHLow" , 0xA09D}, - {"PowerMgrDispatch" , 0xA09E}, - {"PowerDispatch" , 0xA09F}, - {"vMRdAddr" , 0xA0A0}, - {"vMRdData" , 0xA0A1}, - {"vMWrData" , 0xA0A2}, - {"HeapDispatch" , 0xA0A4}, - {"VisRegionChanged" , 0xA0A5}, - {"vStdEntry" , 0xA0A6}, - {"vStdExit" , 0xA0A7}, - {"FSM" , 0xA0AC}, - {"vADBProc" , 0xA0AE}, - {"vMtCheck" , 0xA0AF}, - {"vCheckReMount" , 0xA0B0}, - {"vDtrmV2" , 0xA0B1}, - {"vFindDrive" , 0xA0B2}, - {"vFClose" , 0xA0B3}, - {"vFlushMDB" , 0xA0B4}, - {"vGoDriver" , 0xA0B5}, - {"vWaitUntil" , 0xA0B6}, - {"vSyncWait" , 0xA0B7}, - {"vSoundDead" , 0xA0B8}, - {"vDisptch" , 0xA0B9}, - {"vIAZInit" , 0xA0BA}, - {"vIAZPostInit" , 0xA0BB}, - {"vLaunchInit" , 0xA0BC}, - {"vCacheFlush" , 0xA0BD}, - {"vSysUtil" , 0xA0BE}, - {"vLg2Phys" , 0xA0BF}, - {"vFlushCache" , 0xA0C0}, - {"vGetBlock" , 0xA0C1}, - {"vMarkBlock" , 0xA0C2}, - {"vRelBlock" , 0xA0C3}, - {"vTrashBlocks" , 0xA0C4}, - {"vTrashVBlks" , 0xA0C5}, - {"vCacheWrIP" , 0xA0C6}, - {"vCacheRdIP" , 0xA0C7}, - {"vBasicIO" , 0xA0C8}, - {"vRdBlocks" , 0xA0C9}, - {"vWrBlocks" , 0xA0CA}, - {"vSetUpTags" , 0xA0CB}, - {"vBTClose" , 0xA0CC}, - {"vBTDelete" , 0xA0CD}, - {"vBTFlush" , 0xA0CE}, - {"vBTGetRecord" , 0xA0CF}, - {"vBTInsert" , 0xA0D0}, - {"vBTOpen" , 0xA0D1}, - {"vBTSearch" , 0xA0D2}, - {"vBTUpdate" , 0xA0D3}, - {"vGetNode" , 0xA0D4}, - {"vRelNode" , 0xA0D5}, - {"vAllocNode" , 0xA0D6}, - {"vFreeNode" , 0xA0D7}, - {"vExtBTFile" , 0xA0D8}, - {"vDeallocFile" , 0xA0D9}, - {"vExtendFile" , 0xA0DA}, - {"vTruncateFile" , 0xA0DB}, - {"vCMSetup" , 0xA0DC}, - {"PPC" , 0xA0DD}, - {"vDtrmV1" , 0xA0DE}, - {"vBlkAlloc" , 0xA0DF}, - {"vBlkDeAlloc" , 0xA0E0}, - {"vFileOpen" , 0xA0E1}, - {"vPermssnChk" , 0xA0E2}, - {"vFndFilName" , 0xA0E3}, - {"vRfNCall" , 0xA0E4}, - {"vAdjEOF" , 0xA0E5}, - {"vPixel2Char" , 0xA0E6}, - {"vChar2Pixel" , 0xA0E7}, - {"vHiliteText" , 0xA0E8}, - {"vFileClose" , 0xA0E9}, - {"vFileRead" , 0xA0EA}, - {"vFileWrite" , 0xA0EB}, - {"DispatchHelper" , 0xA0EC}, - {"vUpdAltMDB" , 0xA0ED}, - {"vCkExtFS" , 0xA0EE}, - {"vDtrmV3" , 0xA0EF}, - {"vBMChk" , 0xA0F0}, - {"vTstMod" , 0xA0F1}, - {"vLocCRec" , 0xA0F2}, - {"vTreeSearch" , 0xA0F3}, - {"vMapFBlock" , 0xA0F4}, - {"vXFSearch" , 0xA0F5}, - {"vReadBM" , 0xA0F6}, - {"vDoEject" , 0xA0F7}, - {"vSegStack" , 0xA0F8}, - {"vSuperLoad" , 0xA0F9}, - {"vCmpFrm" , 0xA0FA}, - {"vNewMap" , 0xA0FB}, - {"vCheckLoad" , 0xA0FC}, - {"XTrimMeasure" , 0xA0FD}, - {"XFindWord" , 0xA0FE}, - {"XFindLine" , 0xA0FF}, - {"GetZone" , 0xA11A}, - {"MaxMem" , 0xA11D}, - {"NewPtr" , 0xA11E}, - {"NewHandle" , 0xA122}, - {"HandleZone" , 0xA126}, - {"RecoverHandle" , 0xA128}, - {"PPostEvent" , 0xA12F}, - {"DrvrInstall" , 0xA13D}, - {"GetTrapAddress" , 0xA146}, - {"PtrZone" , 0xA148}, - {"MemoryDispatch" , 0xA15C}, - {"PurgeSpace" , 0xA162}, - {"NewEmptyHandle" , 0xA166}, - {"Microseconds" , 0xA193}, - {"HWPriv" , 0xA198}, - {"Gestalt" , 0xA1AD}, - {"HOpen" , 0xA200}, - {"HGetVInfo" , 0xA207}, - {"HCreate" , 0xA208}, - {"HDelete" , 0xA209}, - {"HOpenRF" , 0xA20A}, - {"HRename" , 0xA20B}, - {"HGetFileInfo" , 0xA20C}, - {"HSetFileInfo" , 0xA20D}, - {"HUnmountVol" , 0xA20E}, - {"AllocContig" , 0xA210}, - {"HGetVol" , 0xA214}, - {"HSetVol" , 0xA215}, - {"BlockMoveData" , 0xA22E}, - {"HSetFLock" , 0xA241}, - {"HRstFLock" , 0xA242}, - {"SetOSTrapAddress" , 0xA247}, - {"StripText" , 0xA256}, - {"HFSDispatch" , 0xA260}, - {"IdleUpdate" , 0xA285}, - {"SleepQInstall" , 0xA28A}, - {"NewPtrClear" , 0xA31E}, - {"NewHandleClear" , 0xA322}, - {"GetOSTrapAddress" , 0xA346}, - {"NewGestalt" , 0xA3AD}, - {"DrvrInstallRsrvMem" , 0xA43D}, - {"UpperText" , 0xA456}, - {"InsXTime" , 0xA458}, - {"IdleState" , 0xA485}, - {"SleepQRemove" , 0xA48A}, - {"NewPtrSys" , 0xA51E}, - {"NewHandleSys" , 0xA522}, - {"DrvrInstallRsrvMem" , 0xA53D}, - {"PurgeSpaceSys" , 0xA562}, - {"ReplaceGestalt" , 0xA5AD}, - {"SetToolBoxTrapAddress" , 0xA647}, - {"StripUpperText" , 0xA656}, - {"SerialPower" , 0xA685}, - {"NewPtrSysClear" , 0xA71E}, - {"NewHandleSysClear" , 0xA722}, - {"GetToolBoxTrapAddress" , 0xA746}, - {"GetToolTrapAddress" , 0xA746}, - {"GetGestaltProcPtr" , 0xA7AD}, - {"SoundDispatch" , 0xA800}, - {"SndDisposeChannel" , 0xA801}, - {"SndAddModifier" , 0xA802}, - {"SndDoCommand" , 0xA803}, - {"SndDoImmediate" , 0xA804}, - {"SndPlay" , 0xA805}, - {"SndControl" , 0xA806}, - {"SndNewChannel" , 0xA807}, - {"InitProcMenu" , 0xA808}, - {"GetControlVariant" , 0xA809}, - {"GetWVariant" , 0xA80A}, - {"PopUpMenuSelect" , 0xA80B}, - {"RGetResource" , 0xA80C}, - {"Count1Resources" , 0xA80D}, - {"Get1IxResource" , 0xA80E}, - {"Get1IxType" , 0xA80F}, - {"Unique1ID" , 0xA810}, - {"TESelView" , 0xA811}, - {"TEPinScroll" , 0xA812}, - {"TEAutoView" , 0xA813}, - {"SetFractEnable" , 0xA814}, - {"SCSIDispatch" , 0xA815}, - {"Pack8" , 0xA816}, - {"CopyMask" , 0xA817}, - {"FixATan2" , 0xA818}, - {"XMunger" , 0xA819}, - {"HOpenResFile" , 0xA81A}, - {"HCreateResFile" , 0xA81B}, - {"Count1Types" , 0xA81C}, - {"InvalMenuBar" , 0xA81D}, - {"SaveRestoreBits" , 0xA81E}, - {"Get1Resource" , 0xA81F}, - {"Get1NamedResource" , 0xA820}, - {"MaxSizeRsrc" , 0xA821}, - {"ResourceDispatch" , 0xA822}, - {"AliasDispatch" , 0xA823}, - {"FSMgr" , 0xA824}, - {"MenuDispatch" , 0xA825}, - {"InsertMenuItem" , 0xA826}, - {"HideDialogItem" , 0xA827}, - {"ShowDialogItem" , 0xA828}, - {"LayerDispatch" , 0xA829}, - {"ComponentDispatch" , 0xA82A}, - {"Pack9" , 0xA82B}, - {"Pack10" , 0xA82C}, - {"Pack11" , 0xA82D}, - {"Pack12" , 0xA82E}, - {"Pack13" , 0xA82F}, - {"Pack14" , 0xA830}, - {"Pack15" , 0xA831}, - {"QuickDrawGX" , 0xA832}, - {"ScrnBitMap" , 0xA833}, - {"SetFScaleDisable" , 0xA834}, - {"FontMetrics" , 0xA835}, - {"GetMaskTable" , 0xA836}, - {"MeasureText" , 0xA837}, - {"CalcMask" , 0xA838}, - {"SeedFill" , 0xA839}, - {"ZoomWindow" , 0xA83A}, - {"TrackBox" , 0xA83B}, - {"TEGetOffset" , 0xA83C}, - {"TEDispatch" , 0xA83D}, - {"TEStyleNew" , 0xA83E}, - {"Long2Fix" , 0xA83F}, - {"Fix2Long" , 0xA840}, - {"Fix2Frac" , 0xA841}, - {"Frac2Fix" , 0xA842}, - {"Fix2X" , 0xA843}, - {"X2Fix" , 0xA844}, - {"Frac2X" , 0xA845}, - {"X2Frac" , 0xA846}, - {"FracCos" , 0xA847}, - {"FracSin" , 0xA848}, - {"FracSqrt" , 0xA849}, - {"FracMul" , 0xA84A}, - {"FracDiv" , 0xA84B}, - {"UserDelay" , 0xA84C}, - {"FixDiv" , 0xA84D}, - {"GetItemCmd" , 0xA84E}, - {"SetItemCmd" , 0xA84F}, - {"InitCursor" , 0xA850}, - {"SetCursor" , 0xA851}, - {"HideCursor" , 0xA852}, - {"ShowCursor" , 0xA853}, - {"FontDispatch" , 0xA854}, - {"ShieldCursor" , 0xA855}, - {"ObscureCursor" , 0xA856}, - {"SetEntry" , 0xA857}, - {"BitAnd" , 0xA858}, - {"BitXOr" , 0xA859}, - {"BitNot" , 0xA85A}, - {"BitOr" , 0xA85B}, - {"BitShift" , 0xA85C}, - {"BitTst" , 0xA85D}, - {"BitSet" , 0xA85E}, - {"BitClr" , 0xA85F}, - {"WaitNextEvent" , 0xA860}, - {"Random" , 0xA861}, - {"ForeColor" , 0xA862}, - {"BackColor" , 0xA863}, - {"ColorBit" , 0xA864}, - {"GetPixel" , 0xA865}, - {"StuffHex" , 0xA866}, - {"LongMul" , 0xA867}, - {"FixMul" , 0xA868}, - {"FixRatio" , 0xA869}, - {"HiWord" , 0xA86A}, - {"LoWord" , 0xA86B}, - {"FixRound" , 0xA86C}, - {"InitPort" , 0xA86D}, - {"InitGraf" , 0xA86E}, - {"OpenPort" , 0xA86F}, - {"LocalToGlobal" , 0xA870}, - {"GlobalToLocal" , 0xA871}, - {"GrafDevice" , 0xA872}, - {"SetPort" , 0xA873}, - {"GetPort" , 0xA874}, - {"SetPBits" , 0xA875}, - {"PortSize" , 0xA876}, - {"MovePortTo" , 0xA877}, - {"SetOrigin" , 0xA878}, - {"SetClip" , 0xA879}, - {"GetClip" , 0xA87A}, - {"ClipRect" , 0xA87B}, - {"BackPat" , 0xA87C}, - {"ClosePort" , 0xA87D}, - {"AddPt" , 0xA87E}, - {"SubPt" , 0xA87F}, - {"SetPt" , 0xA880}, - {"EqualPt" , 0xA881}, - {"StdText" , 0xA882}, - {"DrawChar" , 0xA883}, - {"DrawString" , 0xA884}, - {"DrawText" , 0xA885}, - {"TextWidth" , 0xA886}, - {"TextFont" , 0xA887}, - {"TextFace" , 0xA888}, - {"TextMode" , 0xA889}, - {"TextSize" , 0xA88A}, - {"GetFontInfo" , 0xA88B}, - {"StringWidth" , 0xA88C}, - {"CharWidth" , 0xA88D}, - {"SpaceExtra" , 0xA88E}, - {"OSDispatch" , 0xA88F}, - {"StdLine" , 0xA890}, - {"LineTo" , 0xA891}, - {"Line" , 0xA892}, - {"MoveTo" , 0xA893}, - {"Move" , 0xA894}, - {"ShutDown" , 0xA895}, - {"HidePen" , 0xA896}, - {"ShowPen" , 0xA897}, - {"GetPenState" , 0xA898}, - {"SetPenState" , 0xA899}, - {"GetPen" , 0xA89A}, - {"PenSize" , 0xA89B}, - {"PenMode" , 0xA89C}, - {"PenPat" , 0xA89D}, - {"PenNormal" , 0xA89E}, - {"Unimplemented" , 0xA89F}, - {"StdRect" , 0xA8A0}, - {"FrameRect" , 0xA8A1}, - {"PaintRect" , 0xA8A2}, - {"EraseRect" , 0xA8A3}, - {"InverRect" , 0xA8A4}, - {"FillRect" , 0xA8A5}, - {"EqualRect" , 0xA8A6}, - {"SetRect" , 0xA8A7}, - {"OffsetRect" , 0xA8A8}, - {"InsetRect" , 0xA8A9}, - {"SectRect" , 0xA8AA}, - {"UnionRect" , 0xA8AB}, - {"Pt2Rect" , 0xA8AC}, - {"PtInRect" , 0xA8AD}, - {"EmptyRect" , 0xA8AE}, - {"StdRRect" , 0xA8AF}, - {"FrameRoundRect" , 0xA8B0}, - {"PaintRoundRect" , 0xA8B1}, - {"EraseRoundRect" , 0xA8B2}, - {"InverRoundRect" , 0xA8B3}, - {"FillRoundRect" , 0xA8B4}, - {"ScriptUtil" , 0xA8B5}, - {"StdOval" , 0xA8B6}, - {"FrameOval" , 0xA8B7}, - {"PaintOval" , 0xA8B8}, - {"EraseOval" , 0xA8B9}, - {"InvertOval" , 0xA8BA}, - {"FillOval" , 0xA8BB}, - {"SlopeFromAngle" , 0xA8BC}, - {"StdArc" , 0xA8BD}, - {"FrameArc" , 0xA8BE}, - {"PaintArc" , 0xA8BF}, - {"EraseArc" , 0xA8C0}, - {"InvertArc" , 0xA8C1}, - {"FillArc" , 0xA8C2}, - {"PtToAngle" , 0xA8C3}, - {"AngleFromSlope" , 0xA8C4}, - {"StdPoly" , 0xA8C5}, - {"FramePoly" , 0xA8C6}, - {"PaintPoly" , 0xA8C7}, - {"ErasePoly" , 0xA8C8}, - {"InvertPoly" , 0xA8C9}, - {"FillPoly" , 0xA8CA}, - {"OpenPoly" , 0xA8CB}, - {"ClosePoly" , 0xA8CC}, - {"KillPoly" , 0xA8CD}, - {"OffsetPoly" , 0xA8CE}, - {"PackBits" , 0xA8CF}, - {"UnpackBits" , 0xA8D0}, - {"StdRgn" , 0xA8D1}, - {"FrameRgn" , 0xA8D2}, - {"PaintRgn" , 0xA8D3}, - {"EraseRgn" , 0xA8D4}, - {"InverRgn" , 0xA8D5}, - {"FillRgn" , 0xA8D6}, - {"BitMapToRegion" , 0xA8D7}, - {"NewRgn" , 0xA8D8}, - {"DisposeRgn" , 0xA8D9}, - {"OpenRgn" , 0xA8DA}, - {"CloseRgn" , 0xA8DB}, - {"CopyRgn" , 0xA8DC}, - {"SetEmptyRgn" , 0xA8DD}, - {"SetRecRgn" , 0xA8DE}, - {"RectRgn" , 0xA8DF}, - {"OffsetRgn" , 0xA8E0}, - {"InsetRgn" , 0xA8E1}, - {"EmptyRgn" , 0xA8E2}, - {"EqualRgn" , 0xA8E3}, - {"SectRgn" , 0xA8E4}, - {"UnionRgn" , 0xA8E5}, - {"DiffRgn" , 0xA8E6}, - {"XOrRgn" , 0xA8E7}, - {"PtInRgn" , 0xA8E8}, - {"RectInRgn" , 0xA8E9}, - {"SetStdProcs" , 0xA8EA}, - {"StdBits" , 0xA8EB}, - {"CopyBits" , 0xA8EC}, - {"StdTxMeas" , 0xA8ED}, - {"StdGetPic" , 0xA8EE}, - {"ScrollRect" , 0xA8EF}, - {"StdPutPic" , 0xA8F0}, - {"StdComment" , 0xA8F1}, - {"PicComment" , 0xA8F2}, - {"OpenPicture" , 0xA8F3}, - {"ClosePicture" , 0xA8F4}, - {"KillPicture" , 0xA8F5}, - {"DrawPicture" , 0xA8F6}, - {"Layout" , 0xA8F7}, - {"ScalePt" , 0xA8F8}, - {"MapPt" , 0xA8F9}, - {"MapRect" , 0xA8FA}, - {"MapRgn" , 0xA8FB}, - {"MapPoly" , 0xA8FC}, - {"PrGlue" , 0xA8FD}, - {"InitFonts" , 0xA8FE}, - {"GetFName" , 0xA8FF}, - {"GetFNum" , 0xA900}, - {"FMSwapFont" , 0xA901}, - {"RealFont" , 0xA902}, - {"SetFontLock" , 0xA903}, - {"DrawGrowIcon" , 0xA904}, - {"DragGrayRgn" , 0xA905}, - {"NewString" , 0xA906}, - {"SetString" , 0xA907}, - {"ShowHide" , 0xA908}, - {"CalcVis" , 0xA909}, - {"CalcVBehind" , 0xA90A}, - {"ClipAbove" , 0xA90B}, - {"PaintOne" , 0xA90C}, - {"PaintBehind" , 0xA90D}, - {"SaveOld" , 0xA90E}, - {"DrawNew" , 0xA90F}, - {"GetWMgrPort" , 0xA910}, - {"CheckUpDate" , 0xA911}, - {"InitWindows" , 0xA912}, - {"NewWindow" , 0xA913}, - {"DisposeWindow" , 0xA914}, - {"ShowWindow" , 0xA915}, - {"HideWindow" , 0xA916}, - {"GetWRefCon" , 0xA917}, - {"SetWRefCon" , 0xA918}, - {"GetWTitle" , 0xA919}, - {"SetWTitle" , 0xA91A}, - {"MoveWindow" , 0xA91B}, - {"HiliteWindow" , 0xA91C}, - {"SizeWindow" , 0xA91D}, - {"TrackGoAway" , 0xA91E}, - {"SelectWindow" , 0xA91F}, - {"BringToFront" , 0xA920}, - {"SendBehind" , 0xA921}, - {"BeginUpDate" , 0xA922}, - {"EndUpDate" , 0xA923}, - {"FrontWindow" , 0xA924}, - {"DragWindow" , 0xA925}, - {"DragTheRgn" , 0xA926}, - {"InvalRgn" , 0xA927}, - {"InvalRect" , 0xA928}, - {"ValidRgn" , 0xA929}, - {"ValidRect" , 0xA92A}, - {"GrowWindow" , 0xA92B}, - {"FindWindow" , 0xA92C}, - {"CloseWindow" , 0xA92D}, - {"SetWindowPic" , 0xA92E}, - {"GetWindowPic" , 0xA92F}, - {"InitMenus" , 0xA930}, - {"NewMenu" , 0xA931}, - {"DisposeMenu" , 0xA932}, - {"AppendMenu" , 0xA933}, - {"ClearMenuBar" , 0xA934}, - {"InsertMenu" , 0xA935}, - {"DeleteMenu" , 0xA936}, - {"DrawMenuBar" , 0xA937}, - {"HiliteMenu" , 0xA938}, - {"EnableItem" , 0xA939}, - {"DisableItem" , 0xA93A}, - {"GetMenuBar" , 0xA93B}, - {"SetMenuBar" , 0xA93C}, - {"MenuSelect" , 0xA93D}, - {"MenuKey" , 0xA93E}, - {"GetItmIcon" , 0xA93F}, - {"SetItmIcon" , 0xA940}, - {"GetItmStyle" , 0xA941}, - {"SetItmStyle" , 0xA942}, - {"GetItmMark" , 0xA943}, - {"SetItmMark" , 0xA944}, - {"CheckItem" , 0xA945}, - {"GetMenuItemText" , 0xA946}, - {"SetMenuItemText" , 0xA947}, - {"CalcMenuSize" , 0xA948}, - {"GetMenuHandle" , 0xA949}, - {"SetMFlash" , 0xA94A}, - {"PlotIcon" , 0xA94B}, - {"FlashMenuBar" , 0xA94C}, - {"AppendResMenu" , 0xA94D}, - {"PinRect" , 0xA94E}, - {"DeltaPoint" , 0xA94F}, - {"CountMItems" , 0xA950}, - {"InsertResMenu" , 0xA951}, - {"DeleteMenuItem" , 0xA952}, - {"UpdtControl" , 0xA953}, - {"NewControl" , 0xA954}, - {"DisposeControl" , 0xA955}, - {"KillControls" , 0xA956}, - {"ShowControl" , 0xA957}, - {"HideControl" , 0xA958}, - {"MoveControl" , 0xA959}, - {"GetControlReference" , 0xA95A}, - {"SetControlReference" , 0xA95B}, - {"SizeControl" , 0xA95C}, - {"HiliteControl" , 0xA95D}, - {"GetControlTitle" , 0xA95E}, - {"SetControlTitle" , 0xA95F}, - {"GetControlValue" , 0xA960}, - {"GetControlMinimum" , 0xA961}, - {"GetControlMaximum" , 0xA962}, - {"SetControlValue" , 0xA963}, - {"SetControlMinimum" , 0xA964}, - {"SetControlMaximum" , 0xA965}, - {"TestControl" , 0xA966}, - {"DragControl" , 0xA967}, - {"TrackControl" , 0xA968}, - {"DrawControls" , 0xA969}, - {"GetControlAction" , 0xA96A}, - {"SetControlAction" , 0xA96B}, - {"FindControl" , 0xA96C}, - {"Draw1Control" , 0xA96D}, - {"Dequeue" , 0xA96E}, - {"Enqueue" , 0xA96F}, - {"GetNextEvent" , 0xA970}, - {"EventAvail" , 0xA971}, - {"GetMouse" , 0xA972}, - {"StillDown" , 0xA973}, - {"Button" , 0xA974}, - {"TickCount" , 0xA975}, - {"GetKeys" , 0xA976}, - {"WaitMouseUp" , 0xA977}, - {"UpdtDialog" , 0xA978}, - {"CouldDialog" , 0xA979}, - {"FreeDialog" , 0xA97A}, - {"InitDialogs" , 0xA97B}, - {"GetNewDialog" , 0xA97C}, - {"NewDialog" , 0xA97D}, - {"SelectDialogItemText" , 0xA97E}, - {"IsDialogEvent" , 0xA97F}, - {"DialogSelect" , 0xA980}, - {"DrawDialog" , 0xA981}, - {"CloseDialog" , 0xA982}, - {"DisposeDialog" , 0xA983}, - {"FindDialogItem" , 0xA984}, - {"Alert" , 0xA985}, - {"StopAlert" , 0xA986}, - {"NoteAlert" , 0xA987}, - {"CautionAlert" , 0xA988}, - {"CouldAlert" , 0xA989}, - {"FreeAlert" , 0xA98A}, - {"ParamText" , 0xA98B}, - {"ErrorSound" , 0xA98C}, - {"GetDialogItem" , 0xA98D}, - {"SetDialogItem" , 0xA98E}, - {"SetDialogItemText" , 0xA98F}, - {"GetDialogItemText" , 0xA990}, - {"ModalDialog" , 0xA991}, - {"DetachResource" , 0xA992}, - {"SetResPurge" , 0xA993}, - {"CurResFile" , 0xA994}, - {"InitResources" , 0xA995}, - {"RsrcZoneInit" , 0xA996}, - {"OpenResFile" , 0xA997}, - {"UseResFile" , 0xA998}, - {"UpdateResFile" , 0xA999}, - {"CloseResFile" , 0xA99A}, - {"SetResLoad" , 0xA99B}, - {"CountResources" , 0xA99C}, - {"GetIndResource" , 0xA99D}, - {"CountTypes" , 0xA99E}, - {"GetIndType" , 0xA99F}, - {"GetResource" , 0xA9A0}, - {"GetNamedResource" , 0xA9A1}, - {"LoadResource" , 0xA9A2}, - {"ReleaseResource" , 0xA9A3}, - {"HomeResFile" , 0xA9A4}, - {"SizeRsrc" , 0xA9A5}, - {"GetResAttrs" , 0xA9A6}, - {"SetResAttrs" , 0xA9A7}, - {"GetResInfo" , 0xA9A8}, - {"SetResInfo" , 0xA9A9}, - {"ChangedResource" , 0xA9AA}, - {"AddResource" , 0xA9AB}, - {"AddReference" , 0xA9AC}, - {"RmveResource" , 0xA9AD}, - {"RmveReference" , 0xA9AE}, - {"ResError" , 0xA9AF}, - {"WriteResource" , 0xA9B0}, - {"CreateResFile" , 0xA9B1}, - {"SystemEvent" , 0xA9B2}, - {"SystemClick" , 0xA9B3}, - {"SystemTask" , 0xA9B4}, - {"SystemMenu" , 0xA9B5}, - {"OpenDeskAcc" , 0xA9B6}, - {"CloseDeskAcc" , 0xA9B7}, - {"GetPattern" , 0xA9B8}, - {"GetCursor" , 0xA9B9}, - {"GetString" , 0xA9BA}, - {"GetIcon" , 0xA9BB}, - {"GetPicture" , 0xA9BC}, - {"GetNewWindow" , 0xA9BD}, - {"GetNewControl" , 0xA9BE}, - {"GetRMenu" , 0xA9BF}, - {"GetNewMBar" , 0xA9C0}, - {"UniqueID" , 0xA9C1}, - {"SysEdit" , 0xA9C2}, - {"KeyTranslate" , 0xA9C3}, - {"OpenRFPerm" , 0xA9C4}, - {"RsrcMapEntry" , 0xA9C5}, - {"SecondsToDate" , 0xA9C6}, - {"DateToSeconds" , 0xA9C7}, - {"SysBeep" , 0xA9C8}, - {"SysError" , 0xA9C9}, - {"PutIcon" , 0xA9CA}, - {"TEGetText" , 0xA9CB}, - {"TEInit" , 0xA9CC}, - {"TEDispose" , 0xA9CD}, - {"TETextBox" , 0xA9CE}, - {"TESetText" , 0xA9CF}, - {"TECalText" , 0xA9D0}, - {"TESetSelect" , 0xA9D1}, - {"TENew" , 0xA9D2}, - {"TEUpdate" , 0xA9D3}, - {"TEClick" , 0xA9D4}, - {"TECopy" , 0xA9D5}, - {"TECut" , 0xA9D6}, - {"TEDelete" , 0xA9D7}, - {"TEActivate" , 0xA9D8}, - {"TEDeactivate" , 0xA9D9}, - {"TEIdle" , 0xA9DA}, - {"TEPaste" , 0xA9DB}, - {"TEKey" , 0xA9DC}, - {"TEScroll" , 0xA9DD}, - {"TEInsert" , 0xA9DE}, - {"TESetAlignment" , 0xA9DF}, - {"Munger" , 0xA9E0}, - {"HandToHand" , 0xA9E1}, - {"PtrToXHand" , 0xA9E2}, - {"PtrToHand" , 0xA9E3}, - {"HandAndHand" , 0xA9E4}, - {"InitPack" , 0xA9E5}, - {"InitAllPacks" , 0xA9E6}, - {"Pack0" , 0xA9E7}, - {"Pack1" , 0xA9E8}, - {"Pack2" , 0xA9E9}, - {"Pack3" , 0xA9EA}, - {"FP68K" , 0xA9EB}, - {"Elems68K" , 0xA9EC}, - {"Pack6" , 0xA9ED}, - {"DECSTR68K" , 0xA9EE}, - {"PtrAndHand" , 0xA9EF}, - {"LoadSeg" , 0xA9F0}, - {"UnLoadSeg" , 0xA9F1}, - {"Launch" , 0xA9F2}, - {"Chain" , 0xA9F3}, - {"ExitToShell" , 0xA9F4}, - {"GetAppParms" , 0xA9F5}, - {"GetResFileAttrs" , 0xA9F6}, - {"SetResFileAttrs" , 0xA9F7}, - {"MethodDispatch" , 0xA9F8}, - {"InfoScrap" , 0xA9F9}, - {"UnloadScrap" , 0xA9FA}, - {"LoadScrap" , 0xA9FB}, - {"ZeroScrap" , 0xA9FC}, - {"GetScrap" , 0xA9FD}, - {"PutScrap" , 0xA9FE}, - {"Debugger" , 0xA9FF}, - {"OpenCPort" , 0xAA00}, - {"InitCPort" , 0xAA01}, - {"CloseCPort" , 0xAA02}, - {"NewPixMap" , 0xAA03}, - {"DisposePixMap" , 0xAA04}, - {"CopyPixMap" , 0xAA05}, - {"SetPortPix" , 0xAA06}, - {"NewPixPat" , 0xAA07}, - {"DisposePixPat" , 0xAA08}, - {"CopyPixPat" , 0xAA09}, - {"PenPixPat" , 0xAA0A}, - {"BackPixPat" , 0xAA0B}, - {"GetPixPat" , 0xAA0C}, - {"MakeRGBPat" , 0xAA0D}, - {"FillCRect" , 0xAA0E}, - {"FillCOval" , 0xAA0F}, - {"FillCRoundRect" , 0xAA10}, - {"FillCArc" , 0xAA11}, - {"FillCRgn" , 0xAA12}, - {"FillCPoly" , 0xAA13}, - {"RGBForeColor" , 0xAA14}, - {"RGBBackColor" , 0xAA15}, - {"SetCPixel" , 0xAA16}, - {"GetCPixel" , 0xAA17}, - {"GetCTable" , 0xAA18}, - {"GetForeColor" , 0xAA19}, - {"GetBackColor" , 0xAA1A}, - {"GetCCursor" , 0xAA1B}, - {"SetCCursor" , 0xAA1C}, - {"AllocCursor" , 0xAA1D}, - {"GetCIcon" , 0xAA1E}, - {"PlotCIcon" , 0xAA1F}, - {"OpenCPicture" , 0xAA20}, - {"OpColor" , 0xAA21}, - {"HiliteColor" , 0xAA22}, - {"CharExtra" , 0xAA23}, - {"DisposeCTable" , 0xAA24}, - {"DisposeCIcon" , 0xAA25}, - {"DisposeCCursor" , 0xAA26}, - {"GetMaxDevice" , 0xAA27}, - {"GetCTSeed" , 0xAA28}, - {"GetDeviceList" , 0xAA29}, - {"GetMainDevice" , 0xAA2A}, - {"GetNextDevice" , 0xAA2B}, - {"TestDeviceAttribute" , 0xAA2C}, - {"SetDeviceAttribute" , 0xAA2D}, - {"InitGDevice" , 0xAA2E}, - {"NewGDevice" , 0xAA2F}, - {"DisposeGDevice" , 0xAA30}, - {"SetGDevice" , 0xAA31}, - {"GetGDevice" , 0xAA32}, - {"Color2Index" , 0xAA33}, - {"Index2Color" , 0xAA34}, - {"InvertColor" , 0xAA35}, - {"RealColor" , 0xAA36}, - {"GetSubTable" , 0xAA37}, - {"UpdatePixMap" , 0xAA38}, - {"MakeITable" , 0xAA39}, - {"AddSearch" , 0xAA3A}, - {"AddComp" , 0xAA3B}, - {"SetClientID" , 0xAA3C}, - {"ProtectEntry" , 0xAA3D}, - {"ReserveEntry" , 0xAA3E}, - {"SetEntries" , 0xAA3F}, - {"QDError" , 0xAA40}, - {"SetWinColor" , 0xAA41}, - {"GetAuxWin" , 0xAA42}, - {"SetControlColor" , 0xAA43}, - {"GetAuxiliaryControlRecord", 0xAA44}, - {"NewCWindow" , 0xAA45}, - {"GetNewCWindow" , 0xAA46}, - {"SetDeskCPat" , 0xAA47}, - {"GetCWMgrPort" , 0xAA48}, - {"SaveEntries" , 0xAA49}, - {"RestoreEntries" , 0xAA4A}, - {"NewColorDialog" , 0xAA4B}, - {"DelSearch" , 0xAA4C}, - {"DelComp" , 0xAA4D}, - {"SetStdCProcs" , 0xAA4E}, - {"CalcCMask" , 0xAA4F}, - {"SeedCFill" , 0xAA50}, - {"CopyDeepMask" , 0xAA51}, - {"HighLevelFSDispatch" , 0xAA52}, - {"DictionaryDispatch" , 0xAA53}, - {"TextServicesDispatch" , 0xAA54}, - {"KobeMgr" , 0xAA55}, - {"SpeechRecognitionDispatch", 0xAA56}, - {"DockingDispatch" , 0xAA57}, - {"NewKernelDispatch" , 0xAA58}, - {"MixedModeDispatch" , 0xAA59}, - {"CodeFragmentDispatch" , 0xAA5A}, - {"PBRemoteAccess" , 0xAA5B}, - {"OCEUtils" , 0xAA5C}, - {"DigitalSignature" , 0xAA5D}, - {"OCETBDispatch" , 0xAA5E}, - {"OCEAuthentication" , 0xAA5F}, - {"DeleteMCEntries" , 0xAA60}, - {"GetMCInfo" , 0xAA61}, - {"SetMCInfo" , 0xAA62}, - {"DisposeMCInfo" , 0xAA63}, - {"GetMCEntry" , 0xAA64}, - {"SetMCEntries" , 0xAA65}, - {"MenuChoice" , 0xAA66}, - {"ModalDialogMenuSetup" , 0xAA67}, - {"DialogDispatch" , 0xAA68}, - {"UserNameNotification" , 0xAA69}, - {"DeviceMgr" , 0xAA6A}, - {"PowerPCFuture" , 0xAA6B}, - {"PenMacMgr" , 0xAA6C}, - {"LanguageMgr" , 0xAA6D}, - {"AppleGuideDispatch" , 0xAA6E}, - {"InitPalettes" , 0xAA90}, - {"NewPalette" , 0xAA91}, - {"GetNewPalette" , 0xAA92}, - {"DisposePalette" , 0xAA93}, - {"ActivatePalette" , 0xAA94}, - {"SetPalette" , 0xAA95}, - {"GetPalette" , 0xAA96}, - {"PmForeColor" , 0xAA97}, - {"PmBackColor" , 0xAA98}, - {"AnimateEntry" , 0xAA99}, - {"AnimatePalette" , 0xAA9A}, - {"GetEntryColor" , 0xAA9B}, - {"SetEntryColor" , 0xAA9C}, - {"GetEntryUsage" , 0xAA9D}, - {"SetEntryUsage" , 0xAA9E}, - {"CTab2Palette" , 0xAA9F}, - {"Palette2CTab" , 0xAAA0}, - {"CopyPalette" , 0xAAA1}, - {"PaletteDispatch" , 0xAAA2}, - {"CodecDispatch" , 0xAAA3}, - {"ALMDispatch" , 0xAAA4}, - {"QuickTimeDispatch" , 0xAAAA}, - {"CursorDeviceDispatch" , 0xAADB}, - {"HumanInterfaceUtilsDispatch", 0xAADD}, - {"AppleScript" , 0xAAEE}, - {"PCCardDispatch" , 0xAAF0}, - {"ATAMgr" , 0xAAF1}, - {"ControlStripDispatch" , 0xAAF2}, - {"ExpansionBusDispatch" , 0xAAF3}, - {"InterruptMgr" , 0xAAF4}, - {"InitApplication" , 0xAAFA}, - {"CleanupApplication" , 0xAAFB}, - {"MixedModeMagic" , 0xAAFE}, - {"BitBlt" , 0xAB00}, - {"BitsToMap" , 0xAB01}, - {"BitsToPix" , 0xAB02}, - {"Jackson" , 0xAB03}, - {"ColorMap" , 0xAB04}, - {"CopyHandle" , 0xAB05}, - {"CullPoints" , 0xAB06}, - {"PutPicByte" , 0xAB07}, - {"PutPicOp" , 0xAB08}, - {"DrawArc" , 0xAB09}, - {"DrawLine" , 0xAB0A}, - {"DrawSlab" , 0xAB0B}, - {"FastSlabMode" , 0xAB0C}, - {"GetSeek" , 0xAB0D}, - {"MakeScaleTbl" , 0xAB0E}, - {"CheckPic" , 0xAB0F}, - {"DoLine" , 0xAB10}, - {"OldPatToNew" , 0xAB11}, - {"PackRgn" , 0xAB12}, - {"PatConvert" , 0xAB13}, - {"PatDither" , 0xAB14}, - {"PatExpand" , 0xAB15}, - {"PInit" , 0xAB16}, - {"PortToMap" , 0xAB17}, - {"PushVerb" , 0xAB18}, - {"PutLine" , 0xAB19}, - {"PutOval" , 0xAB1A}, - {"PutRgn" , 0xAB1B}, - {"NewTempBuffer" , 0xAB1C}, - {"QDExtensions" , 0xAB1D}, - {"DisposeTempBuffer" , 0xAB1E}, - {"RgnBlit" , 0xAB1F}, - {"RgnOp" , 0xAB20}, - {"RSect" , 0xAB21}, - {"SeekRgn" , 0xAB22}, - {"SetFillPat" , 0xAB23}, - {"SetUpStretch" , 0xAB24}, - {"SlabMode" , 0xAB25}, - {"SortPoints" , 0xAB26}, - {"StretchBits" , 0xAB27}, - {"StdDevLoop" , 0xAB28}, - {"TrimRect" , 0xAB29}, - {"XorSlab" , 0xAB2A}, - {"ExTblPtr" , 0xAB2B}, - {"NewTempHandle" , 0xAB2D}, - {"PatExTbl" , 0xAB2E}, - {"bMAIN0" , 0xAB30}, - {"bMAIN1" , 0xAB31}, - {"bMAIN2" , 0xAB32}, - {"bMAIN3" , 0xAB33}, - {"bSETUP8" , 0xAB34}, - {"bMAIN9" , 0xAB35}, - {"bSETUP10" , 0xAB36}, - {"bMAIN11" , 0xAB37}, - {"bXMAIN8" , 0xAB38}, - {"bXMAIN9" , 0xAB39}, - {"bXMAIN10" , 0xAB3A}, - {"bXMAIN11" , 0xAB3B}, - {"bcMain0" , 0xAB3C}, - {"bcMain1" , 0xAB3D}, - {"bHilite" , 0xAB3E}, - {"bcMain3" , 0xAB3F}, - {"bEND0" , 0xAB40}, - {"bEND1" , 0xAB41}, - {"bEND2" , 0xAB42}, - {"bEND3" , 0xAB43}, - {"bLONG8" , 0xAB44}, - {"bEND9" , 0xAB45}, - {"bEND10" , 0xAB46}, - {"bEND11" , 0xAB47}, - {"bXLONG8" , 0xAB48}, - {"bXEND9" , 0xAB49}, - {"bXEND10" , 0xAB4A}, - {"bXEND11" , 0xAB4B}, - {"bcEnd0" , 0xAB4C}, - {"bcEnd1" , 0xAB4D}, - {"bSlowHilite" , 0xAB4E}, - {"bcEnd" , 0xAB4F}, - {"bAvg" , 0xAB50}, - {"bAddPin" , 0xAB51}, - {"bAddOver" , 0xAB52}, - {"bSubPin" , 0xAB53}, - {"bTransparent" , 0xAB54}, - {"bMax" , 0xAB55}, - {"bSubOver" , 0xAB56}, - {"bMin" , 0xAB57}, - {"bSetup0" , 0xAB58}, - {"bLeft0" , 0xAB59}, - {"rMASK0" , 0xAB5A}, - {"rMASK1" , 0xAB5B}, - {"rMASK2" , 0xAB5C}, - {"rMASK3" , 0xAB5D}, - {"rMASK8" , 0xAB5E}, - {"rMASK9" , 0xAB5F}, - {"rMASK10" , 0xAB60}, - {"rMASK11" , 0xAB61}, - {"rXMASK8" , 0xAB62}, - {"rXMASK9" , 0xAB63}, - {"rXMASK10" , 0xAB64}, - {"rXMASK11" , 0xAB65}, - {"rAvg" , 0xAB66}, - {"rAddPin" , 0xAB67}, - {"rAddOver" , 0xAB68}, - {"rSubPin" , 0xAB69}, - {"rTransparent" , 0xAB6A}, - {"rMax" , 0xAB6B}, - {"rSubOver" , 0xAB6C}, - {"rMin" , 0xAB6D}, - {"rcMask0" , 0xAB6E}, - {"rcMask1" , 0xAB6F}, - {"rSlowHilite" , 0xAB70}, - {"rcMask3" , 0xAB71}, - {"rHilite" , 0xAB72}, - {"stMASK0" , 0xAB73}, - {"stMASK1" , 0xAB74}, - {"stMASK2" , 0xAB75}, - {"stMASK3" , 0xAB76}, - {"stAvg" , 0xAB77}, - {"stAddPin" , 0xAB78}, - {"stAddOver" , 0xAB79}, - {"stSubPin" , 0xAB7A}, - {"stTransparent" , 0xAB7B}, - {"stMax" , 0xAB7C}, - {"stSubOver" , 0xAB7D}, - {"stMin" , 0xAB7E}, - {"stHilite" , 0xAB7F}, - {"slMASK8" , 0xAB80}, - {"slMASK9" , 0xAB81}, - {"slMASK10" , 0xAB82}, - {"slMASK11" , 0xAB83}, - {"slXMASK8" , 0xAB84}, - {"slXMASK9" , 0xAB85}, - {"slXMASK10" , 0xAB86}, - {"slXMASK11" , 0xAB87}, - {"slAvg" , 0xAB88}, - {"slAddPin" , 0xAB89}, - {"slAddOver" , 0xAB8A}, - {"slSubPin" , 0xAB8B}, - {"slTransparent" , 0xAB8C}, - {"slMax" , 0xAB8D}, - {"slSubOver" , 0xAB8E}, - {"slMin" , 0xAB8F}, - {"slHilite" , 0xAB90}, - {"ITabMatch" , 0xAB91}, - {"ColorThing" , 0xAB92}, - {"Pollack" , 0xAB93}, - {"AllocRunBuf" , 0xAB94}, - {"InitRgn" , 0xAB95}, - {"ScaleBlt" , 0xAB96}, - {"stNoStack" , 0xAB97}, - {"BlitCase" , 0xAB98}, - {"stScanLoop" , 0xAB99}, - {"PicItem1" , 0xAB9A}, - {"MakeGrayITab" , 0xAB9B}, - {"FastLine" , 0xAB9C}, - {"FastSlant" , 0xAB9D}, - {"BitsDevLoop" , 0xAB9E}, - {"rArith16Tab" , 0xABA0}, - {"rArith32Tab" , 0xABA1}, - {"rHiliteTab" , 0xABA2}, - {"gsRunTbl" , 0xABA3}, - {"gsExpTbl" , 0xABA4}, - {"gsSeekTbl" , 0xABA5}, - {"stArith16Tab" , 0xABA6}, - {"stArith32Tab" , 0xABA7}, - {"stColorTab" , 0xABA8}, - {"stGrayTab" , 0xABA9}, - {"stSearchTab" , 0xABAA}, - {"ScaleIndToInd" , 0xABAB}, - {"scIndTab1" , 0xABAC}, - {"scIndTab2" , 0xABAD}, - {"scIndTab4" , 0xABAE}, - {"scIndTab8" , 0xABAF}, - {"scIndTab16" , 0xABB0}, - {"scIndTab32" , 0xABB1}, - {"scDirTab1" , 0xABB2}, - {"scDirTab2" , 0xABB3}, - {"scDirTab4" , 0xABB4}, - {"scDirTab8" , 0xABB5}, - {"scDirTab16" , 0xABB6}, - {"scDirTab32" , 0xABB7}, - {"bArith16Tab" , 0xABB8}, - {"bArith32Tab" , 0xABB9}, - {"bHiliteTab" , 0xABBA}, - {"bArith16Setup" , 0xABBB}, - {"bArith32Setup" , 0xABBC}, - {"slArith16Tab" , 0xABBD}, - {"slArith32Tab" , 0xABBE}, - {"32QD" , 0xABBF}, - {"QDAlphaDispatch" , 0xABC0}, - {"QDStreamToMask" , 0xABC1}, - {"QTMatrixMathDispatch" , 0xABC2}, - {"NQDMisc" , 0xABC3}, - {"GetPMData" , 0xABC4}, - {"32QD" , 0xABC5}, - {"32QD" , 0xABC6}, - {"32QD" , 0xABC7}, - {"StdOpcodeProc" , 0xABC8}, - {"IconDispatch" , 0xABC9}, - {"DeviceLoop" , 0xABCA}, - {"PBBlockMove" , 0xABCC}, - {"SnappingTurk" , 0xABCD}, - {"UnicodeMgr" , 0xABCE}, - {"ProcessMgr" , 0xABCF}, - {"ModemMgr" , 0xABEA}, - {"DisplayDispatch" , 0xABEB}, - {"ButtonMgr" , 0xABEC}, - {"DragDispatch" , 0xABED}, - {"ColorSync" , 0xABEE}, - {"TTSMgr" , 0xABEF}, - {"AROSE" , 0xABF0}, - {"GestaltValueDispatch" , 0xABF1}, - {"ThreadDispatch" , 0xABF2}, - {"EddyTrap" , 0xABF3}, - {"XTNDMgr" , 0xABF4}, - {"DSPManager" , 0xABF5}, - {"CollectionMgr" , 0xABF6}, - {"SynchIdleTime" , 0xABF7}, - {"StdOpcodeProc" , 0xABF8}, - {"AUXDispatch" , 0xABF9}, - {"AUXSysCall" , 0xABFA}, - {"MessageMgr" , 0xABFB}, - {"TranslationDispatch" , 0xABFC}, - {"TouchStone" , 0xABFD}, - {"GXPrinting" , 0xABFE}, - {"DebugStr" , 0xABFF}, - {"" , 0} -}; - -#endif diff --git a/cxmon/src/mon_cmd.cpp b/cxmon/src/mon_cmd.cpp deleted file mode 100644 index 4cb6a92b..00000000 --- a/cxmon/src/mon_cmd.cpp +++ /dev/null @@ -1,669 +0,0 @@ -/* - * mon_cmd.cpp - cxmon standard commands - * - * cxmon (C) 1997-2004 Christian Bauer, Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" - -#include -#include - -#include "mon.h" -#include "mon_cmd.h" -#include "mon_disass.h" - -#ifndef VERSION -#define VERSION "3" -#endif - - -/* - * range_args = [expression] [[COMMA] expression] END - * - * Read start address to "adr", end address to "end_adr". - * "adr" defaults to '.', "end_adr" defaults to '.'+def_range - * - * true: OK, false: Error - */ - -static bool range_args(uintptr *adr, uintptr *end_adr, uint32 def_range) -{ - *adr = mon_dot_address; - *end_adr = mon_dot_address + def_range; - - if (mon_token == T_END) - return true; - else { - if (!mon_expression(adr)) - return false; - *end_adr = *adr + def_range; - if (mon_token == T_END) - return true; - else { - if (mon_token == T_COMMA) mon_get_token(); - if (!mon_expression(end_adr)) - return false; - return mon_token == T_END; - } - } -} - - -/* - * byte_string = (expression | STRING) {COMMA (expression | STRING)} END - */ - -static bool byte_string(uint8 *&str, uintptr &len) -{ - uintptr value; - - static const int GRANULARITY = 16; // must be a power of 2 - str = NULL; - len = 0; - goto start; - - for (;;) { - if (mon_token == T_COMMA) { - mon_get_token(); - -start: - if (mon_token == T_STRING) { - unsigned n = strlen(mon_string); - str = (uint8 *)realloc(str, (len + n - 1 + GRANULARITY) & ~(GRANULARITY - 1)); - assert(str != NULL); - memcpy(str + len, mon_string, n); - len += n; - mon_get_token(); - } else if (mon_expression(&value)) { - str = (uint8 *)realloc(str, (len + GRANULARITY) & ~(GRANULARITY - 1)); - assert(str != NULL); - str[len] = value; - len++; - } else { - if (str) - free(str); - return false; - } - - } else if (mon_token == T_END) { - return true; - } else { - mon_error("',' expected"); - if (str) - free(str); - return false; - } - } -} - - -/* - * Convert character to printable character - */ - -static inline uint8 char2print(uint8 c) -{ - return (c >= 0x20 && c <= 0x7e) ? c : '.'; -} - - -/* - * Show version - * ver - */ - -void version(void) -{ - fprintf(monout, "cxmon V" VERSION "\n"); -} - - -/* - * Redirect output - * o [file] - */ - -void redir_output(void) -{ - // Close old file - if (monout != monerr) { - fclose(monout); - monout = monerr; - return; - } - - // No argument given? - if (mon_token == T_END) - return; - - // Otherwise open file - if (mon_token == T_STRING) { - mon_get_token(); - if (mon_token != T_END) { - mon_error("Too many arguments"); - return; - } - if (!(monout = fopen(mon_string, "w"))) - mon_error("Unable to open file"); - } else - mon_error("'\"' around file name expected"); -} - - -/* - * Compute and display expression - * ? expression - */ - -void print_expr(void) -{ - uintptr val; - - if (!mon_expression(&val)) - return; - if (mon_token != T_END) { - mon_error("Too many arguments"); - return; - } - - if (val > 0x7fffffff) { - fprintf(monout, "Hex unsigned: $%08x\n" - "Hex signed : -$%08x\n" - "Dec unsigned: %u\n" - "Dec signed : %d\n", val, -val, val, val); - fprintf(monout, "Char : '%c%c%c%c'\n", char2print(val >> 24), char2print(val >> 16), char2print(val >> 8), char2print(val)); - } else { - fprintf(monout, "Hex : $%08x\n" - "Dec : %d\n", val, val); - fprintf(monout, "Char: '%c%c%c%c'\n", char2print(val >> 24), char2print(val >> 16), char2print(val >> 8), char2print(val)); - } -} - - -/* - * Execute shell command - * \ "command" - */ - -void shell_command(void) -{ - if (mon_token != T_STRING) { - mon_error("'\"' around command expected"); - return; - } - mon_get_token(); - if (mon_token != T_END) { - mon_error("Too many arguments"); - return; - } - system(mon_string); -} - - -/* - * Memory dump - * m [start [end]] - */ - -#define MEMDUMP_BPL 16 // Bytes per line - -void memory_dump(void) -{ - uintptr adr, end_adr; - uint8 mem[MEMDUMP_BPL + 1]; - - mem[MEMDUMP_BPL] = 0; - - if (!range_args(&adr, &end_adr, 16 * MEMDUMP_BPL - 1)) // 16 lines unless end address specified - return; - - while (adr <= end_adr && !mon_aborted()) { - fprintf(monout, "%0*lx:", int(2 * sizeof(adr)), mon_use_real_mem ? adr: adr % mon_mem_size); - for (int i=0; i>=1, i++) - str[i] = (b & m) ? '*' : '.'; - fprintf(monout, " '%s'\n", str); - adr++; - } - - mon_dot_address = adr; -} - - -/* - * Disassemble - * d [start [end]] - * d65 [start [end]] - * d68 [start [end]] - * d80 [start [end]] - * d86 [start [end]] - * d8086 [start [end]] - */ - -enum CPUType { - CPU_PPC, - CPU_6502, - CPU_680x0, - CPU_Z80, - CPU_80x86_32, - CPU_80x86_16, - CPU_x86_64 -}; - -static void disassemble(CPUType type) -{ - uintptr adr, end_adr; - - if (!range_args(&adr, &end_adr, 16 * 4 - 1)) // 16 lines unless end address specified - return; - - switch (type) { - case CPU_PPC: - while (adr <= end_adr && !mon_aborted()) { - uint32 w = mon_read_word(adr); - fprintf(monout, "%0*lx: %08x\t", int(2 * sizeof(adr)), mon_use_real_mem ? adr : adr % mon_mem_size, w); - disass_ppc(monout, mon_use_real_mem ? adr : adr % mon_mem_size, w); - adr += 4; - } - break; - - case CPU_6502: - while (adr <= end_adr && !mon_aborted()) { - uint8 op = mon_read_byte(adr); - uint8 lo = mon_read_byte(adr + 1); - uint8 hi = mon_read_byte(adr + 2); - fprintf(monout, "%0*lx: ", int(2 * sizeof(adr)), mon_use_real_mem ? adr : adr % mon_mem_size); - adr += disass_6502(monout, mon_use_real_mem ? adr : adr % mon_mem_size, op, lo, hi); - } - break; - - case CPU_680x0: - while (adr <= end_adr && !mon_aborted()) { - fprintf(monout, "%0*lx: ", int(2 * sizeof(adr)), mon_use_real_mem ? adr : adr % mon_mem_size); - adr += disass_68k(monout, mon_use_real_mem ? adr : adr % mon_mem_size); - } - break; - - case CPU_Z80: - while (adr <= end_adr && !mon_aborted()) { - fprintf(monout, "%0*lx: ", int(2 * sizeof(adr)), mon_use_real_mem ? adr : adr % mon_mem_size); - adr += disass_z80(monout, mon_use_real_mem ? adr : adr % mon_mem_size); - } - break; - - case CPU_x86_64: - while (adr <= end_adr && !mon_aborted()) { - fprintf(monout, "%0*lx: ", int(2 * sizeof(adr)), mon_use_real_mem ? adr : adr % mon_mem_size); - adr += disass_x86(monout, mon_use_real_mem ? adr : adr % mon_mem_size, 64); - } - break; - - case CPU_80x86_32: - while (adr <= end_adr && !mon_aborted()) { - fprintf(monout, "%0*lx: ", int(2 * sizeof(adr)), mon_use_real_mem ? adr : adr % mon_mem_size); - adr += disass_x86(monout, mon_use_real_mem ? adr : adr % mon_mem_size, 32); - } - break; - - case CPU_80x86_16: - while (adr <= end_adr && !mon_aborted()) { - fprintf(monout, "%0*lx: ", int(2 * sizeof(adr)), mon_use_real_mem ? adr : adr % mon_mem_size); - adr += disass_x86(monout, mon_use_real_mem ? adr : adr % mon_mem_size, 16); - } - } - - mon_dot_address = adr; -} - -void disassemble_ppc(void) -{ - disassemble(CPU_PPC); -} - -void disassemble_6502(void) -{ - disassemble(CPU_6502); -} - -void disassemble_680x0(void) -{ - disassemble(CPU_680x0); -} - -void disassemble_z80(void) -{ - disassemble(CPU_Z80); -} - -void disassemble_80x86_32(void) -{ - disassemble(CPU_80x86_32); -} - -void disassemble_80x86_16(void) -{ - disassemble(CPU_80x86_16); -} - -void disassemble_x86_64(void) -{ - disassemble(CPU_x86_64); -} - - -/* - * Modify memory - * : addr bytestring - */ - -void modify(void) -{ - uintptr adr, len, src_adr = 0; - uint8 *str; - - if (!mon_expression(&adr)) - return; - if (!byte_string(str, len)) - return; - - while (src_adr < len) - mon_write_byte(adr++, str[src_adr++]); - mon_dot_address = adr; - - free(str); -} - - -/* - * Fill - * f start end bytestring - */ - -void fill(void) -{ - uintptr adr, end_adr, len, src_adr = 0; - uint8 *str; - - if (!mon_expression(&adr)) - return; - if (!mon_expression(&end_adr)) - return; - if (!byte_string(str, len)) - return; - - while (adr <= end_adr) - mon_write_byte(adr++, str[src_adr++ % len]); - - free(str); -} - - -/* - * Transfer memory - * t start end dest - */ - -void transfer(void) -{ - uintptr adr, end_adr, dest; - int num; - - if (!mon_expression(&adr)) - return; - if (!mon_expression(&end_adr)) - return; - if (!mon_expression(&dest)) - return; - if (mon_token != T_END) { - mon_error("Too many arguments"); - return; - } - - num = end_adr - adr + 1; - - if (dest < adr) - for (int i=0; i - -#include "mon.h" -#include "mon_disass.h" - -#include "mon_atraps.h" -#include "mon_lowmem.h" - - -// Flag: enable MacOS A-Trap and LM globals lookup in 68k disassembler -bool mon_macos_mode = false; - - -/* - * GNU disassembler callbacks - */ - -extern "C" { -#include "disass/dis-asm.h" - -int buffer_read_memory(bfd_vma from, bfd_byte *to, unsigned int length, struct disassemble_info *info) -{ - while (length--) - *to++ = mon_read_byte(from++); - return 0; -} - -void perror_memory(int status, bfd_vma memaddr, struct disassemble_info *info) -{ - info->fprintf_func(info->stream, "Unknown error %d\n", status); -} - -bool lookup_lowmem; - -void generic_print_address(bfd_vma addr, struct disassemble_info *info) -{ - if (lookup_lowmem && addr >= 0x100 && addr < 0x3000) { - if (((addr >= 0x400 && addr < 0x800) || (addr >= 0xe00 && addr < 0x1e00)) && ((addr & 3) == 0)) { - // Look for address in A-Trap table - uint16 opcode = (addr < 0xe00 ? 0xa000 + (addr - 0x400) / 4 : 0xa800 + (addr - 0xe00) / 4); - uint16 mask = (addr < 0xe00 ? 0xf8ff : 0xffff); - const atrap_info *p = atraps; - while (p->word) { - if ((p->word & mask) == opcode) { - info->fprintf_func(info->stream, p->name); - return; - } - p++; - } - } else { - // Look for address in low memory globals table - const lowmem_info *p = lowmem; - while (p->name) { - if (addr >= p[0].addr && addr < p[1].addr) { - if (addr == p[0].addr) - info->fprintf_func(info->stream, "%s", p->name); - else - info->fprintf_func(info->stream, "%s+%d", p->name, addr - p->addr); - return; - } - p++; - } - } - } - if (addr >= UVAL64(0x100000000)) - info->fprintf_func(info->stream, "$%08x%08x", (uint32)(addr >> 32), (uint32)addr); - else - info->fprintf_func(info->stream, "$%08x", (uint32)addr); -} - -int generic_symbol_at_address(bfd_vma addr, struct disassemble_info *info) -{ - return 0; -} - -void print_68k_invalid_opcode(unsigned long opcode, struct disassemble_info *info) -{ - if (mon_macos_mode) { - // Look for MacOS A-Trap - const atrap_info *p = atraps; - while (p->word) { - if (p->word == opcode) { - info->fprintf_func(info->stream, p->name); - return; - } - p++; - } - } - info->fprintf_func(info->stream, "?"); -} - -}; - - -/* - * sprintf into a "stream" - */ - -struct SFILE { - char *buffer; - char *current; -}; - -static int mon_sprintf(SFILE *f, const char *format, ...) -{ - int n; - va_list args; - va_start(args, format); - vsprintf(f->current, format, args); - f->current += n = strlen(f->current); - va_end(args); - return n; -} - - -/* - * Disassemble one instruction, return number of bytes - */ - -int disass_68k(FILE *f, uint32 adr) -{ - // Initialize info for GDB disassembler - disassemble_info info; - char buf[1024]; - SFILE sfile = {buf, buf}; - sfile.buffer = buf; - sfile.current = buf; - INIT_DISASSEMBLE_INFO(info, (FILE *)&sfile, (fprintf_ftype)mon_sprintf); - - // Disassemble instruction - lookup_lowmem = mon_macos_mode; - int num = print_insn_m68k(adr, &info); - - for (int i=0; i<6; i+=2) { - if (num > i) - fprintf(f, "%04x ", mon_read_half(adr + i)); - else - fprintf(f, " "); - } - if (num == 8) - fprintf(f, "%04x\t%s\n", mon_read_half(adr + 6), buf); - else if (num > 8) - fprintf(f, "...\t%s\n", buf); - else - fprintf(f, " \t%s\n", buf); - - return num; -} - -int disass_x86(FILE *f, uint32 adr, uint32 bits) -{ - // Initialize info for GDB disassembler - disassemble_info info; - char buf[1024]; - SFILE sfile = {buf, buf}; - sfile.buffer = buf; - sfile.current = buf; - INIT_DISASSEMBLE_INFO(info, (FILE *)&sfile, (fprintf_ftype)mon_sprintf); - if (bits == 16) - info.mach = bfd_mach_i386_i8086; - else if (bits == 64) - info.mach = bfd_mach_x86_64; - - // Disassemble instruction - lookup_lowmem = false; - int num = print_insn_i386_att(adr, &info); - - for (int i=0; i<6; i++) { - if (num > i) - fprintf(f, "%02x ", mon_read_byte(adr + i)); - else - fprintf(f, " "); - } - if (num == 7) - fprintf(f, "%02x\t%s\n", mon_read_byte(adr + 7), buf); - else if (num > 7) - fprintf(f, "..\t%s\n", buf); - else - fprintf(f, " \t%s\n", buf); - - return num; -} diff --git a/cxmon/src/mon_disass.h b/cxmon/src/mon_disass.h deleted file mode 100644 index 487a2965..00000000 --- a/cxmon/src/mon_disass.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * mon_disass.h - Disassemblers - * - * cxmon (C) 1997-2004 Christian Bauer, Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef MON_DISASS_H -#define MON_DISASS_H - -extern void disass_ppc(FILE *f, unsigned int adr, unsigned int w); -extern int disass_68k(FILE *f, uint32 adr); -extern int disass_x86(FILE *f, uint32 adr, uint32 bits = 32); -extern int disass_6502(FILE *f, uint32 adr, uint8 op, uint8 lo, uint8 hi); -extern int disass_z80(FILE *f, uint32 adr); - -#endif diff --git a/cxmon/src/mon_lowmem.cpp b/cxmon/src/mon_lowmem.cpp deleted file mode 100644 index e902352b..00000000 --- a/cxmon/src/mon_lowmem.cpp +++ /dev/null @@ -1,579 +0,0 @@ -/* - * mon_lowmem.cpp - MacOS low memory globals definitions - * - * cxmon (C) 1997-2004 Christian Bauer, Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" - -#include "mon_lowmem.h" - -// Array of low memory globals in ascending order -const lowmem_info lowmem[] = { - {"MonkeyLives" , 0x100}, - {"ScrVRes" , 0x102}, - {"ScrHRes" , 0x104}, - {"ScreenRow" , 0x106}, - {"MemTop" , 0x108}, - {"BufPtr" , 0x10C}, - {"StkLowPt" , 0x110}, - {"HeapEnd" , 0x114}, - {"TheZone" , 0x118}, - {"UTableBase" , 0x11C}, - {"MacJump" , 0x120}, - {"DskRtnAdr" , 0x124}, - {"PollRtnAdr" , 0x128}, - {"DskVerify" , 0x12C}, - {"LoadTrap" , 0x12D}, - {"MmInOK" , 0x12E}, - {"CPUFlag" , 0x12F}, - {"ApplLimit" , 0x130}, - {"SonyVars" , 0x134}, - {"PWMValue" , 0x138}, - {"PollStack" , 0x13A}, - {"PollProc" , 0x13E}, - {"DskErr" , 0x142}, - {"SysEvtMask" , 0x144}, - {"SysEvtBuf" , 0x146}, - {"EventQueue" , 0x14A}, - {"EvtBufCnt" , 0x154}, - {"RndSeed" , 0x156}, - {"SysVersion" , 0x15A}, - {"SEvtEnb" , 0x15C}, - {"DSWndUpdate" , 0x15D}, - {"FontFlag" , 0x15E}, - {"IntFlag" , 0x15F}, - {"VBLQueue" , 0x160}, - {"Ticks" , 0x16A}, - {"MBTicks" , 0x16E}, - {"MBState" , 0x172}, - {"Tocks" , 0x173}, - {"KeyMap" , 0x174}, - {"KeypadMap" , 0x17C}, - {"KeyLast" , 0x184}, - {"KeyTime" , 0x186}, - {"KeyRepTime" , 0x18A}, - {"KeyThresh" , 0x18E}, - {"KeyRepThresh" , 0x190}, - {"Lvl1DT" , 0x192}, - {"Lvl2DT" , 0x1B2}, - {"UnitNtryCnt" , 0x1D2}, - {"VIA" , 0x1D4}, - {"SCCRd" , 0x1D8}, - {"SCCWr" , 0x1DC}, - {"IWM" , 0x1E0}, - {"GetParam" , 0x1E4}, - {"SysParam" , 0x1F8}, - {"SPValid" , 0x1F8}, - {"SPATalkA" , 0x1F9}, - {"SPATalkB" , 0x1FA}, - {"SPConfig" , 0x1FB}, - {"SPPortA" , 0x1FC}, - {"SPPortB" , 0x1FE}, - {"SPAlarm" , 0x200}, - {"SPFont" , 0x204}, - {"SPKbd" , 0x206}, - {"SPPrint" , 0x207}, - {"SPVolCtl" , 0x208}, - {"SPClikCaret" , 0x209}, - {"SPMisc1" , 0x20A}, - {"SPMisc2" , 0x20B}, - {"Time" , 0x20C}, - {"BootDrive" , 0x210}, - {"JShell" , 0x212}, - {"SFSaveDisk" , 0x214}, - {"KbdVars" , 0x216}, - {"KbdLast" , 0x218}, - {"JKybdTask" , 0x21A}, - {"KbdType" , 0x21E}, - {"AlarmState" , 0x21F}, - {"MemErr" , 0x220}, - {"JFigTrkSpd" , 0x222}, - {"JDiskPrime" , 0x226}, - {"JRdAddr" , 0x22A}, - {"JRdData" , 0x22E}, - {"JWrData" , 0x232}, - {"JSeek" , 0x236}, - {"JSetupPoll" , 0x23A}, - {"JRecal" , 0x23E}, - {"JControl" , 0x242}, - {"JWakeUp" , 0x246}, - {"JReSeek" , 0x24A}, - {"JMakeSpdTbl" , 0x24E}, - {"JAdrDisk" , 0x252}, - {"JSetSpeed" , 0x256}, - {"NiblTbl" , 0x25A}, - {"FlEvtMask" , 0x25E}, - {"SdVolume" , 0x260}, - {"SdEnable/Finder" , 0x261}, - {"SoundVars" , 0x262}, - {"SoundBase" , 0x266}, - {"SoundVBL" , 0x26A}, - {"SoundDCE" , 0x27A}, - {"SoundActive" , 0x27E}, - {"SoundLevel" , 0x27F}, - {"CurPitch" , 0x280}, - {"Switcher" , 0x282}, - {"SwitcherTPtr" , 0x286}, - {"RSDHndl" , 0x28A}, - {"ROM85" , 0x28E}, - {"PortAUse" , 0x290}, - {"PortBUse" , 0x291}, - {"ScreenVars" , 0x292}, - {"JGNEFilter" , 0x29A}, - {"Key1Trans" , 0x29E}, - {"Key2Trans" , 0x2A2}, - {"SysZone" , 0x2A6}, - {"ApplZone" , 0x2AA}, - {"ROMBase" , 0x2AE}, - {"RAMBase" , 0x2B2}, - {"ExpandMem" , 0x2B6}, - {"DSAlertTab" , 0x2BA}, - {"ExtStsDT" , 0x2BE}, - {"SCCASts" , 0x2CE}, - {"SCCBSts" , 0x2CF}, - {"SerialVars" , 0x2D0}, - {"ABusVars" , 0x2D8}, - {"ABusDCE" , 0x2DC}, - {"FinderName" , 0x2E0}, - {"DoubleTime" , 0x2F0}, - {"CaretTime" , 0x2F4}, - {"ScrDmpEnb" , 0x2F8}, - {"ScrDmpType" , 0x2F9}, - {"TagData" , 0x2FA}, - {"BufTgFNum" , 0x2FC}, - {"BufTgFFlg" , 0x300}, - {"BufTgFBkNum" , 0x302}, - {"BufTgDate" , 0x304}, - {"DrvQHdr" , 0x308}, - {"PWMBuf2" , 0x312}, - {"HpChk/MacPgm" , 0x316}, - {"Lo3Bytes" , 0x31A}, - {"MinStack" , 0x31E}, - {"DefltStack" , 0x322}, - {"MMDefFlags" , 0x326}, - {"GZRootHnd" , 0x328}, - {"GZRootPtr" , 0x32C}, - {"GZMoveHnd" , 0x330}, - {"DSDrawProc" , 0x334}, - {"EjectNotify" , 0x338}, - {"IAZNotify" , 0x33C}, - {"CurDB" , 0x340}, - {"NxtDB" , 0x342}, - {"MaxDB" , 0x344}, - {"FlushOnly" , 0x346}, - {"RegRsrc" , 0x347}, - {"FLckUnlck" , 0x348}, - {"FrcSync" , 0x349}, - {"NewMount" , 0x34A}, - {"NoEject" , 0x34B}, - {"DrMstrBlk" , 0x34C}, - {"FCBSPtr" , 0x34E}, - {"DefVCBPtr" , 0x352}, - {"VCBQHdr" , 0x356}, - {"FSQHdr" , 0x360}, - {"FSQHead" , 0x362}, - {"FSQTail" , 0x366}, - {"HFSStkTop" , 0x36A}, - {"HFSStkPtr" , 0x36E}, - {"WDCBsPtr" , 0x372}, - {"HFSFlags" , 0x376}, - {"CacheFlag" , 0x377}, - {"SysBMCPtr" , 0x378}, - {"SysVolCPtr" , 0x37C}, - {"SysCtlCPtr" , 0x380}, - {"DefVRefNum" , 0x384}, - {"PMSPPtr" , 0x386}, - {"HFSTagData" , 0x38A}, - {"HFSDSErr" , 0x392}, - {"CacheVars" , 0x394}, - {"CurDirStore" , 0x398}, - {"CacheCom" , 0x39C}, - {"FmtDefaults" , 0x39E}, - {"ErCode" , 0x3A2}, - {"Params" , 0x3A4}, - {"FSTemp8" , 0x3D6}, - {"FSIOErr" , 0x3DE}, - {"FSQueueHook" , 0x3E2}, - {"ExtFSHook" , 0x3E6}, - {"DskSwtchHook" , 0x3EA}, - {"ReqstVol" , 0x3EE}, - {"ToExtFS" , 0x3F2}, - {"FSFCBLen" , 0x3F6}, - {"DSAlertRect" , 0x3F8}, - {"JHideCrsr" , 0x800}, - {"JShowCrsr" , 0x804}, - {"JShieldCrsr" , 0x808}, - {"JScrnAddr" , 0x80C}, - {"JScrnSize" , 0x810}, - {"JInitCrsr" , 0x814}, - {"JSetCrsr" , 0x818}, - {"JCrsrObscure" , 0x81C}, - {"JUpdateProc" , 0x820}, - {"ScrnBase" , 0x824}, - {"MTemp" , 0x828}, - {"RawMouse" , 0x82C}, - {"Mouse" , 0x830}, - {"CrsrPin" , 0x834}, - {"CrsrRect" , 0x83C}, - {"TheCrsr" , 0x844}, - {"CrsrAddr" , 0x888}, - {"JAllocCrsr" , 0x88C}, - {"JSetCCrsr" , 0x890}, - {"JOpcodeProc" , 0x894}, - {"CrsrBase" , 0x898}, - {"CrsrDevice" , 0x89C}, - {"SrcDevice" , 0x8A0}, - {"MainDevice" , 0x8A4}, - {"DeviceList" , 0x8A8}, - {"CrsrRow" , 0x8AC}, - {"QDColors" , 0x8B0}, - {"CrsrVis" , 0x8CC}, - {"CrsrBusy" , 0x8CD}, - {"CrsrNew" , 0x8CE}, - {"CrsrCouple" , 0x8CF}, - {"CrsrState" , 0x8D0}, - {"CrsrObscure" , 0x8D2}, - {"CrsrScale" , 0x8D3}, - {"MouseMask" , 0x8D6}, - {"MouseOffset" , 0x8DA}, - {"JournalFlag" , 0x8DE}, - {"JSwapFont" , 0x8E0}, - {"JFontInfo" , 0x8E4}, - {"JournalRef" , 0x8E8}, - {"CrsrThresh" , 0x8EC}, - {"JCrsrTask" , 0x8EE}, - {"WWExist" , 0x8F2}, - {"QDExist" , 0x8F3}, - {"JFetch" , 0x8F4}, - {"JStash" , 0x8F8}, - {"JIODone" , 0x8FC}, - {"CurApRefNum" , 0x900}, - {"LaunchFlag" , 0x902}, - {"FondState" , 0x903}, - {"CurrentA5" , 0x904}, - {"CurStackBase" , 0x908}, - {"LoadFiller" , 0x90C}, - {"CurApName" , 0x910}, - {"SaveSegHandle" , 0x930}, - {"CurJTOffset" , 0x934}, - {"CurPageOption" , 0x936}, - {"HiliteMode" , 0x938}, - {"LoaderPBlock" , 0x93A}, - {"PrintErr" , 0x944}, - {"ChooserBits" , 0x946}, - {"PrFlags" , 0x946}, - {"PrType" , 0x947}, - {"PrRefNum" , 0x952}, - {"LastPGlobal" , 0x954}, - {"ScrapSize" , 0x960}, - {"ScrapHandle" , 0x964}, - {"ScrapCount" , 0x968}, - {"ScrapState" , 0x96A}, - {"ScrapName" , 0x96C}, - {"ScrapTag" , 0x970}, - {"RomFont0" , 0x980}, - {"AppFontID" , 0x984}, - {"SaveFondFlags" , 0x986}, - {"FMDefaultSize" , 0x987}, - {"CurFMFamily" , 0x988}, - {"CurFMSize" , 0x98A}, - {"CurFMFace" , 0x98C}, - {"CurFMNeedBits" , 0x98D}, - {"CurFMDevice" , 0x98E}, - {"CurFMNumer" , 0x990}, - {"CurFMDenom" , 0x994}, - {"FOutError" , 0x998}, - {"FOutFontHandle" , 0x99A}, - {"FOutBold" , 0x99E}, - {"FOutItalic" , 0x99F}, - {"FOutULOffset" , 0x9A0}, - {"FOutULShadow" , 0x9A1}, - {"FOutULThick" , 0x9A2}, - {"FOutShadow" , 0x9A3}, - {"FOutExtra" , 0x9A4}, - {"FOutAscent" , 0x9A5}, - {"FOutDescent" , 0x9A6}, - {"FOutWidMax" , 0x9A7}, - {"FOutLeading" , 0x9A8}, - {"FOutUnused" , 0x9A9}, - {"FOutNumer" , 0x9AA}, - {"FOutDenom" , 0x9AE}, - {"FMDotsPerInch" , 0x9B2}, - {"FMStyleTab" , 0x9B6}, - {"ToolScratch" , 0x9CE}, - {"WindowList" , 0x9D6}, - {"SaveUpdate" , 0x9DA}, - {"PaintWhite" , 0x9DC}, - {"WMgrPort" , 0x9DE}, - {"DeskPort" , 0x9E2}, - {"OldStructure" , 0x9E6}, - {"OldContent" , 0x9EA}, - {"GrayRgn" , 0x9EE}, - {"SaveVisRgn" , 0x9F2}, - {"DragHook" , 0x9F6}, - {"TempRect" , 0x9FA}, - {"OneOne" , 0xA02}, - {"MinusOne" , 0xA06}, - {"TopMenuItem" , 0xA0A}, - {"AtMenuBottom" , 0xA0C}, - {"IconBitmap" , 0xA0E}, - {"MenuList" , 0xA1C}, - {"MBarEnable" , 0xA20}, - {"CurDeKind" , 0xA22}, - {"MenuFlash" , 0xA24}, - {"TheMenu" , 0xA26}, - {"SavedHandle" , 0xA28}, - {"MBarHook" , 0xA2C}, - {"MenuHook" , 0xA30}, - {"DragPattern" , 0xA34}, - {"DeskPattern" , 0xA3C}, - {"DragFlag" , 0xA44}, - {"CurDragAction" , 0xA46}, - {"FPState" , 0xA4A}, - {"TopMapHndl" , 0xA50}, - {"SysMapHndl" , 0xA54}, - {"SysMap" , 0xA58}, - {"CurMap" , 0xA5A}, - {"ResReadOnly" , 0xA5C}, - {"ResLoad" , 0xA5E}, - {"ResErr" , 0xA60}, - {"TaskLock" , 0xA62}, - {"FScaleDisable" , 0xA63}, - {"CurActivate" , 0xA64}, - {"CurDeactive" , 0xA68}, - {"DeskHook" , 0xA6C}, - {"TEDoText" , 0xA70}, - {"TERecal" , 0xA74}, - {"ApplScratch" , 0xA78}, - {"GhostWindow" , 0xA84}, - {"CloseOrnHook" , 0xA88}, - {"ResumeProc" , 0xA8C}, - {"RestProc" , 0xA8C}, - {"SaveProc" , 0xA90}, - {"SaveSP" , 0xA94}, - {"ANumber" , 0xA98}, - {"ACount" , 0xA9A}, - {"DABeeper" , 0xA9C}, - {"DAStrings" , 0xAA0}, - {"TEScrpLength" , 0xAB0}, - {"TEScrpHandle" , 0xAB4}, - {"AppPacks" , 0xAB8}, - {"SysResName" , 0xAD8}, - {"SoundGlue" , 0xAE8}, - {"AppParmHandle" , 0xAEC}, - {"DSErrCode" , 0xAF0}, - {"ResErrProc" , 0xAF2}, - {"TEWdBreak" , 0xAF6}, - {"DlgFont" , 0xAFA}, - {"LastTGlobal" , 0xAFC}, - {"TrapAgain" , 0xB00}, - {"KeyMVars" , 0xB04}, - {"ROMMapHndl" , 0xB06}, - {"PWMBuf1" , 0xB0A}, - {"BootMask" , 0xB0E}, - {"WidthPtr" , 0xB10}, - {"ATalkHk1" , 0xB14}, - {"LAPMgrPtr" , 0xB18}, - {"FourDHack" , 0xB1C}, - {"UnSwitchedFlags" , 0xB20}, - {"SwitchedFlags" , 0xB21}, - {"HWCfgFlags" , 0xB22}, - {"TimeSCSIDB" , 0xB24}, - {"Top2MenuItem" , 0xB26}, - {"At2MenuBottom" , 0xB28}, - {"WidthTabHandle" , 0xB2A}, - {"SCSIDrvrs" , 0xB2E}, - {"TimeVars" , 0xB30}, - {"BtDskRfn" , 0xB34}, - {"BootTmp8" , 0xB36}, - {"NTSC" , 0xB3E}, - {"T1Arbitrate" , 0xB3F}, - {"JDiskSel" , 0xB40}, - {"JSendCmd" , 0xB44}, - {"JDCDReset" , 0xB48}, - {"LastSPExtra" , 0xB4C}, - {"FileShareVars" , 0xB50}, - {"MenuDisable" , 0xB54}, - {"MBDFHndl" , 0xB58}, - {"MBSaveLoc" , 0xB5C}, - {"BNMQHdr" , 0xB60}, - {"BackgrounderVars" , 0xB64}, - {"MenuLayer" , 0xB68}, - {"OmegaSANE" , 0xB6C}, - {"CarlByte" , 0xB72}, - {"SystemInfo" , 0xB73}, - {"VMGlobals" , 0xB78}, - {"Twitcher2" , 0xB7C}, - {"RMgrHiVars" , 0xB80}, - {"HSCHndl" , 0xB84}, - {"PadRsrc" , 0xB88}, - {"ResOneDeep" , 0xB9A}, - {"PadRsrc2" , 0xB9C}, - {"RomMapInsert" , 0xB9E}, - {"TmpResLoad" , 0xB9F}, - {"IntlSpec" , 0xBA0}, - {"RMgrPerm" , 0xBA4}, - {"WordRedraw" , 0xBA5}, - {"SysFontFam" , 0xBA6}, - {"DefFontSize" , 0xBA8}, - {"MBarHeight" , 0xBAA}, - {"TESysJust" , 0xBAC}, - {"HiHeapMark" , 0xBAE}, - {"SegHiEnable" , 0xBB2}, - {"FDevDisable" , 0xBB3}, - {"CommToolboxGlob" , 0xBB4}, - {"CMVector" , 0xBB4}, - {"ShutDwnQHdr" , 0xBBC}, - {"NewUnused" , 0xBC0}, - {"LastFOND" , 0xBC2}, - {"FONDID" , 0xBC6}, - {"App2Packs" , 0xBC8}, - {"MAErrProc" , 0xBE8}, - {"MASuperTab" , 0xBEC}, - {"MimeGlobs" , 0xBF0}, - {"FractEnable" , 0xBF4}, - {"UsedFWidth" , 0xBF5}, - {"FScaleHFact" , 0xBF6}, - {"FScaleVFact" , 0xBFA}, - {"SCCIOPFlag" , 0xBFE}, - {"MacJmpFlag" , 0xBFF}, - {"SCSIBase" , 0xC00}, - {"SCSIDMA" , 0xC04}, - {"SCSIHsk" , 0xC08}, - {"SCSIGlobals" , 0xC0C}, - {"RGBBlack" , 0xC10}, - {"RGBWhite" , 0xC16}, - {"FMSynth" , 0xC1C}, - {"RowBits" , 0xC20}, - {"ColLines" , 0xC22}, - {"ScreenBytes" , 0xC24}, - {"IOPMgrVars" , 0xC28}, - {"NMIFlag" , 0xC2C}, - {"VidType" , 0xC2D}, - {"VidMode" , 0xC2E}, - {"SCSIPoll" , 0xC2F}, - {"SEVarBase" , 0xC30}, - {"MacsBugSP" , 0xC6C}, - {"MacsBugPC" , 0xC70}, - {"MacsBugSR" , 0xC74}, - {"MMUFlags" , 0xCB0}, - {"MMUType" , 0xCB1}, - {"MMU32bit" , 0xCB2}, - {"MachineType" , 0xCB3}, - {"MMUTbl24" , 0xCB4}, - {"MMUTbl32" , 0xCB8}, - {"SInfoPtr" , 0xCBC}, - {"ASCBase" , 0xCC0}, - {"SMGlobals" , 0xCC4}, - {"TheGDevice" , 0xCC8}, - {"CQDGlobals" , 0xCCC}, - {"AuxWinHead" , 0xCD0}, - {"AuxCtlHead" , 0xCD4}, - {"DeskCPat" , 0xCD8}, - {"SetOSDefKey" , 0xCDC}, - {"LastBinPat" , 0xCE0}, - {"DeskPatEnable" , 0xCE8}, - {"TimeVIADB" , 0xCEA}, - {"VIA2Base" , 0xCEC}, - {"VMVectors" , 0xCF0}, - {"ADBBase" , 0xCF8}, - {"WarmStart" , 0xCFC}, - {"TimeDBRA" , 0xD00}, - {"TimeSCCDB" , 0xD02}, - {"SlotQDT" , 0xD04}, - {"SlotPrTbl" , 0xD08}, - {"SlotVBLQ" , 0xD0C}, - {"ScrnVBLPtr" , 0xD10}, - {"SlotTICKS" , 0xD14}, - {"PowerMgrVars" , 0xD18}, - {"AGBHandle" , 0xD1C}, - {"TableSeed" , 0xD20}, - {"SRsrcTblPtr" , 0xD24}, - {"JVBLTask" , 0xD28}, - {"WMgrCPort" , 0xD2C}, - {"VertRRate" , 0xD30}, - {"SynListHandle" , 0xD32}, - {"LastFore" , 0xD36}, - {"LastBG" , 0xD3A}, - {"LastMode" , 0xD3E}, - {"LastDepth" , 0xD40}, - {"FMExist" , 0xD42}, - {"SavedHilite" , 0xD43}, - {"ShieldDepth" , 0xD4C}, - {"MenuCInfo" , 0xD50}, - {"MBProcHndl" , 0xD54}, - {"MBFlash" , 0xD5C}, - {"ChunkyDepth" , 0xD60}, - {"CrsrPtr" , 0xD62}, - {"PortList" , 0xD66}, - {"MickeyBytes" , 0xD6A}, - {"QDErr" , 0xD6E}, - {"VIA2DT" , 0xD70}, - {"SInitFlags" , 0xD90}, - {"DTQueue" , 0xD92}, - {"DTQFlags" , 0xD92}, - {"DTskQHdr" , 0xD94}, - {"DTskQTail" , 0xD98}, - {"JDTInstall" , 0xD9C}, - {"HiliteRGB" , 0xDA0}, - {"OldTimeSCSIDB" , 0xDA6}, - {"DSCtrAdj" , 0xDA8}, - {"IconTLAddr" , 0xDAC}, - {"VideoInfoOK" , 0xDB0}, - {"EndSRTPtr" , 0xDB4}, - {"SDMJmpTblPtr" , 0xDB8}, - {"JSwapMMU" , 0xDBC}, - {"SdmBusErr" , 0xDC0}, - {"LastTxGDevice" , 0xDC4}, - {"PMgrHandle" , 0xDC8}, - {"LayerPalette" , 0xDCC}, - {"AddrMapFlags" , 0xDD0}, - {"UnivROMFlags" , 0xDD4}, - {"UniversalInfoPtr" , 0xDD8}, - {"BootGlobPtr" , 0xDDC}, - {"EgretGlobals" , 0xDE0}, - {"SaneTrapAddr" , 0xDE4}, - {"Warhol" , 0xDE8}, - {"MemVectors24" , 0x1E00}, - {"Mem2Vectors24" , 0x1EE0}, - {"Phys2Log" , 0x1EF0}, - {"RealMemTop" , 0x1EF4}, - {"PhysMemTop" , 0x1EF8}, - {"MMFlags" , 0x1EFC}, - {"MemVectors32" , 0x1F00}, - {"DrawCrsrVector" , 0x1FB8}, - {"EraseCrsrVector" , 0x1FBC}, - {"PSCIntTbl" , 0x1FC0}, - {"DSPGlobals" , 0x1FC4}, - {"FP040Vects" , 0x1FC8}, - {"FPBSUNVec" , 0x1FCC}, - {"FPUNFLVec" , 0x1FD0}, - {"FPOPERRVec" , 0x1FD4}, - {"FPOVFLVec" , 0x1FD8}, - {"FPSNANVec" , 0x1FDC}, - {"Mem2Vectors32" , 0x1FE0}, - {"SCSI2Base" , 0x1FF0}, - {"LockMemCt" , 0x1FF4}, - {"DockingGlobals" , 0x1FF8}, - {"VectorPtr" , 0x2000}, - {"BasesValid1" , 0x2400}, - {"BasesValid2" , 0x2404}, - {"ExtValid1" , 0x2408}, - {"ExtValid2" , 0x240C}, - {NULL , 0xFFFF} -}; diff --git a/cxmon/src/mon_lowmem.h b/cxmon/src/mon_lowmem.h deleted file mode 100644 index 55e058e8..00000000 --- a/cxmon/src/mon_lowmem.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * mon_lowmem.h - MacOS low memory globals definitions - * - * cxmon (C) 1997-2004 Christian Bauer, Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef MON_LOWMEM_H -#define MON_LOWMEM_H - -struct lowmem_info { - const char *name; - uint16 addr; -}; - -// Array of low memory globals in ascending order -extern const lowmem_info lowmem[]; - -#endif diff --git a/cxmon/src/mon_ppc.cpp b/cxmon/src/mon_ppc.cpp deleted file mode 100644 index 56683654..00000000 --- a/cxmon/src/mon_ppc.cpp +++ /dev/null @@ -1,1129 +0,0 @@ -/* - * mon_ppc.cpp - PowerPC disassembler - * - * cxmon (C) 1997-2004 Christian Bauer, Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" - -#include "mon.h" -#include "mon_disass.h" - - -// Instruction fields -static int primop, exop, vxop, ra, rb, rc, rd; -static unsigned short imm; - - -// Codes for trap instructions -static char *to_code[32] = { - NULL, "lgt", "llt", NULL, "eq", "lge", "lle", NULL, - "gt", NULL, NULL, NULL, "ge", NULL, NULL, NULL, - "lt", NULL, NULL, NULL, "le", NULL, NULL, NULL, - "ne", NULL, NULL, NULL, NULL, NULL, NULL, "" -}; - - -// Macros for instruction forms -#define iform(s, t) fprintf(f, "%s\t$%08x\n", s, t) - -#define bform(s, t) \ - if (rd == 0) \ - fprintf(f, "bdnzf%s\t%d,$%08x\n", s, ra, t); \ - else if (rd == 2) \ - fprintf(f, "bdzf%s\t%d,$%08x\n", s, ra, t); \ - else if (rd == 4) { \ - if (ra == 0) \ - fprintf(f, "bge%s\t$%08x\n", s, t); \ - else if (ra == 1) \ - fprintf(f, "ble%s\t$%08x\n", s, t); \ - else if (ra == 2) \ - fprintf(f, "bne%s\t$%08x\n", s, t); \ - else \ - fprintf(f, "bf%s\t%d,$%08x\n", s, ra, t); \ - } else if (rd == 8) \ - fprintf(f, "bdnzt%s\t%d,$%08x\n", s, ra, t); \ - else if (rd == 10) \ - fprintf(f, "bdzt%s\t%d,$%08x\n", s, ra, t); \ - else if (rd == 12) { \ - if (ra == 0) \ - fprintf(f, "blt%s\t$%08x\n", s, t); \ - else if (ra == 1) \ - fprintf(f, "bgt%s\t$%08x\n", s, t); \ - else if (ra == 2) \ - fprintf(f, "beq%s\t$%08x\n", s, t); \ - else \ - fprintf(f, "bt%s\t%d,$%08x\n", s, ra, t); \ - } else if (rd == 16) \ - fprintf(f, "bdnz%s\t$%08x\n", s, t); \ - else if (rd == 18) \ - fprintf(f, "bdz%s\t$%08x\n", s, t); \ - else \ - fprintf(f, "bc%s\t%d,%d,$%08x\n", s, rd, ra, t) - -#define scform(s) fprintf(f, s "\n") - -#define dform_ls(s) \ - if (ra == 0) \ - fprintf(f, "%s\tr%d,$%08x\n", s, rd, short(imm)); \ - else \ - fprintf(f, "%s\tr%d,$%04x(r%d)\n", s, rd, short(imm), ra) -#define dform_fls(s) \ - if (ra == 0) \ - fprintf(f, "%s\tfr%d,$%08x\n", s, rd, short(imm)); \ - else \ - fprintf(f, "%s\tfr%d,$%04x(r%d)\n", s, rd, short(imm), ra) -#define dform_simm(s) fprintf(f, "%s\tr%d,r%d,$%04x\n", s, rd, ra, short(imm)) -#define dform_simmn(s) fprintf(f, "%s\tr%d,r%d,$%04x\n", s, rd, ra, (-imm) & 0xffff) -#define dform_uimm(s) fprintf(f, "%s\tr%d,r%d,$%04x\n", s, ra, rd, imm) -#define dform_crs(s) fprintf(f, "%s\tcrf%d,r%d,$%04x\n", s, rd >> 2, ra, short(imm)) -#define dform_cru(s) fprintf(f, "%s\tcrf%d,r%d,$%04x\n", s, rd >> 2, ra, imm) -#define dform_to(s) fprintf(f, "%s\t%d,r%d,$%04x\n", s, rd, ra, short(imm)) - -#define dsform(s) fprintf(f, "%s\tr%d,$%04x(r%d)\n", s, rd, short(imm & 0xfffc), ra) - -#define xform_vls(s) \ - if (ra == 0) \ - fprintf(f, "%s\tv%d,r%d\n", s, rd, rb); \ - else \ - fprintf(f, "%s\tv%d,r%d,r%d\n", s, rd, ra, rb) -#define xform_ls(s) \ - if (ra == 0) \ - fprintf(f, "%s\tr%d,r%d\n", s, rd, rb); \ - else \ - fprintf(f, "%s\tr%d,r%d,r%d\n", s, rd, ra, rb) -#define xform_fls(s) \ - if (ra == 0) \ - fprintf(f, "%s\tfr%d,r%d\n", s, rd, rb); \ - else \ - fprintf(f, "%s\tfr%d,r%d,r%d\n", s, rd, ra, rb) -#define xform_lsswi(s) \ - if (ra == 0) \ - fprintf(f, "%s\tr%d,%d\n", s, rd, rb ? rb : 32); \ - else \ - fprintf(f, "%s\tr%d,r%d,%d\n", s, rd, ra, rb ? rb : 32) -#define xform_db(s) fprintf(f, "%s\tr%d,r%d\n", s, rd, rb) -#define xform_d(s) fprintf(f, "%s\tr%d\n", s, rd) -#define xform_fsr(s) fprintf(f, s "\tr%d,%d\n", rd, ra & 0xf) -#define xform_sabc(s) fprintf(f, "%s%s\tr%d,r%d,r%d\n", s, w & 1 ? "." : "", ra, rd, rb) -#define xform_sac(s) fprintf(f, "%s%s\tr%d,r%d\n", s, w & 1 ? "." : "", ra, rd) -#define xform_tsr(s) fprintf(f, s "\t%d,r%d\n", ra & 0xf, rd) -#define xform_sash(s) fprintf(f, s "%s\tr%d,r%d,%d\n", w & 1 ? "." : "", ra, rd, rb) -#define xform_crlab(s) fprintf(f, "%s\tcrf%d,r%d,r%d\n", s, rd >> 2, ra, rb) -#define xform_fcrab(s) fprintf(f, "%s\tcrf%d,fr%d,fr%d\n", s, rd >> 2, ra, rb) -#define xform_crcr(s) fprintf(f, "%s\tcrf%d,crf%d\n", s, rd >> 2, ra >> 2) -#define xform_cr(s) fprintf(f, "%s\tcrf%d\n", s, rd >> 2) -#define xform_cri(s) fprintf(f, s "%s\tcrf%d,%d\n", w & 1 ? "." : "", rd >> 2, rb >> 1) -#define xform_to(s) fprintf(f, "%s\t%d,r%d,r%d\n", s, rd, ra, rb) -#define xform_fdb(s) fprintf(f, "%s%s\tfr%d,fr%d\n", s, w & 1 ? "." : "", rd, rb) -#define xform_fd(s) fprintf(f, "%s%s\tfr%d\n", s, w & 1 ? "." : "", rd) -#define xform_crb(s) fprintf(f, "%s%s\tcrb%d\n", s, w & 1 ? "." : "", rd) -#define xform_ab(s) fprintf(f, "%s\tr%d,r%d\n", s, ra, rb) -#define xform_b(s) fprintf(f, "%s\tr%d\n", s, rb) -#define xform(s) fprintf(f, s "\n") - -#define xlform_b(s) fprintf(f, "%s\t%d,%d\n", s, rd, ra) -#define xlform_cr(s) fprintf(f, "%s\tcrb%d,crb%d,crb%d\n", s, rd, ra, rb) -#define xlform_crcr(s) fprintf(f, "%s\tcrf%d,crf%d\n", s, rd >> 2, ra >> 2) -#define xlform(s) fprintf(f, s "\n") - -#define xfxform_fspr(s) fprintf(f, "%s\tr%d,SPR%d\n", s, rd, ra | (rb << 5)) -#define xfxform_crm(s) fprintf(f, s "\t$%02x,r%d\n", w >> 12 & 0xff, rd) -#define xfxform_tspr(s) fprintf(f, "%s\tSPR%d,r%d\n", s, ra | (rb << 5), rd) -#define xfxform_tb(s) fprintf(f, "%s\tr%d\n", s, rd) - -#define xflform(s) fprintf(f, s "%s\t$%02x,fr%d\n", w & 1 ? "." : "", w >> 17 & 0xff, rb) - -#define xsform(s) fprintf(f, s "%s\tr%d,r%d,%d\n", w & 1 ? "." : "", ra, rd, rb | (w & 2 ? 32 : 0)) - -#define xoform_dab(s) fprintf(f, "%s%s\tr%d,r%d,r%d\n", s, w & 1 ? "." : "", rd, ra, rb) -#define xoform_da(s) fprintf(f, "%s%s\tr%d,r%d\n", s, w & 1 ? "." : "", rd, ra) - -#define aform_dab(s) fprintf(f, "%s%s\tfr%d,fr%d,fr%d\n", s, w & 1 ? "." : "", rd, ra, rb) -#define aform_db(s) fprintf(f, "%s%s\tfr%d,fr%d\n", s, w & 1 ? "." : "", rd, rb) -#define aform_dac(s) fprintf(f, "%s%s\tfr%d,fr%d,fr%d\n", s, w & 1 ? "." : "", rd, ra, rc) -#define aform_dacb(s) fprintf(f, "%s%s\tfr%d,fr%d,fr%d,fr%d\n", s, w & 1 ? "." : "", rd, ra, rc, rb) - -#define mform(s) fprintf(f, "%s%s\tr%d,r%d,r%d,$%08x\n", s, w & 1 ? "." : "", ra, rd, rb, mbme2mask(w >> 6 & 31, w >>1 & 31)) -#define mform_i(s) fprintf(f, "%s%s\tr%d,r%d,%d,$%08x\n", s, w & 1 ? "." : "", ra, rd, rb, mbme2mask(w >> 6 & 31, w >>1 & 31)) - -#define mdform(s) fprintf(f, "%s%s\tr%d,r%d,%d,%d\n", s, w & 1 ? "." : "", ra, rd, rb | (w & 2 ? 32 : 0), rc | (w & 32 ? 32 : 0)) - -#define mdsform(s) fprintf(f, "%s%s\tr%d,r%d,r%d,%d\n", s, w & 1 ? "." : "", ra, rd, rb, rc | (w & 32 ? 32 : 0)) - -#define va_form(s) fprintf(f, "%s\tv%d,v%d,v%d,v%d\n", s, rd, ra, rb, rc) -#define vx_form(s) fprintf(f, "%s\tv%d,v%d,v%d\n", s, rd, ra, rb) -#define vxr_form(s) fprintf(f, "%s%s\tv%d,v%d,v%d\n", s, w & (1 << 10) ? "." : "", rd, ra, rb) -#define vxi_ra_form(s) fprintf(f, "%s\tv%d,v%d,%d\n", s, rd, rb, ra) -#define vx_raz_form(s) \ - if (ra == 0) \ - fprintf(f, "%s\tv%d,v%d\n", s, rd, rb); \ - else \ - fprintf(f, "?\n") -#define vxi_ras_rbz_form(s) \ - if (rb == 0) \ - fprintf(f, "%s\tv%d,%d\n", s, rd, ra - (ra & 0x10 ? 0x20 : 0)); \ - else \ - fprintf(f, "?\n") - -// Prototypes -static void disass4(FILE *f, unsigned int adr, unsigned int w); -static void disass19(FILE *f, unsigned int adr, unsigned int w); -static void disass31(FILE *f, unsigned int adr, unsigned int w); -static void disass59(FILE *f, unsigned int adr, unsigned int w); -static void disass63(FILE *f, unsigned int adr, unsigned int w); -static unsigned int mbme2mask(int mb, int me); -static char *get_spr(int reg); - - -/* - * Disassemble one instruction - */ - -void disass_ppc(FILE *f, unsigned int adr, unsigned int w) -{ - // Divide instruction into fields - primop = w >> 26; - rd = w >> 21 & 0x1f; - ra = w >> 16 & 0x1f; - rb = w >> 11 & 0x1f; - rc = w >> 6 & 0x1f; - exop = w >> 1 & 0x3ff; - vxop = w & 0x7ff; - imm = w & 0xffff; - - // Decode primary opcode - switch (primop) { - case 2: // 64 bit - if (to_code[rd] != NULL) - fprintf(f, "td%si\tr%d,$%04x\n", to_code[rd], ra, short(imm)); - else - dform_to("tdi"); - break; - - case 3: - if (to_code[rd] != NULL) - fprintf(f, "tw%si\tr%d,$%04x\n", to_code[rd], ra, short(imm)); - else - dform_to("twi"); - break; - - case 4: // AltiVec - disass4(f, adr, w); - break; - - case 7: dform_simm("mulli"); break; - case 8: dform_simm("subfic"); break; - - case 10: - if (rd & 1) - dform_cru("cmpldi"); // 64 bit - else - dform_cru("cmplwi"); - break; - - case 11: - if (rd & 1) - dform_crs("cmpdi"); // 64 bit - else - dform_crs("cmpwi"); - break; - - case 12: - if (imm < 0x8000) - dform_simm("addic"); - else - dform_simmn("subic"); - break; - - case 13: - if (imm < 0x8000) - dform_simm("addic."); - else - dform_simmn("subic."); - break; - - case 14: - if (ra == 0) - fprintf(f, "li\tr%d,$%04x\n", rd, short(imm)); - else - if (imm < 0x8000) - dform_simm("addi"); - else - dform_simmn("subi"); - break; - - case 15: - if (ra == 0) - fprintf(f, "lis\tr%d,$%04x\n", rd, imm); - else - if (imm < 0x8000) - dform_simm("addis"); - else - dform_simmn("subis"); - break; - - case 16: { - int target = short(imm & 0xfffc); - char *form; - if (w & 1) - if (w & 2) - form = "la"; - else { - form = "l"; - target += adr; - } - else - if (w & 2) - form = "a"; - else { - form = ""; - target += adr; - } - bform(form, target); - break; - } - - case 17: - if (w & 2) - scform("sc"); - else - fprintf(f, "?\n"); - break; - - case 18: { - int target = w & 0x03fffffc; - if (target & 0x02000000) - target |= 0xfc000000; - if (w & 1) - if (w & 2) - iform("bla", target); - else - iform("bl", adr + target); - else - if (w & 2) - iform("ba", target); - else - iform("b", adr + target); - break; - } - - case 19: disass19(f, adr, w); break; - case 20: mform_i("rlwimi"); break; - case 21: mform_i("rlwinm"); break; - case 23: mform("rlwnm"); break; - - case 24: - if (rd == 0 && ra == 0 && imm == 0) - fprintf(f, "nop\n"); - else - dform_uimm("ori"); - break; - - case 25: dform_uimm("oris"); break; - case 26: dform_uimm("xori"); break; - case 27: dform_uimm("xoris"); break; - case 28: dform_uimm("andi."); break; - case 29: dform_uimm("andis."); break; - - case 30: // 64 bit - switch (w >> 1 & 0xf) { - case 0: case 1: mdform("rldicl"); break; - case 2: case 3: mdform("rldicr"); break; - case 4: case 5: mdform("rldic"); break; - case 6: case 7: mdform("rldimi"); break; - case 8: mdsform("rldcl"); break; - case 9: mdsform("rldcr"); break; - default: - fprintf(f, "?\n"); - break; - }; - break; - - case 31: disass31(f, adr, w); break; - case 32: dform_ls("lwz"); break; - case 33: dform_ls("lwzu"); break; - case 34: dform_ls("lbz"); break; - case 35: dform_ls("lbzu"); break; - case 36: dform_ls("stw"); break; - case 37: dform_ls("stwu"); break; - case 38: dform_ls("stb"); break; - case 39: dform_ls("stbu"); break; - case 40: dform_ls("lhz"); break; - case 41: dform_ls("lhzu"); break; - case 42: dform_ls("lha"); break; - case 43: dform_ls("lhau"); break; - case 44: dform_ls("sth"); break; - case 45: dform_ls("sthu"); break; - case 46: dform_ls("lmw"); break; - case 47: dform_ls("stmw"); break; - case 48: dform_fls("lfs"); break; - case 49: dform_fls("lfsu"); break; - case 50: dform_fls("lfd"); break; - case 51: dform_fls("lfdu"); break; - case 52: dform_fls("stfs"); break; - case 53: dform_fls("stfsu"); break; - case 54: dform_fls("stfd"); break; - case 55: dform_fls("stfdu"); break; - - case 58: // 64 bit - switch (w & 3) { - case 0: dsform("ld"); break; - case 1: dsform("ldu"); break; - case 2: dsform("lwa"); break; - default: - fprintf(f, "?\n"); - break; - } - break; - - case 59: disass59(f, adr, w); break; - - case 62: // 64 bit - switch (w & 3) { - case 0: dsform("std"); break; - case 1: dsform("stdu"); break; - default: - fprintf(f, "?\n"); - break; - } - break; - - case 63: disass63(f, adr, w); break; - - default: - if (!w) - fprintf(f, "illegal\n"); - else - fprintf(f, "?\n"); - break; - } -} - - -/* - * Disassemble instruction with primary opcode = 4 (VX-Form) - */ - -static void disass4(FILE *f, unsigned int adr, unsigned int w) -{ - switch (vxop) { - case 1540: - if (ra == 0 && rb == 0) - fprintf(f, "mfvscr\tv%d\n", rd); - else - fprintf(f, "?\n"); - break; - case 1604: - if (rd == 0 && ra == 0) - fprintf(f, "mtvscr\tv%d\n", rb); - else - fprintf(f, "?\n"); - break; - case 384: vx_form("vaddcuw"); break; - case 10: vx_form("vaddfp"); break; - case 768: vx_form("vaddsbs"); break; - case 832: vx_form("vaddshs"); break; - case 896: vx_form("vaddsws"); break; - case 0: vx_form("vaddubm"); break; - case 512: vx_form("vaddubs"); break; - case 64: vx_form("vadduhm"); break; - case 576: vx_form("vadduhs"); break; - case 128: vx_form("vadduwm"); break; - case 640: vx_form("vadduws"); break; - case 1028: vx_form("vand"); break; - case 1092: vx_form("vandc"); break; - case 1282: vx_form("vavgsb"); break; - case 1346: vx_form("vavgsh"); break; - case 1410: vx_form("vavgsw"); break; - case 1026: vx_form("vavgub"); break; - case 1090: vx_form("vavguh"); break; - case 1154: vx_form("vavguw"); break; - case 842: vxi_ra_form("vcfsx"); break; - case 778: vxi_ra_form("vcfux"); break; - case 966: case 966+1024: vxr_form("vcmpbfp"); break; - case 198: case 198+1024: vxr_form("vcmpeqfp"); break; - case 6: case 6+1024: vxr_form("vcmpequb"); break; - case 70: case 70+1024: vxr_form("vcmpequh"); break; - case 134: case 134+1024: vxr_form("vcmpequw"); break; - case 454: case 454+1024: vxr_form("vcmpgefp"); break; - case 710: case 710+1024: vxr_form("vcmpgtfp"); break; - case 774: case 774+1024: vxr_form("vcmpgtsb"); break; - case 838: case 838+1024: vxr_form("vcmpgtsh"); break; - case 902: case 902+1024: vxr_form("vcmpgtsw"); break; - case 518: case 518+1024: vxr_form("vcmpgtub"); break; - case 582: case 582+1024: vxr_form("vcmpgtuh"); break; - case 646: case 646+1024: vxr_form("vcmpgtuw"); break; - case 970: vxi_ra_form("vctsxs"); break; - case 906: vxi_ra_form("vctuxs"); break; - case 394: vx_raz_form("vexptefp"); break; - case 458: vx_raz_form("vlogefp"); break; - case 1034: vx_form("vmaxfp"); break; - case 258: vx_form("vmaxsb"); break; - case 322: vx_form("vmaxsh"); break; - case 386: vx_form("vmaxsw"); break; - case 2: vx_form("vmaxub"); break; - case 66: vx_form("vmaxuh"); break; - case 130: vx_form("vmaxuw"); break; - case 1098: vx_form("vminfp"); break; - case 770: vx_form("vminsb"); break; - case 834: vx_form("vminsh"); break; - case 898: vx_form("vminsw"); break; - case 514: vx_form("vminub"); break; - case 578: vx_form("vminuh"); break; - case 642: vx_form("vminuw"); break; - case 12: vx_form("vmrghb"); break; - case 76: vx_form("vmrghh"); break; - case 140: vx_form("vmrghw"); break; - case 268: vx_form("vmrglb"); break; - case 332: vx_form("vmrglh"); break; - case 396: vx_form("vmrglw"); break; - case 776: vx_form("vmulesb"); break; - case 840: vx_form("vmulesh"); break; - case 520: vx_form("vmuleub"); break; - case 584: vx_form("vmuleuh"); break; - case 264: vx_form("vmulosb"); break; - case 328: vx_form("vmulosh"); break; - case 8: vx_form("vmuloub"); break; - case 72: vx_form("vmulouh"); break; - case 1284: vx_form("vnor"); break; - case 1156: vx_form("vor"); break; - case 782: vx_form("vpkpx"); break; - case 398: vx_form("vpkshss"); break; - case 270: vx_form("vpkshus"); break; - case 462: vx_form("vpkswss"); break; - case 334: vx_form("vpkswus"); break; - case 14: vx_form("vpkuhum"); break; - case 142: vx_form("vpkuhus"); break; - case 78: vx_form("vpkuwum"); break; - case 206: vx_form("vpkuwus"); break; - case 266: vx_raz_form("vrefp"); break; - case 714: vx_raz_form("vrfim"); break; - case 522: vx_raz_form("vrfin"); break; - case 650: vx_raz_form("vrfip"); break; - case 586: vx_raz_form("vrfiz"); break; - case 4: vx_form("vrlb"); break; - case 68: vx_form("vrlh"); break; - case 132: vx_form("vrlw"); break; - case 330: vx_raz_form("vrsqrtefp"); break; - case 452: vx_form("vsl"); break; - case 260: vx_form("vslb"); break; - case 324: vx_form("vslh"); break; - case 1036: vx_form("vslo"); break; - case 388: vx_form("vslw"); break; - case 524: vxi_ra_form("vspltb"); break; - case 588: vxi_ra_form("vsplth"); break; - case 780: vxi_ras_rbz_form("vspltisb"); break; - case 844: vxi_ras_rbz_form("vspltish"); break; - case 908: vxi_ras_rbz_form("vspltisw"); break; - case 652: vxi_ra_form("vspltw"); break; - case 708: vx_form("vsr"); break; - case 772: vx_form("vsrab"); break; - case 836: vx_form("vsrah"); break; - case 900: vx_form("vsraw"); break; - case 516: vx_form("vsrb"); break; - case 580: vx_form("vsrh"); break; - case 1100: vx_form("vsro"); break; - case 644: vx_form("vsrw"); break; - case 1408: vx_form("vsubcuw"); break; - case 74: vx_form("vsubfp"); break; - case 1792: vx_form("vsubsbs"); break; - case 1856: vx_form("vsubshs"); break; - case 1920: vx_form("vsubsws"); break; - case 1024: vx_form("vsububm"); break; - case 1536: vx_form("vsububs"); break; - case 1088: vx_form("vsubuhm"); break; - case 1600: vx_form("vsubuhs"); break; - case 1152: vx_form("vsubuwm"); break; - case 1664: vx_form("vsubuws"); break; - case 1928: vx_form("vsumsws"); break; - case 1672: vx_form("vsum2sws"); break; - case 1800: vx_form("vsum4sbs"); break; - case 1608: vx_form("vsum4shs"); break; - case 1544: vx_form("vsum4ubs"); break; - case 846: vx_raz_form("vupkhpx"); break; - case 526: vx_raz_form("vupkhsb"); break; - case 590: vx_raz_form("vupkhsh"); break; - case 974: vx_raz_form("vupklpx"); break; - case 654: vx_raz_form("vupklsb"); break; - case 718: vx_raz_form("vupklsh"); break; - case 1220: vx_form("vxor"); break; - default: - if ((vxop & 0x43f) == 44) { // vsldoi vD,vA,vB,SHB - fprintf(f, "vsldoi\tv%d,v%d,v%d,%d\n", rd, ra, rb, rc & 15); - break; - } - switch (vxop & 0x3f) { // VA-form, must come last - case 46: va_form("vmaddfp"); break; - case 32: va_form("vmhaddshs"); break; - case 33: va_form("vmhraddshs"); break; - case 34: va_form("vmladduhm"); break; - case 37: va_form("vmsummbm"); break; - case 40: va_form("vmsumshm"); break; - case 41: va_form("vmsumshs"); break; - case 36: va_form("vmsumubm"); break; - case 38: va_form("vmsumuhm"); break; - case 39: va_form("vmsumuhs"); break; - case 47: va_form("vnmsubfp"); break; - case 43: va_form("vperm"); break; - case 42: va_form("vsel"); break; - default: fprintf(f, "?\n"); break; - } - break; - } -} - - -/* - * Disassemble instruction with primary opcode = 19 (XL-Form) - */ - -static void disass19(FILE *f, unsigned int adr, unsigned int w) -{ - switch (exop) { - case 0: xlform_crcr("mcrf"); break; - - case 16: - if (w & 1) - if (rd == 20) - fprintf(f, "blrl\n"); - else - xlform_b("bclrl"); - else - if (rd == 20) - fprintf(f, "blr\n"); - else - xlform_b("bclr"); - break; - - case 33: - if (ra == rb) - fprintf(f, "crnot\tcrb%d,crb%d\n", rd, ra); - else - xlform_cr("crnor"); - break; - - case 50: xlform("rfi"); break; - case 129: xlform_cr("crandc"); break; - case 150: xlform("isync"); break; - - case 193: - if (ra == rd && rb == rd) - fprintf(f, "crclr\tcrb%d\n", rd); - else - xlform_cr("crxor"); - break; - - case 225: xlform_cr("crnand"); break; - case 257: xlform_cr("crand"); break; - - case 289: - if (ra == rd && rb == rd) - fprintf(f, "crset\tcrb%d\n", rd); - else - xlform_cr("creqv"); - break; - - case 417: xlform_cr("crorc"); break; - - case 449: - if (ra == rb) - fprintf(f, "crmove\tcrb%d,crb%d\n", rd, ra); - else - xlform_cr("cror"); - break; - - case 528: - if (w & 1) - if (rd == 20) - fprintf(f, "bctrl\n"); - else - xlform_b("bcctrl"); - else - if (rd == 20) - fprintf(f, "bctr\n"); - else - xlform_b("bcctr"); - break; - - default: - fprintf(f, "?\n"); - break; - } -} - - -/* - * Disassemble instruction with primary opcode = 31 (X-Form/XO-Form/XFX-Form/XS-Form) - */ - -static void disass31(FILE *f, unsigned int adr, unsigned int w) -{ - switch (exop) { - case 0: - if (rd & 1) - xform_crlab("cmpd"); // 64 bit - else - xform_crlab("cmpw"); - break; - - case 4: - if (rd == 31 && ra == 0 && rb == 0) - xform("trap"); - else if (to_code[rd] != NULL) - fprintf(f, "tw%s\tr%d,r%d\n", to_code[rd], ra, rb); - else - xform_to("tw"); - break; - - case 6: xform_vls("lvsl"); break; - case 7: xform_vls("lvebx"); break; - case 8: xoform_dab("subfc"); break; - case 8+512: xoform_dab("subfco"); break; - case 9: case 9+512: xoform_dab("mulhdu"); break; // 64 bit - case 10: xoform_dab("addc"); break; - case 10+512: xoform_dab("addco"); break; - case 11: case 11+512: xoform_dab("mulhwu"); break; - case 19: xform_d("mfcr"); break; - case 20: xform_ls("lwarx"); break; - case 21: xform_ls("ldx"); break; // 64 bit - case 23: xform_ls("lwzx"); break; - case 24: xform_sabc("slw"); break; - case 26: xform_sac("cntlzw"); break; - case 27: xform_sabc("sld"); break; // 64 bit - case 28: xform_sabc("and"); break; - - case 32: - if (rd & 1) - xform_crlab("cmpld"); // 64 bit - else - xform_crlab("cmplw"); - break; - - case 38: xform_vls("lvsr"); break; - case 39: xform_vls("lvehx"); break; - case 40: xoform_dab("subf"); break; - case 40+512: xoform_dab("subfo"); break; - case 53: xform_ls("ldux"); break; // 64 bit - case 54: xform_ab("dcbst"); break; - case 55: xform_ls("lwzux"); break; - case 58: xform_sac("cntlzd"); break; // 64 bit - case 60: xform_sabc("andc"); break; - - case 68: // 64 bit - if (to_code[rd] != NULL) - fprintf(f, "td%s\tr%d,r%d\n", to_code[rd], ra, rb); - else - xform_to("td"); - break; - - case 71: xform_vls("lvewx"); break; - case 73: case 73+512: xoform_dab("mulhd"); break; // 64 bit - case 75: case 75+512: xoform_dab("mulhw"); break; - case 83: xform_d("mfmsr"); break; - case 84: xform_ls("ldarx"); break; // 64 bit - case 86: xform_ab("dcbf"); break; - case 87: xform_ls("lbzx"); break; - case 103: xform_vls("lvx"); break; - case 104: xoform_da("neg"); break; - case 104+512: xoform_da("nego"); break; - case 119: xform_ls("lbzux"); break; - - case 124: - if (rd == rb) - fprintf(f, "not%s\tr%d,r%d\n", w & 1 ? "." : "", ra, rd); - else - xform_sabc("nor"); - break; - - case 135: xform_vls("stvebx"); break; - case 136: xoform_dab("subfe"); break; - case 136+512: xoform_dab("subfeo"); break; - case 138: xoform_dab("adde"); break; - case 138+512: xoform_dab("addeo"); break; - case 144: xfxform_crm("mtcrf"); break; - case 146: xform_d("mtmsr"); break; - case 149: xform_ls("stdx"); break; // 64 bit - - case 150: - if (w & 1) - xform_ls("stwcx."); - else - fprintf(f, "?\n"); - break; - - case 151: xform_ls("stwx"); break; - case 167: xform_vls("stvehx"); break; - case 181: xform_ls("stdux"); break; // 64 bit - case 183: xform_ls("stwux"); break; - case 199: xform_vls("stvewx"); break; - case 200: xoform_da("subfze"); break; - case 200+512: xoform_da("subfzeo"); break; - case 202: xoform_da("addze"); break; - case 202+512: xoform_da("addzeo"); break; - case 210: xform_tsr("mtsr"); break; - - case 214: // 64 bit - if (w & 1) - xform_ls("stdcx"); - else - fprintf(f, "?\n"); - break; - - case 215: xform_ls("stbx"); break; - case 231: xform_vls("stvx"); break; - case 232: xoform_da("subfme"); break; - case 232+512: xoform_da("subfmeo"); break; - case 233: xoform_dab("mulld"); break; // 64 bit - case 233+512: xoform_dab("mulldo"); break; // 64 bit - case 234: xoform_da("addme"); break; - case 234+512: xoform_da("addmeo"); break; - case 235: xoform_dab("mullw"); break; - case 235+512: xoform_dab("mullwo"); break; - case 242: xform_db("mtsrin"); break; - case 246: xform_ab("dcbtst"); break; - case 247: xform_ls("stbux"); break; - case 266: xoform_dab("add"); break; - case 266+512: xoform_dab("addo"); break; - case 278: xform_ab("dcbt"); break; - case 279: xform_ls("lhzx"); break; - case 284: xform_sabc("eqv"); break; - case 306: xform_b("tlbie"); break; - case 310: xform_ls("eciwx"); break; - case 311: xform_ls("lhzux"); break; - case 316: xform_sabc("xor"); break; - - case 339: - if ((ra | (rb << 5)) == 1) - fprintf(f, "mfxer\tr%d\n", rd); - else if ((ra | (rb << 5)) == 8) - fprintf(f, "mflr\tr%d\n", rd); - else if ((ra | (rb << 5)) == 9) - fprintf(f, "mfctr\tr%d\n", rd); - else if ((ra | (rb << 5)) == 256) - fprintf(f, "mfvrsave\tr%d\n", rd); - else { - char *spr = get_spr(ra | (rb << 5)); - if (spr) - fprintf(f, "mfspr\tr%d,%s\n", rd, spr); - else - xfxform_fspr("mfspr"); - } - break; - - case 341: xform_ls("lwax"); break; // 64 bit - case 343: xform_ls("lhax"); break; - case 359: xform_vls("lvxl"); break; - case 370: xform("tlbia"); break; - - case 822: // AltiVec - if ((rd & 0xc) == 0 && ra == 0 && rb == 0 && (w & 1) == 0) { - if (rd & 0x10) - fprintf(f, "dssall\n"); - else - fprintf(f, "dss\t%d\n", rd & 3); - } - else - fprintf(f, "?\n"); - break; - - case 342: // AltiVec - if ((rd & 0xc) == 0 && (w & 1) == 0) - fprintf(f, "dst%s\tr%d,r%d,%d\n", rd & 0x10 ? "t" : "", ra, rb, rd & 3); - else - fprintf(f, "?\n"); - break; - - case 374: // AltiVec - if ((rd & 0xc) == 0 && (w & 1) == 0) - fprintf(f, "dstst%s\tr%d,r%d,%d\n", rd & 0x10 ? "t" : "", ra, rb, rd & 3); - else - fprintf(f, "?\n"); - break; - - case 371: - if ((ra | (rb << 5)) == 268) - xfxform_tb("mftb"); - else if ((ra | (rb << 5)) == 269) - xfxform_tb("mftbu"); - else - fprintf(f, "?\n"); - break; - - case 373: xform_ls("lwaux"); break; // 64 bit - case 375: xform_ls("lhaux"); break; - case 407: xform_ls("sthx"); break; - case 412: xform_sabc("orc"); break; - case 434: xform_b("slbie"); break; // 64 bit - case 438: xform_ls("ecowx"); break; - case 439: xform_ls("sthux"); break; - - case 444: - if (rd == rb) - fprintf(f, "mr%s\tr%d,r%d\n", w & 1 ? "." : "", ra, rd); - else - xform_sabc("or"); - break; - - case 457: xoform_dab("divdu"); break; // 64 bit - case 457+512: xoform_dab("divduo"); break; // 64 bit - case 459: xoform_dab("divwu"); break; - case 459+512: xoform_dab("divwuo"); break; - - case 467: - if ((ra | (rb << 5)) == 1) - fprintf(f, "mtxer\tr%d\n", rd); - else if ((ra | (rb << 5)) == 8) - fprintf(f, "mtlr\tr%d\n", rd); - else if ((ra | (rb << 5)) == 9) - fprintf(f, "mtctr\tr%d\n", rd); - else if ((ra | (rb << 5)) == 256) - fprintf(f, "mtvrsave\tr%d\n", rd); - else { - char *spr = get_spr(ra | (rb << 5)); - if (spr) - fprintf(f, "mtspr\t%s,r%d\n", spr, rd); - else - xfxform_tspr("mtspr"); - } - break; - - case 470: xform_ab("dcbi"); break; - case 476: xform_sabc("nand"); break; - case 487: xform_vls("stvxl"); break; - case 489: xoform_dab("divd"); break; // 64 bit - case 489+512: xoform_dab("divdo"); break; // 64 bit - case 491: xoform_dab("divw"); break; - case 491+512: xoform_dab("divwo"); break; - case 498: xform("slbia"); break; // 64 bit - case 512: xform_cr("mcrxr"); break; - case 533: xform_ls("lswx"); break; - case 534: xform_ls("lwbrx"); break; - case 535: xform_fls("lfsx"); break; - case 536: xform_sabc("srw"); break; - case 539: xform_sabc("srd"); break; // 64 bit - case 566: xform("tlbsync"); break; - case 567: xform_fls("lfsux"); break; - case 595: xform_fsr("mfsr"); break; - case 597: xform_lsswi("lswi"); break; - case 598: xform("sync"); break; - case 599: xform_fls("lfdx"); break; - case 631: xform_fls("lfdux"); break; - case 659: xform_db("mfsrin"); break; - case 661: xform_ls("stswx"); break; - case 662: xform_ls("stwbrx"); break; - case 663: xform_fls("stfsx"); break; - case 695: xform_fls("stfsux"); break; - case 725: xform_lsswi("stswi"); break; - case 727: xform_fls("stfdx"); break; - case 758: xform_ab("dcba"); break; - case 759: xform_fls("stfdux"); break; - case 790: xform_ls("lhbrx"); break; - case 792: xform_sabc("sraw"); break; - case 794: xform_sabc("srad"); break; // 64 bit - case 824: xform_sash("srawi"); break; - case 826: case 827: xsform("sradi"); break; // 64 bit - case 854: xform("eieio"); break; - case 918: xform_ls("sthbrx"); break; - case 922: xform_sac("extsh"); break; - case 954: xform_sac("extsb"); break; - case 978: fprintf(f, "tlbld\tr%d\n", rb); break; // 603 - case 982: xform_ab("icbi"); break; - case 983: xform_fls("stfiwx"); break; - case 986: xform_sac("extsw"); break; // 64 bit - case 1010: fprintf(f, "tlbli\tr%d\n", rb); break; // 603 - case 1014: xform_ab("dcbz"); break; - - default: - fprintf(f, "?\n"); - break; - } -} - - -/* - * Disassemble instruction with primary opcode = 59 (A-Form) - */ - -static void disass59(FILE *f, unsigned int adr, unsigned int w) -{ - switch (exop & 0x1f) { - case 18: aform_dab("fdivs"); break; - case 20: aform_dab("fsubs"); break; - case 21: aform_dab("fadds"); break; - case 22: aform_db("fsqrts"); break; - case 24: aform_db("fres"); break; - case 25: aform_dac("fmuls"); break; - case 28: aform_dacb("fmsubs"); break; - case 29: aform_dacb("fmadds"); break; - case 30: aform_dacb("fnmsubs"); break; - case 31: aform_dacb("fnmadds"); break; - - default: - fprintf(f, "?\n"); - break; - } -} - - -/* - * Disassemble instruction with primary opcode = 63 (A-Form/X-Form/XFL-Form) - */ - -static void disass63(FILE *f, unsigned int adr, unsigned int w) -{ - if (exop & 0x10) - switch (exop & 0x1f) { - case 18: aform_dab("fdiv"); break; - case 20: aform_dab("fsub"); break; - case 21: aform_dab("fadd"); break; - case 22: aform_db("fsqrt"); break; - case 23: aform_dacb("fsel"); break; - case 25: aform_dac("fmul"); break; - case 26: aform_db("frsqrte"); break; - case 28: aform_dacb("fmsub"); break; - case 29: aform_dacb("fmadd"); break; - case 30: aform_dacb("fnmsub"); break; - case 31: aform_dacb("fnmadd"); break; - - default: - fprintf(f, "?\n"); - break; - } - else - switch (exop) { - case 0: xform_fcrab("fcmpu"); break; - case 12: xform_fdb("frsp"); break; - case 14: xform_fdb("fctiw"); break; - case 15: xform_fdb("fctiwz"); break; - case 32: xform_fcrab("fcmpo"); break; - case 38: xform_crb("mtfsb1"); break; - case 40: xform_fdb("fneg"); break; - case 64: xform_crcr("mcrfs"); break; - case 70: xform_crb("mtfsb0"); break; - case 72: xform_fdb("fmr"); break; - case 134: xform_cri("mtfsfi"); break; - case 136: xform_fdb("fnabs"); break; - case 264: xform_fdb("fabs"); break; - case 583: xform_fd("mffs"); break; - case 711: xflform("mtfsf"); break; - case 814: xform_fdb("fctid"); break; // 64 bit - case 815: xform_fdb("fctidz"); break; // 64 bit - case 846: xform_fdb("fcfid"); break; // 64 bit - - default: - fprintf(f, "?\n"); - break; - } -} - - -/* - * Convert mask begin/end to mask - */ - -static unsigned int mbme2mask(int mb, int me) -{ - unsigned int m = 0; - int i; - - if (mb <= me) - for (i=mb; i<=me; i++) - m |= 1 << (31-i); - else { - for (i=0; i<=me; i++) - m |= 1 << (31-i); - for (i=mb; i<=31; i++) - m |= 1 << (31-i); - } - return m; -} - - -/* - * Convert SPR number to register name - */ - -char *get_spr(int reg) -{ - switch (reg) { - case 1: return "xer"; - case 8: return "lr"; - case 9: return "ctr"; - case 18: return "dsisr"; - case 19: return "dar"; - case 22: return "dec"; - case 25: return "sdr1"; - case 26: return "srr0"; - case 27: return "srr1"; - case 272: return "sprg0"; - case 273: return "sprg1"; - case 274: return "sprg2"; - case 275: return "sprg3"; - case 280: return "asr"; // 64 bit - case 282: return "ear"; - case 284: return "tbl"; - case 285: return "tbu"; - case 287: return "pvr"; - case 528: return "ibat0u"; - case 529: return "ibat0l"; - case 530: return "ibat1u"; - case 531: return "ibat1l"; - case 532: return "ibat2u"; - case 533: return "ibat2l"; - case 534: return "ibat3u"; - case 535: return "ibat3l"; - case 536: return "dbat0u"; - case 537: return "dbat0l"; - case 538: return "dbat1u"; - case 539: return "dbat1l"; - case 540: return "dbat2u"; - case 541: return "dbat2l"; - case 542: return "dbat3u"; - case 543: return "dbat3l"; - case 1013: return "dabr"; - - case 0: return "mq"; // 601 - case 4: return "rtcu"; // 601 - case 5: return "rtcl"; // 601 - case 20: return "rtcu"; // 601 - case 21: return "rtcl"; // 601 - case 952: return "mmcr0"; // 604 - case 953: return "pmc1"; // 604 - case 954: return "pmc2"; // 604 - case 955: return "sia"; // 604 - case 956: return "mmcr1"; // 604e - case 957: return "pmc3"; // 604e - case 958: return "pmc4"; // 604e - case 959: return "sda"; // 604 - case 976: return "dmiss"; // 603 - case 977: return "dcmp"; // 603 - case 978: return "hash1"; // 603 - case 979: return "hash2"; // 603 - case 980: return "imiss"; // 603 - case 981: return "icmp"; // 603 - case 982: return "rpa"; // 603 - case 1008: return "hid0"; // 601/603/604 - case 1009: return "hid1"; // 601/603/604e - case 1010: return "iabr"; // 601/603 - case 1023: return "pir"; // 601/604 - - case 256: return "vrsave"; // AltiVec - - default: return NULL; - } -} diff --git a/cxmon/src/mon_z80.cpp b/cxmon/src/mon_z80.cpp deleted file mode 100644 index b103f5f0..00000000 --- a/cxmon/src/mon_z80.cpp +++ /dev/null @@ -1,604 +0,0 @@ -/* - * mon_z80.cpp - Z80 disassembler - * - * cxmon (C) 1997-2007 Christian Bauer, Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" - -#include - -#include "mon.h" -#include "mon_disass.h" - - -// Addressing modes -enum AddrMode { - A_IMPL, - A_IMM8, // xx - A_IMM16, // xxxx - A_ABS8, // (xx) - A_ABS16, // (xxxx) - A_REL, // relative - A_A, // a - A_HL, // hl or ix or iy - A_SP, // sp - A_REG1, // 8-bit register (bits 0..2 of opcode) or (hl)/(ix+d)/(iy+d) - A_REG1X, // 8-bit register (bits 0..2 of opcode) or (hl)/(ix+d)/(iy+d), don't substitute h or l on prefixes - A_REG2, // 8-bit register (bits 3..5 of opcode) or (hl)/(ix+d)/(iy+d) - A_REG2X, // 8-bit register (bits 3..5 of opcode) or (hl)/(ix+d)/(iy+d), don't substitute h or l on prefixes - A_REG3, // 16-bit register (bits 4..5 of opcode) bc/de/hl/sp - A_REG4, // 16-bit register (bits 4..5 of opcode) bc/de/hl/af - A_COND, // condition code (bits 3..5 of opcode) - A_COND2, // condition code (bits 3..4 of opcode) - A_BIT, // bit number (bits 3..5 of opcode) - A_BIT_REG1, // bit number (bits 3..5 of opcode) followed by 8-bit register (bits 0..2 of opcode) - A_RST, // restart - A_BC_IND, // (bc) - A_DE_IND, // (de) - A_HL_IND, // (hl) or (ix) or (iy) - A_XY_IND, // (ix+d) or (iy+d) - A_SP_IND, // (sp) - A_DE_HL, // de,hl - A_AF_AF, // af,af' -}; - -// Mnemonics -enum Mnemonic { - M_ADC, M_ADD, M_AND, M_BIT, M_CALL, M_CCF, M_CP, M_CPD, M_CPDR, M_CPI, - M_CPIR, M_CPL, M_DAA, M_DEC, M_DI, M_DJNZ, M_EI, M_EX, M_EXX, M_HALT, - M_IM0, M_IM1, M_IM2, M_IN, M_INC, M_IND, M_INDR, M_INI, M_INIR, M_JP, - M_JR, M_LD, M_LDD, M_LDDR, M_LDI, M_LDIR, M_NEG, M_NOP, M_OR, M_OTDR, - M_OTIR, M_OUT, M_OUTD, M_OUTI, M_POP, M_PUSH, M_RES, M_RET, M_RETI, - M_RETN, M_RL, M_RLA, M_RLC, M_RLCA, M_RLD, M_RR, M_RRA, M_RRC, M_RRCA, - M_RRD, M_RST, M_SBC, M_SCF, M_SET, M_SL1, M_SLA, M_SRA, M_SRL, M_SUB, - M_XOR, - M_ILLEGAL, - - M_MAXIMUM -}; - -// Chars for each mnemonic -static const char mnem_1[] = "aaabccccccccddddeeehiiiiiiiiijjlllllnnoooooopprrrrrrrrrrrrrrrssssssssx?"; -static const char mnem_2[] = "ddniacppppppaeijixxammmnnnnnnprdddddeorttuuuoueeeelllllrrrrrsbcellrruo "; -static const char mnem_3[] = "cddtlf ddiilac n xl cddii ddiigp ditttpssttt accd accdtcft1aalbr "; -static const char mnem_4[] = " l r r z t012 r r r r rr di h in a a "; - -// Mnemonic for each opcode -static const Mnemonic mnemonic[256] = { - M_NOP , M_LD , M_LD , M_INC , M_INC , M_DEC , M_LD , M_RLCA, // 00 - M_EX , M_ADD, M_LD , M_DEC , M_INC , M_DEC , M_LD , M_RRCA, - M_DJNZ, M_LD , M_LD , M_INC , M_INC , M_DEC , M_LD , M_RLA , // 10 - M_JR , M_ADD, M_LD , M_DEC , M_INC , M_DEC , M_LD , M_RRA , - M_JR , M_LD , M_LD , M_INC , M_INC , M_DEC , M_LD , M_DAA , // 20 - M_JR , M_ADD, M_LD , M_DEC , M_INC , M_DEC , M_LD , M_CPL , - M_JR , M_LD , M_LD , M_INC , M_INC , M_DEC , M_LD , M_SCF , // 30 - M_JR , M_ADD, M_LD , M_DEC , M_INC , M_DEC , M_LD , M_CCF , - M_LD , M_LD , M_LD , M_LD , M_LD , M_LD , M_LD , M_LD , // 40 - M_LD , M_LD , M_LD , M_LD , M_LD , M_LD , M_LD , M_LD , - M_LD , M_LD , M_LD , M_LD , M_LD , M_LD , M_LD , M_LD , // 50 - M_LD , M_LD , M_LD , M_LD , M_LD , M_LD , M_LD , M_LD , - M_LD , M_LD , M_LD , M_LD , M_LD , M_LD , M_LD , M_LD , // 60 - M_LD , M_LD , M_LD , M_LD , M_LD , M_LD , M_LD , M_LD , - M_LD , M_LD , M_LD , M_LD , M_LD , M_LD , M_HALT, M_LD , // 70 - M_LD , M_LD , M_LD , M_LD , M_LD , M_LD , M_LD , M_LD , - M_ADD , M_ADD, M_ADD, M_ADD , M_ADD , M_ADD , M_ADD , M_ADD , // 80 - M_ADC , M_ADC, M_ADC, M_ADC , M_ADC , M_ADC , M_ADC , M_ADC , - M_SUB , M_SUB, M_SUB, M_SUB , M_SUB , M_SUB , M_SUB , M_SUB , // 90 - M_SBC , M_SBC, M_SBC, M_SBC , M_SBC , M_SBC , M_SBC , M_SBC , - M_AND , M_AND, M_AND, M_AND , M_AND , M_AND , M_AND , M_AND , // a0 - M_XOR , M_XOR, M_XOR, M_XOR , M_XOR , M_XOR , M_XOR , M_XOR , - M_OR , M_OR , M_OR , M_OR , M_OR , M_OR , M_OR , M_OR , // b0 - M_CP , M_CP , M_CP , M_CP , M_CP , M_CP , M_CP , M_CP , - M_RET , M_POP, M_JP , M_JP , M_CALL, M_PUSH , M_ADD , M_RST , // c0 - M_RET , M_RET, M_JP , M_ILLEGAL, M_CALL, M_CALL , M_ADC , M_RST , - M_RET , M_POP, M_JP , M_OUT , M_CALL, M_PUSH , M_SUB , M_RST , // d0 - M_RET , M_EXX, M_JP , M_IN , M_CALL, M_ILLEGAL, M_SBC , M_RST , - M_RET , M_POP, M_JP , M_EX , M_CALL, M_PUSH , M_AND , M_RST , // e0 - M_RET , M_JP , M_JP , M_EX , M_CALL, M_ILLEGAL, M_XOR , M_RST , - M_RET , M_POP, M_JP , M_DI , M_CALL, M_PUSH , M_OR , M_RST , // f0 - M_RET , M_LD , M_JP , M_EI , M_CALL, M_ILLEGAL, M_CP , M_RST -}; - -// Source/destination addressing modes for each opcode -#define A(d,s) (((A_ ## d) << 8) | (A_ ## s)) - -static const int adr_mode[256] = { - A(IMPL,IMPL) , A(REG3,IMM16) , A(BC_IND,A) , A(REG3,IMPL) , A(REG2,IMPL) , A(REG2,IMPL) , A(REG2,IMM8) , A(IMPL,IMPL) , // 00 - A(AF_AF,IMPL) , A(HL,REG3) , A(A,BC_IND) , A(REG3,IMPL) , A(REG2,IMPL) , A(REG2,IMPL) , A(REG2,IMM8) , A(IMPL,IMPL) , - A(REL,IMPL) , A(REG3,IMM16) , A(DE_IND,A) , A(REG3,IMPL) , A(REG2,IMPL) , A(REG2,IMPL) , A(REG2,IMM8) , A(IMPL,IMPL) , // 10 - A(REL,IMPL) , A(HL,REG3) , A(A,DE_IND) , A(REG3,IMPL) , A(REG2,IMPL) , A(REG2,IMPL) , A(REG2,IMM8) , A(IMPL,IMPL) , - A(COND2,REL) , A(REG3,IMM16) , A(ABS16,HL) , A(REG3,IMPL) , A(REG2,IMPL) , A(REG2,IMPL) , A(REG2,IMM8) , A(IMPL,IMPL) , // 20 - A(COND2,REL) , A(HL,REG3) , A(HL,ABS16) , A(REG3,IMPL) , A(REG2,IMPL) , A(REG2,IMPL) , A(REG2,IMM8) , A(IMPL,IMPL) , - A(COND2,REL) , A(REG3,IMM16) , A(ABS16,A) , A(REG3,IMPL) , A(REG2,IMPL) , A(REG2,IMPL) , A(REG2,IMM8) , A(IMPL,IMPL) , // 30 - A(COND2,REL) , A(HL,REG3) , A(A,ABS16) , A(REG3,IMPL) , A(REG2,IMPL) , A(REG2,IMPL) , A(REG2,IMM8) , A(IMPL,IMPL) , - A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2X,REG1), A(REG2,REG1) , // 40 - A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2X,REG1), A(REG2,REG1) , - A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2X,REG1), A(REG2,REG1) , // 50 - A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2X,REG1), A(REG2,REG1) , - A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2X,REG1), A(REG2,REG1) , // 60 - A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2X,REG1), A(REG2,REG1) , - A(REG2,REG1X) , A(REG2,REG1X) , A(REG2,REG1X), A(REG2,REG1X), A(REG2,REG1X), A(REG2,REG1X), A(IMPL,IMPL) , A(REG2,REG1X), // 70 - A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2,REG1) , A(REG2X,REG1), A(REG2,REG1) , - A(A,REG1) , A(A,REG1) , A(A,REG1) , A(A,REG1) , A(A,REG1) , A(A,REG1) , A(A,REG1) , A(A,REG1) , // 80 - A(A,REG1) , A(A,REG1) , A(A,REG1) , A(A,REG1) , A(A,REG1) , A(A,REG1) , A(A,REG1) , A(A,REG1) , - A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , // 90 - A(A,REG1) , A(A,REG1) , A(A,REG1) , A(A,REG1) , A(A,REG1) , A(A,REG1) , A(A,REG1) , A(A,REG1) , - A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , // a0 - A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , - A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , // b0 - A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , A(REG1,IMPL) , - A(COND,IMPL) , A(REG4,IMPL) , A(COND,IMM16), A(IMM16,IMPL), A(COND,IMM16), A(REG4,IMPL) , A(A,IMM8) , A(RST,IMPL) , // c0 - A(COND,IMPL) , A(IMPL,IMPL) , A(COND,IMM16), A(IMPL,IMPL) , A(COND,IMM16), A(IMM16,IMPL), A(A,IMM8) , A(RST,IMPL) , - A(COND,IMPL) , A(REG4,IMPL) , A(COND,IMM16), A(ABS8,A) , A(COND,IMM16), A(REG4,IMPL) , A(IMM8,IMPL) , A(RST,IMPL) , // d0 - A(COND,IMPL) , A(IMPL,IMPL) , A(COND,IMM16), A(A,ABS8) , A(COND,IMM16), A(IMPL,IMPL) , A(A,IMM8) , A(RST,IMPL) , - A(COND,IMPL) , A(REG4,IMPL) , A(COND,IMM16), A(SP_IND,HL) , A(COND,IMM16), A(REG4,IMPL) , A(IMM8,IMPL) , A(RST,IMPL) , // e0 - A(COND,IMPL) , A(HL_IND,IMPL), A(COND,IMM16), A(DE_HL,IMPL), A(COND,IMM16), A(IMPL,IMPL) , A(IMM8,IMPL) , A(RST,IMPL) , - A(COND,IMPL) , A(REG4,IMPL) , A(COND,IMM16), A(IMPL,IMPL) , A(COND,IMM16), A(REG4,IMPL) , A(IMM8,IMPL) , A(RST,IMPL) , // f0 - A(COND,IMPL) , A(SP,HL) , A(COND,IMM16), A(IMPL,IMPL) , A(COND,IMM16), A(IMPL,IMPL) , A(IMM8,IMPL) , A(RST,IMPL) -}; - - -/* - * sprintf into a "stream" - */ - -struct SFILE { - char *buffer; - char *current; -}; - -static int mon_sprintf(SFILE *f, const char *format, ...) -{ - int n; - va_list args; - va_start(args, format); - vsprintf(f->current, format, args); - f->current += n = strlen(f->current); - va_end(args); - return n; -} - - -/* - * Disassemble one instruction, return number of bytes - */ - -static const char *reg_name[] = {"b", "c", "d", "e", "h", "l", "*", "a"}; -static const char *reg_name_ix[] = {"b", "c", "d", "e", "hx", "lx", "*", "a"}; // undoc -static const char *reg_name_iy[] = {"b", "c", "d", "e", "hy", "ly", "*", "a"}; // undoc -static const char *reg_name_16[] = {"bc", "de", "hl", "sp"}; -static const char *reg_name_16_2[] = {"bc", "de", "hl", "af"}; -static const char *cond_name[] = {"nz", "z", "nc", "c", "po", "pe", "p", "m"}; - -static void operand(SFILE *f, char mode, uint32 &adr, uint8 op, bool ix, bool iy) -{ - switch (mode) { - case A_IMPL: - break; - - case A_IMM8: - mon_sprintf(f, "$%02x", mon_read_byte(adr)); adr++; - break; - - case A_IMM16: - mon_sprintf(f, "$%04x", (mon_read_byte(adr + 1) << 8) | mon_read_byte(adr)); adr += 2; - break; - - case A_ABS8: - mon_sprintf(f, "($%02x)", mon_read_byte(adr)); adr++; - break; - - case A_ABS16: - mon_sprintf(f, "($%04x)", (mon_read_byte(adr + 1) << 8) | mon_read_byte(adr)); adr += 2; - break; - - case A_REL: - mon_sprintf(f, "$%04x", (adr + 1 + (int8)mon_read_byte(adr)) & 0xffff); adr++; - break; - - case A_A: - mon_sprintf(f, "a"); - break; - - case A_HL: - mon_sprintf(f, ix ? "ix" : (iy ? "iy" : "hl")); - break; - - case A_SP: - mon_sprintf(f, "sp"); - break; - - case A_REG1: - case A_REG1X: { - int reg = op & 7; - if (reg == 6) { - if (ix || iy) { - mon_sprintf(f, "(%s+$%02x)", ix ? "ix" : "iy", mon_read_byte(adr)); adr++; - } else { - mon_sprintf(f, "(hl)"); - } - } else if (mode == A_REG1) { - mon_sprintf(f, "%s", ix ? reg_name_ix[reg] : (iy ? reg_name_iy[reg] : reg_name[reg])); - } else { - mon_sprintf(f, "%s", reg_name[reg]); - } - break; - } - - case A_REG2: - case A_REG2X: { - int reg = (op >> 3) & 7; - if (reg == 6) { - if (ix || iy) { - mon_sprintf(f, "(%s+$%02x)", ix ? "ix" : "iy", mon_read_byte(adr)); adr++; - } else { - mon_sprintf(f, "(hl)"); - } - } else if (mode == A_REG2) { - mon_sprintf(f, "%s", ix ? reg_name_ix[reg] : (iy ? reg_name_iy[reg] : reg_name[reg])); - } else { - mon_sprintf(f, "%s", reg_name[reg]); - } - break; - } - - case A_REG3: { - int reg = (op >> 4) & 3; - if (reg == 2 && (ix || iy)) { - mon_sprintf(f, ix ? "ix" : "iy"); - } else { - mon_sprintf(f, reg_name_16[reg]); - } - break; - } - - case A_REG4: { - int reg = (op >> 4) & 3; - if (reg == 2 && (ix || iy)) { - mon_sprintf(f, ix ? "ix" : "iy"); - } else { - mon_sprintf(f, reg_name_16_2[reg]); - } - break; - } - - case A_COND: - mon_sprintf(f, cond_name[(op >> 3) & 7]); - break; - - case A_COND2: - mon_sprintf(f, cond_name[(op >> 3) & 3]); - break; - - case A_BIT: - mon_sprintf(f, "%d", (op >> 3) & 7); - break; - - case A_BIT_REG1: { // undoc - int reg = op & 7; - if (reg == 6) { - mon_sprintf(f, "%d", (op >> 3) & 7); - } else { - mon_sprintf(f, "%d,%s", (op >> 3) & 7, reg_name[reg]); - } - break; - } - - case A_RST: - mon_sprintf(f, "$%02x", op & 0x38); - break; - - case A_BC_IND: - mon_sprintf(f, "(bc)"); - break; - - case A_DE_IND: - mon_sprintf(f, "(de)"); - break; - - case A_HL_IND: - mon_sprintf(f, ix ? "(ix)" : (iy ? "(iy)" : "(hl)")); - break; - - case A_XY_IND: // undoc - mon_sprintf(f, "(%s+$%02x)", ix ? "ix" : "iy", mon_read_byte(adr)); adr++; - break; - - case A_SP_IND: - mon_sprintf(f, "(sp)"); - break; - - case A_DE_HL: - mon_sprintf(f, "de,hl"); - break; - - case A_AF_AF: - mon_sprintf(f, "af,af'"); - break; - } -} - -static int print_instr(SFILE *f, Mnemonic mnem, AddrMode dst_mode, AddrMode src_mode, uint32 adr, uint8 op, bool ix, bool iy) -{ - uint32 orig_adr = adr; - - // Print mnemonic - mon_sprintf(f, "%c%c%c%c ", mnem_1[mnem], mnem_2[mnem], mnem_3[mnem], mnem_4[mnem]); - - // Print destination operand - operand(f, dst_mode, adr, op, ix, iy); - - // Print source operand - if (src_mode != A_IMPL) - mon_sprintf(f, ","); - operand(f, src_mode, adr, op, ix, iy); - - return adr - orig_adr; -} - -static int disass_cb(SFILE *f, uint32 adr, bool ix, bool iy) -{ - int num; - - // Fetch opcode - uint8 op; - if (ix || iy) { - op = mon_read_byte(adr + 1); - num = 2; - } else { - op = mon_read_byte(adr); - num = 1; - } - - // Decode mnemonic and addressing modes - Mnemonic mnem = M_ILLEGAL; - AddrMode dst_mode = A_IMPL, src_mode = A_IMPL; - - switch (op & 0xc0) { - case 0x00: - dst_mode = A_REG1X; - if ((ix || iy) && ((op & 7) != 6)) - src_mode = A_XY_IND; - switch ((op >> 3) & 7) { - case 0: mnem = M_RLC; break; - case 1: mnem = M_RRC; break; - case 2: mnem = M_RL; break; - case 3: mnem = M_RR; break; - case 4: mnem = M_SLA; break; - case 5: mnem = M_SRA; break; - case 6: mnem = M_SL1; break; // undoc - case 7: mnem = M_SRL; break; - } - break; - case 0x40: - mnem = M_BIT; dst_mode = A_BIT; - if (ix || iy) - src_mode = A_XY_IND; - else - src_mode = A_REG1; - break; - case 0x80: - mnem = M_RES; - if (ix || iy) { - dst_mode = A_BIT_REG1; - src_mode = A_XY_IND; - } else { - dst_mode = A_BIT; - src_mode = A_REG1; - } - break; - case 0xc0: - mnem = M_SET; - if (ix || iy) { - dst_mode = A_BIT_REG1; - src_mode = A_XY_IND; - } else { - dst_mode = A_BIT; - src_mode = A_REG1; - } - break; - } - - // Print instruction - print_instr(f, mnem, dst_mode, src_mode, adr, op, ix, iy); - return num; -} - -static int disass_ed(SFILE *f, uint32 adr) -{ - // Fetch opcode - uint8 op = mon_read_byte(adr); - - // Decode mnemonic and addressing modes - Mnemonic mnem; - AddrMode dst_mode = A_IMPL, src_mode = A_IMPL; - - switch (op) { - case 0x40: - case 0x48: - case 0x50: - case 0x58: - case 0x60: - case 0x68: - case 0x78: - mon_sprintf(f, "in %s,(c)", reg_name[(op >> 3) & 7]); - return 1; - case 0x70: - mon_sprintf(f, "in (c)"); - return 1; - - case 0x41: - case 0x49: - case 0x51: - case 0x59: - case 0x61: - case 0x69: - case 0x79: - mon_sprintf(f, "out (c),%s", reg_name[(op >> 3) & 7]); - return 1; - case 0x71: // undoc - mon_sprintf(f, "out (c),0"); - return 1; - - case 0x42: - case 0x52: - case 0x62: - case 0x72: - mnem = M_SBC; dst_mode = A_HL; src_mode = A_REG3; - break; - - case 0x43: - case 0x53: - case 0x63: - case 0x73: - mnem = M_LD; dst_mode = A_ABS16; src_mode = A_REG3; - break; - - case 0x4a: - case 0x5a: - case 0x6a: - case 0x7a: - mnem = M_ADC; dst_mode = A_HL; src_mode = A_REG3; - break; - - case 0x4b: - case 0x5b: - case 0x6b: - case 0x7b: - mnem = M_LD; dst_mode = A_REG3; src_mode = A_ABS16; - break; - - case 0x44: - case 0x4c: // undoc - case 0x54: // undoc - case 0x5c: // undoc - case 0x64: // undoc - case 0x6c: // undoc - case 0x74: // undoc - case 0x7c: // undoc - mnem = M_NEG; - break; - - case 0x45: - case 0x55: // undoc - case 0x5d: // undoc - case 0x65: // undoc - case 0x6d: // undoc - case 0x75: // undoc - case 0x7d: // undoc - mnem = M_RETN; - break; - case 0x4d: mnem = M_RETI; break; - - case 0x46: - case 0x4e: // undoc - case 0x66: // undoc - case 0x6e: // undoc - mnem = M_IM0; - break; - case 0x56: - case 0x76: // undoc - mnem = M_IM1; - break; - case 0x5e: - case 0x7e: // undoc - mnem = M_IM2; - break; - - case 0x47: - mon_sprintf(f, "ld i,a"); - return 1; - case 0x4f: - mon_sprintf(f, "ld r,a"); - return 1; - case 0x57: - mon_sprintf(f, "ld a,i"); - return 1; - case 0x5f: - mon_sprintf(f, "ld a,r"); - return 1; - - case 0x67: mnem = M_RRD; break; - case 0x6f: mnem = M_RLD; break; - - case 0xa0: mnem = M_LDI; break; - case 0xa1: mnem = M_CPI; break; - case 0xa2: mnem = M_INI; break; - case 0xa3: mnem = M_OUTI; break; - case 0xa8: mnem = M_LDD; break; - case 0xa9: mnem = M_CPD; break; - case 0xaa: mnem = M_IND; break; - case 0xab: mnem = M_OUTD; break; - case 0xb0: mnem = M_LDIR; break; - case 0xb1: mnem = M_CPIR; break; - case 0xb2: mnem = M_INIR; break; - case 0xb3: mnem = M_OTIR; break; - case 0xb8: mnem = M_LDDR; break; - case 0xb9: mnem = M_CPDR; break; - case 0xba: mnem = M_INDR; break; - case 0xbb: mnem = M_OTDR; break; - - default: - mnem = M_NOP; - break; - } - - // Print instruction - return print_instr(f, mnem, dst_mode, src_mode, adr + 1, op, false, false) + 1; -} - -static int disass(SFILE *f, uint32 adr, bool ix, bool iy) -{ - uint8 op = mon_read_byte(adr); - if (op == 0xcb) - return disass_cb(f, adr + 1, ix, iy) + 1; - else - return print_instr(f, mnemonic[op], AddrMode(adr_mode[op] >> 8), AddrMode(adr_mode[op] & 0xff), adr + 1, op, ix, iy) + 1; -} - -int disass_z80(FILE *f, uint32 adr) -{ - int num; - char buf[64]; - SFILE sfile = {buf, buf}; - - switch (mon_read_byte(adr)) { - case 0xdd: // ix prefix - num = disass(&sfile, adr + 1, true, false) + 1; - break; - case 0xed: - num = disass_ed(&sfile, adr + 1) + 1; - break; - case 0xfd: // iy prefix - num = disass(&sfile, adr + 1, false, true) + 1; - break; - default: - num = disass(&sfile, adr, false, false); - break; - } - - for (int i=0; i<4; i++) { - if (num > i) - fprintf(f, "%02x ", mon_read_byte(adr + i)); - else - fprintf(f, " "); - } - - fprintf(f, "\t%s\n", buf); - return num; -} diff --git a/cxmon/src/sysdeps.h b/cxmon/src/sysdeps.h deleted file mode 100644 index 2b40d17c..00000000 --- a/cxmon/src/sysdeps.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * sysdeps.h - System dependent definitions - * - * cxmon (C) 1997-2004 Christian Bauer, Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef SYSDEPS_H -#define SYSDEPS_H - -#ifndef __STDC__ -#error "Your compiler is not ANSI. Get a real one." -#endif - -#include "config.h" - -#ifndef STDC_HEADERS -#error "You don't have ANSI C header files." -#endif - -#ifdef HAVE_UNISTD_H -# include -# include -#endif - -#include -#include -#include - -/* Data types */ - -#ifdef __BEOS__ - -#include - -#else - -typedef unsigned char uint8; -typedef signed char int8; -#if SIZEOF_SHORT == 2 -typedef unsigned short uint16; -typedef short int16; -#elif SIZEOF_INT == 2 -typedef unsigned int uint16; -typedef int int16; -#else -#error "No 2 byte type, you lose." -#endif -#if SIZEOF_INT == 4 -typedef unsigned int uint32; -typedef int int32; -#elif SIZEOF_LONG == 4 -typedef unsigned long uint32; -typedef long int32; -#else -#error "No 4 byte type, you lose." -#endif -#if SIZEOF_LONG == 8 -typedef unsigned long uint64; -typedef long int64; -#define VAL64(a) (a ## l) -#define UVAL64(a) (a ## ul) -#elif SIZEOF_LONG_LONG == 8 -typedef unsigned long long uint64; -typedef long long int64; -#define VAL64(a) (a ## LL) -#define UVAL64(a) (a ## uLL) -#else -#error "No 8 byte type, you lose." -#endif -#if SIZEOF_VOID_P == 4 -typedef uint32 uintptr; -typedef int32 intptr; -#elif SIZEOF_VOID_P == 8 -typedef uint64 uintptr; -typedef int64 intptr; -#else -#error "Unsupported size of pointer" -#endif - -#endif // def __BEOS__ - -#endif