summaryrefslogtreecommitdiffstats
path: root/board/MAI
diff options
context:
space:
mode:
authorwdenk <wdenk>2003-06-27 21:31:46 +0000
committerwdenk <wdenk>2003-06-27 21:31:46 +0000
commit8bde7f776c77b343aca29b8c7b58464d915ac245 (patch)
tree20f1fd99975215e7c658454a15cdb4ed4694e2d4 /board/MAI
parent993cad9364c6b87ae429d1ed1130d8153f6f027e (diff)
downloadu-boot-8bde7f776c77b343aca29b8c7b58464d915ac245.tar.gz
u-boot-8bde7f776c77b343aca29b8c7b58464d915ac245.tar.xz
u-boot-8bde7f776c77b343aca29b8c7b58464d915ac245.zip
* Code cleanup:LABEL_2003_06_27_2340
- remove trailing white space, trailing empty lines, C++ comments, etc. - split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c) * Patches by Kenneth Johansson, 25 Jun 2003: - major rework of command structure (work done mostly by Michal Cendrowski and Joakim Kristiansen)
Diffstat (limited to 'board/MAI')
-rw-r--r--board/MAI/AmigaOneG3SE/AmigaOneG3SE.c83
-rw-r--r--board/MAI/AmigaOneG3SE/Makefile4
-rw-r--r--board/MAI/AmigaOneG3SE/articiaS.c4
-rw-r--r--board/MAI/AmigaOneG3SE/articiaS.h17
-rw-r--r--board/MAI/AmigaOneG3SE/articiaS_pci.c23
-rw-r--r--board/MAI/AmigaOneG3SE/board_asm_init.S27
-rw-r--r--board/MAI/AmigaOneG3SE/cmd_boota.c8
-rw-r--r--board/MAI/AmigaOneG3SE/config.mk3
-rw-r--r--board/MAI/AmigaOneG3SE/enet.c290
-rw-r--r--board/MAI/AmigaOneG3SE/flash_new.c17
-rw-r--r--board/MAI/AmigaOneG3SE/i8259.c8
-rw-r--r--board/MAI/AmigaOneG3SE/interrupts.c10
-rw-r--r--board/MAI/AmigaOneG3SE/macros.h56
-rw-r--r--board/MAI/AmigaOneG3SE/memio.S21
-rw-r--r--board/MAI/AmigaOneG3SE/memio.h10
-rw-r--r--board/MAI/AmigaOneG3SE/nvram.c3
-rw-r--r--board/MAI/AmigaOneG3SE/ps2kbd.c63
-rw-r--r--board/MAI/AmigaOneG3SE/ps2kbd.h4
-rw-r--r--board/MAI/AmigaOneG3SE/short_types.h2
-rw-r--r--board/MAI/AmigaOneG3SE/smbus.c46
-rw-r--r--board/MAI/AmigaOneG3SE/start.txt399
-rw-r--r--board/MAI/AmigaOneG3SE/u-boot.lds9
-rw-r--r--board/MAI/AmigaOneG3SE/usb_uhci.c5
-rw-r--r--board/MAI/AmigaOneG3SE/usb_uhci.h2
-rw-r--r--board/MAI/AmigaOneG3SE/via686.c18
-rw-r--r--board/MAI/AmigaOneG3SE/video.c26
-rw-r--r--board/MAI/bios_emulator/bios.c76
-rw-r--r--board/MAI/bios_emulator/glue.c29
-rw-r--r--board/MAI/bios_emulator/scitech/include/biosemu.h1
-rw-r--r--board/MAI/bios_emulator/scitech/include/event.h58
-rw-r--r--board/MAI/bios_emulator/scitech/include/pcilib.h31
-rw-r--r--board/MAI/bios_emulator/scitech/include/pm_help.h1
-rw-r--r--board/MAI/bios_emulator/scitech/include/pm_wctl.h1
-rw-r--r--board/MAI/bios_emulator/scitech/include/pmapi.h1
-rw-r--r--board/MAI/bios_emulator/scitech/include/pmimp.h1
-rw-r--r--board/MAI/bios_emulator/scitech/include/scitech.h54
-rw-r--r--board/MAI/bios_emulator/scitech/include/x86emu/regs.h42
-rw-r--r--board/MAI/bios_emulator/scitech/makedefs/common.mk1
-rw-r--r--board/MAI/bios_emulator/scitech/makedefs/gcc_linux.mk1
-rw-r--r--board/MAI/bios_emulator/scitech/makedefs/gcc_win32.mk1
-rw-r--r--board/MAI/bios_emulator/scitech/makedefs/qnx4.mk1
-rw-r--r--board/MAI/bios_emulator/scitech/makedefs/rules/gcc_beos.mk3
-rw-r--r--board/MAI/bios_emulator/scitech/makedefs/rules/gcc_linux.mk1
-rw-r--r--board/MAI/bios_emulator/scitech/makedefs/rules/gcc_win32.mk1
-rw-r--r--board/MAI/bios_emulator/scitech/makedefs/rules/va32.mk8
-rw-r--r--board/MAI/bios_emulator/scitech/makedefs/rules/va365.mk8
-rw-r--r--board/MAI/bios_emulator/scitech/makedefs/rules/wc32.mk55
-rw-r--r--board/MAI/bios_emulator/scitech/makedefs/startup.mk1
-rw-r--r--board/MAI/bios_emulator/scitech/makedefs/wc32.mk1
-rw-r--r--board/MAI/bios_emulator/scitech/src/biosemu/besys.c280
-rw-r--r--board/MAI/bios_emulator/scitech/src/biosemu/bios.c204
-rw-r--r--board/MAI/bios_emulator/scitech/src/biosemu/biosemu.c66
-rw-r--r--board/MAI/bios_emulator/scitech/src/biosemu/warmboot.c610
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/aabeos.c14
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/aados.c2
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/aalib.c52
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/aalinux.c14
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/aaos2.c36
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/aaqnx.c14
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/aartt.c8
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/aasmx.c2
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/aavxd.c8
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/aawin32.c96
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/agplib.c67
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/center.c33
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/cmdline.c342
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/gabeos.c22
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/gados.c3
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/galib.c49
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/galinux.c22
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/gantdrv.c9
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/gaos2.c36
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/gaqnx.c22
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/gartt.c8
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/gasmx.c2
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/gavxd.c9
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/gawin32.c107
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/gtfcalc.c294
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/libcimp.c239
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/peloader.c363
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/vesavbe.c514
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/beos/cpuinfo.c4
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/beos/event.c70
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/beos/oshdr.h4
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/beos/pm.c302
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/beos/ztimer.c20
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/common.c280
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/common/agp.c51
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/common/keyboard.c457
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/common/mtrr.c608
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/common/pcilib.c474
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/common/unixio.c80
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/common/vgastate.c80
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/cpuinfo.c620
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/debug.c24
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/dos/event.c296
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/dos/pm.c762
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/dos/pmdos.c392
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/dos/vflat.c60
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/dos/ztimer.c2
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/event.c430
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/linux/event.c1319
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/linux/oshdr.h1
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/linux/pm.c1117
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/ntdrv/cpuinfo.c1
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/ntdrv/int86.c47
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/ntdrv/irq.c79
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/ntdrv/mem.c281
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/ntdrv/oshdr.h3
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/ntdrv/pm.c347
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/ntdrv/stdio.c201
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/ntdrv/stdlib.c29
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/ntdrv/ztimer.c1
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/os2/event.c495
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/os2/mon.h144
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/os2/oshdr.h1
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/os2/pm.c730
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/os2pm/event.c10
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/photon/event.c176
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/qnx/event.c535
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/qnx/mtrrqnx.c12
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/qnx/pm.c296
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/rttarget/cpuinfo.c22
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/rttarget/event.c212
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/rttarget/pm.c90
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/rttarget/ztimer.c30
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/smx/event.c228
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/smx/pm.c344
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/smx/pmsmx.c146
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/smx/ztimer.c2
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/stub/cpuinfo.c10
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/stub/event.c70
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/stub/oshdr.h6
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/stub/pm.c420
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/stub/ztimer.c20
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/tests/altbrk.c52
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/tests/altcrit.c28
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/tests/biosptr.c38
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/tests/block.c6
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/tests/brk.c48
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/tests/callreal.c46
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/tests/checks.c18
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/tests/cpu.c2
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/tests/critical.c26
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/tests/getch.c134
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/tests/isvesa.c46
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/tests/key.c26
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/tests/key15.c26
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/tests/memtest.c46
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/tests/mouse.c32
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/tests/restore.c23
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/tests/rtc.c34
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/tests/save.c27
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/tests/showpci.c292
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/tests/tick.c34
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/tests/timerc.c6
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/tests/uswc.c268
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/tests/vftest.c32
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/tests/video.c63
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/vdd/fileio.c202
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/vdd/pm.c302
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/vdd/vflat.c4
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/vxd/fileio.c213
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/vxd/pm.c405
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/win32/cpuinfo.c22
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/win32/ddraw.c357
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/win32/event.c285
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/win32/ntservc.c183
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/win32/oshdr.h3
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/win32/pm.c435
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/win32/ztimer.c30
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/x11/event.c46
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/ztimer.c39
-rw-r--r--board/MAI/bios_emulator/scitech/src/v86bios/AsmMacros.h74
-rw-r--r--board/MAI/bios_emulator/scitech/src/v86bios/README11
-rw-r--r--board/MAI/bios_emulator/scitech/src/v86bios/cbios.c188
-rw-r--r--board/MAI/bios_emulator/scitech/src/v86bios/command.c16
-rw-r--r--board/MAI/bios_emulator/scitech/src/v86bios/console.c59
-rw-r--r--board/MAI/bios_emulator/scitech/src/v86bios/debug.h10
-rw-r--r--board/MAI/bios_emulator/scitech/src/v86bios/int.c294
-rw-r--r--board/MAI/bios_emulator/scitech/src/v86bios/io.c80
-rw-r--r--board/MAI/bios_emulator/scitech/src/v86bios/main.c414
-rw-r--r--board/MAI/bios_emulator/scitech/src/v86bios/mem.c30
-rw-r--r--board/MAI/bios_emulator/scitech/src/v86bios/pci.c615
-rw-r--r--board/MAI/bios_emulator/scitech/src/v86bios/pci.h14
-rw-r--r--board/MAI/bios_emulator/scitech/src/v86bios/v86.c372
-rw-r--r--board/MAI/bios_emulator/scitech/src/v86bios/v86bios.c518
-rw-r--r--board/MAI/bios_emulator/scitech/src/v86bios/v86bios.h45
-rw-r--r--board/MAI/bios_emulator/scitech/src/v86bios/x86emu.c86
-rw-r--r--board/MAI/bios_emulator/scitech/src/x86emu/debug.c72
-rw-r--r--board/MAI/bios_emulator/scitech/src/x86emu/decode.c8
-rw-r--r--board/MAI/bios_emulator/scitech/src/x86emu/fpu.c1044
-rw-r--r--board/MAI/bios_emulator/scitech/src/x86emu/ops.c12378
-rw-r--r--board/MAI/bios_emulator/scitech/src/x86emu/ops2.c3034
-rw-r--r--board/MAI/bios_emulator/scitech/src/x86emu/prim_ops.c388
-rw-r--r--board/MAI/bios_emulator/scitech/src/x86emu/sys.c10
-rw-r--r--board/MAI/bios_emulator/scitech/src/x86emu/validate.c642
-rw-r--r--board/MAI/bios_emulator/scitech/src/x86emu/x86emu/debug.h2
-rw-r--r--board/MAI/bios_emulator/x86interface.c110
-rw-r--r--board/MAI/menu/cmd_menu.c13
-rw-r--r--board/MAI/menu/menu.c4
-rw-r--r--board/MAI/menu/menu.h8
202 files changed, 20927 insertions, 21014 deletions
diff --git a/board/MAI/AmigaOneG3SE/AmigaOneG3SE.c b/board/MAI/AmigaOneG3SE/AmigaOneG3SE.c
index 1d6ca813a2..0934e1b693 100644
--- a/board/MAI/AmigaOneG3SE/AmigaOneG3SE.c
+++ b/board/MAI/AmigaOneG3SE/AmigaOneG3SE.c
@@ -30,47 +30,47 @@
#include "via686.h"
__asm(" .globl send_kb \n
- send_kb: \n
- lis r9, 0xfe00 \n
- \n
- li r4, 0x10 # retries \n
- mtctr r4 \n
- \n
- idle: \n
- lbz r4, 0x64(r9) \n
- andi. r4, r4, 0x02 \n
- bne idle \n
- \n
- ready: \n
- stb r3, 0x60(r9) \n
- \n
- check: \n
- lbz r4, 0x64(r9) \n
- andi. r4, r4, 0x01 \n
- beq check \n
- \n
- lbz r4, 0x60(r9) \n
- cmpwi r4, 0xfa \n
- beq done \n
- \n
- bdnz idle \n
- \n
- li r3, 0 \n
- blr \n
- \n
- done: \n
- li r3, 1 \n
- blr \n
- \n
- .globl test_kb \n
- test_kb: \n
- mflr r10 \n
- li r3, 0xed \n
- bl send_kb \n
- li r3, 0x01 \n
- bl send_kb \n
- mtlr r10 \n
- blr \n
+ send_kb: \n
+ lis r9, 0xfe00 \n
+ \n
+ li r4, 0x10 # retries \n
+ mtctr r4 \n
+ \n
+ idle: \n
+ lbz r4, 0x64(r9) \n
+ andi. r4, r4, 0x02 \n
+ bne idle \n
+ \n
+ ready: \n
+ stb r3, 0x60(r9) \n
+ \n
+ check: \n
+ lbz r4, 0x64(r9) \n
+ andi. r4, r4, 0x01 \n
+ beq check \n
+ \n
+ lbz r4, 0x60(r9) \n
+ cmpwi r4, 0xfa \n
+ beq done \n
+ \n
+ bdnz idle \n
+ \n
+ li r3, 0 \n
+ blr \n
+ \n
+ done: \n
+ li r3, 1 \n
+ blr \n
+ \n
+ .globl test_kb \n
+ test_kb: \n
+ mflr r10 \n
+ li r3, 0xed \n
+ bl send_kb \n
+ li r3, 0x01 \n
+ bl send_kb \n
+ mtlr r10 \n
+ blr \n
");
@@ -86,7 +86,6 @@ long initdram (int board_type)
}
-
void after_reloc (ulong dest_addr, gd_t *gd)
{
/* HJF: DECLARE_GLOBAL_DATA_PTR; */
diff --git a/board/MAI/AmigaOneG3SE/Makefile b/board/MAI/AmigaOneG3SE/Makefile
index 785f01f6cc..b1247fe4e8 100644
--- a/board/MAI/AmigaOneG3SE/Makefile
+++ b/board/MAI/AmigaOneG3SE/Makefile
@@ -33,14 +33,14 @@ COBJS = $(BOARD).o articiaS.o flash.o serial.o smbus.o articiaS_pci.o \
AOBJS = board_asm_init.o memio.o
-OBJS = $(COBJS) $(AOBJS)
+OBJS = $(COBJS) $(AOBJS)
EMUDIR = ../bios_emulator/scitech/src/x86emu/
EMUOBJ = $(EMUDIR)decode.o $(EMUDIR)ops2.o $(EMUDIR)fpu.o $(EMUDIR)prim_ops.o \
$(EMUDIR)ops.o $(EMUDIR)sys.o
EMUSRC = $(EMUOBJ:.o=.c)
-$(LIB): .depend $(OBJS) $(EMUSRC)
+$(LIB): .depend $(OBJS) $(EMUSRC)
make libx86emu.a -C ../bios_emulator/scitech/src/x86emu -f makefile.uboot CROSS_COMPILE=$(CROSS_COMPILE)
-rm $(LIB)
$(AR) crv $@ $(OBJS) $(EMUOBJ)
diff --git a/board/MAI/AmigaOneG3SE/articiaS.c b/board/MAI/AmigaOneG3SE/articiaS.c
index 5eddfc6ea7..9fd6b95822 100644
--- a/board/MAI/AmigaOneG3SE/articiaS.c
+++ b/board/MAI/AmigaOneG3SE/articiaS.c
@@ -1,6 +1,6 @@
/*
* (C) Copyright 2002
- * Hyperion Entertainment, ThomasF@hyperion-entertainment.com
+ * Hyperion Entertainment, ThomasF@hyperion-entertainment.com
*
* See file CREDITS for list of people who contributed to this
* project.
@@ -572,7 +572,7 @@ long articiaS_ram_init (void)
if (banks[3].used)
burst_support = banks[3].burst_len;
- /*
+ /*
** Mode register:
** Bits Use
** 0-2 Burst len
diff --git a/board/MAI/AmigaOneG3SE/articiaS.h b/board/MAI/AmigaOneG3SE/articiaS.h
index 158d70ab8e..ce20d03065 100644
--- a/board/MAI/AmigaOneG3SE/articiaS.h
+++ b/board/MAI/AmigaOneG3SE/articiaS.h
@@ -99,14 +99,14 @@
#define XDBCR_HWTOXD (1<<0)
#define XDBCR_KBTOXD (1<<1)
#define XDBCR_RTCTOXD (1<<2)
-#define XDBCR_SCALE_1_1 (0x0<<3)
-#define XDBCR_SCALE_2_2 (0x1<<3)
-#define XDBCR_SCALE_3_2 (0x2<<3)
-#define XDBCR_SCALE_4_4 (0x3<<3)
-#define XDBCR_SCALE_5_8 (0x4<<3)
-#define XDBCR_SCALE_6_8 (0x5<<3)
-#define XDBCR_SCALE_8_8 (0x6<<3)
-#define XDBCR_SCALE_0_16 (0x7<<3)
+#define XDBCR_SCALE_1_1 (0x0<<3)
+#define XDBCR_SCALE_2_2 (0x1<<3)
+#define XDBCR_SCALE_3_2 (0x2<<3)
+#define XDBCR_SCALE_4_4 (0x3<<3)
+#define XDBCR_SCALE_5_8 (0x4<<3)
+#define XDBCR_SCALE_6_8 (0x5<<3)
+#define XDBCR_SCALE_8_8 (0x6<<3)
+#define XDBCR_SCALE_0_16 (0x7<<3)
#define XDBCR_XDPROM (1<<7)
@@ -134,7 +134,6 @@
#define ARTICIAS_ISAIO_PHYS 0xfe002000
-
/* Prototypes */
long articiaS_ram_init(void);
void articiaS_pci_init(void);
diff --git a/board/MAI/AmigaOneG3SE/articiaS_pci.c b/board/MAI/AmigaOneG3SE/articiaS_pci.c
index 2a7763d845..d2e9f292e0 100644
--- a/board/MAI/AmigaOneG3SE/articiaS_pci.c
+++ b/board/MAI/AmigaOneG3SE/articiaS_pci.c
@@ -123,14 +123,14 @@ struct pci_irq_fixup_table fixuptab [] =
{
{ 0, 0, 0, 0xff}, /* Articia S host bridge */
{ 0, 1, 0, 0xff}, /* Articia S AGP bridge */
-// { 0, 6, 0, 0x05}, /* 3COM ethernet */
+/* { 0, 6, 0, 0x05}, /###* 3COM ethernet */
{ 0, 7, 0, 0xff}, /* VIA southbridge */
{ 0, 7, 1, 0x0e}, /* IDE controller in legacy mode */
-// { 0, 7, 2, 0x05}, /* First USB controller */
-// { 0, 7, 3, 0x0c}, /* Second USB controller (shares interrupt with ethernet) */
+/* { 0, 7, 2, 0x05}, /###* First USB controller */
+/* { 0, 7, 3, 0x0c}, /###* Second USB controller (shares interrupt with ethernet) */
{ 0, 7, 4, 0xff}, /* ACPI Power Management */
-// { 0, 7, 5, 0x08}, /* AC97 */
-// { 0, 7, 6, 0x08}, /* MC97 */
+/* { 0, 7, 5, 0x08}, /###* AC97 */
+/* { 0, 7, 6, 0x08}, /###* MC97 */
{ 0xff, 0xff, 0xff, 0xff}
};
@@ -287,7 +287,7 @@ void articiaS_pci_init (void)
PRINTF("atriciaS_pci_init\n");
- // Why aren't these relocated??
+ /* Why aren't these relocated?? */
for (i=0; config_table[i].config_device; i++)
{
switch((int)config_table[i].config_device)
@@ -335,7 +335,6 @@ void articiaS_pci_init (void)
PCI_REGION_IO);
-
articiaS_hose.region_count = 4;
pci_setup_indirect(&articiaS_hose, ARTICIAS_PCI_CFGADDR, ARTICIAS_PCI_CFGDATA);
@@ -410,8 +409,8 @@ pci_dev_t pci_hose_find_class(struct pci_controller *hose, int bus, short find_c
pci_hose_read_config_byte(hose, dev, 0x0B, &c1);
pci_hose_read_config_byte(hose, dev, 0x0A, &c2);
class = c1<<8 | c2;
- //printf("At %02x:%02x:%02x: class %x\n",
- // PCI_BUS(dev), PCI_DEV(dev), PCI_FUNC(dev), class);
+ /*printf("At %02x:%02x:%02x: class %x\n", */
+ /* PCI_BUS(dev), PCI_DEV(dev), PCI_FUNC(dev), class); */
if (class == find_class)
{
if (index == 0)
@@ -441,7 +440,7 @@ pci_dev_t pci_find_bridge_for_bus(struct pci_controller *hose, int busnr)
if (hose == NULL) hose = &articiaS_hose;
- if (busnr < hose->first_busno || busnr > hose->last_busno) return PCI_ANY_ID; // Not in range
+ if (busnr < hose->first_busno || busnr > hose->last_busno) return PCI_ANY_ID; /* Not in range */
/*
* The bridge must be on a lower bus number
@@ -467,7 +466,7 @@ pci_dev_t pci_find_bridge_for_bus(struct pci_controller *hose, int busnr)
if (!PCI_FUNC(dev))
found_multi = header_type & 0x80;
- if (header_type == 1) // Bridge device header
+ if (header_type == 1) /* Bridge device header */
{
pci_hose_read_config_byte(hose, dev, PCI_SECONDARY_BUS, &secondary_bus);
if ((int)secondary_bus == busnr) return dev;
@@ -512,7 +511,7 @@ int articiaS_init_vga (void)
PRINTF("Searching for class 0x%x on bus %d\n", classes[classnr], busnr);
/* Find the first of this class on this bus */
dev = pci_hose_find_class(&articiaS_hose, busnr, classes[classnr], 0);
- if (dev != ~0)
+ if (dev != ~0)
{
PRINTF("Found VGA Card at %02x:%02x:%02x\n", PCI_BUS(dev), PCI_DEV(dev), PCI_FUNC(dev));
break;
diff --git a/board/MAI/AmigaOneG3SE/board_asm_init.S b/board/MAI/AmigaOneG3SE/board_asm_init.S
index a421c5dc43..086b19c052 100644
--- a/board/MAI/AmigaOneG3SE/board_asm_init.S
+++ b/board/MAI/AmigaOneG3SE/board_asm_init.S
@@ -1,14 +1,13 @@
- #include "macros.h"
-
-
+#include "macros.h"
-#define GLOBALINFO0 0x50
+
+#define GLOBALINFO0 0x50
#define GLOBALINFO0_BO (1<<7)
#define GLOBALINFO2_B1ARBITER (1<<6)
#define HBUSACR0 0x5c
#define HBUSACR2_BURST (1<<0)
#define HBUSACR2_LAT (1<<1)
-
+
#define RECEIVER_HOLDING 0
#define TRANSMITTER_HOLDING 0
#define INTERRUPT_ENABLE 1
@@ -35,9 +34,9 @@
#define SUPERIO_1 ((7 << 3) | (0))
#define SUPERIO_2 ((7 << 3) | (1))
-
+
.globl board_asm_init
-
+
board_asm_init:
mflr r29
/* Set 'Must-set' register */
@@ -77,7 +76,7 @@ board_asm_init:
li r5, 0x47
bl pci_write_cfg_byte*/
-
+
/* Enable NVRAM for environment */
li r3, 0
li r4, 0
@@ -91,7 +90,7 @@ board_asm_init:
siowb 0x40, 0x08
siowb 0x41, 0x01
siowb 0x45, 0x80
- siowb 0x46, 0x60
+ siowb 0x46, 0x60
siowb 0x47, 0x20
siowb 0x48, 0x01
siowb 0x4a, 0xc4
@@ -103,7 +102,7 @@ board_asm_init:
siowb 0x56, 0x99
siowb 0x57, 0x90
siowb 0x85, 0x01
-
+
/* Enable configuration mode for SuperIO */
li r3, 0
li r4, (7<<3)
@@ -128,7 +127,7 @@ board_asm_init:
ori r3, r3, 0x0c
outb 0x3f0, 0xe2
outbr 0x3f1, r3
-
+
/* Disable configuration mode */
li r3, 0
li r4, (7<<3)
@@ -145,7 +144,7 @@ board_asm_init:
mtlr r29
blr
-
+
.globl new_reset
.globl new_reset_end
new_reset:
@@ -153,5 +152,5 @@ new_reset:
oris r0, r0, 0xFFF0
mtlr r0
blr
-
-new_reset_end: \ No newline at end of file
+
+new_reset_end:
diff --git a/board/MAI/AmigaOneG3SE/cmd_boota.c b/board/MAI/AmigaOneG3SE/cmd_boota.c
index 140aaff044..db1ecfc308 100644
--- a/board/MAI/AmigaOneG3SE/cmd_boota.c
+++ b/board/MAI/AmigaOneG3SE/cmd_boota.c
@@ -1,6 +1,5 @@
#include <common.h>
#include <command.h>
-#include <cmd_boota.h>
#include "../disk/part_amiga.h"
#include <asm/cache.h>
@@ -121,3 +120,10 @@ int do_boota (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
return 0;
}
+#if defined(CONFIG_AMIGAONEG3SE) && (CONFIG_COMMANDS & CFG_CMD_BSP)
+cmd_tbl_t U_BOOT_CMD(BOOTA) = MK_CMD_ENTRY(
+ "boota", 3, 1, do_boota,
+ "boota - boot an Amiga kernel\n",
+ "address disk"
+);
+#endif /* _CMD_BOOTA_H */
diff --git a/board/MAI/AmigaOneG3SE/config.mk b/board/MAI/AmigaOneG3SE/config.mk
index d7d0e6bde2..930a7930e2 100644
--- a/board/MAI/AmigaOneG3SE/config.mk
+++ b/board/MAI/AmigaOneG3SE/config.mk
@@ -29,5 +29,4 @@ X86EMU = -I../bios_emulator/scitech/include -I../bios_emulator/scitech/src/x86e
TEXT_BASE = 0xfff00000
-PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -Wa,-mregnames -DEASTEREGG $(X86EMU) -Dprintk=printf #-DDEBUG
-
+PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -Wa,-mregnames -DEASTEREGG $(X86EMU) -Dprintk=printf #-DDEBUG
diff --git a/board/MAI/AmigaOneG3SE/enet.c b/board/MAI/AmigaOneG3SE/enet.c
index 0aaa8bf639..d4be889ea8 100644
--- a/board/MAI/AmigaOneG3SE/enet.c
+++ b/board/MAI/AmigaOneG3SE/enet.c
@@ -36,45 +36,45 @@
/* 3Com Ethernet PCI definitions*/
-// #define PCI_VENDOR_ID_3COM 0x10B7
+/* #define PCI_VENDOR_ID_3COM 0x10B7 */
#define PCI_DEVICE_ID_3COM_3C905C 0x9200
/* 3Com Commands, top 5 bits are command and bottom 11 bits are parameters */
-#define TotalReset (0<<11)
+#define TotalReset (0<<11)
#define SelectWindow (1<<11)
#define StartCoax (2<<11)
-#define RxDisable (3<<11)
-#define RxEnable (4<<11)
+#define RxDisable (3<<11)
+#define RxEnable (4<<11)
#define RxReset (5<<11)
-#define UpStall (6<<11)
+#define UpStall (6<<11)
#define UpUnstall (6<<11)+1
-#define DownStall (6<<11)+2
+#define DownStall (6<<11)+2
#define DownUnstall (6<<11)+3
#define RxDiscard (8<<11)
#define TxEnable (9<<11)
-#define TxDisable (10<<11)
+#define TxDisable (10<<11)
#define TxReset (11<<11)
-#define FakeIntr (12<<11)
-#define AckIntr (13<<11)
+#define FakeIntr (12<<11)
+#define AckIntr (13<<11)
#define SetIntrEnb (14<<11)
-#define SetStatusEnb (15<<11)
+#define SetStatusEnb (15<<11)
#define SetRxFilter (16<<11)
#define SetRxThreshold (17<<11)
-#define SetTxThreshold (18<<11)
+#define SetTxThreshold (18<<11)
#define SetTxStart (19<<11)
#define StartDMAUp (20<<11)
#define StartDMADown (20<<11)+1
#define StatsEnable (21<<11)
-#define StatsDisable (22<<11)
+#define StatsDisable (22<<11)
#define StopCoax (23<<11)
#define SetFilterBit (25<<11)
/* The SetRxFilter command accepts the following classes */
-#define RxStation 1
-#define RxMulticast 2
-#define RxBroadcast 4
+#define RxStation 1
+#define RxMulticast 2
+#define RxBroadcast 4
#define RxProm 8
/* 3Com status word defnitions */
@@ -83,12 +83,12 @@
#define HostError 0x0002
#define TxComplete 0x0004
#define TxAvailable 0x0008
-#define RxComplete 0x0010
+#define RxComplete 0x0010
#define RxEarly 0x0020
#define IntReq 0x0040
#define StatsFull 0x0080
#define DMADone (1<<8)
-#define DownComplete (1<<9)
+#define DownComplete (1<<9)
#define UpComplete (1<<10)
#define DMAInProgress (1<<11) /* DMA controller is still busy.*/
#define CmdInProgress (1<<12) /* EL3_CMD is still busy.*/
@@ -114,31 +114,31 @@
/* EEPROM locations. */
-#define PhysAddr01 0
+#define PhysAddr01 0
#define PhysAddr23 1
-#define PhysAddr45 2
+#define PhysAddr45 2
#define ModelID 3
-#define EtherLink3ID 7
-#define IFXcvrIO 8
+#define EtherLink3ID 7
+#define IFXcvrIO 8
#define IRQLine 9
-#define NodeAddr01 10
-#define NodeAddr23 11
+#define NodeAddr01 10
+#define NodeAddr23 11
#define NodeAddr45 12
-#define DriverTune 13
+#define DriverTune 13
#define Checksum 15
/* Register window 1 offsets, the window used in normal operation */
-#define TX_FIFO 0x10
-#define RX_FIFO 0x10
+#define TX_FIFO 0x10
+#define RX_FIFO 0x10
#define RxErrors 0x14
-#define RxStatus 0x18
-#define Timer 0x1A
+#define RxStatus 0x18
+#define Timer 0x1A
#define TxStatus 0x1B
#define TxFree 0x1C /* Remaining free bytes in Tx buffer. */
/* Register Window 2 */
-
+
#define Wn2_ResetOptions 12
/* Register Window 3: MAC/config bits */
@@ -148,11 +148,11 @@
#define Wn3_Options 8
#define BFEXT(value, offset, bitcount) \
- ((((unsigned long)(value)) >> (offset)) & ((1 << (bitcount)) - 1))
+ ((((unsigned long)(value)) >> (offset)) & ((1 << (bitcount)) - 1))
#define BFINS(lhs, rhs, offset, bitcount) \
- (((lhs) & ~((((1 << (bitcount)) - 1)) << (offset))) | \
- (((rhs) & ((1 << (bitcount)) - 1)) << (offset)))
+ (((lhs) & ~((((1 << (bitcount)) - 1)) << (offset))) | \
+ (((rhs) & ((1 << (bitcount)) - 1)) << (offset)))
#define RAM_SIZE(v) BFEXT(v, 0, 3)
#define RAM_WIDTH(v) BFEXT(v, 3, 1)
@@ -163,7 +163,7 @@
#define AUTOSELECT(v) BFEXT(v, 24, 1)
/* Register Window 4: Xcvr/media bits */
-
+
#define Wn4_FIFODiag 4
#define Wn4_NetDiag 6
#define Wn4_PhysicalMgmt 8
@@ -196,28 +196,28 @@
#define DN_COMPLETE 0x00010000 /* This packet has been downloaded */
struct rx_desc_3com {
- u32 next; /* Last entry points to 0 */
- u32 status; /* FSH -> Frame Start Header */
- u32 addr; /* Up to 63 addr/len pairs possible */
- u32 length; /* Set LAST_FRAG to indicate last pair */
+ u32 next; /* Last entry points to 0 */
+ u32 status; /* FSH -> Frame Start Header */
+ u32 addr; /* Up to 63 addr/len pairs possible */
+ u32 length; /* Set LAST_FRAG to indicate last pair */
};
/* Values for the Rx status entry. */
#define RxDComplete 0x00008000
#define RxDError 0x4000
-#define IPChksumErr (1<<25)
-#define TCPChksumErr (1<<26)
+#define IPChksumErr (1<<25)
+#define TCPChksumErr (1<<26)
#define UDPChksumErr (1<<27)
-#define IPChksumValid (1<<29)
+#define IPChksumValid (1<<29)
#define TCPChksumValid (1<<30)
#define UDPChksumValid (1<<31)
struct tx_desc_3com {
- u32 next; /* Last entry points to 0 */
- u32 status; /* bits 0:12 length, others see below */
- u32 addr;
- u32 length;
+ u32 next; /* Last entry points to 0 */
+ u32 status; /* bits 0:12 length, others see below */
+ u32 addr;
+ u32 length;
};
/* Values for the Tx status entry. */
@@ -232,9 +232,9 @@ struct tx_desc_3com {
/* XCVR Types */
#define XCVR_10baseT 0
-#define XCVR_AUI 1
+#define XCVR_AUI 1
#define XCVR_10baseTOnly 2
-#define XCVR_10base2 3
+#define XCVR_10base2 3
#define XCVR_100baseTx 4
#define XCVR_100baseFx 5
#define XCVR_MII 6
@@ -243,10 +243,10 @@ struct tx_desc_3com {
#define XCVR_Default 10 /* I don't think this is correct -> should have been 0x10 if Auto Negotiate */
struct descriptor { /* A generic descriptor. */
- u32 next; /* Last entry points to 0 */
- u32 status; /* FSH -> Frame Start Header */
- u32 addr; /* Up to 63 addr/len pairs possible */
- u32 length; /* Set LAST_FRAG to indicate last pair */
+ u32 next; /* Last entry points to 0 */
+ u32 status; /* FSH -> Frame Start Header */
+ u32 addr; /* Up to 63 addr/len pairs possible */
+ u32 length; /* Set LAST_FRAG to indicate last pair */
};
/* Misc. definitions */
@@ -338,7 +338,7 @@ static inline int ETH_STATUS(struct eth_device* dev)
static inline void ETH_CMD(struct eth_device* dev, int command)
{
- *(volatile u16 *)io_to_phys(EL3_CMD + dev->iobase) = cpu_to_le16(command);
+ *(volatile u16 *)io_to_phys(EL3_CMD + dev->iobase) = cpu_to_le16(command);
__asm volatile ("eieio");
}
@@ -348,24 +348,24 @@ static inline void ETH_CMD(struct eth_device* dev, int command)
static int issue_and_wait(struct eth_device* dev, int command)
{
- int i, status;
+ int i, status;
ETH_CMD(dev, command);
- for (i = 0; i < 2000; i++) {
- status = ETH_STATUS(dev);
- //printf ("Issue: status 0x%4x.\n", status);
+ for (i = 0; i < 2000; i++) {
+ status = ETH_STATUS(dev);
+ /*printf ("Issue: status 0x%4x.\n", status); */
if (!(status & CmdInProgress))
- return 1;
- }
-
- /* OK, that didn't work. Do it the slow way. One second */
- for (i = 0; i < 100000; i++) {
- status = ETH_STATUS(dev);
- //printf ("Issue: status 0x%4x.\n", status);
- return 1;
- udelay(10);
- }
- PRINTF("Ethernet command: 0x%4x did not complete! Status: 0x%4x\n", command, ETH_STATUS(dev) );
+ return 1;
+ }
+
+ /* OK, that didn't work. Do it the slow way. One second */
+ for (i = 0; i < 100000; i++) {
+ status = ETH_STATUS(dev);
+ /*printf ("Issue: status 0x%4x.\n", status); */
+ return 1;
+ udelay(10);
+ }
+ PRINTF("Ethernet command: 0x%4x did not complete! Status: 0x%4x\n", command, ETH_STATUS(dev) );
return 0;
}
@@ -378,7 +378,7 @@ static int auto_negotiate(struct eth_device* dev)
EL3WINDOW(dev, 1);
- // Wait for Auto negotiation to complete
+ /* Wait for Auto negotiation to complete */
for (i = 0; i <= 1000; i++)
{
if (ETH_INW(dev, 2) & 0x04)
@@ -391,7 +391,6 @@ static int auto_negotiate(struct eth_device* dev)
return 0;
}
}
-
return 1;
@@ -430,10 +429,10 @@ void eth_interrupt(struct eth_device *dev)
int eth_3com_initialize(bd_t *bis)
{
- u32 eth_iobase = 0, status;
- int card_number = 0, ret;
- struct eth_device* dev;
- pci_dev_t devno;
+ u32 eth_iobase = 0, status;
+ int card_number = 0, ret;
+ struct eth_device* dev;
+ pci_dev_t devno;
char *s;
s = getenv("3com_base");
@@ -453,10 +452,10 @@ int eth_3com_initialize(bd_t *bis)
}
ret = pci_read_config_dword(devno, PCI_BASE_ADDRESS_0, &eth_iobase);
- eth_iobase &= ~0xf;
+ eth_iobase &= ~0xf;
PRINTF("eth: 3Com Found at Address: 0x%x\n", eth_iobase);
-
+
pci_write_config_dword(devno, PCI_COMMAND, PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
/* Check if I/O accesses and Bus Mastering are enabled */
@@ -481,28 +480,28 @@ int eth_3com_initialize(bd_t *bis)
goto Done;
}
- dev = (struct eth_device*) malloc(sizeof(*dev)); //struct eth_device));
+ dev = (struct eth_device*) malloc(sizeof(*dev)); /*struct eth_device)); */
- sprintf(dev->name, "3Com 3c920c#%d", card_number);
- dev->iobase = eth_iobase;
- dev->priv = (void*) devno;
- dev->init = eth_3com_init;
- dev->halt = eth_3com_halt;
- dev->send = eth_3com_send;
- dev->recv = eth_3com_recv;
+ sprintf(dev->name, "3Com 3c920c#%d", card_number);
+ dev->iobase = eth_iobase;
+ dev->priv = (void*) devno;
+ dev->init = eth_3com_init;
+ dev->halt = eth_3com_halt;
+ dev->send = eth_3com_send;
+ dev->recv = eth_3com_recv;
- eth_register(dev);
+ eth_register(dev);
/* { */
/* char interrupt; */
/* devno = pci_find_device(PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C905C, 0); */
/* pci_read_config_byte(devno, PCI_INTERRUPT_LINE, &interrupt); */
-
+
/* printf("Installing eth0 interrupt handler to %d\n", interrupt); */
/* irq_install_handler(interrupt, eth_interrupt, dev); */
/* } */
- card_number++;
+ card_number++;
/* Set the latency timer for value */
s = getenv("3com_latency");
@@ -532,13 +531,13 @@ int eth_3com_initialize(bd_t *bis)
PRINTF ("Cannot allocate memory for RX_RING.....\n");
goto Done;
}
-
+
if (!(tx_ring = memalign(sizeof(struct tx_desc_3com) * NUM_TX_DESC, 16)))
{
PRINTF ("Cannot allocate memory for TX_RING.....\n");
goto Done;
}
-
+
Done:
return status;
}
@@ -552,7 +551,7 @@ static int eth_3com_init(struct eth_device* dev, bd_t *bis)
struct descriptor *ias_cmd;
/* Determine what type of network the machine is connected to */
- /* presently drops the connect to 10Mbps */
+ /* presently drops the connect to 10Mbps */
if (!auto_negotiate(dev))
{
@@ -560,43 +559,43 @@ static int eth_3com_init(struct eth_device* dev, bd_t *bis)
goto Done;
}
- issue_and_wait(dev, TxReset);
- issue_and_wait(dev, RxReset|0x04);
+ issue_and_wait(dev, TxReset);
+ issue_and_wait(dev, RxReset|0x04);
- /* Switch to register set 7 for normal use. */
- EL3WINDOW(dev, 7);
+ /* Switch to register set 7 for normal use. */
+ EL3WINDOW(dev, 7);
/* Initialize Rx and Tx rings */
init_rx_ring(dev);
purge_tx_ring(dev);
- ETH_CMD(dev, SetRxFilter | RxStation | RxBroadcast | RxProm);
+ ETH_CMD(dev, SetRxFilter | RxStation | RxBroadcast | RxProm);
- issue_and_wait(dev,SetTxStart|0x07ff);
+ issue_and_wait(dev,SetTxStart|0x07ff);
- /* Below sets which indication bits to be seen. */
+ /* Below sets which indication bits to be seen. */
- status_enable = SetStatusEnb | HostError | DownComplete | UpComplete | (1<<6);
- ETH_CMD(dev, status_enable);
+ status_enable = SetStatusEnb | HostError | DownComplete | UpComplete | (1<<6);
+ ETH_CMD(dev, status_enable);
/* Below sets no bits are to cause an interrupt since this is just polling */
- intr_enable = SetIntrEnb;
-// intr_enable = SetIntrEnb | (1<<9) | (1<<10) | (1<<6);
- ETH_CMD(dev, intr_enable);
+ intr_enable = SetIntrEnb;
+/* intr_enable = SetIntrEnb | (1<<9) | (1<<10) | (1<<6); */
+ ETH_CMD(dev, intr_enable);
ETH_OUTB(dev, 127, UpPoll);
- /* Ack all pending events, and set active indicator mask */
+ /* Ack all pending events, and set active indicator mask */
- ETH_CMD(dev, AckIntr | IntLatch | TxAvailable | RxEarly | IntReq);
- ETH_CMD(dev, intr_enable);
+ ETH_CMD(dev, AckIntr | IntLatch | TxAvailable | RxEarly | IntReq);
+ ETH_CMD(dev, intr_enable);
/* Tell the adapter where the RX ring is located */
issue_and_wait(dev,UpStall); /* Stall and set the UplistPtr */
ETH_OUTL(dev, (u32)&rx_ring[rx_next], UpListPtr);
- ETH_CMD(dev, RxEnable); /* Enable the receiver. */
+ ETH_CMD(dev, RxEnable); /* Enable the receiver. */
issue_and_wait(dev,UpUnstall);
/* Send the Individual Address Setup frame */
@@ -612,7 +611,7 @@ static int eth_3com_init(struct eth_device* dev, bd_t *bis)
/* Tell the adapter where the TX ring is located */
- ETH_CMD(dev, TxEnable); /* Enable transmitter. */
+ ETH_CMD(dev, TxEnable); /* Enable transmitter. */
issue_and_wait(dev, DownStall); /* Stall and set the DownListPtr. */
ETH_OUTL(dev, (u32)&tx_ring[tx_cur], DownListPtr);
issue_and_wait(dev, DownUnstall);
@@ -627,13 +626,13 @@ static int eth_3com_init(struct eth_device* dev, bd_t *bis)
}
if (ETH_STATUS(dev) & DownComplete) /* If DownLoad Complete ACK the bit */
{
- ETH_CMD(dev, AckIntr | DownComplete); /* acknowledge the indication bit */
- issue_and_wait(dev, DownStall); /* stall and clear DownListPtr */
+ ETH_CMD(dev, AckIntr | DownComplete); /* acknowledge the indication bit */
+ issue_and_wait(dev, DownStall); /* stall and clear DownListPtr */
ETH_OUTL(dev, 0, DownListPtr);
issue_and_wait(dev, DownUnstall);
}
status = 1;
-
+
Done:
return status;
}
@@ -673,8 +672,8 @@ int eth_3com_send(struct eth_device* dev, volatile void *packet, int length)
}
if (ETH_STATUS(dev) & DownComplete) /* If DownLoad Complete ACK the bit */
{
- ETH_CMD(dev, AckIntr | DownComplete); /* acknowledge the indication bit */
- issue_and_wait(dev, DownStall); /* stall and clear DownListPtr */
+ ETH_CMD(dev, AckIntr | DownComplete); /* acknowledge the indication bit */
+ issue_and_wait(dev, DownStall); /* stall and clear DownListPtr */
ETH_OUTL(dev, 0, DownListPtr);
issue_and_wait(dev, DownUnstall);
}
@@ -710,15 +709,15 @@ int eth_3com_recv(struct eth_device* dev)
status = le32_to_cpu(rx_ring[rx_next].status); /* packet status */
while (status & (1<<15))
- {
+ {
/* A packet has been received */
- if (status & (1<<15))
+ if (status & (1<<15))
{
/* A valid frame received */
-
+
length = le32_to_cpu(rx_ring[rx_next].status) & 0x1fff; /* length is in bits 0 - 12 */
-
+
/* Pass the packet up to the protocol layers */
NetReceive((uchar *)le32_to_cpu(rx_ring[rx_next].addr), length);
@@ -748,7 +747,7 @@ Done:
void eth_3com_halt(struct eth_device* dev)
{
- if (!(dev->iobase))
+ if (!(dev->iobase))
{
goto Done;
}
@@ -758,14 +757,14 @@ void eth_3com_halt(struct eth_device* dev)
issue_and_wait(dev, RxDisable);
issue_and_wait(dev, TxDisable);
-// free(tx_ring); /* release memory allocated to the DPD and UPD rings */
-// free(rx_ring);
+/* free(tx_ring); /###* release memory allocated to the DPD and UPD rings */
+/* free(rx_ring); */
Done:
return;
}
-static void init_rx_ring(struct eth_device* dev)
+static void init_rx_ring(struct eth_device* dev)
{
int i;
@@ -782,7 +781,7 @@ static void init_rx_ring(struct eth_device* dev)
rx_next = 0;
}
-static void purge_tx_ring(struct eth_device* dev)
+static void purge_tx_ring(struct eth_device* dev)
{
int i;
@@ -799,39 +798,39 @@ static void purge_tx_ring(struct eth_device* dev)
}
}
-static void read_hw_addr(struct eth_device* dev, bd_t *bis)
+static void read_hw_addr(struct eth_device* dev, bd_t *bis)
{
u8 hw_addr[ETH_ALEN];
unsigned int eeprom[0x40];
unsigned int checksum = 0;
int i, j, timer;
- /* Read the station address from the EEPROM. */
+ /* Read the station address from the EEPROM. */
- EL3WINDOW(dev, 0);
+ EL3WINDOW(dev, 0);
for (i = 0; i < 0x40; i++)
{
- ETH_OUTW(dev, EEPROM_Read + i, Wn0EepromCmd);
- /* Pause for at least 162 us. for the read to take place. */
- for (timer = 10; timer >= 0; timer--)
+ ETH_OUTW(dev, EEPROM_Read + i, Wn0EepromCmd);
+ /* Pause for at least 162 us. for the read to take place. */
+ for (timer = 10; timer >= 0; timer--)
{
- udelay(162);
- if ((ETH_INW(dev, Wn0EepromCmd) & 0x8000) == 0)
- break;
- }
- eeprom[i] = ETH_INW(dev, Wn0EepromData);
- }
+ udelay(162);
+ if ((ETH_INW(dev, Wn0EepromCmd) & 0x8000) == 0)
+ break;
+ }
+ eeprom[i] = ETH_INW(dev, Wn0EepromData);
+ }
/* Checksum calculation. I'm not sure about this part and there seems to be a bug on the 3com side of things */
- for (i = 0; i < 0x21; i++)
- checksum ^= eeprom[i];
- checksum = (checksum ^ (checksum >> 8)) & 0xff;
+ for (i = 0; i < 0x21; i++)
+ checksum ^= eeprom[i];
+ checksum = (checksum ^ (checksum >> 8)) & 0xff;
- if (checksum != 0xbb)
- printf(" *** INVALID EEPROM CHECKSUM %4.4x *** \n", checksum);
+ if (checksum != 0xbb)
+ printf(" *** INVALID EEPROM CHECKSUM %4.4x *** \n", checksum);
- for (i = 0, j = 0; i < 3; i++)
+ for (i = 0, j = 0; i < 3; i++)
{
hw_addr[j++] = (u8)((eeprom[i+10] >> 8) & 0xff);
hw_addr[j++] = (u8)(eeprom[i+10] & 0xff);
@@ -839,9 +838,9 @@ static void read_hw_addr(struct eth_device* dev, bd_t *bis)
/* MAC Address is in window 2, write value from EEPROM to window 2 */
- EL3WINDOW(dev, 2);
- for (i = 0; i < 6; i++)
- ETH_OUTB(dev, hw_addr[i], i);
+ EL3WINDOW(dev, 2);
+ for (i = 0; i < 6; i++)
+ ETH_OUTB(dev, hw_addr[i], i);
for (j = 0; j < ETH_ALEN; j+=2)
{
@@ -849,9 +848,9 @@ static void read_hw_addr(struct eth_device* dev, bd_t *bis)
hw_addr[j+1] = (u8)((ETH_INW(dev, j) >> 8) & 0xff);
}
- for (i=0;i<ETH_ALEN;i++)
+ for (i=0;i<ETH_ALEN;i++)
{
- if (hw_addr[i] != bis->bi_enetaddr[i])
+ if (hw_addr[i] != bis->bi_enetaddr[i])
{
/* printf("Warning: HW address don't match:\n"); */
/* printf("Address in 3Com Window 2 is " */
@@ -870,9 +869,9 @@ static void read_hw_addr(struct eth_device* dev, bd_t *bis)
bis->bi_enetaddr[4] == 0 && bis->bi_enetaddr[5] == 0)
{
- sprintf(buffer, "%02X:%02X:%02X:%02X:%02X:%02X",
- hw_addr[0], hw_addr[1], hw_addr[2],
- hw_addr[3], hw_addr[4], hw_addr[5]);
+ sprintf(buffer, "%02X:%02X:%02X:%02X:%02X:%02X",
+ hw_addr[0], hw_addr[1], hw_addr[2],
+ hw_addr[3], hw_addr[4], hw_addr[5]);
setenv("ethaddr", buffer);
}
}
@@ -883,4 +882,3 @@ static void read_hw_addr(struct eth_device* dev, bd_t *bis)
Done:
return;
}
-
diff --git a/board/MAI/AmigaOneG3SE/flash_new.c b/board/MAI/AmigaOneG3SE/flash_new.c
index 3fb9f1246b..d46bf46465 100644
--- a/board/MAI/AmigaOneG3SE/flash_new.c
+++ b/board/MAI/AmigaOneG3SE/flash_new.c
@@ -27,11 +27,10 @@
#include <common.h>
#include <flash.h>
#include <asm/io.h>
-#include "memio.h"
+#include "memio.h"
/*---------------------------------------------------------------------*/
#undef DEBUG_FLASH
-//#define DEBUG_FLASH
#ifdef DEBUG_FLASH
#define DEBUGF(fmt,args...) printf(fmt ,##args)
@@ -68,7 +67,7 @@ static void flash_to_mem(void)
unsigned char x;
flash_xd_nest --;
-
+
if (flash_xd_nest == 0)
{
DEBUGF("Flash on memory bus\n");
@@ -327,7 +326,7 @@ static int flash_get_offsets (ulong base, flash_info_t *info)
/* set sector offsets for uniform sector type */
for (i = 0; i < info->sector_count; i++) {
info->start[i] = base + i * info->size /
- info->sector_count;
+ info->sector_count;
}
break;
default:
@@ -478,7 +477,7 @@ int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
}
if ((rc = write_word(info, wp, data)) != 0) {
- flash_to_mem();
+ flash_to_mem();
return (rc);
}
wp += 4;
@@ -493,7 +492,7 @@ int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
data = (data << 8) | *src++;
}
if ((rc = write_word(info, wp, data)) != 0) {
- flash_to_mem();
+ flash_to_mem();
return (rc);
}
wp += 4;
@@ -582,7 +581,7 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)
*/
static void flash_reset (ulong addr)
{
- flash_to_xd();
+ flash_to_xd();
out8(addr, 0xF0); /* reset bank */
iobarrier_rw();
flash_to_mem();
@@ -633,10 +632,10 @@ void flash_print_info (flash_info_t *info)
info->size / 0x100000, info->sector_count);
} else if (info->size % 0x400 == 0) {
printf (" Size: %ld KB in %d Sectors\n",
- info->size / 0x400, info->sector_count);
+ info->size / 0x400, info->sector_count);
} else {
printf (" Size: %ld B in %d Sectors\n",
- info->size, info->sector_count);
+ info->size, info->sector_count);
}
printf (" Sector Start Addresses:");
diff --git a/board/MAI/AmigaOneG3SE/i8259.c b/board/MAI/AmigaOneG3SE/i8259.c
index 6cdfc60da4..34f489f7c5 100644
--- a/board/MAI/AmigaOneG3SE/i8259.c
+++ b/board/MAI/AmigaOneG3SE/i8259.c
@@ -75,16 +75,16 @@ void i8259_init(void)
char dummy;
PRINTF("Initializing Interrupt controller\n");
/* init master interrupt controller */
- out8(0x20, 0x11); //0x19); // was: 0x11); /* Start init sequence */
+ out8(0x20, 0x11); /* 0x19); /###* Start init sequence */
out8(0x21, 0x00); /* Vector base */
out8(0x21, 0x04); /* edge tiggered, Cascade (slave) on IRQ2 */
- out8(0x21, 0x11); // was: 0x01); /* Select 8086 mode */
+ out8(0x21, 0x11); /* was: 0x01); /###* Select 8086 mode */
/* init slave interrupt controller */
- out8(0xA0, 0x11); //0x19); // was: 0x11); /* Start init sequence */
+ out8(0xA0, 0x11); /* 0x19); /###* Start init sequence */
out8(0xA1, 0x08); /* Vector base */
out8(0xA1, 0x02); /* edge triggered, Cascade (slave) on IRQ2 */
- out8(0xA1, 0x11); // was: 0x01); /* Select 8086 mode */
+ out8(0xA1, 0x11); /* was: 0x01); /###* Select 8086 mode */
/* always read ISR */
out8(0x20, 0x0B);
diff --git a/board/MAI/AmigaOneG3SE/interrupts.c b/board/MAI/AmigaOneG3SE/interrupts.c
index bb93ea0283..5b314a8b71 100644
--- a/board/MAI/AmigaOneG3SE/interrupts.c
+++ b/board/MAI/AmigaOneG3SE/interrupts.c
@@ -73,7 +73,7 @@ get_msr(void)
static __inline__ void
set_msr(unsigned long msr)
{
- asm volatile("mtmsr %0" : : "r" (msr));
+ asm volatile("mtmsr %0" : : "r" (msr));
}
static __inline__ unsigned long
@@ -89,7 +89,7 @@ get_dec(void)
static __inline__ void
set_dec(unsigned long val)
{
- asm volatile("mtdec %0" : : "r" (val));
+ asm volatile("mtdec %0" : : "r" (val));
}
@@ -167,8 +167,8 @@ external_interrupt(struct pt_regs *regs)
int irq, unmask = 1;
- irq = i8259_irq(); //i8259_get_irq(regs);
-// printf("irq = %d, handler at %p ack=%d\n", irq, irq_handlers[irq].handler, *(volatile unsigned char *)0xFEF00000);
+ irq = i8259_irq(); /*i8259_get_irq(regs); */
+/* printf("irq = %d, handler at %p ack=%d\n", irq, irq_handlers[irq].handler, *(volatile unsigned char *)0xFEF00000); */
i8259_mask_and_ack(irq);
if (irq_handlers[irq].handler != NULL)
@@ -264,5 +264,3 @@ do_irqinfo(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
{
puts("IRQ related functions are unimplemented currently.\n");
}
-
-
diff --git a/board/MAI/AmigaOneG3SE/macros.h b/board/MAI/AmigaOneG3SE/macros.h
index 0fbe39b3ba..6020d7e1cb 100644
--- a/board/MAI/AmigaOneG3SE/macros.h
+++ b/board/MAI/AmigaOneG3SE/macros.h
@@ -5,20 +5,20 @@
/*
** Load a long integer into a register
*/
- .macro liw reg, value
- lis \reg, \value@h
- ori \reg, \reg, \value@l
- .endm
+ .macro liw reg, value
+ lis \reg, \value@h
+ ori \reg, \reg, \value@l
+ .endm
- /*
+ /*
** Generate config_addr request
** This macro expects the values in registers:
** r3 - bus
** r4 - devfn
** r5 - offset
*/
- .macro config_addr
+ .macro config_addr
rlwinm r9, r5, 24, 0, 6
rlwinm r8, r4, 16, 0, 31
rlwinm r7, r3, 8, 0, 31
@@ -31,7 +31,7 @@
sync
.endm
-
+
/*
** Generate config_data address
*/
@@ -45,40 +45,40 @@
/*
** Write a byte value to an output port
*/
- .macro outb port, value
- lis r2, 0xfe00
- li r0, \value
- stb r0, \port(r2)
- .endm
+ .macro outb port, value
+ lis r2, 0xfe00
+ li r0, \value
+ stb r0, \port(r2)
+ .endm
/*
** Write a register byte value to an output port
*/
- .macro outbr port, value
- lis r2, 0xfe00
- stb \value, \port(r2)
- .endm
+ .macro outbr port, value
+ lis r2, 0xfe00
+ stb \value, \port(r2)
+ .endm
- /*
+ /*
** Read a byte value from a port into a specified register
*/
- .macro inb reg, port
- lis r2, 0xfe00
- lbz \reg, \port(r2)
- .endm
+ .macro inb reg, port
+ lis r2, 0xfe00
+ lbz \reg, \port(r2)
+ .endm
/*
** Write a byte to the SuperIO config area
*/
- .macro siowb offset, value
- li r3, 0
- li r4, (7<<3)
- li r5, \offset
- li r6, \value
- bl pci_write_cfg_byte
- .endm
+ .macro siowb offset, value
+ li r3, 0
+ li r4, (7<<3)
+ li r5, \offset
+ li r6, \value
+ bl pci_write_cfg_byte
+ .endm
#endif
diff --git a/board/MAI/AmigaOneG3SE/memio.S b/board/MAI/AmigaOneG3SE/memio.S
index c4a09aab10..980d343556 100644
--- a/board/MAI/AmigaOneG3SE/memio.S
+++ b/board/MAI/AmigaOneG3SE/memio.S
@@ -1,9 +1,8 @@
#include "macros.h"
-
.globl pci_read_cfg_byte
-
+
pci_read_cfg_byte:
config_addr
config_data 3
@@ -12,11 +11,10 @@ pci_read_cfg_byte:
lbz r3, 0(r9)
blr
-
.globl pci_write_cfg_byte
-
-pci_write_cfg_byte:
+
+pci_write_cfg_byte:
config_addr
config_data 3
stb r6, 0(r9)
@@ -25,9 +23,8 @@ pci_write_cfg_byte:
blr
-
.globl pci_read_cfg_word
-
+
pci_read_cfg_word:
config_addr
config_data 2
@@ -37,9 +34,8 @@ pci_read_cfg_word:
blr
-
.globl pci_write_cfg_word
-
+
pci_write_cfg_word:
config_addr
config_data 2
@@ -48,10 +44,9 @@ pci_write_cfg_word:
sync
blr
-
.globl pci_read_cfg_long
-
+
pci_read_cfg_long:
config_addr
config_data 0
@@ -61,9 +56,8 @@ pci_read_cfg_long:
blr
-
.globl pci_write_cfg_long
-
+
pci_write_cfg_long:
config_addr
config_data 0
@@ -71,4 +65,3 @@ pci_write_cfg_long:
eieio
sync
blr
-
diff --git a/board/MAI/AmigaOneG3SE/memio.h b/board/MAI/AmigaOneG3SE/memio.h
index df0839f91d..f5ce303070 100644
--- a/board/MAI/AmigaOneG3SE/memio.h
+++ b/board/MAI/AmigaOneG3SE/memio.h
@@ -2,7 +2,7 @@
* Memory mapped IO
*
* (C) Copyright 2002
- * Hyperion Entertainment, ThomasF@hyperion-entertainment.com
+ * Hyperion Entertainment, ThomasF@hyperion-entertainment.com
*
* See file CREDITS for list of people who contributed to this
* project.
@@ -15,9 +15,9 @@
*
* 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
- */
+ */
#ifndef _MEMIO_H
#define _MEMIO_H
@@ -97,8 +97,8 @@ static inline void write_long_big(volatile uint32 *to, uint32 x)
#define CONFIG_ADDR(bus, devfn, offset) \
write_long_big((uint32 *)0xFEC00CF8, \
- ((offset & 0xFC)<<24) | (devfn << 16) \
- | (bus<<8) | 0x80);
+ ((offset & 0xFC)<<24) | (devfn << 16) \
+ | (bus<<8) | 0x80);
#define CONFIG_DATA(offset,mask) ((void *)(0xFEE00CFC+(offset & mask)))
diff --git a/board/MAI/AmigaOneG3SE/nvram.c b/board/MAI/AmigaOneG3SE/nvram.c
index 5dde15b6a7..d37eec1f9b 100644
--- a/board/MAI/AmigaOneG3SE/nvram.c
+++ b/board/MAI/AmigaOneG3SE/nvram.c
@@ -1,6 +1,6 @@
/*
* (C) Copyright 2002
- * Thomas Frieden, Hyperion Entertainment
+ * Thomas Frieden, Hyperion Entertainment
* ThomasF@hyperion-entertainment.com
*
* See file CREDITS for list of people who contributed to this
@@ -34,4 +34,3 @@ void disable_nvram(void)
{
pci_write_cfg_byte(0, 0, 0x56, 0x0);
}
-
diff --git a/board/MAI/AmigaOneG3SE/ps2kbd.c b/board/MAI/AmigaOneG3SE/ps2kbd.c
index a6d67beecd..bfe5eb3ed7 100644
--- a/board/MAI/AmigaOneG3SE/ps2kbd.c
+++ b/board/MAI/AmigaOneG3SE/ps2kbd.c
@@ -1,7 +1,7 @@
/*
* (C) Copyright 2002
* John W. Linville, linville@tuxdriver.com
- *
+ *
* Modified from code for support of MIP405 and PIP405 boards. Previous
* copyright follows.
*
@@ -48,7 +48,6 @@ void i8259_unmask_irq(unsigned int irq);
#undef KBG_DEBUG
-//#define KBG_DEBUG
#ifdef KBG_DEBUG
#define PRINTF(fmt,args...) printf (fmt ,##args)
@@ -143,8 +142,6 @@ void i8259_unmask_irq(unsigned int irq);
#define KBD_BUFFER_LEN 0x20 /* size of the keyboardbuffer */
-
-
static volatile char kbd_buffer[KBD_BUFFER_LEN];
static volatile int in_pointer = 0;
static volatile int out_pointer = 0;
@@ -172,7 +169,7 @@ static unsigned char kbd_plain_xlate[] = {
'2', '3', '0', '.',0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, /* 0x50 - 0x5F */
'\r',0xff,0xff
};
-
+
static unsigned char kbd_shift_xlate[] = {
0xff,0x1b, '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+','\b','\t', /* 0x00 - 0x0f */
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}','\r',0xff, 'A', 'S', /* 0x10 - 0x1f */
@@ -194,7 +191,7 @@ static unsigned char kbd_ctrl_xlate[] = {
};
/******************************************************************
- * Init
+ * Init
******************************************************************/
int isa_kbd_init(void)
@@ -252,7 +249,7 @@ int drv_isa_kbd_init (void)
error=console_assign(stdin,DEVNAME);
if(error==0)
return 1;
- else
+ else
return error;
}
return 1;
@@ -261,7 +258,7 @@ int drv_isa_kbd_init (void)
}
/******************************************************************
- * Queue handling
+ * Queue handling
******************************************************************/
/* puts character in the queue and sets up the in and out pointer */
void kbd_put_queue(char data)
@@ -287,7 +284,7 @@ int kbd_testc(void)
if(in_pointer==out_pointer)
return(0); /* no data */
else
- return(1);
+ return(1);
}
/* gets the character from the queue */
int kbd_getc(void)
@@ -295,13 +292,13 @@ int kbd_getc(void)
char c;
while(in_pointer==out_pointer);
- if((out_pointer+1)==KBD_BUFFER_LEN)
+ if((out_pointer+1)==KBD_BUFFER_LEN)
out_pointer=0;
else
out_pointer++;
c=kbd_buffer[out_pointer];
return (int)c;
-
+
}
@@ -324,7 +321,7 @@ void kbd_set_leds(void)
kbd_send_data(KBD_CMD_SET_LEDS);
kbd_send_data(leds);
}
-
+
void handle_keyboard_event(unsigned char scancode)
{
@@ -381,11 +378,11 @@ void handle_keyboard_event(unsigned char scancode)
console_changed = 1;
}
return;
- case 0x2A:
+ case 0x2A:
case 0x36: /* shift pressed */
shift=1;
return; /* do nothing else */
- case 0xAA:
+ case 0xAA:
case 0xB6: /* shift released */
shift=0;
return; /* do nothing else */
@@ -408,15 +405,15 @@ void handle_keyboard_event(unsigned char scancode)
case 0x3A: /* capslock pressed */
caps_lock=~caps_lock;
kbd_set_leds();
- return;
+ return;
case 0x45: /* numlock pressed */
num_lock=~num_lock;
kbd_set_leds();
- return;
+ return;
case 0xC6: /* scroll lock released */
case 0xC5: /* num lock released */
case 0xBA: /* caps lock released */
- return; /* just swallow */
+ return; /* just swallow */
}
if((scancode&0x80)==0x80) /* key released */
return;
@@ -456,7 +453,7 @@ void handle_keyboard_event(unsigned char scancode)
PRINTF("unkown scancode %X\n",scancode);
return; /* swallow unknown codes */
}
-
+
kbd_put_queue(keycode);
PRINTF("%x\n",keycode);
}
@@ -494,30 +491,29 @@ unsigned char handle_kbd_event(void)
}
-
/******************************************************************************
* Lowlevel Part of keyboard section
- */
+ */
unsigned char kbd_read_status(void)
{
return(in8(CFG_ISA_IO_BASE_ADDRESS + KDB_COMMAND_PORT));
-}
-
+}
+
unsigned char kbd_read_input(void)
{
return(in8(CFG_ISA_IO_BASE_ADDRESS + KDB_DATA_PORT));
-}
+}
void kbd_write_command(unsigned char cmd)
{
out8(CFG_ISA_IO_BASE_ADDRESS + KDB_COMMAND_PORT,cmd);
-}
-
+}
+
void kbd_write_output(unsigned char data)
{
out8(CFG_ISA_IO_BASE_ADDRESS + KDB_DATA_PORT, data);
-}
-
+}
+
int kbd_read_data(void)
{
int val;
@@ -537,7 +533,7 @@ int kbd_wait_for_input(void)
{
unsigned long timeout;
int val;
-
+
timeout = KBD_TIMEOUT;
val=kbd_read_data();
while(val < 0)
@@ -602,7 +598,7 @@ char * kbd_initialize(void)
* If the test is successful a x55 is placed in the input buffer.
*/
kbd_write_command_w(KBD_CCMD_SELF_TEST);
- if (kbd_wait_for_input() != 0x55)
+ if (kbd_wait_for_input() != 0x55)
return "Kbd: failed self test";
/*
* Perform a keyboard interface test. This causes the controller
@@ -610,7 +606,7 @@ char * kbd_initialize(void)
* test are placed in the input buffer.
*/
kbd_write_command_w(KBD_CCMD_KBD_TEST);
- if (kbd_wait_for_input() != 0x00)
+ if (kbd_wait_for_input() != 0x00)
return "Kbd: interface failed self test";
/*
* Enable the keyboard by allowing the keyboard clock to run.
@@ -628,7 +624,7 @@ char * kbd_initialize(void)
do {
kbd_write_output_w(KBD_CMD_RESET);
status = kbd_wait_for_input();
- if (status == KBD_REPLY_ACK)
+ if (status == KBD_REPLY_ACK)
break;
if (status != KBD_REPLY_RESEND)
{
@@ -692,8 +688,3 @@ void kbd_interrupt(void)
{
handle_kbd_event();
}
-
-
-
-/* eof */
-
diff --git a/board/MAI/AmigaOneG3SE/ps2kbd.h b/board/MAI/AmigaOneG3SE/ps2kbd.h
index 95fc14d66a..fc5c4229dd 100644
--- a/board/MAI/AmigaOneG3SE/ps2kbd.h
+++ b/board/MAI/AmigaOneG3SE/ps2kbd.h
@@ -1,7 +1,7 @@
/*
* (C) Copyright 2002
* John W. Linville, linville@tuxdriver.com
- *
+ *
* Modified from code for support of MIP405 and PIP405 boards. Previous
* copyright follows.
*
@@ -30,7 +30,7 @@
#ifndef _KBD_H_
#define _KBD_H_
-
+
extern int kbd_testc(void);
extern int kbd_getc(void);
extern void kbd_interrupt(void);
diff --git a/board/MAI/AmigaOneG3SE/short_types.h b/board/MAI/AmigaOneG3SE/short_types.h
index 22df3c92c4..1840d28b45 100644
--- a/board/MAI/AmigaOneG3SE/short_types.h
+++ b/board/MAI/AmigaOneG3SE/short_types.h
@@ -2,7 +2,7 @@
* short type names
*
* (C) Copyright 2002
- * Hyperion Entertainment, ThomasF@hyperion-entertainment.com
+ * Hyperion Entertainment, ThomasF@hyperion-entertainment.com
*
* See file CREDITS for list of people who contributed to this
* project.
diff --git a/board/MAI/AmigaOneG3SE/smbus.c b/board/MAI/AmigaOneG3SE/smbus.c
index 616005ea93..de139773ea 100644
--- a/board/MAI/AmigaOneG3SE/smbus.c
+++ b/board/MAI/AmigaOneG3SE/smbus.c
@@ -26,18 +26,18 @@ void sm_write_byte(uint8 writeme)
{
int i;
int level;
-
+
out_byte(0xA539, 0x00);
level = 0;
for (i=0; i<8; i++)
{
- if ((writeme & 0x80) == (level<<7))
- {
+ if ((writeme & 0x80) == (level<<7))
+ {
/* Bit did not change, rewrite strobe */
out_byte(0xA539, level | 0x02);
- out_byte(0xA539, level);
+ out_byte(0xA539, level);
}
else
{
@@ -68,7 +68,7 @@ uint8 sm_read_byte(void)
}
return retme;
-}
+}
int sm_get_ack(void)
{
@@ -106,36 +106,36 @@ void sm_send_stop(void)
int sm_read_byte_from_device(uint8 addr, uint8 reg, uint8 *storage)
{
- // S Addr Wr
+ /* S Addr Wr */
sm_write_mode();
sm_send_start();
sm_write_byte((addr<<1));
-
- // [A]
+
+ /* [A] */
sm_read_mode();
if (sm_get_ack() == FALSE) return FALSE;
- // Comm
+ /* Comm */
sm_write_mode();
sm_write_byte(reg);
-
- // [A]
+
+ /* [A] */
sm_read_mode();
if (sm_get_ack() == FALSE) return FALSE;
- // S Addr Rd
+ /* S Addr Rd */
sm_write_mode();
sm_send_start();
sm_write_byte((addr<<1)|1);
-
- // [A]
+
+ /* [A] */
sm_read_mode();
if (sm_get_ack() == FALSE) return FALSE;
- // [Data]
+ /* [Data] */
*storage = sm_read_byte();
-
- // NA
+
+ /* NA */
sm_write_mode();
sm_write_nack();
sm_send_stop();
@@ -144,10 +144,10 @@ int sm_read_byte_from_device(uint8 addr, uint8 reg, uint8 *storage)
}
void sm_init(void)
-{
+{
/* Switch to PMC mode */
pci_write_cfg_byte(0, 0, REG_GROUP, (uint8)(REG_GROUP_SPECIAL|REG_GROUP_POWER));
-
+
/* Set GPIO Base */
pci_write_cfg_long(0, 0, 0x40, 0xa500);
@@ -155,12 +155,12 @@ void sm_init(void)
pci_write_cfg_byte(0, 0, 0x44, 0x11);
/* Set both GPIO 0 and 1 as output */
- out_byte(0xA53A, 0x03);
+ out_byte(0xA53A, 0x03);
}
void sm_term(void)
-{
+{
/* Switch to normal mode */
pci_write_cfg_byte(0, 0, REG_GROUP, 0);
}
@@ -173,7 +173,7 @@ int sm_get_data(uint8 *DataArray, int dimm_socket)
#if 0
/* Switch to PMC mode */
pci_write_cfg_byte(0, 0, REG_GROUP, (uint8)(REG_GROUP_SPECIAL|REG_GROUP_POWER));
-
+
/* Set GPIO Base */
pci_write_cfg_long(0, 0, 0x40, 0xa500);
@@ -181,7 +181,7 @@ int sm_get_data(uint8 *DataArray, int dimm_socket)
pci_write_cfg_byte(0, 0, 0x44, 0x11);
/* Set both GPIO 0 and 1 as output */
- out_byte(0xA53A, 0x03);
+ out_byte(0xA53A, 0x03);
#endif
sm_init();
diff --git a/board/MAI/AmigaOneG3SE/start.txt b/board/MAI/AmigaOneG3SE/start.txt
index 5c7b541a2b..e4214622ce 100644
--- a/board/MAI/AmigaOneG3SE/start.txt
+++ b/board/MAI/AmigaOneG3SE/start.txt
@@ -1,201 +1,198 @@
-
- /*------------------------------------------------------*/
- /* TERON Articia / SDRAM Init */
- /*------------------------------------------------------*/
-
-* XD_CTL = 0x81000000 (0x74)
-
-* HBUS_ACC_CTL_0 &= 0xFFFFFDFF (0x5c)
- /* host bus access ctl reg 2(5e) */
- /* set - CPU read from memory data one clock after data is latched */
-
-* GLOBL_INFO_0 |= 0x00004000 (0x50)
- /* global info register 2 (52), AGP/PCI bus 1 arbiter is addressed in Articia S */
-
- PCI_1_SB_CONFIG_0 |= 0x00000400 (0x80d0)
- /* PCI1 side band config reg 2 (d2), enable read acces while write buffer not empty */
-
- MEM_RAS_CTL_0 |= 0x3f000000 (0xcc)
- &= 0x3fffffff
- /* RAS park control reg 0(cc), park access enable is set */
-
- HOST_RDBUF_CTL |= 0x10000000 (0x70)
- &= 0x10ffffff
- /* host read buffer control reg, enable prefetch for CPU read from DRAM control */
-
- HBUS_ACC_CTL_0 |= 0x0100001f (0x5c)
- &= 0xf1ffffff
- /* host bus access control register, enable CPU address bus pipe control */
- /* two outstanding requests, *** changed to 2 from 3 */
- /* enable line merge write control for CPU write to system memory, PCI 1 */
- /* and PCI 0 bus memory; enable page merge write control for write to */
- /* PCI bus 0 & bus 1 memory */
-
- SRAM_CTL |= 0x00004000 (0xc8)
- &= 0xffbff7ff
- /* DRAM detail timing control register 1 (ca), bit 3 set to 0 */
- /* DRAM start access latency control - wait for one clock */
- /* ff9f changed to ffbf */
-
- DIM0_TIM_CTL_0 = 0x737d737d (0xc9)
- /* DRAM timing control for dimm0 & dimm1; set wait one clock */
- /* cycle for next data access */
-
- DIM2_TIM_CTL_0 = 0x737d737d (0xca)
- /* DRAM timing control for dimm2 & dimm3; set wait one clock */
- /* cycle for next data access */
-
- DIM0_BNK0_CTL_0 = BNK0_RAM_SIZ_128MB (0x90)
- /* set dimm0 bank0 for 128 MB */
-
- DIM0_BNK1_CTL_0 = BNK1_RAM_SIZ_128MB (0x94)
- /* set dimm0 for bank1 */
-
- DIM0_TIM_CTL_0 = 0xf3bf0000 (0xc9)
- /* dimm0 timing control register; RAS - CAS latency - 4 clock */
- /* CAS access latency - 3 wait; pre-charge latency - 3 wait */
- /* pre-charge command period control - 5 clock; wait one clock */
- /* cycle for next data access; read to write access latency control */
- /* - 2 clock cycles */
-
- DRAM_GBL_CTL_0 |= 0x00000100 (0xc0)
- &= 0xffff01ff
- /* memory global control register - support buffer sdram on bank 0 */
-
- DRAM_ECC_CTL_0 |= 0x00260000 (0xc4)
- &= 0xff26ffff
- /* enable ECC; enable read, modify, write control */
-
- DRAM_REF_CTL_0 = DRAM_REF_DATA (0xb8)
- /* set DRAM refresh parameters *** changed to 00940100 */
-
- nop
- nop
- nop
- nop
- nop
-
- DRAM_ECC_CTL_0 |= 0x20243280 (0xc4)
- /* turn off ecc */
- /* for SDRAM bank 0 */
-
- DRAM_ECC_CTL_0 |= 0x20243290 (0xc4) ?
- /* for SDRAM bank 1 */
-
-
-/* Additional Stuff...*/
-
- GLOBL_CTRL |= 0x20000b00 (0x54)
-
- PCI_0_SB_CONFIG |= 0x04100007 (0xd0)
- /* PCI 0 Side band config reg*/
-
- 0x8000083c |= 0x00080000
- /* Disable VGA decode on PCI Bus 1 */
-
-
-/*End Additional Stuff..*/
-
- /*--------------------------------------------------------------*/
- /* TERON serial port initialization code */
- /*--------------------------------------------------------------*/
-
- 0x84380080 |= 0x00030000
- /* enable super IO configuration VIA chip Register 85 */
- /* Enable super I/O config mode */
-
- 0xfe0003f0 = 0xe2
- bl delay1
-
- 0xfe0003f1 = 0x0f
- bl delay1
- /* enable com1 & com2, parallel port disabled */
-
- 0xfe0003f0 = 0xe7
- bl delay1
- /* let's make com1 base as 0x3f8 */
-
- 0xfe0003f1 = 0xfe
- bl delay1
-
- 0xfe0003f0 = 0xe8
- bl delay1
- /* let's make com2 base as 0x2f8 */
-
- 0xfe0003f1 = 0xbe
-
- 0x84380080 &= 0xfffdffff
- /* closing super IO configuration VIA chip Register 85 */
-
-
-/* -------------------------------*/
-
- 0xfe0003fb = 0x83
- bl delay1
- /*latch enable word length -8 bit */ /* set mslab bit */
- 0xfe0003f8 = 0x0c
- bl delay1
- /* set baud rate lsb for 9600 baud */
- 0xfe0003f9 = 0x0
- bl delay1
- /* set baud rate msb for 9600 baud */
- 0xfe0003fb = 0x03
- bl delay1
- /* reset mslab */
-
- /*--------------------------------------------------------------*/
- /* END TERON Serial Port Initialization Code */
- /*--------------------------------------------------------------*/
-
-
-
- /*--------------------------------------------------------------*/
- /* END TERON Articia / SDRAM Initialization code */
- /*--------------------------------------------------------------*/
-
-Proposed from Documentation:
-
-write dmem 0xfec00cf8 0x50000080
-write dmem 0xfee00cfc 0xc0305411
-
- Writes to index 0x50-0x53.
- 0x50: Global Information Register 0
- 0xC0 = Little Endian CPU, Sequential order Burst
- 0x51: Global Information Register 1
- Read only, 0x30 = Provides PowerPC and X86 support
- 0x52: Global Information Register 2
- 0x05 = 64/128 bit CPU bus support
- 0x53: Global Information Register 3
- 0x80 = PCI Bus 0 grant active time is 1 clock after REQ# deasserted
-
-write dmem 0xfec00cf8 0x5c000080
-write dmem 0xfee00cfc 0xb300011F
-
-write dmem 0xfec00cf8 0xc8000080
-write dmem 0xfee00cfc 0x0020f100
-
-write dmem 0xfec00cf8 0x90000080
-write dmem 0xfee00cfc 0x007fe700
-
-write dmem 0xfec00cf8 0x9400080
-write dmem 0xfee00cfc 0x007fe700
-
-write dmem 0xfec00cf8 0xb0000080
-write dmem 0xfee00cfc 0x737d737d
-
-write dmem 0xfec00cf8 0xb4000080
-write dmem 0xfee00cfc 0x737d737d
-
-write dmem 0xfec00cf8 0xc0000080
-write dmem 0xfee00cfc 0x40005500
-
-write dmem 0xfec00cf8 0xb8000080
-write dmem 0xfee00cfc 0x00940100
-
-write dmem 0xfec00cf8 0xc4000080
-write dmem 0xfee00cfc 0x00003280
-
-write dmem 0xfec00cf8 0xc4000080
-write dmem 0xfee00cfc 0x00003290
-
-
+
+ /*------------------------------------------------------*/
+ /* TERON Articia / SDRAM Init */
+ /*------------------------------------------------------*/
+
+* XD_CTL = 0x81000000 (0x74)
+
+* HBUS_ACC_CTL_0 &= 0xFFFFFDFF (0x5c)
+ /* host bus access ctl reg 2(5e) */
+ /* set - CPU read from memory data one clock after data is latched */
+
+* GLOBL_INFO_0 |= 0x00004000 (0x50)
+ /* global info register 2 (52), AGP/PCI bus 1 arbiter is addressed in Articia S */
+
+ PCI_1_SB_CONFIG_0 |= 0x00000400 (0x80d0)
+ /* PCI1 side band config reg 2 (d2), enable read acces while write buffer not empty */
+
+ MEM_RAS_CTL_0 |= 0x3f000000 (0xcc)
+ &= 0x3fffffff
+ /* RAS park control reg 0(cc), park access enable is set */
+
+ HOST_RDBUF_CTL |= 0x10000000 (0x70)
+ &= 0x10ffffff
+ /* host read buffer control reg, enable prefetch for CPU read from DRAM control */
+
+ HBUS_ACC_CTL_0 |= 0x0100001f (0x5c)
+ &= 0xf1ffffff
+ /* host bus access control register, enable CPU address bus pipe control */
+ /* two outstanding requests, *** changed to 2 from 3 */
+ /* enable line merge write control for CPU write to system memory, PCI 1 */
+ /* and PCI 0 bus memory; enable page merge write control for write to */
+ /* PCI bus 0 & bus 1 memory */
+
+ SRAM_CTL |= 0x00004000 (0xc8)
+ &= 0xffbff7ff
+ /* DRAM detail timing control register 1 (ca), bit 3 set to 0 */
+ /* DRAM start access latency control - wait for one clock */
+ /* ff9f changed to ffbf */
+
+ DIM0_TIM_CTL_0 = 0x737d737d (0xc9)
+ /* DRAM timing control for dimm0 & dimm1; set wait one clock */
+ /* cycle for next data access */
+
+ DIM2_TIM_CTL_0 = 0x737d737d (0xca)
+ /* DRAM timing control for dimm2 & dimm3; set wait one clock */
+ /* cycle for next data access */
+
+ DIM0_BNK0_CTL_0 = BNK0_RAM_SIZ_128MB (0x90)
+ /* set dimm0 bank0 for 128 MB */
+
+ DIM0_BNK1_CTL_0 = BNK1_RAM_SIZ_128MB (0x94)
+ /* set dimm0 for bank1 */
+
+ DIM0_TIM_CTL_0 = 0xf3bf0000 (0xc9)
+ /* dimm0 timing control register; RAS - CAS latency - 4 clock */
+ /* CAS access latency - 3 wait; pre-charge latency - 3 wait */
+ /* pre-charge command period control - 5 clock; wait one clock */
+ /* cycle for next data access; read to write access latency control */
+ /* - 2 clock cycles */
+
+ DRAM_GBL_CTL_0 |= 0x00000100 (0xc0)
+ &= 0xffff01ff
+ /* memory global control register - support buffer sdram on bank 0 */
+
+ DRAM_ECC_CTL_0 |= 0x00260000 (0xc4)
+ &= 0xff26ffff
+ /* enable ECC; enable read, modify, write control */
+
+ DRAM_REF_CTL_0 = DRAM_REF_DATA (0xb8)
+ /* set DRAM refresh parameters *** changed to 00940100 */
+
+ nop
+ nop
+ nop
+ nop
+ nop
+
+ DRAM_ECC_CTL_0 |= 0x20243280 (0xc4)
+ /* turn off ecc */
+ /* for SDRAM bank 0 */
+
+ DRAM_ECC_CTL_0 |= 0x20243290 (0xc4) ?
+ /* for SDRAM bank 1 */
+
+
+/* Additional Stuff...*/
+
+ GLOBL_CTRL |= 0x20000b00 (0x54)
+
+ PCI_0_SB_CONFIG |= 0x04100007 (0xd0)
+ /* PCI 0 Side band config reg*/
+
+ 0x8000083c |= 0x00080000
+ /* Disable VGA decode on PCI Bus 1 */
+
+
+/*End Additional Stuff..*/
+
+ /*--------------------------------------------------------------*/
+ /* TERON serial port initialization code */
+ /*--------------------------------------------------------------*/
+
+ 0x84380080 |= 0x00030000
+ /* enable super IO configuration VIA chip Register 85 */
+ /* Enable super I/O config mode */
+
+ 0xfe0003f0 = 0xe2
+ bl delay1
+
+ 0xfe0003f1 = 0x0f
+ bl delay1
+ /* enable com1 & com2, parallel port disabled */
+
+ 0xfe0003f0 = 0xe7
+ bl delay1
+ /* let's make com1 base as 0x3f8 */
+
+ 0xfe0003f1 = 0xfe
+ bl delay1
+
+ 0xfe0003f0 = 0xe8
+ bl delay1
+ /* let's make com2 base as 0x2f8 */
+
+ 0xfe0003f1 = 0xbe
+
+ 0x84380080 &= 0xfffdffff
+ /* closing super IO configuration VIA chip Register 85 */
+
+
+/* -------------------------------*/
+
+ 0xfe0003fb = 0x83
+ bl delay1
+ /*latch enable word length -8 bit */ /* set mslab bit */
+ 0xfe0003f8 = 0x0c
+ bl delay1
+ /* set baud rate lsb for 9600 baud */
+ 0xfe0003f9 = 0x0
+ bl delay1
+ /* set baud rate msb for 9600 baud */
+ 0xfe0003fb = 0x03
+ bl delay1
+ /* reset mslab */
+
+ /*--------------------------------------------------------------*/
+ /* END TERON Serial Port Initialization Code */
+ /*--------------------------------------------------------------*/
+
+
+ /*--------------------------------------------------------------*/
+ /* END TERON Articia / SDRAM Initialization code */
+ /*--------------------------------------------------------------*/
+
+Proposed from Documentation:
+
+write dmem 0xfec00cf8 0x50000080
+write dmem 0xfee00cfc 0xc0305411
+
+ Writes to index 0x50-0x53.
+ 0x50: Global Information Register 0
+ 0xC0 = Little Endian CPU, Sequential order Burst
+ 0x51: Global Information Register 1
+ Read only, 0x30 = Provides PowerPC and X86 support
+ 0x52: Global Information Register 2
+ 0x05 = 64/128 bit CPU bus support
+ 0x53: Global Information Register 3
+ 0x80 = PCI Bus 0 grant active time is 1 clock after REQ# deasserted
+
+write dmem 0xfec00cf8 0x5c000080
+write dmem 0xfee00cfc 0xb300011F
+
+write dmem 0xfec00cf8 0xc8000080
+write dmem 0xfee00cfc 0x0020f100
+
+write dmem 0xfec00cf8 0x90000080
+write dmem 0xfee00cfc 0x007fe700
+
+write dmem 0xfec00cf8 0x9400080
+write dmem 0xfee00cfc 0x007fe700
+
+write dmem 0xfec00cf8 0xb0000080
+write dmem 0xfee00cfc 0x737d737d
+
+write dmem 0xfec00cf8 0xb4000080
+write dmem 0xfee00cfc 0x737d737d
+
+write dmem 0xfec00cf8 0xc0000080
+write dmem 0xfee00cfc 0x40005500
+
+write dmem 0xfec00cf8 0xb8000080
+write dmem 0xfee00cfc 0x00940100
+
+write dmem 0xfec00cf8 0xc4000080
+write dmem 0xfee00cfc 0x00003280
+
+write dmem 0xfec00cf8 0xc4000080
+write dmem 0xfee00cfc 0x00003290
diff --git a/board/MAI/AmigaOneG3SE/u-boot.lds b/board/MAI/AmigaOneG3SE/u-boot.lds
index 10c0c3da2a..2281d35867 100644
--- a/board/MAI/AmigaOneG3SE/u-boot.lds
+++ b/board/MAI/AmigaOneG3SE/u-boot.lds
@@ -63,7 +63,7 @@ SECTIONS
cpu/74xx_7xx/start.o (.text)
/* store the environment in a seperate sector in the boot flash */
/* . = env_offset; */
- common/environment.o(.text)
+ common/environment.o(.text)
*(.text)
*(.fixup)
@@ -87,7 +87,7 @@ SECTIONS
PROVIDE (erotext = .);
.reloc :
{
- *(.got)
+ *(.got)
_GOT2_TABLE_ = .;
*(.got2)
_FIXUP_TABLE_ = .;
@@ -108,6 +108,11 @@ SECTIONS
_edata = .;
PROVIDE (edata = .);
+ __u_boot_cmd_start = .;
+ .u_boot_cmd : { *(.u_boot_cmd) }
+ __u_boot_cmd_end = .;
+
+
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
diff --git a/board/MAI/AmigaOneG3SE/usb_uhci.c b/board/MAI/AmigaOneG3SE/usb_uhci.c
index fd8cb4ef33..14e804308a 100644
--- a/board/MAI/AmigaOneG3SE/usb_uhci.c
+++ b/board/MAI/AmigaOneG3SE/usb_uhci.c
@@ -83,7 +83,7 @@
#define USB_MAX_TEMP_INT_TD 32 /* number of temporary TDs for Interrupt transfers */
-//#define USB_UHCI_DEBUG
+/*#define USB_UHCI_DEBUG */
#ifdef USB_UHCI_DEBUG
#define USB_UHCI_PRINTF(fmt,args...) printf (fmt ,##args)
@@ -599,7 +599,7 @@ int usb_lowlevel_init(void)
printf("Error USB UHCI (%04X,%04X) not found\n",USB_UHCI_VEND_ID,USB_UHCI_DEV_ID);
return -1;
}
-
+
#if 1
s = getenv("usb_irq");
if (s)
@@ -1115,7 +1115,6 @@ static void usb_display_wValue(unsigned short wValue,unsigned short wIndex)
#endif
-
#ifdef USB_UHCI_DEBUG
static int usb_display_td(uhci_td_t *td)
diff --git a/board/MAI/AmigaOneG3SE/usb_uhci.h b/board/MAI/AmigaOneG3SE/usb_uhci.h
index 7fda60b6a1..3387157320 100644
--- a/board/MAI/AmigaOneG3SE/usb_uhci.h
+++ b/board/MAI/AmigaOneG3SE/usb_uhci.h
@@ -190,5 +190,3 @@ struct virt_root_hub {
#endif /* _USB_UHCI_H_ */
-
-
diff --git a/board/MAI/AmigaOneG3SE/via686.c b/board/MAI/AmigaOneG3SE/via686.c
index 0483ca9fbd..c797e47691 100644
--- a/board/MAI/AmigaOneG3SE/via686.c
+++ b/board/MAI/AmigaOneG3SE/via686.c
@@ -211,18 +211,18 @@ void via_cfgfunc_via686(struct pci_controller *host, pci_dev_t dev, struct pci_c
__asm (" .globl via_calibrate_time_base \n"
"via_calibrate_time_base: \n"
- " lis 9, 0xfe00 \n"
- " li 0, 0x00 \n"
+ " lis 9, 0xfe00 \n"
+ " li 0, 0x00 \n"
" mttbu 0 \n"
" mttbl 0 \n"
"ctb_loop: \n"
- " lbz 0, 0x61(9) \n"
- " eieio \n"
- " andi. 0, 0, 0x20 \n"
- " beq ctb_loop \n"
- "ctb_done: \n"
- " mftb 3 \n"
- " blr");
+ " lbz 0, 0x61(9) \n"
+ " eieio \n"
+ " andi. 0, 0, 0x20 \n"
+ " beq ctb_loop \n"
+ "ctb_done: \n"
+ " mftb 3 \n"
+ " blr");
extern unsigned long via_calibrate_time_base(void);
diff --git a/board/MAI/AmigaOneG3SE/video.c b/board/MAI/AmigaOneG3SE/video.c
index e80288b129..36e3c624a9 100644
--- a/board/MAI/AmigaOneG3SE/video.c
+++ b/board/MAI/AmigaOneG3SE/video.c
@@ -1,6 +1,6 @@
/*
* (C) Copyright 2002
- * Hyperion Entertainment, Hans-JoergF@hyperion-entertainment.com
+ * Hyperion Entertainment, Hans-JoergF@hyperion-entertainment.com
*
* See file CREDITS for list of people who contributed to this
* project.
@@ -100,7 +100,7 @@ int drv_video_init(void)
video_inited = 1;
video_init();
memset (&vgadev, 0, sizeof(vgadev));
-
+
strcpy(vgadev.name, VIDEO_NAME);
vgadev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_SYSTEM;
vgadev.putc = video_putc;
@@ -108,7 +108,7 @@ int drv_video_init(void)
vgadev.getc = NULL;
vgadev.tstc = NULL;
vgadev.start = video_start;
-
+
error = device_register (&vgadev);
if (error == 0)
@@ -129,11 +129,11 @@ int drv_video_init(void)
int video_init(void)
{
- cursor_position = VIDEO_BASE; // Color text display base
+ cursor_position = VIDEO_BASE; /* Color text display base */
cursor_row = 0;
cursor_col = 0;
- current_attr = video_get_attr(); // Currently selected value for attribute.
-// video_test();
+ current_attr = video_get_attr(); /* Currently selected value for attribute. */
+/* video_test(); */
video_set_color(current_attr);
return 0;
@@ -283,7 +283,7 @@ void video_bios_print_string(char *s, int x, int y, int attr, int count)
void video_draw_box(int style, int attr, char *title, int separate, int x, int y, int w, int h)
{
- unsigned char *fb, *fb2;
+ unsigned char *fb, *fb2;
unsigned char *st = (style == SINGLE_BOX)?video_single_box : video_double_box;
unsigned char *ti = (style == SINGLE_BOX)?video_single_title : video_double_title;
int i;
@@ -324,11 +324,11 @@ void video_draw_box(int style, int attr, char *title, int separate, int x, int y
*fb = st[3];
*(fb+1) = attr; fb += 2*VIDEO_COLS;
- *fb2 = st[4];
+ *fb2 = st[4];
*(fb2+1) = attr; fb2 += 2*VIDEO_COLS;
}
-
- // Draw title
+
+ /* Draw title */
if (title)
{
if (separate == 0)
@@ -370,7 +370,7 @@ void video_draw_box(int style, int attr, char *title, int separate, int x, int y
fb += 2;
}
fb = video_addr(x+2, y+1);
-
+
while (*title)
{
*fb = *title;
@@ -414,7 +414,7 @@ void video_save_rect(int x, int y, int w, int h, void *save_area, int clearchar,
}
void video_restore_rect(int x, int y, int w, int h, void *save_area)
-{
+{
unsigned char *save = (unsigned char *)save_area;
unsigned char *fb = video_addr(x,y);
int i,j;
@@ -484,7 +484,7 @@ void video_banner(void)
int i;
char *s;
int maxdev;
-
+
if (video_inited == 0) return;
#ifdef EASTEREGG
diff --git a/board/MAI/bios_emulator/bios.c b/board/MAI/bios_emulator/bios.c
index 4707bd9a8c..d51eb64692 100644
--- a/board/MAI/bios_emulator/bios.c
+++ b/board/MAI/bios_emulator/bios.c
@@ -130,14 +130,14 @@ static void X86API int1A(int intno)
switch(M.x86.R_AX)
{
- case 0xB101: // PCI Bios Present?
+ case 0xB101: /* PCI Bios Present? */
M.x86.R_AL = 0x00;
M.x86.R_EDX = 0x20494350;
M.x86.R_BX = 0x0210;
M.x86.R_CL = 3;
CLEAR_FLAG(F_CF);
break;
- case 0xB102: // Find device
+ case 0xB102: /* Find device */
device = mypci_find_device(M.x86.R_DX, M.x86.R_CX, M.x86.R_SI);
if (device != -1)
{
@@ -151,52 +151,52 @@ static void X86API int1A(int intno)
}
CONDITIONAL_SET_FLAG((M.x86.R_AH != PCIBIOS_SUCCESSFUL), F_CF);
break;
- case 0xB103: // Find PCI class code
+ case 0xB103: /* Find PCI class code */
M.x86.R_AH = PCIBIOS_DEVICE_NOT_FOUND;
- //printf("Find by class not yet implmented");
+ /*printf("Find by class not yet implmented"); */
CONDITIONAL_SET_FLAG((M.x86.R_AH != PCIBIOS_SUCCESSFUL), F_CF);
break;
- case 0xB108: // read config byte
+ case 0xB108: /* read config byte */
M.x86.R_CL = mypci_read_cfg_byte(M.x86.R_BH, M.x86.R_BL, M.x86.R_DI);
M.x86.R_AH = PCIBIOS_SUCCESSFUL;
CONDITIONAL_SET_FLAG((M.x86.R_AH != PCIBIOS_SUCCESSFUL), F_CF);
- //printf("read_config_byte %x,%x,%x -> %x\n", M.x86.R_BH, M.x86.R_BL, M.x86.R_DI,
- // M.x86.R_CL);
+ /*printf("read_config_byte %x,%x,%x -> %x\n", M.x86.R_BH, M.x86.R_BL, M.x86.R_DI, */
+ /* M.x86.R_CL); */
break;
- case 0xB109: // read config word
+ case 0xB109: /* read config word */
M.x86.R_CX = mypci_read_cfg_word(M.x86.R_BH, M.x86.R_BL, M.x86.R_DI);
M.x86.R_AH = PCIBIOS_SUCCESSFUL;
CONDITIONAL_SET_FLAG((M.x86.R_AH != PCIBIOS_SUCCESSFUL), F_CF);
- //printf("read_config_word %x,%x,%x -> %x\n", M.x86.R_BH, M.x86.R_BL, M.x86.R_DI,
- // M.x86.R_CX);
+ /*printf("read_config_word %x,%x,%x -> %x\n", M.x86.R_BH, M.x86.R_BL, M.x86.R_DI, */
+ /* M.x86.R_CX); */
break;
- case 0xB10A: // read config dword
+ case 0xB10A: /* read config dword */
M.x86.R_ECX = mypci_read_cfg_long(M.x86.R_BH, M.x86.R_BL, M.x86.R_DI);
M.x86.R_AH = PCIBIOS_SUCCESSFUL;
CONDITIONAL_SET_FLAG((M.x86.R_AH != PCIBIOS_SUCCESSFUL), F_CF);
- //printf("read_config_long %x,%x,%x -> %x\n", M.x86.R_BH, M.x86.R_BL, M.x86.R_DI,
- // M.x86.R_ECX);
+ /*printf("read_config_long %x,%x,%x -> %x\n", M.x86.R_BH, M.x86.R_BL, M.x86.R_DI, */
+ /* M.x86.R_ECX); */
break;
- case 0xB10B: // write config byte
+ case 0xB10B: /* write config byte */
mypci_write_cfg_byte(M.x86.R_BH, M.x86.R_BL, M.x86.R_DI, M.x86.R_CL);
M.x86.R_AH = PCIBIOS_SUCCESSFUL;
CONDITIONAL_SET_FLAG((M.x86.R_AH != PCIBIOS_SUCCESSFUL), F_CF);
- //printf("write_config_byte %x,%x,%x <- %x\n", M.x86.R_BH, M.x86.R_BL, M.x86.R_DI,
- // M.x86.R_CL);
+ /*printf("write_config_byte %x,%x,%x <- %x\n", M.x86.R_BH, M.x86.R_BL, M.x86.R_DI, */
+ /* M.x86.R_CL); */
break;
- case 0xB10C: // write config word
+ case 0xB10C: /* write config word */
mypci_write_cfg_word(M.x86.R_BH, M.x86.R_BL, M.x86.R_DI, M.x86.R_CX);
M.x86.R_AH = PCIBIOS_SUCCESSFUL;
CONDITIONAL_SET_FLAG((M.x86.R_AH != PCIBIOS_SUCCESSFUL), F_CF);
- //printf("write_config_word %x,%x,%x <- %x\n", M.x86.R_BH, M.x86.R_BL, M.x86.R_DI,
- // M.x86.R_CX);
+ /*printf("write_config_word %x,%x,%x <- %x\n", M.x86.R_BH, M.x86.R_BL, M.x86.R_DI, */
+ /* M.x86.R_CX); */
break;
- case 0xB10D: // write config dword
+ case 0xB10D: /* write config dword */
mypci_write_cfg_long(M.x86.R_BH, M.x86.R_BL, M.x86.R_DI, M.x86.R_ECX);
M.x86.R_AH = PCIBIOS_SUCCESSFUL;
CONDITIONAL_SET_FLAG((M.x86.R_AH != PCIBIOS_SUCCESSFUL), F_CF);
- //printf("write_config_long %x,%x,%x <- %x\n", M.x86.R_BH, M.x86.R_BL, M.x86.R_DI,
- // M.x86.R_ECX);
+ /*printf("write_config_long %x,%x,%x <- %x\n", M.x86.R_BH, M.x86.R_BL, M.x86.R_DI, */
+ /* M.x86.R_ECX); */
break;
default:
PRINTF("BIOS int %xh: Unknown function AX=%04xh\n", intno, M.x86.R_AX);
@@ -208,7 +208,7 @@ void bios_init(void)
{
int i;
X86EMU_intrFuncs bios_intr_tab[256];
-
+
for (i=0; i<256; i++)
{
write_long_little(M.mem_base+i*4, BIOS_SEG<<16);
@@ -221,7 +221,7 @@ void bios_init(void)
bios_intr_tab[0x15] = int15;
bios_intr_tab[0x6D] = int42;
-
+
X86EMU_setupIntrFuncs(bios_intr_tab);
video_init();
}
@@ -252,14 +252,14 @@ unsigned char setup_bw[] =
unsigned char * setup_modes[] =
{
- setup_40x25, // mode 0: 40x25 bw text
- setup_40x25, // mode 1: 40x25 col text
- setup_80x25, // mode 2: 80x25 bw text
- setup_80x25, // mode 3: 80x25 col text
- setup_graphics, // mode 4: 320x200 col graphics
- setup_graphics, // mode 5: 320x200 bw graphics
- setup_graphics, // mode 6: 640x200 bw graphics
- setup_bw // mode 7: 80x25 mono text
+ setup_40x25, /* mode 0: 40x25 bw text */
+ setup_40x25, /* mode 1: 40x25 col text */
+ setup_80x25, /* mode 2: 80x25 bw text */
+ setup_80x25, /* mode 3: 80x25 col text */
+ setup_graphics, /* mode 4: 320x200 col graphics */
+ setup_graphics, /* mode 5: 320x200 bw graphics */
+ setup_graphics, /* mode 6: 640x200 bw graphics */
+ setup_bw /* mode 7: 80x25 mono text */
};
unsigned int setup_cols[] =
@@ -280,13 +280,13 @@ unsigned int setup_bufsize[] =
void bios_set_mode(int mode)
{
int i;
- unsigned char mode_set = setup_modesets[mode]; // Control register value
- unsigned char *setup_regs = setup_modes[mode]; // Register 3D4 Array
+ unsigned char mode_set = setup_modesets[mode]; /* Control register value */
+ unsigned char *setup_regs = setup_modes[mode]; /* Register 3D4 Array */
- // Switch video off
+ /* Switch video off */
out_byte(0x3D8, mode_set & 0x37);
- // Set up parameters at 3D4h
+ /* Set up parameters at 3D4h */
for (i=0; i<16; i++)
{
out_byte(0x3D4, (unsigned char)i);
@@ -294,10 +294,10 @@ void bios_set_mode(int mode)
setup_regs++;
}
- // Enable video
+ /* Enable video */
out_byte(0x3D8, mode_set);
- // Set overscan
+ /* Set overscan */
if (mode == 6) out_byte(0x3D9, 0x3F);
else out_byte(0x3D9, 0x30);
}
diff --git a/board/MAI/bios_emulator/glue.c b/board/MAI/bios_emulator/glue.c
index f59ffaa56d..b380f0dfe8 100644
--- a/board/MAI/bios_emulator/glue.c
+++ b/board/MAI/bios_emulator/glue.c
@@ -401,7 +401,7 @@ int find_image(u32 rom_address, u32 rom_size, void **image, u32 *image_size)
{
int i = 0;
unsigned char *rom = (unsigned char *)rom_address;
- /* if (*rom != 0x55 || *(rom+1) != 0xAA) return 0; // No bios rom this is, yes. */
+ /* if (*rom != 0x55 || *(rom+1) != 0xAA) return 0; /* No bios rom this is, yes. */ */
for (;;)
{
@@ -479,7 +479,6 @@ void show_bat_mapping(void)
}
-
void remove_init_data(void)
{
char *s;
@@ -497,19 +496,19 @@ void remove_init_data(void)
}
else if (s)
{
- if (strcmp(s, "dcache")==0)
- {
- dcache_enable();
- }
- else if (strcmp(s, "icache") == 0)
- {
- icache_enable();
- }
- else if (strcmp(s, "on")== 0 || strcmp(s, "both") == 0)
- {
- dcache_enable();
- icache_enable();
- }
+ if (strcmp(s, "dcache")==0)
+ {
+ dcache_enable();
+ }
+ else if (strcmp(s, "icache") == 0)
+ {
+ icache_enable();
+ }
+ else if (strcmp(s, "on")== 0 || strcmp(s, "both") == 0)
+ {
+ dcache_enable();
+ icache_enable();
+ }
}
/* show_bat_mapping();*/
diff --git a/board/MAI/bios_emulator/scitech/include/biosemu.h b/board/MAI/bios_emulator/scitech/include/biosemu.h
index e38ff3157f..82c33a7c1d 100644
--- a/board/MAI/bios_emulator/scitech/include/biosemu.h
+++ b/board/MAI/bios_emulator/scitech/include/biosemu.h
@@ -152,4 +152,3 @@ void PMAPI BE_exit(void);
#endif
#endif /* __BIOSEMU_H */
-
diff --git a/board/MAI/bios_emulator/scitech/include/event.h b/board/MAI/bios_emulator/scitech/include/event.h
index 0de45172d6..beeac87645 100644
--- a/board/MAI/bios_emulator/scitech/include/event.h
+++ b/board/MAI/bios_emulator/scitech/include/event.h
@@ -201,9 +201,9 @@ keyboard), but the translated ASCII values may be different depending on
the country code pages in use.
NOTE: Scan codes in the event library are not really hardware scan codes,
- but rather virtual scan codes as generated by a low level keyboard
- interface driver. All virtual codes begin with scan code 0x60 and
- range up from there.
+ but rather virtual scan codes as generated by a low level keyboard
+ interface driver. All virtual codes begin with scan code 0x60 and
+ range up from there.
HEADER:
event.h
@@ -496,38 +496,38 @@ event.h
MEMBERS:
which - Window identifier for message for use by high level window manager
- code (i.e. MegaVision GUI or Windows API).
+ code (i.e. MegaVision GUI or Windows API).
what - Type of event that occurred. Will be one of the values defined by
- the EVT_eventType enumeration.
+ the EVT_eventType enumeration.
when - Time that the event occurred in milliseconds since startup
where_x - X coordinate of the mouse cursor location at the time of the event
- (in screen coordinates). For joystick events this represents
- the position of the first joystick X axis.
+ (in screen coordinates). For joystick events this represents
+ the position of the first joystick X axis.
where_y - Y coordinate of the mouse cursor location at the time of the event
- (in screen coordinates). For joystick events this represents
- the position of the first joystick Y axis.
+ (in screen coordinates). For joystick events this represents
+ the position of the first joystick Y axis.
relative_x - Relative movement of the mouse cursor in the X direction (in
- units of mickeys, or 1/200th of an inch). For joystick events
- this represents the position of the second joystick X axis.
+ units of mickeys, or 1/200th of an inch). For joystick events
+ this represents the position of the second joystick X axis.
relative_y - Relative movement of the mouse cursor in the Y direction (in
- units of mickeys, or 1/200th of an inch). For joystick events
- this represents the position of the second joystick Y axis.
+ units of mickeys, or 1/200th of an inch). For joystick events
+ this represents the position of the second joystick Y axis.
message - Event specific message for the event. For use events this can be
- any user specific information. For keyboard events this contains
- the ASCII code in bits 0-7, the keyboard scan code in bits 8-15 and
- the character repeat count in bits 16-30. You can use the
- EVT_asciiCode, EVT_scanCode and EVT_repeatCount macros to extract
- this information from the message field. For mouse events this
- contains information about which button was pressed, and will be a
- combination of the flags defined by the EVT_eventMouseMaskType
- enumeration. For joystick events, this conatins information
- about which buttons were pressed, and will be a combination of
- the flags defined by the EVT_eventJoyMaskType enumeration.
+ any user specific information. For keyboard events this contains
+ the ASCII code in bits 0-7, the keyboard scan code in bits 8-15 and
+ the character repeat count in bits 16-30. You can use the
+ EVT_asciiCode, EVT_scanCode and EVT_repeatCount macros to extract
+ this information from the message field. For mouse events this
+ contains information about which button was pressed, and will be a
+ combination of the flags defined by the EVT_eventMouseMaskType
+ enumeration. For joystick events, this conatins information
+ about which buttons were pressed, and will be a combination of
+ the flags defined by the EVT_eventJoyMaskType enumeration.
modifiers - Contains additional information about the state of the keyboard
- shift modifiers (Ctrl, Alt and Shift keys) when the event
- occurred. For mouse events it will also contain the state of
- the mouse buttons. Will be a combination of the values defined
- by the EVT_eventModMaskType enumeration.
+ shift modifiers (Ctrl, Alt and Shift keys) when the event
+ occurred. For mouse events it will also contain the state of
+ the mouse buttons. Will be a combination of the values defined
+ by the EVT_eventModMaskType enumeration.
next - Internal use; do not use.
prev - Internal use; do not use.
****************************************************************************/
@@ -555,8 +555,8 @@ different code page translation table if you want to support keyboards
other than the US English keyboard (the default).
NOTE: Entries in code page tables *must* be in ascending order for the
- scan codes as we do a binary search on the tables for the ASCII
- code equivalents.
+ scan codes as we do a binary search on the tables for the ASCII
+ code equivalents.
HEADER:
event.h
diff --git a/board/MAI/bios_emulator/scitech/include/pcilib.h b/board/MAI/bios_emulator/scitech/include/pcilib.h
index e2d58b0848..238f8ef83b 100644
--- a/board/MAI/bios_emulator/scitech/include/pcilib.h
+++ b/board/MAI/bios_emulator/scitech/include/pcilib.h
@@ -103,14 +103,14 @@ typedef enum {
typedef union {
struct {
- uint Zero:2;
- uint Register:6;
- uint Function:3;
- uint Device:5;
- uint Bus:8;
- uint Reserved:7;
- uint Enable:1;
- } p;
+ uint Zero:2;
+ uint Register:6;
+ uint Function:3;
+ uint Device:5;
+ uint Bus:8;
+ uint Reserved:7;
+ uint Enable:1;
+ } p;
ulong i;
} PCIslot;
@@ -194,9 +194,9 @@ typedef struct {
uchar SubordinateBus;
uchar SecondaryLatency;
struct {
- ulong Base;
- ulong Limit;
- } Range[4];
+ ulong Base;
+ ulong Limit;
+ } Range[4];
uchar InterruptLine;
uchar InterruptPin;
ushort BridgeControl;
@@ -224,10 +224,10 @@ typedef struct {
uchar HeaderType;
uchar BIST;
union {
- PCIType0Info type0;
- PCIType1Info type1;
- PCIType2Info type2;
- } u;
+ PCIType0Info type0;
+ PCIType1Info type1;
+ PCIType2Info type2;
+ } u;
} PCIDeviceInfo;
/* PCI Capability header structure. All PCI capabilities have the
@@ -411,4 +411,3 @@ ulong _ASMAPI PCIBIOS_getEntry(void);
#endif
#endif /* __PCILIB_H */
-
diff --git a/board/MAI/bios_emulator/scitech/include/pm_help.h b/board/MAI/bios_emulator/scitech/include/pm_help.h
index 60a7c25457..536a2baac5 100644
--- a/board/MAI/bios_emulator/scitech/include/pm_help.h
+++ b/board/MAI/bios_emulator/scitech/include/pm_help.h
@@ -164,4 +164,3 @@ typedef enum {
#endif /* !__OS2__ */
#endif /* __PMHELP_H */
-
diff --git a/board/MAI/bios_emulator/scitech/include/pm_wctl.h b/board/MAI/bios_emulator/scitech/include/pm_wctl.h
index 088c19e531..20aa15e534 100644
--- a/board/MAI/bios_emulator/scitech/include/pm_wctl.h
+++ b/board/MAI/bios_emulator/scitech/include/pm_wctl.h
@@ -73,4 +73,3 @@ PMHELP_CTL_CODE(GASETLOCALPATH ,0x002D),
PMHELP_CTL_CODE(GAGETEXPORTS ,0x002E),
PMHELP_CTL_CODE(GATHUNK ,0x002F),
PMHELP_CTL_CODE(SETNUCLEUSPATH ,0x0030),
-
diff --git a/board/MAI/bios_emulator/scitech/include/pmapi.h b/board/MAI/bios_emulator/scitech/include/pmapi.h
index 3affe67d63..7ddace7080 100644
--- a/board/MAI/bios_emulator/scitech/include/pmapi.h
+++ b/board/MAI/bios_emulator/scitech/include/pmapi.h
@@ -1146,4 +1146,3 @@ int PMAPI PM_int386x(int intno, PMREGS *in, PMREGS *out,PMSREGS *sregs);
#endif
#endif /* __PMAPI_H */
-
diff --git a/board/MAI/bios_emulator/scitech/include/pmimp.h b/board/MAI/bios_emulator/scitech/include/pmimp.h
index d6c5cdb740..817f5e6a21 100644
--- a/board/MAI/bios_emulator/scitech/include/pmimp.h
+++ b/board/MAI/bios_emulator/scitech/include/pmimp.h
@@ -191,4 +191,3 @@ PM_imports _VARAPI _PM_imports = {
NULL,
#endif
};
-
diff --git a/board/MAI/bios_emulator/scitech/include/scitech.h b/board/MAI/bios_emulator/scitech/include/scitech.h
index 1dbfface0d..8d5eee9443 100644
--- a/board/MAI/bios_emulator/scitech/include/scitech.h
+++ b/board/MAI/bios_emulator/scitech/include/scitech.h
@@ -80,7 +80,7 @@
#ifdef __GNUC__
#ifdef __cplusplus
-// G++ currently fucks this up!
+/* G++ currently fucks this up! */
#define __cdecl
#define __stdcall
#else
@@ -605,18 +605,18 @@ void _ASMAPI DebugVxD(void);
{ \
static ibool firstTime = true; \
if (firstTime) { \
- firstTime = false; \
- DebugInt(); \
- } \
+ firstTime = false; \
+ DebugInt(); \
+ } \
}
#define DebugVxDOnce() \
{ \
static ibool firstTime = true; \
if (firstTime) { \
- firstTime = false; \
- DebugVxD(); \
- } \
+ firstTime = false; \
+ DebugVxD(); \
+ } \
}
/* Macros for linux string compatibility functions */
@@ -636,10 +636,10 @@ void _ASMAPI DebugVxD(void);
/* Get rid of some helaciously annoying Visual C++ warnings! */
#if defined(_MSC_VER) && !defined(__MWERKS__) && !defined(__SC__)
-#pragma warning(disable:4761) // integral size mismatch in argument; conversion supplied
-#pragma warning(disable:4244) // conversion from 'unsigned short ' to 'unsigned char ', possible loss of data
-#pragma warning(disable:4018) // '<' : signed/unsigned mismatch
-#pragma warning(disable:4305) // 'initializing' : truncation from 'const double' to 'float'
+#pragma warning(disable:4761) /* integral size mismatch in argument; conversion supplied */
+#pragma warning(disable:4244) /* conversion from 'unsigned short ' to 'unsigned char ', possible loss of data */
+#pragma warning(disable:4018) /* '<' : signed/unsigned mismatch */
+#pragma warning(disable:4305) /* 'initializing' : truncation from 'const double' to 'float' */
#endif
/*---------------------------------------------------------------------------
@@ -674,29 +674,29 @@ void _CHK_defaultFail(int fatal,const char *msg,const char *cond,const char *fil
# define CHK(x) x
#if CHECKED > 1
# define CHECK(p) \
- ((p) ? (void)0 : DebugInt(), \
- _CHK_fail(1,"Check failed: '%s', file %s, line %d\n", \
- #p, __FILE__, __LINE__))
+ ((p) ? (void)0 : DebugInt(), \
+ _CHK_fail(1,"Check failed: '%s', file %s, line %d\n", \
+ #p, __FILE__, __LINE__))
# define WARN(p) \
- ((p) ? (void)0 : DebugInt(), \
- _CHK_fail(0,"Warning: '%s', file %s, line %d\n", \
- #p, __FILE__, __LINE__))
+ ((p) ? (void)0 : DebugInt(), \
+ _CHK_fail(0,"Warning: '%s', file %s, line %d\n", \
+ #p, __FILE__, __LINE__))
#else
# define CHECK(p) \
- ((p) ? (void)0 : \
- _CHK_fail(1,"Check failed: '%s', file %s, line %d\n", \
- #p, __FILE__, __LINE__))
+ ((p) ? (void)0 : \
+ _CHK_fail(1,"Check failed: '%s', file %s, line %d\n", \
+ #p, __FILE__, __LINE__))
# define WARN(p) \
- ((p) ? (void)0 : \
- _CHK_fail(0,"Warning: '%s', file %s, line %d\n", \
- #p, __FILE__, __LINE__))
+ ((p) ? (void)0 : \
+ _CHK_fail(0,"Warning: '%s', file %s, line %d\n", \
+ #p, __FILE__, __LINE__))
#endif
# define LOGFATAL(msg) \
- _CHK_fail(1,"Fatal error: '%s', file %s, line %d\n", \
- msg, __FILE__, __LINE__)
+ _CHK_fail(1,"Fatal error: '%s', file %s, line %d\n", \
+ msg, __FILE__, __LINE__)
# define LOGWARN(msg) \
- _CHK_fail(0,"Warning: '%s', file %s, line %d\n", \
- msg, __FILE__, __LINE__)
+ _CHK_fail(0,"Warning: '%s', file %s, line %d\n", \
+ msg, __FILE__, __LINE__)
#else
# define CHK(x)
# define CHECK(p) ((void)0)
diff --git a/board/MAI/bios_emulator/scitech/include/x86emu/regs.h b/board/MAI/bios_emulator/scitech/include/x86emu/regs.h
index c6ce88462a..a12017b00f 100644
--- a/board/MAI/bios_emulator/scitech/include/x86emu/regs.h
+++ b/board/MAI/bios_emulator/scitech/include/x86emu/regs.h
@@ -105,7 +105,7 @@ struct i386_special_regs {
u32 FLAGS;
};
-/*
+/*
* Segment registers here represent the 16 bit quantities
* CS, DS, ES, SS.
*/
@@ -183,8 +183,8 @@ struct i386_segment_regs {
#define F_ALWAYS_ON (0x0002) /* flag bits always on */
/*
- * Define a mask for only those flag bits we will ever pass back
- * (via PUSHF)
+ * Define a mask for only those flag bits we will ever pass back
+ * (via PUSHF)
*/
#define F_MSK (FB_CF|FB_PF|FB_AF|FB_ZF|FB_SF|FB_TF|FB_IF|FB_DF|FB_OF)
@@ -235,21 +235,21 @@ struct i386_segment_regs {
#define SYSMODE_HALTED 0x40000000
#define SYSMODE_SEGMASK (SYSMODE_SEG_DS_SS | \
- SYSMODE_SEGOVR_CS | \
- SYSMODE_SEGOVR_DS | \
- SYSMODE_SEGOVR_ES | \
- SYSMODE_SEGOVR_FS | \
- SYSMODE_SEGOVR_GS | \
- SYSMODE_SEGOVR_SS)
+ SYSMODE_SEGOVR_CS | \
+ SYSMODE_SEGOVR_DS | \
+ SYSMODE_SEGOVR_ES | \
+ SYSMODE_SEGOVR_FS | \
+ SYSMODE_SEGOVR_GS | \
+ SYSMODE_SEGOVR_SS)
#define SYSMODE_CLRMASK (SYSMODE_SEG_DS_SS | \
- SYSMODE_SEGOVR_CS | \
- SYSMODE_SEGOVR_DS | \
- SYSMODE_SEGOVR_ES | \
- SYSMODE_SEGOVR_FS | \
- SYSMODE_SEGOVR_GS | \
- SYSMODE_SEGOVR_SS | \
- SYSMODE_PREFIX_DATA | \
- SYSMODE_PREFIX_ADDR)
+ SYSMODE_SEGOVR_CS | \
+ SYSMODE_SEGOVR_DS | \
+ SYSMODE_SEGOVR_ES | \
+ SYSMODE_SEGOVR_FS | \
+ SYSMODE_SEGOVR_GS | \
+ SYSMODE_SEGOVR_SS | \
+ SYSMODE_PREFIX_DATA | \
+ SYSMODE_PREFIX_ADDR)
#define INTR_SYNCH 0x1
#define INTR_ASYNCH 0x2
@@ -266,8 +266,8 @@ typedef struct {
* Delayed flag set 3 bits (zero, signed, parity)
* reserved 6 bits
* interrupt # 8 bits instruction raised interrupt
- * BIOS video segregs 4 bits
- * Interrupt Pending 1 bits
+ * BIOS video segregs 4 bits
+ * Interrupt Pending 1 bits
* Extern interrupt 1 bits
* Halted 1 bits
*/
@@ -317,12 +317,12 @@ extern "C" { /* Use "C" linkage when in C++ mode */
extern X86EMU_sysEnv _X86EMU_env;
#define M _X86EMU_env
-
+
/*-------------------------- Function Prototypes --------------------------*/
/* Function to log information at runtime */
-//void printk(const char *fmt, ...);
+/*void printk(const char *fmt, ...); */
#ifdef __cplusplus
} /* End of "C" linkage for C++ */
diff --git a/board/MAI/bios_emulator/scitech/makedefs/common.mk b/board/MAI/bios_emulator/scitech/makedefs/common.mk
index da2364f644..d337152e74 100644
--- a/board/MAI/bios_emulator/scitech/makedefs/common.mk
+++ b/board/MAI/bios_emulator/scitech/makedefs/common.mk
@@ -178,4 +178,3 @@ ASFLAGS += -d__SNAP__
# Include file dependencies
.INCLUDE .IGNORE: "makefile.dep"
-
diff --git a/board/MAI/bios_emulator/scitech/makedefs/gcc_linux.mk b/board/MAI/bios_emulator/scitech/makedefs/gcc_linux.mk
index 361ed4a2a7..72c4cedfd4 100644
--- a/board/MAI/bios_emulator/scitech/makedefs/gcc_linux.mk
+++ b/board/MAI/bios_emulator/scitech/makedefs/gcc_linux.mk
@@ -178,4 +178,3 @@ PMLIB := -lpm
# Define which file contains our rules
RULES_MAK := gcc_linux.mk
-
diff --git a/board/MAI/bios_emulator/scitech/makedefs/gcc_win32.mk b/board/MAI/bios_emulator/scitech/makedefs/gcc_win32.mk
index 1709d884c3..21ccf97849 100644
--- a/board/MAI/bios_emulator/scitech/makedefs/gcc_win32.mk
+++ b/board/MAI/bios_emulator/scitech/makedefs/gcc_win32.mk
@@ -133,4 +133,3 @@ PMLIB := -lpm
# Define which file contains our rules
RULES_MAK := gcc_win32.mk
-
diff --git a/board/MAI/bios_emulator/scitech/makedefs/qnx4.mk b/board/MAI/bios_emulator/scitech/makedefs/qnx4.mk
index 56dfa4de56..f583af36f6 100644
--- a/board/MAI/bios_emulator/scitech/makedefs/qnx4.mk
+++ b/board/MAI/bios_emulator/scitech/makedefs/qnx4.mk
@@ -162,4 +162,3 @@ PMLIB := -lpm
# Define which file contains our rules
RULES_MAK := qnx4.mk
-
diff --git a/board/MAI/bios_emulator/scitech/makedefs/rules/gcc_beos.mk b/board/MAI/bios_emulator/scitech/makedefs/rules/gcc_beos.mk
index 4b59328267..681b698fc2 100644
--- a/board/MAI/bios_emulator/scitech/makedefs/rules/gcc_beos.mk
+++ b/board/MAI/bios_emulator/scitech/makedefs/rules/gcc_beos.mk
@@ -44,5 +44,4 @@ PMLIB :=
%$L: ; $(LIB) $(LIBFLAGS) $@ $&
# Implicit rule for building an executable file
-%$E: ; $(LD) $(LDFLAGS) -o $@ $& $(EXELIBS) $(PMLIB)
-
+%$E: ; $(LD) $(LDFLAGS) -o $@ $& $(EXELIBS) $(PMLIB)
diff --git a/board/MAI/bios_emulator/scitech/makedefs/rules/gcc_linux.mk b/board/MAI/bios_emulator/scitech/makedefs/rules/gcc_linux.mk
index 56719ed765..5f91fe53f4 100644
--- a/board/MAI/bios_emulator/scitech/makedefs/rules/gcc_linux.mk
+++ b/board/MAI/bios_emulator/scitech/makedefs/rules/gcc_linux.mk
@@ -91,4 +91,3 @@ LD := $(LDXX)
@$(ECHO) ld $@
@$(LD) $(LDFLAGS) -o $@ $& $(EXELIBS) $(PMLIB) -lm
.ENDIF
-
diff --git a/board/MAI/bios_emulator/scitech/makedefs/rules/gcc_win32.mk b/board/MAI/bios_emulator/scitech/makedefs/rules/gcc_win32.mk
index 36b24b1a7c..485d166ac4 100644
--- a/board/MAI/bios_emulator/scitech/makedefs/rules/gcc_win32.mk
+++ b/board/MAI/bios_emulator/scitech/makedefs/rules/gcc_win32.mk
@@ -88,4 +88,3 @@ LD := $(LDXX)
@$(ECHO) ld $@
@$(LD) $(LDFLAGS) -o $@ @$(mktmp $(&:s/\/\\) $(EXELIBS) $(PMLIB) -lm)
.ENDIF
-
diff --git a/board/MAI/bios_emulator/scitech/makedefs/rules/va32.mk b/board/MAI/bios_emulator/scitech/makedefs/rules/va32.mk
index 588028f734..1a20319cba 100644
--- a/board/MAI/bios_emulator/scitech/makedefs/rules/va32.mk
+++ b/board/MAI/bios_emulator/scitech/makedefs/rules/va32.mk
@@ -69,14 +69,14 @@ PMLIB :=
# Implicit rule for building an executable file using response file
.IF $(USE_OS2GUI)
%$E: ;
- rclink $(LD) $(RC) $@ $(mktmp $(LDFLAGS) $(&:t"+\n":s/\/\\)\n$@\n$*.map\n$(EXELIBS) $(PMLIB)\n$*.def\n)
+ rclink $(LD) $(RC) $@ $(mktmp $(LDFLAGS) $(&:t"+\n":s/\/\\)\n$@\n$*.map\n$(EXELIBS) $(PMLIB)\n$*.def\n)
.IF $(LXLITE)
- lxlite $@
+ lxlite $@
.ENDIF
.ELSE
%$E: ;
- rclink $(LD) $(RC) $@ $(mktmp $(LDFLAGS) $(&:t"+\n":s/\/\\)\n$@\n$*.map\n$(EXELIBS) $(PMLIB)\n\n)
+ rclink $(LD) $(RC) $@ $(mktmp $(LDFLAGS) $(&:t"+\n":s/\/\\)\n$@\n$*.map\n$(EXELIBS) $(PMLIB)\n\n)
.IF $(LXLITE)
- lxlite $@
+ lxlite $@
.ENDIF
.ENDIF
diff --git a/board/MAI/bios_emulator/scitech/makedefs/rules/va365.mk b/board/MAI/bios_emulator/scitech/makedefs/rules/va365.mk
index 0c149b758f..2b4180146a 100644
--- a/board/MAI/bios_emulator/scitech/makedefs/rules/va365.mk
+++ b/board/MAI/bios_emulator/scitech/makedefs/rules/va365.mk
@@ -66,14 +66,14 @@ PMLIB :=
# Implicit rule for building an executable file using response file
.IF $(USE_OS2GUI)
%$E: ;
- rclink $(LD) $(RC) $@ $(mktmp $(LDFLAGS) $(&:t"+\n":s/\/\\)\n$@\n$*.map\n$(EXELIBS) $(PMLIB)\n$*.def\n)
+ rclink $(LD) $(RC) $@ $(mktmp $(LDFLAGS) $(&:t"+\n":s/\/\\)\n$@\n$*.map\n$(EXELIBS) $(PMLIB)\n$*.def\n)
.IF $(LXLITE)
- lxlite $@
+ lxlite $@
.ENDIF
.ELSE
%$E: ;
- rclink $(LD) $(RC) $@ $(mktmp $(LDFLAGS) $(&:t"+\n":s/\/\\)\n$@\n$*.map\n$(EXELIBS) $(PMLIB)\n\n)
+ rclink $(LD) $(RC) $@ $(mktmp $(LDFLAGS) $(&:t"+\n":s/\/\\)\n$@\n$*.map\n$(EXELIBS) $(PMLIB)\n\n)
.IF $(LXLITE)
- lxlite $@
+ lxlite $@
.ENDIF
.ENDIF
diff --git a/board/MAI/bios_emulator/scitech/makedefs/rules/wc32.mk b/board/MAI/bios_emulator/scitech/makedefs/rules/wc32.mk
index 68bfd83bea..39b8819b2b 100644
--- a/board/MAI/bios_emulator/scitech/makedefs/rules/wc32.mk
+++ b/board/MAI/bios_emulator/scitech/makedefs/rules/wc32.mk
@@ -109,7 +109,7 @@ LDFLAGS += OP PRIV=1
@gcpp -DNASM_ASSEMBLER -D__WATCOMC__ -EP $(<:s,/,\) > $(*:s,/,\).asm
nasm @$(mktmp -f obj -o $@) $(*:s,/,\).asm
@$(RM) -S $(mktmp $(*:s,/,\).asm)
-.ENDIF
+.ENDIF
# Special target to build dllstart.asm using Borland TASM
dllstart.obj: dllstart.asm
@@ -126,26 +126,26 @@ dllstart.obj: dllstart.asm
@trimlib $(mktmp $(LDFLAGS) OP quiet SYS os2v2 dll\nN $@\nF $(&:t",\n":s/\/\\)\nLIBR $(EXELIBS:t",")) $*.lnk
rclink $(LD) $(RC) $@ $*.lnk
.IF $(LEAVE_LINKFILE)
-.ELSE
+.ELSE
@$(RM) -S $(mktmp *.lnk)
-.ENDIF
+.ENDIF
.ELIF $(USE_WIN32)
%$D: ;
@trimlib $(mktmp $(LDFLAGS) OP quiet SYS nt_dll\nN $@\nF $(&:t",\n":s/\/\\)\nLIBR $(PMLIB)$(DEFLIBS)$(EXELIBS:t",")) $*.lnk
rclink $(LD) $(RC) $@ $*.lnk
.IF $(LEAVE_LINKFILE)
-.ELSE
+.ELSE
@$(RM) -S $(mktmp *.lnk)
-.ENDIF
+.ENDIF
.ELSE
%$D: ;
@trimlib $(mktmp $(LDFLAGS) OP quiet SYS win386\nN $*.rex\nF $(&:t",\n":s/\/\\)\nLIBR $(EXELIBS:t",")) $*.lnk
rclink $(LD) $(RC) $@ $*.lnk
wbind $* -d -q -n
.IF $(LEAVE_LINKFILE)
-.ELSE
+.ELSE
@$(RM) -S $(mktmp *.lnk)
-.ENDIF
+.ENDIF
.ENDIF
.ENDIF
@@ -171,18 +171,18 @@ dllstart.obj: dllstart.asm
$(LD) $(LDFLAGS) @$*.lnk
x32fix $@
.IF $(LEAVE_LINKFILE)
-.ELSE
+.ELSE
@$(RM) -S $(mktmp *.lnk)
-.ENDIF
+.ENDIF
.ELIF $(USE_OS232)
.IF $(USE_OS2GUI)
%$E: ;
@trimlib $(mktmp $(LDFLAGS) OP quiet SYS os2v2_pm\nN $@\nF $(&:t",":s/\/\\)\nLIBR $(PMLIB)$(EXELIBS:t",")) $*.lnk
rclink $(LD) $(RC) $@ $*.lnk
.IF $(LEAVE_LINKFILE)
-.ELSE
+.ELSE
@$(RM) -S $(mktmp *.lnk)
-.ENDIF
+.ENDIF
.IF $(LXLITE)
lxlite $@
.ENDIF
@@ -191,9 +191,9 @@ dllstart.obj: dllstart.asm
@trimlib $(mktmp $(LDFLAGS) OP quiet SYS os2v2\nN $@\nF $(&:t",":s/\/\\)\nLIBR $(PMLIB)$(EXELIBS:t",")) $*.lnk
rclink $(LD) $(RC) $@ $*.lnk
.IF $(LEAVE_LINKFILE)
-.ELSE
+.ELSE
@$(RM) -S $(mktmp *.lnk)
-.ENDIF
+.ENDIF
.IF $(LXLITE)
lxlite $@
.ENDIF
@@ -203,43 +203,43 @@ dllstart.obj: dllstart.asm
@trimlib $(mktmp $(LDFLAGS) OP quiet SYS nt\nN $@\nF $(&:t",":s/\/\\)\nLIBR $(DEFLIBS)$(EXELIBS:t",")) $*.lnk
rclink $(LD) $(RC) $@ $*.lnk
.IF $(LEAVE_LINKFILE)
-.ELSE
+.ELSE
@$(RM) -S $(mktmp *.lnk)
-.ENDIF
+.ENDIF
.ELIF $(USE_WIN32)
.IF $(WIN32_GUI)
%$E: ;
@trimlib $(mktmp $(LDFLAGS) OP quiet SYS win95\nN $@\nF $(&:t",":s/\/\\)\nLIBR $(PMLIB)$(DEFLIBS)$(EXELIBS:t",")) $*.lnk
rclink $(LD) $(RC) $@ $*.lnk
.IF $(LEAVE_LINKFILE)
-.ELSE
+.ELSE
@$(RM) -S $(mktmp *.lnk)
-.ENDIF
+.ENDIF
.ELSE
%$E: ;
@trimlib $(mktmp $(LDFLAGS) OP quiet SYS nt\nN $@\nF $(&:t",":s/\/\\)\nLIBR $(PMLIB)$(DEFLIBS)$(EXELIBS:t",")) $*.lnk
rclink $(LD) $(RC) $@ $*.lnk
.IF $(LEAVE_LINKFILE)
-.ELSE
+.ELSE
@$(RM) -S $(mktmp *.lnk)
-.ENDIF
+.ENDIF
.ENDIF
.ELIF $(USE_WIN386)
%$E: ;
@trimlib $(mktmp $(LDFLAGS) OP quiet SYS win386\nN $*.rex\nF $(&:t",":s/\/\\)\nLIBR $(PMLIB)$(EXELIBS:t",")) $*.lnk
rclink $(LD) wbind $*.rex $*.lnk
.IF $(LEAVE_LINKFILE)
-.ELSE
+.ELSE
@$(RM) -S $(mktmp *.lnk)
-.ENDIF
+.ENDIF
.ELIF $(USE_TNT)
%$E: ;
@trimlib $(mktmp $(LDFLAGS) OP quiet\nN $@\nF $(&:t",":s/\/\\)\nLIBR dosx32.lib,tntapi.lib,$(PMLIB)$(EXELIBS:t",")) $*.lnk
$(LD) @$*.lnk
.IF $(LEAVE_LINKFILE)
-.ELSE
+.ELSE
@$(RM) -S $(mktmp *.lnk)
-.ENDIF
+.ENDIF
.IF $(DOSSTYLE)
@markphar $@
.ENDIF
@@ -250,16 +250,15 @@ dllstart.obj: dllstart.asm
$(LD) @$*.lnk
@attrib +s $*.exe
.IF $(LEAVE_LINKFILE)
-.ELSE
+.ELSE
@$(RM) -S $(mktmp *.lnk)
-.ENDIF
+.ENDIF
.ELSE
%$E: ;
@trimlib $(mktmp $(LDFLAGS) OP quiet\nN $@\nF $(&:t",":s/\/\\)\nLIBR $(PMLIB)$(EXELIBS:t",")) $*.lnk
$(LD) @$*.lnk
.IF $(LEAVE_LINKFILE)
-.ELSE
+.ELSE
@$(RM) -S $(mktmp *.lnk)
-.ENDIF
.ENDIF
-
+.ENDIF
diff --git a/board/MAI/bios_emulator/scitech/makedefs/startup.mk b/board/MAI/bios_emulator/scitech/makedefs/startup.mk
index 1d67a975e8..d8b2ba2b9b 100644
--- a/board/MAI/bios_emulator/scitech/makedefs/startup.mk
+++ b/board/MAI/bios_emulator/scitech/makedefs/startup.mk
@@ -159,4 +159,3 @@ __.SILENT := $(.SILENT)
# We dont use TABS in our makefiles
.NOTABS := yes
-
diff --git a/board/MAI/bios_emulator/scitech/makedefs/wc32.mk b/board/MAI/bios_emulator/scitech/makedefs/wc32.mk
index ff035117be..e5175ca9ea 100644
--- a/board/MAI/bios_emulator/scitech/makedefs/wc32.mk
+++ b/board/MAI/bios_emulator/scitech/makedefs/wc32.mk
@@ -351,4 +351,3 @@ LIB_BASE_DIR := $(SCITECH_LIB)\lib\release
# Define which file contains our rules
RULES_MAK := wc32.mk
-
diff --git a/board/MAI/bios_emulator/scitech/src/biosemu/besys.c b/board/MAI/bios_emulator/scitech/src/biosemu/besys.c
index 7f7ea99939..1512ce9bf9 100644
--- a/board/MAI/bios_emulator/scitech/src/biosemu/besys.c
+++ b/board/MAI/bios_emulator/scitech/src/biosemu/besys.c
@@ -77,20 +77,20 @@ u8 X86API BE_rdb(
u8 val = 0;
if (addr >= 0xC0000 && addr <= _BE_env.biosmem_limit) {
- val = *(u8*)(_BE_env.biosmem_base + addr - 0xC0000);
- }
+ val = *(u8*)(_BE_env.biosmem_base + addr - 0xC0000);
+ }
else if (addr >= 0xA0000 && addr <= 0xFFFFF) {
- val = readb(_BE_env.busmem_base, addr - 0xA0000);
- }
+ val = readb(_BE_env.busmem_base, addr - 0xA0000);
+ }
else if (addr > M.mem_size - 1) {
DB( printk("mem_read: address %#lx out of range!\n", addr);)
- HALT_SYS();
- }
+ HALT_SYS();
+ }
else {
- val = *(u8*)(M.mem_base + addr);
- }
+ val = *(u8*)(M.mem_base + addr);
+ }
DB( if (DEBUG_MEM())
- printk("%#08x 1 -> %#x\n", addr, val);)
+ printk("%#08x 1 -> %#x\n", addr, val);)
return val;
}
@@ -112,42 +112,42 @@ u16 X86API BE_rdw(
if (addr >= 0xC0000 && addr <= _BE_env.biosmem_limit) {
#ifdef __BIG_ENDIAN__
- if (addr & 0x1) {
- addr -= 0xC0000;
- val = ( *(u8*)(_BE_env.biosmem_base + addr) |
- (*(u8*)(_BE_env.biosmem_base + addr + 1) << 8));
- }
- else
+ if (addr & 0x1) {
+ addr -= 0xC0000;
+ val = ( *(u8*)(_BE_env.biosmem_base + addr) |
+ (*(u8*)(_BE_env.biosmem_base + addr + 1) << 8));
+ }
+ else
#endif
- val = *(u16*)(_BE_env.biosmem_base + addr - 0xC0000);
- }
+ val = *(u16*)(_BE_env.biosmem_base + addr - 0xC0000);
+ }
else if (addr >= 0xA0000 && addr <= 0xFFFFF) {
#ifdef __BIG_ENDIAN__
- if (addr & 0x1) {
- addr -= 0xA0000;
- val = ( readb(_BE_env.busmem_base, addr) |
- (readb(_BE_env.busmem_base, addr + 1) << 8));
- }
- else
+ if (addr & 0x1) {
+ addr -= 0xA0000;
+ val = ( readb(_BE_env.busmem_base, addr) |
+ (readb(_BE_env.busmem_base, addr + 1) << 8));
+ }
+ else
#endif
- val = readw(_BE_env.busmem_base, addr - 0xA0000);
- }
+ val = readw(_BE_env.busmem_base, addr - 0xA0000);
+ }
else if (addr > M.mem_size - 2) {
DB( printk("mem_read: address %#lx out of range!\n", addr);)
- HALT_SYS();
- }
+ HALT_SYS();
+ }
else {
#ifdef __BIG_ENDIAN__
- if (addr & 0x1) {
- val = ( *(u8*)(M.mem_base + addr) |
- (*(u8*)(M.mem_base + addr + 1) << 8));
- }
- else
+ if (addr & 0x1) {
+ val = ( *(u8*)(M.mem_base + addr) |
+ (*(u8*)(M.mem_base + addr + 1) << 8));
+ }
+ else
#endif
- val = *(u16*)(M.mem_base + addr);
- }
+ val = *(u16*)(M.mem_base + addr);
+ }
DB( if (DEBUG_MEM())
- printk("%#08x 2 -> %#x\n", addr, val);)
+ printk("%#08x 2 -> %#x\n", addr, val);)
return val;
}
@@ -169,48 +169,48 @@ u32 X86API BE_rdl(
if (addr >= 0xC0000 && addr <= _BE_env.biosmem_limit) {
#ifdef __BIG_ENDIAN__
- if (addr & 0x3) {
- addr -= 0xC0000;
- val = ( *(u8*)(_BE_env.biosmem_base + addr + 0) |
- (*(u8*)(_BE_env.biosmem_base + addr + 1) << 8) |
- (*(u8*)(_BE_env.biosmem_base + addr + 2) << 16) |
- (*(u8*)(_BE_env.biosmem_base + addr + 3) << 24));
- }
- else
+ if (addr & 0x3) {
+ addr -= 0xC0000;
+ val = ( *(u8*)(_BE_env.biosmem_base + addr + 0) |
+ (*(u8*)(_BE_env.biosmem_base + addr + 1) << 8) |
+ (*(u8*)(_BE_env.biosmem_base + addr + 2) << 16) |
+ (*(u8*)(_BE_env.biosmem_base + addr + 3) << 24));
+ }
+ else
#endif
- val = *(u32*)(_BE_env.biosmem_base + addr - 0xC0000);
- }
+ val = *(u32*)(_BE_env.biosmem_base + addr - 0xC0000);
+ }
else if (addr >= 0xA0000 && addr <= 0xFFFFF) {
#ifdef __BIG_ENDIAN__
- if (addr & 0x3) {
- addr -= 0xA0000;
- val = ( readb(_BE_env.busmem_base, addr) |
- (readb(_BE_env.busmem_base, addr + 1) << 8) |
- (readb(_BE_env.busmem_base, addr + 2) << 16) |
- (readb(_BE_env.busmem_base, addr + 3) << 24));
- }
- else
+ if (addr & 0x3) {
+ addr -= 0xA0000;
+ val = ( readb(_BE_env.busmem_base, addr) |
+ (readb(_BE_env.busmem_base, addr + 1) << 8) |
+ (readb(_BE_env.busmem_base, addr + 2) << 16) |
+ (readb(_BE_env.busmem_base, addr + 3) << 24));
+ }
+ else
#endif
- val = readl(_BE_env.busmem_base, addr - 0xA0000);
- }
+ val = readl(_BE_env.busmem_base, addr - 0xA0000);
+ }
else if (addr > M.mem_size - 4) {
DB( printk("mem_read: address %#lx out of range!\n", addr);)
- HALT_SYS();
- }
+ HALT_SYS();
+ }
else {
#ifdef __BIG_ENDIAN__
- if (addr & 0x3) {
- val = ( *(u8*)(M.mem_base + addr + 0) |
- (*(u8*)(M.mem_base + addr + 1) << 8) |
- (*(u8*)(M.mem_base + addr + 2) << 16) |
- (*(u8*)(M.mem_base + addr + 3) << 24));
- }
- else
+ if (addr & 0x3) {
+ val = ( *(u8*)(M.mem_base + addr + 0) |
+ (*(u8*)(M.mem_base + addr + 1) << 8) |
+ (*(u8*)(M.mem_base + addr + 2) << 16) |
+ (*(u8*)(M.mem_base + addr + 3) << 24));
+ }
+ else
#endif
- val = *(u32*)(M.mem_base + addr);
- }
+ val = *(u32*)(M.mem_base + addr);
+ }
DB( if (DEBUG_MEM())
- printk("%#08x 4 -> %#x\n", addr, val);)
+ printk("%#08x 4 -> %#x\n", addr, val);)
return val;
}
@@ -228,20 +228,20 @@ void X86API BE_wrb(
u8 val)
{
DB( if (DEBUG_MEM())
- printk("%#08x 1 <- %#x\n", addr, val);)
+ printk("%#08x 1 <- %#x\n", addr, val);)
if (addr >= 0xC0000 && addr <= _BE_env.biosmem_limit) {
- *(u8*)(_BE_env.biosmem_base + addr - 0xC0000) = val;
- }
+ *(u8*)(_BE_env.biosmem_base + addr - 0xC0000) = val;
+ }
else if (addr >= 0xA0000 && addr <= 0xFFFFF) {
- writeb(val, _BE_env.busmem_base, addr - 0xA0000);
- }
+ writeb(val, _BE_env.busmem_base, addr - 0xA0000);
+ }
else if (addr > M.mem_size-1) {
DB( printk("mem_write: address %#lx out of range!\n", addr);)
- HALT_SYS();
- }
+ HALT_SYS();
+ }
else {
- *(u8*)(M.mem_base + addr) = val;
- }
+ *(u8*)(M.mem_base + addr) = val;
+ }
}
/****************************************************************************
@@ -258,43 +258,43 @@ void X86API BE_wrw(
u16 val)
{
DB( if (DEBUG_MEM())
- printk("%#08x 2 <- %#x\n", addr, val);)
+ printk("%#08x 2 <- %#x\n", addr, val);)
if (addr >= 0xC0000 && addr <= _BE_env.biosmem_limit) {
#ifdef __BIG_ENDIAN__
- if (addr & 0x1) {
- addr -= 0xC0000;
- *(u8*)(_BE_env.biosmem_base + addr + 0) = (val >> 0) & 0xff;
- *(u8*)(_BE_env.biosmem_base + addr + 1) = (val >> 8) & 0xff;
- }
- else
+ if (addr & 0x1) {
+ addr -= 0xC0000;
+ *(u8*)(_BE_env.biosmem_base + addr + 0) = (val >> 0) & 0xff;
+ *(u8*)(_BE_env.biosmem_base + addr + 1) = (val >> 8) & 0xff;
+ }
+ else
#endif
- *(u16*)(_BE_env.biosmem_base + addr - 0xC0000) = val;
- }
+ *(u16*)(_BE_env.biosmem_base + addr - 0xC0000) = val;
+ }
else if (addr >= 0xA0000 && addr <= 0xFFFFF) {
#ifdef __BIG_ENDIAN__
- if (addr & 0x1) {
- addr -= 0xA0000;
- writeb(val >> 0, _BE_env.busmem_base, addr);
- writeb(val >> 8, _BE_env.busmem_base, addr + 1);
- }
- else
+ if (addr & 0x1) {
+ addr -= 0xA0000;
+ writeb(val >> 0, _BE_env.busmem_base, addr);
+ writeb(val >> 8, _BE_env.busmem_base, addr + 1);
+ }
+ else
#endif
- writew(val, _BE_env.busmem_base, addr - 0xA0000);
- }
+ writew(val, _BE_env.busmem_base, addr - 0xA0000);
+ }
else if (addr > M.mem_size-2) {
DB( printk("mem_write: address %#lx out of range!\n", addr);)
- HALT_SYS();
- }
+ HALT_SYS();
+ }
else {
#ifdef __BIG_ENDIAN__
- if (addr & 0x1) {
- *(u8*)(M.mem_base + addr + 0) = (val >> 0) & 0xff;
- *(u8*)(M.mem_base + addr + 1) = (val >> 8) & 0xff;
- }
- else
+ if (addr & 0x1) {
+ *(u8*)(M.mem_base + addr + 0) = (val >> 0) & 0xff;
+ *(u8*)(M.mem_base + addr + 1) = (val >> 8) & 0xff;
+ }
+ else
#endif
- *(u16*)(M.mem_base + addr) = val;
- }
+ *(u16*)(M.mem_base + addr) = val;
+ }
}
/****************************************************************************
@@ -311,49 +311,49 @@ void X86API BE_wrl(
u32 val)
{
DB( if (DEBUG_MEM())
- printk("%#08x 4 <- %#x\n", addr, val);)
+ printk("%#08x 4 <- %#x\n", addr, val);)
if (addr >= 0xC0000 && addr <= _BE_env.biosmem_limit) {
#ifdef __BIG_ENDIAN__
- if (addr & 0x1) {
- addr -= 0xC0000;
- *(u8*)(M.mem_base + addr + 0) = (val >> 0) & 0xff;
- *(u8*)(M.mem_base + addr + 1) = (val >> 8) & 0xff;
- *(u8*)(M.mem_base + addr + 2) = (val >> 16) & 0xff;
- *(u8*)(M.mem_base + addr + 3) = (val >> 24) & 0xff;
- }
- else
+ if (addr & 0x1) {
+ addr -= 0xC0000;
+ *(u8*)(M.mem_base + addr + 0) = (val >> 0) & 0xff;
+ *(u8*)(M.mem_base + addr + 1) = (val >> 8) & 0xff;
+ *(u8*)(M.mem_base + addr + 2) = (val >> 16) & 0xff;
+ *(u8*)(M.mem_base + addr + 3) = (val >> 24) & 0xff;
+ }
+ else
#endif
- *(u32*)(M.mem_base + addr - 0xC0000) = val;
- }
+ *(u32*)(M.mem_base + addr - 0xC0000) = val;
+ }
else if (addr >= 0xA0000 && addr <= 0xFFFFF) {
#ifdef __BIG_ENDIAN__
- if (addr & 0x3) {
- addr -= 0xA0000;
- writeb(val >> 0, _BE_env.busmem_base, addr);
- writeb(val >> 8, _BE_env.busmem_base, addr + 1);
- writeb(val >> 16, _BE_env.busmem_base, addr + 1);
- writeb(val >> 24, _BE_env.busmem_base, addr + 1);
- }
- else
+ if (addr & 0x3) {
+ addr -= 0xA0000;
+ writeb(val >> 0, _BE_env.busmem_base, addr);
+ writeb(val >> 8, _BE_env.busmem_base, addr + 1);
+ writeb(val >> 16, _BE_env.busmem_base, addr + 1);
+ writeb(val >> 24, _BE_env.busmem_base, addr + 1);
+ }
+ else
#endif
- writel(val, _BE_env.busmem_base, addr - 0xA0000);
- }
+ writel(val, _BE_env.busmem_base, addr - 0xA0000);
+ }
else if (addr > M.mem_size-4) {
DB( printk("mem_write: address %#lx out of range!\n", addr);)
- HALT_SYS();
- }
+ HALT_SYS();
+ }
else {
#ifdef __BIG_ENDIAN__
- if (addr & 0x1) {
- *(u8*)(M.mem_base + addr + 0) = (val >> 0) & 0xff;
- *(u8*)(M.mem_base + addr + 1) = (val >> 8) & 0xff;
- *(u8*)(M.mem_base + addr + 2) = (val >> 16) & 0xff;
- *(u8*)(M.mem_base + addr + 3) = (val >> 24) & 0xff;
- }
- else
+ if (addr & 0x1) {
+ *(u8*)(M.mem_base + addr + 0) = (val >> 0) & 0xff;
+ *(u8*)(M.mem_base + addr + 1) = (val >> 8) & 0xff;
+ *(u8*)(M.mem_base + addr + 2) = (val >> 16) & 0xff;
+ *(u8*)(M.mem_base + addr + 3) = (val >> 24) & 0xff;
+ }
+ else
#endif
- *(u32*)(M.mem_base + addr) = val;
- }
+ *(u32*)(M.mem_base + addr) = val;
+ }
}
/* Debug functions to do ISA/PCI bus port I/O */
@@ -365,7 +365,7 @@ u8 X86API BE_inb(int port)
{
u8 val = PM_inpb(port);
if (DEBUG_IO())
- printk("%04X:%04X: inb.%04X -> %02X\n",M.x86.saved_cs, M.x86.saved_ip, (ushort)port, val);
+ printk("%04X:%04X: inb.%04X -> %02X\n",M.x86.saved_cs, M.x86.saved_ip, (ushort)port, val);
return val;
}
@@ -373,7 +373,7 @@ u16 X86API BE_inw(int port)
{
u16 val = PM_inpw(port);
if (DEBUG_IO())
- printk("%04X:%04X: inw.%04X -> %04X\n",M.x86.saved_cs, M.x86.saved_ip, (ushort)port, val);
+ printk("%04X:%04X: inw.%04X -> %04X\n",M.x86.saved_cs, M.x86.saved_ip, (ushort)port, val);
return val;
}
@@ -381,28 +381,28 @@ u32 X86API BE_inl(int port)
{
u32 val = PM_inpd(port);
if (DEBUG_IO())
- printk("%04X:%04X: inl.%04X -> %08X\n",M.x86.saved_cs, M.x86.saved_ip, (ushort)port, val);
+ printk("%04X:%04X: inl.%04X -> %08X\n",M.x86.saved_cs, M.x86.saved_ip, (ushort)port, val);
return val;
}
void X86API BE_outb(int port, u8 val)
{
if (DEBUG_IO())
- printk("%04X:%04X: outb.%04X <- %02X\n",M.x86.saved_cs, M.x86.saved_ip, (ushort)port, val);
+ printk("%04X:%04X: outb.%04X <- %02X\n",M.x86.saved_cs, M.x86.saved_ip, (ushort)port, val);
PM_outpb(port,val);
}
void X86API BE_outw(int port, u16 val)
{
if (DEBUG_IO())
- printk("%04X:%04X: outw.%04X <- %04X\n",M.x86.saved_cs, M.x86.saved_ip, (ushort)port, val);
+ printk("%04X:%04X: outw.%04X <- %04X\n",M.x86.saved_cs, M.x86.saved_ip, (ushort)port, val);
PM_outpw(port,val);
}
void X86API BE_outl(int port, u32 val)
{
if (DEBUG_IO())
- printk("%04X:%04X: outl.%04X <- %08X\n",M.x86.saved_cs, M.x86.saved_ip, (ushort)port, val);
+ printk("%04X:%04X: outl.%04X <- %08X\n",M.x86.saved_cs, M.x86.saved_ip, (ushort)port, val);
PM_outpd(port,val);
}
#endif
diff --git a/board/MAI/bios_emulator/scitech/src/biosemu/bios.c b/board/MAI/bios_emulator/scitech/src/biosemu/bios.c
index 3fb4c3608a..c0f4a4b18e 100644
--- a/board/MAI/bios_emulator/scitech/src/biosemu/bios.c
+++ b/board/MAI/bios_emulator/scitech/src/biosemu/bios.c
@@ -50,9 +50,9 @@ static void X86API undefined_intr(
int intno)
{
if (BE_rdw(intno * 4 + 2) == BIOS_SEG)
- printk("biosEmu: undefined interrupt %xh called!\n",intno);
+ printk("biosEmu: undefined interrupt %xh called!\n",intno);
else
- X86EMU_prepareForInt(intno);
+ X86EMU_prepareForInt(intno);
}
/****************************************************************************
@@ -68,26 +68,26 @@ static void X86API int42(
int intno)
{
if (M.x86.R_AH == 0x12 && M.x86.R_BL == 0x32) {
- if (M.x86.R_AL == 0) {
- /* Enable CPU accesses to video memory */
- PM_outpb(0x3c2, PM_inpb(0x3cc) | (u8)0x02);
- return;
- }
- else if (M.x86.R_AL == 1) {
- /* Disable CPU accesses to video memory */
- PM_outpb(0x3c2, PM_inpb(0x3cc) & (u8)~0x02);
- return;
- }
+ if (M.x86.R_AL == 0) {
+ /* Enable CPU accesses to video memory */
+ PM_outpb(0x3c2, PM_inpb(0x3cc) | (u8)0x02);
+ return;
+ }
+ else if (M.x86.R_AL == 1) {
+ /* Disable CPU accesses to video memory */
+ PM_outpb(0x3c2, PM_inpb(0x3cc) & (u8)~0x02);
+ return;
+ }
#ifdef DEBUG
- else {
- printk("biosEmu/bios.int42: unknown function AH=0x12, BL=0x32, AL=%#02x\n",M.x86.R_AL);
- }
+ else {
+ printk("biosEmu/bios.int42: unknown function AH=0x12, BL=0x32, AL=%#02x\n",M.x86.R_AL);
+ }
#endif
- }
+ }
#ifdef DEBUG
else {
- printk("biosEmu/bios.int42: unknown function AH=%#02x, AL=%#02x, BL=%#02x\n",M.x86.R_AH, M.x86.R_AL, M.x86.R_BL);
- }
+ printk("biosEmu/bios.int42: unknown function AH=%#02x, AL=%#02x, BL=%#02x\n",M.x86.R_AH, M.x86.R_AL, M.x86.R_BL);
+ }
#endif
}
@@ -106,9 +106,9 @@ static void X86API int10(
int intno)
{
if (BE_rdw(intno * 4 + 2) == BIOS_SEG)
- int42(intno);
+ int42(intno);
else
- X86EMU_prepareForInt(intno);
+ X86EMU_prepareForInt(intno);
}
/* Result codes returned by the PCI BIOS */
@@ -142,87 +142,87 @@ static void X86API int1A(
/* Fail if no PCI device information has been registered */
if (!_BE_env.vgaInfo.pciInfo)
- return;
+ return;
pciSlot = (u16)(_BE_env.vgaInfo.pciInfo->slot.i >> 8);
switch (M.x86.R_AX) {
- case 0xB101: /* PCI bios present? */
- M.x86.R_AL = 0x00; /* no config space/special cycle generation support */
- M.x86.R_EDX = 0x20494350; /* " ICP" */
- M.x86.R_BX = 0x0210; /* Version 2.10 */
- M.x86.R_CL = 0; /* Max bus number in system */
- CLEAR_FLAG(F_CF);
- break;
- case 0xB102: /* Find PCI device */
- M.x86.R_AH = DEVICE_NOT_FOUND;
- if (M.x86.R_DX == _BE_env.vgaInfo.pciInfo->VendorID &&
- M.x86.R_CX == _BE_env.vgaInfo.pciInfo->DeviceID &&
- M.x86.R_SI == 0) {
- M.x86.R_AH = SUCCESSFUL;
- M.x86.R_BX = pciSlot;
- }
- CONDITIONAL_SET_FLAG((M.x86.R_AH != SUCCESSFUL), F_CF);
- break;
- case 0xB103: /* Find PCI class code */
- M.x86.R_AH = DEVICE_NOT_FOUND;
- if (M.x86.R_CL == _BE_env.vgaInfo.pciInfo->Interface &&
- M.x86.R_CH == _BE_env.vgaInfo.pciInfo->SubClass &&
- (u8)(M.x86.R_ECX >> 16) == _BE_env.vgaInfo.pciInfo->BaseClass) {
- M.x86.R_AH = SUCCESSFUL;
- M.x86.R_BX = pciSlot;
- }
- CONDITIONAL_SET_FLAG((M.x86.R_AH != SUCCESSFUL), F_CF);
- break;
- case 0xB108: /* Read configuration byte */
- M.x86.R_AH = BAD_REGISTER_NUMBER;
- if (M.x86.R_BX == pciSlot) {
- M.x86.R_AH = SUCCESSFUL;
- M.x86.R_CL = (u8)PCI_accessReg(M.x86.R_DI,0,PCI_READ_BYTE,_BE_env.vgaInfo.pciInfo);
- }
- CONDITIONAL_SET_FLAG((M.x86.R_AH != SUCCESSFUL), F_CF);
- break;
- case 0xB109: /* Read configuration word */
- M.x86.R_AH = BAD_REGISTER_NUMBER;
- if (M.x86.R_BX == pciSlot) {
- M.x86.R_AH = SUCCESSFUL;
- M.x86.R_CX = (u16)PCI_accessReg(M.x86.R_DI,0,PCI_READ_WORD,_BE_env.vgaInfo.pciInfo);
- }
- CONDITIONAL_SET_FLAG((M.x86.R_AH != SUCCESSFUL), F_CF);
- break;
- case 0xB10A: /* Read configuration dword */
- M.x86.R_AH = BAD_REGISTER_NUMBER;
- if (M.x86.R_BX == pciSlot) {
- M.x86.R_AH = SUCCESSFUL;
- M.x86.R_ECX = (u32)PCI_accessReg(M.x86.R_DI,0,PCI_READ_DWORD,_BE_env.vgaInfo.pciInfo);
- }
- CONDITIONAL_SET_FLAG((M.x86.R_AH != SUCCESSFUL), F_CF);
- break;
- case 0xB10B: /* Write configuration byte */
- M.x86.R_AH = BAD_REGISTER_NUMBER;
- if (M.x86.R_BX == pciSlot) {
- M.x86.R_AH = SUCCESSFUL;
- PCI_accessReg(M.x86.R_DI,M.x86.R_CL,PCI_WRITE_BYTE,_BE_env.vgaInfo.pciInfo);
- }
- CONDITIONAL_SET_FLAG((M.x86.R_AH != SUCCESSFUL), F_CF);
- break;
- case 0xB10C: /* Write configuration word */
- M.x86.R_AH = BAD_REGISTER_NUMBER;
- if (M.x86.R_BX == pciSlot) {
- M.x86.R_AH = SUCCESSFUL;
- PCI_accessReg(M.x86.R_DI,M.x86.R_CX,PCI_WRITE_WORD,_BE_env.vgaInfo.pciInfo);
- }
- CONDITIONAL_SET_FLAG((M.x86.R_AH != SUCCESSFUL), F_CF);
- break;
- case 0xB10D: /* Write configuration dword */
- M.x86.R_AH = BAD_REGISTER_NUMBER;
- if (M.x86.R_BX == pciSlot) {
- M.x86.R_AH = SUCCESSFUL;
- PCI_accessReg(M.x86.R_DI,M.x86.R_ECX,PCI_WRITE_DWORD,_BE_env.vgaInfo.pciInfo);
- }
- CONDITIONAL_SET_FLAG((M.x86.R_AH != SUCCESSFUL), F_CF);
- break;
- default:
- printk("biosEmu/bios.int1a: unknown function AX=%#04x\n", M.x86.R_AX);
- }
+ case 0xB101: /* PCI bios present? */
+ M.x86.R_AL = 0x00; /* no config space/special cycle generation support */
+ M.x86.R_EDX = 0x20494350; /* " ICP" */
+ M.x86.R_BX = 0x0210; /* Version 2.10 */
+ M.x86.R_CL = 0; /* Max bus number in system */
+ CLEAR_FLAG(F_CF);
+ break;
+ case 0xB102: /* Find PCI device */
+ M.x86.R_AH = DEVICE_NOT_FOUND;
+ if (M.x86.R_DX == _BE_env.vgaInfo.pciInfo->VendorID &&
+ M.x86.R_CX == _BE_env.vgaInfo.pciInfo->DeviceID &&
+ M.x86.R_SI == 0) {
+ M.x86.R_AH = SUCCESSFUL;
+ M.x86.R_BX = pciSlot;
+ }
+ CONDITIONAL_SET_FLAG((M.x86.R_AH != SUCCESSFUL), F_CF);
+ break;
+ case 0xB103: /* Find PCI class code */
+ M.x86.R_AH = DEVICE_NOT_FOUND;
+ if (M.x86.R_CL == _BE_env.vgaInfo.pciInfo->Interface &&
+ M.x86.R_CH == _BE_env.vgaInfo.pciInfo->SubClass &&
+ (u8)(M.x86.R_ECX >> 16) == _BE_env.vgaInfo.pciInfo->BaseClass) {
+ M.x86.R_AH = SUCCESSFUL;
+ M.x86.R_BX = pciSlot;
+ }
+ CONDITIONAL_SET_FLAG((M.x86.R_AH != SUCCESSFUL), F_CF);
+ break;
+ case 0xB108: /* Read configuration byte */
+ M.x86.R_AH = BAD_REGISTER_NUMBER;
+ if (M.x86.R_BX == pciSlot) {
+ M.x86.R_AH = SUCCESSFUL;
+ M.x86.R_CL = (u8)PCI_accessReg(M.x86.R_DI,0,PCI_READ_BYTE,_BE_env.vgaInfo.pciInfo);
+ }
+ CONDITIONAL_SET_FLAG((M.x86.R_AH != SUCCESSFUL), F_CF);
+ break;
+ case 0xB109: /* Read configuration word */
+ M.x86.R_AH = BAD_REGISTER_NUMBER;
+ if (M.x86.R_BX == pciSlot) {
+ M.x86.R_AH = SUCCESSFUL;
+ M.x86.R_CX = (u16)PCI_accessReg(M.x86.R_DI,0,PCI_READ_WORD,_BE_env.vgaInfo.pciInfo);
+ }
+ CONDITIONAL_SET_FLAG((M.x86.R_AH != SUCCESSFUL), F_CF);
+ break;
+ case 0xB10A: /* Read configuration dword */
+ M.x86.R_AH = BAD_REGISTER_NUMBER;
+ if (M.x86.R_BX == pciSlot) {
+ M.x86.R_AH = SUCCESSFUL;
+ M.x86.R_ECX = (u32)PCI_accessReg(M.x86.R_DI,0,PCI_READ_DWORD,_BE_env.vgaInfo.pciInfo);
+ }
+ CONDITIONAL_SET_FLAG((M.x86.R_AH != SUCCESSFUL), F_CF);
+ break;
+ case 0xB10B: /* Write configuration byte */
+ M.x86.R_AH = BAD_REGISTER_NUMBER;
+ if (M.x86.R_BX == pciSlot) {
+ M.x86.R_AH = SUCCESSFUL;
+ PCI_accessReg(M.x86.R_DI,M.x86.R_CL,PCI_WRITE_BYTE,_BE_env.vgaInfo.pciInfo);
+ }
+ CONDITIONAL_SET_FLAG((M.x86.R_AH != SUCCESSFUL), F_CF);
+ break;
+ case 0xB10C: /* Write configuration word */
+ M.x86.R_AH = BAD_REGISTER_NUMBER;
+ if (M.x86.R_BX == pciSlot) {
+ M.x86.R_AH = SUCCESSFUL;
+ PCI_accessReg(M.x86.R_DI,M.x86.R_CX,PCI_WRITE_WORD,_BE_env.vgaInfo.pciInfo);
+ }
+ CONDITIONAL_SET_FLAG((M.x86.R_AH != SUCCESSFUL), F_CF);
+ break;
+ case 0xB10D: /* Write configuration dword */
+ M.x86.R_AH = BAD_REGISTER_NUMBER;
+ if (M.x86.R_BX == pciSlot) {
+ M.x86.R_AH = SUCCESSFUL;
+ PCI_accessReg(M.x86.R_DI,M.x86.R_ECX,PCI_WRITE_DWORD,_BE_env.vgaInfo.pciInfo);
+ }
+ CONDITIONAL_SET_FLAG((M.x86.R_AH != SUCCESSFUL), F_CF);
+ break;
+ default:
+ printk("biosEmu/bios.int1a: unknown function AX=%#04x\n", M.x86.R_AX);
+ }
}
/****************************************************************************
@@ -240,9 +240,9 @@ void _BE_bios_init(
X86EMU_intrFuncs bios_intr_tab[256];
for (i = 0; i < 256; ++i) {
- intrTab[i] = BIOS_SEG << 16;
- bios_intr_tab[i] = undefined_intr;
- }
+ intrTab[i] = BIOS_SEG << 16;
+ bios_intr_tab[i] = undefined_intr;
+ }
bios_intr_tab[0x10] = int10;
bios_intr_tab[0x1A] = int1A;
bios_intr_tab[0x42] = int42;
diff --git a/board/MAI/bios_emulator/scitech/src/biosemu/biosemu.c b/board/MAI/bios_emulator/scitech/src/biosemu/biosemu.c
index ed2717c218..0052709cc6 100644
--- a/board/MAI/bios_emulator/scitech/src/biosemu/biosemu.c
+++ b/board/MAI/bios_emulator/scitech/src/biosemu/biosemu.c
@@ -100,9 +100,9 @@ ibool PMAPI BE_init(
#endif
memset(&M,0,sizeof(M));
if (memSize < 20480)
- PM_fatalError("Emulator requires at least 20Kb of memory!\n");
+ PM_fatalError("Emulator requires at least 20Kb of memory!\n");
if ((M.mem_base = (unsigned long)malloc(memSize)) == NULL)
- PM_fatalError("Out of memory!");
+ PM_fatalError("Out of memory!");
M.mem_size = memSize;
_BE_env.busmem_base = (ulong)PM_mapPhysicalAddr(0xA0000,0x5FFFF,true);
M.x86.debug = debugFlags;
@@ -144,15 +144,15 @@ void PMAPI BE_setVGA(
_BE_env.vgaInfo.pciInfo = info->pciInfo;
_BE_env.vgaInfo.BIOSImage = info->BIOSImage;
if (info->BIOSImage) {
- _BE_env.biosmem_base = (ulong)info->BIOSImage;
- _BE_env.biosmem_limit = 0xC0000 + info->BIOSImageLen-1;
- }
+ _BE_env.biosmem_base = (ulong)info->BIOSImage;
+ _BE_env.biosmem_limit = 0xC0000 + info->BIOSImageLen-1;
+ }
else {
- _BE_env.biosmem_base = _BE_env.busmem_base + 0x20000;
- _BE_env.biosmem_limit = 0xC7FFF;
- }
+ _BE_env.biosmem_base = _BE_env.busmem_base + 0x20000;
+ _BE_env.biosmem_limit = 0xC7FFF;
+ }
if (*((u32*)info->LowMem) == 0)
- _BE_bios_init((u32*)info->LowMem);
+ _BE_bios_init((u32*)info->LowMem);
memcpy((u8*)M.mem_base,info->LowMem,sizeof(info->LowMem));
}
@@ -182,8 +182,8 @@ This function maps a real mode pointer in the emulator memory to a protected
mode pointer that can be used to directly access the memory.
NOTE: The memory is *always* in little endian format, son on non-x86
- systems you will need to do endian translations to access this
- memory.
+ systems you will need to do endian translations to access this
+ memory.
****************************************************************************/
void * PMAPI BE_mapRealPointer(
uint r_seg,
@@ -192,11 +192,11 @@ void * PMAPI BE_mapRealPointer(
u32 addr = ((u32)r_seg << 4) + r_off;
if (addr >= 0xC0000 && addr <= _BE_env.biosmem_limit) {
- return (void*)(_BE_env.biosmem_base + addr - 0xC0000);
- }
+ return (void*)(_BE_env.biosmem_base + addr - 0xC0000);
+ }
else if (addr >= 0xA0000 && addr <= 0xFFFFF) {
- return (void*)(_BE_env.busmem_base + addr - 0xA0000);
- }
+ return (void*)(_BE_env.busmem_base + addr - 0xA0000);
+ }
return (void*)(M.mem_base + addr);
}
@@ -213,8 +213,8 @@ and located at 15Kb into the start of the real mode memory (16Kb is where
we put the real mode code we execute for issuing interrupts).
NOTE: The memory is *always* in little endian format, son on non-x86
- systems you will need to do endian translations to access this
- memory.
+ systems you will need to do endian translations to access this
+ memory.
****************************************************************************/
void * PMAPI BE_getVESABuf(
uint *len,
@@ -416,28 +416,28 @@ BE_exports * _CEXPORT BE_initLibrary(
PM_imports *pmImp)
{
static BE_exports _BE_exports = {
- sizeof(BE_exports),
- BE_init,
- BE_setVGA,
- BE_getVGA,
- BE_mapRealPointer,
- BE_getVESABuf,
- BE_callRealMode,
- BE_int86,
- BE_int86x,
- NULL,
- BE_exit,
- };
+ sizeof(BE_exports),
+ BE_init,
+ BE_setVGA,
+ BE_getVGA,
+ BE_mapRealPointer,
+ BE_getVESABuf,
+ BE_callRealMode,
+ BE_int86,
+ BE_int86x,
+ NULL,
+ BE_exit,
+ };
int i,max;
ulong *p;
- // Initialize all default imports to point to fatal error handler
- // for upwards compatibility.
+ /* Initialize all default imports to point to fatal error handler */
+ /* for upwards compatibility. */
max = sizeof(_PM_imports)/sizeof(BE_initLibrary_t);
for (i = 0,p = (ulong*)&_PM_imports; i < max; i++)
- *p++ = (ulong)_PM_fatalErrorHandler;
+ *p++ = (ulong)_PM_fatalErrorHandler;
- // Now copy all our imported functions
+ /* Now copy all our imported functions */
memcpy(&_PM_imports,pmImp,MIN(sizeof(_PM_imports),pmImp->dwSize));
return &_BE_exports;
}
diff --git a/board/MAI/bios_emulator/scitech/src/biosemu/warmboot.c b/board/MAI/bios_emulator/scitech/src/biosemu/warmboot.c
index 96fa5a0e0f..98d5fb8a62 100644
--- a/board/MAI/bios_emulator/scitech/src/biosemu/warmboot.c
+++ b/board/MAI/bios_emulator/scitech/src/biosemu/warmboot.c
@@ -112,16 +112,16 @@ static ulong PCI_findBIOSAddr(
int bar;
for (bar = 0x10; bar <= 0x14; bar++) {
- base = PCI_readPCIRegL(bar,device) & ~0xFF;
- if (!(base & 0x1)) {
- PCI_writePCIRegL(bar,0xFFFFFFFF,device);
- size = PCI_readPCIRegL(bar,device) & ~0xFF;
- size = ~size+1;
- PCI_writePCIRegL(bar,0,device);
- if (size >= MAX_BIOSLEN)
- return base;
- }
- }
+ base = PCI_readPCIRegL(bar,device) & ~0xFF;
+ if (!(base & 0x1)) {
+ PCI_writePCIRegL(bar,0xFFFFFFFF,device);
+ size = PCI_readPCIRegL(bar,device) & ~0xFF;
+ size = ~size+1;
+ PCI_writePCIRegL(bar,0,device);
+ if (size >= MAX_BIOSLEN)
+ return base;
+ }
+ }
return 0;
}
@@ -138,13 +138,13 @@ static void _PCI_fixupSecondaryBARs(void)
int i;
for (i = 0; i < NumDevices; i++) {
- PCI_writePCIRegL(0x10,PCI[DeviceIndex[i]].BaseAddress10,i);
- PCI_writePCIRegL(0x14,PCI[DeviceIndex[i]].BaseAddress14,i);
- PCI_writePCIRegL(0x18,PCI[DeviceIndex[i]].BaseAddress18,i);
- PCI_writePCIRegL(0x1C,PCI[DeviceIndex[i]].BaseAddress1C,i);
- PCI_writePCIRegL(0x20,PCI[DeviceIndex[i]].BaseAddress20,i);
- PCI_writePCIRegL(0x24,PCI[DeviceIndex[i]].BaseAddress24,i);
- }
+ PCI_writePCIRegL(0x10,PCI[DeviceIndex[i]].BaseAddress10,i);
+ PCI_writePCIRegL(0x14,PCI[DeviceIndex[i]].BaseAddress14,i);
+ PCI_writePCIRegL(0x18,PCI[DeviceIndex[i]].BaseAddress18,i);
+ PCI_writePCIRegL(0x1C,PCI[DeviceIndex[i]].BaseAddress1C,i);
+ PCI_writePCIRegL(0x20,PCI[DeviceIndex[i]].BaseAddress20,i);
+ PCI_writePCIRegL(0x24,PCI[DeviceIndex[i]].BaseAddress24,i);
+ }
}
/****************************************************************************
@@ -165,29 +165,29 @@ static void PCI_doBIOSPOST(
RMREGS regs;
RMSREGS sregs;
- // Determine the value to store in AX for BIOS POST
+ /* Determine the value to store in AX for BIOS POST */
regs.x.ax = (u16)(PCI[DeviceIndex[device]].slot.i >> 8);
if (useV86) {
- // Post the BIOS using the PM functions (ie: v86 mode on Linux)
- if (!PM_doBIOSPOST(regs.x.ax,BIOSPhysAddr,mappedBIOS,BIOSLen)) {
- // If the PM function fails, this probably means are we are on
- // DOS and can't re-map the real mode 0xC0000 region. In thise
- // case if the device is the primary, we can use the real
- // BIOS at 0xC0000 directly.
- if (device == 0)
- PM_doBIOSPOST(regs.x.ax,0xC0000,mappedBIOS,BIOSLen);
- }
- }
+ /* Post the BIOS using the PM functions (ie: v86 mode on Linux) */
+ if (!PM_doBIOSPOST(regs.x.ax,BIOSPhysAddr,mappedBIOS,BIOSLen)) {
+ /* If the PM function fails, this probably means are we are on */
+ /* DOS and can't re-map the real mode 0xC0000 region. In thise */
+ /* case if the device is the primary, we can use the real */
+ /* BIOS at 0xC0000 directly. */
+ if (device == 0)
+ PM_doBIOSPOST(regs.x.ax,0xC0000,mappedBIOS,BIOSLen);
+ }
+ }
else {
- // Setup the X86 emulator for the VGA BIOS
- BE_setVGA(&VGAInfo[device]);
+ /* Setup the X86 emulator for the VGA BIOS */
+ BE_setVGA(&VGAInfo[device]);
- // Execute the BIOS POST code
- BE_callRealMode(0xC000,0x0003,&regs,&sregs);
+ /* Execute the BIOS POST code */
+ BE_callRealMode(0xC000,0x0003,&regs,&sregs);
- // Cleanup and exit
- BE_getVGA(&VGAInfo[device]);
- }
+ /* Cleanup and exit */
+ BE_getVGA(&VGAInfo[device]);
+ }
}
/****************************************************************************
@@ -206,113 +206,113 @@ static ibool PCI_postControllers(void)
char filename[_MAX_PATH];
FILE *f;
- // Disable the primary display controller and AGP VGA pass-through
+ /* Disable the primary display controller and AGP VGA pass-through */
DISABLE_DEVICE(0);
if (AGPBridge)
- DISABLE_AGP_VGA();
+ DISABLE_AGP_VGA();
- // Now POST all the secondary controllers
+ /* Now POST all the secondary controllers */
for (device = 0; device < NumDevices; device++) {
- // Skip the device if it is not enabled (probably an ISA device)
- if (DeviceIndex[device] == -1)
- continue;
-
- // Enable secondary display controller. If the secondary controller
- // is on the AGP bus, then enable VGA resources for the AGP device.
- ENABLE_DEVICE(device);
- if (AGPBridge && AGPBridge->SecondayBusNumber == PCI[DeviceIndex[device]].slot.p.Bus)
- ENABLE_AGP_VGA();
-
- // Check if the controller has already been POST'ed
- if (VGA_NOT_ACTIVE()) {
- // Find a viable place to map the secondary PCI BIOS image and map it
- printk("Device %d not enabled, so attempting warm boot it\n", device);
-
- // For AGP devices (and PCI devices that do have the ROM base
- // address zero'ed out) we have to map the BIOS to a location
- // that is passed by the AGP bridge to the bus. Some AGP devices
- // have the ROM base address already set up for us, and some
- // do not (we map to one of the existing BAR locations in
- // this case).
- mappedBIOS = NULL;
- if (PCI[DeviceIndex[device]].ROMBaseAddress != 0)
- mappedBIOSPhys = PCI[DeviceIndex[device]].ROMBaseAddress & ~0xF;
- else
- mappedBIOSPhys = PCI_findBIOSAddr(device);
- printk("Mapping BIOS image to 0x%08X\n", mappedBIOSPhys);
- mappedBIOS = PM_mapPhysicalAddr(mappedBIOSPhys,MAX_BIOSLEN-1,false);
- PCI_writePCIRegL(0x30,mappedBIOSPhys | 0x1,device);
- BIOSImageLen = mappedBIOS[2] * 512;
- if ((copyOfBIOS = malloc(BIOSImageLen)) == NULL)
- return false;
- memcpy(copyOfBIOS,mappedBIOS,BIOSImageLen);
- PM_freePhysicalAddr(mappedBIOS,MAX_BIOSLEN-1);
-
- // Allocate memory to store copy of BIOS from secondary controllers
- VGAInfo[device].pciInfo = &PCI[DeviceIndex[device]];
- VGAInfo[device].BIOSImage = copyOfBIOS;
- VGAInfo[device].BIOSImageLen = BIOSImageLen;
-
- // Restore device mappings
- PCI_writePCIRegL(0x30,PCI[DeviceIndex[device]].ROMBaseAddress,device);
- PCI_writePCIRegL(0x10,PCI[DeviceIndex[device]].BaseAddress10,device);
- PCI_writePCIRegL(0x14,PCI[DeviceIndex[device]].BaseAddress14,device);
-
- // Now execute the BIOS POST for the device
- if (copyOfBIOS[0] == 0x55 && copyOfBIOS[1] == 0xAA) {
- printk("Executing BIOS POST for controller.\n");
- PCI_doBIOSPOST(device,mappedBIOSPhys,copyOfBIOS,BIOSImageLen);
- }
-
- // Reset the size of the BIOS image to the final size
- VGAInfo[device].BIOSImageLen = FINAL_BIOSLEN;
-
- // Save the BIOS and interrupt vector information to disk
- sprintf(filename,"%s/bios.%02d",PM_getNucleusConfigPath(),device);
- if ((f = fopen(filename,"wb")) != NULL) {
- fwrite(copyOfBIOS,1,FINAL_BIOSLEN,f);
- fwrite(VGAInfo[device].LowMem,1,sizeof(VGAInfo[device].LowMem),f);
- fclose(f);
- }
- }
- else {
- // Allocate memory to store copy of BIOS from secondary controllers
- if ((copyOfBIOS = malloc(FINAL_BIOSLEN)) == NULL)
- return false;
- VGAInfo[device].pciInfo = &PCI[DeviceIndex[device]];
- VGAInfo[device].BIOSImage = copyOfBIOS;
- VGAInfo[device].BIOSImageLen = FINAL_BIOSLEN;
-
- // Load the BIOS and interrupt vector information from disk
- sprintf(filename,"%s/bios.%02d",PM_getNucleusConfigPath(),device);
- if ((f = fopen(filename,"rb")) != NULL) {
- fread(copyOfBIOS,1,FINAL_BIOSLEN,f);
- fread(VGAInfo[device].LowMem,1,sizeof(VGAInfo[device].LowMem),f);
- fclose(f);
- }
- }
-
- // Fix up all the secondary PCI base address registers
- // (restores them all from the values we read previously)
- _PCI_fixupSecondaryBARs();
-
- // Disable the secondary controller and AGP VGA pass-through
- DISABLE_DEVICE(device);
- if (AGPBridge)
- DISABLE_AGP_VGA();
- }
-
- // Reenable primary display controller and reset AGP bridge control
+ /* Skip the device if it is not enabled (probably an ISA device) */
+ if (DeviceIndex[device] == -1)
+ continue;
+
+ /* Enable secondary display controller. If the secondary controller */
+ /* is on the AGP bus, then enable VGA resources for the AGP device. */
+ ENABLE_DEVICE(device);
+ if (AGPBridge && AGPBridge->SecondayBusNumber == PCI[DeviceIndex[device]].slot.p.Bus)
+ ENABLE_AGP_VGA();
+
+ /* Check if the controller has already been POST'ed */
+ if (VGA_NOT_ACTIVE()) {
+ /* Find a viable place to map the secondary PCI BIOS image and map it */
+ printk("Device %d not enabled, so attempting warm boot it\n", device);
+
+ /* For AGP devices (and PCI devices that do have the ROM base */
+ /* address zero'ed out) we have to map the BIOS to a location */
+ /* that is passed by the AGP bridge to the bus. Some AGP devices */
+ /* have the ROM base address already set up for us, and some */
+ /* do not (we map to one of the existing BAR locations in */
+ /* this case). */
+ mappedBIOS = NULL;
+ if (PCI[DeviceIndex[device]].ROMBaseAddress != 0)
+ mappedBIOSPhys = PCI[DeviceIndex[device]].ROMBaseAddress & ~0xF;
+ else
+ mappedBIOSPhys = PCI_findBIOSAddr(device);
+ printk("Mapping BIOS image to 0x%08X\n", mappedBIOSPhys);
+ mappedBIOS = PM_mapPhysicalAddr(mappedBIOSPhys,MAX_BIOSLEN-1,false);
+ PCI_writePCIRegL(0x30,mappedBIOSPhys | 0x1,device);
+ BIOSImageLen = mappedBIOS[2] * 512;
+ if ((copyOfBIOS = malloc(BIOSImageLen)) == NULL)
+ return false;
+ memcpy(copyOfBIOS,mappedBIOS,BIOSImageLen);
+ PM_freePhysicalAddr(mappedBIOS,MAX_BIOSLEN-1);
+
+ /* Allocate memory to store copy of BIOS from secondary controllers */
+ VGAInfo[device].pciInfo = &PCI[DeviceIndex[device]];
+ VGAInfo[device].BIOSImage = copyOfBIOS;
+ VGAInfo[device].BIOSImageLen = BIOSImageLen;
+
+ /* Restore device mappings */
+ PCI_writePCIRegL(0x30,PCI[DeviceIndex[device]].ROMBaseAddress,device);
+ PCI_writePCIRegL(0x10,PCI[DeviceIndex[device]].BaseAddress10,device);
+ PCI_writePCIRegL(0x14,PCI[DeviceIndex[device]].BaseAddress14,device);
+
+ /* Now execute the BIOS POST for the device */
+ if (copyOfBIOS[0] == 0x55 && copyOfBIOS[1] == 0xAA) {
+ printk("Executing BIOS POST for controller.\n");
+ PCI_doBIOSPOST(device,mappedBIOSPhys,copyOfBIOS,BIOSImageLen);
+ }
+
+ /* Reset the size of the BIOS image to the final size */
+ VGAInfo[device].BIOSImageLen = FINAL_BIOSLEN;
+
+ /* Save the BIOS and interrupt vector information to disk */
+ sprintf(filename,"%s/bios.%02d",PM_getNucleusConfigPath(),device);
+ if ((f = fopen(filename,"wb")) != NULL) {
+ fwrite(copyOfBIOS,1,FINAL_BIOSLEN,f);
+ fwrite(VGAInfo[device].LowMem,1,sizeof(VGAInfo[device].LowMem),f);
+ fclose(f);
+ }
+ }
+ else {
+ /* Allocate memory to store copy of BIOS from secondary controllers */
+ if ((copyOfBIOS = malloc(FINAL_BIOSLEN)) == NULL)
+ return false;
+ VGAInfo[device].pciInfo = &PCI[DeviceIndex[device]];
+ VGAInfo[device].BIOSImage = copyOfBIOS;
+ VGAInfo[device].BIOSImageLen = FINAL_BIOSLEN;
+
+ /* Load the BIOS and interrupt vector information from disk */
+ sprintf(filename,"%s/bios.%02d",PM_getNucleusConfigPath(),device);
+ if ((f = fopen(filename,"rb")) != NULL) {
+ fread(copyOfBIOS,1,FINAL_BIOSLEN,f);
+ fread(VGAInfo[device].LowMem,1,sizeof(VGAInfo[device].LowMem),f);
+ fclose(f);
+ }
+ }
+
+ /* Fix up all the secondary PCI base address registers */
+ /* (restores them all from the values we read previously) */
+ _PCI_fixupSecondaryBARs();
+
+ /* Disable the secondary controller and AGP VGA pass-through */
+ DISABLE_DEVICE(device);
+ if (AGPBridge)
+ DISABLE_AGP_VGA();
+ }
+
+ /* Reenable primary display controller and reset AGP bridge control */
if (AGPBridge)
- RESTORE_AGP_VGA();
+ RESTORE_AGP_VGA();
ENABLE_DEVICE(0);
- // Free physical BIOS image mapping
+ /* Free physical BIOS image mapping */
PM_freePhysicalAddr(mappedBIOS,MAX_BIOSLEN-1);
- // Restore the X86 emulator BIOS info to primary controller
+ /* Restore the X86 emulator BIOS info to primary controller */
if (!useV86)
- BE_setVGA(&VGAInfo[0]);
+ BE_setVGA(&VGAInfo[0]);
return true;
}
@@ -327,123 +327,123 @@ static void EnumeratePCI(void)
PCIBridgeInfo *info;
printk("Displaying enumeration of PCI bus (%d devices, %d display devices)\n",
- NumPCI, NumDevices);
+ NumPCI, NumDevices);
for (index = 0; index < NumDevices; index++)
- printk(" Display device %d is PCI device %d\n",index,DeviceIndex[index]);
+ printk(" Display device %d is PCI device %d\n",index,DeviceIndex[index]);
printk("\n");
printk("Bus Slot Fnc DeviceID SubSystem Rev Class IRQ Int Cmd\n");
for (i = 0; i < NumPCI; i++) {
- printk("%2d %2d %2d %04X:%04X %04X:%04X %02X %02X:%02X %02X %02X %04X ",
- PCI[i].slot.p.Bus,
- PCI[i].slot.p.Device,
- PCI[i].slot.p.Function,
- PCI[i].VendorID,
- PCI[i].DeviceID,
- PCI[i].SubSystemVendorID,
- PCI[i].SubSystemID,
- PCI[i].RevID,
- PCI[i].BaseClass,
- PCI[i].SubClass,
- PCI[i].InterruptLine,
- PCI[i].InterruptPin,
- PCI[i].Command);
- for (index = 0; index < NumDevices; index++) {
- if (DeviceIndex[index] == i)
- break;
- }
- if (index < NumDevices)
- printk("<- %d\n", index);
- else
- printk("\n");
- }
+ printk("%2d %2d %2d %04X:%04X %04X:%04X %02X %02X:%02X %02X %02X %04X ",
+ PCI[i].slot.p.Bus,
+ PCI[i].slot.p.Device,
+ PCI[i].slot.p.Function,
+ PCI[i].VendorID,
+ PCI[i].DeviceID,
+ PCI[i].SubSystemVendorID,
+ PCI[i].SubSystemID,
+ PCI[i].RevID,
+ PCI[i].BaseClass,
+ PCI[i].SubClass,
+ PCI[i].InterruptLine,
+ PCI[i].InterruptPin,
+ PCI[i].Command);
+ for (index = 0; index < NumDevices; index++) {
+ if (DeviceIndex[index] == i)
+ break;
+ }
+ if (index < NumDevices)
+ printk("<- %d\n", index);
+ else
+ printk("\n");
+ }
printk("\n");
printk("DeviceID Stat Ifc Cch Lat Hdr BIST\n");
for (i = 0; i < NumPCI; i++) {
- printk("%04X:%04X %04X %02X %02X %02X %02X %02X ",
- PCI[i].VendorID,
- PCI[i].DeviceID,
- PCI[i].Status,
- PCI[i].Interface,
- PCI[i].CacheLineSize,
- PCI[i].LatencyTimer,
- PCI[i].HeaderType,
- PCI[i].BIST);
- for (index = 0; index < NumDevices; index++) {
- if (DeviceIndex[index] == i)
- break;
- }
- if (index < NumDevices)
- printk("<- %d\n", index);
- else
- printk("\n");
- }
+ printk("%04X:%04X %04X %02X %02X %02X %02X %02X ",
+ PCI[i].VendorID,
+ PCI[i].DeviceID,
+ PCI[i].Status,
+ PCI[i].Interface,
+ PCI[i].CacheLineSize,
+ PCI[i].LatencyTimer,
+ PCI[i].HeaderType,
+ PCI[i].BIST);
+ for (index = 0; index < NumDevices; index++) {
+ if (DeviceIndex[index] == i)
+ break;
+ }
+ if (index < NumDevices)
+ printk("<- %d\n", index);
+ else
+ printk("\n");
+ }
printk("\n");
printk("DeviceID Base10h Base14h Base18h Base1Ch Base20h Base24h ROMBase\n");
for (i = 0; i < NumPCI; i++) {
- printk("%04X:%04X %08X %08X %08X %08X %08X %08X %08X ",
- PCI[i].VendorID,
- PCI[i].DeviceID,
- PCI[i].BaseAddress10,
- PCI[i].BaseAddress14,
- PCI[i].BaseAddress18,
- PCI[i].BaseAddress1C,
- PCI[i].BaseAddress20,
- PCI[i].BaseAddress24,
- PCI[i].ROMBaseAddress);
- for (index = 0; index < NumDevices; index++) {
- if (DeviceIndex[index] == i)
- break;
- }
- if (index < NumDevices)
- printk("<- %d\n", index);
- else
- printk("\n");
- }
+ printk("%04X:%04X %08X %08X %08X %08X %08X %08X %08X ",
+ PCI[i].VendorID,
+ PCI[i].DeviceID,
+ PCI[i].BaseAddress10,
+ PCI[i].BaseAddress14,
+ PCI[i].BaseAddress18,
+ PCI[i].BaseAddress1C,
+ PCI[i].BaseAddress20,
+ PCI[i].BaseAddress24,
+ PCI[i].ROMBaseAddress);
+ for (index = 0; index < NumDevices; index++) {
+ if (DeviceIndex[index] == i)
+ break;
+ }
+ if (index < NumDevices)
+ printk("<- %d\n", index);
+ else
+ printk("\n");
+ }
printk("\n");
printk("DeviceID BAR10Len BAR14Len BAR18Len BAR1CLen BAR20Len BAR24Len ROMLen\n");
for (i = 0; i < NumPCI; i++) {
- printk("%04X:%04X %08X %08X %08X %08X %08X %08X %08X ",
- PCI[i].VendorID,
- PCI[i].DeviceID,
- PCI[i].BaseAddress10Len,
- PCI[i].BaseAddress14Len,
- PCI[i].BaseAddress18Len,
- PCI[i].BaseAddress1CLen,
- PCI[i].BaseAddress20Len,
- PCI[i].BaseAddress24Len,
- PCI[i].ROMBaseAddressLen);
- for (index = 0; index < NumDevices; index++) {
- if (DeviceIndex[index] == i)
- break;
- }
- if (index < NumDevices)
- printk("<- %d\n", index);
- else
- printk("\n");
- }
+ printk("%04X:%04X %08X %08X %08X %08X %08X %08X %08X ",
+ PCI[i].VendorID,
+ PCI[i].DeviceID,
+ PCI[i].BaseAddress10Len,
+ PCI[i].BaseAddress14Len,
+ PCI[i].BaseAddress18Len,
+ PCI[i].BaseAddress1CLen,
+ PCI[i].BaseAddress20Len,
+ PCI[i].BaseAddress24Len,
+ PCI[i].ROMBaseAddressLen);
+ for (index = 0; index < NumDevices; index++) {
+ if (DeviceIndex[index] == i)
+ break;
+ }
+ if (index < NumDevices)
+ printk("<- %d\n", index);
+ else
+ printk("\n");
+ }
printk("\n");
printk("Displaying enumeration of %d bridge devices\n",NumBridges);
printk("\n");
printk("DeviceID P# S# B# IOB IOL MemBase MemLimit PreBase PreLimit Ctrl\n");
for (i = 0; i < NumBridges; i++) {
- info = (PCIBridgeInfo*)&PCI[BridgeIndex[i]];
- printk("%04X:%04X %02X %02X %02X %04X %04X %08X %08X %08X %08X %04X\n",
- info->VendorID,
- info->DeviceID,
- info->PrimaryBusNumber,
- info->SecondayBusNumber,
- info->SubordinateBusNumber,
- ((u16)info->IOBase << 8) & 0xF000,
- info->IOLimit ?
- ((u16)info->IOLimit << 8) | 0xFFF : 0,
- ((u32)info->MemoryBase << 16) & 0xFFF00000,
- info->MemoryLimit ?
- ((u32)info->MemoryLimit << 16) | 0xFFFFF : 0,
- ((u32)info->PrefetchableMemoryBase << 16) & 0xFFF00000,
- info->PrefetchableMemoryLimit ?
- ((u32)info->PrefetchableMemoryLimit << 16) | 0xFFFFF : 0,
- info->BridgeControl);
- }
+ info = (PCIBridgeInfo*)&PCI[BridgeIndex[i]];
+ printk("%04X:%04X %02X %02X %02X %04X %04X %08X %08X %08X %08X %04X\n",
+ info->VendorID,
+ info->DeviceID,
+ info->PrimaryBusNumber,
+ info->SecondayBusNumber,
+ info->SubordinateBusNumber,
+ ((u16)info->IOBase << 8) & 0xF000,
+ info->IOLimit ?
+ ((u16)info->IOLimit << 8) | 0xFFF : 0,
+ ((u32)info->MemoryBase << 16) & 0xFFF00000,
+ info->MemoryLimit ?
+ ((u32)info->MemoryLimit << 16) | 0xFFFFF : 0,
+ ((u32)info->PrefetchableMemoryBase << 16) & 0xFFF00000,
+ info->PrefetchableMemoryLimit ?
+ ((u32)info->PrefetchableMemoryLimit << 16) | 0xFFFFF : 0,
+ info->BridgeControl);
+ }
printk("\n");
}
@@ -460,51 +460,51 @@ static int PCI_enumerateDevices(void)
int i,j;
PCIBridgeInfo *info;
- // If this is the first time we have been called, enumerate all
- // devices on the PCI bus.
+ /* If this is the first time we have been called, enumerate all */
+ /* devices on the PCI bus. */
if (NumPCI == -1) {
- for (i = 0; i < MAX_PCI_DEVICES; i++)
- PCI[i].dwSize = sizeof(PCI[i]);
- if ((NumPCI = PCI_enumerate(PCI,MAX_PCI_DEVICES)) == 0)
- return -1;
-
- // Build a list of all PCI bridge devices
- for (i = 0,NumBridges = 0,BridgeIndex[0] = -1; i < NumPCI; i++) {
- if (PCI[i].BaseClass == PCI_BRIDGE_CLASS) {
- if (NumBridges < MAX_PCI_DEVICES)
- BridgeIndex[NumBridges++] = i;
- }
- }
-
- // Now build a list of all display class devices
- for (i = 0,NumDevices = 1,DeviceIndex[0] = -1; i < NumPCI; i++) {
- if (PCI_IS_DISPLAY_CLASS(&PCI[i])) {
- if ((PCI[i].Command & 0x3) == 0x3) {
- DeviceIndex[0] = i;
- }
- else {
- if (NumDevices < MAX_PCI_DEVICES)
- DeviceIndex[NumDevices++] = i;
- }
- if (PCI[i].slot.p.Bus != 0) {
- // This device is on a different bus than the primary
- // PCI bus, so it is probably an AGP device. Find the
- // AGP bus device that controls that bus so we can
- // control it.
- for (j = 0; j < NumBridges; j++) {
- info = (PCIBridgeInfo*)&PCI[BridgeIndex[j]];
- if (info->SecondayBusNumber == PCI[i].slot.p.Bus) {
- AGPBridge = info;
- break;
- }
- }
- }
- }
- }
-
- // Enumerate all PCI and bridge devices to log file
- EnumeratePCI();
- }
+ for (i = 0; i < MAX_PCI_DEVICES; i++)
+ PCI[i].dwSize = sizeof(PCI[i]);
+ if ((NumPCI = PCI_enumerate(PCI,MAX_PCI_DEVICES)) == 0)
+ return -1;
+
+ /* Build a list of all PCI bridge devices */
+ for (i = 0,NumBridges = 0,BridgeIndex[0] = -1; i < NumPCI; i++) {
+ if (PCI[i].BaseClass == PCI_BRIDGE_CLASS) {
+ if (NumBridges < MAX_PCI_DEVICES)
+ BridgeIndex[NumBridges++] = i;
+ }
+ }
+
+ /* Now build a list of all display class devices */
+ for (i = 0,NumDevices = 1,DeviceIndex[0] = -1; i < NumPCI; i++) {
+ if (PCI_IS_DISPLAY_CLASS(&PCI[i])) {
+ if ((PCI[i].Command & 0x3) == 0x3) {
+ DeviceIndex[0] = i;
+ }
+ else {
+ if (NumDevices < MAX_PCI_DEVICES)
+ DeviceIndex[NumDevices++] = i;
+ }
+ if (PCI[i].slot.p.Bus != 0) {
+ /* This device is on a different bus than the primary */
+ /* PCI bus, so it is probably an AGP device. Find the */
+ /* AGP bus device that controls that bus so we can */
+ /* control it. */
+ for (j = 0; j < NumBridges; j++) {
+ info = (PCIBridgeInfo*)&PCI[BridgeIndex[j]];
+ if (info->SecondayBusNumber == PCI[i].slot.p.Bus) {
+ AGPBridge = info;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ /* Enumerate all PCI and bridge devices to log file */
+ EnumeratePCI();
+ }
return NumDevices;
}
@@ -522,48 +522,48 @@ void printk(const char *fmt, ...)
int main(int argc,char *argv[])
{
while (argc > 1) {
- if (stricmp(argv[1],"-usev86") == 0) {
- useV86 = true;
- }
- else if (stricmp(argv[1],"-force") == 0) {
- forcePost = true;
- }
+ if (stricmp(argv[1],"-usev86") == 0) {
+ useV86 = true;
+ }
+ else if (stricmp(argv[1],"-force") == 0) {
+ forcePost = true;
+ }
#ifdef DEBUG
- else if (stricmp(argv[1],"-decode") == 0) {
- debugFlags |= DEBUG_DECODE_F;
- }
- else if (stricmp(argv[1],"-iotrace") == 0) {
- debugFlags |= DEBUG_IO_TRACE_F;
- }
+ else if (stricmp(argv[1],"-decode") == 0) {
+ debugFlags |= DEBUG_DECODE_F;
+ }
+ else if (stricmp(argv[1],"-iotrace") == 0) {
+ debugFlags |= DEBUG_IO_TRACE_F;
+ }
#endif
- else {
- printf("Usage: warmboot [-usev86] [-force] [-decode] [-iotrace]\n");
- exit(-1);
- }
- argc--;
- argv++;
- }
+ else {
+ printf("Usage: warmboot [-usev86] [-force] [-decode] [-iotrace]\n");
+ exit(-1);
+ }
+ argc--;
+ argv++;
+ }
if ((logfile = fopen("warmboot.log","w")) == NULL)
- exit(1);
+ exit(1);
PM_init();
if (!useV86) {
- // Initialise the x86 BIOS emulator
- BE_init(false,debugFlags,65536,&VGAInfo[0]);
- }
+ /* Initialise the x86 BIOS emulator */
+ BE_init(false,debugFlags,65536,&VGAInfo[0]);
+ }
- // Enumerate all devices (which POST's them at the same time)
+ /* Enumerate all devices (which POST's them at the same time) */
if (PCI_enumerateDevices() < 1) {
- printk("No PCI display devices found!\n");
- return -1;
- }
+ printk("No PCI display devices found!\n");
+ return -1;
+ }
- // Post all the display controller BIOS'es
+ /* Post all the display controller BIOS'es */
PCI_postControllers();
- // Cleanup and exit the emulator
+ /* Cleanup and exit the emulator */
if (!useV86)
- BE_exit();
+ BE_exit();
fclose(logfile);
return 0;
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/aabeos.c b/board/MAI/bios_emulator/scitech/src/common/aabeos.c
index ba8645945b..ad5698a406 100644
--- a/board/MAI/bios_emulator/scitech/src/common/aabeos.c
+++ b/board/MAI/bios_emulator/scitech/src/common/aabeos.c
@@ -70,7 +70,7 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0)
- haveRDTSC = true;
+ haveRDTSC = true;
return true;
}
@@ -82,11 +82,11 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
else {
- struct timeval t;
- gettimeofday(&t, NULL);
- value->low = t.tv_sec*1000000 + t.tv_usec;
- value->high = 0;
- }
+ struct timeval t;
+ gettimeofday(&t, NULL);
+ value->low = t.tv_sec*1000000 + t.tv_usec;
+ value->high = 0;
+ }
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/aados.c b/board/MAI/bios_emulator/scitech/src/common/aados.c
index e994f938eb..342d2f33a4 100644
--- a/board/MAI/bios_emulator/scitech/src/common/aados.c
+++ b/board/MAI/bios_emulator/scitech/src/common/aados.c
@@ -49,7 +49,7 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0)
- return true;
+ return true;
return false;
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/aalib.c b/board/MAI/bios_emulator/scitech/src/common/aalib.c
index 84bf7b3d8f..5003b22291 100644
--- a/board/MAI/bios_emulator/scitech/src/common/aalib.c
+++ b/board/MAI/bios_emulator/scitech/src/common/aalib.c
@@ -100,35 +100,35 @@ static ibool LoadDriver(void)
/* Check if we have already loaded the driver */
if (loaded)
- return true;
+ return true;
PM_init();
_AA_exports.dwSize = sizeof(_AA_exports);
/* Open the BPD file */
if (!PM_findBPD(DLL_NAME,bpdpath))
- return false;
+ return false;
strcpy(filename,bpdpath);
strcat(filename,DLL_NAME);
if ((hModBPD = PE_loadLibrary(filename,false)) == NULL)
- return false;
+ return false;
if ((AA_initLibrary = (AA_initLibrary_t)PE_getProcAddress(hModBPD,"_AA_initLibrary")) == NULL)
- return false;
+ return false;
bpdpath[strlen(bpdpath)-1] = 0;
if (strcmp(bpdpath,PM_getNucleusPath()) == 0)
- strcpy(bpdpath,PM_getNucleusConfigPath());
+ strcpy(bpdpath,PM_getNucleusConfigPath());
else {
- PM_backslash(bpdpath);
- strcat(bpdpath,"config");
- }
+ PM_backslash(bpdpath);
+ strcat(bpdpath,"config");
+ }
if ((aaExp = AA_initLibrary(bpdpath,filename,&_PM_imports,&_N_imports,&_AA_imports)) == NULL)
- PM_fatalError("AA_initLibrary failed!\n");
+ PM_fatalError("AA_initLibrary failed!\n");
/* Initialize all default imports to point to fatal error handler
* for upwards compatibility, and copy the exported functions.
*/
max = sizeof(_AA_exports)/sizeof(AA_initLibrary_t);
for (i = 0,p = (ulong*)&_AA_exports; i < max; i++)
- *p++ = (ulong)_AA_fatalErrorHandler;
+ *p++ = (ulong)_AA_fatalErrorHandler;
memcpy(&_AA_exports,aaExp,MIN(sizeof(_AA_exports),aaExp->dwSize));
loaded = true;
return true;
@@ -143,7 +143,7 @@ static ibool LoadDriver(void)
int NAPI AA_status(void)
{
if (!loaded)
- return nDriverNotFound;
+ return nDriverNotFound;
return _AA_exports.AA_status();
}
@@ -152,7 +152,7 @@ const char * NAPI AA_errorMsg(
N_int32 status)
{
if (!loaded)
- return "Unable to load Nucleus device driver!";
+ return "Unable to load Nucleus device driver!";
return _AA_exports.AA_errorMsg(status);
}
@@ -160,7 +160,7 @@ const char * NAPI AA_errorMsg(
int NAPI AA_getDaysLeft(void)
{
if (!LoadDriver())
- return -1;
+ return -1;
return _AA_exports.AA_getDaysLeft();
}
@@ -168,7 +168,7 @@ int NAPI AA_getDaysLeft(void)
int NAPI AA_registerLicense(uchar *license)
{
if (!LoadDriver())
- return 0;
+ return 0;
return _AA_exports.AA_registerLicense(license);
}
@@ -176,7 +176,7 @@ int NAPI AA_registerLicense(uchar *license)
int NAPI AA_enumerateDevices(void)
{
if (!LoadDriver())
- return 0;
+ return 0;
return _AA_exports.AA_enumerateDevices();
}
@@ -184,7 +184,7 @@ int NAPI AA_enumerateDevices(void)
AA_devCtx * NAPI AA_loadDriver(N_int32 deviceIndex)
{
if (!LoadDriver())
- return NULL;
+ return NULL;
return _AA_exports.AA_loadDriver(deviceIndex);
}
#endif
@@ -211,15 +211,15 @@ void NAPI _OS_delay(
LZTimerObject tm;
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0) {
- if (!inited) {
- ZTimerInit();
- inited = true;
- }
- LZTimerOnExt(&tm);
- while (LZTimerLapExt(&tm) < microSeconds)
- ;
- LZTimerOnExt(&tm);
- }
+ if (!inited) {
+ ZTimerInit();
+ inited = true;
+ }
+ LZTimerOnExt(&tm);
+ while (LZTimerLapExt(&tm) < microSeconds)
+ ;
+ LZTimerOnExt(&tm);
+ }
else
- _OS_delay8253(microSeconds);
+ _OS_delay8253(microSeconds);
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/aalinux.c b/board/MAI/bios_emulator/scitech/src/common/aalinux.c
index 4385b23e4f..d3d468ed0f 100644
--- a/board/MAI/bios_emulator/scitech/src/common/aalinux.c
+++ b/board/MAI/bios_emulator/scitech/src/common/aalinux.c
@@ -72,7 +72,7 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0)
- haveRDTSC = true;
+ haveRDTSC = true;
return true;
}
@@ -84,11 +84,11 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
else {
- struct timeval t;
- gettimeofday(&t, NULL);
- value->low = t.tv_sec*1000000 + t.tv_usec;
- value->high = 0;
- }
+ struct timeval t;
+ gettimeofday(&t, NULL);
+ value->low = t.tv_sec*1000000 + t.tv_usec;
+ value->high = 0;
+ }
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/aaos2.c b/board/MAI/bios_emulator/scitech/src/common/aaos2.c
index 486b96a9c0..0ec8c9fcf1 100644
--- a/board/MAI/bios_emulator/scitech/src/common/aaos2.c
+++ b/board/MAI/bios_emulator/scitech/src/common/aaos2.c
@@ -65,25 +65,25 @@ GA_sharedInfo * NAPI GA_getSharedInfo(
/* Open our helper device driver */
if (DosOpen(PMHELP_NAME,&hSDDHelp,&result,0,0,
- FILE_OPEN, OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,
- NULL))
- PM_fatalError("Unable to open SDDHELP$ helper device driver!");
+ FILE_OPEN, OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,
+ NULL))
+ PM_fatalError("Unable to open SDDHELP$ helper device driver!");
outLen = sizeof(result);
DosDevIOCtl(hSDDHelp,PMHELP_IOCTL,PMHELP_GETSHAREDINFO,
- NULL, 0, NULL,
- &result, outLen, &outLen);
+ NULL, 0, NULL,
+ &result, outLen, &outLen);
DosClose(hSDDHelp);
if (result) {
- /* We have found the shared Nucleus packet. Because not all processes
- * map to SDDPMI.DLL, we need to ensure that we connect to this
- * DLL so that it gets mapped into our address space (that is
- * where the shared Nucleus packet is located). Simply doing a
- * DosLoadModule on it is enough for this.
- */
- HMODULE hModSDDPMI;
- char buf[80];
- DosLoadModule((PSZ)buf,sizeof(buf),(PSZ)"SDDPMI.DLL",&hModSDDPMI);
- }
+ /* We have found the shared Nucleus packet. Because not all processes
+ * map to SDDPMI.DLL, we need to ensure that we connect to this
+ * DLL so that it gets mapped into our address space (that is
+ * where the shared Nucleus packet is located). Simply doing a
+ * DosLoadModule on it is enough for this.
+ */
+ HMODULE hModSDDPMI;
+ char buf[80];
+ DosLoadModule((PSZ)buf,sizeof(buf),(PSZ)"SDDPMI.DLL",&hModSDDPMI);
+ }
return (GA_sharedInfo*)result;
}
@@ -106,7 +106,7 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0)
- haveRDTSC = true;
+ haveRDTSC = true;
return true;
}
@@ -118,7 +118,7 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
else
- DosTmrQueryTime((QWORD*)value);
+ DosTmrQueryTime((QWORD*)value);
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/aaqnx.c b/board/MAI/bios_emulator/scitech/src/common/aaqnx.c
index 2e26c9afa6..13531be99f 100644
--- a/board/MAI/bios_emulator/scitech/src/common/aaqnx.c
+++ b/board/MAI/bios_emulator/scitech/src/common/aaqnx.c
@@ -72,7 +72,7 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0)
- haveRDTSC = true;
+ haveRDTSC = true;
return true;
}
@@ -84,12 +84,12 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
else {
- struct timespec ts;
+ struct timespec ts;
- clock_gettime(CLOCK_REALTIME, &ts);
- value->low = (ts.tv_nsec / 1000 + ts.tv_sec * 1000000);
- value->high = 0;
- }
+ clock_gettime(CLOCK_REALTIME, &ts);
+ value->low = (ts.tv_nsec / 1000 + ts.tv_sec * 1000000);
+ value->high = 0;
+ }
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/aartt.c b/board/MAI/bios_emulator/scitech/src/common/aartt.c
index 17a06b531c..1a5a67a4e9 100644
--- a/board/MAI/bios_emulator/scitech/src/common/aartt.c
+++ b/board/MAI/bios_emulator/scitech/src/common/aartt.c
@@ -71,9 +71,9 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0) {
- haveRDTSC = true;
- return true;
- }
+ haveRDTSC = true;
+ return true;
+ }
return false;
}
@@ -85,5 +85,5 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/aasmx.c b/board/MAI/bios_emulator/scitech/src/common/aasmx.c
index 56cbd5b888..163060f717 100644
--- a/board/MAI/bios_emulator/scitech/src/common/aasmx.c
+++ b/board/MAI/bios_emulator/scitech/src/common/aasmx.c
@@ -68,7 +68,7 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0)
- return true;
+ return true;
return false;
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/aavxd.c b/board/MAI/bios_emulator/scitech/src/common/aavxd.c
index 295533db39..221b02bd9b 100644
--- a/board/MAI/bios_emulator/scitech/src/common/aavxd.c
+++ b/board/MAI/bios_emulator/scitech/src/common/aavxd.c
@@ -71,8 +71,8 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0) {
- haveRDTSC = true;
- }
+ haveRDTSC = true;
+ }
return true;
}
@@ -84,7 +84,7 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
else
- VTD_Get_Real_Time(&value->high,&value->low);
+ VTD_Get_Real_Time(&value->high,&value->low);
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/aawin32.c b/board/MAI/bios_emulator/scitech/src/common/aawin32.c
index f63f004f99..541df4ac58 100644
--- a/board/MAI/bios_emulator/scitech/src/common/aawin32.c
+++ b/board/MAI/bios_emulator/scitech/src/common/aawin32.c
@@ -75,9 +75,9 @@ GA_sharedInfo * NAPI GA_getSharedInfo(
PM_init();
inBuf[0] = device;
if (DeviceIoControl(_PM_hDevice, PMHELP_GETSHAREDINFO32, inBuf, sizeof(inBuf),
- outBuf, sizeof(outBuf), &count, NULL)) {
- return (GA_sharedInfo*)outBuf[0];
- }
+ outBuf, sizeof(outBuf), &count, NULL)) {
+ return (GA_sharedInfo*)outBuf[0];
+ }
return NULL;
}
@@ -102,16 +102,16 @@ static ibool NAPI _GA_softStereoInit(
GA_devCtx *dc)
{
if (_PM_hDevice) {
- DWORD inBuf[1]; /* Buffer to send data to VxD */
- DWORD outBuf[1]; /* Buffer to receive data from VxD */
- DWORD count; /* Count of bytes returned from VxD */
+ DWORD inBuf[1]; /* Buffer to send data to VxD */
+ DWORD outBuf[1]; /* Buffer to receive data from VxD */
+ DWORD count; /* Count of bytes returned from VxD */
- inBuf[0] = (ulong)dc;
- if (DeviceIoControl(_PM_hDevice, PMHELP_GASTEREOINIT32, inBuf, sizeof(inBuf),
- outBuf, sizeof(outBuf), &count, NULL)) {
- return outBuf[0];
- }
- }
+ inBuf[0] = (ulong)dc;
+ if (DeviceIoControl(_PM_hDevice, PMHELP_GASTEREOINIT32, inBuf, sizeof(inBuf),
+ outBuf, sizeof(outBuf), &count, NULL)) {
+ return outBuf[0];
+ }
+ }
return false;
}
@@ -122,9 +122,9 @@ This function turns on software stereo mode, either directly or via the VxD.
static void NAPI _GA_softStereoOn(void)
{
if (_PM_hDevice) {
- DeviceIoControl(_PM_hDevice, PMHELP_GASTEREOON32, NULL, 0,
- NULL, 0, NULL, NULL);
- }
+ DeviceIoControl(_PM_hDevice, PMHELP_GASTEREOON32, NULL, 0,
+ NULL, 0, NULL, NULL);
+ }
}
/****************************************************************************
@@ -137,14 +137,14 @@ static void NAPI _GA_softStereoScheduleFlip(
N_uint32 rightAddr)
{
if (_PM_hDevice) {
- DWORD inBuf[2]; /* Buffer to send data to VxD */
- DWORD count; /* Count of bytes returned from VxD */
+ DWORD inBuf[2]; /* Buffer to send data to VxD */
+ DWORD count; /* Count of bytes returned from VxD */
- inBuf[0] = (ulong)leftAddr;
- inBuf[1] = (ulong)rightAddr;
- DeviceIoControl(_PM_hDevice, PMHELP_GASTEREOFLIP32, inBuf, sizeof(inBuf),
- NULL, 0, &count, NULL);
- }
+ inBuf[0] = (ulong)leftAddr;
+ inBuf[1] = (ulong)rightAddr;
+ DeviceIoControl(_PM_hDevice, PMHELP_GASTEREOFLIP32, inBuf, sizeof(inBuf),
+ NULL, 0, &count, NULL);
+ }
}
/****************************************************************************
@@ -154,14 +154,14 @@ This function turns off software stereo mode, either directly or via the VxD.
static N_int32 NAPI _GA_softStereoGetFlipStatus(void)
{
if (_PM_hDevice) {
- DWORD outBuf[1]; /* Buffer to receive data from VxD */
- DWORD count; /* Count of bytes returned from VxD */
+ DWORD outBuf[1]; /* Buffer to receive data from VxD */
+ DWORD count; /* Count of bytes returned from VxD */
- if (DeviceIoControl(_PM_hDevice, PMHELP_GASTEREOFLIPSTATUS32, NULL, 0,
- outBuf, sizeof(outBuf), &count, NULL)) {
- return outBuf[0];
- }
- }
+ if (DeviceIoControl(_PM_hDevice, PMHELP_GASTEREOFLIPSTATUS32, NULL, 0,
+ outBuf, sizeof(outBuf), &count, NULL)) {
+ return outBuf[0];
+ }
+ }
return 0;
}
@@ -172,7 +172,7 @@ This function turns off software stereo mode, either directly or via the VxD.
static void NAPI _GA_softStereoWaitTillFlipped(void)
{
while (!_GA_softStereoGetFlipStatus())
- ;
+ ;
}
/****************************************************************************
@@ -182,9 +182,9 @@ This function turns off software stereo mode, either directly or via the VxD.
static void NAPI _GA_softStereoOff(void)
{
if (_PM_hDevice) {
- DeviceIoControl(_PM_hDevice, PMHELP_GASTEREOOFF32, NULL, 0,
- NULL, 0, NULL, NULL);
- }
+ DeviceIoControl(_PM_hDevice, PMHELP_GASTEREOOFF32, NULL, 0,
+ NULL, 0, NULL, NULL);
+ }
}
/****************************************************************************
@@ -195,9 +195,9 @@ the VxD.
static void NAPI _GA_softStereoExit(void)
{
if (_PM_hDevice) {
- DeviceIoControl(_PM_hDevice, PMHELP_GASTEREOEXIT32, NULL, 0,
- NULL, 0, NULL, NULL);
- }
+ DeviceIoControl(_PM_hDevice, PMHELP_GASTEREOEXIT32, NULL, 0,
+ NULL, 0, NULL, NULL);
+ }
}
/****************************************************************************
@@ -217,14 +217,14 @@ static GA_devCtx * NAPI _GA_loadDriver(
N_int32 totalMemory = 0,oldIOPL;
if (deviceIndex >= GA_MAX_DEVICES)
- PM_fatalError("DeviceIndex too large in GA_loadDriver!");
+ PM_fatalError("DeviceIndex too large in GA_loadDriver!");
PM_init();
inBuf[0] = deviceIndex;
if (DeviceIoControl(_PM_hDevice, PMHELP_GETMEMSIZE32,
- inBuf, sizeof(inBuf), outBuf, sizeof(outBuf), NULL, NULL))
- totalMemory = outBuf[0];
+ inBuf, sizeof(inBuf), outBuf, sizeof(outBuf), NULL, NULL))
+ totalMemory = outBuf[0];
if (totalMemory == 0)
- totalMemory = 8192;
+ totalMemory = 8192;
_GA_exports.GA_forceMemSize(totalMemory,shared);
oldIOPL = PM_setIOPL(3);
dc = ORG_GA_loadDriver(deviceIndex,shared);
@@ -240,13 +240,13 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0) {
- haveRDTSC = true;
- return true;
- }
+ haveRDTSC = true;
+ return true;
+ }
else if (QueryPerformanceFrequency((LARGE_INTEGER*)&countFreq)) {
- haveRDTSC = false;
- return true;
- }
+ haveRDTSC = false;
+ return true;
+ }
return false;
}
@@ -258,7 +258,7 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
else
- QueryPerformanceCounter((LARGE_INTEGER*)value);
+ QueryPerformanceCounter((LARGE_INTEGER*)value);
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/agplib.c b/board/MAI/bios_emulator/scitech/src/common/agplib.c
index df8f932fb1..476eedc873 100644
--- a/board/MAI/bios_emulator/scitech/src/common/agplib.c
+++ b/board/MAI/bios_emulator/scitech/src/common/agplib.c
@@ -88,31 +88,31 @@ static ibool LoadDriver(void)
/* Check if we have already loaded the driver */
if (loaded)
- return true;
+ return true;
PM_init();
/* Open the BPD file */
if (!PM_findBPD(DLL_NAME,bpdpath))
- return false;
+ return false;
strcpy(filename,bpdpath);
strcat(filename,DLL_NAME);
if ((hModBPD = PE_loadLibrary(filename,false)) == NULL)
- return false;
+ return false;
if ((AGP_initLibrary = (AGP_initLibrary_t)PE_getProcAddress(hModBPD,"_AGP_initLibrary")) == NULL)
- return false;
+ return false;
bpdpath[strlen(bpdpath)-1] = 0;
if (strcmp(bpdpath,PM_getNucleusPath()) == 0)
- strcpy(bpdpath,PM_getNucleusConfigPath());
+ strcpy(bpdpath,PM_getNucleusConfigPath());
else {
- PM_backslash(bpdpath);
- strcat(bpdpath,"config");
- }
+ PM_backslash(bpdpath);
+ strcat(bpdpath,"config");
+ }
if ((agpExp = AGP_initLibrary(bpdpath,filename,GA_getSystemPMImports(),&_N_imports,&_AGP_imports)) == NULL)
- PM_fatalError("AGP_initLibrary failed!\n");
+ PM_fatalError("AGP_initLibrary failed!\n");
_AGP_exports.dwSize = sizeof(_AGP_exports);
max = sizeof(_AGP_exports)/sizeof(AGP_initLibrary_t);
for (i = 0,p = (ulong*)&_AGP_exports; i < max; i++)
- *p++ = (ulong)_AGP_fatalErrorHandler;
+ *p++ = (ulong)_AGP_fatalErrorHandler;
memcpy(&_AGP_exports,agpExp,MIN(sizeof(_AGP_exports),agpExp->dwSize));
loaded = true;
return true;
@@ -127,7 +127,7 @@ static ibool LoadDriver(void)
int NAPI AGP_status(void)
{
if (!loaded)
- return nDriverNotFound;
+ return nDriverNotFound;
return _AGP_exports.AGP_status();
}
@@ -136,7 +136,7 @@ const char * NAPI AGP_errorMsg(
N_int32 status)
{
if (!loaded)
- return "Unable to load Nucleus device driver!";
+ return "Unable to load Nucleus device driver!";
return _AGP_exports.AGP_errorMsg(status);
}
@@ -144,7 +144,7 @@ const char * NAPI AGP_errorMsg(
AGP_devCtx * NAPI AGP_loadDriver(N_int32 deviceIndex)
{
if (!LoadDriver())
- return NULL;
+ return NULL;
return _AGP_exports.AGP_loadDriver(deviceIndex);
}
@@ -153,7 +153,7 @@ void NAPI AGP_unloadDriver(
AGP_devCtx *dc)
{
if (loaded)
- _AGP_exports.AGP_unloadDriver(dc);
+ _AGP_exports.AGP_unloadDriver(dc);
}
/* {secret} */
@@ -161,7 +161,7 @@ void NAPI AGP_getGlobalOptions(
AGP_globalOptions *options)
{
if (LoadDriver())
- _AGP_exports.AGP_getGlobalOptions(options);
+ _AGP_exports.AGP_getGlobalOptions(options);
}
/* {secret} */
@@ -169,7 +169,7 @@ void NAPI AGP_setGlobalOptions(
AGP_globalOptions *options)
{
if (LoadDriver())
- _AGP_exports.AGP_setGlobalOptions(options);
+ _AGP_exports.AGP_setGlobalOptions(options);
}
/* {secret} */
@@ -177,7 +177,7 @@ void NAPI AGP_saveGlobalOptions(
AGP_globalOptions *options)
{
if (loaded)
- _AGP_exports.AGP_saveGlobalOptions(options);
+ _AGP_exports.AGP_saveGlobalOptions(options);
}
#endif
@@ -197,24 +197,23 @@ void NAPI _OS_delay(
if (!inited) {
#ifndef __WIN32_VXD__
- // This has been causing problems in VxD's for some reason, so for now
- // we avoid using it.
- if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0) {
- ZTimerInit();
- haveRDTSC = true;
- }
- else
+ /* This has been causing problems in VxD's for some reason, so for now */
+ /* we avoid using it. */
+ if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0) {
+ ZTimerInit();
+ haveRDTSC = true;
+ }
+ else
#endif
- haveRDTSC = false;
- inited = true;
- }
+ haveRDTSC = false;
+ inited = true;
+ }
if (haveRDTSC) {
- LZTimerOnExt(&tm);
- while (LZTimerLapExt(&tm) < microSeconds)
- ;
- LZTimerOnExt(&tm);
- }
+ LZTimerOnExt(&tm);
+ while (LZTimerLapExt(&tm) < microSeconds)
+ ;
+ LZTimerOnExt(&tm);
+ }
else
- _OS_delay8253(microSeconds);
+ _OS_delay8253(microSeconds);
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/common/center.c b/board/MAI/bios_emulator/scitech/src/common/center.c
index 7eb368fd3a..68e17c2a94 100644
--- a/board/MAI/bios_emulator/scitech/src/common/center.c
+++ b/board/MAI/bios_emulator/scitech/src/common/center.c
@@ -60,19 +60,19 @@ void _EXPORT CenterWindow(HWND hWndCenter, HWND parent, BOOL repaint)
CenterY = ((RectParent.bottom - RectParent.top) - Height) / 2;
if ((CenterX < 0) || (CenterY < 0)) {
- /* The Center Window is smaller than the parent window. */
- if (hWndParent != GetDesktopWindow()) {
- /* If the parent window is not the desktop use the desktop size. */
- CenterX = (GetSystemMetrics(SM_CXSCREEN) - Width) / 2;
- CenterY = (GetSystemMetrics(SM_CYSCREEN) - Height) / 2;
- }
- CenterX = (CenterX < 0) ? 0: CenterX;
- CenterY = (CenterY < 0) ? 0: CenterY;
- }
+ /* The Center Window is smaller than the parent window. */
+ if (hWndParent != GetDesktopWindow()) {
+ /* If the parent window is not the desktop use the desktop size. */
+ CenterX = (GetSystemMetrics(SM_CXSCREEN) - Width) / 2;
+ CenterY = (GetSystemMetrics(SM_CYSCREEN) - Height) / 2;
+ }
+ CenterX = (CenterX < 0) ? 0: CenterX;
+ CenterY = (CenterY < 0) ? 0: CenterY;
+ }
else {
- CenterX += RectParent.left;
- CenterY += RectParent.top;
- }
+ CenterX += RectParent.left;
+ CenterY += RectParent.top;
+ }
/* Copy the values into RectCenter */
RectCenter.left = CenterX;
@@ -82,8 +82,8 @@ void _EXPORT CenterWindow(HWND hWndCenter, HWND parent, BOOL repaint)
/* Move the window to the new location */
MoveWindow(hWndCenter, RectCenter.left, RectCenter.top,
- (RectCenter.right - RectCenter.left),
- (RectCenter.bottom - RectCenter.top), repaint);
+ (RectCenter.right - RectCenter.left),
+ (RectCenter.bottom - RectCenter.top), repaint);
}
void _EXPORT CenterLogo(HWND hWndLogo, HWND hWndParent, int CenterY)
@@ -117,7 +117,6 @@ void _EXPORT CenterLogo(HWND hWndLogo, HWND hWndParent, int CenterY)
/* Move the window to the new location */
MoveWindow(hWndLogo, RectCenter.left, RectCenter.top,
- (RectCenter.right - RectCenter.left),
- (RectCenter.bottom - RectCenter.top), false);
+ (RectCenter.right - RectCenter.left),
+ (RectCenter.bottom - RectCenter.top), false);
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/common/cmdline.c b/board/MAI/bios_emulator/scitech/src/common/cmdline.c
index 872fae9194..531e5e1312 100644
--- a/board/MAI/bios_emulator/scitech/src/common/cmdline.c
+++ b/board/MAI/bios_emulator/scitech/src/common/cmdline.c
@@ -106,49 +106,49 @@ int getcmdopt(
char *formatchar;
if (argc > nextargv) {
- if (nextchar == NULL) {
- nextchar = argv[nextargv]; /* Index next argument */
- if (nextchar == NULL) {
- nextargv++;
- return ALLDONE; /* No more options */
- }
- if (IS_NOT_SWITCH_CHAR(*nextchar)) {
- nextchar = NULL;
- return PARAMETER; /* We have a parameter */
- }
- nextchar++; /* Move past switch operator */
- if (IS_SWITCH_CHAR(*nextchar)) {
- nextchar = NULL;
- return INVALID; /* Ignore rest of line */
- }
- }
- if ((ch = *(nextchar++)) == 0) {
- nextchar = NULL;
- return INVALID; /* No options on line */
- }
-
- if (ch == ':' || (formatchar = strchr(format, ch)) == NULL)
- return INVALID;
-
- if (*(++formatchar) == ':') { /* Expect an argument after option */
- nextargv++;
- if (*nextchar == 0) {
- if (argc <= nextargv)
- return INVALID;
- nextchar = argv[nextargv++];
- }
- *argument = nextchar;
- nextchar = NULL;
- }
- else { /* We have a switch style option */
- if (*nextchar == 0) {
- nextargv++;
- nextchar = NULL;
- }
- *argument = NULL;
- }
- return ch; /* return the option specifier */
- }
+ if (nextchar == NULL) {
+ nextchar = argv[nextargv]; /* Index next argument */
+ if (nextchar == NULL) {
+ nextargv++;
+ return ALLDONE; /* No more options */
+ }
+ if (IS_NOT_SWITCH_CHAR(*nextchar)) {
+ nextchar = NULL;
+ return PARAMETER; /* We have a parameter */
+ }
+ nextchar++; /* Move past switch operator */
+ if (IS_SWITCH_CHAR(*nextchar)) {
+ nextchar = NULL;
+ return INVALID; /* Ignore rest of line */
+ }
+ }
+ if ((ch = *(nextchar++)) == 0) {
+ nextchar = NULL;
+ return INVALID; /* No options on line */
+ }
+
+ if (ch == ':' || (formatchar = strchr(format, ch)) == NULL)
+ return INVALID;
+
+ if (*(++formatchar) == ':') { /* Expect an argument after option */
+ nextargv++;
+ if (*nextchar == 0) {
+ if (argc <= nextargv)
+ return INVALID;
+ nextchar = argv[nextargv++];
+ }
+ *argument = nextchar;
+ nextchar = NULL;
+ }
+ else { /* We have a switch style option */
+ if (*nextchar == 0) {
+ nextargv++;
+ nextchar = NULL;
+ }
+ *argument = NULL;
+ }
+ return ch; /* return the option specifier */
+ }
nextchar = NULL;
nextargv++;
return ALLDONE; /* no arguments on command line */
@@ -174,51 +174,51 @@ static int parse_option(
int num_read;
switch ((int)(optarr->type)) {
- case OPT_INTEGER:
- num_read = sscanf(argument,"%d",(int*)optarr->arg);
- break;
- case OPT_HEX:
- num_read = sscanf(argument,"%x",(int*)optarr->arg);
- break;
- case OPT_OCTAL:
- num_read = sscanf(argument,"%o",(int*)optarr->arg);
- break;
- case OPT_UNSIGNED:
- num_read = sscanf(argument,"%u",(uint*)optarr->arg);
- break;
- case OPT_LINTEGER:
- num_read = sscanf(argument,"%ld",(long*)optarr->arg);
- break;
- case OPT_LHEX:
- num_read = sscanf(argument,"%lx",(long*)optarr->arg);
- break;
- case OPT_LOCTAL:
- num_read = sscanf(argument,"%lo",(long*)optarr->arg);
- break;
- case OPT_LUNSIGNED:
- num_read = sscanf(argument,"%lu",(ulong*)optarr->arg);
- break;
- case OPT_FLOAT:
- num_read = sscanf(argument,"%f",(float*)optarr->arg);
- break;
- case OPT_DOUBLE:
- num_read = sscanf(argument,"%lf",(double*)optarr->arg);
- break;
- case OPT_LDOUBLE:
- num_read = sscanf(argument,"%Lf",(long double*)optarr->arg);
- break;
- case OPT_STRING:
- num_read = 1; /* This always works */
- *((char**)optarr->arg) = argument;
- break;
- default:
- return INVALID;
- }
+ case OPT_INTEGER:
+ num_read = sscanf(argument,"%d",(int*)optarr->arg);
+ break;
+ case OPT_HEX:
+ num_read = sscanf(argument,"%x",(int*)optarr->arg);
+ break;
+ case OPT_OCTAL:
+ num_read = sscanf(argument,"%o",(int*)optarr->arg);
+ break;
+ case OPT_UNSIGNED:
+ num_read = sscanf(argument,"%u",(uint*)optarr->arg);
+ break;
+ case OPT_LINTEGER:
+ num_read = sscanf(argument,"%ld",(long*)optarr->arg);
+ break;
+ case OPT_LHEX:
+ num_read = sscanf(argument,"%lx",(long*)optarr->arg);
+ break;
+ case OPT_LOCTAL:
+ num_read = sscanf(argument,"%lo",(long*)optarr->arg);
+ break;
+ case OPT_LUNSIGNED:
+ num_read = sscanf(argument,"%lu",(ulong*)optarr->arg);
+ break;
+ case OPT_FLOAT:
+ num_read = sscanf(argument,"%f",(float*)optarr->arg);
+ break;
+ case OPT_DOUBLE:
+ num_read = sscanf(argument,"%lf",(double*)optarr->arg);
+ break;
+ case OPT_LDOUBLE:
+ num_read = sscanf(argument,"%Lf",(long double*)optarr->arg);
+ break;
+ case OPT_STRING:
+ num_read = 1; /* This always works */
+ *((char**)optarr->arg) = argument;
+ break;
+ default:
+ return INVALID;
+ }
if (num_read == 0)
- return INVALID;
+ return INVALID;
else
- return ALLDONE;
+ return ALLDONE;
}
/****************************************************************************
@@ -261,8 +261,8 @@ int getargs(
int num_opt,
Option optarr[],
int (*do_param)(
- char *param,
- int num))
+ char *param,
+ int num))
{
int i,opt;
char *argument;
@@ -273,51 +273,51 @@ int getargs(
strcpy(cmdstr,"hH?");
for (i = 0,opt = 3; i < num_opt; i++,opt++) {
- cmdstr[opt] = optarr[i].opt;
- if (optarr[i].type != OPT_SWITCH) {
- cmdstr[++opt] = ':';
- }
- }
+ cmdstr[opt] = optarr[i].opt;
+ if (optarr[i].type != OPT_SWITCH) {
+ cmdstr[++opt] = ':';
+ }
+ }
cmdstr[opt] = '\0';
for (;;) {
- opt = getcmdopt(argc,argv,cmdstr,&argument);
- switch (opt) {
- case 'H':
- case 'h':
- case '?':
- return HELP;
- case ALLDONE:
- return ALLDONE;
- case INVALID:
- return INVALID;
- case PARAMETER:
- if (do_param == NULL)
- return INVALID;
- if (do_param(argv[nextargv],param_num) == INVALID)
- return INVALID;
- nextargv++;
- param_num++;
- break;
- default:
-
- /* Search for the option in the option array. We are
- * guaranteed to find it.
- */
-
- for (i = 0; i < num_opt; i++) {
- if (optarr[i].opt == opt)
- break;
- }
- if (optarr[i].type == OPT_SWITCH)
- *((ibool*)optarr[i].arg) = true;
- else {
- if (parse_option(&optarr[i],argument) == INVALID)
- return INVALID;
- }
- break;
- }
- }
+ opt = getcmdopt(argc,argv,cmdstr,&argument);
+ switch (opt) {
+ case 'H':
+ case 'h':
+ case '?':
+ return HELP;
+ case ALLDONE:
+ return ALLDONE;
+ case INVALID:
+ return INVALID;
+ case PARAMETER:
+ if (do_param == NULL)
+ return INVALID;
+ if (do_param(argv[nextargv],param_num) == INVALID)
+ return INVALID;
+ nextargv++;
+ param_num++;
+ break;
+ default:
+
+ /* Search for the option in the option array. We are
+ * guaranteed to find it.
+ */
+
+ for (i = 0; i < num_opt; i++) {
+ if (optarr[i].opt == opt)
+ break;
+ }
+ if (optarr[i].type == OPT_SWITCH)
+ *((ibool*)optarr[i].arg) = true;
+ else {
+ if (parse_option(&optarr[i],argument) == INVALID)
+ return INVALID;
+ }
+ break;
+ }
+ }
}
/****************************************************************************
@@ -340,11 +340,11 @@ void print_desc(
int i;
for (i = 0; i < num_opt; i++) {
- if (optarr[i].type == OPT_SWITCH)
- printf(" -%c %s\n",optarr[i].opt,optarr[i].desc);
- else
- printf(" -%c<arg> %s\n",optarr[i].opt,optarr[i].desc);
- }
+ if (optarr[i].type == OPT_SWITCH)
+ printf(" -%c %s\n",optarr[i].opt,optarr[i].desc);
+ else
+ printf(" -%c<arg> %s\n",optarr[i].opt,optarr[i].desc);
+ }
}
/****************************************************************************
@@ -382,45 +382,45 @@ int parse_commandline(
argv[argc++] = filename;
cmdLine = strncpy(str, cmdLine, sizeof(str)-1);
while (*cmdLine) {
- switch (*cmdLine) {
- case '"' :
- if (prevWord != NULL) {
- if (inQuote) {
- if (!noStrip)
- *cmdLine = '\0';
- argv [argc++] = prevWord;
- prevWord = NULL;
- }
- else
- noStrip = TRUE;
- }
- inQuote = !inQuote;
- break;
- case ' ' :
- case '\t' :
- if (!inQuote) {
- if (prevWord != NULL) {
- *cmdLine = '\0';
- argv [argc++] = prevWord;
- prevWord = NULL;
- noStrip = FALSE;
- }
- }
- break;
- default :
- if (prevWord == NULL)
- prevWord = cmdLine;
- break;
- }
- if (argc >= maxArgv - 1)
- break;
- cmdLine++;
- }
+ switch (*cmdLine) {
+ case '"' :
+ if (prevWord != NULL) {
+ if (inQuote) {
+ if (!noStrip)
+ *cmdLine = '\0';
+ argv [argc++] = prevWord;
+ prevWord = NULL;
+ }
+ else
+ noStrip = TRUE;
+ }
+ inQuote = !inQuote;
+ break;
+ case ' ' :
+ case '\t' :
+ if (!inQuote) {
+ if (prevWord != NULL) {
+ *cmdLine = '\0';
+ argv [argc++] = prevWord;
+ prevWord = NULL;
+ noStrip = FALSE;
+ }
+ }
+ break;
+ default :
+ if (prevWord == NULL)
+ prevWord = cmdLine;
+ break;
+ }
+ if (argc >= maxArgv - 1)
+ break;
+ cmdLine++;
+ }
if ((prevWord != NULL || (inQuote && prevWord != NULL)) && argc < maxArgv - 1) {
- *cmdLine = '\0';
- argv [argc++] = prevWord;
- }
+ *cmdLine = '\0';
+ argv [argc++] = prevWord;
+ }
argv[argc] = NULL;
/* Return updated parameters */
diff --git a/board/MAI/bios_emulator/scitech/src/common/gabeos.c b/board/MAI/bios_emulator/scitech/src/common/gabeos.c
index 1d8a543216..a934bd1cfc 100644
--- a/board/MAI/bios_emulator/scitech/src/common/gabeos.c
+++ b/board/MAI/bios_emulator/scitech/src/common/gabeos.c
@@ -70,10 +70,10 @@ library is used with the application local version of Nucleus.
****************************************************************************/
PM_imports * NAPI GA_getSystemPMImports(void)
{
- // TODO: We may very well want to provide a system shared library
- // that eports the PM functions required by the Nucleus library
- // for BeOS here. That will eliminate fatal errors loading new
- // drivers on BeOS!
+ /* TODO: We may very well want to provide a system shared library */
+ /* that eports the PM functions required by the Nucleus library */
+ /* for BeOS here. That will eliminate fatal errors loading new */
+ /* drivers on BeOS! */
return &_PM_imports;
}
@@ -124,7 +124,7 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0)
- haveRDTSC = true;
+ haveRDTSC = true;
return true;
}
@@ -136,11 +136,11 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
else {
- struct timeval t;
- gettimeofday(&t, NULL);
- value->low = t.tv_sec*1000000 + t.tv_usec;
- value->high = 0;
- }
+ struct timeval t;
+ gettimeofday(&t, NULL);
+ value->low = t.tv_sec*1000000 + t.tv_usec;
+ value->high = 0;
+ }
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/gados.c b/board/MAI/bios_emulator/scitech/src/common/gados.c
index 4c90e805d7..d2be77694f 100644
--- a/board/MAI/bios_emulator/scitech/src/common/gados.c
+++ b/board/MAI/bios_emulator/scitech/src/common/gados.c
@@ -120,7 +120,7 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0)
- return true;
+ return true;
return false;
}
@@ -133,4 +133,3 @@ void NAPI GA_TimerRead(
{
_GA_readTimeStamp(value);
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/common/galib.c b/board/MAI/bios_emulator/scitech/src/common/galib.c
index 7c1fbe312d..f2eacc3d24 100644
--- a/board/MAI/bios_emulator/scitech/src/common/galib.c
+++ b/board/MAI/bios_emulator/scitech/src/common/galib.c
@@ -107,7 +107,7 @@ static ibool LoadDriver(
/* Check if we have already loaded the driver */
if (loaded)
- return true;
+ return true;
PM_init();
/* First try to see if we can find the system wide shared exports
@@ -116,33 +116,33 @@ static ibool LoadDriver(
*/
__GA_exports.dwSize = sizeof(__GA_exports);
if (GA_getSharedExports(&__GA_exports,shared))
- return loaded = true;
+ return loaded = true;
/* Open the BPD file */
if (!PM_findBPD(DLL_NAME,bpdpath))
- return false;
+ return false;
strcpy(filename,bpdpath);
strcat(filename,DLL_NAME);
if ((hModBPD = PE_loadLibrary(filename,shared)) == NULL)
- return false;
+ return false;
if ((GA_initLibrary = (GA_initLibrary_t)PE_getProcAddress(hModBPD,"_GA_initLibrary")) == NULL)
- return false;
+ return false;
bpdpath[strlen(bpdpath)-1] = 0;
if (strcmp(bpdpath,PM_getNucleusPath()) == 0)
- strcpy(bpdpath,PM_getNucleusConfigPath());
+ strcpy(bpdpath,PM_getNucleusConfigPath());
else {
- PM_backslash(bpdpath);
- strcat(bpdpath,"config");
- }
+ PM_backslash(bpdpath);
+ strcat(bpdpath,"config");
+ }
if ((gaExp = GA_initLibrary(shared,bpdpath,filename,GA_getSystemPMImports(),&_N_imports,&_GA_imports)) == NULL)
- PM_fatalError("GA_initLibrary failed!\n");
+ PM_fatalError("GA_initLibrary failed!\n");
/* Initialize all default imports to point to fatal error handler
* for upwards compatibility, and copy the exported functions.
*/
max = sizeof(__GA_exports)/sizeof(GA_initLibrary_t);
for (i = 0,p = (ulong*)&__GA_exports; i < max; i++)
- *p++ = (ulong)_GA_fatalErrorHandler;
+ *p++ = (ulong)_GA_fatalErrorHandler;
memcpy(&__GA_exports,gaExp,MIN(sizeof(__GA_exports),gaExp->dwSize));
loaded = true;
return true;
@@ -157,7 +157,7 @@ static ibool LoadDriver(
int NAPI GA_status(void)
{
if (!loaded)
- return nDriverNotFound;
+ return nDriverNotFound;
return __GA_exports.GA_status();
}
@@ -166,7 +166,7 @@ const char * NAPI GA_errorMsg(
N_int32 status)
{
if (!loaded)
- return "Unable to load Nucleus device driver!";
+ return "Unable to load Nucleus device driver!";
return __GA_exports.GA_errorMsg(status);
}
@@ -174,7 +174,7 @@ const char * NAPI GA_errorMsg(
int NAPI GA_getDaysLeft(N_int32 shared)
{
if (!LoadDriver(shared))
- return -1;
+ return -1;
return __GA_exports.GA_getDaysLeft(shared);
}
@@ -182,7 +182,7 @@ int NAPI GA_getDaysLeft(N_int32 shared)
int NAPI GA_registerLicense(uchar *license,N_int32 shared)
{
if (!LoadDriver(shared))
- return 0;
+ return 0;
return __GA_exports.GA_registerLicense(license,shared);
}
@@ -190,7 +190,7 @@ int NAPI GA_registerLicense(uchar *license,N_int32 shared)
ibool NAPI GA_loadInGUI(N_int32 shared)
{
if (!LoadDriver(shared))
- return false;
+ return false;
return __GA_exports.GA_loadInGUI(shared);
}
@@ -198,7 +198,7 @@ ibool NAPI GA_loadInGUI(N_int32 shared)
int NAPI GA_enumerateDevices(N_int32 shared)
{
if (!LoadDriver(shared))
- return 0;
+ return 0;
return __GA_exports.GA_enumerateDevices(shared);
}
@@ -206,7 +206,7 @@ int NAPI GA_enumerateDevices(N_int32 shared)
GA_devCtx * NAPI GA_loadDriver(N_int32 deviceIndex,N_int32 shared)
{
if (!LoadDriver(shared))
- return NULL;
+ return NULL;
return __GA_exports.GA_loadDriver(deviceIndex,shared);
}
@@ -216,7 +216,7 @@ void NAPI GA_getGlobalOptions(
ibool shared)
{
if (LoadDriver(shared))
- __GA_exports.GA_getGlobalOptions(options,shared);
+ __GA_exports.GA_getGlobalOptions(options,shared);
}
/* {secret} */
@@ -226,7 +226,7 @@ PE_MODULE * NAPI GA_loadLibrary(
ibool shared)
{
if (!LoadDriver(shared))
- return NULL;
+ return NULL;
return __GA_exports.GA_loadLibrary(szBPDName,size,shared);
}
@@ -236,7 +236,7 @@ GA_devCtx * NAPI GA_getCurrentDriver(
{
/* Bail for older drivers that didn't export this function! */
if (!__GA_exports.GA_getCurrentDriver)
- return NULL;
+ return NULL;
return __GA_exports.GA_getCurrentDriver(deviceIndex);
}
@@ -246,7 +246,7 @@ REF2D_driver * NAPI GA_getCurrentRef2d(
{
/* Bail for older drivers that didn't export this function! */
if (!__GA_exports.GA_getCurrentRef2d)
- return NULL;
+ return NULL;
return __GA_exports.GA_getCurrentRef2d(deviceIndex);
}
@@ -254,7 +254,7 @@ REF2D_driver * NAPI GA_getCurrentRef2d(
int NAPI GA_isOEMVersion(ibool shared)
{
if (!LoadDriver(shared))
- return 0;
+ return 0;
return __GA_exports.GA_isOEMVersion(shared);
}
@@ -262,8 +262,7 @@ int NAPI GA_isOEMVersion(ibool shared)
N_uint32 * NAPI GA_getLicensedDevices(ibool shared)
{
if (!LoadDriver(shared))
- return 0;
+ return 0;
return __GA_exports.GA_getLicensedDevices(shared);
}
#endif
-
diff --git a/board/MAI/bios_emulator/scitech/src/common/galinux.c b/board/MAI/bios_emulator/scitech/src/common/galinux.c
index cbd9d7f4e5..47e4e8581d 100644
--- a/board/MAI/bios_emulator/scitech/src/common/galinux.c
+++ b/board/MAI/bios_emulator/scitech/src/common/galinux.c
@@ -72,10 +72,10 @@ library is used with the application local version of Nucleus.
****************************************************************************/
PM_imports * NAPI GA_getSystemPMImports(void)
{
- // TODO: We may very well want to provide a system shared library
- // that eports the PM functions required by the Nucleus library
- // for Linux here. That will eliminate fatal errors loading new
- // drivers on Linux!
+ /* TODO: We may very well want to provide a system shared library */
+ /* that eports the PM functions required by the Nucleus library */
+ /* for Linux here. That will eliminate fatal errors loading new */
+ /* drivers on Linux! */
return &_PM_imports;
}
@@ -126,7 +126,7 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0)
- haveRDTSC = true;
+ haveRDTSC = true;
return true;
}
@@ -138,11 +138,11 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
else {
- struct timeval t;
- gettimeofday(&t, NULL);
- value->low = t.tv_sec*1000000 + t.tv_usec;
- value->high = 0;
- }
+ struct timeval t;
+ gettimeofday(&t, NULL);
+ value->low = t.tv_sec*1000000 + t.tv_usec;
+ value->high = 0;
+ }
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/gantdrv.c b/board/MAI/bios_emulator/scitech/src/common/gantdrv.c
index d9944c56ae..050f73767c 100644
--- a/board/MAI/bios_emulator/scitech/src/common/gantdrv.c
+++ b/board/MAI/bios_emulator/scitech/src/common/gantdrv.c
@@ -117,8 +117,8 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0) {
- haveRDTSC = true;
- }
+ haveRDTSC = true;
+ }
return true;
}
@@ -130,8 +130,7 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
else
- KeQuerySystemTime((LARGE_INTEGER*)value);
+ KeQuerySystemTime((LARGE_INTEGER*)value);
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/common/gaos2.c b/board/MAI/bios_emulator/scitech/src/common/gaos2.c
index 822e93ca61..26e6503e5f 100644
--- a/board/MAI/bios_emulator/scitech/src/common/gaos2.c
+++ b/board/MAI/bios_emulator/scitech/src/common/gaos2.c
@@ -83,11 +83,11 @@ static ulong CallSDDHelp(
* can't fail here.
*/
DosOpen(PMHELP_NAME,&hSDDHelp,&result[0],0,0,
- FILE_OPEN, OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,
- NULL);
+ FILE_OPEN, OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,
+ NULL);
DosDevIOCtl(hSDDHelp,PMHELP_IOCTL,func,
- &parms, inLen = sizeof(parms), &inLen,
- &result, outLen = sizeof(result), &outLen);
+ &parms, inLen = sizeof(parms), &inLen,
+ &result, outLen = sizeof(result), &outLen);
DosClose(hSDDHelp);
return result[0];
}
@@ -147,17 +147,17 @@ ibool NAPI GA_getSharedExports(
/* Initialise the PM library and connect to our runtime DLL's */
PM_init();
if (CallSDDHelp(PMHELP_GETSHAREDEXP) != 0) {
- /* We have found the shared Nucleus exports. Because not all processes
- * map to SDDPMI.DLL, we need to ensure that we connect to this
- * DLL so that it gets mapped into our address space (that is
- * where the shared Nucleus loader code is located). Simply doing a
- * DosLoadModule on it is enough for this.
- */
- DosLoadModule((PSZ)buf,sizeof(buf),(PSZ)"SDDPMI.DLL",&hModSDDPMI);
- exp = (GA_exports*)result[0];
- memcpy(gaExp,exp,MIN(gaExp->dwSize,exp->dwSize));
- return true;
- }
+ /* We have found the shared Nucleus exports. Because not all processes
+ * map to SDDPMI.DLL, we need to ensure that we connect to this
+ * DLL so that it gets mapped into our address space (that is
+ * where the shared Nucleus loader code is located). Simply doing a
+ * DosLoadModule on it is enough for this.
+ */
+ DosLoadModule((PSZ)buf,sizeof(buf),(PSZ)"SDDPMI.DLL",&hModSDDPMI);
+ exp = (GA_exports*)result[0];
+ memcpy(gaExp,exp,MIN(gaExp->dwSize,exp->dwSize));
+ return true;
+ }
#endif
(void)shared;
return false;
@@ -197,7 +197,7 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0)
- haveRDTSC = true;
+ haveRDTSC = true;
return true;
}
@@ -209,9 +209,9 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
else
- DosTmrQueryTime((QWORD*)value);
+ DosTmrQueryTime((QWORD*)value);
}
/****************************************************************************
diff --git a/board/MAI/bios_emulator/scitech/src/common/gaqnx.c b/board/MAI/bios_emulator/scitech/src/common/gaqnx.c
index 0846cccef0..525d662869 100644
--- a/board/MAI/bios_emulator/scitech/src/common/gaqnx.c
+++ b/board/MAI/bios_emulator/scitech/src/common/gaqnx.c
@@ -72,10 +72,10 @@ library is used with the application local version of Nucleus.
****************************************************************************/
PM_imports * NAPI GA_getSystemPMImports(void)
{
- // TODO: We may very well want to provide a system shared library
- // that eports the PM functions required by the Nucleus library
- // for QNX here. That will eliminate fatal errors loading new
- // drivers on QNX!
+ /* TODO: We may very well want to provide a system shared library */
+ /* that eports the PM functions required by the Nucleus library */
+ /* for QNX here. That will eliminate fatal errors loading new */
+ /* drivers on QNX! */
return &_PM_imports;
}
@@ -126,7 +126,7 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0)
- haveRDTSC = true;
+ haveRDTSC = true;
return true;
}
@@ -138,12 +138,12 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
else {
- struct timespec ts;
+ struct timespec ts;
- clock_gettime(CLOCK_REALTIME, &ts);
- value->low = (ts.tv_nsec / 1000 + ts.tv_sec * 1000000);
- value->high = 0;
- }
+ clock_gettime(CLOCK_REALTIME, &ts);
+ value->low = (ts.tv_nsec / 1000 + ts.tv_sec * 1000000);
+ value->high = 0;
+ }
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/gartt.c b/board/MAI/bios_emulator/scitech/src/common/gartt.c
index 003e1e7dbe..3a41f59c18 100644
--- a/board/MAI/bios_emulator/scitech/src/common/gartt.c
+++ b/board/MAI/bios_emulator/scitech/src/common/gartt.c
@@ -121,9 +121,9 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0) {
- haveRDTSC = true;
- return true;
- }
+ haveRDTSC = true;
+ return true;
+ }
return false;
}
@@ -135,5 +135,5 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/gasmx.c b/board/MAI/bios_emulator/scitech/src/common/gasmx.c
index 62e68dc13e..ae31941f49 100644
--- a/board/MAI/bios_emulator/scitech/src/common/gasmx.c
+++ b/board/MAI/bios_emulator/scitech/src/common/gasmx.c
@@ -118,7 +118,7 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0)
- return true;
+ return true;
return false;
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/gavxd.c b/board/MAI/bios_emulator/scitech/src/common/gavxd.c
index 62173cc8d0..fc8ba8d657 100644
--- a/board/MAI/bios_emulator/scitech/src/common/gavxd.c
+++ b/board/MAI/bios_emulator/scitech/src/common/gavxd.c
@@ -117,8 +117,8 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0) {
- haveRDTSC = true;
- }
+ haveRDTSC = true;
+ }
return true;
}
@@ -130,8 +130,7 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
else
- VTD_Get_Real_Time(&value->high,&value->low);
+ VTD_Get_Real_Time(&value->high,&value->low);
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/common/gawin32.c b/board/MAI/bios_emulator/scitech/src/common/gawin32.c
index a2a4150953..69443344f4 100644
--- a/board/MAI/bios_emulator/scitech/src/common/gawin32.c
+++ b/board/MAI/bios_emulator/scitech/src/common/gawin32.c
@@ -67,16 +67,16 @@ static ibool LoadSharedDLL(void)
/* Check if we have already loaded the DLL */
if (hModDLL)
- return true;
+ return true;
PM_init();
/* Open the DLL file */
if (!PM_findBPD(DLL_NAME,bpdpath))
- return false;
+ return false;
strcpy(filename,bpdpath);
strcat(filename,DLL_NAME);
if ((hModDLL = LoadLibrary(filename)) == NULL)
- return false;
+ return false;
return true;
}
@@ -103,10 +103,10 @@ void NAPI GA_setLocalPath(
PM_setLocalBPDPath(path);
if (_PM_hDevice != INVALID_HANDLE_VALUE) {
- inBuf[0] = (DWORD)path;
- DeviceIoControl(_PM_hDevice, PMHELP_GASETLOCALPATH32,
- inBuf, sizeof(inBuf), outBuf, sizeof(outBuf), &outCnt, NULL);
- }
+ inBuf[0] = (DWORD)path;
+ DeviceIoControl(_PM_hDevice, PMHELP_GASETLOCALPATH32,
+ inBuf, sizeof(inBuf), outBuf, sizeof(outBuf), &outCnt, NULL);
+ }
}
/****************************************************************************
@@ -126,18 +126,18 @@ PM_imports * NAPI GA_getSystemPMImports(void)
PM_imports * (NAPIP _GA_getSystemPMImports)(void);
if (LoadSharedDLL()) {
- /* Note that Visual C++ build DLL's with only a single underscore in front
- * of the exported name while Watcom C provides two of them. We check for
- * both to allow working with either compiled DLL.
- */
- if ((_GA_getSystemPMImports = (void*)GetProcAddress(hModDLL,"_GA_getSystemPMImports")) != NULL) {
- if ((_GA_getSystemPMImports = (void*)GetProcAddress(hModDLL,"__GA_getSystemPMImports")) != NULL) {
- pmImp = _GA_getSystemPMImports();
- memcpy(&_PM_imports,pmImp,MIN(_PM_imports.dwSize,pmImp->dwSize));
- return pmImp;
- }
- }
- }
+ /* Note that Visual C++ build DLL's with only a single underscore in front
+ * of the exported name while Watcom C provides two of them. We check for
+ * both to allow working with either compiled DLL.
+ */
+ if ((_GA_getSystemPMImports = (void*)GetProcAddress(hModDLL,"_GA_getSystemPMImports")) != NULL) {
+ if ((_GA_getSystemPMImports = (void*)GetProcAddress(hModDLL,"__GA_getSystemPMImports")) != NULL) {
+ pmImp = _GA_getSystemPMImports();
+ memcpy(&_PM_imports,pmImp,MIN(_PM_imports.dwSize,pmImp->dwSize));
+ return pmImp;
+ }
+ }
+ }
return &_PM_imports;
}
@@ -162,16 +162,16 @@ ibool NAPI GA_getSharedExports(
useRing0Driver = false;
if (shared) {
- if (!LoadSharedDLL())
- PM_fatalError("Unable to load " DLL_NAME "!");
- if ((_GA_getSystemGAExports = (void*)GetProcAddress(hModDLL,"_GA_getSystemGAExports")) == NULL)
- if ((_GA_getSystemGAExports = (void*)GetProcAddress(hModDLL,"__GA_getSystemGAExports")) == NULL)
- PM_fatalError("Unable to load " DLL_NAME "!");
- exp = _GA_getSystemGAExports();
- memcpy(gaExp,exp,MIN(gaExp->dwSize,exp->dwSize));
- useRing0Driver = true;
- return true;
- }
+ if (!LoadSharedDLL())
+ PM_fatalError("Unable to load " DLL_NAME "!");
+ if ((_GA_getSystemGAExports = (void*)GetProcAddress(hModDLL,"_GA_getSystemGAExports")) == NULL)
+ if ((_GA_getSystemGAExports = (void*)GetProcAddress(hModDLL,"__GA_getSystemGAExports")) == NULL)
+ PM_fatalError("Unable to load " DLL_NAME "!");
+ exp = _GA_getSystemGAExports();
+ memcpy(gaExp,exp,MIN(gaExp->dwSize,exp->dwSize));
+ useRing0Driver = true;
+ return true;
+ }
return false;
}
@@ -188,14 +188,14 @@ ibool NAPI GA_queryFunctions(
static ibool (NAPIP _GA_queryFunctions)(GA_devCtx *dc,N_uint32 id,void _FAR_ *funcs) = NULL;
if (useRing0Driver) {
- // Call the version in nga_w32.dll if it is loaded
- if (!_GA_queryFunctions) {
- if ((_GA_queryFunctions = (void*)GetProcAddress(hModDLL,"_GA_queryFunctions")) == NULL)
- if ((_GA_queryFunctions = (void*)GetProcAddress(hModDLL,"__GA_queryFunctions")) == NULL)
- PM_fatalError("Unable to get exports from " DLL_NAME "!");
- }
- return _GA_queryFunctions(dc,id,funcs);
- }
+ /* Call the version in nga_w32.dll if it is loaded */
+ if (!_GA_queryFunctions) {
+ if ((_GA_queryFunctions = (void*)GetProcAddress(hModDLL,"_GA_queryFunctions")) == NULL)
+ if ((_GA_queryFunctions = (void*)GetProcAddress(hModDLL,"__GA_queryFunctions")) == NULL)
+ PM_fatalError("Unable to get exports from " DLL_NAME "!");
+ }
+ return _GA_queryFunctions(dc,id,funcs);
+ }
return __GA_exports.GA_queryFunctions(dc,id,funcs);
}
@@ -211,14 +211,14 @@ ibool NAPI REF2D_queryFunctions(
static ibool (NAPIP _REF2D_queryFunctions)(REF2D_driver *ref2d,N_uint32 id,void _FAR_ *funcs) = NULL;
if (useRing0Driver) {
- // Call the version in nga_w32.dll if it is loaded
- if (!_REF2D_queryFunctions) {
- if ((_REF2D_queryFunctions = (void*)GetProcAddress(hModDLL,"_REF2D_queryFunctions")) == NULL)
- if ((_REF2D_queryFunctions = (void*)GetProcAddress(hModDLL,"__REF2D_queryFunctions")) == NULL)
- PM_fatalError("Unable to get exports from " DLL_NAME "!");
- }
- return _REF2D_queryFunctions(ref2d,id,funcs);
- }
+ /* Call the version in nga_w32.dll if it is loaded */
+ if (!_REF2D_queryFunctions) {
+ if ((_REF2D_queryFunctions = (void*)GetProcAddress(hModDLL,"_REF2D_queryFunctions")) == NULL)
+ if ((_REF2D_queryFunctions = (void*)GetProcAddress(hModDLL,"__REF2D_queryFunctions")) == NULL)
+ PM_fatalError("Unable to get exports from " DLL_NAME "!");
+ }
+ return _REF2D_queryFunctions(ref2d,id,funcs);
+ }
return __GA_exports.REF2D_queryFunctions(ref2d,id,funcs);
}
#endif
@@ -231,13 +231,13 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0) {
- haveRDTSC = true;
- return true;
- }
+ haveRDTSC = true;
+ return true;
+ }
else if (QueryPerformanceFrequency((LARGE_INTEGER*)&countFreq)) {
- haveRDTSC = false;
- return true;
- }
+ haveRDTSC = false;
+ return true;
+ }
return false;
}
@@ -249,8 +249,7 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
else
- QueryPerformanceCounter((LARGE_INTEGER*)value);
+ QueryPerformanceCounter((LARGE_INTEGER*)value);
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/common/gtfcalc.c b/board/MAI/bios_emulator/scitech/src/common/gtfcalc.c
index 5a03ac5885..1d547e9abb 100644
--- a/board/MAI/bios_emulator/scitech/src/common/gtfcalc.c
+++ b/board/MAI/bios_emulator/scitech/src/common/gtfcalc.c
@@ -107,9 +107,9 @@ static void GetInternalConstants(GTF_constants *c)
c->hSync = GC.hSync;
c->minVSyncBP = GC.minVSyncBP;
if (GC.k == 0)
- c->k = 0.001;
+ c->k = 0.001;
else
- c->k = GC.k;
+ c->k = GC.k;
c->m = (c->k / 256) * GC.m;
c->c = (GC.c - GC.j) * (c->k / 256) + GC.j;
c->j = GC.j;
@@ -165,89 +165,89 @@ void GTF_calcTimings(double hPixels,double vLines,double freq,
vFieldRate = vFreq;
interlace = 0;
if (wantInterlace)
- dotClock *= 2;
+ dotClock *= 2;
/* Determine the lines for margins */
if (wantMargins) {
- topMarginLines = round(c.margin / 100 * vLines);
- botMarginLines = round(c.margin / 100 * vLines);
- }
+ topMarginLines = round(c.margin / 100 * vLines);
+ botMarginLines = round(c.margin / 100 * vLines);
+ }
else {
- topMarginLines = 0;
- botMarginLines = 0;
- }
+ topMarginLines = 0;
+ botMarginLines = 0;
+ }
if (type != GTF_lockPF) {
- if (type == GTF_lockVF) {
- /* Estimate the horizontal period */
- hPeriodEst = ((1/vFieldRate) - (c.minVSyncBP/1000000)) /
- (vLines + (2*topMarginLines) + c.minPorch + interlace) * 1000000;
-
- /* Find the number of lines in vSync + back porch */
- vSyncBP = round(c.minVSyncBP / hPeriodEst);
- }
- else if (type == GTF_lockHF) {
- /* Find the number of lines in vSync + back porch */
- vSyncBP = round((c.minVSyncBP * hFreq) / 1000);
- }
-
- /* Find the number of lines in the V back porch alone */
- vBackPorch = vSyncBP - c.vSyncRqd;
-
- /* Find the total number of lines in the vertical period */
- vTotalLines = vLines + topMarginLines + botMarginLines + vSyncBP
- + interlace + c.minPorch;
-
- if (type == GTF_lockVF) {
- /* Estimate the vertical frequency */
- vFieldRateEst = 1000000 / (hPeriodEst * vTotalLines);
-
- /* Find the actual horizontal period */
- hPeriod = (hPeriodEst * vFieldRateEst) / vFieldRate;
-
- /* Find the actual vertical field frequency */
- vFieldRate = 1000000 / (hPeriod * vTotalLines);
- }
- else if (type == GTF_lockHF) {
- /* Find the actual vertical field frequency */
- vFieldRate = (hFreq / vTotalLines) * 1000;
- }
- }
+ if (type == GTF_lockVF) {
+ /* Estimate the horizontal period */
+ hPeriodEst = ((1/vFieldRate) - (c.minVSyncBP/1000000)) /
+ (vLines + (2*topMarginLines) + c.minPorch + interlace) * 1000000;
+
+ /* Find the number of lines in vSync + back porch */
+ vSyncBP = round(c.minVSyncBP / hPeriodEst);
+ }
+ else if (type == GTF_lockHF) {
+ /* Find the number of lines in vSync + back porch */
+ vSyncBP = round((c.minVSyncBP * hFreq) / 1000);
+ }
+
+ /* Find the number of lines in the V back porch alone */
+ vBackPorch = vSyncBP - c.vSyncRqd;
+
+ /* Find the total number of lines in the vertical period */
+ vTotalLines = vLines + topMarginLines + botMarginLines + vSyncBP
+ + interlace + c.minPorch;
+
+ if (type == GTF_lockVF) {
+ /* Estimate the vertical frequency */
+ vFieldRateEst = 1000000 / (hPeriodEst * vTotalLines);
+
+ /* Find the actual horizontal period */
+ hPeriod = (hPeriodEst * vFieldRateEst) / vFieldRate;
+
+ /* Find the actual vertical field frequency */
+ vFieldRate = 1000000 / (hPeriod * vTotalLines);
+ }
+ else if (type == GTF_lockHF) {
+ /* Find the actual vertical field frequency */
+ vFieldRate = (hFreq / vTotalLines) * 1000;
+ }
+ }
/* Find the number of pixels in the left and right margins */
if (wantMargins) {
- leftMarginPixels = round(hPixels * c.margin) / (100 * c.cellGran);
- rightMarginPixels = round(hPixels * c.margin) / (100 * c.cellGran);
- }
+ leftMarginPixels = round(hPixels * c.margin) / (100 * c.cellGran);
+ rightMarginPixels = round(hPixels * c.margin) / (100 * c.cellGran);
+ }
else {
- leftMarginPixels = 0;
- rightMarginPixels = 0;
- }
+ leftMarginPixels = 0;
+ rightMarginPixels = 0;
+ }
/* Find the total number of active pixels in image + margins */
hTotalActivePixels = hPixels + leftMarginPixels + rightMarginPixels;
if (type == GTF_lockVF) {
- /* Find the ideal blanking duty cycle */
- idealDutyCycle = c.c - ((c.m * hPeriod) / 1000);
- }
+ /* Find the ideal blanking duty cycle */
+ idealDutyCycle = c.c - ((c.m * hPeriod) / 1000);
+ }
else if (type == GTF_lockHF) {
- /* Find the ideal blanking duty cycle */
- idealDutyCycle = c.c - (c.m / hFreq);
- }
+ /* Find the ideal blanking duty cycle */
+ idealDutyCycle = c.c - (c.m / hFreq);
+ }
else if (type == GTF_lockPF) {
- /* Find ideal horizontal period from blanking duty cycle formula */
- idealHPeriod = (((c.c - 100) + (sqrt((pow(100-c.c,2)) +
- (0.4 * c.m * (hTotalActivePixels + rightMarginPixels +
- leftMarginPixels) / dotClock)))) / (2 * c.m)) * 1000;
+ /* Find ideal horizontal period from blanking duty cycle formula */
+ idealHPeriod = (((c.c - 100) + (sqrt((pow(100-c.c,2)) +
+ (0.4 * c.m * (hTotalActivePixels + rightMarginPixels +
+ leftMarginPixels) / dotClock)))) / (2 * c.m)) * 1000;
- /* Find the ideal blanking duty cycle */
- idealDutyCycle = c.c - ((c.m * idealHPeriod) / 1000);
- }
+ /* Find the ideal blanking duty cycle */
+ idealDutyCycle = c.c - ((c.m * idealHPeriod) / 1000);
+ }
/* Find the number of pixels in blanking time */
hBlankPixels = round((hTotalActivePixels * idealDutyCycle) /
- ((100 - idealDutyCycle) * c.cellGran)) * c.cellGran;
+ ((100 - idealDutyCycle) * c.cellGran)) * c.cellGran;
/* Find the total number of pixels */
hTotalPixels = hTotalActivePixels + hBlankPixels;
@@ -262,35 +262,35 @@ void GTF_calcTimings(double hPixels,double vLines,double freq,
hSyncBP = hBackPorch + hSyncWidth;
if (type == GTF_lockPF) {
- /* Find the horizontal frequency */
- hFreq = (dotClock / hTotalPixels) * 1000;
+ /* Find the horizontal frequency */
+ hFreq = (dotClock / hTotalPixels) * 1000;
- /* Find the number of lines in vSync + back porch */
- vSyncBP = round((c.minVSyncBP * hFreq) / 1000);
+ /* Find the number of lines in vSync + back porch */
+ vSyncBP = round((c.minVSyncBP * hFreq) / 1000);
- /* Find the number of lines in the V back porch alone */
- vBackPorch = vSyncBP - c.vSyncRqd;
+ /* Find the number of lines in the V back porch alone */
+ vBackPorch = vSyncBP - c.vSyncRqd;
- /* Find the total number of lines in the vertical period */
- vTotalLines = vLines + topMarginLines + botMarginLines + vSyncBP
- + interlace + c.minPorch;
+ /* Find the total number of lines in the vertical period */
+ vTotalLines = vLines + topMarginLines + botMarginLines + vSyncBP
+ + interlace + c.minPorch;
- /* Find the actual vertical field frequency */
- vFieldRate = (hFreq / vTotalLines) * 1000;
- }
+ /* Find the actual vertical field frequency */
+ vFieldRate = (hFreq / vTotalLines) * 1000;
+ }
else {
- if (type == GTF_lockVF) {
- /* Find the horizontal frequency */
- hFreq = 1000 / hPeriod;
- }
- else if (type == GTF_lockHF) {
- /* Find the horizontal frequency */
- hPeriod = 1000 / hFreq;
- }
-
- /* Find the pixel clock frequency */
- dotClock = hTotalPixels / hPeriod;
- }
+ if (type == GTF_lockVF) {
+ /* Find the horizontal frequency */
+ hFreq = 1000 / hPeriod;
+ }
+ else if (type == GTF_lockHF) {
+ /* Find the horizontal frequency */
+ hPeriod = 1000 / hFreq;
+ }
+
+ /* Find the pixel clock frequency */
+ dotClock = hTotalPixels / hPeriod;
+ }
/* Return the computed frequencies */
t->vFreq = vFieldRate;
@@ -315,16 +315,16 @@ void GTF_calcTimings(double hPixels,double vLines,double freq,
t->v.vSyncWidth = (int)c.vSyncRqd;
t->v.vBackPorch = (int)vBackPorch;
if (wantInterlace) {
- /* Halve the timings for interlaced modes */
- t->v.vTotal /= 2;
- t->v.vDisp /= 2;
- t->v.vSyncStart /= 2;
- t->v.vSyncEnd /= 2;
- t->v.vFrontPorch /= 2;
- t->v.vSyncWidth /= 2;
- t->v.vBackPorch /= 2;
- t->dotClock /= 2;
- }
+ /* Halve the timings for interlaced modes */
+ t->v.vTotal /= 2;
+ t->v.vDisp /= 2;
+ t->v.vSyncStart /= 2;
+ t->v.vSyncEnd /= 2;
+ t->v.vFrontPorch /= 2;
+ t->v.vSyncWidth /= 2;
+ t->v.vBackPorch /= 2;
+ t->dotClock /= 2;
+ }
/* Mark as GTF timing using the sync polarities */
t->interlace = (wantInterlace) ? 'I' : 'N';
@@ -348,30 +348,30 @@ void main(int argc,char *argv[])
GTF_timings t;
if (argc != 5 && argc != 6) {
- printf("Usage: GTFCALC <xPixels> <yPixels> <freq> [[Hz] [KHz] [MHz]] [I]\n");
- printf("\n");
- printf("where <xPixels> is the horizontal resolution of the mode, <yPixels> is the\n");
- printf("vertical resolution of the mode. The <freq> value will be the frequency to\n");
- printf("drive the calculations, and will be either the vertical frequency (in Hz)\n");
- printf("the horizontal frequency (in KHz) or the dot clock (in MHz). To generate\n");
- printf("timings for an interlaced mode, add 'I' to the end of the command line.\n");
- printf("\n");
- printf("For example to generate timings for 640x480 at 60Hz vertical:\n");
- printf("\n");
- printf(" GTFCALC 640 480 60 Hz\n");
- printf("\n");
- printf("For example to generate timings for 640x480 at 31.5KHz horizontal:\n");
- printf("\n");
- printf(" GTFCALC 640 480 31.5 KHz\n");
- printf("\n");
- printf("For example to generate timings for 640x480 with a 25.175Mhz dot clock:\n");
- printf("\n");
- printf(" GTFCALC 640 480 25.175 MHz\n");
- printf("\n");
- printf("GTFCALC will print a summary of the results found, and dump the CRTC\n");
- printf("values to the UVCONFIG.CRT file in the format used by SciTech Display Doctor.\n");
- exit(1);
- }
+ printf("Usage: GTFCALC <xPixels> <yPixels> <freq> [[Hz] [KHz] [MHz]] [I]\n");
+ printf("\n");
+ printf("where <xPixels> is the horizontal resolution of the mode, <yPixels> is the\n");
+ printf("vertical resolution of the mode. The <freq> value will be the frequency to\n");
+ printf("drive the calculations, and will be either the vertical frequency (in Hz)\n");
+ printf("the horizontal frequency (in KHz) or the dot clock (in MHz). To generate\n");
+ printf("timings for an interlaced mode, add 'I' to the end of the command line.\n");
+ printf("\n");
+ printf("For example to generate timings for 640x480 at 60Hz vertical:\n");
+ printf("\n");
+ printf(" GTFCALC 640 480 60 Hz\n");
+ printf("\n");
+ printf("For example to generate timings for 640x480 at 31.5KHz horizontal:\n");
+ printf("\n");
+ printf(" GTFCALC 640 480 31.5 KHz\n");
+ printf("\n");
+ printf("For example to generate timings for 640x480 with a 25.175Mhz dot clock:\n");
+ printf("\n");
+ printf(" GTFCALC 640 480 25.175 MHz\n");
+ printf("\n");
+ printf("GTFCALC will print a summary of the results found, and dump the CRTC\n");
+ printf("values to the UVCONFIG.CRT file in the format used by SciTech Display Doctor.\n");
+ exit(1);
+ }
/* Get values from command line */
xPixels = atof(argv[1]);
@@ -381,33 +381,33 @@ void main(int argc,char *argv[])
/* Compute the CRTC timings */
if (toupper(argv[4][0]) == 'H')
- GTF_calcTimings(xPixels,yPixels,freq,GTF_lockVF,false,interlace,&t);
+ GTF_calcTimings(xPixels,yPixels,freq,GTF_lockVF,false,interlace,&t);
else if (toupper(argv[4][0]) == 'K')
- GTF_calcTimings(xPixels,yPixels,freq,GTF_lockHF,false,interlace,&t);
+ GTF_calcTimings(xPixels,yPixels,freq,GTF_lockHF,false,interlace,&t);
else if (toupper(argv[4][0]) == 'M')
- GTF_calcTimings(xPixels,yPixels,freq,GTF_lockPF,false,interlace,&t);
+ GTF_calcTimings(xPixels,yPixels,freq,GTF_lockPF,false,interlace,&t);
else {
- printf("Unknown command line!\n");
- exit(1);
- }
+ printf("Unknown command line!\n");
+ exit(1);
+ }
/* Dump summary info to standard output */
printf("CRTC values for %.0fx%.0f @ %.2f %s\n", xPixels, yPixels, freq, argv[4]);
printf("\n");
printf(" hTotal = %-4d vTotal = %-4d\n",
- t.h.hTotal, t.v.vTotal);
+ t.h.hTotal, t.v.vTotal);
printf(" hDisp = %-4d vDisp = %-4d\n",
- t.h.hDisp, t.v.vDisp);
+ t.h.hDisp, t.v.vDisp);
printf(" hSyncStart = %-4d vSyncStart = %-4d\n",
- t.h.hSyncStart, t.v.vSyncStart);
+ t.h.hSyncStart, t.v.vSyncStart);
printf(" hSyncEnd = %-4d vSyncEnd = %-4d\n",
- t.h.hSyncEnd, t.v.vSyncEnd);
+ t.h.hSyncEnd, t.v.vSyncEnd);
printf(" hFrontPorch = %-4d vFrontPorch = %-4d\n",
- t.h.hFrontPorch, t.v.vFrontPorch);
+ t.h.hFrontPorch, t.v.vFrontPorch);
printf(" hSyncWidth = %-4d vSyncWidth = %-4d\n",
- t.h.hSyncWidth, t.v.vSyncWidth);
+ t.h.hSyncWidth, t.v.vSyncWidth);
printf(" hBackPorch = %-4d vBackPorch = %-4d\n",
- t.h.hBackPorch, t.v.vBackPorch);
+ t.h.hBackPorch, t.v.vBackPorch);
printf("\n");
printf(" Interlaced = %s\n", (t.interlace == 'I') ? "Yes" : "No");
printf(" H sync pol = %c\n", t.hSyncPol);
@@ -419,18 +419,18 @@ void main(int argc,char *argv[])
/* Dump to file in format used by SciTech Display Doctor */
if ((f = fopen("UVCONFIG.CRT","w")) != NULL) {
- fprintf(f, "[%.0f %.0f]\n", xPixels, yPixels);
- fprintf(f, "%d %d %d %d '%c' %s\n",
- t.h.hTotal, t.h.hDisp,
- t.h.hSyncStart, t.h.hSyncEnd,
- t.hSyncPol, (t.interlace == 'I') ? "I" : "NI");
- fprintf(f, "%d %d %d %d '%c'\n",
- t.v.vTotal, t.v.vDisp,
- t.v.vSyncStart, t.v.vSyncEnd,
- t.vSyncPol);
- fprintf(f, "%.2f\n", t.dotClock);
- fclose(f);
- }
+ fprintf(f, "[%.0f %.0f]\n", xPixels, yPixels);
+ fprintf(f, "%d %d %d %d '%c' %s\n",
+ t.h.hTotal, t.h.hDisp,
+ t.h.hSyncStart, t.h.hSyncEnd,
+ t.hSyncPol, (t.interlace == 'I') ? "I" : "NI");
+ fprintf(f, "%d %d %d %d '%c'\n",
+ t.v.vTotal, t.v.vDisp,
+ t.v.vSyncStart, t.v.vSyncEnd,
+ t.vSyncPol);
+ fprintf(f, "%.2f\n", t.dotClock);
+ fclose(f);
+ }
}
#endif /* TESTING */
diff --git a/board/MAI/bios_emulator/scitech/src/common/libcimp.c b/board/MAI/bios_emulator/scitech/src/common/libcimp.c
index 0eacd120bf..ab73ad578c 100644
--- a/board/MAI/bios_emulator/scitech/src/common/libcimp.c
+++ b/board/MAI/bios_emulator/scitech/src/common/libcimp.c
@@ -270,27 +270,27 @@ int _CDECL stub_open(const char *_path, int _oflag, unsigned _mode)
/* Find an empty file handle to use */
for (i = 3; i < MAX_FILES; i++) {
- if (!openHandles[i])
- break;
- }
+ if (!openHandles[i])
+ break;
+ }
if (openHandles[i])
- return -1;
+ return -1;
/* Find the open flags to use */
if (_oflag & ___O_TRUNC)
- strcpy(mode,"w");
+ strcpy(mode,"w");
else if (_oflag & ___O_CREAT)
- strcpy(mode,"a");
+ strcpy(mode,"a");
else
- strcpy(mode,"r");
+ strcpy(mode,"r");
if (_oflag & ___O_BINARY)
- strcat(mode,"b");
+ strcat(mode,"b");
if (_oflag & ___O_TEXT)
- strcat(mode,"t");
+ strcat(mode,"t");
/* Open the file and store the file handle */
if ((openHandles[i] = fopen(_path,mode)) == NULL)
- return -1;
+ return -1;
return i;
}
@@ -300,25 +300,25 @@ int _CDECL stub_access(const char *_path, int _amode)
int _CDECL stub_close(int _fildes)
{
if (_fildes >= 3 && openHandles[_fildes]) {
- fclose(openHandles[_fildes]);
- openHandles[_fildes] = NULL;
- }
+ fclose(openHandles[_fildes]);
+ openHandles[_fildes] = NULL;
+ }
return 0;
}
off_t _CDECL stub_lseek(int _fildes, off_t _offset, int _whence)
{
if (_fildes >= 3) {
- fseek(openHandles[_fildes],_offset,_whence);
- return ftell(openHandles[_fildes]);
- }
+ fseek(openHandles[_fildes],_offset,_whence);
+ return ftell(openHandles[_fildes]);
+ }
return 0;
}
size_t _CDECL stub_read(int _fildes, void *_buf, size_t _nbyte)
{
if (_fildes >= 3)
- return fread(_buf,1,_nbyte,openHandles[_fildes]);
+ return fread(_buf,1,_nbyte,openHandles[_fildes]);
return 0;
}
@@ -327,18 +327,18 @@ int _CDECL stub_unlink(const char *_path)
WORD error;
if (initComplete) {
- if (R0_DeleteFile((char*)_path,0,&error))
- return 0;
- return -1;
- }
+ if (R0_DeleteFile((char*)_path,0,&error))
+ return 0;
+ return -1;
+ }
else
- return i_remove(_path);
+ return i_remove(_path);
}
size_t _CDECL stub_write(int _fildes, const void *_buf, size_t _nbyte)
{
if (_fildes >= 3)
- return fwrite(_buf,1,_nbyte,openHandles[_fildes]);
+ return fwrite(_buf,1,_nbyte,openHandles[_fildes]);
return _nbyte;
}
@@ -356,7 +356,7 @@ void _CDECL _OS_setfileattr(const char *filename,unsigned attrib)
{
WORD error;
if (initComplete)
- R0_SetFileAttributes((char*)filename,attrib,&error);
+ R0_SetFileAttributes((char*)filename,attrib,&error);
}
/* Return the current date in days since 1/1/1980 */
@@ -380,59 +380,59 @@ int _CDECL stub_open(const char *_path, int _oflag, unsigned _mode)
/* Find an empty file handle to use */
for (i = 3; i < MAX_FILES; i++) {
- if (!openHandles[i])
- break;
- }
+ if (!openHandles[i])
+ break;
+ }
if (openHandles[i])
- return -1;
+ return -1;
/* Find the open flags to use */
if (_oflag & ___O_TRUNC)
- strcpy(mode,"w");
+ strcpy(mode,"w");
else if (_oflag & ___O_CREAT)
- strcpy(mode,"a");
+ strcpy(mode,"a");
else
- strcpy(mode,"r");
+ strcpy(mode,"r");
if (_oflag & ___O_BINARY)
- strcat(mode,"b");
+ strcat(mode,"b");
if (_oflag & ___O_TEXT)
- strcat(mode,"t");
+ strcat(mode,"t");
/* Open the file and store the file handle */
if ((openHandles[i] = fopen(_path,mode)) == NULL)
- return -1;
+ return -1;
return i;
}
int _CDECL stub_close(int _fildes)
{
if (_fildes >= 3 && openHandles[_fildes]) {
- fclose(openHandles[_fildes]);
- openHandles[_fildes] = NULL;
- }
+ fclose(openHandles[_fildes]);
+ openHandles[_fildes] = NULL;
+ }
return 0;
}
off_t _CDECL stub_lseek(int _fildes, off_t _offset, int _whence)
{
if (_fildes >= 3) {
- fseek(openHandles[_fildes],_offset,_whence);
- return ftell(openHandles[_fildes]);
- }
+ fseek(openHandles[_fildes],_offset,_whence);
+ return ftell(openHandles[_fildes]);
+ }
return 0;
}
size_t _CDECL stub_read(int _fildes, void *_buf, size_t _nbyte)
{
if (_fildes >= 3)
- return fread(_buf,1,_nbyte,openHandles[_fildes]);
+ return fread(_buf,1,_nbyte,openHandles[_fildes]);
return 0;
}
size_t _CDECL stub_write(int _fildes, const void *_buf, size_t _nbyte)
{
if (_fildes >= 3)
- return fwrite(_buf,1,_nbyte,openHandles[_fildes]);
+ return fwrite(_buf,1,_nbyte,openHandles[_fildes]);
return _nbyte;
}
@@ -444,7 +444,7 @@ int _CDECL stub_isatty(int _fildes)
int _CDECL stub_unlink(const char *_path)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
return -1;
}
@@ -454,7 +454,7 @@ int _CDECL stub_remove(const char *_filename)
int _CDECL stub_rename(const char *_old, const char *_new)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
return -1;
}
@@ -462,11 +462,11 @@ void _CDECL _OS_setfileattr(const char *filename,unsigned attrib)
{
uint _attr = 0;
if (attrib & __A_RDONLY)
- _attr |= FILE_ATTRIBUTE_READONLY;
+ _attr |= FILE_ATTRIBUTE_READONLY;
if (attrib & __A_HIDDEN)
- _attr |= FILE_ATTRIBUTE_HIDDEN;
+ _attr |= FILE_ATTRIBUTE_HIDDEN;
if (attrib & __A_SYSTEM)
- _attr |= FILE_ATTRIBUTE_SYSTEM;
+ _attr |= FILE_ATTRIBUTE_SYSTEM;
PM_setFileAttr(filename,_attr);
}
@@ -506,7 +506,7 @@ void _CDECL _OS_setfileattr(const char *filename,unsigned attrib)
{
FILESTATUS3 s;
if (DosQueryPathInfo((PSZ)filename,FIL_STANDARD,(PVOID)&s,sizeof(s)))
- return;
+ return;
s.attrFile = attrib;
DosSetPathInfo((PSZ)filename,FIL_STANDARD,(PVOID)&s,sizeof(s),0L);
}
@@ -528,25 +528,25 @@ int _CDECL stub_open(const char *_path, int _oflag, unsigned _mode)
/* Determine open flags */
if (_oflag & ___O_CREAT) {
- if (_oflag & ___O_EXCL)
- openflag = OPEN_ACTION_FAIL_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
- else if (_oflag & ___O_TRUNC)
- openflag = OPEN_ACTION_REPLACE_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
- else
- openflag = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
- }
+ if (_oflag & ___O_EXCL)
+ openflag = OPEN_ACTION_FAIL_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
+ else if (_oflag & ___O_TRUNC)
+ openflag = OPEN_ACTION_REPLACE_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
+ else
+ openflag = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
+ }
else if (_oflag & ___O_TRUNC)
- openflag = OPEN_ACTION_REPLACE_IF_EXISTS;
+ openflag = OPEN_ACTION_REPLACE_IF_EXISTS;
else
- openflag = OPEN_ACTION_OPEN_IF_EXISTS;
+ openflag = OPEN_ACTION_OPEN_IF_EXISTS;
/* Determine open mode flags */
if (_oflag & ___O_RDONLY)
- openmode = OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE;
+ openmode = OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE;
else if (_oflag & ___O_WRONLY)
- openmode = OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYWRITE;
+ openmode = OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYWRITE;
else
- openmode = OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYWRITE;
+ openmode = OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYWRITE;
/* Copy the path to a variable on the stack. We need to do this
* for OS/2 as when the drivers are loaded into shared kernel
@@ -555,14 +555,14 @@ int _CDECL stub_open(const char *_path, int _oflag, unsigned _mode)
*/
strcpy(path,_path);
if (DosOpen(path, &handle, &actiontaken, 0, FILE_NORMAL,
- openflag, openmode, NULL) != NO_ERROR)
- return -1;
+ openflag, openmode, NULL) != NO_ERROR)
+ return -1;
/* Handle append mode of operation */
if (_oflag & ___O_APPEND) {
- if (DosSetFilePtr(handle, 0, FILE_END, &error) != NO_ERROR)
- return -1;
- }
+ if (DosSetFilePtr(handle, 0, FILE_END, &error) != NO_ERROR)
+ return -1;
+ }
return handle;
}
@@ -578,16 +578,16 @@ int _CDECL stub_access(const char *_path, int _amode)
*/
strcpy(path,_path);
if (DosQueryPathInfo(path, FIL_STANDARD, &fs, sizeof(fs)) != NO_ERROR)
- return -1;
+ return -1;
if ((_amode & W_OK) && (fs.attrFile & FILE_READONLY))
- return -1;
+ return -1;
return 0;
}
int _CDECL stub_close(int _fildes)
{
if (DosClose(_fildes) != NO_ERROR)
- return -1;
+ return -1;
return 0;
}
@@ -596,17 +596,17 @@ off_t _CDECL stub_lseek(int _fildes, off_t _offset, int _whence)
ULONG cbActual, origin;
switch (_whence) {
- case SEEK_CUR:
- origin = FILE_CURRENT;
- break;
- case SEEK_END:
- origin = FILE_END;
- break;
- default:
- origin = FILE_BEGIN;
- }
+ case SEEK_CUR:
+ origin = FILE_CURRENT;
+ break;
+ case SEEK_END:
+ origin = FILE_END;
+ break;
+ default:
+ origin = FILE_BEGIN;
+ }
if (DosSetFilePtr(_fildes, _offset, origin, &cbActual) != NO_ERROR)
- return -1;
+ return -1;
return cbActual;
}
@@ -621,19 +621,19 @@ size_t _CDECL stub_read(int _fildes, void *_buf, size_t _nbyte)
* in kernel space and will cause DosRead to bail internally.
*/
while (_nbyte > BUF_SIZE) {
- if (DosRead(_fildes, file_io_buf, BUF_SIZE, &cbRead) != NO_ERROR)
- return -1;
- cbActual += cbRead;
- memcpy(p,file_io_buf,BUF_SIZE);
- p += BUF_SIZE;
- _nbyte -= BUF_SIZE;
- }
+ if (DosRead(_fildes, file_io_buf, BUF_SIZE, &cbRead) != NO_ERROR)
+ return -1;
+ cbActual += cbRead;
+ memcpy(p,file_io_buf,BUF_SIZE);
+ p += BUF_SIZE;
+ _nbyte -= BUF_SIZE;
+ }
if (_nbyte) {
- if (DosRead(_fildes, file_io_buf, _nbyte, &cbRead) != NO_ERROR)
- return -1;
- cbActual += cbRead;
- memcpy(p,file_io_buf,_nbyte);
- }
+ if (DosRead(_fildes, file_io_buf, _nbyte, &cbRead) != NO_ERROR)
+ return -1;
+ cbActual += cbRead;
+ memcpy(p,file_io_buf,_nbyte);
+ }
return cbActual;
}
@@ -648,19 +648,19 @@ size_t _CDECL stub_write(int _fildes, const void *_buf, size_t _nbyte)
* in kernel space and will cause DosWrite to bail internally.
*/
while (_nbyte > BUF_SIZE) {
- memcpy(file_io_buf,p,BUF_SIZE);
- if (DosWrite(_fildes, file_io_buf, BUF_SIZE, &cbWrite) != NO_ERROR)
- return -1;
- cbActual += cbWrite;
- p += BUF_SIZE;
- _nbyte -= BUF_SIZE;
- }
+ memcpy(file_io_buf,p,BUF_SIZE);
+ if (DosWrite(_fildes, file_io_buf, BUF_SIZE, &cbWrite) != NO_ERROR)
+ return -1;
+ cbActual += cbWrite;
+ p += BUF_SIZE;
+ _nbyte -= BUF_SIZE;
+ }
if (_nbyte) {
- memcpy(file_io_buf,p,_nbyte);
- if (DosWrite(_fildes, file_io_buf, _nbyte, &cbWrite) != NO_ERROR)
- return -1;
- cbActual += cbWrite;
- }
+ memcpy(file_io_buf,p,_nbyte);
+ if (DosWrite(_fildes, file_io_buf, _nbyte, &cbWrite) != NO_ERROR)
+ return -1;
+ cbActual += cbWrite;
+ }
return cbActual;
}
@@ -675,7 +675,7 @@ int _CDECL stub_unlink(const char *_path)
*/
strcpy(path,_path);
if (DosDelete(path) != NO_ERROR)
- return -1;
+ return -1;
return 0;
}
@@ -684,7 +684,7 @@ int _CDECL stub_isatty(int _fildes)
ULONG htype, flags;
if (DosQueryHType(_fildes, &htype, &flags) != NO_ERROR)
- return 0;
+ return 0;
return ((htype & 0xFF) == HANDTYPE_DEVICE);
}
@@ -700,7 +700,7 @@ int _CDECL stub_remove(const char *_path)
*/
strcpy(path,_path);
if (DosDelete(path) != NO_ERROR)
- return -1;
+ return -1;
return 0;
}
@@ -717,7 +717,7 @@ int _CDECL stub_rename(const char *_old, const char *_new)
strcpy(old,_old);
strcpy(new,_new);
if (DosMove(old, new) != NO_ERROR)
- return -1;
+ return -1;
return 0;
}
@@ -734,23 +734,23 @@ void _CDECL _OS_setfileattr(const char *filename,unsigned attrib)
int _CDECL stub_open(const char *_path, int _oflag, unsigned _mode)
{
int oflag_tab[] = {
- ___O_RDONLY, O_RDONLY,
- ___O_WRONLY, O_WRONLY,
- ___O_RDWR, O_RDWR,
- ___O_BINARY, O_BINARY,
- ___O_TEXT, O_TEXT,
- ___O_CREAT, O_CREAT,
- ___O_EXCL, O_EXCL,
- ___O_TRUNC, O_TRUNC,
- ___O_APPEND, O_APPEND,
- };
+ ___O_RDONLY, O_RDONLY,
+ ___O_WRONLY, O_WRONLY,
+ ___O_RDWR, O_RDWR,
+ ___O_BINARY, O_BINARY,
+ ___O_TEXT, O_TEXT,
+ ___O_CREAT, O_CREAT,
+ ___O_EXCL, O_EXCL,
+ ___O_TRUNC, O_TRUNC,
+ ___O_APPEND, O_APPEND,
+ };
int i,oflag = 0;
/* Translate the oflag's to the OS dependent versions */
for (i = 0; i < sizeof(oflag_tab) / sizeof(int); i += 2) {
- if (_oflag & oflag_tab[i])
- oflag |= oflag_tab[i+1];
- }
+ if (_oflag & oflag_tab[i])
+ oflag |= oflag_tab[i+1];
+ }
return open(_path,oflag,_mode);
}
@@ -825,4 +825,3 @@ void * _CDECL stub_signal(int sig, void *handler)
return (void*)signal(sig,(__code_ptr)handler);
#endif
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/common/peloader.c b/board/MAI/bios_emulator/scitech/src/common/peloader.c
index b9bec4aebb..a134bb012f 100644
--- a/board/MAI/bios_emulator/scitech/src/common/peloader.c
+++ b/board/MAI/bios_emulator/scitech/src/common/peloader.c
@@ -79,35 +79,35 @@ static int PE_readHeader(
result = PE_invalidDLLImage;
fseek(f, startOffset, SEEK_SET);
if (fread(&exehdr, 1, sizeof(exehdr), f) != sizeof(exehdr))
- return false;
+ return false;
if (exehdr.signature != 0x5A4D)
- return false;
+ return false;
/* Now seek to the start of the PE header defined at offset 0x3C
* in the MS-DOS EXE header, and read the signature and check it.
*/
fseek(f, startOffset+0x3C, SEEK_SET);
if (fread(&offset, 1, sizeof(offset), f) != sizeof(offset))
- return false;
+ return false;
fseek(f, startOffset+offset, SEEK_SET);
if (fread(&signature, 1, sizeof(signature), f) != sizeof(signature))
- return false;
+ return false;
if (signature != 0x00004550)
- return false;
+ return false;
/* Now read the PE file header and check that it is correct */
if (fread(filehdr, 1, sizeof(*filehdr), f) != sizeof(*filehdr))
- return false;
+ return false;
if (filehdr->Machine != IMAGE_FILE_MACHINE_I386)
- return false;
+ return false;
if (!(filehdr->Characteristics & IMAGE_FILE_32BIT_MACHINE))
- return false;
+ return false;
if (!(filehdr->Characteristics & IMAGE_FILE_DLL))
- return false;
+ return false;
if (fread(opthdr, 1, sizeof(*opthdr), f) != sizeof(*opthdr))
- return false;
+ return false;
if (opthdr->Magic != 0x10B)
- return false;
+ return false;
/* Success, so return true! */
return true;
@@ -138,15 +138,15 @@ ulong PEAPI PE_getFileSize(
/* Read the PE file headers from disk */
if (!PE_readHeader(f,startOffset,&filehdr,&opthdr))
- return 0xFFFFFFFF;
+ return 0xFFFFFFFF;
/* Scan all the section headers summing up the total size */
size = opthdr.SizeOfHeaders;
for (i = 0; i < filehdr.NumberOfSections; i++) {
- if (fread(&secthdr, 1, sizeof(secthdr), f) != sizeof(secthdr))
- return 0xFFFFFFFF;
- size += secthdr.SizeOfRawData;
- }
+ if (fread(&secthdr, 1, sizeof(secthdr), f) != sizeof(secthdr))
+ return 0xFFFFFFFF;
+ size += secthdr.SizeOfRawData;
+ }
return size;
}
@@ -199,7 +199,7 @@ PE_MODULE * PEAPI PE_loadLibraryExt(
/* Read the PE file headers from disk */
if (!PE_readHeader(f,startOffset,&filehdr,&opthdr))
- return NULL;
+ return NULL;
/* Scan all the section headers and find the necessary sections */
text_off = data_off = reloc_off = export_off = 0;
@@ -208,56 +208,56 @@ PE_MODULE * PEAPI PE_loadLibraryExt(
export_addr = export_size = export_end = 0;
reloc_size = 0;
for (i = 0; i < filehdr.NumberOfSections; i++) {
- if (fread(&secthdr, 1, sizeof(secthdr), f) != sizeof(secthdr))
- goto Error;
- if (strcmp(secthdr.Name, ".edata") == 0 || strcmp(secthdr.Name, ".rdata") == 0) {
- /* Exports section */
- export_off = secthdr.PointerToRawData;
- export_addr = secthdr.VirtualAddress;
- export_size = secthdr.SizeOfRawData;
- export_end = export_addr + export_size;
- }
- else if (strcmp(secthdr.Name, ".idata") == 0) {
- /* Imports section, ignore */
- }
- else if (strcmp(secthdr.Name, ".reloc") == 0) {
- /* Relocations section */
- reloc_off = secthdr.PointerToRawData;
- reloc_size = secthdr.SizeOfRawData;
- }
- else if (!text_off && secthdr.Characteristics & IMAGE_SCN_CNT_CODE) {
- /* Code section */
- text_off = secthdr.PointerToRawData;
- text_addr = secthdr.VirtualAddress;
- text_size = secthdr.SizeOfRawData;
- }
- else if (!data_off && secthdr.Characteristics & IMAGE_SCN_CNT_INITIALIZED_DATA) {
- /* Data section */
- data_off = secthdr.PointerToRawData;
- data_addr = secthdr.VirtualAddress;
- data_size = secthdr.SizeOfRawData;
- data_end = data_addr + data_size;
- }
- }
+ if (fread(&secthdr, 1, sizeof(secthdr), f) != sizeof(secthdr))
+ goto Error;
+ if (strcmp(secthdr.Name, ".edata") == 0 || strcmp(secthdr.Name, ".rdata") == 0) {
+ /* Exports section */
+ export_off = secthdr.PointerToRawData;
+ export_addr = secthdr.VirtualAddress;
+ export_size = secthdr.SizeOfRawData;
+ export_end = export_addr + export_size;
+ }
+ else if (strcmp(secthdr.Name, ".idata") == 0) {
+ /* Imports section, ignore */
+ }
+ else if (strcmp(secthdr.Name, ".reloc") == 0) {
+ /* Relocations section */
+ reloc_off = secthdr.PointerToRawData;
+ reloc_size = secthdr.SizeOfRawData;
+ }
+ else if (!text_off && secthdr.Characteristics & IMAGE_SCN_CNT_CODE) {
+ /* Code section */
+ text_off = secthdr.PointerToRawData;
+ text_addr = secthdr.VirtualAddress;
+ text_size = secthdr.SizeOfRawData;
+ }
+ else if (!data_off && secthdr.Characteristics & IMAGE_SCN_CNT_INITIALIZED_DATA) {
+ /* Data section */
+ data_off = secthdr.PointerToRawData;
+ data_addr = secthdr.VirtualAddress;
+ data_size = secthdr.SizeOfRawData;
+ data_end = data_addr + data_size;
+ }
+ }
/* Check to make sure that we have all the sections we need */
if (!text_off || !data_off || !export_off || !reloc_off) {
- result = PE_invalidDLLImage;
- goto Error;
- }
+ result = PE_invalidDLLImage;
+ goto Error;
+ }
/* Find the size of the image to load allocate memory for it */
image_size = MAX(export_end,data_end) - text_addr;
*size = sizeof(PE_MODULE) + image_size + 4096;
if (shared)
- hMod = PM_mallocShared(*size);
+ hMod = PM_mallocShared(*size);
else
- hMod = PM_malloc(*size);
+ hMod = PM_malloc(*size);
reloc = PM_malloc(reloc_size);
if (!hMod || !reloc) {
- result = PE_outOfMemory;
- goto Error;
- }
+ result = PE_outOfMemory;
+ goto Error;
+ }
hMod->text = (uchar*)ROUND_4K((ulong)hMod + sizeof(PE_MODULE));
hMod->data = (uchar*)((ulong)hMod->text + (data_addr - text_addr));
@@ -272,48 +272,48 @@ PE_MODULE * PEAPI PE_loadLibraryExt(
result = PE_invalidDLLImage;
fseek(f, startOffset+text_off, SEEK_SET);
if (fread(hMod->text, 1, text_size, f) != text_size)
- goto Error;
+ goto Error;
fseek(f, startOffset+data_off, SEEK_SET);
if (fread(hMod->data, 1, data_size, f) != data_size)
- goto Error;
+ goto Error;
fseek(f, startOffset+export_off, SEEK_SET);
if (fread(hMod->export, 1, export_size, f) != export_size)
- goto Error;
+ goto Error;
fseek(f, startOffset+reloc_off, SEEK_SET);
if (fread(reloc, 1, reloc_size, f) != reloc_size)
- goto Error;
+ goto Error;
/* Now perform relocations on all sections in the image */
delta = (ulong)hMod->text - opthdr.ImageBase - text_addr;
baseReloc = (BASE_RELOCATION*)reloc;
for (;;) {
- /* Check for termination condition */
- if (!baseReloc->PageRVA || !baseReloc->BlockSize)
- break;
-
- /* Do fixups */
- pageOffset = baseReloc->PageRVA - hMod->textBase;
- numFixups = (baseReloc->BlockSize - sizeof(BASE_RELOCATION)) / sizeof(ushort);
- fixup = (ushort*)(baseReloc + 1);
- for (i = 0; i < numFixups; i++) {
- relocType = *fixup >> 12;
- if (relocType) {
- offset = pageOffset + (*fixup & 0x0FFF);
- *(ulong*)(hMod->text + offset) += delta;
- }
- fixup++;
- }
-
- /* Move to next relocation block */
- baseReloc = (BASE_RELOCATION*)((ulong)baseReloc + baseReloc->BlockSize);
- }
+ /* Check for termination condition */
+ if (!baseReloc->PageRVA || !baseReloc->BlockSize)
+ break;
+
+ /* Do fixups */
+ pageOffset = baseReloc->PageRVA - hMod->textBase;
+ numFixups = (baseReloc->BlockSize - sizeof(BASE_RELOCATION)) / sizeof(ushort);
+ fixup = (ushort*)(baseReloc + 1);
+ for (i = 0; i < numFixups; i++) {
+ relocType = *fixup >> 12;
+ if (relocType) {
+ offset = pageOffset + (*fixup & 0x0FFF);
+ *(ulong*)(hMod->text + offset) += delta;
+ }
+ fixup++;
+ }
+
+ /* Move to next relocation block */
+ baseReloc = (BASE_RELOCATION*)((ulong)baseReloc + baseReloc->BlockSize);
+ }
/* Initialise the C runtime library for the loaded DLL */
result = PE_unableToInitLibC;
if ((InitLibC = (InitLibC_t)PE_getProcAddress(hMod,"_InitLibC")) == NULL)
- goto Error;
+ goto Error;
if (!InitLibC(&___imports,PM_getOSType()))
- goto Error;
+ goto Error;
/* Clean up, close the file and return the loaded module handle */
PM_free(reloc);
@@ -322,9 +322,9 @@ PE_MODULE * PEAPI PE_loadLibraryExt(
Error:
if (shared)
- PM_freeShared(hMod);
+ PM_freeShared(hMod);
else
- PM_free(hMod);
+ PM_free(hMod);
PM_free(reloc);
return NULL;
}
@@ -360,53 +360,53 @@ PE_MODULE * PEAPI PE_loadLibrary(
#if (defined(__WINDOWS32__) || defined(__DRIVER__)) && defined(CHECKED)
if (!shared) {
- PM_MODULE hInst;
- InitLibC_t InitLibC;
-
- /* For Win32 if are building checked libraries for debugging, we use
- * the real Win32 DLL functions so that we can debug the resulting DLL
- * files with the Win32 debuggers. Note that we can't do this if
- * we need to load the files into a shared memory context.
- */
- if ((hInst = PM_loadLibrary(szDLLName)) == NULL) {
- result = PE_fileNotFound;
- return NULL;
- }
-
- /* Initialise the C runtime library for the loaded DLL */
- result = PE_unableToInitLibC;
- if ((InitLibC = (void*)PM_getProcAddress(hInst,"_InitLibC")) == NULL)
- return NULL;
- if (!InitLibC(&___imports,PM_getOSType()))
- return NULL;
-
- /* Allocate the PE_MODULE structure */
- if ((hMod = PM_malloc(sizeof(*hMod))) == NULL)
- return NULL;
- hMod->text = (void*)hInst;
- hMod->shared = -1;
-
- /* DLL loaded successfully so return module handle */
- result = PE_ok;
- return hMod;
- }
+ PM_MODULE hInst;
+ InitLibC_t InitLibC;
+
+ /* For Win32 if are building checked libraries for debugging, we use
+ * the real Win32 DLL functions so that we can debug the resulting DLL
+ * files with the Win32 debuggers. Note that we can't do this if
+ * we need to load the files into a shared memory context.
+ */
+ if ((hInst = PM_loadLibrary(szDLLName)) == NULL) {
+ result = PE_fileNotFound;
+ return NULL;
+ }
+
+ /* Initialise the C runtime library for the loaded DLL */
+ result = PE_unableToInitLibC;
+ if ((InitLibC = (void*)PM_getProcAddress(hInst,"_InitLibC")) == NULL)
+ return NULL;
+ if (!InitLibC(&___imports,PM_getOSType()))
+ return NULL;
+
+ /* Allocate the PE_MODULE structure */
+ if ((hMod = PM_malloc(sizeof(*hMod))) == NULL)
+ return NULL;
+ hMod->text = (void*)hInst;
+ hMod->shared = -1;
+
+ /* DLL loaded successfully so return module handle */
+ result = PE_ok;
+ return hMod;
+ }
else
#endif
- {
- FILE *f;
- ulong size;
-
- /* Attempt to open the file on disk */
- if (shared < 0)
- shared = 0;
- if ((f = fopen(szDLLName,"rb")) == NULL) {
- result = PE_fileNotFound;
- return NULL;
- }
- hMod = PE_loadLibraryExt(f,0,&size,shared);
- fclose(f);
- return hMod;
- }
+ {
+ FILE *f;
+ ulong size;
+
+ /* Attempt to open the file on disk */
+ if (shared < 0)
+ shared = 0;
+ if ((f = fopen(szDLLName,"rb")) == NULL) {
+ result = PE_fileNotFound;
+ return NULL;
+ }
+ hMod = PE_loadLibraryExt(f,0,&size,shared);
+ fclose(f);
+ return hMod;
+ }
}
/****************************************************************************
@@ -445,14 +445,14 @@ PE_MODULE * PEAPI PE_loadLibraryMGL(
*/
#if !defined(__WIN32_VXD__) && !defined(__NT_DRIVER__)
if (getenv("MGL_ROOT")) {
- strcpy(path,getenv("MGL_ROOT"));
- PM_backslash(path);
- }
+ strcpy(path,getenv("MGL_ROOT"));
+ PM_backslash(path);
+ }
strcat(path,"drivers");
PM_backslash(path);
strcat(path,szDLLName);
if ((hMod = PE_loadLibrary(path,shared)) != NULL)
- return hMod;
+ return hMod;
#endif
strcpy(path,"drivers");
PM_backslash(path);
@@ -488,39 +488,39 @@ void * PEAPI PE_getProcAddress(
{
#if (defined(__WINDOWS32__) || defined(__DRIVER__)) && defined(CHECKED)
if (hModule->shared == -1)
- return (void*)PM_getProcAddress(hModule->text,szProcName);
+ return (void*)PM_getProcAddress(hModule->text,szProcName);
else
#endif
- {
- uint i;
- EXPORT_DIRECTORY *exports;
- ulong funcOffset;
- ulong *AddressTable;
- ulong *NameTable;
- ushort *OrdinalTable;
- char *name;
-
- /* Find the address of the export tables from the export section */
- if (!hModule)
- return NULL;
- exports = (EXPORT_DIRECTORY*)(hModule->export + hModule->exportDir);
- AddressTable = (ulong*)(hModule->export + exports->AddressTableRVA - hModule->exportBase);
- NameTable = (ulong*)(hModule->export + exports->NameTableRVA - hModule->exportBase);
- OrdinalTable = (ushort*)(hModule->export + exports->OrdinalTableRVA - hModule->exportBase);
-
- /* Search the export name table to find the function name */
- for (i = 0; i < exports->NumberOfNamePointers; i++) {
- name = (char*)(hModule->export + NameTable[i] - hModule->exportBase);
- if (strcmp(name,szProcName) == 0)
- break;
- }
- if (i == exports->NumberOfNamePointers)
- return NULL;
- funcOffset = AddressTable[OrdinalTable[i]];
- if (!funcOffset)
- return NULL;
- return (void*)(hModule->text + funcOffset - hModule->textBase);
- }
+ {
+ uint i;
+ EXPORT_DIRECTORY *exports;
+ ulong funcOffset;
+ ulong *AddressTable;
+ ulong *NameTable;
+ ushort *OrdinalTable;
+ char *name;
+
+ /* Find the address of the export tables from the export section */
+ if (!hModule)
+ return NULL;
+ exports = (EXPORT_DIRECTORY*)(hModule->export + hModule->exportDir);
+ AddressTable = (ulong*)(hModule->export + exports->AddressTableRVA - hModule->exportBase);
+ NameTable = (ulong*)(hModule->export + exports->NameTableRVA - hModule->exportBase);
+ OrdinalTable = (ushort*)(hModule->export + exports->OrdinalTableRVA - hModule->exportBase);
+
+ /* Search the export name table to find the function name */
+ for (i = 0; i < exports->NumberOfNamePointers; i++) {
+ name = (char*)(hModule->export + NameTable[i] - hModule->exportBase);
+ if (strcmp(name,szProcName) == 0)
+ break;
+ }
+ if (i == exports->NumberOfNamePointers)
+ return NULL;
+ funcOffset = AddressTable[OrdinalTable[i]];
+ if (!funcOffset)
+ return NULL;
+ return (void*)(hModule->text + funcOffset - hModule->textBase);
+ }
}
/****************************************************************************
@@ -546,25 +546,25 @@ void PEAPI PE_freeLibrary(
#if (defined(__WINDOWS32__) || defined(__DRIVER__)) && defined(CHECKED)
if (hModule->shared == -1) {
- /* Run the C runtime library exit code on module unload */
- if ((TerminateLibC = (TerminateLibC_t)PM_getProcAddress(hModule->text,"_TerminateLibC")) != NULL)
- TerminateLibC();
- PM_freeLibrary(hModule->text);
- PM_free(hModule);
- }
+ /* Run the C runtime library exit code on module unload */
+ if ((TerminateLibC = (TerminateLibC_t)PM_getProcAddress(hModule->text,"_TerminateLibC")) != NULL)
+ TerminateLibC();
+ PM_freeLibrary(hModule->text);
+ PM_free(hModule);
+ }
else
#endif
- {
- if (hModule) {
- /* Run the C runtime library exit code on module unload */
- if ((TerminateLibC = (TerminateLibC_t)PE_getProcAddress(hModule,"_TerminateLibC")) != NULL)
- TerminateLibC();
- if (hModule->shared)
- PM_freeShared(hModule);
- else
- PM_free(hModule);
- }
- }
+ {
+ if (hModule) {
+ /* Run the C runtime library exit code on module unload */
+ if ((TerminateLibC = (TerminateLibC_t)PE_getProcAddress(hModule,"_TerminateLibC")) != NULL)
+ TerminateLibC();
+ if (hModule->shared)
+ PM_freeShared(hModule);
+ else
+ PM_free(hModule);
+ }
+ }
}
/****************************************************************************
@@ -584,4 +584,3 @@ int PEAPI PE_getError(void)
{
return result;
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/common/vesavbe.c b/board/MAI/bios_emulator/scitech/src/common/vesavbe.c
index 2be57e2bd3..a669e5c292 100644
--- a/board/MAI/bios_emulator/scitech/src/common/vesavbe.c
+++ b/board/MAI/bios_emulator/scitech/src/common/vesavbe.c
@@ -73,10 +73,10 @@ void VBEAPI VBE_init(void)
****************************************************************************/
{
if (!state->VESABuf_ptr) {
- /* Allocate a global buffer for communicating with the VESA VBE */
- if ((state->VESABuf_ptr = PM_getVESABuf(&VESABuf_len, &state->VESABuf_rseg, &state->VESABuf_roff)) == NULL)
- PM_fatalError("VESAVBE.C: Real mode memory allocation failed!");
- }
+ /* Allocate a global buffer for communicating with the VESA VBE */
+ if ((state->VESABuf_ptr = PM_getVESABuf(&VESABuf_len, &state->VESABuf_rseg, &state->VESABuf_roff)) == NULL)
+ PM_fatalError("VESAVBE.C: Real mode memory allocation failed!");
+ }
}
void * VBEAPI VBE_getRMBuf(uint *len,uint *rseg,uint *roff)
@@ -129,7 +129,7 @@ void VBEAPI VBE_callESDI(RMREGS *regs, void *buffer, int size)
RMSREGS sregs;
if (!state->VESABuf_ptr)
- PM_fatalError("You *MUST* call VBE_init() before you can call the VESAVBE.C module!");
+ PM_fatalError("You *MUST* call VBE_init() before you can call the VESAVBE.C module!");
sregs.es = (ushort)state->VESABuf_rseg;
regs->x.di = (ushort)state->VESABuf_roff;
memcpy(state->VESABuf_ptr, buffer, size);
@@ -157,7 +157,7 @@ static char *VBE_copyStrToLocal(char *p,char *realPtr,char *max)
v = PM_mapRealPointer((uint)((ulong)realPtr >> 16), (uint)((ulong)realPtr & 0xFFFF));
while (*v != 0 && p < max)
- *p++ = *v++;
+ *p++ = *v++;
*p++ = 0;
return p;
}
@@ -178,7 +178,7 @@ static void VBE_copyShortToLocal(ushort *p,ushort *realPtr)
v = PM_mapRealPointer((uint)((ulong)realPtr >> 16),(uint)((ulong)realPtr & 0xFFFF));
while (*v != 0xFFFF)
- *p++ = *v++;
+ *p++ = *v++;
*p = 0xFFFF;
}
#endif
@@ -200,26 +200,26 @@ int VBEAPI VBE_detectEXT(VBE_vgaInfo *vgaInfo,ibool forceUniVBE)
regs.x.ax = 0x4F00; /* Get SuperVGA information */
if (forceUniVBE) {
- regs.x.bx = 0x1234;
- regs.x.cx = 0x4321;
- }
+ regs.x.bx = 0x1234;
+ regs.x.cx = 0x4321;
+ }
else {
- regs.x.bx = 0;
- regs.x.cx = 0;
- }
+ regs.x.bx = 0;
+ regs.x.cx = 0;
+ }
strncpy(vgaInfo->VESASignature,"VBE2",4);
VBE_callESDI(&regs, vgaInfo, sizeof(*vgaInfo));
if (regs.x.ax != VBE_SUCCESS)
- return 0;
+ return 0;
if (strncmp(vgaInfo->VESASignature,"VESA",4) != 0)
- return 0;
+ return 0;
/* Check for bogus BIOSes that return a VBE version number that is
* not correct, and fix it up. We also check the OemVendorNamePtr for a
* valid value, and if it is invalid then we also reset to VBE 1.2.
*/
if (vgaInfo->VESAVersion >= 0x200 && vgaInfo->OemVendorNamePtr == 0)
- vgaInfo->VESAVersion = 0x102;
+ vgaInfo->VESAVersion = 0x102;
#ifndef REALMODE
/* Relocate all the indirect information (mode tables, OEM strings
* etc) from the low 1Mb memory region into a static buffer in
@@ -227,23 +227,23 @@ int VBEAPI VBE_detectEXT(VBE_vgaInfo *vgaInfo,ibool forceUniVBE)
* from mapping the strings from real mode to protected mode.
*/
{
- char *p,*p2;
+ char *p,*p2;
p2 = VBE_copyStrToLocal(localBuf,vgaInfo->OemStringPtr,MAX_LOCAL_BUF);
vgaInfo->OemStringPtr = localBuf;
if (vgaInfo->VESAVersion >= 0x200) {
- p = VBE_copyStrToLocal(p2,vgaInfo->OemVendorNamePtr,MAX_LOCAL_BUF);
- vgaInfo->OemVendorNamePtr = p2;
- p2 = VBE_copyStrToLocal(p,vgaInfo->OemProductNamePtr,MAX_LOCAL_BUF);
- vgaInfo->OemProductNamePtr = p;
- p = VBE_copyStrToLocal(p2,vgaInfo->OemProductRevPtr,MAX_LOCAL_BUF);
- vgaInfo->OemProductRevPtr = p2;
- VBE_copyShortToLocal((ushort*)p,vgaInfo->VideoModePtr);
- vgaInfo->VideoModePtr = (ushort*)p;
- }
+ p = VBE_copyStrToLocal(p2,vgaInfo->OemVendorNamePtr,MAX_LOCAL_BUF);
+ vgaInfo->OemVendorNamePtr = p2;
+ p2 = VBE_copyStrToLocal(p,vgaInfo->OemProductNamePtr,MAX_LOCAL_BUF);
+ vgaInfo->OemProductNamePtr = p;
+ p = VBE_copyStrToLocal(p2,vgaInfo->OemProductRevPtr,MAX_LOCAL_BUF);
+ vgaInfo->OemProductRevPtr = p2;
+ VBE_copyShortToLocal((ushort*)p,vgaInfo->VideoModePtr);
+ vgaInfo->VideoModePtr = (ushort*)p;
+ }
else {
- VBE_copyShortToLocal((ushort*)p2,vgaInfo->VideoModePtr);
- vgaInfo->VideoModePtr = (ushort*)p2;
- }
+ VBE_copyShortToLocal((ushort*)p2,vgaInfo->VideoModePtr);
+ vgaInfo->VideoModePtr = (ushort*)p2;
+ }
}
#endif
state->VBEMemory = vgaInfo->TotalMemory * 64;
@@ -253,17 +253,17 @@ int VBEAPI VBE_detectEXT(VBE_vgaInfo *vgaInfo,ibool forceUniVBE)
*/
haveRiva128 = false;
if (vgaInfo->VESAVersion >= 0x300 &&
- (strstr(vgaInfo->OemStringPtr,"NVidia") != NULL ||
- strstr(vgaInfo->OemStringPtr,"Riva") != NULL)) {
- haveRiva128 = true;
- }
+ (strstr(vgaInfo->OemStringPtr,"NVidia") != NULL ||
+ strstr(vgaInfo->OemStringPtr,"Riva") != NULL)) {
+ haveRiva128 = true;
+ }
/* Check for Matrox G400 cards which claim to be VBE 3.0
* compliant yet they don't implement the refresh rate control
* functions.
*/
if (vgaInfo->VESAVersion >= 0x300 && (strcmp(vgaInfo->OemProductNamePtr,"Matrox G400") == 0))
- vgaInfo->VESAVersion = 0x200;
+ vgaInfo->VESAVersion = 0x200;
return (state->VBEVersion = vgaInfo->VESAVersion);
}
@@ -305,70 +305,70 @@ ibool VBEAPI VBE_getModeInfo(int mode,VBE_modeInfo *modeInfo)
regs.x.cx = (ushort)mode;
VBE_callESDI(&regs, modeInfo, sizeof(*modeInfo));
if (regs.x.ax != VBE_SUCCESS)
- return false;
+ return false;
if ((modeInfo->ModeAttributes & vbeMdAvailable) == 0)
- return false;
+ return false;
/* Map out triple buffer and stereo flags for NVidia Riva128
* chips.
*/
if (haveRiva128) {
- modeInfo->ModeAttributes &= ~vbeMdTripleBuf;
- modeInfo->ModeAttributes &= ~vbeMdStereo;
- }
+ modeInfo->ModeAttributes &= ~vbeMdTripleBuf;
+ modeInfo->ModeAttributes &= ~vbeMdStereo;
+ }
/* Support old style RGB definitions for VBE 1.1 BIOSes */
bits = modeInfo->BitsPerPixel;
if (modeInfo->MemoryModel == vbeMemPK && bits > 8) {
- modeInfo->MemoryModel = vbeMemRGB;
- switch (bits) {
- case 15:
- modeInfo->RedMaskSize = 5;
- modeInfo->RedFieldPosition = 10;
- modeInfo->GreenMaskSize = 5;
- modeInfo->GreenFieldPosition = 5;
- modeInfo->BlueMaskSize = 5;
- modeInfo->BlueFieldPosition = 0;
- modeInfo->RsvdMaskSize = 1;
- modeInfo->RsvdFieldPosition = 15;
- break;
- case 16:
- modeInfo->RedMaskSize = 5;
- modeInfo->RedFieldPosition = 11;
- modeInfo->GreenMaskSize = 5;
- modeInfo->GreenFieldPosition = 5;
- modeInfo->BlueMaskSize = 5;
- modeInfo->BlueFieldPosition = 0;
- modeInfo->RsvdMaskSize = 0;
- modeInfo->RsvdFieldPosition = 0;
- break;
- case 24:
- modeInfo->RedMaskSize = 8;
- modeInfo->RedFieldPosition = 16;
- modeInfo->GreenMaskSize = 8;
- modeInfo->GreenFieldPosition = 8;
- modeInfo->BlueMaskSize = 8;
- modeInfo->BlueFieldPosition = 0;
- modeInfo->RsvdMaskSize = 0;
- modeInfo->RsvdFieldPosition = 0;
- break;
- }
- }
+ modeInfo->MemoryModel = vbeMemRGB;
+ switch (bits) {
+ case 15:
+ modeInfo->RedMaskSize = 5;
+ modeInfo->RedFieldPosition = 10;
+ modeInfo->GreenMaskSize = 5;
+ modeInfo->GreenFieldPosition = 5;
+ modeInfo->BlueMaskSize = 5;
+ modeInfo->BlueFieldPosition = 0;
+ modeInfo->RsvdMaskSize = 1;
+ modeInfo->RsvdFieldPosition = 15;
+ break;
+ case 16:
+ modeInfo->RedMaskSize = 5;
+ modeInfo->RedFieldPosition = 11;
+ modeInfo->GreenMaskSize = 5;
+ modeInfo->GreenFieldPosition = 5;
+ modeInfo->BlueMaskSize = 5;
+ modeInfo->BlueFieldPosition = 0;
+ modeInfo->RsvdMaskSize = 0;
+ modeInfo->RsvdFieldPosition = 0;
+ break;
+ case 24:
+ modeInfo->RedMaskSize = 8;
+ modeInfo->RedFieldPosition = 16;
+ modeInfo->GreenMaskSize = 8;
+ modeInfo->GreenFieldPosition = 8;
+ modeInfo->BlueMaskSize = 8;
+ modeInfo->BlueFieldPosition = 0;
+ modeInfo->RsvdMaskSize = 0;
+ modeInfo->RsvdFieldPosition = 0;
+ break;
+ }
+ }
/* Convert the 32k direct color modes of VBE 1.2+ BIOSes to
* be recognised as 15 bits per pixel modes.
*/
if (bits == 16 && modeInfo->RsvdMaskSize == 1)
- modeInfo->BitsPerPixel = 15;
+ modeInfo->BitsPerPixel = 15;
/* Fix up bogus BIOS'es that report incorrect reserved pixel masks
* for 32K color modes. Quite a number of BIOS'es have this problem,
* and this affects our OS/2 drivers in VBE fallback mode.
*/
if (bits == 15 && (modeInfo->RsvdMaskSize != 1 || modeInfo->RsvdFieldPosition != 15)) {
- modeInfo->RsvdMaskSize = 1;
- modeInfo->RsvdFieldPosition = 15;
- }
+ modeInfo->RsvdMaskSize = 1;
+ modeInfo->RsvdFieldPosition = 15;
+ }
return true;
}
@@ -391,20 +391,20 @@ long VBEAPI VBE_getPageSize(VBE_modeInfo *mi)
size = (long)mi->BytesPerScanLine * (long)mi->YResolution;
if (mi->BitsPerPixel == 4) {
- /* We have a 16 color video mode, so round up the page size to
- * 8k, 16k, 32k or 64k boundaries depending on how large it is.
- */
-
- size = (size + 0x1FFFL) & 0xFFFFE000L;
- if (size != 0x2000) {
- size = (size + 0x3FFFL) & 0xFFFFC000L;
- if (size != 0x4000) {
- size = (size + 0x7FFFL) & 0xFFFF8000L;
- if (size != 0x8000)
- size = (size + 0xFFFFL) & 0xFFFF0000L;
- }
- }
- }
+ /* We have a 16 color video mode, so round up the page size to
+ * 8k, 16k, 32k or 64k boundaries depending on how large it is.
+ */
+
+ size = (size + 0x1FFFL) & 0xFFFFE000L;
+ if (size != 0x2000) {
+ size = (size + 0x3FFFL) & 0xFFFFC000L;
+ if (size != 0x4000) {
+ size = (size + 0x7FFFL) & 0xFFFF8000L;
+ if (size != 0x8000)
+ size = (size + 0xFFFFL) & 0xFFFF0000L;
+ }
+ }
+ }
else size = (size + 0xFFFFL) & 0xFFFF0000L;
return size;
}
@@ -425,26 +425,26 @@ ibool VBEAPI VBE_setVideoModeExt(int mode,VBE_CRTCInfo *crtc)
RMREGS regs;
if (state->VBEVersion < 0x200 && mode < 0x100) {
- /* Some VBE implementations barf terribly if you try to set non-VBE
- * video modes with the VBE set mode call. VBE 2.0 implementations
- * must be able to handle this.
- */
- regs.h.al = (ushort)mode;
- regs.h.ah = 0;
- PM_int86(0x10,&regs,&regs);
- }
+ /* Some VBE implementations barf terribly if you try to set non-VBE
+ * video modes with the VBE set mode call. VBE 2.0 implementations
+ * must be able to handle this.
+ */
+ regs.h.al = (ushort)mode;
+ regs.h.ah = 0;
+ PM_int86(0x10,&regs,&regs);
+ }
else {
- if (state->VBEVersion < 0x300 && (mode & vbeRefreshCtrl))
- return false;
- regs.x.ax = 0x4F02;
- regs.x.bx = (ushort)mode;
- if ((mode & vbeRefreshCtrl) && crtc)
- VBE_callESDI(&regs, crtc, sizeof(*crtc));
- else
- PM_int86(0x10,&regs,&regs);
- if (regs.x.ax != VBE_SUCCESS)
- return false;
- }
+ if (state->VBEVersion < 0x300 && (mode & vbeRefreshCtrl))
+ return false;
+ regs.x.ax = 0x4F02;
+ regs.x.bx = (ushort)mode;
+ if ((mode & vbeRefreshCtrl) && crtc)
+ VBE_callESDI(&regs, crtc, sizeof(*crtc));
+ else
+ PM_int86(0x10,&regs,&regs);
+ if (regs.x.ax != VBE_SUCCESS)
+ return false;
+ }
return true;
}
@@ -475,7 +475,7 @@ int VBEAPI VBE_getVideoMode(void)
regs.x.ax = 0x4F03;
PM_int86(0x10,&regs,&regs);
if (regs.x.ax != VBE_SUCCESS)
- return -1;
+ return -1;
return regs.x.bx;
}
@@ -515,7 +515,7 @@ int VBEAPI VBE_getBank(int window)
regs.h.bl = window;
PM_int86(0x10,&regs,&regs);
if (regs.x.ax != VBE_SUCCESS)
- return -1;
+ return -1;
return regs.x.dx;
}
@@ -637,7 +637,7 @@ ibool VBEAPI VBE_setDisplayStart(int x,int y,ibool waitVRT)
regs.x.ax = 0x4F07;
if (waitVRT)
- regs.x.bx = 0x80;
+ regs.x.bx = 0x80;
else regs.x.bx = 0x00;
regs.x.cx = x;
regs.x.dx = y;
@@ -685,12 +685,12 @@ ibool VBEAPI VBE_setDisplayStartAlt(ulong startAddr,ibool waitVRT)
RMREGS regs;
if (state->VBEVersion >= 0x300) {
- regs.x.ax = 0x4F07;
- regs.x.bx = waitVRT ? 0x82 : 0x02;
- regs.e.ecx = startAddr;
- PM_int86(0x10,&regs,&regs);
- return regs.x.ax == VBE_SUCCESS;
- }
+ regs.x.ax = 0x4F07;
+ regs.x.bx = waitVRT ? 0x82 : 0x02;
+ regs.e.ecx = startAddr;
+ PM_int86(0x10,&regs,&regs);
+ return regs.x.ax == VBE_SUCCESS;
+ }
return false;
}
@@ -712,12 +712,12 @@ int VBEAPI VBE_getDisplayStartStatus(void)
RMREGS regs;
if (state->VBEVersion >= 0x300) {
- regs.x.ax = 0x4F07;
- regs.x.bx = 0x0004;
- PM_int86(0x10,&regs,&regs);
- if (regs.x.ax == VBE_SUCCESS)
- return (regs.x.cx != 0);
- }
+ regs.x.ax = 0x4F07;
+ regs.x.bx = 0x0004;
+ PM_int86(0x10,&regs,&regs);
+ if (regs.x.ax == VBE_SUCCESS)
+ return (regs.x.cx != 0);
+ }
return -1;
}
@@ -738,11 +738,11 @@ ibool VBEAPI VBE_enableStereoMode(void)
RMREGS regs;
if (state->VBEVersion >= 0x300) {
- regs.x.ax = 0x4F07;
- regs.x.bx = 0x0005;
- PM_int86(0x10,&regs,&regs);
- return regs.x.ax == VBE_SUCCESS;
- }
+ regs.x.ax = 0x4F07;
+ regs.x.bx = 0x0005;
+ PM_int86(0x10,&regs,&regs);
+ return regs.x.ax == VBE_SUCCESS;
+ }
return false;
}
@@ -762,11 +762,11 @@ ibool VBEAPI VBE_disableStereoMode(void)
RMREGS regs;
if (state->VBEVersion >= 0x300) {
- regs.x.ax = 0x4F07;
- regs.x.bx = 0x0006;
- PM_int86(0x10,&regs,&regs);
- return regs.x.ax == VBE_SUCCESS;
- }
+ regs.x.ax = 0x4F07;
+ regs.x.bx = 0x0006;
+ PM_int86(0x10,&regs,&regs);
+ return regs.x.ax == VBE_SUCCESS;
+ }
return false;
}
@@ -793,13 +793,13 @@ ibool VBEAPI VBE_setStereoDisplayStart(ulong leftAddr,ulong rightAddr,
RMREGS regs;
if (state->VBEVersion >= 0x300) {
- regs.x.ax = 0x4F07;
- regs.x.bx = waitVRT ? 0x83 : 0x03;
- regs.e.ecx = leftAddr;
- regs.e.edx = rightAddr;
- PM_int86(0x10,&regs,&regs);
- return regs.x.ax == VBE_SUCCESS;
- }
+ regs.x.ax = 0x4F07;
+ regs.x.bx = waitVRT ? 0x83 : 0x03;
+ regs.e.ecx = leftAddr;
+ regs.e.edx = rightAddr;
+ PM_int86(0x10,&regs,&regs);
+ return regs.x.ax == VBE_SUCCESS;
+ }
return false;
}
@@ -832,14 +832,14 @@ ulong VBEAPI VBE_getClosestClock(ushort mode,ulong pixelClock)
RMREGS regs;
if (state->VBEVersion >= 0x300) {
- regs.x.ax = 0x4F0B;
- regs.h.bl = 0x00;
- regs.e.ecx = pixelClock;
- regs.x.dx = mode;
- PM_int86(0x10,&regs,&regs);
- if (regs.x.ax == VBE_SUCCESS)
- return regs.e.ecx;
- }
+ regs.x.ax = 0x4F0B;
+ regs.h.bl = 0x00;
+ regs.e.ecx = pixelClock;
+ regs.x.dx = mode;
+ PM_int86(0x10,&regs,&regs);
+ if (regs.x.ax == VBE_SUCCESS)
+ return regs.e.ecx;
+ }
return -1;
}
@@ -875,7 +875,7 @@ int VBEAPI VBE_getDACWidth(void)
regs.h.bl = 0x01;
PM_int86(0x10,&regs,&regs);
if (regs.x.ax != VBE_SUCCESS)
- return -1;
+ return -1;
return regs.h.bh;
}
@@ -927,11 +927,11 @@ void * VBEAPI VBE_getBankedPointer(VBE_modeInfo *modeInfo)
*/
ulong seg = (ushort)modeInfo->WinASegment;
if (seg != 0) {
- if (seg == 0xA000)
- return (void*)PM_getA0000Pointer();
- else
- return (void*)PM_mapPhysicalAddr(seg << 4,0xFFFF,true);
- }
+ if (seg == 0xA000)
+ return (void*)PM_getA0000Pointer();
+ else
+ return (void*)PM_mapPhysicalAddr(seg << 4,0xFFFF,true);
+ }
return NULL;
}
@@ -956,14 +956,14 @@ void * VBEAPI VBE_getLinearPointer(VBE_modeInfo *modeInfo)
/* Search for an already mapped pointer */
for (i = 0; i < numPtrs; i++) {
- if (physPtr[i] == modeInfo->PhysBasePtr)
- return linPtr[i];
- }
+ if (physPtr[i] == modeInfo->PhysBasePtr)
+ return linPtr[i];
+ }
if (numPtrs < MAX_LIN_PTRS) {
- physPtr[numPtrs] = modeInfo->PhysBasePtr;
- linPtr[numPtrs] = PM_mapPhysicalAddr(modeInfo->PhysBasePtr,(state->VBEMemory * 1024L)-1,true);
- return linPtr[numPtrs++];
- }
+ physPtr[numPtrs] = modeInfo->PhysBasePtr;
+ linPtr[numPtrs] = PM_mapPhysicalAddr(modeInfo->PhysBasePtr,(state->VBEMemory * 1024L)-1,true);
+ return linPtr[numPtrs++];
+ }
return NULL;
}
@@ -989,56 +989,56 @@ static void InitPMCode(void)
int pmLen;
if (!state->pmInfo && state->VBEVersion >= 0x200) {
- regs.x.ax = 0x4F0A;
- regs.x.bx = 0;
- PM_int86x(0x10,&regs,&regs,&sregs);
- if (regs.x.ax != VBE_SUCCESS)
- return;
- if (VBE_shared)
- state->pmInfo = PM_mallocShared(regs.x.cx);
- else
- state->pmInfo = PM_malloc(regs.x.cx);
- if (state->pmInfo == NULL)
- return;
- state->pmInfo32 = state->pmInfo;
- pmLen = regs.x.cx;
-
- /* Relocate the block into our local data segment */
- code = PM_mapRealPointer(sregs.es,regs.x.di);
- memcpy(state->pmInfo,code,pmLen);
-
- /* Now do a sanity check on the information we recieve to ensure
- * that is is correct. Some BIOS return totally bogus information
- * in here (Matrox is one)! Under DOS this works OK, but under OS/2
- * we are screwed.
- */
- if (state->pmInfo->setWindow >= pmLen ||
- state->pmInfo->setDisplayStart >= pmLen ||
- state->pmInfo->setPalette >= pmLen ||
- state->pmInfo->IOPrivInfo >= pmLen) {
- if (VBE_shared)
- PM_freeShared(state->pmInfo);
- else
- PM_free(state->pmInfo);
- state->pmInfo32 = state->pmInfo = NULL;
- return;
- }
-
- /* Read the IO priveledge info and determine if we need to
- * pass a selector to MMIO registers to the bank switch code.
- * Since we no longer support selector allocation, we no longer
- * support this mechanism so we disable the protected mode
- * interface in this case.
- */
- if (state->pmInfo->IOPrivInfo && !state->MMIOSel) {
- ushort *p = (ushort*)((uchar*)state->pmInfo + state->pmInfo->IOPrivInfo);
- while (*p != 0xFFFF)
- p++;
- p++;
- if (*p != 0xFFFF)
- VBE_freePMCode();
- }
- }
+ regs.x.ax = 0x4F0A;
+ regs.x.bx = 0;
+ PM_int86x(0x10,&regs,&regs,&sregs);
+ if (regs.x.ax != VBE_SUCCESS)
+ return;
+ if (VBE_shared)
+ state->pmInfo = PM_mallocShared(regs.x.cx);
+ else
+ state->pmInfo = PM_malloc(regs.x.cx);
+ if (state->pmInfo == NULL)
+ return;
+ state->pmInfo32 = state->pmInfo;
+ pmLen = regs.x.cx;
+
+ /* Relocate the block into our local data segment */
+ code = PM_mapRealPointer(sregs.es,regs.x.di);
+ memcpy(state->pmInfo,code,pmLen);
+
+ /* Now do a sanity check on the information we recieve to ensure
+ * that is is correct. Some BIOS return totally bogus information
+ * in here (Matrox is one)! Under DOS this works OK, but under OS/2
+ * we are screwed.
+ */
+ if (state->pmInfo->setWindow >= pmLen ||
+ state->pmInfo->setDisplayStart >= pmLen ||
+ state->pmInfo->setPalette >= pmLen ||
+ state->pmInfo->IOPrivInfo >= pmLen) {
+ if (VBE_shared)
+ PM_freeShared(state->pmInfo);
+ else
+ PM_free(state->pmInfo);
+ state->pmInfo32 = state->pmInfo = NULL;
+ return;
+ }
+
+ /* Read the IO priveledge info and determine if we need to
+ * pass a selector to MMIO registers to the bank switch code.
+ * Since we no longer support selector allocation, we no longer
+ * support this mechanism so we disable the protected mode
+ * interface in this case.
+ */
+ if (state->pmInfo->IOPrivInfo && !state->MMIOSel) {
+ ushort *p = (ushort*)((uchar*)state->pmInfo + state->pmInfo->IOPrivInfo);
+ while (*p != 0xFFFF)
+ p++;
+ p++;
+ if (*p != 0xFFFF)
+ VBE_freePMCode();
+ }
+ }
}
void * VBEAPI VBE_getSetBank(void)
@@ -1050,10 +1050,10 @@ void * VBEAPI VBE_getSetBank(void)
****************************************************************************/
{
if (state->VBEVersion >= 0x200) {
- InitPMCode();
- if (state->pmInfo)
- return (uchar*)state->pmInfo + state->pmInfo->setWindow;
- }
+ InitPMCode();
+ if (state->pmInfo)
+ return (uchar*)state->pmInfo + state->pmInfo->setWindow;
+ }
return NULL;
}
@@ -1066,10 +1066,10 @@ void * VBEAPI VBE_getSetDisplayStart(void)
****************************************************************************/
{
if (state->VBEVersion >= 0x200) {
- InitPMCode();
- if (state->pmInfo)
- return (uchar*)state->pmInfo + state->pmInfo->setDisplayStart;
- }
+ InitPMCode();
+ if (state->pmInfo)
+ return (uchar*)state->pmInfo + state->pmInfo->setDisplayStart;
+ }
return NULL;
}
@@ -1082,10 +1082,10 @@ void * VBEAPI VBE_getSetPalette(void)
****************************************************************************/
{
if (state->VBEVersion >= 0x200) {
- InitPMCode();
- if (state->pmInfo)
- return (uchar*)state->pmInfo + state->pmInfo->setPalette;
- }
+ InitPMCode();
+ if (state->pmInfo)
+ return (uchar*)state->pmInfo + state->pmInfo->setPalette;
+ }
return NULL;
}
@@ -1104,13 +1104,13 @@ void VBEAPI VBE_freePMCode(void)
****************************************************************************/
{
if (state->pmInfo) {
- if (VBE_shared)
- PM_freeShared(state->pmInfo);
- else
- PM_free(state->pmInfo);
- state->pmInfo = NULL;
- state->pmInfo32 = NULL;
- }
+ if (VBE_shared)
+ PM_freeShared(state->pmInfo);
+ else
+ PM_free(state->pmInfo);
+ state->pmInfo = NULL;
+ state->pmInfo32 = NULL;
+ }
}
void VBEAPI VBE_sharePMCode(void)
@@ -1183,31 +1183,31 @@ ibool VBEAPI VBE_getBankFunc32(int *codeLen,void **bankFunc,int dualBanks,
InitPMCode();
if (state->VBEVersion >= 0x200 && state->pmInfo32 && !state->MMIOSel) {
- code = (uchar*)state->pmInfo32 + state->pmInfo32->setWindow;
- if (state->pmInfo32->extensionSig == VBE20_EXT_SIG)
- len = state->pmInfo32->setWindowLen-1;
- else {
- /* We are running on a system without the UniVBE 5.2 extension.
- * We do as best we can by scanning through the code for the
- * ret function to determine the length. This is not foolproof,
- * but is the best we can do.
- */
- p = code;
- while (*p != 0xC3)
- p++;
- len = p - code;
- }
- if ((len + sizeof(VBE20A_bankFunc32_Start) + sizeof(VBE20_bankFunc32_End)) > sizeof(bankFunc32))
- PM_fatalError("32-bit bank switch function too long!");
- copy(p,bankFunc32,VBE20A_bankFunc32_Start);
- memcpy(p,code,len);
- p += len;
- copy(p,p,VBE20_bankFunc32_End);
- *codeLen = p - bankFunc32;
- bankFunc32[VBE20_adjustOffset] = (uchar)bankAdjust;
- *bankFunc = bankFunc32;
- return true;
- }
+ code = (uchar*)state->pmInfo32 + state->pmInfo32->setWindow;
+ if (state->pmInfo32->extensionSig == VBE20_EXT_SIG)
+ len = state->pmInfo32->setWindowLen-1;
+ else {
+ /* We are running on a system without the UniVBE 5.2 extension.
+ * We do as best we can by scanning through the code for the
+ * ret function to determine the length. This is not foolproof,
+ * but is the best we can do.
+ */
+ p = code;
+ while (*p != 0xC3)
+ p++;
+ len = p - code;
+ }
+ if ((len + sizeof(VBE20A_bankFunc32_Start) + sizeof(VBE20_bankFunc32_End)) > sizeof(bankFunc32))
+ PM_fatalError("32-bit bank switch function too long!");
+ copy(p,bankFunc32,VBE20A_bankFunc32_Start);
+ memcpy(p,code,len);
+ p += len;
+ copy(p,p,VBE20_bankFunc32_End);
+ *codeLen = p - bankFunc32;
+ bankFunc32[VBE20_adjustOffset] = (uchar)bankAdjust;
+ *bankFunc = bankFunc32;
+ return true;
+ }
return false;
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/beos/cpuinfo.c b/board/MAI/bios_emulator/scitech/src/pm/beos/cpuinfo.c
index c8f825e25b..cb3afe20c1 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/beos/cpuinfo.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/beos/cpuinfo.c
@@ -64,8 +64,8 @@ Initialise the counter and return the frequency of the counter.
static void GetCounterFrequency(
CPU_largeInteger *freq)
{
- // TODO: Return the frequency of the counter in here. You should try to
- // normalise this value to be around 100,000 ticks per second.
+ /* TODO: Return the frequency of the counter in here. You should try to */
+ /* normalise this value to be around 100,000 ticks per second. */
freq->low = 1000000;
freq->high = 0;
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/beos/event.c b/board/MAI/bios_emulator/scitech/src/pm/beos/event.c
index 4c32ce7434..93c6c0a8fc 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/beos/event.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/beos/event.c
@@ -59,7 +59,7 @@ events.
****************************************************************************/
ulong _EVT_getTicks(void)
{
- // TODO: Implement this for your OS!
+ /* TODO: Implement this for your OS! */
}
/****************************************************************************
@@ -68,36 +68,36 @@ Pumps all messages in the application message queue into our event queue.
****************************************************************************/
static void _EVT_pumpMessages(void)
{
- // TODO: The purpose of this function is to read all keyboard and mouse
- // events from the OS specific event queue, translate them and post
- // them into the SciTech event queue.
- //
- // NOTE: There are a couple of important things that this function must
- // take care of:
- //
- // 1. Support for KEYDOWN, KEYREPEAT and KEYUP is required.
- //
- // 2. Support for reading hardware scan code as well as ASCII
- // translated values is required. Games use the scan codes rather
- // than ASCII values. Scan codes go into the high order byte of the
- // keyboard message field.
- //
- // 3. Support for at least reading mouse motion data (mickeys) from the
- // mouse is required. Using the mickey values, we can then translate
- // to mouse cursor coordinates scaled to the range of the current
- // graphics display mode. Mouse values are scaled based on the
- // global 'rangeX' and 'rangeY'.
- //
- // 4. Support for a timestamp for the events is required, which is
- // defined as the number of milliseconds since some event (usually
- // system startup). This is the timestamp when the event occurred
- // (ie: at interrupt time) not when it was stuff into the SciTech
- // event queue.
- //
- // 5. Support for mouse double click events. If the OS has a native
- // mechanism to determine this, it should be used. Otherwise the
- // time stamp information will be used by the generic event code
- // to generate double click events.
+ /* TODO: The purpose of this function is to read all keyboard and mouse */
+ /* events from the OS specific event queue, translate them and post */
+ /* them into the SciTech event queue. */
+ /* */
+ /* NOTE: There are a couple of important things that this function must */
+ /* take care of: */
+ /* */
+ /* 1. Support for KEYDOWN, KEYREPEAT and KEYUP is required. */
+ /* */
+ /* 2. Support for reading hardware scan code as well as ASCII */
+ /* translated values is required. Games use the scan codes rather */
+ /* than ASCII values. Scan codes go into the high order byte of the */
+ /* keyboard message field. */
+ /* */
+ /* 3. Support for at least reading mouse motion data (mickeys) from the */
+ /* mouse is required. Using the mickey values, we can then translate */
+ /* to mouse cursor coordinates scaled to the range of the current */
+ /* graphics display mode. Mouse values are scaled based on the */
+ /* global 'rangeX' and 'rangeY'. */
+ /* */
+ /* 4. Support for a timestamp for the events is required, which is */
+ /* defined as the number of milliseconds since some event (usually */
+ /* system startup). This is the timestamp when the event occurred */
+ /* (ie: at interrupt time) not when it was stuff into the SciTech */
+ /* event queue. */
+ /* */
+ /* 5. Support for mouse double click events. If the OS has a native */
+ /* mechanism to determine this, it should be used. Otherwise the */
+ /* time stamp information will be used by the generic event code */
+ /* to generate double click events. */
}
/****************************************************************************
@@ -141,7 +141,7 @@ void EVTAPI EVT_init(
initEventQueue();
memset(keyUpMsg,0,sizeof(keyUpMsg));
- // TODO: Do any OS specific initialisation here
+ /* TODO: Do any OS specific initialisation here */
/* Catch program termination signals so we can clean up properly */
signal(SIGABRT, _EVT_abort);
@@ -171,7 +171,7 @@ and this function can be used to resume it again later.
****************************************************************************/
void EVT_resume(void)
{
- // Do nothing for non DOS systems
+ /* Do nothing for non DOS systems */
}
/****************************************************************************
@@ -181,7 +181,7 @@ de-install the event handling code.
****************************************************************************/
void EVT_suspend(void)
{
- // Do nothing for non DOS systems
+ /* Do nothing for non DOS systems */
}
/****************************************************************************
@@ -195,5 +195,5 @@ void EVT_exit(void)
signal(SIGFPE, SIG_DFL);
signal(SIGINT, SIG_DFL);
- // TODO: Do any OS specific cleanup in here
+ /* TODO: Do any OS specific cleanup in here */
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/beos/oshdr.h b/board/MAI/bios_emulator/scitech/src/pm/beos/oshdr.h
index ab423d4be6..043d73ecd1 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/beos/oshdr.h
+++ b/board/MAI/bios_emulator/scitech/src/pm/beos/oshdr.h
@@ -28,5 +28,5 @@
*
****************************************************************************/
-// This is where you include OS specific headers for the event handling
-// library.
+/* This is where you include OS specific headers for the event handling */
+/* library. */
diff --git a/board/MAI/bios_emulator/scitech/src/pm/beos/pm.c b/board/MAI/bios_emulator/scitech/src/pm/beos/pm.c
index c57d82ab68..2dcb1b81fb 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/beos/pm.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/beos/pm.c
@@ -38,7 +38,7 @@
#include <stdlib.h>
#include <string.h>
-// TODO: Include any BeOS specific headers here!
+/* TODO: Include any BeOS specific headers here! */
/*--------------------------- Global variables ----------------------------*/
@@ -48,12 +48,12 @@ static void (PMAPIP fatalErrorCleanup)(void) = NULL;
void PMAPI PM_init(void)
{
- // TODO: Do any initialisation in here. This includes getting IOPL
- // access for the process calling PM_init. This will get called
- // more than once.
+ /* TODO: Do any initialisation in here. This includes getting IOPL */
+ /* access for the process calling PM_init. This will get called */
+ /* more than once. */
- // TODO: If you support the supplied MTRR register stuff (you need to
- // be at ring 0 for this!), you should initialise it in here.
+ /* TODO: If you support the supplied MTRR register stuff (you need to */
+ /* be at ring 0 for this!), you should initialise it in here. */
/* MTRR_init(); */
}
@@ -68,9 +68,9 @@ void PMAPI PM_backslash(char *s)
{
uint pos = strlen(s);
if (s[pos-1] != '/') {
- s[pos] = '/';
- s[pos+1] = '\0';
- }
+ s[pos] = '/';
+ s[pos+1] = '\0';
+ }
}
void PMAPI PM_setFatalErrorCleanup(
@@ -81,112 +81,112 @@ void PMAPI PM_setFatalErrorCleanup(
void PMAPI PM_fatalError(const char *msg)
{
- // TODO: If you are running in a GUI environment without a console,
- // this needs to be changed to bring up a fatal error message
- // box and terminate the program.
+ /* TODO: If you are running in a GUI environment without a console, */
+ /* this needs to be changed to bring up a fatal error message */
+ /* box and terminate the program. */
if (fatalErrorCleanup)
- fatalErrorCleanup();
+ fatalErrorCleanup();
fprintf(stderr,"%s\n", msg);
exit(1);
}
void * PMAPI PM_getVESABuf(uint *len,uint *rseg,uint *roff)
{
- // No BIOS access for the BeOS
+ /* No BIOS access for the BeOS */
return NULL;
}
int PMAPI PM_kbhit(void)
{
- // TODO: This function checks if a key is available to be read. This
- // should be implemented, but is mostly used by the test programs
- // these days.
+ /* TODO: This function checks if a key is available to be read. This */
+ /* should be implemented, but is mostly used by the test programs */
+ /* these days. */
return true;
}
int PMAPI PM_getch(void)
{
- // TODO: This returns the ASCII code of the key pressed. This
- // should be implemented, but is mostly used by the test programs
- // these days.
+ /* TODO: This returns the ASCII code of the key pressed. This */
+ /* should be implemented, but is mostly used by the test programs */
+ /* these days. */
return 0xD;
}
int PMAPI PM_openConsole(void)
{
- // TODO: Opens up a fullscreen console for graphics output. If your
- // console does not have graphics/text modes, this can be left
- // empty. The main purpose of this is to disable console switching
- // when in graphics modes if you can switch away from fullscreen
- // consoles (if you want to allow switching, this can be done
- // elsewhere with a full save/restore state of the graphics mode).
+ /* TODO: Opens up a fullscreen console for graphics output. If your */
+ /* console does not have graphics/text modes, this can be left */
+ /* empty. The main purpose of this is to disable console switching */
+ /* when in graphics modes if you can switch away from fullscreen */
+ /* consoles (if you want to allow switching, this can be done */
+ /* elsewhere with a full save/restore state of the graphics mode). */
return 0;
}
int PMAPI PM_getConsoleStateSize(void)
{
- // TODO: Returns the size of the console state buffer used to save the
- // state of the console before going into graphics mode. This is
- // used to restore the console back to normal when we are done.
+ /* TODO: Returns the size of the console state buffer used to save the */
+ /* state of the console before going into graphics mode. This is */
+ /* used to restore the console back to normal when we are done. */
return 1;
}
void PMAPI PM_saveConsoleState(void *stateBuf,int console_id)
{
- // TODO: Saves the state of the console into the state buffer. This is
- // used to restore the console back to normal when we are done.
- // We will always restore 80x25 text mode after being in graphics
- // mode, so if restoring text mode is all you need to do this can
- // be left empty.
+ /* TODO: Saves the state of the console into the state buffer. This is */
+ /* used to restore the console back to normal when we are done. */
+ /* We will always restore 80x25 text mode after being in graphics */
+ /* mode, so if restoring text mode is all you need to do this can */
+ /* be left empty. */
}
void PMAPI PM_restoreConsoleState(const void *stateBuf,int console_id)
{
- // TODO: Restore the state of the console from the state buffer. This is
- // used to restore the console back to normal when we are done.
- // We will always restore 80x25 text mode after being in graphics
- // mode, so if restoring text mode is all you need to do this can
- // be left empty.
+ /* TODO: Restore the state of the console from the state buffer. This is */
+ /* used to restore the console back to normal when we are done. */
+ /* We will always restore 80x25 text mode after being in graphics */
+ /* mode, so if restoring text mode is all you need to do this can */
+ /* be left empty. */
}
void PMAPI PM_closeConsole(int console_id)
{
- // TODO: Close the console when we are done, going back to text mode.
+ /* TODO: Close the console when we are done, going back to text mode. */
}
void PM_setOSCursorLocation(int x,int y)
{
- // TODO: Set the OS console cursor location to the new value. This is
- // generally used for new OS ports (used mostly for DOS).
+ /* TODO: Set the OS console cursor location to the new value. This is */
+ /* generally used for new OS ports (used mostly for DOS). */
}
void PM_setOSScreenWidth(int width,int height)
{
- // TODO: Set the OS console screen width. This is generally unused for
- // new OS ports.
+ /* TODO: Set the OS console screen width. This is generally unused for */
+ /* new OS ports. */
}
ibool PMAPI PM_setRealTimeClockHandler(PM_intHandler ih, int frequency)
{
- // TODO: Install a real time clock interrupt handler. Normally this
- // will not be supported from most OS'es in user land, so an
- // alternative mechanism is needed to enable software stereo.
- // Hence leave this unimplemented unless you have a high priority
- // mechanism to call the 32-bit callback when the real time clock
- // interrupt fires.
+ /* TODO: Install a real time clock interrupt handler. Normally this */
+ /* will not be supported from most OS'es in user land, so an */
+ /* alternative mechanism is needed to enable software stereo. */
+ /* Hence leave this unimplemented unless you have a high priority */
+ /* mechanism to call the 32-bit callback when the real time clock */
+ /* interrupt fires. */
return false;
}
void PMAPI PM_setRealTimeClockFrequency(int frequency)
{
- // TODO: Set the real time clock interrupt frequency. Used for stereo
- // LC shutter glasses when doing software stereo. Usually sets
- // the frequency to around 2048 Hz.
+ /* TODO: Set the real time clock interrupt frequency. Used for stereo */
+ /* LC shutter glasses when doing software stereo. Usually sets */
+ /* the frequency to around 2048 Hz. */
}
void PMAPI PM_restoreRealTimeClockHandler(void)
{
- // TODO: Restores the real time clock handler.
+ /* TODO: Restores the real time clock handler. */
}
char * PMAPI PM_getCurrentPath(
@@ -219,8 +219,8 @@ const char * PMAPI PM_getNucleusConfigPath(void)
const char * PMAPI PM_getUniqueID(void)
{
- // TODO: Return a unique ID for the machine. If a unique ID is not
- // available, return the machine name.
+ /* TODO: Return a unique ID for the machine. If a unique ID is not */
+ /* available, return the machine name. */
static char buf[128];
gethostname(buf, 128);
return buf;
@@ -228,7 +228,7 @@ const char * PMAPI PM_getUniqueID(void)
const char * PMAPI PM_getMachineName(void)
{
- // TODO: Return the network machine name for the machine.
+ /* TODO: Return the network machine name for the machine. */
static char buf[128];
gethostname(buf, 128);
return buf;
@@ -236,7 +236,7 @@ const char * PMAPI PM_getMachineName(void)
void * PMAPI PM_getBIOSPointer(void)
{
- // No BIOS access on the BeOS
+ /* No BIOS access on the BeOS */
return NULL;
}
@@ -244,212 +244,212 @@ void * PMAPI PM_getA0000Pointer(void)
{
static void *bankPtr;
if (!bankPtr)
- bankPtr = PM_mapPhysicalAddr(0xA0000,0xFFFF,true);
+ bankPtr = PM_mapPhysicalAddr(0xA0000,0xFFFF,true);
return bankPtr;
}
void * PMAPI PM_mapPhysicalAddr(ulong base,ulong limit,ibool isCached)
{
- // TODO: This function maps a physical memory address to a linear
- // address in the address space of the calling process.
-
- // NOTE: This function *must* be able to handle any phsyical base
- // address, and hence you will have to handle rounding of
- // the physical base address to a page boundary (ie: 4Kb on
- // x86 CPU's) to be able to properly map in the memory
- // region.
-
- // NOTE: If possible the isCached bit should be used to ensure that
- // the PCD (Page Cache Disable) and PWT (Page Write Through)
- // bits are set to disable caching for a memory mapping used
- // for MMIO register access. We also disable caching using
- // the MTRR registers for Pentium Pro and later chipsets so if
- // MTRR support is enabled for your OS then you can safely ignore
- // the isCached flag and always enable caching in the page
- // tables.
+ /* TODO: This function maps a physical memory address to a linear */
+ /* address in the address space of the calling process. */
+
+ /* NOTE: This function *must* be able to handle any phsyical base */
+ /* address, and hence you will have to handle rounding of */
+ /* the physical base address to a page boundary (ie: 4Kb on */
+ /* x86 CPU's) to be able to properly map in the memory */
+ /* region. */
+
+ /* NOTE: If possible the isCached bit should be used to ensure that */
+ /* the PCD (Page Cache Disable) and PWT (Page Write Through) */
+ /* bits are set to disable caching for a memory mapping used */
+ /* for MMIO register access. We also disable caching using */
+ /* the MTRR registers for Pentium Pro and later chipsets so if */
+ /* MTRR support is enabled for your OS then you can safely ignore */
+ /* the isCached flag and always enable caching in the page */
+ /* tables. */
return NULL;
}
void PMAPI PM_freePhysicalAddr(void *ptr,ulong limit)
{
- // TODO: This function will free a physical memory mapping previously
- // allocated with PM_mapPhysicalAddr() if at all possible. If
- // you can't free physical memory mappings, simply do nothing.
+ /* TODO: This function will free a physical memory mapping previously */
+ /* allocated with PM_mapPhysicalAddr() if at all possible. If */
+ /* you can't free physical memory mappings, simply do nothing. */
}
ulong PMAPI PM_getPhysicalAddr(void *p)
{
- // TODO: This function should find the physical address of a linear
- // address.
+ /* TODO: This function should find the physical address of a linear */
+ /* address. */
return 0xFFFFFFFFUL;
}
void PMAPI PM_sleep(ulong milliseconds)
{
- // TODO: Put the process to sleep for milliseconds
+ /* TODO: Put the process to sleep for milliseconds */
}
int PMAPI PM_getCOMPort(int port)
{
- // TODO: Re-code this to determine real values using the Plug and Play
- // manager for the OS.
+ /* TODO: Re-code this to determine real values using the Plug and Play */
+ /* manager for the OS. */
switch (port) {
- case 0: return 0x3F8;
- case 1: return 0x2F8;
- }
+ case 0: return 0x3F8;
+ case 1: return 0x2F8;
+ }
return 0;
}
int PMAPI PM_getLPTPort(int port)
{
- // TODO: Re-code this to determine real values using the Plug and Play
- // manager for the OS.
+ /* TODO: Re-code this to determine real values using the Plug and Play */
+ /* manager for the OS. */
switch (port) {
- case 0: return 0x3BC;
- case 1: return 0x378;
- case 2: return 0x278;
- }
+ case 0: return 0x3BC;
+ case 1: return 0x378;
+ case 2: return 0x278;
+ }
return 0;
}
void * PMAPI PM_mallocShared(long size)
{
- // TODO: This is used to allocate memory that is shared between process
- // that all access the common Nucleus drivers via a common display
- // driver DLL. If your OS does not support shared memory (or if
- // the display driver does not need to allocate shared memory
- // for each process address space), this should just call PM_malloc.
+ /* TODO: This is used to allocate memory that is shared between process */
+ /* that all access the common Nucleus drivers via a common display */
+ /* driver DLL. If your OS does not support shared memory (or if */
+ /* the display driver does not need to allocate shared memory */
+ /* for each process address space), this should just call PM_malloc. */
return PM_malloc(size);
}
void PMAPI PM_freeShared(void *ptr)
{
- // TODO: Free the shared memory block. This will be called in the context
- // of the original calling process that allocated the shared
- // memory with PM_mallocShared. Simply call free if you do not
- // need this.
+ /* TODO: Free the shared memory block. This will be called in the context */
+ /* of the original calling process that allocated the shared */
+ /* memory with PM_mallocShared. Simply call free if you do not */
+ /* need this. */
PM_free(ptr);
}
void * PMAPI PM_mapToProcess(void *base,ulong limit)
{
- // TODO: This function is used to map a physical memory mapping
- // previously allocated with PM_mapPhysicalAddr into the
- // address space of the calling process. If the memory mapping
- // allocated by PM_mapPhysicalAddr is global to all processes,
- // simply return the pointer.
+ /* TODO: This function is used to map a physical memory mapping */
+ /* previously allocated with PM_mapPhysicalAddr into the */
+ /* address space of the calling process. If the memory mapping */
+ /* allocated by PM_mapPhysicalAddr is global to all processes, */
+ /* simply return the pointer. */
return base;
}
void * PMAPI PM_mapRealPointer(uint r_seg,uint r_off)
{
- // No BIOS access on the BeOS
+ /* No BIOS access on the BeOS */
return NULL;
}
void * PMAPI PM_allocRealSeg(uint size,uint *r_seg,uint *r_off)
{
- // No BIOS access on the BeOS
+ /* No BIOS access on the BeOS */
return NULL;
}
void PMAPI PM_freeRealSeg(void *mem)
{
- // No BIOS access on the BeOS
+ /* No BIOS access on the BeOS */
}
void PMAPI DPMI_int86(int intno, DPMI_regs *regs)
{
- // No BIOS access on the BeOS
+ /* No BIOS access on the BeOS */
}
int PMAPI PM_int86(int intno, RMREGS *in, RMREGS *out)
{
- // No BIOS access on the BeOS
+ /* No BIOS access on the BeOS */
return 0;
}
int PMAPI PM_int86x(int intno, RMREGS *in, RMREGS *out,
RMSREGS *sregs)
{
- // No BIOS access on the BeOS
+ /* No BIOS access on the BeOS */
return 0;
}
void PMAPI PM_callRealMode(uint seg,uint off, RMREGS *in,
RMSREGS *sregs)
{
- // No BIOS access on the BeOS
+ /* No BIOS access on the BeOS */
}
void PMAPI PM_availableMemory(ulong *physical,ulong *total)
{
- // TODO: Report the amount of available memory, both the amount of
- // physical memory left and the amount of virtual memory left.
- // If the OS does not provide these services, report 0's.
+ /* TODO: Report the amount of available memory, both the amount of */
+ /* physical memory left and the amount of virtual memory left. */
+ /* If the OS does not provide these services, report 0's. */
*physical = *total = 0;
}
void * PMAPI PM_allocLockedMem(uint size,ulong *physAddr,ibool contiguous,ibool below16Meg)
{
- // TODO: Allocate a block of locked, physical memory of the specified
- // size. This is used for bus master operations. If this is not
- // supported by the OS, return NULL and bus mastering will not
- // be used.
+ /* TODO: Allocate a block of locked, physical memory of the specified */
+ /* size. This is used for bus master operations. If this is not */
+ /* supported by the OS, return NULL and bus mastering will not */
+ /* be used. */
return NULL;
}
void PMAPI PM_freeLockedMem(void *p,uint size,ibool contiguous)
{
- // TODO: Free a memory block allocated with PM_allocLockedMem.
+ /* TODO: Free a memory block allocated with PM_allocLockedMem. */
}
void PMAPI PM_setBankA(int bank)
{
- // No BIOS access on the BeOS
+ /* No BIOS access on the BeOS */
}
void PMAPI PM_setBankAB(int bank)
{
- // No BIOS access on the BeOS
+ /* No BIOS access on the BeOS */
}
void PMAPI PM_setCRTStart(int x,int y,int waitVRT)
{
- // No BIOS access on the BeOS
+ /* No BIOS access on the BeOS */
}
ibool PMAPI PM_enableWriteCombine(ulong base,ulong length,uint type)
{
- // TODO: This function should enable Pentium Pro and Pentium II MTRR
- // write combining for the passed in physical memory base address
- // and length. Normally this is done via calls to an OS specific
- // device driver as this can only be done at ring 0.
- //
- // NOTE: This is a *very* important function to implement! If you do
- // not implement, graphics performance on the latest Intel chips
- // will be severly impaired. For sample code that can be used
- // directly in a ring 0 device driver, see the MSDOS implementation
- // which includes assembler code to do this directly (if the
- // program is running at ring 0).
+ /* TODO: This function should enable Pentium Pro and Pentium II MTRR */
+ /* write combining for the passed in physical memory base address */
+ /* and length. Normally this is done via calls to an OS specific */
+ /* device driver as this can only be done at ring 0. */
+ /* */
+ /* NOTE: This is a *very* important function to implement! If you do */
+ /* not implement, graphics performance on the latest Intel chips */
+ /* will be severly impaired. For sample code that can be used */
+ /* directly in a ring 0 device driver, see the MSDOS implementation */
+ /* which includes assembler code to do this directly (if the */
+ /* program is running at ring 0). */
return false;
}
ibool PMAPI PM_doBIOSPOST(ushort axVal,ulong BIOSPhysAddr,void *mappedBIOS)
{
- // TODO: This function is used to run the BIOS POST code on a secondary
- // controller to initialise it for use. This is not necessary
- // for multi-controller operation, but it will make it a lot
- // more convenicent for end users (otherwise they have to boot
- // the system once with the secondary controller as primary, and
- // then boot with both controllers installed).
- //
- // Even if you don't support full BIOS access, it would be
- // adviseable to be able to POST the secondary controllers in the
- // system using this function as a minimum requirement. Some
- // graphics hardware has registers that contain values that only
- // the BIOS knows about, which makes bring up a card from cold
- // reset difficult if the BIOS has not POST'ed it.
+ /* TODO: This function is used to run the BIOS POST code on a secondary */
+ /* controller to initialise it for use. This is not necessary */
+ /* for multi-controller operation, but it will make it a lot */
+ /* more convenicent for end users (otherwise they have to boot */
+ /* the system once with the secondary controller as primary, and */
+ /* then boot with both controllers installed). */
+ /* */
+ /* Even if you don't support full BIOS access, it would be */
+ /* adviseable to be able to POST the secondary controllers in the */
+ /* system using this function as a minimum requirement. Some */
+ /* graphics hardware has registers that contain values that only */
+ /* the BIOS knows about, which makes bring up a card from cold */
+ /* reset difficult if the BIOS has not POST'ed it. */
return false;
}
@@ -506,7 +506,7 @@ ibool PMAPI PM_driveValid(
char drive)
{
if (drive == 3)
- return true;
+ return true;
return false;
}
@@ -533,7 +533,7 @@ void PMAPI PM_setFileAttr(
const char *filename,
uint attrib)
{
- // TODO: Set the file attributes for a file
+ /* TODO: Set the file attributes for a file */
(void)filename;
(void)attrib;
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/beos/ztimer.c b/board/MAI/bios_emulator/scitech/src/pm/beos/ztimer.c
index a5637a5ecf..a528b73177 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/beos/ztimer.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/beos/ztimer.c
@@ -36,7 +36,7 @@ Initialise the Zen Timer module internals.
****************************************************************************/
void _ZTimerInit(void)
{
- // TODO: Do any specific internal initialisation in here
+ /* TODO: Do any specific internal initialisation in here */
}
/****************************************************************************
@@ -46,8 +46,8 @@ Start the Zen Timer counting.
static void _LZTimerOn(
LZTimerObject *tm)
{
- // TODO: Start the Zen Timer counting. This should be a macro if
- // possible.
+ /* TODO: Start the Zen Timer counting. This should be a macro if */
+ /* possible. */
}
/****************************************************************************
@@ -57,8 +57,8 @@ Compute the lap time since the timer was started.
static ulong _LZTimerLap(
LZTimerObject *tm)
{
- // TODO: Compute the lap time between the current time and when the
- // timer was started.
+ /* TODO: Compute the lap time between the current time and when the */
+ /* timer was started. */
return 0;
}
@@ -69,7 +69,7 @@ Stop the Zen Timer counting.
static void _LZTimerOff(
LZTimerObject *tm)
{
- // TODO: Stop the timer counting. Should be a macro if possible.
+ /* TODO: Stop the timer counting. Should be a macro if possible. */
}
/****************************************************************************
@@ -79,7 +79,7 @@ Compute the elapsed time in microseconds between start and end timings.
static ulong _LZTimerCount(
LZTimerObject *tm)
{
- // TODO: Compute the elapsed time and return it. Always microseconds.
+ /* TODO: Compute the elapsed time and return it. Always microseconds. */
return 0;
}
@@ -95,9 +95,9 @@ Read the Long Period timer from the OS
****************************************************************************/
static ulong _ULZReadTime(void)
{
- // TODO: Read the long period timer from the OS. The resolution of this
- // timer should be around 1/20 of a second for timing long
- // periods if possible.
+ /* TODO: Read the long period timer from the OS. The resolution of this */
+ /* timer should be around 1/20 of a second for timing long */
+ /* periods if possible. */
}
/****************************************************************************
diff --git a/board/MAI/bios_emulator/scitech/src/pm/common.c b/board/MAI/bios_emulator/scitech/src/pm/common.c
index b100b8ad42..d5a8e8f1c7 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/common.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/common.c
@@ -98,9 +98,9 @@ static ibool TryPath(
strcpy(filename,bpdpath);
strcat(filename,dllname);
if ((f = fopen(filename,"rb")) == NULL)
- return false;
+ return false;
if (cachedpath)
- strcpy(cachedpath,bpdpath);
+ strcpy(cachedpath,bpdpath);
fclose(f);
return true;
}
@@ -121,20 +121,20 @@ static ibool GetLocalOverride(void)
static ibool local_override = -1;
if (local_override == -1) {
- local_override = false;
- strcpy(filename,PM_getNucleusPath());
- PM_backslash(filename);
- strcat(filename,"graphics.ini");
- if ((f = fopen(filename,"r")) != NULL) {
- while (!feof(f) && fgets(filename,sizeof(filename),f)) {
- if (strnicmp(filename,"uselocal",8) == 0) {
- local_override = ((*(filename+9) - '0') == 1);
- break;
- }
- }
- fclose(f);
- }
- }
+ local_override = false;
+ strcpy(filename,PM_getNucleusPath());
+ PM_backslash(filename);
+ strcat(filename,"graphics.ini");
+ if ((f = fopen(filename,"r")) != NULL) {
+ while (!feof(f) && fgets(filename,sizeof(filename),f)) {
+ if (strnicmp(filename,"uselocal",8) == 0) {
+ local_override = ((*(filename+9) - '0') == 1);
+ break;
+ }
+ }
+ fclose(f);
+ }
+ }
return local_override;
}
@@ -164,44 +164,44 @@ ibool PMAPI PM_findBPD(
/* On the first call determine the path to the Nucleus drivers */
if (cachedpath[0] == 0) {
- /* First try in the global system Nucleus driver path if
- * the local override setting is not enabled.
- */
- PM_init();
- if (!GetLocalOverride()) {
- if (TryPath(bpdpath,cachedpath,PM_getNucleusPath(),"",dllname))
- return true;
- }
-
- /* Next try in the local application directory if available */
- if (localBPDPath[0] != 0) {
- if (TryPath(bpdpath,cachedpath,localBPDPath,"",dllname))
- return true;
- }
- else {
+ /* First try in the global system Nucleus driver path if
+ * the local override setting is not enabled.
+ */
+ PM_init();
+ if (!GetLocalOverride()) {
+ if (TryPath(bpdpath,cachedpath,PM_getNucleusPath(),"",dllname))
+ return true;
+ }
+
+ /* Next try in the local application directory if available */
+ if (localBPDPath[0] != 0) {
+ if (TryPath(bpdpath,cachedpath,localBPDPath,"",dllname))
+ return true;
+ }
+ else {
#if !defined(__WIN32_VXD__) && !defined(__NT_DRIVER__)
- char *mgl_root;
- if ((mgl_root = getenv("MGL_ROOT")) != NULL) {
- if (TryPath(bpdpath,cachedpath,mgl_root,"drivers",dllname))
- return true;
- }
+ char *mgl_root;
+ if ((mgl_root = getenv("MGL_ROOT")) != NULL) {
+ if (TryPath(bpdpath,cachedpath,mgl_root,"drivers",dllname))
+ return true;
+ }
#endif
- PM_getCurrentPath(bpdpath,PM_MAX_PATH);
- if (TryPath(bpdpath,cachedpath,bpdpath,"drivers",dllname))
- return true;
- }
-
- /* Finally try in the global system path again so that we
- * will still find the drivers in the global system path if
- * the local override option is on, but the application does
- * not have any local override drivers.
- */
- if (TryPath(bpdpath,cachedpath,PM_getNucleusPath(),"",dllname))
- return true;
-
- /* Whoops, we can't find the BPD file! */
- return false;
- }
+ PM_getCurrentPath(bpdpath,PM_MAX_PATH);
+ if (TryPath(bpdpath,cachedpath,bpdpath,"drivers",dllname))
+ return true;
+ }
+
+ /* Finally try in the global system path again so that we
+ * will still find the drivers in the global system path if
+ * the local override option is on, but the application does
+ * not have any local override drivers.
+ */
+ if (TryPath(bpdpath,cachedpath,PM_getNucleusPath(),"",dllname))
+ return true;
+
+ /* Whoops, we can't find the BPD file! */
+ return false;
+ }
/* Always try in the previously discovered path */
return TryPath(bpdpath,NULL,cachedpath,"",dllname);
@@ -216,9 +216,9 @@ static char *_stpcpy(
const char *_src)
{
if (!_dest || !_src)
- return 0;
+ return 0;
while ((*_dest++ = *_src++) != 0)
- ;
+ ;
return --_dest;
}
@@ -233,13 +233,13 @@ static void safe_strncpy(
unsigned maxlen)
{
if (dst) {
- if(strlen(src) >= maxlen) {
- strncpy(dst, src, maxlen);
- dst[maxlen] = 0;
- }
- else
- strcpy(dst, src);
- }
+ if(strlen(src) >= maxlen) {
+ strncpy(dst, src, maxlen);
+ dst[maxlen] = 0;
+ }
+ else
+ strcpy(dst, src);
+ }
}
/****************************************************************************
@@ -250,16 +250,16 @@ static int findDot(
char *p)
{
if (*(p-1) == '.')
- p--;
+ p--;
switch (*--p) {
- case ':':
- if (*(p-2) != '\0')
- break;
- case '/':
- case '\\':
- case '\0':
- return true;
- }
+ case ':':
+ if (*(p-2) != '\0')
+ break;
+ case '/':
+ case '\\':
+ case '\0':
+ return true;
+ }
return false;
}
@@ -299,25 +299,25 @@ void PMAPI PM_makepath(
const char *ext)
{
if (drive && *drive) {
- *path++ = *drive;
- *path++ = ':';
- }
+ *path++ = *drive;
+ *path++ = ':';
+ }
if (dir && *dir) {
- path = _stpcpy(path,dir);
- if (*(path-1) != '\\' && *(path-1) != '/')
+ path = _stpcpy(path,dir);
+ if (*(path-1) != '\\' && *(path-1) != '/')
#ifdef __UNIX__
- *path++ = '/';
+ *path++ = '/';
#else
- *path++ = '\\';
+ *path++ = '\\';
#endif
- }
+ }
if (name)
- path = _stpcpy(path,name);
+ path = _stpcpy(path,name);
if (ext && *ext) {
- if (*ext != '.')
- *path++ = '.';
- path = _stpcpy(path,ext);
- }
+ if (*ext != '.')
+ *path++ = '.';
+ path = _stpcpy(path,ext);
+ }
*path = 0;
}
@@ -377,7 +377,7 @@ int PMAPI PM_splitpath(
/* Copy filename into template up to PM_MAX_PATH characters */
p = buf;
if ((temp = strlen(path)) > PM_MAX_PATH)
- temp = PM_MAX_PATH;
+ temp = PM_MAX_PATH;
*p++ = 0;
strncpy(p, path, temp);
*(p += temp) = 0;
@@ -385,53 +385,53 @@ int PMAPI PM_splitpath(
/* Split the filename and fill corresponding nonzero pointers */
temp = 0;
for (;;) {
- switch (*--p) {
- case '.':
- if (!temp && (*(p+1) == '\0'))
- temp = findDot(p);
- if ((!temp) && ((ret & PM_HAS_EXTENSION) == 0)) {
- ret |= PM_HAS_EXTENSION;
- safe_strncpy(ext, p, PM_MAX_PATH - 1);
- *p = 0;
- }
- continue;
- case ':':
- if (p != &buf[2])
- continue;
- case '\0':
- if (temp) {
- if (*++p)
- ret |= PM_HAS_DIRECTORY;
- safe_strncpy(dir, p, PM_MAX_PATH - 1);
- *p-- = 0;
- break;
- }
- case '/':
- case '\\':
- if (!temp) {
- temp++;
- if (*++p)
- ret |= PM_HAS_FILENAME;
- safe_strncpy(name, p, PM_MAX_PATH - 1);
- *p-- = 0;
- if (*p == 0 || (*p == ':' && p == &buf[2]))
- break;
- }
- continue;
- case '*':
- case '?':
- if (!temp)
- ret |= PM_HAS_WILDCARDS;
- default:
- continue;
- }
- break;
- }
+ switch (*--p) {
+ case '.':
+ if (!temp && (*(p+1) == '\0'))
+ temp = findDot(p);
+ if ((!temp) && ((ret & PM_HAS_EXTENSION) == 0)) {
+ ret |= PM_HAS_EXTENSION;
+ safe_strncpy(ext, p, PM_MAX_PATH - 1);
+ *p = 0;
+ }
+ continue;
+ case ':':
+ if (p != &buf[2])
+ continue;
+ case '\0':
+ if (temp) {
+ if (*++p)
+ ret |= PM_HAS_DIRECTORY;
+ safe_strncpy(dir, p, PM_MAX_PATH - 1);
+ *p-- = 0;
+ break;
+ }
+ case '/':
+ case '\\':
+ if (!temp) {
+ temp++;
+ if (*++p)
+ ret |= PM_HAS_FILENAME;
+ safe_strncpy(name, p, PM_MAX_PATH - 1);
+ *p-- = 0;
+ if (*p == 0 || (*p == ':' && p == &buf[2]))
+ break;
+ }
+ continue;
+ case '*':
+ case '?':
+ if (!temp)
+ ret |= PM_HAS_WILDCARDS;
+ default:
+ continue;
+ }
+ break;
+ }
if (*p == ':') {
- if (buf[1])
- ret |= PM_HAS_DRIVE;
- safe_strncpy(drive, &buf[1], PM_MAX_DRIVE - 1);
- }
+ if (buf[1])
+ ret |= PM_HAS_DRIVE;
+ safe_strncpy(drive, &buf[1], PM_MAX_DRIVE - 1);
+ }
return ret;
}
@@ -466,15 +466,15 @@ void PMAPI PM_blockUntilTimeout(
static ibool firstTime = true;
if (firstTime) {
- firstTime = false;
- LZTimerOnExt(&tm);
- }
+ firstTime = false;
+ LZTimerOnExt(&tm);
+ }
else {
- if ((msDelay = (microseconds - LZTimerLapExt(&tm)) / 1000L) > 0)
- PM_sleep(msDelay);
- while (LZTimerLapExt(&tm) < microseconds)
- ;
- LZTimerOffExt(&tm);
- LZTimerOnExt(&tm);
- }
+ if ((msDelay = (microseconds - LZTimerLapExt(&tm)) / 1000L) > 0)
+ PM_sleep(msDelay);
+ while (LZTimerLapExt(&tm) < microseconds)
+ ;
+ LZTimerOffExt(&tm);
+ LZTimerOnExt(&tm);
+ }
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/common/agp.c b/board/MAI/bios_emulator/scitech/src/pm/common/agp.c
index 23f7e1e145..d53bc88e14 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/common/agp.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/common/agp.c
@@ -54,22 +54,22 @@ size of the available AGP aperture in megabytes.
ulong PMAPI PM_agpInit(void)
{
if ((agp = AGP_loadDriver(0)) == NULL)
- return 0;
+ return 0;
driver.dwSize = sizeof(driver);
if (!agp->QueryFunctions(AGP_GET_DRIVERFUNCS,&driver))
- return 0;
+ return 0;
switch (driver.GetApertureSize()) {
- case agpSize4MB: return 4;
- case agpSize8MB: return 8;
- case agpSize16MB: return 16;
- case agpSize32MB: return 32;
- case agpSize64MB: return 64;
- case agpSize128MB: return 128;
- case agpSize256MB: return 256;
- case agpSize512MB: return 512;
- case agpSize1GB: return 1024;
- case agpSize2GB: return 2048;
- }
+ case agpSize4MB: return 4;
+ case agpSize8MB: return 8;
+ case agpSize16MB: return 16;
+ case agpSize32MB: return 32;
+ case agpSize64MB: return 64;
+ case agpSize128MB: return 128;
+ case agpSize256MB: return 256;
+ case agpSize512MB: return 512;
+ case agpSize1GB: return 1024;
+ case agpSize2GB: return 2048;
+ }
return 0;
}
@@ -106,18 +106,18 @@ ibool PMAPI PM_agpReservePhysical(
PM_physAddr *physAddr)
{
switch (type) {
- case PM_agpUncached:
- type = agpUncached;
- break;
- case PM_agpWriteCombine:
- type = agpWriteCombine;
- break;
- case PM_agpIntelDCACHE:
- type = agpIntelDCACHE;
- break;
- default:
- return false;
- }
+ case PM_agpUncached:
+ type = agpUncached;
+ break;
+ case PM_agpWriteCombine:
+ type = agpWriteCombine;
+ break;
+ case PM_agpIntelDCACHE:
+ type = agpIntelDCACHE;
+ break;
+ default:
+ return false;
+ }
return driver.ReservePhysical(numPages,type,physContext,physAddr) == nOK;
}
@@ -187,4 +187,3 @@ ibool PMAPI PM_agpFreePhysical(
}
#endif /* !REALMODE */
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/common/keyboard.c b/board/MAI/bios_emulator/scitech/src/pm/common/keyboard.c
index 79b4040ac1..36867bdba7 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/common/keyboard.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/common/keyboard.c
@@ -52,18 +52,18 @@ static uchar translateScan(
int n,pivot,val;
for (n = count; n > 0; ) {
- pivot = n >> 1;
- test = table + pivot;
- val = scanCode - test->scanCode;
- if (val < 0)
- n = pivot;
- else if (val == 0)
- return test->asciiCode;
- else {
- table = test + 1;
- n -= pivot + 1;
- }
- }
+ pivot = n >> 1;
+ test = table + pivot;
+ val = scanCode - test->scanCode;
+ if (val < 0)
+ n = pivot;
+ else if (val == 0)
+ return test->asciiCode;
+ else {
+ table = test + 1;
+ n -= pivot + 1;
+ }
+ }
return 0;
}
@@ -84,35 +84,35 @@ void _EVT_maskKeyCode(
evt->message &= ~0xFF;
if (evt->modifiers & EVT_NUMLOCK) {
- if ((ascii = translateScan(scan,EVT.codePage->numPad,EVT.codePage->numPadLen)) != 0) {
- evt->message |= ascii;
- return;
- }
- }
+ if ((ascii = translateScan(scan,EVT.codePage->numPad,EVT.codePage->numPadLen)) != 0) {
+ evt->message |= ascii;
+ return;
+ }
+ }
if (evt->modifiers & EVT_CTRLSTATE) {
- evt->message |= translateScan(scan,EVT.codePage->ctrl,EVT.codePage->ctrlLen);
- return;
- }
+ evt->message |= translateScan(scan,EVT.codePage->ctrl,EVT.codePage->ctrlLen);
+ return;
+ }
if (evt->modifiers & EVT_CAPSLOCK) {
- if (evt->modifiers & EVT_SHIFTKEY) {
- if ((ascii = translateScan(scan,EVT.codePage->shiftCaps,EVT.codePage->shiftCapsLen)) != 0) {
- evt->message |= ascii;
- return;
- }
- }
- else {
- if ((ascii = translateScan(scan,EVT.codePage->caps,EVT.codePage->capsLen)) != 0) {
- evt->message |= ascii;
- return;
- }
- }
- }
+ if (evt->modifiers & EVT_SHIFTKEY) {
+ if ((ascii = translateScan(scan,EVT.codePage->shiftCaps,EVT.codePage->shiftCapsLen)) != 0) {
+ evt->message |= ascii;
+ return;
+ }
+ }
+ else {
+ if ((ascii = translateScan(scan,EVT.codePage->caps,EVT.codePage->capsLen)) != 0) {
+ evt->message |= ascii;
+ return;
+ }
+ }
+ }
if (evt->modifiers & EVT_SHIFTKEY) {
- if ((ascii = translateScan(scan,EVT.codePage->shift,EVT.codePage->shiftLen)) != 0) {
- evt->message |= ascii;
- return;
- }
- }
+ if ((ascii = translateScan(scan,EVT.codePage->shift,EVT.codePage->shiftLen)) != 0) {
+ evt->message |= ascii;
+ return;
+ }
+ }
evt->message |= translateScan(scan,EVT.codePage->normal,EVT.codePage->normalLen);
}
@@ -124,9 +124,9 @@ static ibool _EVT_isKeyDown(
uchar scanCode)
{
if (scanCode > 0x7F)
- return false;
+ return false;
else
- return EVT.keyTable[scanCode] != 0;
+ return EVT.keyTable[scanCode] != 0;
}
/****************************************************************************
@@ -139,7 +139,7 @@ Adds a new keyboard event to the event queue. This routine is called from
within the keyboard interrupt subroutine!
NOTE: Interrupts are OFF when this routine is called by the keyboard ISR,
- and we leave them OFF the entire time.
+ and we leave them OFF the entire time.
****************************************************************************/
static void addKeyEvent(
uint what,
@@ -148,31 +148,31 @@ static void addKeyEvent(
event_t evt;
if (EVT.count < EVENTQSIZE) {
- /* Save information in event record */
- evt.when = _EVT_getTicks();
- evt.what = what;
- evt.message = message | 0x10000UL;
- evt.where_x = 0;
- evt.where_y = 0;
- evt.relative_x = 0;
- evt.relative_y = 0;
- evt.modifiers = EVT.keyModifiers;
- if (evt.what == EVT_KEYREPEAT) {
- if (EVT.oldKey != -1)
- EVT.evtq[EVT.oldKey].message += 0x10000UL;
- else {
- EVT.oldKey = EVT.freeHead;
- addEvent(&evt); /* Add to tail of event queue */
- }
- }
- else {
+ /* Save information in event record */
+ evt.when = _EVT_getTicks();
+ evt.what = what;
+ evt.message = message | 0x10000UL;
+ evt.where_x = 0;
+ evt.where_y = 0;
+ evt.relative_x = 0;
+ evt.relative_y = 0;
+ evt.modifiers = EVT.keyModifiers;
+ if (evt.what == EVT_KEYREPEAT) {
+ if (EVT.oldKey != -1)
+ EVT.evtq[EVT.oldKey].message += 0x10000UL;
+ else {
+ EVT.oldKey = EVT.freeHead;
+ addEvent(&evt); /* Add to tail of event queue */
+ }
+ }
+ else {
#ifdef __QNX__
- _EVT_maskKeyCode(&evt);
+ _EVT_maskKeyCode(&evt);
#endif
- addEvent(&evt); /* Add to tail of event queue */
- }
- EVT.oldMove = -1;
- }
+ addEvent(&evt); /* Add to tail of event queue */
+ }
+ EVT.oldMove = -1;
+ }
}
/****************************************************************************
@@ -184,7 +184,7 @@ static int kbWaitForWriteReady(void)
{
int timeout = 8192;
while ((timeout > 0) && (PM_inpb(0x64) & 0x02))
- timeout--;
+ timeout--;
return (timeout > 0);
}
@@ -197,7 +197,7 @@ static int kbWaitForReadReady(void)
{
int timeout = 8192;
while ((timeout > 0) && (!(PM_inpb(0x64) & 0x01)))
- timeout--;
+ timeout--;
return (timeout > 0);
}
@@ -215,20 +215,20 @@ static int kbSendData(
int timeout, temp;
do {
- if (!kbWaitForWriteReady())
- return 0;
- PM_outpb(0x60,data);
- timeout = 8192;
- while (--timeout > 0) {
- if (!kbWaitForReadReady())
- return 0;
- temp = PM_inpb(0x60);
- if (temp == 0xFA)
- return 1;
- if (temp == 0xFE)
- break;
- }
- } while ((resends-- > 0) && (timeout > 0));
+ if (!kbWaitForWriteReady())
+ return 0;
+ PM_outpb(0x60,data);
+ timeout = 8192;
+ while (--timeout > 0) {
+ if (!kbWaitForReadReady())
+ return 0;
+ temp = PM_inpb(0x60);
+ if (temp == 0xFA)
+ return 1;
+ if (temp == 0xFE)
+ break;
+ }
+ } while ((resends-- > 0) && (timeout > 0));
return 0;
}
@@ -245,10 +245,10 @@ static void setLEDS(
uint modifiers)
{
if (EVT.allowLEDS) {
- if (!kbSendData(0xED) || !kbSendData((modifiers>>9) & 7)) {
- kbSendData(0xF4);
- }
- }
+ if (!kbSendData(0xED) || !kbSendData((modifiers>>9) & 7)) {
+ kbSendData(0xF4);
+ }
+ }
}
/****************************************************************************
@@ -256,7 +256,7 @@ REMARKS:
Function to process raw scan codes read from the keyboard controller.
NOTE: Interrupts are OFF when this routine is called by the keyboard ISR,
- and we leave them OFF the entire time.
+ and we leave them OFF the entire time.
{secret}
****************************************************************************/
void processRawScanCode(
@@ -267,156 +267,156 @@ void processRawScanCode(
int what;
if (pauseLoop) {
- /* Skip scan codes until the pause key sequence has been read */
- pauseLoop--;
- }
+ /* Skip scan codes until the pause key sequence has been read */
+ pauseLoop--;
+ }
else if (scan == 0xE0) {
- /* This signals the start of an extended scan code sequence */
- extended = 1;
- }
+ /* This signals the start of an extended scan code sequence */
+ extended = 1;
+ }
else if (scan == 0xE1) {
- /* The Pause key sends a strange scan code sequence, which is:
- *
- * E1 1D 52 E1 9D D2
- *
- * However there is never any release code nor any auto-repeat for
- * this key. For this reason we simply ignore the key and skip the
- * next 5 scan codes read from the keyboard.
- */
- pauseLoop = 5;
- }
+ /* The Pause key sends a strange scan code sequence, which is:
+ *
+ * E1 1D 52 E1 9D D2
+ *
+ * However there is never any release code nor any auto-repeat for
+ * this key. For this reason we simply ignore the key and skip the
+ * next 5 scan codes read from the keyboard.
+ */
+ pauseLoop = 5;
+ }
else {
- /* Process the scan code normally (it may be an extended code
- * however!). Bit 7 means key was released, and bits 0-6 are the
- * scan code.
- */
- what = (scan & 0x80) ? EVT_KEYUP : EVT_KEYDOWN;
- scan &= 0x7F;
- if (extended) {
- extended = 0;
- if (scan == 0x2A || scan == 0x36) {
- /* Ignore these extended scan code sequences. These are
- * used by the keyboard controller to wrap around certain
- * key sequences for the keypad (and when NUMLOCK is down
- * internally).
- */
- return;
- }
+ /* Process the scan code normally (it may be an extended code
+ * however!). Bit 7 means key was released, and bits 0-6 are the
+ * scan code.
+ */
+ what = (scan & 0x80) ? EVT_KEYUP : EVT_KEYDOWN;
+ scan &= 0x7F;
+ if (extended) {
+ extended = 0;
+ if (scan == 0x2A || scan == 0x36) {
+ /* Ignore these extended scan code sequences. These are
+ * used by the keyboard controller to wrap around certain
+ * key sequences for the keypad (and when NUMLOCK is down
+ * internally).
+ */
+ return;
+ }
- /* Convert extended codes for key sequences that we map to
- * virtual scan codes so the user can detect them in their
- * code.
- */
- switch (scan) {
- case KB_leftCtrl: scan = KB_rightCtrl; break;
- case KB_leftAlt: scan = KB_rightAlt; break;
- case KB_divide: scan = KB_padDivide; break;
- case KB_enter: scan = KB_padEnter; break;
- case KB_padTimes: scan = KB_sysReq; break;
- }
- }
- else {
- /* Convert regular scan codes for key sequences that we map to
- * virtual scan codes so the user can detect them in their
- * code.
- */
- switch (scan) {
- case KB_left: scan = KB_padLeft; break;
- case KB_right: scan = KB_padRight; break;
- case KB_up: scan = KB_padUp; break;
- case KB_down: scan = KB_padDown; break;
- case KB_insert: scan = KB_padInsert; break;
- case KB_delete: scan = KB_padDelete; break;
- case KB_home: scan = KB_padHome; break;
- case KB_end: scan = KB_padEnd; break;
- case KB_pageUp: scan = KB_padPageUp; break;
- case KB_pageDown: scan = KB_padPageDown; break;
- }
- }
+ /* Convert extended codes for key sequences that we map to
+ * virtual scan codes so the user can detect them in their
+ * code.
+ */
+ switch (scan) {
+ case KB_leftCtrl: scan = KB_rightCtrl; break;
+ case KB_leftAlt: scan = KB_rightAlt; break;
+ case KB_divide: scan = KB_padDivide; break;
+ case KB_enter: scan = KB_padEnter; break;
+ case KB_padTimes: scan = KB_sysReq; break;
+ }
+ }
+ else {
+ /* Convert regular scan codes for key sequences that we map to
+ * virtual scan codes so the user can detect them in their
+ * code.
+ */
+ switch (scan) {
+ case KB_left: scan = KB_padLeft; break;
+ case KB_right: scan = KB_padRight; break;
+ case KB_up: scan = KB_padUp; break;
+ case KB_down: scan = KB_padDown; break;
+ case KB_insert: scan = KB_padInsert; break;
+ case KB_delete: scan = KB_padDelete; break;
+ case KB_home: scan = KB_padHome; break;
+ case KB_end: scan = KB_padEnd; break;
+ case KB_pageUp: scan = KB_padPageUp; break;
+ case KB_pageDown: scan = KB_padPageDown; break;
+ }
+ }
- /* Determine if the key is an UP, DOWN or REPEAT and maintain the
- * up/down status of all keys in our global key array.
- */
- if (what == EVT_KEYDOWN) {
- if (EVT.keyTable[scan])
- what = EVT_KEYREPEAT;
- else
- EVT.keyTable[scan] = scan;
- }
- else {
- EVT.keyTable[scan] = 0;
- }
+ /* Determine if the key is an UP, DOWN or REPEAT and maintain the
+ * up/down status of all keys in our global key array.
+ */
+ if (what == EVT_KEYDOWN) {
+ if (EVT.keyTable[scan])
+ what = EVT_KEYREPEAT;
+ else
+ EVT.keyTable[scan] = scan;
+ }
+ else {
+ EVT.keyTable[scan] = 0;
+ }
- /* Handle shift key modifiers */
- if (what != EVT_KEYREPEAT) {
- switch (scan) {
- case KB_capsLock:
- if (what == EVT_KEYDOWN)
- EVT.keyModifiers ^= EVT_CAPSLOCK;
- setLEDS(EVT.keyModifiers);
- break;
- case KB_numLock:
- if (what == EVT_KEYDOWN)
- EVT.keyModifiers ^= EVT_NUMLOCK;
- setLEDS(EVT.keyModifiers);
- break;
- case KB_scrollLock:
- if (what == EVT_KEYDOWN)
- EVT.keyModifiers ^= EVT_SCROLLLOCK;
- setLEDS(EVT.keyModifiers);
- break;
- case KB_leftShift:
- if (what == EVT_KEYUP)
- EVT.keyModifiers &= ~EVT_LEFTSHIFT;
- else
- EVT.keyModifiers |= EVT_LEFTSHIFT;
- break;
- case KB_rightShift:
- if (what == EVT_KEYUP)
- EVT.keyModifiers &= ~EVT_RIGHTSHIFT;
- else
- EVT.keyModifiers |= EVT_RIGHTSHIFT;
- break;
- case KB_leftCtrl:
- if (what == EVT_KEYUP)
- EVT.keyModifiers &= ~EVT_LEFTCTRL;
- else
- EVT.keyModifiers |= EVT_LEFTCTRL;
- break;
- case KB_rightCtrl:
- if (what == EVT_KEYUP)
- EVT.keyModifiers &= ~EVT_RIGHTCTRL;
- else
- EVT.keyModifiers |= EVT_RIGHTCTRL;
- break;
- case KB_leftAlt:
- if (what == EVT_KEYUP)
- EVT.keyModifiers &= ~EVT_LEFTALT;
- else
- EVT.keyModifiers |= EVT_LEFTALT;
- break;
- case KB_rightAlt:
- if (what == EVT_KEYUP)
- EVT.keyModifiers &= ~EVT_RIGHTALT;
- else
- EVT.keyModifiers |= EVT_RIGHTALT;
- break;
+ /* Handle shift key modifiers */
+ if (what != EVT_KEYREPEAT) {
+ switch (scan) {
+ case KB_capsLock:
+ if (what == EVT_KEYDOWN)
+ EVT.keyModifiers ^= EVT_CAPSLOCK;
+ setLEDS(EVT.keyModifiers);
+ break;
+ case KB_numLock:
+ if (what == EVT_KEYDOWN)
+ EVT.keyModifiers ^= EVT_NUMLOCK;
+ setLEDS(EVT.keyModifiers);
+ break;
+ case KB_scrollLock:
+ if (what == EVT_KEYDOWN)
+ EVT.keyModifiers ^= EVT_SCROLLLOCK;
+ setLEDS(EVT.keyModifiers);
+ break;
+ case KB_leftShift:
+ if (what == EVT_KEYUP)
+ EVT.keyModifiers &= ~EVT_LEFTSHIFT;
+ else
+ EVT.keyModifiers |= EVT_LEFTSHIFT;
+ break;
+ case KB_rightShift:
+ if (what == EVT_KEYUP)
+ EVT.keyModifiers &= ~EVT_RIGHTSHIFT;
+ else
+ EVT.keyModifiers |= EVT_RIGHTSHIFT;
+ break;
+ case KB_leftCtrl:
+ if (what == EVT_KEYUP)
+ EVT.keyModifiers &= ~EVT_LEFTCTRL;
+ else
+ EVT.keyModifiers |= EVT_LEFTCTRL;
+ break;
+ case KB_rightCtrl:
+ if (what == EVT_KEYUP)
+ EVT.keyModifiers &= ~EVT_RIGHTCTRL;
+ else
+ EVT.keyModifiers |= EVT_RIGHTCTRL;
+ break;
+ case KB_leftAlt:
+ if (what == EVT_KEYUP)
+ EVT.keyModifiers &= ~EVT_LEFTALT;
+ else
+ EVT.keyModifiers |= EVT_LEFTALT;
+ break;
+ case KB_rightAlt:
+ if (what == EVT_KEYUP)
+ EVT.keyModifiers &= ~EVT_RIGHTALT;
+ else
+ EVT.keyModifiers |= EVT_RIGHTALT;
+ break;
#ifdef SUPPORT_CTRL_ALT_DEL
- case KB_delete:
- if ((EVT.keyModifiers & EVT_CTRLSTATE) && (EVT.keyModifiers & EVT_ALTSTATE))
- Reboot();
- break;
+ case KB_delete:
+ if ((EVT.keyModifiers & EVT_CTRLSTATE) && (EVT.keyModifiers & EVT_ALTSTATE))
+ Reboot();
+ break;
#endif
- }
- }
+ }
+ }
- /* Add the untranslated key code to the event queue. All
- * translation to ASCII from the key codes occurs when the key
- * is extracted from the queue, saving time in the low level
- * interrupt handler.
- */
- addKeyEvent(what,scan << 8);
- }
+ /* Add the untranslated key code to the event queue. All
+ * translation to ASCII from the key codes occurs when the key
+ * is extracted from the queue, saving time in the low level
+ * interrupt handler.
+ */
+ addKeyEvent(what,scan << 8);
+ }
}
/****************************************************************************
@@ -442,9 +442,8 @@ void EVTAPI EVT_allowLEDS(
{
EVT.allowLEDS = true;
if (enable)
- setLEDS(EVT.keyModifiers);
+ setLEDS(EVT.keyModifiers);
else
- setLEDS(0);
+ setLEDS(0);
EVT.allowLEDS = enable;
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/common/mtrr.c b/board/MAI/bios_emulator/scitech/src/pm/common/mtrr.c
index d6ced6eadc..eed5f45c9e 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/common/mtrr.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/common/mtrr.c
@@ -106,26 +106,26 @@ static int MTRR_haveWriteCombine(void)
ulong config,dummy;
switch (cpuFamily) {
- case CPU_AMD:
- if (cpuType < CPU_AMDAthlon) {
- /* AMD K6-2 stepping 8 and later support the MTRR registers.
- * The earlier K6-2 steppings (300Mhz models) do not
- * support MTRR's.
- */
- if ((cpuType < CPU_AMDK6_2) || (cpuType == CPU_AMDK6_2 && cpuStepping < 8))
- return 0;
- return 1;
- }
- /* Fall through for AMD Athlon which uses P6 style MTRR's */
- case CPU_Intel:
- _MTRR_readMSR(INTEL_cap_MSR,&config,&dummy);
- return (config & (1 << 10));
- case CPU_Cyrix:
- /* Cyrix 6x86 and later support the MTRR registers */
- if (cpuType < CPU_Cyrix6x86)
- return 0;
- return 1;
- }
+ case CPU_AMD:
+ if (cpuType < CPU_AMDAthlon) {
+ /* AMD K6-2 stepping 8 and later support the MTRR registers.
+ * The earlier K6-2 steppings (300Mhz models) do not
+ * support MTRR's.
+ */
+ if ((cpuType < CPU_AMDK6_2) || (cpuType == CPU_AMDK6_2 && cpuStepping < 8))
+ return 0;
+ return 1;
+ }
+ /* Fall through for AMD Athlon which uses P6 style MTRR's */
+ case CPU_Intel:
+ _MTRR_readMSR(INTEL_cap_MSR,&config,&dummy);
+ return (config & (1 << 10));
+ case CPU_Cyrix:
+ /* Cyrix 6x86 and later support the MTRR registers */
+ if (cpuType < CPU_Cyrix6x86)
+ return 0;
+ return 1;
+ }
return 0;
}
@@ -149,10 +149,10 @@ static int GENERIC_getFreeRegion(
ulong lbase,lsize;
for (i = 0; i < numMTRR; i++) {
- getMTRR(i,&lbase,&lsize,&ltype);
- if (lsize < 1)
- return i;
- }
+ getMTRR(i,&lbase,&lsize,&ltype);
+ if (lsize < 1)
+ return i;
+ }
(void)base;
(void)size;
return -1;
@@ -178,10 +178,10 @@ static int AMDK6_getFreeRegion(
ulong lbase,lsize;
for (i = 0; i < numMTRR; i++) {
- getMTRR(i,&lbase,&lsize,&ltype);
- if (lsize < 1)
- return i;
- }
+ getMTRR(i,&lbase,&lsize,&ltype);
+ if (lsize < 1)
+ return i;
+ }
(void)base;
(void)size;
return -1;
@@ -207,23 +207,23 @@ static int CYRIX_getFreeRegion(
ulong lbase, lsize;
if (size > 0x2000000UL) {
- /* If we are to set up a region >32M then look at ARR7 immediately */
- getMTRR(7,&lbase,&lsize,&ltype);
- if (lsize < 1)
- return 7;
- }
+ /* If we are to set up a region >32M then look at ARR7 immediately */
+ getMTRR(7,&lbase,&lsize,&ltype);
+ if (lsize < 1)
+ return 7;
+ }
else {
- /* Check ARR0-6 registers */
- for (i = 0; i < 7; i++) {
- getMTRR(i,&lbase,&lsize,&ltype);
- if (lsize < 1)
- return i;
- }
- /* Try ARR7 but its size must be at least 256K */
- getMTRR(7,&lbase,&lsize,&ltype);
- if ((lsize < 1) && (size >= 0x40000))
- return i;
- }
+ /* Check ARR0-6 registers */
+ for (i = 0; i < 7; i++) {
+ getMTRR(i,&lbase,&lsize,&ltype);
+ if (lsize < 1)
+ return i;
+ }
+ /* Try ARR7 but its size must be at least 256K */
+ getMTRR(7,&lbase,&lsize,&ltype);
+ if ((lsize < 1) && (size >= 0x40000))
+ return i;
+ }
(void)base;
return -1;
}
@@ -240,20 +240,20 @@ static void MTRR_beginUpdate(
{
c->flags = _MTRR_disableInt();
if (cpuFamily != CPU_AMD || (cpuFamily == CPU_AMD && cpuType >= CPU_AMDAthlon)) {
- switch (cpuFamily) {
- case CPU_Intel:
- case CPU_AMD:
- /* Disable MTRRs, and set the default type to uncached */
- c->cr4Val = _MTRR_saveCR4();
- _MTRR_readMSR(INTEL_defType_MSR,&c->defTypeLo,&c->defTypeHi);
- _MTRR_writeMSR(INTEL_defType_MSR,c->defTypeLo & 0xF300UL,c->defTypeHi);
- break;
- case CPU_Cyrix:
- c->ccr3 = _MTRR_getCx86(CX86_CCR3);
- _MTRR_setCx86(CX86_CCR3, (uchar)((c->ccr3 & 0x0F) | 0x10));
- break;
- }
- }
+ switch (cpuFamily) {
+ case CPU_Intel:
+ case CPU_AMD:
+ /* Disable MTRRs, and set the default type to uncached */
+ c->cr4Val = _MTRR_saveCR4();
+ _MTRR_readMSR(INTEL_defType_MSR,&c->defTypeLo,&c->defTypeHi);
+ _MTRR_writeMSR(INTEL_defType_MSR,c->defTypeLo & 0xF300UL,c->defTypeHi);
+ break;
+ case CPU_Cyrix:
+ c->ccr3 = _MTRR_getCx86(CX86_CCR3);
+ _MTRR_setCx86(CX86_CCR3, (uchar)((c->ccr3 & 0x0F) | 0x10));
+ break;
+ }
+ }
}
/****************************************************************************
@@ -267,18 +267,18 @@ static void MTRR_endUpdate(
MTRRContext *c)
{
if (cpuFamily != CPU_AMD || (cpuFamily == CPU_AMD && cpuType >= CPU_AMDAthlon)) {
- PM_flushTLB();
- switch (cpuFamily) {
- case CPU_Intel:
- case CPU_AMD:
- _MTRR_writeMSR(INTEL_defType_MSR,c->defTypeLo,c->defTypeHi);
- _MTRR_restoreCR4(c->cr4Val);
- break;
- case CPU_Cyrix:
- _MTRR_setCx86(CX86_CCR3,(uchar)c->ccr3);
- break;
- }
- }
+ PM_flushTLB();
+ switch (cpuFamily) {
+ case CPU_Intel:
+ case CPU_AMD:
+ _MTRR_writeMSR(INTEL_defType_MSR,c->defTypeLo,c->defTypeHi);
+ _MTRR_restoreCR4(c->cr4Val);
+ break;
+ case CPU_Cyrix:
+ _MTRR_setCx86(CX86_CCR3,(uchar)c->ccr3);
+ break;
+ }
+ }
/* Re-enable interrupts (if enabled previously) */
_MTRR_restoreInt(c->flags);
@@ -304,12 +304,12 @@ static void INTEL_getMTRR(
_MTRR_readMSR(INTEL_physMask_MSR(reg),&maskLo,&hi);
if ((maskLo & 0x800) == 0) {
- /* MTRR is disabled, so it is free */
- *base = 0;
- *size = 0;
- *type = 0;
- return;
- }
+ /* MTRR is disabled, so it is free */
+ *base = 0;
+ *size = 0;
+ *type = 0;
+ return;
+ }
_MTRR_readMSR(INTEL_physBase_MSR(reg),&baseLo,&hi);
maskLo = (maskLo & 0xFFFFF000UL);
*size = ~(maskLo - 1);
@@ -338,15 +338,15 @@ static void INTEL_setMTRR(
MTRR_beginUpdate(&c);
if (size == 0) {
- /* The invalid bit is kept in the mask, so we simply clear the
- * relevant mask register to disable a range.
- */
- _MTRR_writeMSR(INTEL_physMask_MSR(reg),0,0);
- }
+ /* The invalid bit is kept in the mask, so we simply clear the
+ * relevant mask register to disable a range.
+ */
+ _MTRR_writeMSR(INTEL_physMask_MSR(reg),0,0);
+ }
else {
- _MTRR_writeMSR(INTEL_physBase_MSR(reg),base | type,0);
- _MTRR_writeMSR(INTEL_physMask_MSR(reg),~(size - 1) | 0x800,0);
- }
+ _MTRR_writeMSR(INTEL_physBase_MSR(reg),base | type,0);
+ _MTRR_writeMSR(INTEL_physMask_MSR(reg),~(size - 1) | 0x800,0);
+ }
MTRR_endUpdate(&c);
}
@@ -386,19 +386,19 @@ static void AMD_getMTRR(
/* Upper dword is region 1, lower is region 0 */
_MTRR_readMSR(0xC0000085, &low, &high);
if (reg == 1)
- low = high;
+ low = high;
/* Find the base and type for the region */
*base = low & 0xFFFE0000;
*type = 0;
if (low & 1)
- *type = PM_MTRR_UNCACHABLE;
+ *type = PM_MTRR_UNCACHABLE;
if (low & 2)
- *type = PM_MTRR_WRCOMB;
+ *type = PM_MTRR_WRCOMB;
if ((low & 3) == 0) {
- *size = 0;
- return;
- }
+ *size = 0;
+ return;
+ }
/* This needs a little explaining. The size is stored as an
* inverted mask of bits of 128K granularity 15 bits long offset
@@ -441,26 +441,26 @@ static void AMD_setMTRR(
MTRR_beginUpdate(&c);
_MTRR_readMSR(0xC0000085, &low, &high);
if (size == 0) {
- /* Clear register to disable */
- if (reg)
- high = 0;
- else
- low = 0;
- }
+ /* Clear register to disable */
+ if (reg)
+ high = 0;
+ else
+ low = 0;
+ }
else {
- /* Set the register to the base (already shifted for us), the
- * type (off by one) and an inverted bitmask of the size
- * The size is the only odd bit. We are fed say 512K
- * We invert this and we get 111 1111 1111 1011 but
- * if you subtract one and invert you get the desired
- * 111 1111 1111 1100 mask
- */
- newVal = (((~(size-1)) >> 15) & 0x0001FFFC) | base | (type+1);
- if (reg)
- high = newVal;
- else
- low = newVal;
- }
+ /* Set the register to the base (already shifted for us), the
+ * type (off by one) and an inverted bitmask of the size
+ * The size is the only odd bit. We are fed say 512K
+ * We invert this and we get 111 1111 1111 1011 but
+ * if you subtract one and invert you get the desired
+ * 111 1111 1111 1100 mask
+ */
+ newVal = (((~(size-1)) >> 15) & 0x0001FFFC) | base | (type+1);
+ if (reg)
+ high = newVal;
+ else
+ low = newVal;
+ }
/* The writeback rule is quite specific. See the manual. Its
* disable local interrupts, write back the cache, set the MTRR
@@ -507,29 +507,29 @@ static void CYRIX_getMTRR(
* Note: shift==0xF means 4G, this is unsupported.
*/
if (shift)
- *size = (reg < 7 ? 0x800UL : 0x20000UL) << shift;
+ *size = (reg < 7 ? 0x800UL : 0x20000UL) << shift;
else
- *size = 0;
+ *size = 0;
/* Bit 0 is Cache Enable on ARR7, Cache Disable on ARR0-ARR6 */
if (reg < 7) {
- switch (rcr) {
- case 1: *type = PM_MTRR_UNCACHABLE; break;
- case 8: *type = PM_MTRR_WRBACK; break;
- case 9: *type = PM_MTRR_WRCOMB; break;
- case 24:
- default: *type = PM_MTRR_WRTHROUGH; break;
- }
- }
+ switch (rcr) {
+ case 1: *type = PM_MTRR_UNCACHABLE; break;
+ case 8: *type = PM_MTRR_WRBACK; break;
+ case 9: *type = PM_MTRR_WRCOMB; break;
+ case 24:
+ default: *type = PM_MTRR_WRTHROUGH; break;
+ }
+ }
else {
- switch (rcr) {
- case 0: *type = PM_MTRR_UNCACHABLE; break;
- case 8: *type = PM_MTRR_WRCOMB; break;
- case 9: *type = PM_MTRR_WRBACK; break;
- case 25:
- default: *type = PM_MTRR_WRTHROUGH; break;
- }
- }
+ switch (rcr) {
+ case 0: *type = PM_MTRR_UNCACHABLE; break;
+ case 8: *type = PM_MTRR_WRCOMB; break;
+ case 9: *type = PM_MTRR_WRBACK; break;
+ case 25:
+ default: *type = PM_MTRR_WRTHROUGH; break;
+ }
+ }
}
/****************************************************************************
@@ -557,23 +557,23 @@ static void CYRIX_setMTRR(
size >>= (reg < 7 ? 12 : 18);
size &= 0x7FFF; /* Make sure arr_size <= 14 */
for (arr_size = 0; size; arr_size++, size >>= 1)
- ;
+ ;
if (reg < 7) {
- switch (type) {
- case PM_MTRR_UNCACHABLE: arr_type = 1; break;
- case PM_MTRR_WRCOMB: arr_type = 9; break;
- case PM_MTRR_WRTHROUGH: arr_type = 24; break;
- default: arr_type = 8; break;
- }
- }
+ switch (type) {
+ case PM_MTRR_UNCACHABLE: arr_type = 1; break;
+ case PM_MTRR_WRCOMB: arr_type = 9; break;
+ case PM_MTRR_WRTHROUGH: arr_type = 24; break;
+ default: arr_type = 8; break;
+ }
+ }
else {
- switch (type) {
- case PM_MTRR_UNCACHABLE: arr_type = 0; break;
- case PM_MTRR_WRCOMB: arr_type = 8; break;
- case PM_MTRR_WRTHROUGH: arr_type = 25; break;
- default: arr_type = 9; break;
- }
- }
+ switch (type) {
+ case PM_MTRR_UNCACHABLE: arr_type = 0; break;
+ case PM_MTRR_WRCOMB: arr_type = 8; break;
+ case PM_MTRR_WRTHROUGH: arr_type = 25; break;
+ default: arr_type = 9; break;
+ }
+ }
MTRR_beginUpdate(&c);
_MTRR_setCx86((uchar)arr, ((uchar*)&base)[3]);
_MTRR_setCx86((uchar)(arr+1), ((uchar*)&base)[2]);
@@ -615,28 +615,28 @@ static void CYRIX_initARR(void)
ccr[5] = _MTRR_getCx86(CX86_CCR5);
ccr[6] = _MTRR_getCx86(CX86_CCR6);
if (ccr[3] & 1)
- ccrc[3] = 1;
+ ccrc[3] = 1;
else {
- /* Disable SMM mode (bit 1), access to SMM memory (bit 2) and
- * access to SMM memory through ARR3 (bit 7).
- */
- if (ccr[6] & 0x02) {
- ccr[6] &= 0xFD;
- ccrc[6] = 1; /* Disable write protection of ARR3. */
- _MTRR_setCx86(CX86_CCR6,ccr[6]);
- }
- }
+ /* Disable SMM mode (bit 1), access to SMM memory (bit 2) and
+ * access to SMM memory through ARR3 (bit 7).
+ */
+ if (ccr[6] & 0x02) {
+ ccr[6] &= 0xFD;
+ ccrc[6] = 1; /* Disable write protection of ARR3. */
+ _MTRR_setCx86(CX86_CCR6,ccr[6]);
+ }
+ }
/* If we changed CCR1 in memory, change it in the processor, too. */
if (ccrc[1])
- _MTRR_setCx86(CX86_CCR1,ccr[1]);
+ _MTRR_setCx86(CX86_CCR1,ccr[1]);
/* Enable ARR usage by the processor */
if (!(ccr[5] & 0x20)) {
- ccr[5] |= 0x20;
- ccrc[5] = 1;
- _MTRR_setCx86(CX86_CCR5,ccr[5]);
- }
+ ccr[5] |= 0x20;
+ ccrc[5] = 1;
+ _MTRR_setCx86(CX86_CCR5,ccr[5]);
+ }
/* We are finished updating */
MTRR_endUpdate(&c);
@@ -654,72 +654,72 @@ void MTRR_init(void)
/* Check that we have a compatible CPU */
if (numMTRR == -1) {
- numMTRR = 0;
- if (!_MTRR_isRing0())
- return;
- cpu = CPU_getProcessorType();
- cpuFamily = cpu & CPU_familyMask;
- cpuType = cpu & CPU_mask;
- cpuStepping = (cpu & CPU_steppingMask) >> CPU_steppingShift;
- switch (cpuFamily) {
- case CPU_Intel:
- /* Intel Pentium Pro and later support the MTRR registers */
- if (cpuType < CPU_PentiumPro)
- return;
- _MTRR_readMSR(INTEL_cap_MSR,&eax,&edx);
- numMTRR = eax & 0xFF;
- getMTRR = INTEL_getMTRR;
- setMTRR = INTEL_setMTRR;
- getFreeRegion = GENERIC_getFreeRegion;
- INTEL_disableBankedWriteCombine();
- break;
- case CPU_AMD:
- /* AMD K6-2 and later support the MTRR registers */
- if ((cpuType < CPU_AMDK6_2) || (cpuType == CPU_AMDK6_2 && cpuStepping < 8))
- return;
- if (cpuType < CPU_AMDAthlon) {
- numMTRR = 2; /* AMD CPU's have 2 MTRR's */
- getMTRR = AMD_getMTRR;
- setMTRR = AMD_setMTRR;
- getFreeRegion = AMDK6_getFreeRegion;
-
- /* For some reason some IBM systems with K6-2 processors
- * have write combined enabled for the system BIOS
- * region from 0xE0000 to 0xFFFFFF. We need *both* MTRR's
- * for our own graphics drivers, so if we detect any
- * regions below the 1Meg boundary, we remove them
- * so we can use this MTRR register ourselves.
- */
- for (i = 0; i < numMTRR; i++) {
- getMTRR(i,&lbase,&lsize,&ltype);
- if (lbase < 0x100000)
- setMTRR(i,0,0,0);
- }
- }
- else {
- /* AMD Athlon uses P6 style MTRR's */
- _MTRR_readMSR(INTEL_cap_MSR,&eax,&edx);
- numMTRR = eax & 0xFF;
- getMTRR = INTEL_getMTRR;
- setMTRR = INTEL_setMTRR;
- getFreeRegion = GENERIC_getFreeRegion;
- INTEL_disableBankedWriteCombine();
- }
- break;
- case CPU_Cyrix:
- /* Cyrix 6x86 and later support the MTRR registers */
- if (cpuType < CPU_Cyrix6x86 || cpuType >= CPU_CyrixMediaGX)
- return;
- numMTRR = 8; /* Cyrix CPU's have 8 ARR's */
- getMTRR = CYRIX_getMTRR;
- setMTRR = CYRIX_setMTRR;
- getFreeRegion = CYRIX_getFreeRegion;
- CYRIX_initARR();
- break;
- default:
- return;
- }
- }
+ numMTRR = 0;
+ if (!_MTRR_isRing0())
+ return;
+ cpu = CPU_getProcessorType();
+ cpuFamily = cpu & CPU_familyMask;
+ cpuType = cpu & CPU_mask;
+ cpuStepping = (cpu & CPU_steppingMask) >> CPU_steppingShift;
+ switch (cpuFamily) {
+ case CPU_Intel:
+ /* Intel Pentium Pro and later support the MTRR registers */
+ if (cpuType < CPU_PentiumPro)
+ return;
+ _MTRR_readMSR(INTEL_cap_MSR,&eax,&edx);
+ numMTRR = eax & 0xFF;
+ getMTRR = INTEL_getMTRR;
+ setMTRR = INTEL_setMTRR;
+ getFreeRegion = GENERIC_getFreeRegion;
+ INTEL_disableBankedWriteCombine();
+ break;
+ case CPU_AMD:
+ /* AMD K6-2 and later support the MTRR registers */
+ if ((cpuType < CPU_AMDK6_2) || (cpuType == CPU_AMDK6_2 && cpuStepping < 8))
+ return;
+ if (cpuType < CPU_AMDAthlon) {
+ numMTRR = 2; /* AMD CPU's have 2 MTRR's */
+ getMTRR = AMD_getMTRR;
+ setMTRR = AMD_setMTRR;
+ getFreeRegion = AMDK6_getFreeRegion;
+
+ /* For some reason some IBM systems with K6-2 processors
+ * have write combined enabled for the system BIOS
+ * region from 0xE0000 to 0xFFFFFF. We need *both* MTRR's
+ * for our own graphics drivers, so if we detect any
+ * regions below the 1Meg boundary, we remove them
+ * so we can use this MTRR register ourselves.
+ */
+ for (i = 0; i < numMTRR; i++) {
+ getMTRR(i,&lbase,&lsize,&ltype);
+ if (lbase < 0x100000)
+ setMTRR(i,0,0,0);
+ }
+ }
+ else {
+ /* AMD Athlon uses P6 style MTRR's */
+ _MTRR_readMSR(INTEL_cap_MSR,&eax,&edx);
+ numMTRR = eax & 0xFF;
+ getMTRR = INTEL_getMTRR;
+ setMTRR = INTEL_setMTRR;
+ getFreeRegion = GENERIC_getFreeRegion;
+ INTEL_disableBankedWriteCombine();
+ }
+ break;
+ case CPU_Cyrix:
+ /* Cyrix 6x86 and later support the MTRR registers */
+ if (cpuType < CPU_Cyrix6x86 || cpuType >= CPU_CyrixMediaGX)
+ return;
+ numMTRR = 8; /* Cyrix CPU's have 8 ARR's */
+ getMTRR = CYRIX_getMTRR;
+ setMTRR = CYRIX_setMTRR;
+ getFreeRegion = CYRIX_getFreeRegion;
+ CYRIX_initARR();
+ break;
+ default:
+ return;
+ }
+ }
}
/****************************************************************************
@@ -745,93 +745,93 @@ int MTRR_enableWriteCombine(
/* Check that we have a CPU that supports MTRR's and type is valid */
if (numMTRR <= 0) {
- if (!_MTRR_isRing0())
- return PM_MTRR_ERR_NO_OS_SUPPORT;
- return PM_MTRR_NOT_SUPPORTED;
- }
+ if (!_MTRR_isRing0())
+ return PM_MTRR_ERR_NO_OS_SUPPORT;
+ return PM_MTRR_NOT_SUPPORTED;
+ }
if (type >= PM_MTRR_MAX)
- return PM_MTRR_ERR_PARAMS;
+ return PM_MTRR_ERR_PARAMS;
/* If the type is WC, check that this processor supports it */
if (!MTRR_haveWriteCombine())
- return PM_MTRR_ERR_NOWRCOMB;
+ return PM_MTRR_ERR_NOWRCOMB;
/* Adjust the boundaries depending on the CPU type */
switch (cpuFamily) {
- case CPU_AMD:
- if (cpuType < CPU_AMDAthlon) {
- /* Apply the K6 block alignment and size rules. In order:
- * o Uncached or gathering only
- * o 128K or bigger block
- * o Power of 2 block
- * o base suitably aligned to the power
- */
- if (type > PM_MTRR_WRCOMB && (size < (1 << 17) || (size & ~(size-1))-size || (base & (size-1))))
- return PM_MTRR_ERR_NOT_ALIGNED;
- break;
- }
- /* Fall through for AMD Athlon which uses P6 style MTRR's */
- case CPU_Intel:
- case CPU_Cyrix:
- if ((base & 0xFFF) || (size & 0xFFF)) {
- /* Base and size must be multiples of 4Kb */
- return PM_MTRR_ERR_NOT_4KB_ALIGNED;
- }
- if (base < 0x100000) {
- /* Base must be >= 1Mb */
- return PM_MTRR_ERR_BELOW_1MB;
- }
-
- /* Check upper bits of base and last are equal and lower bits
- * are 0 for base and 1 for last
- */
- last = base + size - 1;
- for (lbase = base; !(lbase & 1) && (last & 1); lbase = lbase >> 1, last = last >> 1)
- ;
- if (lbase != last) {
- /* Base is not aligned on the correct boundary */
- return PM_MTRR_ERR_NOT_ALIGNED;
- }
- break;
- default:
- return PM_MTRR_NOT_SUPPORTED;
- }
+ case CPU_AMD:
+ if (cpuType < CPU_AMDAthlon) {
+ /* Apply the K6 block alignment and size rules. In order:
+ * o Uncached or gathering only
+ * o 128K or bigger block
+ * o Power of 2 block
+ * o base suitably aligned to the power
+ */
+ if (type > PM_MTRR_WRCOMB && (size < (1 << 17) || (size & ~(size-1))-size || (base & (size-1))))
+ return PM_MTRR_ERR_NOT_ALIGNED;
+ break;
+ }
+ /* Fall through for AMD Athlon which uses P6 style MTRR's */
+ case CPU_Intel:
+ case CPU_Cyrix:
+ if ((base & 0xFFF) || (size & 0xFFF)) {
+ /* Base and size must be multiples of 4Kb */
+ return PM_MTRR_ERR_NOT_4KB_ALIGNED;
+ }
+ if (base < 0x100000) {
+ /* Base must be >= 1Mb */
+ return PM_MTRR_ERR_BELOW_1MB;
+ }
+
+ /* Check upper bits of base and last are equal and lower bits
+ * are 0 for base and 1 for last
+ */
+ last = base + size - 1;
+ for (lbase = base; !(lbase & 1) && (last & 1); lbase = lbase >> 1, last = last >> 1)
+ ;
+ if (lbase != last) {
+ /* Base is not aligned on the correct boundary */
+ return PM_MTRR_ERR_NOT_ALIGNED;
+ }
+ break;
+ default:
+ return PM_MTRR_NOT_SUPPORTED;
+ }
/* Search for existing MTRR */
for (i = 0; i < numMTRR; ++i) {
- getMTRR(i,&lbase,&lsize,&ltype);
- if (lbase == 0 && lsize == 0)
- continue;
- if (base > lbase + (lsize-1))
- continue;
- if ((base < lbase) && (base+size-1 < lbase))
- continue;
-
- /* Check that we don't overlap an existing region */
- if (type != PM_MTRR_UNCACHABLE) {
- if ((base < lbase) || (base+size-1 > lbase+lsize-1))
- return PM_MTRR_ERR_OVERLAP;
- }
- else if (base == lbase && size == lsize) {
- /* The region already exists so leave it alone */
- return PM_MTRR_ERR_OK;
- }
-
- /* New region is enclosed by an existing region, so only allow
- * a new type to be created if we are setting a region to be
- * uncacheable (such as MMIO registers within a framebuffer).
- */
- if (ltype != (int)type) {
- if (type == PM_MTRR_UNCACHABLE)
- continue;
- return PM_MTRR_ERR_TYPE_MISMATCH;
- }
- return PM_MTRR_ERR_OK;
- }
+ getMTRR(i,&lbase,&lsize,&ltype);
+ if (lbase == 0 && lsize == 0)
+ continue;
+ if (base > lbase + (lsize-1))
+ continue;
+ if ((base < lbase) && (base+size-1 < lbase))
+ continue;
+
+ /* Check that we don't overlap an existing region */
+ if (type != PM_MTRR_UNCACHABLE) {
+ if ((base < lbase) || (base+size-1 > lbase+lsize-1))
+ return PM_MTRR_ERR_OVERLAP;
+ }
+ else if (base == lbase && size == lsize) {
+ /* The region already exists so leave it alone */
+ return PM_MTRR_ERR_OK;
+ }
+
+ /* New region is enclosed by an existing region, so only allow
+ * a new type to be created if we are setting a region to be
+ * uncacheable (such as MMIO registers within a framebuffer).
+ */
+ if (ltype != (int)type) {
+ if (type == PM_MTRR_UNCACHABLE)
+ continue;
+ return PM_MTRR_ERR_TYPE_MISMATCH;
+ }
+ return PM_MTRR_ERR_OK;
+ }
/* Search for an empty MTRR */
if ((i = getFreeRegion(base,size)) < 0)
- return PM_MTRR_ERR_NONE_FREE;
+ return PM_MTRR_ERR_NONE_FREE;
setMTRR(i,base,size,type);
return PM_MTRR_ERR_OK;
}
@@ -852,16 +852,16 @@ int PMAPI PM_enumWriteCombine(
/* Check that we have a CPU that supports MTRR's and type is valid */
if (numMTRR <= 0) {
- if (!_MTRR_isRing0())
- return PM_MTRR_ERR_NO_OS_SUPPORT;
- return PM_MTRR_NOT_SUPPORTED;
- }
+ if (!_MTRR_isRing0())
+ return PM_MTRR_ERR_NO_OS_SUPPORT;
+ return PM_MTRR_NOT_SUPPORTED;
+ }
/* Enumerate all existing MTRR's */
for (i = 0; i < numMTRR; ++i) {
- getMTRR(i,&lbase,&lsize,&ltype);
- callback(lbase,lsize,ltype);
- }
+ getMTRR(i,&lbase,&lsize,&ltype);
+ callback(lbase,lsize,ltype);
+ }
return PM_MTRR_ERR_OK;
}
#endif
diff --git a/board/MAI/bios_emulator/scitech/src/pm/common/pcilib.c b/board/MAI/bios_emulator/scitech/src/pm/common/pcilib.c
index 8dd6dd13e3..1d542fc5df 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/common/pcilib.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/common/pcilib.c
@@ -67,13 +67,13 @@
typedef union {
struct {
- ulong signature; /* _32_ */
- ulong entry; /* 32 bit physical address */
- uchar revision; /* Revision level, 0 */
- uchar length; /* Length in paragraphs should be 01 */
- uchar checksum; /* All bytes must add up to zero */
- uchar reserved[5]; /* Must be zero */
- } fields;
+ ulong signature; /* _32_ */
+ ulong entry; /* 32 bit physical address */
+ uchar revision; /* Revision level, 0 */
+ uchar length; /* Length in paragraphs should be 01 */
+ uchar checksum; /* All bytes must add up to zero */
+ uchar reserved[5]; /* Must be zero */
+ } fields;
char chars[16];
} PCI_bios32;
@@ -143,54 +143,54 @@ static int PCIBIOS_detect(
/* Bail if we have already detected no BIOS is present */
if (PCIBIOSVersion == 0)
- return 0;
+ return 0;
/* First scan the memory from 0xE0000 to 0xFFFFF looking for the
* BIOS32 service directory, so we can determine if we can call it
* from 32-bit protected mode.
*/
if (PCIBIOSVersion == -1) {
- PCIBIOSVersion = 0;
- BIOSImage = PM_mapPhysicalAddr(0xE0000,BIOS_LIMIT,false);
- if (!BIOSImage)
- return 0;
- BIOSEnd = BIOSImage + 0x20000;
- for (BIOSDir = (PCI_bios32*)BIOSImage; BIOSDir < (PCI_bios32*)BIOSEnd; BIOSDir++) {
- uchar sum;
- int i,length;
-
- if (BIOSDir->fields.signature != BIOS32_SIGNATURE)
- continue;
- length = BIOSDir->fields.length * 16;
- if (!length)
- continue;
- for (sum = i = 0; i < length ; i++)
- sum += BIOSDir->chars[i];
- if (sum != 0)
- continue;
- BIOSEntry.address = (ulong)BIOSImage + (BIOSDir->fields.entry - 0xE0000);
- BIOSEntry.segment = _PCI_getCS();
- break;
- }
-
- /* If we found the BIOS32 directory, call it to get the address of the
- * PCI services.
- */
- if (BIOSEntry.address == 0)
- return 0;
- if (_BIOS32_service(PCI_SERVICE,0,&physBase,&length,&offset,BIOSEntry) != 0)
- return 0;
- PCIPhysEntry = physBase + offset;
- PCIEntry.address = (ulong)BIOSImage + (PCIPhysEntry - 0xE0000);
- PCIEntry.segment = _PCI_getCS();
- }
+ PCIBIOSVersion = 0;
+ BIOSImage = PM_mapPhysicalAddr(0xE0000,BIOS_LIMIT,false);
+ if (!BIOSImage)
+ return 0;
+ BIOSEnd = BIOSImage + 0x20000;
+ for (BIOSDir = (PCI_bios32*)BIOSImage; BIOSDir < (PCI_bios32*)BIOSEnd; BIOSDir++) {
+ uchar sum;
+ int i,length;
+
+ if (BIOSDir->fields.signature != BIOS32_SIGNATURE)
+ continue;
+ length = BIOSDir->fields.length * 16;
+ if (!length)
+ continue;
+ for (sum = i = 0; i < length ; i++)
+ sum += BIOSDir->chars[i];
+ if (sum != 0)
+ continue;
+ BIOSEntry.address = (ulong)BIOSImage + (BIOSDir->fields.entry - 0xE0000);
+ BIOSEntry.segment = _PCI_getCS();
+ break;
+ }
+
+ /* If we found the BIOS32 directory, call it to get the address of the
+ * PCI services.
+ */
+ if (BIOSEntry.address == 0)
+ return 0;
+ if (_BIOS32_service(PCI_SERVICE,0,&physBase,&length,&offset,BIOSEntry) != 0)
+ return 0;
+ PCIPhysEntry = physBase + offset;
+ PCIEntry.address = (ulong)BIOSImage + (PCIPhysEntry - 0xE0000);
+ PCIEntry.segment = _PCI_getCS();
+ }
#endif
/* We found the BIOS entry, so now do the version check */
version = _PCIBIOS_isPresent(PCI_BIOS_PRESENT,&signature,&stat,lastBus,PCIEntry);
if (version > 0 && ((stat >> 8) == 0) && signature == PCI_SIGNATURE) {
- *hwType = stat & 0xFF;
- return PCIBIOSVersion = version;
- }
+ *hwType = stat & 0xFF;
+ return PCIBIOSVersion = version;
+ }
return 0;
}
@@ -215,16 +215,16 @@ static ibool CheckDuplicate(
{
/* Ignore devices with a vendor ID of 0 */
if (info->VendorID == 0)
- return true;
+ return true;
/* NOTE: We only check against the current device on
* the bus to ensure that we do not exclude
* multiple controllers of the same device ID.
*/
if (info->slot.p.Bus == prev->slot.p.Bus &&
- info->slot.p.Device == prev->slot.p.Device &&
- info->DeviceID == prev->DeviceID)
- return true;
+ info->slot.p.Device == prev->slot.p.Device &&
+ info->DeviceID == prev->DeviceID)
+ return true;
return false;
}
@@ -253,41 +253,41 @@ static int PCI_enumerateMech1(
tmp = PM_inpd(0xCF8);
PM_outpd(0xCF8,slot.i);
if ((PM_inpd(0xCF8) == slot.i) && (PM_inpd(0xCFC) != 0xFFFFFFFFUL)) {
- /* PCI access mechanism 1 - the preferred mechanism */
- for (bus = 0; bus < 8; bus++) {
- slot.p.Bus = bus;
- for (device = 0; device < 32; device++) {
- slot.p.Device = device;
- for (function = 0; function < 8; function++) {
- slot.p.Function = function;
- slot.p.Register = 0;
- PM_outpd(0xCF8,slot.i);
- if (PM_inpd(0xCFC) != 0xFFFFFFFFUL) {
- memset(&pci,0,sizeof(pci));
- pci.dwSize = sizeof(pci);
- pci.mech1 = 1;
- pci.slot = slot;
- lp = (ulong*)&(pci.VendorID);
- for (i = 0; i < NUM_PCI_REG; i++, lp++) {
- slot.p.Register = i;
- PM_outpd(0xCF8,slot.i);
- *lp = PM_inpd(0xCFC);
- }
- if (!CheckDuplicate(&pci,&prev)) {
- if (info)
- COPY_STRUCTURE(&info[numFound],&pci);
- ++numFound;
- }
- prev = pci;
- }
- }
- }
- }
-
- /* Disable PCI config cycle on exit */
- PM_outpd(0xCF8,0);
- return numFound;
- }
+ /* PCI access mechanism 1 - the preferred mechanism */
+ for (bus = 0; bus < 8; bus++) {
+ slot.p.Bus = bus;
+ for (device = 0; device < 32; device++) {
+ slot.p.Device = device;
+ for (function = 0; function < 8; function++) {
+ slot.p.Function = function;
+ slot.p.Register = 0;
+ PM_outpd(0xCF8,slot.i);
+ if (PM_inpd(0xCFC) != 0xFFFFFFFFUL) {
+ memset(&pci,0,sizeof(pci));
+ pci.dwSize = sizeof(pci);
+ pci.mech1 = 1;
+ pci.slot = slot;
+ lp = (ulong*)&(pci.VendorID);
+ for (i = 0; i < NUM_PCI_REG; i++, lp++) {
+ slot.p.Register = i;
+ PM_outpd(0xCF8,slot.i);
+ *lp = PM_inpd(0xCFC);
+ }
+ if (!CheckDuplicate(&pci,&prev)) {
+ if (info)
+ COPY_STRUCTURE(&info[numFound],&pci);
+ ++numFound;
+ }
+ prev = pci;
+ }
+ }
+ }
+ }
+
+ /* Disable PCI config cycle on exit */
+ PM_outpd(0xCF8,0);
+ return numFound;
+ }
PM_outpd(0xCF8,tmp);
/* No hardware access mechanism 1 found */
@@ -320,42 +320,42 @@ static int PCI_enumerateMech2(
PM_outpb(0xCF8,0x00);
PM_outpb(0xCFA,0x00);
if (PM_inpb(0xCF8) == 0x00 && PM_inpb(0xCFB) == 0x00) {
- /* PCI access mechanism 2 - the older mechanism for legacy busses */
- for (bus = 0; bus < 2; bus++) {
- slot.p.Bus = bus;
- PM_outpb(0xCFA,(uchar)bus);
- for (device = 0; device < 16; device++) {
- slot.p.Device = device;
- deviceIO = 0xC000 + (device << 8);
- for (function = 0; function < 8; function++) {
- slot.p.Function = function;
- slot.p.Register = 0;
- PM_outpb(0xCF8,(uchar)((function << 1) | 0x10));
- if (PM_inpd(deviceIO) != 0xFFFFFFFFUL) {
- memset(&pci,0,sizeof(pci));
- pci.dwSize = sizeof(pci);
- pci.mech1 = 0;
- pci.slot = slot;
- lp = (ulong*)&(pci.VendorID);
- for (i = 0; i < NUM_PCI_REG; i++, lp++) {
- slot.p.Register = i;
- *lp = PM_inpd(deviceIO + (i << 2));
- }
- if (!CheckDuplicate(&pci,&prev)) {
- if (info)
- COPY_STRUCTURE(&info[numFound],&pci);
- ++numFound;
- }
- prev = pci;
- }
- }
- }
- }
-
- /* Disable PCI config cycle on exit */
- PM_outpb(0xCF8,0);
- return numFound;
- }
+ /* PCI access mechanism 2 - the older mechanism for legacy busses */
+ for (bus = 0; bus < 2; bus++) {
+ slot.p.Bus = bus;
+ PM_outpb(0xCFA,(uchar)bus);
+ for (device = 0; device < 16; device++) {
+ slot.p.Device = device;
+ deviceIO = 0xC000 + (device << 8);
+ for (function = 0; function < 8; function++) {
+ slot.p.Function = function;
+ slot.p.Register = 0;
+ PM_outpb(0xCF8,(uchar)((function << 1) | 0x10));
+ if (PM_inpd(deviceIO) != 0xFFFFFFFFUL) {
+ memset(&pci,0,sizeof(pci));
+ pci.dwSize = sizeof(pci);
+ pci.mech1 = 0;
+ pci.slot = slot;
+ lp = (ulong*)&(pci.VendorID);
+ for (i = 0; i < NUM_PCI_REG; i++, lp++) {
+ slot.p.Register = i;
+ *lp = PM_inpd(deviceIO + (i << 2));
+ }
+ if (!CheckDuplicate(&pci,&prev)) {
+ if (info)
+ COPY_STRUCTURE(&info[numFound],&pci);
+ ++numFound;
+ }
+ prev = pci;
+ }
+ }
+ }
+ }
+
+ /* Disable PCI config cycle on exit */
+ PM_outpb(0xCF8,0);
+ return numFound;
+ }
/* No hardware access mechanism 2 found */
return 0;
@@ -394,32 +394,32 @@ static int PCI_enumerateBIOS(
PCIDeviceInfo pci,prev = {0};
if (PCIBIOS_detect(&hwType,&lastBus)) {
- /* PCI BIOS access - the ultimate fallback */
- for (bus = 0; bus <= lastBus; bus++) {
- slot.p.Bus = bus;
- for (device = 0; device < 32; device++) {
- slot.p.Device = device;
- for (function = 0; function < 8; function++) {
- slot.p.Function = function;
- if (PCIBIOS_readDWORD(0,slot.i) != 0xFFFFFFFFUL) {
- memset(&pci,0,sizeof(pci));
- pci.dwSize = sizeof(pci);
- pci.mech1 = 2;
- pci.slot = slot;
- lp = (ulong*)&(pci.VendorID);
- for (i = 0; i < NUM_PCI_REG; i++, lp++)
- *lp = PCIBIOS_readDWORD(i << 2,slot.i);
- if (!CheckDuplicate(&pci,&prev)) {
- if (info)
- COPY_STRUCTURE(&info[numFound],&pci);
- ++numFound;
- }
- prev = pci;
- }
- }
- }
- }
- }
+ /* PCI BIOS access - the ultimate fallback */
+ for (bus = 0; bus <= lastBus; bus++) {
+ slot.p.Bus = bus;
+ for (device = 0; device < 32; device++) {
+ slot.p.Device = device;
+ for (function = 0; function < 8; function++) {
+ slot.p.Function = function;
+ if (PCIBIOS_readDWORD(0,slot.i) != 0xFFFFFFFFUL) {
+ memset(&pci,0,sizeof(pci));
+ pci.dwSize = sizeof(pci);
+ pci.mech1 = 2;
+ pci.slot = slot;
+ lp = (ulong*)&(pci.VendorID);
+ for (i = 0; i < NUM_PCI_REG; i++, lp++)
+ *lp = PCIBIOS_readDWORD(i << 2,slot.i);
+ if (!CheckDuplicate(&pci,&prev)) {
+ if (info)
+ COPY_STRUCTURE(&info[numFound],&pci);
+ ++numFound;
+ }
+ prev = pci;
+ }
+ }
+ }
+ }
+ }
/* Return number of devices found */
return numFound;
@@ -447,11 +447,11 @@ int _ASMAPI PCI_enumerate(
* stuff we can't do directly.
*/
if ((numFound = PCI_enumerateMech1(info)) == 0) {
- if ((numFound = PCI_enumerateMech2(info)) == 0) {
- if ((numFound = PCI_enumerateBIOS(info)) == 0)
- return 0;
- }
- }
+ if ((numFound = PCI_enumerateMech2(info)) == 0) {
+ if ((numFound = PCI_enumerateBIOS(info)) == 0)
+ return 0;
+ }
+ }
return numFound;
}
@@ -493,22 +493,22 @@ ulong _ASMAPI PCI_findBARSize(
base = PCI_accessReg(bar,0,PCI_READ_DWORD,pci);
if (base && !(base & 0x1)) {
- /* For some strange reason some devices don't properly decode
- * their base address registers (Intel PCI/PCI bridges!), and
- * we read completely bogus values. We check for that here
- * and clear out those BAR's.
- *
- * We check for that here because at least the low 12 bits
- * of the address range must be zeros, since the page size
- * on IA32 processors is always 4Kb.
- */
- if ((base & 0xFFF) == 0) {
- PCI_accessReg(bar,0xFFFFFFFF,PCI_WRITE_DWORD,pci);
- size = PCI_accessReg(bar,0,PCI_READ_DWORD,pci) & ~0xFF;
- size = ~size+1;
- PCI_accessReg(bar,base,PCI_WRITE_DWORD,pci);
- }
- }
+ /* For some strange reason some devices don't properly decode
+ * their base address registers (Intel PCI/PCI bridges!), and
+ * we read completely bogus values. We check for that here
+ * and clear out those BAR's.
+ *
+ * We check for that here because at least the low 12 bits
+ * of the address range must be zeros, since the page size
+ * on IA32 processors is always 4Kb.
+ */
+ if ((base & 0xFFF) == 0) {
+ PCI_accessReg(bar,0xFFFFFFFF,PCI_WRITE_DWORD,pci);
+ size = PCI_accessReg(bar,0,PCI_READ_DWORD,pci) & ~0xFF;
+ size = ~size+1;
+ PCI_accessReg(bar,base,PCI_WRITE_DWORD,pci);
+ }
+ }
pci->slot.p.Register = 0;
return size;
}
@@ -542,49 +542,49 @@ ulong _ASMAPI PCI_accessReg(
int iobase;
if (info->mech1 == 2) {
- /* Use PCI BIOS access since we dont have direct hardware access */
- switch (func) {
- case PCI_READ_BYTE:
- return (uchar)_PCIBIOS_service(READ_CONFIG_BYTE,info->slot.i >> 8,index,0,PCIEntry);
- case PCI_READ_WORD:
- return (ushort)_PCIBIOS_service(READ_CONFIG_WORD,info->slot.i >> 8,index,0,PCIEntry);
- case PCI_READ_DWORD:
- return (ulong)_PCIBIOS_service(READ_CONFIG_DWORD,info->slot.i >> 8,index,0,PCIEntry);
- case PCI_WRITE_BYTE:
- _PCIBIOS_service(WRITE_CONFIG_BYTE,info->slot.i >> 8,index,value,PCIEntry);
- break;
- case PCI_WRITE_WORD:
- _PCIBIOS_service(WRITE_CONFIG_WORD,info->slot.i >> 8,index,value,PCIEntry);
- break;
- case PCI_WRITE_DWORD:
- _PCIBIOS_service(WRITE_CONFIG_DWORD,info->slot.i >> 8,index,value,PCIEntry);
- break;
- }
- }
+ /* Use PCI BIOS access since we dont have direct hardware access */
+ switch (func) {
+ case PCI_READ_BYTE:
+ return (uchar)_PCIBIOS_service(READ_CONFIG_BYTE,info->slot.i >> 8,index,0,PCIEntry);
+ case PCI_READ_WORD:
+ return (ushort)_PCIBIOS_service(READ_CONFIG_WORD,info->slot.i >> 8,index,0,PCIEntry);
+ case PCI_READ_DWORD:
+ return (ulong)_PCIBIOS_service(READ_CONFIG_DWORD,info->slot.i >> 8,index,0,PCIEntry);
+ case PCI_WRITE_BYTE:
+ _PCIBIOS_service(WRITE_CONFIG_BYTE,info->slot.i >> 8,index,value,PCIEntry);
+ break;
+ case PCI_WRITE_WORD:
+ _PCIBIOS_service(WRITE_CONFIG_WORD,info->slot.i >> 8,index,value,PCIEntry);
+ break;
+ case PCI_WRITE_DWORD:
+ _PCIBIOS_service(WRITE_CONFIG_DWORD,info->slot.i >> 8,index,value,PCIEntry);
+ break;
+ }
+ }
else {
- /* Use direct hardware access mechanisms */
- if (info->mech1) {
- /* PCI access mechanism 1 */
- iobase = 0xCFC + (index & 3);
- info->slot.p.Register = index >> 2;
- PM_outpd(0xCF8,info->slot.i);
- }
- else {
- /* PCI access mechanism 2 */
- PM_outpb(0xCF8,(uchar)((info->slot.p.Function << 1) | 0x10));
- PM_outpb(0xCFA,(uchar)info->slot.p.Bus);
- iobase = 0xC000 + (info->slot.p.Device << 8) + index;
- }
- switch (func) {
- case PCI_READ_BYTE:
- case PCI_READ_WORD:
- case PCI_READ_DWORD: value = PM_inpd(iobase); break;
- case PCI_WRITE_BYTE: PM_outpb(iobase,(uchar)value); break;
- case PCI_WRITE_WORD: PM_outpw(iobase,(ushort)value); break;
- case PCI_WRITE_DWORD: PM_outpd(iobase,(ulong)value); break;
- }
- PM_outpd(0xCF8,0);
- }
+ /* Use direct hardware access mechanisms */
+ if (info->mech1) {
+ /* PCI access mechanism 1 */
+ iobase = 0xCFC + (index & 3);
+ info->slot.p.Register = index >> 2;
+ PM_outpd(0xCF8,info->slot.i);
+ }
+ else {
+ /* PCI access mechanism 2 */
+ PM_outpb(0xCF8,(uchar)((info->slot.p.Function << 1) | 0x10));
+ PM_outpb(0xCFA,(uchar)info->slot.p.Bus);
+ iobase = 0xC000 + (info->slot.p.Device << 8) + index;
+ }
+ switch (func) {
+ case PCI_READ_BYTE:
+ case PCI_READ_WORD:
+ case PCI_READ_DWORD: value = PM_inpd(iobase); break;
+ case PCI_WRITE_BYTE: PM_outpb(iobase,(uchar)value); break;
+ case PCI_WRITE_WORD: PM_outpw(iobase,(ushort)value); break;
+ case PCI_WRITE_DWORD: PM_outpd(iobase,(ulong)value); break;
+ }
+ PM_outpd(0xCF8,0);
+ }
return value;
}
@@ -608,14 +608,14 @@ ibool _ASMAPI PCI_getIRQRoutingOptions(
int ret;
if (PCIPhysEntry) {
- buf.BufferSize = numDevices * sizeof(PCIRouteInfo);
- buf.DataBuffer = buffer;
- if ((ret = _PCIBIOS_getRouting(&buf,PCIEntry)) == 0x89)
- return buf.BufferSize / sizeof(PCIRouteInfo);
- if (ret != 0)
- return -1;
- return 0;
- }
+ buf.BufferSize = numDevices * sizeof(PCIRouteInfo);
+ buf.DataBuffer = buffer;
+ if ((ret = _PCIBIOS_getRouting(&buf,PCIEntry)) == 0x89)
+ return buf.BufferSize / sizeof(PCIRouteInfo);
+ if (ret != 0)
+ return -1;
+ return 0;
+ }
/* We currently only support this via the PCI BIOS functions */
return -1;
@@ -642,13 +642,13 @@ ibool _ASMAPI PCI_setHardwareIRQ(
uint IRQ)
{
if (PCIPhysEntry) {
- if (_PCIBIOS_setIRQ(info->slot.i >> 8,intPin,IRQ,PCIEntry)) {
- info->u.type0.InterruptPin = intPin;
- info->u.type0.InterruptLine = IRQ;
- return true;
- }
- return false;
- }
+ if (_PCIBIOS_setIRQ(info->slot.i >> 8,intPin,IRQ,PCIEntry)) {
+ info->u.type0.InterruptPin = intPin;
+ info->u.type0.InterruptLine = IRQ;
+ return true;
+ }
+ return false;
+ }
/* We currently only support this via the PCI BIOS functions */
return false;
@@ -668,7 +668,7 @@ void _ASMAPI PCI_generateSpecialCyle(
ulong specialCycleData)
{
if (PCIPhysEntry)
- _PCIBIOS_specialCycle(bus,specialCycleData,PCIEntry);
+ _PCIBIOS_specialCycle(bus,specialCycleData,PCIEntry);
/* We currently only support this via the PCI BIOS functions */
}
@@ -699,14 +699,14 @@ void _ASMAPI PCI_readRegBlock(
int endCount = count - middleCount * 4 - startCount;
for (i = 0,pb = dst; i < startCount; i++, index++) {
- *pb++ = (uchar)PCI_accessReg(index,0,PCI_READ_BYTE,info);
- }
+ *pb++ = (uchar)PCI_accessReg(index,0,PCI_READ_BYTE,info);
+ }
for (i = 0,pd = (ulong*)pb; i < middleCount; i++, index += 4) {
- *pd++ = (ulong)PCI_accessReg(index,0,PCI_READ_DWORD,info);
- }
+ *pd++ = (ulong)PCI_accessReg(index,0,PCI_READ_DWORD,info);
+ }
for (i = 0,pb = (uchar*)pd; i < endCount; i++, index++) {
- *pb++ = (uchar)PCI_accessReg(index,0,PCI_READ_BYTE,info);
- }
+ *pb++ = (uchar)PCI_accessReg(index,0,PCI_READ_BYTE,info);
+ }
}
/****************************************************************************
@@ -736,12 +736,12 @@ void _ASMAPI PCI_writeRegBlock(
int endCount = count - middleCount * 4 - startCount;
for (i = 0,pb = src; i < startCount; i++, index++) {
- PCI_accessReg(index,*pb++,PCI_WRITE_BYTE,info);
- }
+ PCI_accessReg(index,*pb++,PCI_WRITE_BYTE,info);
+ }
for (i = 0,pd = (ulong*)pb; i < middleCount; i++, index += 4) {
- PCI_accessReg(index,*pd++,PCI_WRITE_DWORD,info);
- }
+ PCI_accessReg(index,*pd++,PCI_WRITE_DWORD,info);
+ }
for (i = 0,pb = (uchar*)pd; i < endCount; i++, index++) {
- PCI_accessReg(index,*pb++,PCI_WRITE_BYTE,info);
- }
+ PCI_accessReg(index,*pb++,PCI_WRITE_BYTE,info);
+ }
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/common/unixio.c b/board/MAI/bios_emulator/scitech/src/pm/common/unixio.c
index 04aa47002b..c3a66a7c14 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/common/unixio.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/common/unixio.c
@@ -65,9 +65,9 @@ static void convertFindData(
strcat(filename,blk->d_name);
stat(filename,&st);
if (!(st.st_mode & S_IWRITE))
- findData->attrib |= PM_FILE_READONLY;
+ findData->attrib |= PM_FILE_READONLY;
if (st.st_mode & S_IFDIR)
- findData->attrib |= PM_FILE_DIRECTORY;
+ findData->attrib |= PM_FILE_DIRECTORY;
findData->sizeLo = st.st_size;
findData->sizeHi = 0;
strncpy(findData->name,blk->d_name,PM_MAX_PATH);
@@ -91,24 +91,24 @@ static ibool filematch(
PM_backslash(fullpath);
strcat(fullpath, dire->d_name);
if (stat(fullpath, &st) != 0)
- return false;
+ return false;
for (; i < (int)strlen(dire->d_name) && j < (int)strlen(pattern); i++, j++) {
- if (pattern[j] == '*' && lastchar != '\\') {
- if (pattern[j+1] == '\0')
- return true;
- while (dire->d_name[i++] != pattern[j+1]) {
- if (dire->d_name[i] == '\0')
- return false;
- }
- i -= 2;
- }
- else if (dire->d_name[i] != pattern[j] &&
- !(pattern[j] == '?' && lastchar != '\\'))
- return false;
- lastchar = pattern[i];
- }
+ if (pattern[j] == '*' && lastchar != '\\') {
+ if (pattern[j+1] == '\0')
+ return true;
+ while (dire->d_name[i++] != pattern[j+1]) {
+ if (dire->d_name[i] == '\0')
+ return false;
+ }
+ i -= 2;
+ }
+ else if (dire->d_name[i] != pattern[j] &&
+ !(pattern[j] == '?' && lastchar != '\\'))
+ return false;
+ lastchar = pattern[i];
+ }
if (j == (int)strlen(pattern) && i == (int)strlen(dire->d_name))
- return true;
+ return true;
return false;
}
@@ -126,23 +126,23 @@ void * PMAPI PM_findFirstFile(
char ext[PM_MAX_PATH];
if ((d = PM_malloc(sizeof(*d))) == NULL)
- return PM_FILE_INVALID;
+ return PM_FILE_INVALID;
PM_splitpath(filename,NULL,d->path,name,ext);
strcpy(d->mask,name);
strcat(d->mask,ext);
if (strlen(d->path) == 0)
- strcpy(d->path, ".");
+ strcpy(d->path, ".");
if (d->path[strlen(d->path)-1] == '/')
- d->path[strlen(d->path)-1] = 0;
+ d->path[strlen(d->path)-1] = 0;
if ((d->d = opendir(d->path)) != NULL) {
- while ((dire = readdir(d->d)) != NULL) {
- if (filematch(d->mask,d->path,dire)) {
- convertFindData(findData,dire,d->path);
- return d;
- }
- }
- closedir(d->d);
- }
+ while ((dire = readdir(d->d)) != NULL) {
+ if (filematch(d->mask,d->path,dire)) {
+ convertFindData(findData,dire,d->path);
+ return d;
+ }
+ }
+ closedir(d->d);
+ }
PM_free(d);
return PM_FILE_INVALID;
}
@@ -159,11 +159,11 @@ ibool PMAPI PM_findNextFile(
struct dirent *dire;
while ((dire = readdir(d->d)) != NULL) {
- if (filematch(d->mask,d->path,dire)) {
- convertFindData(findData,dire,d->path);
- return true;
- }
- }
+ if (filematch(d->mask,d->path,dire)) {
+ convertFindData(findData,dire,d->path);
+ return true;
+ }
+ }
return false;
}
@@ -197,7 +197,7 @@ ibool PMAPI PM_driveValid(
char drive)
{
if (drive == 3)
- return true;
+ return true;
return false;
}
@@ -230,9 +230,9 @@ void PMAPI PM_setFileAttr(
stat(filename,&st);
mode = st.st_mode;
if (attrib & PM_FILE_READONLY)
- mode &= ~S_IWRITE;
+ mode &= ~S_IWRITE;
else
- mode |= S_IWRITE;
+ mode |= S_IWRITE;
chmod(filename,mode);
}
@@ -247,7 +247,7 @@ uint PMAPI PM_getFileAttr(
stat(filename,&st);
if (st.st_mode & S_IWRITE)
- return 0;
+ return 0;
return PM_FILE_READONLY;
}
@@ -280,7 +280,7 @@ ibool PMAPI PM_getFileTime(
ibool gmTime,
PM_time *time)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
(void)filename;
(void)gmTime;
(void)time;
@@ -297,7 +297,7 @@ ibool PMAPI PM_setFileTime(
ibool gmTime,
PM_time *time)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
(void)filename;
(void)gmTime;
(void)time;
diff --git a/board/MAI/bios_emulator/scitech/src/pm/common/vgastate.c b/board/MAI/bios_emulator/scitech/src/pm/common/vgastate.c
index 3be14e81eb..8056e9a33f 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/common/vgastate.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/common/vgastate.c
@@ -104,7 +104,7 @@ static void vga_delay(void)
* what we need.
*/
for (i = 0; i <= 10; i++)
- PM_outpb(0x80, 0);
+ PM_outpb(0x80, 0);
}
/****************************************************************************
@@ -152,9 +152,9 @@ static void vga_savepalette(
_port_out(0, PEL_IR);
for (i = 0; i < 768; i++) {
- vga_delay();
- *pal++ = _port_in(PEL_D);
- }
+ vga_delay();
+ *pal++ = _port_in(PEL_D);
+ }
}
/****************************************************************************
@@ -169,9 +169,9 @@ static void vga_restorepalette(
/* restore saved palette */
_port_out(0, PEL_IW);
for (i = 0; i < 768; i++) {
- vga_delay();
- _port_out(*pal++, PEL_D);
- }
+ vga_delay();
+ _port_out(*pal++, PEL_D);
+ }
}
/****************************************************************************
@@ -247,25 +247,25 @@ void PMAPI PM_saveVGAState(
/* Save state of VGA registers */
for (i = 0; i < CRT_C; i++) {
- _port_out(i, CRT_I);
- regs[CRT + i] = _port_in(CRT_D);
- }
+ _port_out(i, CRT_I);
+ regs[CRT + i] = _port_in(CRT_D);
+ }
for (i = 0; i < ATT_C; i++) {
- _port_in(IS1_R);
- vga_delay();
- _port_out(i, ATT_IW);
- vga_delay();
- regs[ATT + i] = _port_in(ATT_R);
- vga_delay();
- }
+ _port_in(IS1_R);
+ vga_delay();
+ _port_out(i, ATT_IW);
+ vga_delay();
+ regs[ATT + i] = _port_in(ATT_R);
+ vga_delay();
+ }
for (i = 0; i < GRA_C; i++) {
- _port_out(i, GRA_I);
- regs[GRA + i] = _port_in(GRA_D);
- }
+ _port_out(i, GRA_I);
+ regs[GRA + i] = _port_in(GRA_D);
+ }
for (i = 0; i < SEQ_C; i++) {
- _port_out(i, SEQ_I);
- regs[SEQ + i] = _port_in(SEQ_D);
- }
+ _port_out(i, SEQ_I);
+ regs[SEQ + i] = _port_in(SEQ_D);
+ }
regs[MIS] = _port_in(MIS_R);
/* Save the VGA palette values */
@@ -302,7 +302,7 @@ void PMAPI PM_restoreVGAState(
/* Delay to allow clock change to settle */
for (i = 0; i < 10; i++)
- vga_delay();
+ vga_delay();
/* Synchronous reset on */
_port_out(0x00,SEQ_I);
@@ -312,9 +312,9 @@ void PMAPI PM_restoreVGAState(
_port_out(1, SEQ_I);
_port_out(regs[SEQ + 1] | 0x20, SEQ_D);
for (i = 2; i < SEQ_C; i++) {
- _port_out(i, SEQ_I);
- _port_out(regs[SEQ + i], SEQ_D);
- }
+ _port_out(i, SEQ_I);
+ _port_out(regs[SEQ + i], SEQ_D);
+ }
/* Synchronous reset off */
_port_out(0x00,SEQ_I);
@@ -324,21 +324,21 @@ void PMAPI PM_restoreVGAState(
_port_out(0x11, CRT_I);
_port_out(_port_in(CRT_D) & 0x7F, CRT_D);
for (i = 0; i < CRT_C; i++) {
- _port_out(i, CRT_I);
- _port_out(regs[CRT + i], CRT_D);
- }
+ _port_out(i, CRT_I);
+ _port_out(regs[CRT + i], CRT_D);
+ }
for (i = 0; i < GRA_C; i++) {
- _port_out(i, GRA_I);
- _port_out(regs[GRA + i], GRA_D);
- }
+ _port_out(i, GRA_I);
+ _port_out(regs[GRA + i], GRA_D);
+ }
for (i = 0; i < ATT_C; i++) {
- _port_in(IS1_R); /* reset flip-flop */
- vga_delay();
- _port_out(i, ATT_IW);
- vga_delay();
- _port_out(regs[ATT + i], ATT_IW);
- vga_delay();
- }
+ _port_in(IS1_R); /* reset flip-flop */
+ vga_delay();
+ _port_out(i, ATT_IW);
+ vga_delay();
+ _port_out(regs[ATT + i], ATT_IW);
+ vga_delay();
+ }
/* Ensure the VGA screen is turned on */
PM_vgaUnblankDisplay();
diff --git a/board/MAI/bios_emulator/scitech/src/pm/cpuinfo.c b/board/MAI/bios_emulator/scitech/src/pm/cpuinfo.c
index e2446a4397..ac62e81c10 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/cpuinfo.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/cpuinfo.c
@@ -168,144 +168,144 @@ uint ZAPI CPU_getProcessorType(void)
static ibool firstTime = true;
if (_CPU_haveCPUID()) {
- cpu = _CPU_checkCPUID();
- vendor = cpu & ~CPU_mask;
- if (vendor == CPU_Intel) {
- /* Check for Intel processors */
- switch (cpu & CPU_mask) {
- case 4: cpu = CPU_i486; break;
- case 5: cpu = CPU_Pentium; break;
- case 6:
- if ((model = _CPU_getCPUIDModel()) == 1)
- cpu = CPU_PentiumPro;
- else if (model <= 6) {
- cacheSize = _CPU_getCacheSize();
- if ((model == 5 && cacheSize == 0) ||
- (model == 5 && cacheSize == 256) ||
- (model == 6 && cacheSize == 128))
- cpu = CPU_Celeron;
- else
- cpu = CPU_PentiumII;
- }
- else if (model >= 7) {
- /* Model 7 == Pentium III */
- /* Model 8 == Celeron/Pentium III Coppermine */
- cacheSize = _CPU_getCacheSize();
- if ((model == 8 && cacheSize == 128))
- cpu = CPU_Celeron;
- else
- cpu = CPU_PentiumIII;
- }
- break;
- default:
- cpu = CPU_UnkIntel;
- }
- }
- else if (vendor == CPU_Cyrix) {
- /* Check for Cyrix processors */
- switch (cpu & CPU_mask) {
- case 4:
- if ((model = _CPU_getCPUIDModel()) == 4)
- cpu = CPU_CyrixMediaGX;
- else
- cpu = CPU_UnkCyrix;
- break;
- case 5:
- if ((model = _CPU_getCPUIDModel()) == 2)
- cpu = CPU_Cyrix6x86;
- else if (model == 4)
- cpu = CPU_CyrixMediaGXm;
- else
- cpu = CPU_UnkCyrix;
- break;
- case 6:
- if ((model = _CPU_getCPUIDModel()) <= 1)
- cpu = CPU_Cyrix6x86MX;
- else
- cpu = CPU_UnkCyrix;
- break;
- default:
- cpu = CPU_UnkCyrix;
- }
- }
- else if (vendor == CPU_AMD) {
- /* Check for AMD processors */
- switch (cpu & CPU_mask) {
- case 4:
- if ((model = _CPU_getCPUIDModel()) == 0)
- cpu = CPU_AMDAm5x86;
- else
- cpu = CPU_AMDAm486;
- break;
- case 5:
- if ((model = _CPU_getCPUIDModel()) <= 3)
- cpu = CPU_AMDK5;
- else if (model <= 7)
- cpu = CPU_AMDK6;
- else if (model == 8)
- cpu = CPU_AMDK6_2;
- else if (model == 9)
- cpu = CPU_AMDK6_III;
- else if (model == 13) {
- if (_CPU_getCPUIDStepping() <= 3)
- cpu = CPU_AMDK6_IIIplus;
- else
- cpu = CPU_AMDK6_2plus;
- }
- else
- cpu = CPU_UnkAMD;
- break;
- case 6:
- if ((model = _CPU_getCPUIDModel()) == 3)
- cpu = CPU_AMDDuron;
- else
- cpu = CPU_AMDAthlon;
- break;
- default:
- cpu = CPU_UnkAMD;
- }
- }
- else if (vendor == CPU_IDT) {
- /* Check for IDT WinChip processors */
- switch (cpu & CPU_mask) {
- case 5:
- if ((model = _CPU_getCPUIDModel()) <= 4)
- cpu = CPU_WinChipC6;
- else if (model == 8)
- cpu = CPU_WinChip2;
- else
- cpu = CPU_UnkIDT;
- break;
- default:
- cpu = CPU_UnkIDT;
- }
- }
- else {
- /* Assume a Pentium compatible Intel clone */
- cpu = CPU_Pentium;
- }
- return cpu | vendor | (_CPU_getCPUIDStepping() << CPU_steppingShift);
- }
+ cpu = _CPU_checkCPUID();
+ vendor = cpu & ~CPU_mask;
+ if (vendor == CPU_Intel) {
+ /* Check for Intel processors */
+ switch (cpu & CPU_mask) {
+ case 4: cpu = CPU_i486; break;
+ case 5: cpu = CPU_Pentium; break;
+ case 6:
+ if ((model = _CPU_getCPUIDModel()) == 1)
+ cpu = CPU_PentiumPro;
+ else if (model <= 6) {
+ cacheSize = _CPU_getCacheSize();
+ if ((model == 5 && cacheSize == 0) ||
+ (model == 5 && cacheSize == 256) ||
+ (model == 6 && cacheSize == 128))
+ cpu = CPU_Celeron;
+ else
+ cpu = CPU_PentiumII;
+ }
+ else if (model >= 7) {
+ /* Model 7 == Pentium III */
+ /* Model 8 == Celeron/Pentium III Coppermine */
+ cacheSize = _CPU_getCacheSize();
+ if ((model == 8 && cacheSize == 128))
+ cpu = CPU_Celeron;
+ else
+ cpu = CPU_PentiumIII;
+ }
+ break;
+ default:
+ cpu = CPU_UnkIntel;
+ }
+ }
+ else if (vendor == CPU_Cyrix) {
+ /* Check for Cyrix processors */
+ switch (cpu & CPU_mask) {
+ case 4:
+ if ((model = _CPU_getCPUIDModel()) == 4)
+ cpu = CPU_CyrixMediaGX;
+ else
+ cpu = CPU_UnkCyrix;
+ break;
+ case 5:
+ if ((model = _CPU_getCPUIDModel()) == 2)
+ cpu = CPU_Cyrix6x86;
+ else if (model == 4)
+ cpu = CPU_CyrixMediaGXm;
+ else
+ cpu = CPU_UnkCyrix;
+ break;
+ case 6:
+ if ((model = _CPU_getCPUIDModel()) <= 1)
+ cpu = CPU_Cyrix6x86MX;
+ else
+ cpu = CPU_UnkCyrix;
+ break;
+ default:
+ cpu = CPU_UnkCyrix;
+ }
+ }
+ else if (vendor == CPU_AMD) {
+ /* Check for AMD processors */
+ switch (cpu & CPU_mask) {
+ case 4:
+ if ((model = _CPU_getCPUIDModel()) == 0)
+ cpu = CPU_AMDAm5x86;
+ else
+ cpu = CPU_AMDAm486;
+ break;
+ case 5:
+ if ((model = _CPU_getCPUIDModel()) <= 3)
+ cpu = CPU_AMDK5;
+ else if (model <= 7)
+ cpu = CPU_AMDK6;
+ else if (model == 8)
+ cpu = CPU_AMDK6_2;
+ else if (model == 9)
+ cpu = CPU_AMDK6_III;
+ else if (model == 13) {
+ if (_CPU_getCPUIDStepping() <= 3)
+ cpu = CPU_AMDK6_IIIplus;
+ else
+ cpu = CPU_AMDK6_2plus;
+ }
+ else
+ cpu = CPU_UnkAMD;
+ break;
+ case 6:
+ if ((model = _CPU_getCPUIDModel()) == 3)
+ cpu = CPU_AMDDuron;
+ else
+ cpu = CPU_AMDAthlon;
+ break;
+ default:
+ cpu = CPU_UnkAMD;
+ }
+ }
+ else if (vendor == CPU_IDT) {
+ /* Check for IDT WinChip processors */
+ switch (cpu & CPU_mask) {
+ case 5:
+ if ((model = _CPU_getCPUIDModel()) <= 4)
+ cpu = CPU_WinChipC6;
+ else if (model == 8)
+ cpu = CPU_WinChip2;
+ else
+ cpu = CPU_UnkIDT;
+ break;
+ default:
+ cpu = CPU_UnkIDT;
+ }
+ }
+ else {
+ /* Assume a Pentium compatible Intel clone */
+ cpu = CPU_Pentium;
+ }
+ return cpu | vendor | (_CPU_getCPUIDStepping() << CPU_steppingShift);
+ }
else {
- if (_CPU_check80386())
- cpu = CPU_i386;
- else if (_CPU_check80486()) {
- /* If we get here we may have a Cyrix processor so we can try
- * enabling the CPUID instruction and trying again.
- */
- if (firstTime) {
- firstTime = false;
- _CPU_enableCyrixCPUID();
- return CPU_getProcessorType();
- }
- cpu = CPU_i486;
- }
- else
- cpu = CPU_Pentium;
- if (!_CPU_checkClone())
- return cpu | CPU_Intel;
- return cpu;
- }
+ if (_CPU_check80386())
+ cpu = CPU_i386;
+ else if (_CPU_check80486()) {
+ /* If we get here we may have a Cyrix processor so we can try
+ * enabling the CPUID instruction and trying again.
+ */
+ if (firstTime) {
+ firstTime = false;
+ _CPU_enableCyrixCPUID();
+ return CPU_getProcessorType();
+ }
+ cpu = CPU_i486;
+ }
+ else
+ cpu = CPU_Pentium;
+ if (!_CPU_checkClone())
+ return cpu | CPU_Intel;
+ return cpu;
+ }
#elif defined(__ALPHA__)
return CPU_Alpha;
#elif defined(__MIPS__)
@@ -337,7 +337,7 @@ ibool ZAPI CPU_haveMMX(void)
{
#ifdef __INTEL__
if (_CPU_haveCPUID())
- return (_CPU_getCPUIDFeatures() & CPU_HaveMMX) != 0;
+ return (_CPU_getCPUIDFeatures() & CPU_HaveMMX) != 0;
return false;
#else
return false;
@@ -366,7 +366,7 @@ ibool ZAPI CPU_have3DNow(void)
{
#ifdef __INTEL__
if (_CPU_haveCPUID())
- return _CPU_have3DNow();
+ return _CPU_have3DNow();
return false;
#else
return false;
@@ -395,7 +395,7 @@ ibool ZAPI CPU_haveSSE(void)
{
#ifdef __INTEL__
if (_CPU_haveCPUID())
- return (_CPU_getCPUIDFeatures() & CPU_HaveSSE) != 0;
+ return (_CPU_getCPUIDFeatures() & CPU_HaveSSE) != 0;
return false;
#else
return false;
@@ -432,7 +432,7 @@ ibool ZAPI CPU_haveRDTSC(void)
{
#ifdef __INTEL__
if (_CPU_haveCPUID())
- return (_CPU_getCPUIDFeatures() & CPU_HaveRDTSC) != 0;
+ return (_CPU_getCPUIDFeatures() & CPU_HaveRDTSC) != 0;
return false;
#else
return false;
@@ -464,22 +464,22 @@ static ulong GetBSFCpuSpeed(
iPriority = SetMaxThreadPriority();
GetCounterFrequency(&count_freq);
for (i = 0; i < SAMPLINGS; i++) {
- GetCounter(&t0);
- for (j = 0; j < INNER_LOOPS; j++)
- _CPU_runBSFLoop(ITERATIONS);
- GetCounter(&t1);
- current = t1.low - t0.low;
- if (current < lowest)
- lowest = current;
- }
+ GetCounter(&t0);
+ for (j = 0; j < INNER_LOOPS; j++)
+ _CPU_runBSFLoop(ITERATIONS);
+ GetCounter(&t1);
+ current = t1.low - t0.low;
+ if (current < lowest)
+ lowest = current;
+ }
RestoreThreadPriority(iPriority);
/* Compute frequency */
ticks = _CPU_mulDiv(lowest,1000000,count_freq.low);
if ((ticks % count_freq.low) > (count_freq.low/2))
- ticks++; /* Round up if necessary */
+ ticks++; /* Round up if necessary */
if (ticks == 0)
- return 0;
+ return 0;
return ((cycles*INNER_LOOPS)/ticks);
}
@@ -513,44 +513,44 @@ static ulong GetRDTSCCpuSpeed(
GetCounterFrequency(&count_freq);
PM_set64(freq,count_freq.high,count_freq.low);
for (tries = 0; tries < 3; tries++) {
- /* Loop until 100 ticks have passed since last read of hi-res
- * counter. This accounts for overhead later.
- */
- GetCounter(&t0);
- t1.low = t0.low;
- t1.high = t0.high;
- while ((t1.low - t0.low) < 100) {
- GetCounter(&t1);
- _CPU_readTimeStamp(&s0);
- }
-
- /* Loop until 30000 ticks have passed since last read of hi-res counter.
- * This allows for elapsed time for sampling. For a hi-res frequency
- * of 1MHz, this is about 0.03 of a second. The frequency reported
- * by the OS dependent code should be tuned to provide a good
- * sample period depending on the accuracy of the OS timers (ie:
- * if the accuracy is lower, lower the frequency to spend more time
- * in the inner loop to get better accuracy).
- */
- t0.low = t1.low;
- t0.high = t1.high;
- while ((t1.low - t0.low) < maxCount) {
- GetCounter(&t1);
- _CPU_readTimeStamp(&s1);
- }
-
- /* Find the difference during the timing loop */
- PM_set64(stamp0,s0.high,s0.low);
- PM_set64(stamp1,s1.high,s1.low);
- PM_set64(ticks0,t0.high,t0.low);
- PM_set64(ticks1,t1.high,t1.low);
- PM_sub64(cycles,stamp1,stamp0);
- PM_sub64(ticks,ticks1,ticks0);
-
- /* Sum up the results */
- PM_add64(total_ticks,total_ticks,ticks);
- PM_add64(total_cycles,total_cycles,cycles);
- }
+ /* Loop until 100 ticks have passed since last read of hi-res
+ * counter. This accounts for overhead later.
+ */
+ GetCounter(&t0);
+ t1.low = t0.low;
+ t1.high = t0.high;
+ while ((t1.low - t0.low) < 100) {
+ GetCounter(&t1);
+ _CPU_readTimeStamp(&s0);
+ }
+
+ /* Loop until 30000 ticks have passed since last read of hi-res counter.
+ * This allows for elapsed time for sampling. For a hi-res frequency
+ * of 1MHz, this is about 0.03 of a second. The frequency reported
+ * by the OS dependent code should be tuned to provide a good
+ * sample period depending on the accuracy of the OS timers (ie:
+ * if the accuracy is lower, lower the frequency to spend more time
+ * in the inner loop to get better accuracy).
+ */
+ t0.low = t1.low;
+ t0.high = t1.high;
+ while ((t1.low - t0.low) < maxCount) {
+ GetCounter(&t1);
+ _CPU_readTimeStamp(&s1);
+ }
+
+ /* Find the difference during the timing loop */
+ PM_set64(stamp0,s0.high,s0.low);
+ PM_set64(stamp1,s1.high,s1.low);
+ PM_set64(ticks0,t0.high,t0.low);
+ PM_set64(ticks1,t1.high,t1.low);
+ PM_sub64(cycles,stamp1,stamp0);
+ PM_sub64(ticks,ticks1,ticks0);
+
+ /* Sum up the results */
+ PM_add64(total_ticks,total_ticks,ticks);
+ PM_add64(total_cycles,total_cycles,cycles);
+ }
RestoreThreadPriority(iPriority);
/* Compute frequency in Hz */
@@ -598,46 +598,46 @@ ulong ZAPI CPU_getProcessorSpeed(
ulong cpuSpeed;
uint i;
static ulong intel_cycles[] = {
- 115,47,43,
- };
+ 115,47,43,
+ };
static ulong cyrix_cycles[] = {
- 38,38,52,52,
- };
+ 38,38,52,52,
+ };
static ulong amd_cycles[] = {
- 49,
- };
+ 49,
+ };
static ulong known_speeds[] = {
- 1000,950,900,850,800,750,700,650,600,550,500,450,433,400,350,
- 333,300,266,233,200,166,150,133,120,100,90,75,66,60,50,33,20,0,
- };
+ 1000,950,900,850,800,750,700,650,600,550,500,450,433,400,350,
+ 333,300,266,233,200,166,150,133,120,100,90,75,66,60,50,33,20,0,
+ };
if (CPU_haveRDTSC()) {
- cpuSpeed = (GetRDTSCCpuSpeed(accurate) + 500000) / 1000000;
- }
+ cpuSpeed = (GetRDTSCCpuSpeed(accurate) + 500000) / 1000000;
+ }
else {
- int type = CPU_getProcessorType();
- int processor = type & CPU_mask;
- int vendor = type & CPU_familyMask;
- if (vendor == CPU_Intel)
- cpuSpeed = GetBSFCpuSpeed(ITERATIONS * intel_cycles[processor - CPU_i386]);
- else if (vendor == CPU_Cyrix)
- cpuSpeed = GetBSFCpuSpeed(ITERATIONS * cyrix_cycles[processor - CPU_Cyrix6x86]);
- else if (vendor == CPU_AMD)
- cpuSpeed = GetBSFCpuSpeed(ITERATIONS * amd_cycles[0]);
- else
- return 0;
- }
+ int type = CPU_getProcessorType();
+ int processor = type & CPU_mask;
+ int vendor = type & CPU_familyMask;
+ if (vendor == CPU_Intel)
+ cpuSpeed = GetBSFCpuSpeed(ITERATIONS * intel_cycles[processor - CPU_i386]);
+ else if (vendor == CPU_Cyrix)
+ cpuSpeed = GetBSFCpuSpeed(ITERATIONS * cyrix_cycles[processor - CPU_Cyrix6x86]);
+ else if (vendor == CPU_AMD)
+ cpuSpeed = GetBSFCpuSpeed(ITERATIONS * amd_cycles[0]);
+ else
+ return 0;
+ }
/* Now normalise the results given known processors speeds, if the
* speed we measure is within 2MHz of the expected values
*/
if (!accurate) {
- for (i = 0; known_speeds[i] != 0; i++) {
- if (cpuSpeed >= (known_speeds[i]-3) && cpuSpeed <= (known_speeds[i]+3)) {
- return known_speeds[i];
- }
- }
- }
+ for (i = 0; known_speeds[i] != 0; i++) {
+ if (cpuSpeed >= (known_speeds[i]-3) && cpuSpeed <= (known_speeds[i]+3)) {
+ return known_speeds[i];
+ }
+ }
+ }
return cpuSpeed;
#else
return 0;
@@ -674,8 +674,8 @@ ulong ZAPI CPU_getProcessorSpeedInHZ(
{
#if defined(__INTEL__)
if (CPU_haveRDTSC()) {
- return GetRDTSCCpuSpeed(accurate);
- }
+ return GetRDTSCCpuSpeed(accurate);
+ }
return CPU_getProcessorSpeed(false) * 1000000;
#else
return 0;
@@ -706,101 +706,101 @@ char * ZAPI CPU_getProcessorName(void)
static char name[80];
if (speed == -1) {
- cpu = CPU_getProcessorType();
- speed = CPU_getProcessorSpeed(false);
- }
+ cpu = CPU_getProcessorType();
+ speed = CPU_getProcessorSpeed(false);
+ }
sprintf(name,"%d MHz ", speed);
switch (cpu & CPU_mask) {
- case CPU_i386:
- strcat(name,"Intel i386 processor");
- break;
- case CPU_i486:
- strcat(name,"Intel i486 processor");
- break;
- case CPU_Pentium:
- strcat(name,"Intel Pentium processor");
- break;
- case CPU_PentiumPro:
- strcat(name,"Intel Pentium Pro processor");
- break;
- case CPU_PentiumII:
- strcat(name,"Intel Pentium II processor");
- break;
- case CPU_Celeron:
- strcat(name,"Intel Celeron processor");
- break;
- case CPU_PentiumIII:
- strcat(name,"Intel Pentium III processor");
- break;
- case CPU_UnkIntel:
- strcat(name,"Unknown Intel processor");
- break;
- case CPU_Cyrix6x86:
- strcat(name,"Cyrix 6x86 processor");
- break;
- case CPU_Cyrix6x86MX:
- strcat(name,"Cyrix 6x86MX processor");
- break;
- case CPU_CyrixMediaGX:
- strcat(name,"Cyrix MediaGX processor");
- break;
- case CPU_CyrixMediaGXm:
- strcat(name,"Cyrix MediaGXm processor");
- break;
- case CPU_UnkCyrix:
- strcat(name,"Unknown Cyrix processor");
- break;
- case CPU_AMDAm486:
- strcat(name,"AMD Am486 processor");
- break;
- case CPU_AMDAm5x86:
- strcat(name,"AMD Am5x86 processor");
- break;
- case CPU_AMDK5:
- strcat(name,"AMD K5 processor");
- break;
- case CPU_AMDK6:
- strcat(name,"AMD K6 processor");
- break;
- case CPU_AMDK6_2:
- strcat(name,"AMD K6-2 processor");
- break;
- case CPU_AMDK6_III:
- strcat(name,"AMD K6-III processor");
- break;
- case CPU_AMDK6_2plus:
- strcat(name,"AMD K6-2+ processor");
- break;
- case CPU_AMDK6_IIIplus:
- strcat(name,"AMD K6-III+ processor");
- break;
- case CPU_UnkAMD:
- strcat(name,"Unknown AMD processor");
- break;
- case CPU_AMDAthlon:
- strcat(name,"AMD Athlon processor");
- break;
- case CPU_AMDDuron:
- strcat(name,"AMD Duron processor");
- break;
- case CPU_WinChipC6:
- strcat(name,"IDT WinChip C6 processor");
- break;
- case CPU_WinChip2:
- strcat(name,"IDT WinChip 2 processor");
- break;
- case CPU_UnkIDT:
- strcat(name,"Unknown IDT processor");
- break;
- default:
- strcat(name,"Unknown processor");
- }
+ case CPU_i386:
+ strcat(name,"Intel i386 processor");
+ break;
+ case CPU_i486:
+ strcat(name,"Intel i486 processor");
+ break;
+ case CPU_Pentium:
+ strcat(name,"Intel Pentium processor");
+ break;
+ case CPU_PentiumPro:
+ strcat(name,"Intel Pentium Pro processor");
+ break;
+ case CPU_PentiumII:
+ strcat(name,"Intel Pentium II processor");
+ break;
+ case CPU_Celeron:
+ strcat(name,"Intel Celeron processor");
+ break;
+ case CPU_PentiumIII:
+ strcat(name,"Intel Pentium III processor");
+ break;
+ case CPU_UnkIntel:
+ strcat(name,"Unknown Intel processor");
+ break;
+ case CPU_Cyrix6x86:
+ strcat(name,"Cyrix 6x86 processor");
+ break;
+ case CPU_Cyrix6x86MX:
+ strcat(name,"Cyrix 6x86MX processor");
+ break;
+ case CPU_CyrixMediaGX:
+ strcat(name,"Cyrix MediaGX processor");
+ break;
+ case CPU_CyrixMediaGXm:
+ strcat(name,"Cyrix MediaGXm processor");
+ break;
+ case CPU_UnkCyrix:
+ strcat(name,"Unknown Cyrix processor");
+ break;
+ case CPU_AMDAm486:
+ strcat(name,"AMD Am486 processor");
+ break;
+ case CPU_AMDAm5x86:
+ strcat(name,"AMD Am5x86 processor");
+ break;
+ case CPU_AMDK5:
+ strcat(name,"AMD K5 processor");
+ break;
+ case CPU_AMDK6:
+ strcat(name,"AMD K6 processor");
+ break;
+ case CPU_AMDK6_2:
+ strcat(name,"AMD K6-2 processor");
+ break;
+ case CPU_AMDK6_III:
+ strcat(name,"AMD K6-III processor");
+ break;
+ case CPU_AMDK6_2plus:
+ strcat(name,"AMD K6-2+ processor");
+ break;
+ case CPU_AMDK6_IIIplus:
+ strcat(name,"AMD K6-III+ processor");
+ break;
+ case CPU_UnkAMD:
+ strcat(name,"Unknown AMD processor");
+ break;
+ case CPU_AMDAthlon:
+ strcat(name,"AMD Athlon processor");
+ break;
+ case CPU_AMDDuron:
+ strcat(name,"AMD Duron processor");
+ break;
+ case CPU_WinChipC6:
+ strcat(name,"IDT WinChip C6 processor");
+ break;
+ case CPU_WinChip2:
+ strcat(name,"IDT WinChip 2 processor");
+ break;
+ case CPU_UnkIDT:
+ strcat(name,"Unknown IDT processor");
+ break;
+ default:
+ strcat(name,"Unknown processor");
+ }
if (CPU_haveMMX())
- strcat(name," with MMX(R)");
+ strcat(name," with MMX(R)");
if (CPU_have3DNow())
- strcat(name,", 3DNow!(R)");
+ strcat(name,", 3DNow!(R)");
if (CPU_haveSSE())
- strcat(name,", SSE(R)");
+ strcat(name,", SSE(R)");
return name;
#else
return "Unknown";
diff --git a/board/MAI/bios_emulator/scitech/src/pm/debug.c b/board/MAI/bios_emulator/scitech/src/pm/debug.c
index d86e3e6a0d..751bf098fc 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/debug.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/debug.c
@@ -61,23 +61,23 @@ void _CHK_defaultFail(
char buf[256];
if (logFile[0] == 0) {
- strcpy(logFile,PM_getNucleusPath());
- PM_backslash(logFile);
- strcat(logFile,"scitech.log");
- }
+ strcpy(logFile,PM_getNucleusPath());
+ PM_backslash(logFile);
+ strcat(logFile,"scitech.log");
+ }
if ((f = fopen(logFile,"a+")) != NULL) {
#if defined(__WIN32_VXD__) || defined(__OS2_VDD__) || defined(__NT_DRIVER__)
- sprintf(buf,msg,cond,file,line);
- fwrite(buf,1,strlen(buf),f);
+ sprintf(buf,msg,cond,file,line);
+ fwrite(buf,1,strlen(buf),f);
#else
- fprintf(f,msg,cond,file,line);
+ fprintf(f,msg,cond,file,line);
#endif
- fclose(f);
- }
+ fclose(f);
+ }
if (fatal) {
- sprintf(buf,"Check failed: check '%s' for details", logFile);
- PM_fatalError(buf);
- }
+ sprintf(buf,"Check failed: check '%s' for details", logFile);
+ PM_fatalError(buf);
+ }
}
#endif
diff --git a/board/MAI/bios_emulator/scitech/src/pm/dos/event.c b/board/MAI/bios_emulator/scitech/src/pm/dos/event.c
index 12ecb298bc..a969d111b4 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/dos/event.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/dos/event.c
@@ -75,7 +75,7 @@ static void EVTAPI _EVT_pumpMessages(void)
_EVT_restoreInt(ps);
}
- regs.x.ax = 0x0B; // Reset Move Mouse
+ regs.x.ax = 0x0B; /* Reset Move Mouse */
PM_int86(0x33,&regs,&regs);
}
#endif
@@ -178,8 +178,8 @@ Adds a new mouse event to the event queue. This routine is called from within
the mouse interrupt subroutine, so it must be efficient.
NOTE: Interrupts MUST be OFF while this routine is called to ensure we have
- mutually exclusive access to our internal data structures for
- interrupt driven systems (like under DOS).
+ mutually exclusive access to our internal data structures for
+ interrupt driven systems (like under DOS).
****************************************************************************/
static void addMouseEvent(
uint what,
@@ -193,18 +193,18 @@ static void addMouseEvent(
event_t evt;
if (EVT.count < EVENTQSIZE) {
- /* Save information in event record. */
- evt.when = _EVT_getTicks();
- evt.what = what;
- evt.message = message;
- evt.modifiers = but_stat;
- evt.where_x = x; /* Save mouse event position */
- evt.where_y = y;
- evt.relative_x = mickeyX;
- evt.relative_y = mickeyY;
- evt.modifiers |= EVT.keyModifiers;
- addEvent(&evt); /* Add to tail of event queue */
- }
+ /* Save information in event record. */
+ evt.when = _EVT_getTicks();
+ evt.what = what;
+ evt.message = message;
+ evt.modifiers = but_stat;
+ evt.where_x = x; /* Save mouse event position */
+ evt.where_y = y;
+ evt.relative_x = mickeyX;
+ evt.relative_y = mickeyY;
+ evt.modifiers |= EVT.keyModifiers;
+ addEvent(&evt); /* Add to tail of event queue */
+ }
}
/****************************************************************************
@@ -233,47 +233,47 @@ static void EVTAPI mouseISR(
uint buttonMask;
if (mask & 1) {
- /* Save the current mouse coordinates */
- EVT.mx = x; EVT.my = y;
-
- /* If the last event was a movement event, then modify the last
- * event rather than post a new one, so that the queue will not
- * become saturated. Before we modify the data structures, we
- * MUST ensure that interrupts are off.
- */
- ps = _EVT_disableInt();
- if (EVT.oldMove != -1) {
- EVT.evtq[EVT.oldMove].where_x = x; /* Modify existing one */
- EVT.evtq[EVT.oldMove].where_y = y;
- EVT.evtq[EVT.oldMove].relative_x += mickeyX;
- EVT.evtq[EVT.oldMove].relative_y += mickeyY;
- }
- else {
- EVT.oldMove = EVT.freeHead; /* Save id of this move event */
- addMouseEvent(EVT_MOUSEMOVE,0,x,y,mickeyX,mickeyY,butstate);
- }
- _EVT_restoreInt(ps);
- }
+ /* Save the current mouse coordinates */
+ EVT.mx = x; EVT.my = y;
+
+ /* If the last event was a movement event, then modify the last
+ * event rather than post a new one, so that the queue will not
+ * become saturated. Before we modify the data structures, we
+ * MUST ensure that interrupts are off.
+ */
+ ps = _EVT_disableInt();
+ if (EVT.oldMove != -1) {
+ EVT.evtq[EVT.oldMove].where_x = x; /* Modify existing one */
+ EVT.evtq[EVT.oldMove].where_y = y;
+ EVT.evtq[EVT.oldMove].relative_x += mickeyX;
+ EVT.evtq[EVT.oldMove].relative_y += mickeyY;
+ }
+ else {
+ EVT.oldMove = EVT.freeHead; /* Save id of this move event */
+ addMouseEvent(EVT_MOUSEMOVE,0,x,y,mickeyX,mickeyY,butstate);
+ }
+ _EVT_restoreInt(ps);
+ }
if (mask & 0x2A) {
- ps = _EVT_disableInt();
- buttonMask = 0;
- if (mask & 2) buttonMask |= EVT_LEFTBMASK;
- if (mask & 8) buttonMask |= EVT_RIGHTBMASK;
- if (mask & 32) buttonMask |= EVT_MIDDLEBMASK;
- addMouseEvent(EVT_MOUSEDOWN,buttonMask,x,y,0,0,butstate);
- EVT.oldMove = -1;
- _EVT_restoreInt(ps);
- }
+ ps = _EVT_disableInt();
+ buttonMask = 0;
+ if (mask & 2) buttonMask |= EVT_LEFTBMASK;
+ if (mask & 8) buttonMask |= EVT_RIGHTBMASK;
+ if (mask & 32) buttonMask |= EVT_MIDDLEBMASK;
+ addMouseEvent(EVT_MOUSEDOWN,buttonMask,x,y,0,0,butstate);
+ EVT.oldMove = -1;
+ _EVT_restoreInt(ps);
+ }
if (mask & 0x54) {
- ps = _EVT_disableInt();
- buttonMask = 0;
- if (mask & 2) buttonMask |= EVT_LEFTBMASK;
- if (mask & 8) buttonMask |= EVT_RIGHTBMASK;
- if (mask & 32) buttonMask |= EVT_MIDDLEBMASK;
- addMouseEvent(EVT_MOUSEUP,buttonMask,x,y,0,0,butstate);
- EVT.oldMove = -1;
- _EVT_restoreInt(ps);
- }
+ ps = _EVT_disableInt();
+ buttonMask = 0;
+ if (mask & 2) buttonMask |= EVT_LEFTBMASK;
+ if (mask & 8) buttonMask |= EVT_RIGHTBMASK;
+ if (mask & 32) buttonMask |= EVT_MIDDLEBMASK;
+ addMouseEvent(EVT_MOUSEUP,buttonMask,x,y,0,0,butstate);
+ EVT.oldMove = -1;
+ _EVT_restoreInt(ps);
+ }
EVT.oldKey = -1;
}
@@ -282,7 +282,7 @@ REMARKS:
Keyboard interrupt handler function.
NOTE: Interrupts are OFF when this routine is called by the keyboard ISR,
- and we leave them OFF the entire time.
+ and we leave them OFF the entire time.
****************************************************************************/
static void EVTAPI keyboardISR(void)
{
@@ -327,7 +327,7 @@ void EVTAPI EVT_init(
* while the program is initialising.
*/
while ((i = _EVT_getKeyCode()) != 0)
- addKeyEvent(EVT_KEYDOWN,i);
+ addKeyEvent(EVT_KEYDOWN,i);
}
/****************************************************************************
@@ -344,62 +344,62 @@ void EVTAPI EVT_resume(void)
PM_lockHandle lh; /* Unused in DOS */
if (_EVT_useEvents) {
- /* Initialise the event queue and enable our interrupt handlers */
- initEventQueue();
+ /* Initialise the event queue and enable our interrupt handlers */
+ initEventQueue();
#ifndef NO_KEYBOARD_INTERRUPT
- PM_setKeyHandler(keyboardISR);
+ PM_setKeyHandler(keyboardISR);
#endif
#ifndef NO_MOUSE_INTERRUPT
- if ((haveMouse = detectMouse()) != 0) {
- int oldmode = _EVT_foolMouse();
- PM_setMouseHandler(0xFFFF,mouseISR);
- _EVT_unfoolMouse(oldmode);
- }
+ if ((haveMouse = detectMouse()) != 0) {
+ int oldmode = _EVT_foolMouse();
+ PM_setMouseHandler(0xFFFF,mouseISR);
+ _EVT_unfoolMouse(oldmode);
+ }
#endif
- /* Read the keyboard modifier flags from the BIOS to get the
- * correct initialisation state. The only state we care about is
- * the correct toggle state flags such as SCROLLLOCK, NUMLOCK and
- * CAPSLOCK.
- */
- EVT.keyModifiers = 0;
- mods = PM_getByte(_EVT_biosPtr+0x17);
- if (mods & 0x10)
- EVT.keyModifiers |= EVT_SCROLLLOCK;
- if (mods & 0x20)
- EVT.keyModifiers |= EVT_NUMLOCK;
- if (mods & 0x40)
- EVT.keyModifiers |= EVT_CAPSLOCK;
-
- /* Lock all of the code and data used by our protected mode interrupt
- * handling routines, so that it will continue to work correctly
- * under real mode.
- */
- if (!locked) {
- /* It is difficult to ensure that we lock our global data, so we
- * do this by taking the address of a variable locking all data
- * 2Kb on either side. This should properly cover the global data
- * used by the module (the other alternative is to declare the
- * variables in assembler, in which case we know it will be
- * correct).
- */
- stat = !PM_lockDataPages(&EVT,sizeof(EVT),&lh);
- stat |= !PM_lockDataPages(&_EVT_biosPtr,sizeof(_EVT_biosPtr),&lh);
- stat |= !PM_lockCodePages((__codePtr)_EVT_cCodeStart,(int)_EVT_cCodeEnd-(int)_EVT_cCodeStart,&lh);
- stat |= !PM_lockCodePages((__codePtr)_EVT_codeStart,(int)_EVT_codeEnd-(int)_EVT_codeStart,&lh);
- if (stat) {
- PM_fatalError("Page locking services failed - interrupt handling not safe!");
- exit(1);
- }
- locked = 1;
- }
-
- /* Catch program termination signals so we can clean up properly */
- signal(SIGABRT, _EVT_abort);
- signal(SIGFPE, _EVT_abort);
- signal(SIGINT, _EVT_abort);
- _EVT_installed = true;
- }
+ /* Read the keyboard modifier flags from the BIOS to get the
+ * correct initialisation state. The only state we care about is
+ * the correct toggle state flags such as SCROLLLOCK, NUMLOCK and
+ * CAPSLOCK.
+ */
+ EVT.keyModifiers = 0;
+ mods = PM_getByte(_EVT_biosPtr+0x17);
+ if (mods & 0x10)
+ EVT.keyModifiers |= EVT_SCROLLLOCK;
+ if (mods & 0x20)
+ EVT.keyModifiers |= EVT_NUMLOCK;
+ if (mods & 0x40)
+ EVT.keyModifiers |= EVT_CAPSLOCK;
+
+ /* Lock all of the code and data used by our protected mode interrupt
+ * handling routines, so that it will continue to work correctly
+ * under real mode.
+ */
+ if (!locked) {
+ /* It is difficult to ensure that we lock our global data, so we
+ * do this by taking the address of a variable locking all data
+ * 2Kb on either side. This should properly cover the global data
+ * used by the module (the other alternative is to declare the
+ * variables in assembler, in which case we know it will be
+ * correct).
+ */
+ stat = !PM_lockDataPages(&EVT,sizeof(EVT),&lh);
+ stat |= !PM_lockDataPages(&_EVT_biosPtr,sizeof(_EVT_biosPtr),&lh);
+ stat |= !PM_lockCodePages((__codePtr)_EVT_cCodeStart,(int)_EVT_cCodeEnd-(int)_EVT_cCodeStart,&lh);
+ stat |= !PM_lockCodePages((__codePtr)_EVT_codeStart,(int)_EVT_codeEnd-(int)_EVT_codeStart,&lh);
+ if (stat) {
+ PM_fatalError("Page locking services failed - interrupt handling not safe!");
+ exit(1);
+ }
+ locked = 1;
+ }
+
+ /* Catch program termination signals so we can clean up properly */
+ signal(SIGABRT, _EVT_abort);
+ signal(SIGFPE, _EVT_abort);
+ signal(SIGINT, _EVT_abort);
+ _EVT_installed = true;
+ }
}
/****************************************************************************
@@ -415,18 +415,18 @@ void EVTAPI EVT_setMouseRange(
RMREGS regs;
if (haveMouse) {
- int oldmode = _EVT_foolMouse();
- PM_resetMouseDriver(1);
- regs.x.ax = 7; /* Mouse function 7 - Set horizontal min and max */
- regs.x.cx = 0;
- regs.x.dx = xRes;
- PM_int86(0x33,&regs,&regs);
- regs.x.ax = 8; /* Mouse function 8 - Set vertical min and max */
- regs.x.cx = 0;
- regs.x.dx = yRes;
- PM_int86(0x33,&regs,&regs);
- _EVT_unfoolMouse(oldmode);
- }
+ int oldmode = _EVT_foolMouse();
+ PM_resetMouseDriver(1);
+ regs.x.ax = 7; /* Mouse function 7 - Set horizontal min and max */
+ regs.x.cx = 0;
+ regs.x.dx = xRes;
+ PM_int86(0x33,&regs,&regs);
+ regs.x.ax = 8; /* Mouse function 8 - Set vertical min and max */
+ regs.x.cx = 0;
+ regs.x.dx = yRes;
+ PM_int86(0x33,&regs,&regs);
+ _EVT_unfoolMouse(oldmode);
+ }
}
/****************************************************************************
@@ -441,13 +441,13 @@ void _EVT_setMousePos(
RMREGS regs;
if (haveMouse) {
- int oldmode = _EVT_foolMouse();
- regs.x.ax = 4; /* Mouse function 4 - Set mouse position */
- regs.x.cx = *x; /* New horizontal coordinate */
- regs.x.dx = *y; /* New vertical coordinate */
- PM_int86(0x33,&regs,&regs);
- _EVT_unfoolMouse(oldmode);
- }
+ int oldmode = _EVT_foolMouse();
+ regs.x.ax = 4; /* Mouse function 4 - Set mouse position */
+ regs.x.cx = *x; /* New horizontal coordinate */
+ regs.x.dx = *y; /* New vertical coordinate */
+ PM_int86(0x33,&regs,&regs);
+ _EVT_unfoolMouse(oldmode);
+ }
}
/****************************************************************************
@@ -460,28 +460,28 @@ void EVTAPI EVT_suspend(void)
uchar mods;
if (_EVT_installed) {
- /* Restore the interrupt handlers */
- PM_restoreKeyHandler();
- if (haveMouse)
- PM_restoreMouseHandler();
- signal(SIGABRT, SIG_DFL);
- signal(SIGFPE, SIG_DFL);
- signal(SIGINT, SIG_DFL);
-
- /* Set the keyboard modifier flags in the BIOS to our values */
- EVT_allowLEDS(true);
- mods = PM_getByte(_EVT_biosPtr+0x17) & ~0x70;
- if (EVT.keyModifiers & EVT_SCROLLLOCK)
- mods |= 0x10;
- if (EVT.keyModifiers & EVT_NUMLOCK)
- mods |= 0x20;
- if (EVT.keyModifiers & EVT_CAPSLOCK)
- mods |= 0x40;
- PM_setByte(_EVT_biosPtr+0x17,mods);
-
- /* Flag that we are no longer installed */
- _EVT_installed = false;
- }
+ /* Restore the interrupt handlers */
+ PM_restoreKeyHandler();
+ if (haveMouse)
+ PM_restoreMouseHandler();
+ signal(SIGABRT, SIG_DFL);
+ signal(SIGFPE, SIG_DFL);
+ signal(SIGINT, SIG_DFL);
+
+ /* Set the keyboard modifier flags in the BIOS to our values */
+ EVT_allowLEDS(true);
+ mods = PM_getByte(_EVT_biosPtr+0x17) & ~0x70;
+ if (EVT.keyModifiers & EVT_SCROLLLOCK)
+ mods |= 0x10;
+ if (EVT.keyModifiers & EVT_NUMLOCK)
+ mods |= 0x20;
+ if (EVT.keyModifiers & EVT_CAPSLOCK)
+ mods |= 0x40;
+ PM_setByte(_EVT_biosPtr+0x17,mods);
+
+ /* Flag that we are no longer installed */
+ _EVT_installed = false;
+ }
}
/****************************************************************************
diff --git a/board/MAI/bios_emulator/scitech/src/pm/dos/pm.c b/board/MAI/bios_emulator/scitech/src/pm/dos/pm.c
index 71acd6894e..2ad9e34f91 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/dos/pm.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/dos/pm.c
@@ -156,7 +156,7 @@ void PMAPI PM_VxDCall(
VXD_regs *regs)
{
if (_PM_VXD_sel != 0 || _PM_VXD_off != 0)
- _PM_VxDCall(regs,_PM_VXD_off,_PM_VXD_sel);
+ _PM_VxDCall(regs,_PM_VXD_off,_PM_VXD_sel);
}
/****************************************************************************
@@ -172,11 +172,11 @@ uint PMAPI PMHELP_getVersion(void)
/* Call the helper VxD to determine the version number */
if (_PM_VXD_sel != 0 || _PM_VXD_off != 0) {
- memset(&r,0,sizeof(r));
- r.eax = API_NUM(PMHELP_GETVER);
- _PM_VxDCall(&r,_PM_VXD_off,_PM_VXD_sel);
- return VXD_version = (uint)r.eax;
- }
+ memset(&r,0,sizeof(r));
+ r.eax = API_NUM(PMHELP_GETVER);
+ _PM_VxDCall(&r,_PM_VXD_off,_PM_VXD_sel);
+ return VXD_version = (uint)r.eax;
+ }
return VXD_version = 0;
}
@@ -199,7 +199,7 @@ static ibool PMHELP_connect(void)
/* Bail early if we have alread connected */
if (VXD_version != -1)
- return VXD_version != 0;
+ return VXD_version != 0;
/* Get the static SDDHELP.VXD entry point if available */
PM_segread(&sregs);
@@ -211,9 +211,9 @@ static ibool PMHELP_connect(void)
_PM_VXD_sel = sregs.es;
_PM_VXD_off = regs.x.di;
if (_PM_VXD_sel != 0 || _PM_VXD_off != 0) {
- if (PMHELP_getVersion() >= PMHELP_VERSION)
- return true;
- }
+ if (PMHELP_getVersion() >= PMHELP_VERSION)
+ return true;
+ }
/* If we get here, then either SDDHELP.VXD is not loaded, or it is an
* earlier version. In this case try to dynamically load the PMHELP.VXD
@@ -228,7 +228,7 @@ static ibool PMHELP_connect(void)
VXD_loadSel = sregs.es;
VXD_loadOff = regs.x.di;
if (VXD_loadSel == 0 && VXD_loadOff == 0)
- return VXD_version = 0;
+ return VXD_version = 0;
r.eax = 1;
r.ebx = 0;
r.edx = (uint)VXD_name;
@@ -237,7 +237,7 @@ static ibool PMHELP_connect(void)
r.es = sregs.es;
_PM_VxDCall(&r,VXD_loadOff,VXD_loadSel);
if (r.eax != 0)
- return VXD_version = 0;
+ return VXD_version = 0;
/* Get the dynamic VxD entry point so we can call it */
atexit(UnloadVxD);
@@ -249,9 +249,9 @@ static ibool PMHELP_connect(void)
_PM_VXD_sel = sregs.es;
_PM_VXD_off = regs.x.di;
if (_PM_VXD_sel == 0 && _PM_VXD_off == 0)
- return VXD_version = 0;
+ return VXD_version = 0;
if (PMHELP_getVersion() >= PMHELP_VERSION)
- return true;
+ return true;
return VXD_version = 0;
}
#endif
@@ -269,24 +269,24 @@ void PMAPI PM_init(void)
/* Check if we are running under CauseWay under real DOS */
if (_PM_haveCauseWay == -1) {
- /* Check if we are running under DPMI in which case we will not be
- * able to use our special ring 0 CauseWay functions.
- */
- _PM_haveCauseWay = false;
- regs.x.ax = 0xFF00;
- PM_int386(0x31,&regs,&regs);
- if (regs.x.cflag || !(regs.e.edi & 8)) {
- /* We are not under DPMI, so now check if CauseWay is active */
- regs.x.ax = 0xFFF9;
- PM_int386(0x31,&regs,&regs);
- if (!regs.x.cflag && regs.e.ecx == 0x43415553 && regs.e.edx == 0x45574159)
- _PM_haveCauseWay = true;
- }
-
- /* Now connect to PMHELP.VXD and initialise MTRR module */
- if (!PMHELP_connect())
- MTRR_init();
- }
+ /* Check if we are running under DPMI in which case we will not be
+ * able to use our special ring 0 CauseWay functions.
+ */
+ _PM_haveCauseWay = false;
+ regs.x.ax = 0xFF00;
+ PM_int386(0x31,&regs,&regs);
+ if (regs.x.cflag || !(regs.e.edi & 8)) {
+ /* We are not under DPMI, so now check if CauseWay is active */
+ regs.x.ax = 0xFFF9;
+ PM_int386(0x31,&regs,&regs);
+ if (!regs.x.cflag && regs.e.ecx == 0x43415553 && regs.e.edx == 0x45574159)
+ _PM_haveCauseWay = true;
+ }
+
+ /* Now connect to PMHELP.VXD and initialise MTRR module */
+ if (!PMHELP_connect())
+ MTRR_init();
+ }
#endif
}
@@ -311,14 +311,14 @@ int PMAPI PM_enableWriteCombine(
VXD_regs regs;
if (PMHELP_connect()) {
- memset(&regs,0,sizeof(regs));
- regs.eax = API_NUM(PMHELP_ENABLELFBCOMB);
- regs.ebx = base;
- regs.ecx = size;
- regs.edx = type;
- _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
- return regs.eax;
- }
+ memset(&regs,0,sizeof(regs));
+ regs.eax = API_NUM(PMHELP_ENABLELFBCOMB);
+ regs.ebx = base;
+ regs.ecx = size;
+ regs.edx = type;
+ _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
+ return regs.eax;
+ }
return MTRR_enableWriteCombine(base,size,type);
#else
return PM_MTRR_NOT_SUPPORTED;
@@ -346,9 +346,9 @@ void PMAPI PM_backslash(char *s)
{
uint pos = strlen(s);
if (s[pos-1] != '\\') {
- s[pos] = '\\';
- s[pos+1] = '\0';
- }
+ s[pos] = '\\';
+ s[pos+1] = '\0';
+ }
}
void PMAPI PM_setFatalErrorCleanup(
@@ -360,7 +360,7 @@ void PMAPI PM_setFatalErrorCleanup(
void PMAPI PM_fatalError(const char *msg)
{
if (fatalErrorCleanup)
- fatalErrorCleanup();
+ fatalErrorCleanup();
fprintf(stderr,"%s\n", msg);
exit(1);
}
@@ -368,18 +368,18 @@ void PMAPI PM_fatalError(const char *msg)
static void ExitVBEBuf(void)
{
if (VESABuf_ptr)
- PM_freeRealSeg(VESABuf_ptr);
+ PM_freeRealSeg(VESABuf_ptr);
VESABuf_ptr = 0;
}
void * PMAPI PM_getVESABuf(uint *len,uint *rseg,uint *roff)
{
if (!VESABuf_ptr) {
- /* Allocate a global buffer for communicating with the VESA VBE */
- if ((VESABuf_ptr = PM_allocRealSeg(VESABuf_len, &VESABuf_rseg, &VESABuf_roff)) == NULL)
- return NULL;
- atexit(ExitVBEBuf);
- }
+ /* Allocate a global buffer for communicating with the VESA VBE */
+ if ((VESABuf_ptr = PM_allocRealSeg(VESABuf_len, &VESABuf_rseg, &VESABuf_roff)) == NULL)
+ return NULL;
+ atexit(ExitVBEBuf);
+ }
*len = VESABuf_len;
*rseg = VESABuf_rseg;
*roff = VESABuf_roff;
@@ -429,12 +429,12 @@ void PMAPI _PM_addRealModeBlock(void *mem,uint tag)
int i;
for (i = 0; i < MAX_RM_BLOCKS; i++) {
- if (rmBlocks[i].p == NULL) {
- rmBlocks[i].p = mem;
- rmBlocks[i].tag = tag;
- return;
- }
- }
+ if (rmBlocks[i].p == NULL) {
+ rmBlocks[i].p = mem;
+ rmBlocks[i].tag = tag;
+ return;
+ }
+ }
PM_fatalError("To many real mode memory block allocations!");
}
@@ -443,9 +443,9 @@ uint PMAPI _PM_findRealModeBlock(void *mem)
int i;
for (i = 0; i < MAX_RM_BLOCKS; i++) {
- if (rmBlocks[i].p == mem)
- return rmBlocks[i].tag;
- }
+ if (rmBlocks[i].p == mem)
+ return rmBlocks[i].tag;
+ }
PM_fatalError("Could not find prior real mode memory block allocation!");
return 0;
}
@@ -469,19 +469,19 @@ const char * PMAPI PM_getNucleusPath(void)
char *env;
if ((env = getenv("NUCLEUS_PATH")) != NULL)
- return env;
+ return env;
if ((env = getenv("WINBOOTDIR")) != NULL) {
- /* Running in a Windows 9x DOS box or DOS mode */
- strcpy(path,env);
- strcat(path,"\\system\\nucleus");
- return path;
- }
+ /* Running in a Windows 9x DOS box or DOS mode */
+ strcpy(path,env);
+ strcat(path,"\\system\\nucleus");
+ return path;
+ }
if ((env = getenv("SystemRoot")) != NULL) {
- /* Running in an NT/2K DOS box */
- strcpy(path,env);
- strcat(path,"\\system32\\nucleus");
- return path;
- }
+ /* Running in an NT/2K DOS box */
+ strcpy(path,env);
+ strcat(path,"\\system32\\nucleus");
+ return path;
+ }
return "c:\\nucleus";
}
@@ -538,12 +538,12 @@ void PMAPI PM_saveConsoleState(void *stateBuf,PM_HWND hwndConsole)
sb->oldMode = regs.h.al & 0x7F;
sb->old50Lines = false;
if (sb->oldMode == 0x3) {
- regs.x.ax = 0x1130;
- regs.x.bx = 0;
- regs.x.dx = 0;
- PM_int86(0x10,&regs,&regs);
- sb->old50Lines = (regs.h.dl == 42 || regs.h.dl == 49);
- }
+ regs.x.ax = 0x1130;
+ regs.x.bx = 0;
+ regs.x.dx = 0;
+ PM_int86(0x10,&regs,&regs);
+ sb->old50Lines = (regs.h.dl == 42 || regs.h.dl == 49);
+ }
(void)hwndConsole;
}
@@ -560,10 +560,10 @@ void PMAPI PM_restoreConsoleState(const void *stateBuf,PM_HWND hwndConsole)
/* Retore 50 line mode if set */
if (sb->old50Lines) {
- regs.x.ax = 0x1112;
- regs.x.bx = 0;
- PM_int86(0x10,&regs,&regs);
- }
+ regs.x.ax = 0x1112;
+ regs.x.bx = 0;
+ PM_int86(0x10,&regs,&regs);
+ }
(void)hwndConsole;
}
@@ -587,13 +587,13 @@ void PMAPI PM_setOSScreenWidth(int width,int height)
PM_setWord(_biosPtr+0x4C,width*2);
PM_setByte(_biosPtr+0x84,height-1);
if (height > 25) {
- PM_setWord(_biosPtr+0x60,0x0607);
- PM_setByte(_biosPtr+0x85,0x08);
- }
+ PM_setWord(_biosPtr+0x60,0x0607);
+ PM_setByte(_biosPtr+0x85,0x08);
+ }
else {
- PM_setWord(_biosPtr+0x60,0x0D0E);
- PM_setByte(_biosPtr+0x85,0x016);
- }
+ PM_setWord(_biosPtr+0x60,0x0D0E);
+ PM_setByte(_biosPtr+0x85,0x016);
+ }
}
void * PMAPI PM_mallocShared(long size)
@@ -623,22 +623,22 @@ ibool PMAPI PM_doBIOSPOST(
/* Create a zero memory mapping for us to use */
if (firstTime) {
- rmZeroPtr = PM_mapPhysicalAddr(0,0x7FFF,true);
- firstTime = false;
- }
+ rmZeroPtr = PM_mapPhysicalAddr(0,0x7FFF,true);
+ firstTime = false;
+ }
/* Remap the secondary BIOS to 0xC0000 physical */
if (BIOSPhysAddr != 0xC0000L || BIOSLen > 32768) {
- /* DOS cannot virtually remap the BIOS, so we can only work if all
- * the secondary controllers are identical, and we then use the
- * BIOS on the first controller for all the remaining controllers.
- *
- * For OS'es that do virtual memory, and remapping of 0xC0000
- * physical (perhaps a copy on write mapping) should be all that
- * is needed.
- */
- return false;
- }
+ /* DOS cannot virtually remap the BIOS, so we can only work if all
+ * the secondary controllers are identical, and we then use the
+ * BIOS on the first controller for all the remaining controllers.
+ *
+ * For OS'es that do virtual memory, and remapping of 0xC0000
+ * physical (perhaps a copy on write mapping) should be all that
+ * is needed.
+ */
+ return false;
+ }
/* Save current handlers of int 10h and 6Dh */
GetRMVect(0x10,&Current10);
@@ -656,9 +656,9 @@ ibool PMAPI PM_doBIOSPOST(
/* Second the primary BIOS mappin 1:1 for 0xC0000 physical */
if (BIOSPhysAddr != 0xC0000L) {
- /* DOS does not support this */
- (void)mappedBIOS;
- }
+ /* DOS does not support this */
+ (void)mappedBIOS;
+ }
return true;
}
@@ -669,26 +669,26 @@ void PMAPI PM_sleep(ulong milliseconds)
LZTimerOnExt(&tm);
while (LZTimerLapExt(&tm) < microseconds)
- ;
+ ;
LZTimerOffExt(&tm);
}
int PMAPI PM_getCOMPort(int port)
{
switch (port) {
- case 0: return 0x3F8;
- case 1: return 0x2F8;
- }
+ case 0: return 0x3F8;
+ case 1: return 0x2F8;
+ }
return 0;
}
int PMAPI PM_getLPTPort(int port)
{
switch (port) {
- case 0: return 0x3BC;
- case 1: return 0x378;
- case 2: return 0x278;
- }
+ case 0: return 0x3BC;
+ case 1: return 0x378;
+ case 2: return 0x278;
+ }
return 0;
}
@@ -733,15 +733,15 @@ static void convertFindData(
memset(findData,0,findData->dwSize);
findData->dwSize = dwSize;
if (blk->attrib & _A_RDONLY)
- findData->attrib |= PM_FILE_READONLY;
+ findData->attrib |= PM_FILE_READONLY;
if (blk->attrib & _A_SUBDIR)
- findData->attrib |= PM_FILE_DIRECTORY;
+ findData->attrib |= PM_FILE_DIRECTORY;
if (blk->attrib & _A_ARCH)
- findData->attrib |= PM_FILE_ARCHIVE;
+ findData->attrib |= PM_FILE_ARCHIVE;
if (blk->attrib & _A_HIDDEN)
- findData->attrib |= PM_FILE_HIDDEN;
+ findData->attrib |= PM_FILE_HIDDEN;
if (blk->attrib & _A_SYSTEM)
- findData->attrib |= PM_FILE_SYSTEM;
+ findData->attrib |= PM_FILE_SYSTEM;
findData->sizeLo = blk->size;
strncpy(findData->name,blk->name,PM_MAX_PATH);
findData->name[PM_MAX_PATH-1] = 0;
@@ -760,11 +760,11 @@ void * PMAPI PM_findFirstFile(
struct find_t *blk;
if ((blk = PM_malloc(sizeof(*blk))) == NULL)
- return PM_FILE_INVALID;
+ return PM_FILE_INVALID;
if (_dos_findfirst((char*)filename,FIND_MASK,blk) == 0) {
- convertFindData(findData,blk);
- return blk;
- }
+ convertFindData(findData,blk);
+ return blk;
+ }
return PM_FILE_INVALID;
}
@@ -779,9 +779,9 @@ ibool PMAPI PM_findNextFile(
struct find_t *blk = handle;
if (_dos_findnext(blk) == 0) {
- convertFindData(findData,blk);
- return true;
- }
+ convertFindData(findData,blk);
+ return true;
+ }
return false;
}
@@ -813,9 +813,9 @@ ibool PMAPI PM_driveValid(
{
RMREGS regs;
regs.h.dl = (uchar)(drive - 'A' + 1);
- regs.h.ah = 0x36; // Get disk information service
+ regs.h.ah = 0x36; /* Get disk information service */
PM_int86(0x21,&regs,&regs);
- return regs.x.ax != 0xFFFF; // AX = 0xFFFF if disk is invalid
+ return regs.x.ax != 0xFFFF; /* AX = 0xFFFF if disk is invalid */
}
/****************************************************************************
@@ -848,25 +848,25 @@ void PMAPI PM_setFileAttr(
DWORD attr = 0;
if (attrib & PM_FILE_READONLY)
- attr |= FILE_ATTRIBUTE_READONLY;
+ attr |= FILE_ATTRIBUTE_READONLY;
if (attrib & PM_FILE_ARCHIVE)
- attr |= FILE_ATTRIBUTE_ARCHIVE;
+ attr |= FILE_ATTRIBUTE_ARCHIVE;
if (attrib & PM_FILE_HIDDEN)
- attr |= FILE_ATTRIBUTE_HIDDEN;
+ attr |= FILE_ATTRIBUTE_HIDDEN;
if (attrib & PM_FILE_SYSTEM)
- attr |= FILE_ATTRIBUTE_SYSTEM;
+ attr |= FILE_ATTRIBUTE_SYSTEM;
SetFileAttributes((LPSTR)filename, attr);
#else
uint attr = 0;
if (attrib & PM_FILE_READONLY)
- attr |= _A_RDONLY;
+ attr |= _A_RDONLY;
if (attrib & PM_FILE_ARCHIVE)
- attr |= _A_ARCH;
+ attr |= _A_ARCH;
if (attrib & PM_FILE_HIDDEN)
- attr |= _A_HIDDEN;
+ attr |= _A_HIDDEN;
if (attrib & PM_FILE_SYSTEM)
- attr |= _A_SYSTEM;
+ attr |= _A_SYSTEM;
_dos_setfileattr(filename,attr);
#endif
}
@@ -910,7 +910,7 @@ ulong PMAPI DPMI_mapPhysicalToLinear(ulong physAddr,ulong limit)
* mapped 1:1 for this memory anyway so we just return the base address.
*/
if (physAddr < 0x100000L)
- return physAddr;
+ return physAddr;
/* Search table of existing mappings to see if we have already mapped
* a region of memory that will serve this purpose. We do this because
@@ -919,20 +919,20 @@ ulong PMAPI DPMI_mapPhysicalToLinear(ulong physAddr,ulong limit)
* more mappings than necessary.
*/
for (i = 0; i < numMaps; i++) {
- if (maps[i].physical == physAddr && maps[i].limit == limit)
- return maps[i].linear;
- }
+ if (maps[i].physical == physAddr && maps[i].limit == limit)
+ return maps[i].linear;
+ }
/* Find a free slot in our physical memory mapping table */
for (i = 0; i < numMaps; i++) {
- if (maps[i].limit == 0)
- break;
- }
+ if (maps[i].limit == 0)
+ break;
+ }
if (i == numMaps) {
- i = numMaps++;
- if (i == MAX_MEMORY_MAPPINGS)
- return NULL;
- }
+ i = numMaps++;
+ if (i == MAX_MEMORY_MAPPINGS)
+ return NULL;
+ }
/* Round the physical address to a 4Kb boundary and the limit to a
* 4Kb-1 boundary before passing the values to DPMI as some extenders
@@ -950,7 +950,7 @@ ulong PMAPI DPMI_mapPhysicalToLinear(ulong physAddr,ulong limit)
r.x.di = roundedLimit & 0xFFFF;
PM_int386(0x31, &r, &r);
if (r.x.cflag)
- return 0xFFFFFFFFUL;
+ return 0xFFFFFFFFUL;
maps[i].physical = physAddr;
maps[i].limit = limit;
maps[i].linear = ((ulong)r.x.bx << 16) + r.x.cx + baseOfs;
@@ -967,7 +967,7 @@ int PMAPI DPMI_setSelectorBase(ushort sel,ulong linAddr)
r.x.dx = linAddr & 0xFFFF;
PM_int386(0x31, &r, &r);
if (r.x.cflag)
- return 0;
+ return 0;
return 1;
}
@@ -991,7 +991,7 @@ int PMAPI DPMI_setSelectorLimit(ushort sel,ulong limit)
r.x.dx = limit & 0xFFFF;
PM_int386(0x31, &r, &r);
if (r.x.cflag)
- return 0;
+ return 0;
return 1;
}
@@ -1011,19 +1011,19 @@ uint PMAPI DPMI_createSelector(ulong base,ulong limit)
* segment).
*/
if (limit >= 0x10000L) {
- r.x.ax = 9;
- r.x.bx = sel;
- r.x.cx = 0x40F3;
- PM_int386(0x31, &r, &r);
- }
+ r.x.ax = 9;
+ r.x.bx = sel;
+ r.x.cx = 0x40F3;
+ PM_int386(0x31, &r, &r);
+ }
/* Map physical memory and create selector */
if ((base = DPMI_mapPhysicalToLinear(base,limit)) == 0xFFFFFFFFUL)
- return 0;
+ return 0;
if (!DPMI_setSelectorBase(sel,base))
- return 0;
+ return 0;
if (!DPMI_setSelectorLimit(sel,limit))
- return 0;
+ return 0;
return sel;
}
@@ -1083,39 +1083,39 @@ static void PM_adjustPageTables(
andMask = ~0x18;
orMask = (isCached) ? 0x00 : 0x18;
if (_PM_pagingEnabled() == 1 && (PDB = _PM_getPDB()) != 0) {
- if (_PM_haveCauseWay) {
- /* CauseWay is a little different in the page table handling.
- * The code that we use for DOS4G/W does not appear to work
- * with CauseWay correctly as it does not appear to allow us
- * to map the page tables directly. Instead we can directly
- * access the page table entries in extended memory where
- * CauseWay always locates them (starting at 1024*4096*1023)
- */
- startPage = (linear >> 12);
- endPage = ((linear+limit) >> 12);
- pPageTable = (ulong*)CW_PAGE_TABLE_START;
- for (iPage = startPage; iPage <= endPage; iPage++)
- pPageTable[iPage] = (pPageTable[iPage] & andMask) | orMask;
- }
- else {
- pPDB = (ulong*)DPMI_mapPhysicalToLinear(PDB,0xFFF);
- if (pPDB) {
- startPDB = (linear >> 22) & 0x3FF;
- startPage = (linear >> 12) & 0x3FF;
- endPDB = ((linear+limit) >> 22) & 0x3FF;
- endPage = ((linear+limit) >> 12) & 0x3FF;
- for (iPDB = startPDB; iPDB <= endPDB; iPDB++) {
- pageTable = pPDB[iPDB] & ~0xFFF;
- pPageTable = (ulong*)DPMI_mapPhysicalToLinear(pageTable,0xFFF);
- start = (iPDB == startPDB) ? startPage : 0;
- end = (iPDB == endPDB) ? endPage : 0x3FF;
- for (iPage = start; iPage <= end; iPage++)
- pPageTable[iPage] = (pPageTable[iPage] & andMask) | orMask;
- }
- }
- }
- PM_flushTLB();
- }
+ if (_PM_haveCauseWay) {
+ /* CauseWay is a little different in the page table handling.
+ * The code that we use for DOS4G/W does not appear to work
+ * with CauseWay correctly as it does not appear to allow us
+ * to map the page tables directly. Instead we can directly
+ * access the page table entries in extended memory where
+ * CauseWay always locates them (starting at 1024*4096*1023)
+ */
+ startPage = (linear >> 12);
+ endPage = ((linear+limit) >> 12);
+ pPageTable = (ulong*)CW_PAGE_TABLE_START;
+ for (iPage = startPage; iPage <= endPage; iPage++)
+ pPageTable[iPage] = (pPageTable[iPage] & andMask) | orMask;
+ }
+ else {
+ pPDB = (ulong*)DPMI_mapPhysicalToLinear(PDB,0xFFF);
+ if (pPDB) {
+ startPDB = (linear >> 22) & 0x3FF;
+ startPage = (linear >> 12) & 0x3FF;
+ endPDB = ((linear+limit) >> 22) & 0x3FF;
+ endPage = ((linear+limit) >> 12) & 0x3FF;
+ for (iPDB = startPDB; iPDB <= endPDB; iPDB++) {
+ pageTable = pPDB[iPDB] & ~0xFFF;
+ pPageTable = (ulong*)DPMI_mapPhysicalToLinear(pageTable,0xFFF);
+ start = (iPDB == startPDB) ? startPage : 0;
+ end = (iPDB == endPDB) ? endPage : 0x3FF;
+ for (iPage = start; iPage <= end; iPage++)
+ pPageTable[iPage] = (pPageTable[iPage] & andMask) | orMask;
+ }
+ }
+ }
+ PM_flushTLB();
+ }
#endif
}
@@ -1129,28 +1129,28 @@ void * PMAPI DPMI_mapPhysicalAddr(ulong base,ulong limit,ibool isCached)
PM_segread(&sregs);
DSBaseAddr = DPMI_getSelectorBase(sregs.ds);
if ((base < 0x100000) && (DSBaseAddr == 0)) {
- /* DS is zero based, so we can directly access the first 1Mb of
- * system memory (like under DOS4GW).
- */
- return (void*)base;
- }
+ /* DS is zero based, so we can directly access the first 1Mb of
+ * system memory (like under DOS4GW).
+ */
+ return (void*)base;
+ }
/* Map the memory to a linear address using DPMI function 0x800 */
if ((linAddr = DPMI_mapPhysicalToLinear(base,limit)) == 0xFFFFFFFF) {
- if (base >= 0x100000)
- return NULL;
- /* If the linear address mapping fails but we are trying to
- * map an area in the first 1Mb of system memory, then we must
- * be running under a Windows or OS/2 DOS box. Under these
- * environments we can use the segment wrap around as a fallback
- * measure, as this does work properly.
- */
- linAddr = base;
- }
+ if (base >= 0x100000)
+ return NULL;
+ /* If the linear address mapping fails but we are trying to
+ * map an area in the first 1Mb of system memory, then we must
+ * be running under a Windows or OS/2 DOS box. Under these
+ * environments we can use the segment wrap around as a fallback
+ * measure, as this does work properly.
+ */
+ linAddr = base;
+ }
/* Now expand the default DS selector to 4Gb so we can access it */
if (!DPMI_setSelectorLimit(sregs.ds,0xFFFFFFFFUL))
- return NULL;
+ return NULL;
/* Finally enable caching for the page tables that we just mapped in,
* since DOS4GW and PMODE/W create the page table entries without
@@ -1162,7 +1162,7 @@ void * PMAPI DPMI_mapPhysicalAddr(ulong base,ulong limit,ibool isCached)
* caching) so that MMIO register regions do not screw up.
*/
if (DSBaseAddr == 0)
- PM_adjustPageTables(linAddr,limit,isCached);
+ PM_adjustPageTables(linAddr,limit,isCached);
/* Now return the base address of the memory into the default DS */
return (void*)(linAddr - DSBaseAddr);
@@ -1192,10 +1192,10 @@ void PMAPI PM_callRealMode(uint seg,uint off, RMREGS *in,
uint oldSeg,oldOff;
if (!crPtr) {
- /* Allocate and copy the memory block only once */
- crPtr = PM_allocRealSeg(sizeof(int6AHandler), &crRSeg, &crROff);
- memcpy(crPtr,int6AHandler,sizeof(int6AHandler));
- }
+ /* Allocate and copy the memory block only once */
+ crPtr = PM_allocRealSeg(sizeof(int6AHandler), &crRSeg, &crROff);
+ memcpy(crPtr,int6AHandler,sizeof(int6AHandler));
+ }
PM_setWord(crPtr,off); /* Plug in address to call */
PM_setWord(crPtr+2,seg);
p = PM_mapRealPointer(0,0x6A * 4);
@@ -1234,14 +1234,14 @@ void * PMAPI PM_allocLockedMem(
* helper VxD services to allocate the memory that we need.
*/
if (VXD_version) {
- memset(&regs,0,sizeof(regs));
- regs.eax = API_NUM(PMHELP_ALLOCLOCKED);
- regs.ebx = size;
- regs.ecx = (ulong)physAddr;
- regs.edx = contiguous | (below16Meg << 8);
- _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
- return (void*)regs.eax;
- }
+ memset(&regs,0,sizeof(regs));
+ regs.eax = API_NUM(PMHELP_ALLOCLOCKED);
+ regs.ebx = size;
+ regs.ecx = (ulong)physAddr;
+ regs.edx = contiguous | (below16Meg << 8);
+ _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
+ return (void*)regs.eax;
+ }
/* If the memory is not contiguous, we simply need to allocate it
* using regular memory allocation services, and lock it down
@@ -1257,19 +1257,19 @@ void * PMAPI PM_allocLockedMem(
* size rounded up to the next 4K boundary.
*/
if (!contiguous)
- p = PM_malloc(roundedSize);
+ p = PM_malloc(roundedSize);
else
#endif
- p = PM_allocRealSeg(roundedSize,&r_seg,&r_off);
+ p = PM_allocRealSeg(roundedSize,&r_seg,&r_off);
if (p == NULL)
- return NULL;
+ return NULL;
roundedP = (void*)(((ulong)p + 0xFFF) & ~0xFFF);
*((ulong*)(roundedP + size)) = (ulong)p;
PM_lockDataPages(roundedP,size,&lh);
if ((*physAddr = PM_getPhysicalAddr(roundedP)) == 0xFFFFFFFF) {
- PM_freeLockedMem(roundedP,size,contiguous);
- return NULL;
- }
+ PM_freeLockedMem(roundedP,size,contiguous);
+ return NULL;
+ }
/* Disable caching for the memory since it is probably a DMA buffer */
#ifndef REALMODE
@@ -1289,22 +1289,22 @@ void PMAPI PM_freeLockedMem(void *p,uint size,ibool contiguous)
PM_lockHandle lh; /* Unused in DOS */
if (!p)
- return;
+ return;
if (VXD_version) {
- memset(&regs,0,sizeof(regs));
- regs.eax = API_NUM(PMHELP_FREELOCKED);
- regs.ebx = (ulong)p;
- regs.ecx = size;
- regs.edx = contiguous;
- _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
- return;
- }
+ memset(&regs,0,sizeof(regs));
+ regs.eax = API_NUM(PMHELP_FREELOCKED);
+ regs.ebx = (ulong)p;
+ regs.ecx = size;
+ regs.edx = contiguous;
+ _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
+ return;
+ }
PM_unlockDataPages(p,size,&lh);
if (!contiguous)
- free(*((void**)((uchar*)p + size)));
+ free(*((void**)((uchar*)p + size)));
else
#endif
- PM_freeRealSeg(*((void**)((char*)p + size)));
+ PM_freeRealSeg(*((void**)((char*)p + size)));
}
#ifndef REALMODE
@@ -1321,11 +1321,11 @@ static pageblock *PM_addNewPageBlock(void)
/* Allocate memory for the new page block, and add to head of list */
size = PAGES_PER_BLOCK * PM_PAGE_SIZE + (PM_PAGE_SIZE-1) + sizeof(pageblock);
if ((newBlock = PM_malloc(size)) == NULL)
- return NULL;
+ return NULL;
newBlock->prev = NULL;
newBlock->next = pageBlocks;
if (pageBlocks)
- pageBlocks->prev = newBlock;
+ pageBlocks->prev = newBlock;
pageBlocks = newBlock;
/* Initialise the page aligned free list for the page block */
@@ -1334,7 +1334,7 @@ static pageblock *PM_addNewPageBlock(void)
newBlock->freeListStart = newBlock->freeList;
newBlock->freeListEnd = p + (PAGES_PER_BLOCK-1) * PM_PAGE_SIZE;
for (i = 0; i < PAGES_PER_BLOCK; i++,p = next)
- FREELIST_NEXT(p) = next = p + PM_PAGE_SIZE;
+ FREELIST_NEXT(p) = next = p + PM_PAGE_SIZE;
FREELIST_NEXT(p - PM_PAGE_SIZE) = NULL;
return newBlock;
}
@@ -1355,27 +1355,27 @@ void * PMAPI PM_allocPage(
/* Call the helper VxD for this service if we are running in a DOS box */
if (VXD_version) {
- memset(&regs,0,sizeof(regs));
- regs.eax = API_NUM(PMHELP_ALLOCPAGE);
- regs.ebx = locked;
- _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
- return (void*)regs.eax;
- }
+ memset(&regs,0,sizeof(regs));
+ regs.eax = API_NUM(PMHELP_ALLOCPAGE);
+ regs.ebx = locked;
+ _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
+ return (void*)regs.eax;
+ }
/* Scan the block list looking for any free blocks. Allocate a new
* page block if no free blocks are found.
*/
for (block = pageBlocks; block != NULL; block = block->next) {
- if (block->freeCount)
- break;
- }
+ if (block->freeCount)
+ break;
+ }
if (block == NULL && (block = PM_addNewPageBlock()) == NULL)
- return NULL;
+ return NULL;
block->freeCount--;
p = block->freeList;
block->freeList = FREELIST_NEXT(p);
if (locked)
- PM_lockDataPages(p,PM_PAGE_SIZE,&lh);
+ PM_lockDataPages(p,PM_PAGE_SIZE,&lh);
return p;
#else
return NULL;
@@ -1395,42 +1395,42 @@ void PMAPI PM_freePage(
/* Call the helper VxD for this service if we are running in a DOS box */
if (VXD_version) {
- memset(&regs,0,sizeof(regs));
- regs.eax = API_NUM(PMHELP_FREEPAGE);
- regs.ebx = (ulong)p;
- _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
- return;
- }
+ memset(&regs,0,sizeof(regs));
+ regs.eax = API_NUM(PMHELP_FREEPAGE);
+ regs.ebx = (ulong)p;
+ _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
+ return;
+ }
/* First find the page block that this page belongs to */
for (block = pageBlocks; block != NULL; block = block->next) {
- if (p >= block->freeListStart && p <= block->freeListEnd)
- break;
- }
+ if (p >= block->freeListStart && p <= block->freeListEnd)
+ break;
+ }
CHECK(block != NULL);
/* Now free the block by adding it to the free list */
FREELIST_NEXT(p) = block->freeList;
block->freeList = p;
if (++block->freeCount == PAGES_PER_BLOCK) {
- /* If all pages in the page block are now free, free the entire
- * page block itself.
- */
- if (block == pageBlocks) {
- /* Delete from head */
- pageBlocks = block->next;
- if (block->next)
- block->next->prev = NULL;
- }
- else {
- /* Delete from middle of list */
- CHECK(block->prev != NULL);
- block->prev->next = block->next;
- if (block->next)
- block->next->prev = block->prev;
- }
- PM_free(block);
- }
+ /* If all pages in the page block are now free, free the entire
+ * page block itself.
+ */
+ if (block == pageBlocks) {
+ /* Delete from head */
+ pageBlocks = block->next;
+ if (block->next)
+ block->next->prev = NULL;
+ }
+ else {
+ /* Delete from middle of list */
+ CHECK(block->prev != NULL);
+ block->prev->next = block->next;
+ if (block->next)
+ block->next->prev = block->prev;
+ }
+ PM_free(block);
+ }
#else
(void)p;
#endif
@@ -1444,7 +1444,7 @@ void PMAPI PM_freePage(
#ifndef MK_FP
#define MK_FP(s,o) ( (void far *)( ((ulong)(s) << 16) + \
- (ulong)(o) ))
+ (ulong)(o) ))
#endif
void * PMAPI PM_mapRealPointer(uint r_seg,uint r_off)
@@ -1534,7 +1534,7 @@ static uchar *zeroPtr = NULL;
void * PMAPI PM_getBIOSPointer(void)
{
if (!zeroPtr)
- zeroPtr = PM_mapPhysicalAddr(0,0xFFFFF,true);
+ zeroPtr = PM_mapPhysicalAddr(0,0xFFFFF,true);
return (void*)(zeroPtr + 0x400);
}
@@ -1542,7 +1542,7 @@ void * PMAPI PM_getA0000Pointer(void)
{
static void *bankPtr;
if (!bankPtr)
- bankPtr = PM_mapPhysicalAddr(0xA0000,0xFFFF,true);
+ bankPtr = PM_mapPhysicalAddr(0xA0000,0xFFFF,true);
return bankPtr;
}
@@ -1561,16 +1561,16 @@ void * PMAPI PM_mapPhysicalAddr(ulong base,ulong limit,ibool isCached)
* running at ring 0 (ie: under real DOS).
*/
if (VXD_version == -1)
- PM_init();
+ PM_init();
if (VXD_version) {
- memset(&regs,0,sizeof(regs));
- regs.eax = API_NUM(PMHELP_MAPPHYS);
- regs.ebx = base;
- regs.ecx = limit;
- regs.edx = isCached;
- _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
- return (void*)regs.eax;
- }
+ memset(&regs,0,sizeof(regs));
+ regs.eax = API_NUM(PMHELP_MAPPHYS);
+ regs.ebx = base;
+ regs.ecx = limit;
+ regs.edx = isCached;
+ _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
+ return (void*)regs.eax;
+ }
/* Round the physical address to a 4Kb boundary and the limit to a
* 4Kb-1 boundary before passing the values to TNT. If we round the
@@ -1583,15 +1583,15 @@ void * PMAPI PM_mapPhysicalAddr(ulong base,ulong limit,ibool isCached)
_dx_config_inf(&config, (UCHAR*)&config);
err = _dx_map_phys(config.c_ds_sel,baseAddr,(newLimit + 4095) / 4096,&offset);
if (err == 130) {
- /* If the TNT function failed, we are running in a DPMI environment
- * and this function does not work. However we know how to handle
- * DPMI properly, so we use our generic DPMI functions to do
- * what the TNT runtime libraries can't.
- */
- return DPMI_mapPhysicalAddr(base,limit,isCached);
- }
+ /* If the TNT function failed, we are running in a DPMI environment
+ * and this function does not work. However we know how to handle
+ * DPMI properly, so we use our generic DPMI functions to do
+ * what the TNT runtime libraries can't.
+ */
+ return DPMI_mapPhysicalAddr(base,limit,isCached);
+ }
if (err == 0)
- return (void*)(offset + baseOfs);
+ return (void*)(offset + baseOfs);
return NULL;
}
@@ -1611,7 +1611,7 @@ void * PMAPI PM_mapToProcess(void *base,ulong limit)
void * PMAPI PM_mapRealPointer(uint r_seg,uint r_off)
{
if (!zeroPtr)
- zeroPtr = PM_mapPhysicalAddr(0,0xFFFFF);
+ zeroPtr = PM_mapPhysicalAddr(0,0xFFFFF);
return (void*)(zeroPtr + MK_PHYS(r_seg,r_off));
}
@@ -1621,7 +1621,7 @@ void * PMAPI PM_allocRealSeg(uint size,uint *r_seg,uint *r_off)
void *p;
if (_dx_real_alloc((size + 0xF) >> 4,&addr,&t) != 0)
- return 0;
+ return 0;
*r_seg = addr; /* Real mode segment address */
*r_off = 0; /* Real mode segment offset */
p = PM_mapRealPointer(*r_seg,*r_off);
@@ -1732,7 +1732,7 @@ void * PMAPI PM_allocRealSeg(uint size,uint *r_seg,uint *r_off)
r.x.bx = (size + 0xF) >> 4; /* Number of paragraphs to allocate */
PM_int386(0x21, &r, &r); /* Call DOS extender */
if (r.x.cflag)
- return 0; /* Could not allocate the memory */
+ return 0; /* Could not allocate the memory */
*r_seg = r.e.eax;
*r_off = 0;
return PM_mapRealPointer(*r_seg,*r_off);
@@ -1828,19 +1828,19 @@ void * PMAPI PM_mapPhysicalAddr(ulong base,ulong limit,ibool isCached)
* running at ring 0 (ie: under real DOS).
*/
if (VXD_version == -1)
- PM_init();
+ PM_init();
if (VXD_version) {
- memset(&regs,0,sizeof(regs));
- regs.eax = API_NUM(PMHELP_MAPPHYS);
- regs.ebx = base;
- regs.ecx = limit;
- regs.edx = isCached;
- _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
- return (void*)regs.eax;
- }
+ memset(&regs,0,sizeof(regs));
+ regs.eax = API_NUM(PMHELP_MAPPHYS);
+ regs.ebx = base;
+ regs.ecx = limit;
+ regs.edx = isCached;
+ _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
+ return (void*)regs.eax;
+ }
if (base > 0x100000)
- return _x386_map_physical_address((void*)base,limit);
+ return _x386_map_physical_address((void*)base,limit);
return (void*)((ulong)_x386_zero_base_ptr + base);
}
@@ -1872,7 +1872,7 @@ void PMAPI PM_availableMemory(ulong *physical,ulong *total)
/* Get physical memory available */
*physical = _X32_getPhysMem();
if (*physical > *total)
- *physical = *total;
+ *physical = *total;
}
#endif
@@ -1908,16 +1908,16 @@ void * PMAPI PM_mapPhysicalAddr(ulong base,ulong limit,ibool isCached)
* running at ring 0 (ie: under real DOS).
*/
if (VXD_version == -1)
- PM_init();
+ PM_init();
if (VXD_version) {
- memset(&regs,0,sizeof(regs));
- regs.eax = API_NUM(PMHELP_MAPPHYS);
- regs.ebx = base;
- regs.ecx = limit;
- regs.edx = isCached;
- _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
- return (void*)regs.eax;
- }
+ memset(&regs,0,sizeof(regs));
+ regs.eax = API_NUM(PMHELP_MAPPHYS);
+ regs.ebx = base;
+ regs.ecx = limit;
+ regs.edx = isCached;
+ _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
+ return (void*)regs.eax;
+ }
return DPMI_mapPhysicalAddr(base,limit,isCached);
}
@@ -1932,7 +1932,7 @@ ulong PMAPI PM_getPhysicalAddr(void *p)
{
ulong physAddr;
if (!PM_getPhysicalAddrRange(p,1,&physAddr))
- return 0xFFFFFFFF;
+ return 0xFFFFFFFF;
return physAddr | ((ulong)p & 0xFFF);
}
@@ -1950,14 +1950,14 @@ ibool PMAPI PM_getPhysicalAddrRange(
* helper VxD services to find the physical address of an address.
*/
if (VXD_version) {
- memset(&regs,0,sizeof(regs));
- regs.eax = API_NUM(PMHELP_GETPHYSICALADDRRANGE);
- regs.ebx = (ulong)p;
- regs.ecx = (ulong)length;
- regs.edx = (ulong)physAddress;
- _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
- return regs.eax;
- }
+ memset(&regs,0,sizeof(regs));
+ regs.eax = API_NUM(PMHELP_GETPHYSICALADDRRANGE);
+ regs.ebx = (ulong)p;
+ regs.ecx = (ulong)length;
+ regs.edx = (ulong)physAddress;
+ _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
+ return regs.eax;
+ }
/* Find base address for default DS selector */
PM_segread(&sregs);
@@ -1970,38 +1970,38 @@ ibool PMAPI PM_getPhysicalAddrRange(
pte = *((ulong*)p);
#ifdef DOS4GW
if (_PM_pagingEnabled() == 0) {
- int count;
- ulong linAddr = (ulong)p;
-
- /* When paging is disabled physical=linear */
- for (count = (length+0xFFF) >> 12; count > 0; count--) {
- *physAddress++ = linAddr;
- linAddr += 4096;
- }
- return true;
- }
+ int count;
+ ulong linAddr = (ulong)p;
+
+ /* When paging is disabled physical=linear */
+ for (count = (length+0xFFF) >> 12; count > 0; count--) {
+ *physAddress++ = linAddr;
+ linAddr += 4096;
+ }
+ return true;
+ }
else if ((PDB = _PM_getPDB()) != 0 && DSBaseAddr == 0) {
- int startPDB,endPDB,iPDB,startPage,endPage,start,end,iPage;
- ulong pageTable,*pPageTable,linAddr = (ulong)p;
- ulong limit = length-1;
-
- pPDB = (ulong*)DPMI_mapPhysicalToLinear(PDB,0xFFF);
- if (pPDB) {
- startPDB = (linAddr >> 22) & 0x3FFL;
- startPage = (linAddr >> 12) & 0x3FFL;
- endPDB = ((linAddr+limit) >> 22) & 0x3FFL;
- endPage = ((linAddr+limit) >> 12) & 0x3FFL;
- for (iPDB = startPDB; iPDB <= endPDB; iPDB++) {
- pageTable = pPDB[iPDB] & ~0xFFFL;
- pPageTable = (ulong*)DPMI_mapPhysicalToLinear(pageTable,0xFFF);
- start = (iPDB == startPDB) ? startPage : 0;
- end = (iPDB == endPDB) ? endPage : 0x3FFL;
- for (iPage = start; iPage <= end; iPage++)
- *physAddress++ = (pPageTable[iPage] & ~0xFFF);
- }
- return true;
- }
- }
+ int startPDB,endPDB,iPDB,startPage,endPage,start,end,iPage;
+ ulong pageTable,*pPageTable,linAddr = (ulong)p;
+ ulong limit = length-1;
+
+ pPDB = (ulong*)DPMI_mapPhysicalToLinear(PDB,0xFFF);
+ if (pPDB) {
+ startPDB = (linAddr >> 22) & 0x3FFL;
+ startPage = (linAddr >> 12) & 0x3FFL;
+ endPDB = ((linAddr+limit) >> 22) & 0x3FFL;
+ endPage = ((linAddr+limit) >> 12) & 0x3FFL;
+ for (iPDB = startPDB; iPDB <= endPDB; iPDB++) {
+ pageTable = pPDB[iPDB] & ~0xFFFL;
+ pPageTable = (ulong*)DPMI_mapPhysicalToLinear(pageTable,0xFFF);
+ start = (iPDB == startPDB) ? startPage : 0;
+ end = (iPDB == endPDB) ? endPage : 0x3FFL;
+ for (iPage = start; iPage <= end; iPage++)
+ *physAddress++ = (pPageTable[iPage] & ~0xFFF);
+ }
+ return true;
+ }
+ }
#endif
return false;
}
@@ -2017,7 +2017,7 @@ void * PMAPI PM_mapRealPointer(uint r_seg,uint r_off)
static uchar *zeroPtr = NULL;
if (!zeroPtr)
- zeroPtr = PM_mapPhysicalAddr(0,0xFFFFF,true);
+ zeroPtr = PM_mapPhysicalAddr(0,0xFFFFF,true);
return (void*)(zeroPtr + MK_PHYS(r_seg,r_off));
}
@@ -2030,7 +2030,7 @@ void * PMAPI PM_allocRealSeg(uint size,uint *r_seg,uint *r_off)
r.x.bx = (size + 0xF) >> 4; /* number of paragraphs */
PM_int386(0x31, &r, &r);
if (r.x.cflag)
- return NULL; /* DPMI call failed */
+ return NULL; /* DPMI call failed */
*r_seg = r.x.ax; /* Real mode segment */
*r_off = 0;
p = PM_mapRealPointer(*r_seg,*r_off);
@@ -2043,10 +2043,10 @@ void PMAPI PM_freeRealSeg(void *mem)
PMREGS r;
if (mem) {
- r.x.ax = 0x101; /* DPMI free DOS memory */
- r.x.dx = _PM_findRealModeBlock(mem);/* DX := selector from 0x100 */
- PM_int386(0x31, &r, &r);
- }
+ r.x.ax = 0x101; /* DPMI free DOS memory */
+ r.x.dx = _PM_findRealModeBlock(mem);/* DX := selector from 0x100 */
+ PM_int386(0x31, &r, &r);
+ }
}
static DPMI_handler_t DPMI_int10 = NULL;
@@ -2062,9 +2062,9 @@ void PMAPI DPMI_int86(int intno, DPMI_regs *regs)
PMSREGS sr;
if (intno == 0x10 && DPMI_int10) {
- if (DPMI_int10(regs))
- return;
- }
+ if (DPMI_int10(regs))
+ return;
+ }
PM_segread(&sr);
r.x.ax = 0x300; /* DPMI issue real interrupt */
r.h.bl = intno;
@@ -2116,17 +2116,17 @@ int PMAPI PM_int86x(int intno, RMREGS *in, RMREGS *out,
#pragma pack(1)
typedef struct {
- uint LargestBlockAvail;
- uint MaxUnlockedPage;
- uint LargestLockablePage;
- uint LinAddrSpace;
- uint NumFreePagesAvail;
- uint NumPhysicalPagesFree;
- uint TotalPhysicalPages;
- uint FreeLinAddrSpace;
- uint SizeOfPageFile;
- uint res[3];
- } MemInfo;
+ uint LargestBlockAvail;
+ uint MaxUnlockedPage;
+ uint LargestLockablePage;
+ uint LinAddrSpace;
+ uint NumFreePagesAvail;
+ uint NumPhysicalPagesFree;
+ uint TotalPhysicalPages;
+ uint FreeLinAddrSpace;
+ uint SizeOfPageFile;
+ uint res[3];
+ } MemInfo;
#pragma pack()
@@ -2144,7 +2144,7 @@ void PMAPI PM_availableMemory(ulong *physical,ulong *total)
*physical = memInfo.NumPhysicalPagesFree * 4096;
*total = memInfo.LargestBlockAvail;
if (*total < *physical)
- *physical = *total;
+ *physical = *total;
}
#endif
@@ -2212,7 +2212,7 @@ Function to get the file attributes for a specific file.
uint PMAPI PM_getFileAttr(
const char *filename)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
return 0;
}
@@ -2225,7 +2225,7 @@ ibool PMAPI PM_getFileTime(
ibool gmTime,
PM_time *time)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
return false;
}
@@ -2238,6 +2238,6 @@ ibool PMAPI PM_setFileTime(
ibool gmTime,
PM_time *time)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
return false;
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/dos/pmdos.c b/board/MAI/bios_emulator/scitech/src/pm/dos/pmdos.c
index 74f8427a1c..eecc2daede 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/dos/pmdos.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/dos/pmdos.c
@@ -160,47 +160,47 @@ void PMAPI PM_resetMouseDriver(int hardReset)
regs.x.ax = hardReset ? 0 : 33;
PM_int86(0x33, &regs, &regs);
if (oldHandler)
- PM_setMouseHandler(_PM_mouseMask, oldHandler);
+ PM_setMouseHandler(_PM_mouseMask, oldHandler);
}
void PMAPI PM_setRealTimeClockFrequency(int frequency)
{
static short convert[] = {
- 8192,
- 4096,
- 2048,
- 1024,
- 512,
- 256,
- 128,
- 64,
- 32,
- 16,
- 8,
- 4,
- 2,
- -1,
- };
+ 8192,
+ 4096,
+ 2048,
+ 1024,
+ 512,
+ 256,
+ 128,
+ 64,
+ 32,
+ 16,
+ 8,
+ 4,
+ 2,
+ -1,
+ };
int i;
/* First clear any pending RTC timeout if not cleared */
_PM_readCMOS(0x0C);
if (frequency == 0) {
- /* Disable RTC timout */
- _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
- _PM_writeCMOS(0x0B,_PM_oldCMOSRegB & 0x0F);
- }
+ /* Disable RTC timout */
+ _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
+ _PM_writeCMOS(0x0B,_PM_oldCMOSRegB & 0x0F);
+ }
else {
- /* Convert frequency value to RTC clock indexes */
- for (i = 0; convert[i] != -1; i++) {
- if (convert[i] == frequency)
- break;
- }
+ /* Convert frequency value to RTC clock indexes */
+ for (i = 0; convert[i] != -1; i++) {
+ if (convert[i] == frequency)
+ break;
+ }
- /* Set RTC timout value and enable timeout */
- _PM_writeCMOS(0x0A,0x20 | (i+3));
- _PM_writeCMOS(0x0B,(_PM_oldCMOSRegB & 0x0F) | 0x40);
- }
+ /* Set RTC timout value and enable timeout */
+ _PM_writeCMOS(0x0A,0x20 | (i+3));
+ _PM_writeCMOS(0x0B,(_PM_oldCMOSRegB & 0x0F) | 0x40);
+ }
}
#ifndef REALMODE
@@ -216,18 +216,18 @@ static void PMAPI lockPMHandlers(void)
* under real mode.
*/
if (!locked) {
- PM_saveDS();
- stat = !PM_lockDataPages(&globalDataStart-2048,4096,&lh);
- stat |= !PM_lockDataPages(&_PM_pmdosDataStart,(int)&_PM_pmdosDataEnd - (int)&_PM_pmdosDataStart,&lh);
- stat |= !PM_lockCodePages((__codePtr)_PM_pmdosCodeStart,(int)_PM_pmdosCodeEnd-(int)_PM_pmdosCodeStart,&lh);
- stat |= !PM_lockDataPages(&_PM_DMADataStart,(int)&_PM_DMADataEnd - (int)&_PM_DMADataStart,&lh);
- stat |= !PM_lockCodePages((__codePtr)_PM_DMACodeStart,(int)_PM_DMACodeEnd-(int)_PM_DMACodeStart,&lh);
- if (stat) {
- printf("Page locking services failed - interrupt handling not safe!\n");
- exit(1);
- }
- locked = 1;
- }
+ PM_saveDS();
+ stat = !PM_lockDataPages(&globalDataStart-2048,4096,&lh);
+ stat |= !PM_lockDataPages(&_PM_pmdosDataStart,(int)&_PM_pmdosDataEnd - (int)&_PM_pmdosDataStart,&lh);
+ stat |= !PM_lockCodePages((__codePtr)_PM_pmdosCodeStart,(int)_PM_pmdosCodeEnd-(int)_PM_pmdosCodeStart,&lh);
+ stat |= !PM_lockDataPages(&_PM_DMADataStart,(int)&_PM_DMADataEnd - (int)&_PM_DMADataStart,&lh);
+ stat |= !PM_lockCodePages((__codePtr)_PM_DMACodeStart,(int)_PM_DMACodeEnd-(int)_PM_DMACodeStart,&lh);
+ if (stat) {
+ printf("Page locking services failed - interrupt handling not safe!\n");
+ exit(1);
+ }
+ locked = 1;
+ }
}
#endif
@@ -240,7 +240,7 @@ static void PMAPI lockPMHandlers(void)
#ifndef MK_FP
#define MK_FP(s,o) ( (void far *)( ((ulong)(s) << 16) + \
- (ulong)(o) ))
+ (ulong)(o) ))
#endif
int PMAPI PM_setMouseHandler(int mask, PM_mouseHandler mh)
@@ -256,10 +256,10 @@ void PMAPI PM_restoreMouseHandler(void)
union REGS regs;
if (_PM_mouseHandler) {
- regs.x.ax = 33;
- int86(0x33, &regs, &regs);
- _PM_mouseHandler = NULL;
- }
+ regs.x.ax = 33;
+ int86(0x33, &regs, &regs);
+ _PM_mouseHandler = NULL;
+ }
}
void PMAPI PM_setTimerHandler(PM_intHandler th)
@@ -272,9 +272,9 @@ void PMAPI PM_setTimerHandler(PM_intHandler th)
void PMAPI PM_restoreTimerHandler(void)
{
if (_PM_timerHandler) {
- _PM_setRMvect(0x8, (long)_PM_prevTimer);
- _PM_timerHandler = NULL;
- }
+ _PM_setRMvect(0x8, (long)_PM_prevTimer);
+ _PM_timerHandler = NULL;
+ }
}
ibool PMAPI PM_setRealTimeClockHandler(PM_intHandler th,int frequency)
@@ -300,15 +300,15 @@ ibool PMAPI PM_setRealTimeClockHandler(PM_intHandler th,int frequency)
void PMAPI PM_restoreRealTimeClockHandler(void)
{
if (_PM_rtcHandler) {
- /* Restore CMOS registers and mask RTC clock */
- _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
- _PM_writeCMOS(0x0B,_PM_oldCMOSRegB);
- PM_outpb(0xA1,(PM_inpb(0xA1) & 0xFE) | (_PM_oldRTCPIC2 & ~0xFE));
+ /* Restore CMOS registers and mask RTC clock */
+ _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
+ _PM_writeCMOS(0x0B,_PM_oldCMOSRegB);
+ PM_outpb(0xA1,(PM_inpb(0xA1) & 0xFE) | (_PM_oldRTCPIC2 & ~0xFE));
- /* Restore the interrupt vector */
- _PM_setRMvect(0x70, (long)_PM_prevRTC);
- _PM_rtcHandler = NULL;
- }
+ /* Restore the interrupt vector */
+ _PM_setRMvect(0x70, (long)_PM_prevRTC);
+ _PM_rtcHandler = NULL;
+ }
}
void PMAPI PM_setKeyHandler(PM_intHandler kh)
@@ -321,9 +321,9 @@ void PMAPI PM_setKeyHandler(PM_intHandler kh)
void PMAPI PM_restoreKeyHandler(void)
{
if (_PM_keyHandler) {
- _PM_setRMvect(0x9, (long)_PM_prevKey);
- _PM_keyHandler = NULL;
- }
+ _PM_setRMvect(0x9, (long)_PM_prevKey);
+ _PM_keyHandler = NULL;
+ }
}
void PMAPI PM_setKey15Handler(PM_key15Handler kh)
@@ -336,9 +336,9 @@ void PMAPI PM_setKey15Handler(PM_key15Handler kh)
void PMAPI PM_restoreKey15Handler(void)
{
if (_PM_key15Handler) {
- _PM_setRMvect(0x15, (long)_PM_prevKey15);
- _PM_key15Handler = NULL;
- }
+ _PM_setRMvect(0x15, (long)_PM_prevKey15);
+ _PM_key15Handler = NULL;
+ }
}
void PMAPI PM_installAltBreakHandler(PM_breakHandler bh)
@@ -362,11 +362,11 @@ void PMAPI PM_installBreakHandler(void)
void PMAPI PM_restoreBreakHandler(void)
{
if (_PM_prevBreak) {
- _PM_setRMvect(0x1B, (long)_PM_prevBreak);
- _PM_setRMvect(0x23, (long)_PM_prevCtrlC);
- _PM_prevBreak = NULL;
- _PM_breakHandler = NULL;
- }
+ _PM_setRMvect(0x1B, (long)_PM_prevBreak);
+ _PM_setRMvect(0x23, (long)_PM_prevCtrlC);
+ _PM_prevBreak = NULL;
+ _PM_breakHandler = NULL;
+ }
}
void PMAPI PM_installAltCriticalHandler(PM_criticalHandler ch)
@@ -387,10 +387,10 @@ void PMAPI PM_installCriticalHandler(void)
void PMAPI PM_restoreCriticalHandler(void)
{
if (_PM_prevCritical) {
- _PM_setRMvect(0x24, (long)_PM_prevCritical);
- _PM_prevCritical = NULL;
- _PM_critHandler = NULL;
- }
+ _PM_setRMvect(0x24, (long)_PM_prevCritical);
+ _PM_prevCritical = NULL;
+ _PM_critHandler = NULL;
+ }
}
int PMAPI PM_lockDataPages(void *p,uint len,PM_lockHandle *lh)
@@ -499,7 +499,7 @@ uchar * installCallback(void (PMAPI *pmCB)(),uint *rseg, uint *roff)
/* Copy the real mode handler to real mode memory */
if ((p = PM_allocRealSeg(sizeof(realHandler),rseg,roff)) == NULL)
- return NULL;
+ return NULL;
memcpy(p,realHandler,sizeof(realHandler));
/* Skip past global variabls in real mode code segment */
@@ -516,7 +516,7 @@ int PMAPI PM_setMouseHandler(int mask, PM_mouseHandler mh)
lockPMHandlers(); /* Ensure our handlers are locked */
if ((mousePtr = installCallback(_PM_mouseISR, &rseg, &roff)) == NULL)
- return 0;
+ return 0;
_PM_mouseHandler = mh;
/* Install the real mode mouse handler */
@@ -533,11 +533,11 @@ void PMAPI PM_restoreMouseHandler(void)
RMREGS regs;
if (_PM_mouseHandler) {
- regs.x.ax = 33;
- PM_int86(0x33, &regs, &regs);
- PM_freeRealSeg(mousePtr);
- _PM_mouseHandler = NULL;
- }
+ regs.x.ax = 33;
+ PM_int86(0x33, &regs, &regs);
+ PM_freeRealSeg(mousePtr);
+ _PM_mouseHandler = NULL;
+ }
}
void PMAPI PM_getPMvect(int intno, PMFARPTR *isr)
@@ -602,9 +602,9 @@ void PMAPI PM_setTimerHandler(PM_intHandler th)
void PMAPI PM_restoreTimerHandler(void)
{
if (_PM_timerHandler) {
- restoreISR(0x8, _PM_prevTimer, _PM_prevRealTimer);
- _PM_timerHandler = NULL;
- }
+ restoreISR(0x8, _PM_prevTimer, _PM_prevRealTimer);
+ _PM_timerHandler = NULL;
+ }
}
ibool PMAPI PM_setRealTimeClockHandler(PM_intHandler th,int frequency)
@@ -630,15 +630,15 @@ ibool PMAPI PM_setRealTimeClockHandler(PM_intHandler th,int frequency)
void PMAPI PM_restoreRealTimeClockHandler(void)
{
if (_PM_rtcHandler) {
- /* Restore CMOS registers and mask RTC clock */
- _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
- _PM_writeCMOS(0x0B,_PM_oldCMOSRegB);
- PM_outpb(0xA1,(PM_inpb(0xA1) & 0xFE) | (_PM_oldRTCPIC2 & ~0xFE));
+ /* Restore CMOS registers and mask RTC clock */
+ _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
+ _PM_writeCMOS(0x0B,_PM_oldCMOSRegB);
+ PM_outpb(0xA1,(PM_inpb(0xA1) & 0xFE) | (_PM_oldRTCPIC2 & ~0xFE));
- /* Restore the interrupt vector */
- restoreISR(0x70, _PM_prevRTC, _PM_prevRealRTC);
- _PM_rtcHandler = NULL;
- }
+ /* Restore the interrupt vector */
+ restoreISR(0x70, _PM_prevRTC, _PM_prevRealRTC);
+ _PM_rtcHandler = NULL;
+ }
}
void PMAPI PM_setKeyHandler(PM_intHandler kh)
@@ -651,9 +651,9 @@ void PMAPI PM_setKeyHandler(PM_intHandler kh)
void PMAPI PM_restoreKeyHandler(void)
{
if (_PM_keyHandler) {
- restoreISR(0x9, _PM_prevKey, _PM_prevRealKey);
- _PM_keyHandler = NULL;
- }
+ restoreISR(0x9, _PM_prevKey, _PM_prevRealKey);
+ _PM_keyHandler = NULL;
+ }
}
void PMAPI PM_setKey15Handler(PM_key15Handler kh)
@@ -666,9 +666,9 @@ void PMAPI PM_setKey15Handler(PM_key15Handler kh)
void PMAPI PM_restoreKey15Handler(void)
{
if (_PM_key15Handler) {
- restoreISR(0x15, _PM_prevKey15, _PM_prevRealKey15);
- _PM_key15Handler = NULL;
- }
+ restoreISR(0x15, _PM_prevKey15, _PM_prevRealKey15);
+ _PM_key15Handler = NULL;
+ }
}
void PMAPI PM_installAltBreakHandler(PM_breakHandler bh)
@@ -692,11 +692,11 @@ void PMAPI PM_installBreakHandler(void)
void PMAPI PM_restoreBreakHandler(void)
{
if (_PM_prevBreak.sel) {
- restoreISR(0x1B, _PM_prevBreak, prevRealBreak);
- restoreISR(0x23, _PM_prevCtrlC, prevRealCtrlC);
- _PM_prevBreak.sel = 0;
- _PM_breakHandler = NULL;
- }
+ restoreISR(0x1B, _PM_prevBreak, prevRealBreak);
+ restoreISR(0x23, _PM_prevCtrlC, prevRealCtrlC);
+ _PM_prevBreak.sel = 0;
+ _PM_breakHandler = NULL;
+ }
}
void PMAPI PM_installAltCriticalHandler(PM_criticalHandler ch)
@@ -717,10 +717,10 @@ void PMAPI PM_installCriticalHandler(void)
void PMAPI PM_restoreCriticalHandler(void)
{
if (_PM_prevCritical.sel) {
- restoreISR(0x24, _PM_prevCritical, prevRealCritical);
- _PM_prevCritical.sel = 0;
- _PM_critHandler = NULL;
- }
+ restoreISR(0x24, _PM_prevCritical, prevRealCritical);
+ _PM_prevCritical.sel = 0;
+ _PM_critHandler = NULL;
+ }
}
int PMAPI PM_lockDataPages(void *p,uint len,PM_lockHandle *lh)
@@ -816,9 +816,9 @@ int installCallback(void (PMAPI *pmCB)(),uint *psel, uint *poff,
* buffer once since we cant dealloate it with X32).
*/
if (*psel == 0) {
- if (!PM_allocRealSeg(sizeof(realHandler),psel,poff,rseg,roff))
- return 0;
- }
+ if (!PM_allocRealSeg(sizeof(realHandler),psel,poff,rseg,roff))
+ return 0;
+ }
PM_memcpyfn(*psel,*poff,realHandler,sizeof(realHandler));
/* Skip past global variables in real mode code segment */
@@ -835,7 +835,7 @@ int PMAPI PM_setMouseHandler(int mask, PM_mouseHandler mh)
lockPMHandlers(); /* Ensure our handlers are locked */
if (!installCallback(_PM_mouseISR, &mouseSel, &mouseOff, &rseg, &roff))
- return 0;
+ return 0;
_PM_mouseHandler = mh;
/* Install the real mode mouse handler */
@@ -852,10 +852,10 @@ void PMAPI PM_restoreMouseHandler(void)
RMREGS regs;
if (_PM_mouseHandler) {
- regs.x.ax = 33;
- PM_int86(0x33, &regs, &regs);
- _PM_mouseHandler = NULL;
- }
+ regs.x.ax = 33;
+ PM_int86(0x33, &regs, &regs);
+ _PM_mouseHandler = NULL;
+ }
}
void PMAPI PM_getPMvect(int intno, PMFARPTR *isr)
@@ -941,9 +941,9 @@ void PMAPI PM_setTimerHandler(PM_intHandler th)
void PMAPI PM_restoreTimerHandler(void)
{
if (_PM_timerHandler) {
- restoreISR(0x8, _PM_prevTimer, _PM_prevRealTimer);
- _PM_timerHandler = NULL;
- }
+ restoreISR(0x8, _PM_prevTimer, _PM_prevRealTimer);
+ _PM_timerHandler = NULL;
+ }
}
ibool PMAPI PM_setRealTimeClockHandler(PM_intHandler th,int frequency)
@@ -969,15 +969,15 @@ ibool PMAPI PM_setRealTimeClockHandler(PM_intHandler th,int frequency)
void PMAPI PM_restoreRealTimeClockHandler(void)
{
if (_PM_rtcHandler) {
- /* Restore CMOS registers and mask RTC clock */
- _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
- _PM_writeCMOS(0x0B,_PM_oldCMOSRegB);
- PM_outpb(0xA1,(PM_inpb(0xA1) & 0xFE) | (_PM_oldRTCPIC2 & ~0xFE));
+ /* Restore CMOS registers and mask RTC clock */
+ _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
+ _PM_writeCMOS(0x0B,_PM_oldCMOSRegB);
+ PM_outpb(0xA1,(PM_inpb(0xA1) & 0xFE) | (_PM_oldRTCPIC2 & ~0xFE));
- /* Restore the interrupt vector */
- restoreISR(0x70, _PM_prevRTC, _PM_prevRealRTC);
- _PM_rtcHandler = NULL;
- }
+ /* Restore the interrupt vector */
+ restoreISR(0x70, _PM_prevRTC, _PM_prevRealRTC);
+ _PM_rtcHandler = NULL;
+ }
}
void PMAPI PM_setKeyHandler(PM_intHandler kh)
@@ -990,9 +990,9 @@ void PMAPI PM_setKeyHandler(PM_intHandler kh)
void PMAPI PM_restoreKeyHandler(void)
{
if (_PM_keyHandler) {
- restoreISR(0x9, _PM_prevKey, _PM_prevRealKey);
- _PM_keyHandler = NULL;
- }
+ restoreISR(0x9, _PM_prevKey, _PM_prevRealKey);
+ _PM_keyHandler = NULL;
+ }
}
void PMAPI PM_setKey15Handler(PM_key15Handler kh)
@@ -1005,9 +1005,9 @@ void PMAPI PM_setKey15Handler(PM_key15Handler kh)
void PMAPI PM_restoreKey15Handler(void)
{
if (_PM_key15Handler) {
- restoreISR(0x15, _PM_prevKey15, _PM_prevRealKey15);
- _PM_key15Handler = NULL;
- }
+ restoreISR(0x15, _PM_prevKey15, _PM_prevRealKey15);
+ _PM_key15Handler = NULL;
+ }
}
void PMAPI PM_installAltBreakHandler(PM_breakHandler bh)
@@ -1031,11 +1031,11 @@ void PMAPI PM_installBreakHandler(void)
void PMAPI PM_restoreBreakHandler(void)
{
if (_PM_prevBreak.sel) {
- restoreISR(0x1B, _PM_prevBreak, prevRealBreak);
- restoreISR(0x23, _PM_prevCtrlC, prevRealCtrlC);
- _PM_prevBreak.sel = 0;
- _PM_breakHandler = NULL;
- }
+ restoreISR(0x1B, _PM_prevBreak, prevRealBreak);
+ restoreISR(0x23, _PM_prevCtrlC, prevRealCtrlC);
+ _PM_prevBreak.sel = 0;
+ _PM_breakHandler = NULL;
+ }
}
void PMAPI PM_installAltCriticalHandler(PM_criticalHandler ch)
@@ -1056,10 +1056,10 @@ void PMAPI PM_installCriticalHandler(void)
void PMAPI PM_restoreCriticalHandler(void)
{
if (_PM_prevCritical.sel) {
- restoreISR(0x24, _PM_prevCritical, prevRealCritical);
- _PM_prevCritical.sel = 0;
- _PM_critHandler = NULL;
- }
+ restoreISR(0x24, _PM_prevCritical, prevRealCritical);
+ _PM_prevCritical.sel = 0;
+ _PM_critHandler = NULL;
+ }
}
int PMAPI PM_lockDataPages(void *p,uint len,PM_lockHandle *lh)
@@ -1199,10 +1199,10 @@ void PMAPI PM_restoreMouseHandler(void)
PMREGS regs;
if (_PM_mouseHandler) {
- regs.x.ax = 33;
- PM_int386(0x33, &regs, &regs);
- _PM_mouseHandler = NULL;
- }
+ regs.x.ax = 33;
+ PM_int386(0x33, &regs, &regs);
+ _PM_mouseHandler = NULL;
+ }
}
#endif
@@ -1288,10 +1288,10 @@ int PMAPI PM_setMouseHandler(int mask, PM_mouseHandler mh)
/* Copy the real mode handler to real mode memory */
if ((mousePtr = PM_allocRealSeg(sizeof(mouseHandler),&rseg,&roff)) == NULL)
- return 0;
+ return 0;
memcpy(mousePtr,mouseHandler,sizeof(mouseHandler));
if (!_DPMI_allocateCallback(_PM_mousePMCB, mouseRegs, &mouseRMCB))
- PM_fatalError("Unable to allocate real mode callback!\n");
+ PM_fatalError("Unable to allocate real mode callback!\n");
PM_setLong(mousePtr,mouseRMCB);
/* Install the real mode mouse handler */
@@ -1309,12 +1309,12 @@ void PMAPI PM_restoreMouseHandler(void)
RMREGS regs;
if (_PM_mouseHandler) {
- regs.x.ax = 33;
- PM_int86(0x33, &regs, &regs);
- PM_freeRealSeg(mousePtr);
- _DPMI_freeCallback(mouseRMCB);
- _PM_mouseHandler = NULL;
- }
+ regs.x.ax = 33;
+ PM_int86(0x33, &regs, &regs);
+ PM_freeRealSeg(mousePtr);
+ _DPMI_freeCallback(mouseRMCB);
+ _PM_mouseHandler = NULL;
+ }
}
#endif
@@ -1347,9 +1347,9 @@ void PMAPI PM_setTimerHandler(PM_intHandler th)
void PMAPI PM_restoreTimerHandler(void)
{
if (_PM_timerHandler) {
- restoreISR(0x8, _PM_prevTimer, _PM_prevRealTimer);
- _PM_timerHandler = NULL;
- }
+ restoreISR(0x8, _PM_prevTimer, _PM_prevRealTimer);
+ _PM_timerHandler = NULL;
+ }
}
ibool PMAPI PM_setRealTimeClockHandler(PM_intHandler th,int frequency)
@@ -1375,15 +1375,15 @@ ibool PMAPI PM_setRealTimeClockHandler(PM_intHandler th,int frequency)
void PMAPI PM_restoreRealTimeClockHandler(void)
{
if (_PM_rtcHandler) {
- /* Restore CMOS registers and mask RTC clock */
- _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
- _PM_writeCMOS(0x0B,_PM_oldCMOSRegB);
- PM_outpb(0xA1,(PM_inpb(0xA1) & 0xFE) | (_PM_oldRTCPIC2 & ~0xFE));
+ /* Restore CMOS registers and mask RTC clock */
+ _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
+ _PM_writeCMOS(0x0B,_PM_oldCMOSRegB);
+ PM_outpb(0xA1,(PM_inpb(0xA1) & 0xFE) | (_PM_oldRTCPIC2 & ~0xFE));
- /* Restore the interrupt vector */
- restoreISR(0x70, _PM_prevRTC, _PM_prevRealRTC);
- _PM_rtcHandler = NULL;
- }
+ /* Restore the interrupt vector */
+ restoreISR(0x70, _PM_prevRTC, _PM_prevRealRTC);
+ _PM_rtcHandler = NULL;
+ }
}
PM_IRQHandle PMAPI PM_setIRQHandler(
@@ -1396,20 +1396,20 @@ PM_IRQHandle PMAPI PM_setIRQHandler(
thunkSize = (ulong)_PM_irqISRTemplateEnd - (ulong)_PM_irqISRTemplate;
if ((handle = PM_malloc(sizeof(_PM_IRQHandle) + thunkSize)) == NULL)
- return NULL;
+ return NULL;
handle->IRQ = IRQ;
handle->prevPIC = PM_inpb(0x21);
handle->prevPIC2 = PM_inpb(0xA1);
if (IRQ < 8) {
- handle->IRQVect = (IRQ + 8);
- PICmask = (1 << IRQ);
- chainPrevious = ((handle->prevPIC & PICmask) == 0);
- }
+ handle->IRQVect = (IRQ + 8);
+ PICmask = (1 << IRQ);
+ chainPrevious = ((handle->prevPIC & PICmask) == 0);
+ }
else {
- handle->IRQVect = (0x60 + IRQ + 8);
- PICmask = ((1 << IRQ) | 0x4);
- chainPrevious = ((handle->prevPIC2 & (PICmask >> 8)) == 0);
- }
+ handle->IRQVect = (0x60 + IRQ + 8);
+ PICmask = ((1 << IRQ) | 0x4);
+ chainPrevious = ((handle->prevPIC2 & (PICmask >> 8)) == 0);
+ }
/* Copy and setup the assembler thunk */
offsetAdjust = (ulong)handle->thunk - (ulong)_PM_irqISRTemplate;
@@ -1417,13 +1417,13 @@ PM_IRQHandle PMAPI PM_setIRQHandler(
*((ulong*)&handle->thunk[2]) = offsetAdjust;
*((ulong*)&handle->thunk[11+0]) = (ulong)ih;
if (chainPrevious) {
- *((ulong*)&handle->thunk[11+4]) = handle->prevHandler.off;
- *((ulong*)&handle->thunk[11+8]) = handle->prevHandler.sel;
- }
+ *((ulong*)&handle->thunk[11+4]) = handle->prevHandler.off;
+ *((ulong*)&handle->thunk[11+8]) = handle->prevHandler.sel;
+ }
else {
- *((ulong*)&handle->thunk[11+4]) = 0;
- *((ulong*)&handle->thunk[11+8]) = 0;
- }
+ *((ulong*)&handle->thunk[11+4]) = 0;
+ *((ulong*)&handle->thunk[11+8]) = 0;
+ }
*((ulong*)&handle->thunk[11+12]) = IRQ;
/* Set the real time clock interrupt handler */
@@ -1444,9 +1444,9 @@ void PMAPI PM_restoreIRQHandler(
/* Restore PIC mask for the interrupt */
if (handle->IRQ < 8)
- PICmask = (1 << handle->IRQ);
+ PICmask = (1 << handle->IRQ);
else
- PICmask = ((1 << handle->IRQ) | 0x4);
+ PICmask = ((1 << handle->IRQ) | 0x4);
PM_outpb(0xA1,(PM_inpb(0xA1) & ~(PICmask >> 8)) | (handle->prevPIC2 & (PICmask >> 8)));
PM_outpb(0x21,(PM_inpb(0x21) & ~PICmask) | (handle->prevPIC & PICmask));
@@ -1467,9 +1467,9 @@ void PMAPI PM_setKeyHandler(PM_intHandler kh)
void PMAPI PM_restoreKeyHandler(void)
{
if (_PM_keyHandler) {
- restoreISR(0x9, _PM_prevKey, _PM_prevRealKey);
- _PM_keyHandler = NULL;
- }
+ restoreISR(0x9, _PM_prevKey, _PM_prevRealKey);
+ _PM_keyHandler = NULL;
+ }
}
void PMAPI PM_setKey15Handler(PM_key15Handler kh)
@@ -1482,9 +1482,9 @@ void PMAPI PM_setKey15Handler(PM_key15Handler kh)
void PMAPI PM_restoreKey15Handler(void)
{
if (_PM_key15Handler) {
- restoreISR(0x15, _PM_prevKey15, _PM_prevRealKey15);
- _PM_key15Handler = NULL;
- }
+ restoreISR(0x15, _PM_prevKey15, _PM_prevRealKey15);
+ _PM_key15Handler = NULL;
+ }
}
/* Real mode Ctrl-C and Ctrl-Break handler. This handler simply sets a
@@ -1540,14 +1540,14 @@ void PMAPI PM_installBreakHandler(void)
void PMAPI PM_restoreBreakHandler(void)
{
if (_PM_prevBreak.sel) {
- restoreISR(0x1B, _PM_prevBreak, prevRealBreak);
- restoreISR(0x23, _PM_prevCtrlC, prevRealCtrlC);
- _PM_prevBreak.sel = 0;
- _PM_breakHandler = NULL;
+ restoreISR(0x1B, _PM_prevBreak, prevRealBreak);
+ restoreISR(0x23, _PM_prevCtrlC, prevRealCtrlC);
+ _PM_prevBreak.sel = 0;
+ _PM_breakHandler = NULL;
#ifndef DOS4GW
- PM_freeRealSeg(_PM_ctrlBPtr);
+ PM_freeRealSeg(_PM_ctrlBPtr);
#endif
- }
+ }
}
/* Real mode Critical Error handler. This handler simply saves the AX and
@@ -1599,11 +1599,11 @@ void PMAPI PM_installCriticalHandler(void)
void PMAPI PM_restoreCriticalHandler(void)
{
if (_PM_prevCritical.sel) {
- restoreISR(0x24, _PM_prevCritical, prevRealCritical);
- PM_freeRealSeg(_PM_critPtr);
- _PM_prevCritical.sel = 0;
- _PM_critHandler = NULL;
- }
+ restoreISR(0x24, _PM_prevCritical, prevRealCritical);
+ PM_freeRealSeg(_PM_critPtr);
+ _PM_prevCritical.sel = 0;
+ _PM_critHandler = NULL;
+ }
}
int PMAPI PM_lockDataPages(void *p,uint len,PM_lockHandle *lh)
diff --git a/board/MAI/bios_emulator/scitech/src/pm/dos/vflat.c b/board/MAI/bios_emulator/scitech/src/pm/dos/vflat.c
index 2e78e25a8b..c3e9b6c33f 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/dos/vflat.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/dos/vflat.c
@@ -79,7 +79,7 @@ PRIVATE ibool CheckDPMI(void)
PMREGS regs;
if (haveDPMI)
- return true;
+ return true;
/* Check if we are running under DPMI in which case we will not be
* able to install our page fault handlers. We can however use the
@@ -88,7 +88,7 @@ PRIVATE ibool CheckDPMI(void)
regs.x.ax = 0xFF00;
PM_int386(0x31,&regs,&regs);
if (!regs.x.cflag && (regs.e.edi & 8))
- return (haveDPMI = true);
+ return (haveDPMI = true);
return false;
}
@@ -101,13 +101,13 @@ ibool PMAPI VF_available(void)
****************************************************************************/
{
if (!VF_zeroPtr)
- VF_zeroPtr = PM_mapPhysicalAddr(0,0xFFFFFFFF,true);
+ VF_zeroPtr = PM_mapPhysicalAddr(0,0xFFFFFFFF,true);
if (CheckDPMI())
- return false;
+ return false;
/* Standard DOS4GW, PMODE/W and Causeway */
if (InitPaging() == -1)
- return false;
+ return false;
ClosePaging();
return true;
}
@@ -153,21 +153,21 @@ void * PMAPI InitDOS4GW(ulong baseAddr,int bankSize,int codeLen,void *bankFunc)
int i;
if (InitPaging() == -1)
- return NULL; /* Cannot do hardware paging! */
+ return NULL; /* Cannot do hardware paging! */
/* Map 4MB of video memory into linear address space (read/write) */
if (bankSize == 64) {
- for (i = 0; i < 64; i++) {
- MapPhysical2Linear(baseAddr,VFLAT_START_ADDR+(i<<16),16,
- PAGE_WRITE | PAGE_NOTPRESENT);
- }
- }
+ for (i = 0; i < 64; i++) {
+ MapPhysical2Linear(baseAddr,VFLAT_START_ADDR+(i<<16),16,
+ PAGE_WRITE | PAGE_NOTPRESENT);
+ }
+ }
else {
- for (i = 0; i < 1024; i++) {
- MapPhysical2Linear(baseAddr,VFLAT_START_ADDR+(i<<12),1,
- PAGE_WRITE | PAGE_NOTPRESENT);
- }
- }
+ for (i = 0; i < 1024; i++) {
+ MapPhysical2Linear(baseAddr,VFLAT_START_ADDR+(i<<12),1,
+ PAGE_WRITE | PAGE_NOTPRESENT);
+ }
+ }
/* Install our page fault handler and banks switch function */
InstallFaultHandler(baseAddr,bankSize);
@@ -191,13 +191,13 @@ void * PMAPI VF_init(ulong baseAddr,int bankSize,int codeLen,void *bankFunc)
****************************************************************************/
{
if (installed)
- return (void*)VFLAT_START_ADDR;
+ return (void*)VFLAT_START_ADDR;
if (codeLen > 100)
- return NULL; /* Bank function is too large! */
+ return NULL; /* Bank function is too large! */
if (!VF_zeroPtr)
- VF_zeroPtr = PM_mapPhysicalAddr(0,0xFFFFFFFF,true);
+ VF_zeroPtr = PM_mapPhysicalAddr(0,0xFFFFFFFF,true);
if (CheckDPMI())
- return InitDPMI(baseAddr,bankSize,codeLen,bankFunc);
+ return InitDPMI(baseAddr,bankSize,codeLen,bankFunc);
return InitDOS4GW(baseAddr,bankSize,codeLen,bankFunc);
}
@@ -212,16 +212,16 @@ void PMAPI VF_exit(void)
****************************************************************************/
{
if (installed) {
- if (haveDPMI) {
- /* DPMI support */
- }
- else {
- /* Standard DOS4GW and PMODE/W support */
- RemoveFaultHandler();
- ClosePaging();
- }
- installed = false;
- }
+ if (haveDPMI) {
+ /* DPMI support */
+ }
+ else {
+ /* Standard DOS4GW and PMODE/W support */
+ RemoveFaultHandler();
+ ClosePaging();
+ }
+ installed = false;
+ }
}
/*-------------------------------------------------------------------------*/
diff --git a/board/MAI/bios_emulator/scitech/src/pm/dos/ztimer.c b/board/MAI/bios_emulator/scitech/src/pm/dos/ztimer.c
index 960ed06cd7..53ab16cf40 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/dos/ztimer.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/dos/ztimer.c
@@ -106,6 +106,6 @@ passed, so if this happens we will be generating erronous results.
ulong __ULZElapsedTime(ulong start,ulong finish)
{
if (finish < start)
- finish += 1573040L; /* Number of ticks in 24 hours */
+ finish += 1573040L; /* Number of ticks in 24 hours */
return finish - start;
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/event.c b/board/MAI/bios_emulator/scitech/src/pm/event.c
index b284c68cfb..b6f458654b 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/event.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/event.c
@@ -106,8 +106,8 @@ queue. This routine assumes that at least one spot is available on the
freeList for the event to be inserted.
NOTE: Interrupts MUST be OFF while this routine is called to ensure we have
- mutually exclusive access to our internal data structures for
- interrupt driven systems (like under DOS).
+ mutually exclusive access to our internal data structures for
+ interrupt driven systems (like under DOS).
****************************************************************************/
static void addEvent(
event_t *evt)
@@ -116,35 +116,35 @@ static void addEvent(
/* Check for mouse double click events */
if (evt->what & EVT_MOUSEEVT) {
- EVT.autoMouse_x = evt->where_x;
- EVT.autoMouse_y = evt->where_y;
- if ((evt->what & EVT_MOUSEDOWN) && !(evt->message & EVT_DBLCLICK)) {
- /* Determine if the last mouse event was a double click event */
- uint diff_x = ABS(evt->where_x - EVT.downMouse.where_x);
- uint diff_y = ABS(evt->where_y - EVT.downMouse.where_y);
- if ((evt->message == EVT.downMouse.message)
- && ((evt->when - EVT.downMouse.when) <= EVT.doubleClick)
- && (diff_x <= EVT.doubleClickThresh)
- && (diff_y <= EVT.doubleClickThresh)) {
- evt->message |= EVT_DBLCLICK;
- EVT.downMouse = *evt;
- EVT.downMouse.when = 0;
- }
- else
- EVT.downMouse = *evt;
- EVT.autoTicks = _EVT_getTicks();
- }
- else if (evt->what & EVT_MOUSEUP) {
- EVT.downMouse.what = EVT_NULLEVT;
- EVT.firstAuto = true;
- }
- }
+ EVT.autoMouse_x = evt->where_x;
+ EVT.autoMouse_y = evt->where_y;
+ if ((evt->what & EVT_MOUSEDOWN) && !(evt->message & EVT_DBLCLICK)) {
+ /* Determine if the last mouse event was a double click event */
+ uint diff_x = ABS(evt->where_x - EVT.downMouse.where_x);
+ uint diff_y = ABS(evt->where_y - EVT.downMouse.where_y);
+ if ((evt->message == EVT.downMouse.message)
+ && ((evt->when - EVT.downMouse.when) <= EVT.doubleClick)
+ && (diff_x <= EVT.doubleClickThresh)
+ && (diff_y <= EVT.doubleClickThresh)) {
+ evt->message |= EVT_DBLCLICK;
+ EVT.downMouse = *evt;
+ EVT.downMouse.when = 0;
+ }
+ else
+ EVT.downMouse = *evt;
+ EVT.autoTicks = _EVT_getTicks();
+ }
+ else if (evt->what & EVT_MOUSEUP) {
+ EVT.downMouse.what = EVT_NULLEVT;
+ EVT.firstAuto = true;
+ }
+ }
/* Call user supplied callback to modify the event if desired */
if (EVT.userEventCallback) {
- if (!EVT.userEventCallback(evt))
- return;
- }
+ if (!EVT.userEventCallback(evt))
+ return;
+ }
/* Get spot to place the event from the free list */
evtID = EVT.freeHead;
@@ -154,9 +154,9 @@ static void addEvent(
evt->next = -1;
evt->prev = EVT.tail;
if (EVT.tail != -1)
- EVT.evtq[EVT.tail].next = evtID;
+ EVT.evtq[EVT.tail].next = evtID;
else
- EVT.head = evtID;
+ EVT.head = evtID;
EVT.tail = evtID;
EVT.evtq[evtID] = *evt;
EVT.count++;
@@ -172,7 +172,7 @@ static void initEventQueue(void)
/* Build free list, and initialize global data structures */
for (i = 0; i < EVENTQSIZE; i++)
- EVT.evtq[i].next = i+1;
+ EVT.evtq[i].next = i+1;
EVT.evtq[EVENTQSIZE-1].next = -1; /* Terminate list */
EVT.count = EVT.freeHead = 0;
EVT.head = EVT.tail = -1;
@@ -217,21 +217,21 @@ static int scaleJoyAxis(
/* Make sure the joystick is calibrated properly */
if (EVT.joyCenter[axis] - EVT.joyMin[axis] < 5)
- return raw;
+ return raw;
if (EVT.joyMax[axis] - EVT.joyCenter[axis] < 5)
- return raw;
+ return raw;
/* Now scale the coordinates to -128 to 127 */
raw -= EVT.joyCenter[axis];
if (raw < 0)
- range = EVT.joyCenter[axis]-EVT.joyMin[axis];
+ range = EVT.joyCenter[axis]-EVT.joyMin[axis];
else
- range = EVT.joyMax[axis]-EVT.joyCenter[axis];
+ range = EVT.joyMax[axis]-EVT.joyCenter[axis];
scaled = (raw * 128) / range;
if (scaled < -128)
- scaled = -128;
+ scaled = -128;
if (scaled > 127)
- scaled = 127;
+ scaled = 127;
return scaled;
}
#endif
@@ -308,9 +308,9 @@ int EVTAPI EVT_joyIsPresent(void)
#endif
mask = _EVT_readJoyAxis(EVT_JOY_AXIS_ALL,EVT.joyCenter);
if (mask) {
- for (i = 0; i < JOY_NUM_AXES; i++)
- EVT.joyMax[i] = EVT.joyCenter[i]*2;
- }
+ for (i = 0; i < JOY_NUM_AXES; i++)
+ EVT.joyMax[i] = EVT.joyCenter[i]*2;
+ }
return mask;
}
@@ -329,9 +329,9 @@ All information polled from the joystick will be posted to the event
queue for later retrieval.
Note: Most analogue joysticks will provide readings that change even
- though the joystick has not moved. Hence if you call this routine
- you will likely get an EVT_JOYMOVE event every time through your
- event loop.
+ though the joystick has not moved. Hence if you call this routine
+ you will likely get an EVT_JOYMOVE event every time through your
+ event loop.
SEE ALSO:
EVT_getNext, EVT_peekNext, EVT_joySetUpperLeft, EVT_joySetLowerRight,
@@ -343,68 +343,68 @@ void EVTAPI EVT_pollJoystick(void)
int i,axis[JOY_NUM_AXES],newButState,mask,moved,ps;
if (EVT.joyMask) {
- /* Read joystick axes and post movement events if they have
- * changed since the last time we polled. Until the events are
- * actually flushed, we keep modifying the same joystick movement
- * event, so you won't get multiple movement event
- */
- mask = _EVT_readJoyAxis(EVT.joyMask,axis);
- newButState = _EVT_readJoyButtons();
- moved = false;
- for (i = 0; i < JOY_NUM_AXES; i++) {
- if (mask & (EVT_JOY_AXIS_X1 << i))
- axis[i] = scaleJoyAxis(axis[i],i);
- else
- axis[i] = EVT.joyPrev[i];
- if (axis[i] != EVT.joyPrev[i])
- moved = true;
- }
- if (moved) {
- memcpy(EVT.joyPrev,axis,sizeof(EVT.joyPrev));
- ps = _EVT_disableInt();
- if (EVT.oldJoyMove != -1) {
- /* Modify the existing joystick movement event */
- EVT.evtq[EVT.oldJoyMove].message = newButState;
- EVT.evtq[EVT.oldJoyMove].where_x = EVT.joyPrev[0];
- EVT.evtq[EVT.oldJoyMove].where_y = EVT.joyPrev[1];
- EVT.evtq[EVT.oldJoyMove].relative_x = EVT.joyPrev[2];
- EVT.evtq[EVT.oldJoyMove].relative_y = EVT.joyPrev[3];
- }
- else if (EVT.count < EVENTQSIZE) {
- /* Add a new joystick movement event */
- EVT.oldJoyMove = EVT.freeHead;
- memset(&evt,0,sizeof(evt));
- evt.what = EVT_JOYMOVE;
- evt.message = EVT.joyButState;
- evt.where_x = EVT.joyPrev[0];
- evt.where_y = EVT.joyPrev[1];
- evt.relative_x = EVT.joyPrev[2];
- evt.relative_y = EVT.joyPrev[3];
- addEvent(&evt);
- }
- _EVT_restoreInt(ps);
- }
-
- /* Read the joystick buttons, and post events to reflect the change
- * in state for the joystick buttons.
- */
- if (newButState != EVT.joyButState) {
- if (EVT.count < EVENTQSIZE) {
- /* Add a new joystick click event */
- ps = _EVT_disableInt();
- memset(&evt,0,sizeof(evt));
- evt.what = EVT_JOYCLICK;
- evt.message = newButState;
- EVT.evtq[EVT.oldJoyMove].where_x = EVT.joyPrev[0];
- EVT.evtq[EVT.oldJoyMove].where_y = EVT.joyPrev[1];
- EVT.evtq[EVT.oldJoyMove].relative_x = EVT.joyPrev[2];
- EVT.evtq[EVT.oldJoyMove].relative_y = EVT.joyPrev[3];
- addEvent(&evt);
- _EVT_restoreInt(ps);
- }
- EVT.joyButState = newButState;
- }
- }
+ /* Read joystick axes and post movement events if they have
+ * changed since the last time we polled. Until the events are
+ * actually flushed, we keep modifying the same joystick movement
+ * event, so you won't get multiple movement event
+ */
+ mask = _EVT_readJoyAxis(EVT.joyMask,axis);
+ newButState = _EVT_readJoyButtons();
+ moved = false;
+ for (i = 0; i < JOY_NUM_AXES; i++) {
+ if (mask & (EVT_JOY_AXIS_X1 << i))
+ axis[i] = scaleJoyAxis(axis[i],i);
+ else
+ axis[i] = EVT.joyPrev[i];
+ if (axis[i] != EVT.joyPrev[i])
+ moved = true;
+ }
+ if (moved) {
+ memcpy(EVT.joyPrev,axis,sizeof(EVT.joyPrev));
+ ps = _EVT_disableInt();
+ if (EVT.oldJoyMove != -1) {
+ /* Modify the existing joystick movement event */
+ EVT.evtq[EVT.oldJoyMove].message = newButState;
+ EVT.evtq[EVT.oldJoyMove].where_x = EVT.joyPrev[0];
+ EVT.evtq[EVT.oldJoyMove].where_y = EVT.joyPrev[1];
+ EVT.evtq[EVT.oldJoyMove].relative_x = EVT.joyPrev[2];
+ EVT.evtq[EVT.oldJoyMove].relative_y = EVT.joyPrev[3];
+ }
+ else if (EVT.count < EVENTQSIZE) {
+ /* Add a new joystick movement event */
+ EVT.oldJoyMove = EVT.freeHead;
+ memset(&evt,0,sizeof(evt));
+ evt.what = EVT_JOYMOVE;
+ evt.message = EVT.joyButState;
+ evt.where_x = EVT.joyPrev[0];
+ evt.where_y = EVT.joyPrev[1];
+ evt.relative_x = EVT.joyPrev[2];
+ evt.relative_y = EVT.joyPrev[3];
+ addEvent(&evt);
+ }
+ _EVT_restoreInt(ps);
+ }
+
+ /* Read the joystick buttons, and post events to reflect the change
+ * in state for the joystick buttons.
+ */
+ if (newButState != EVT.joyButState) {
+ if (EVT.count < EVENTQSIZE) {
+ /* Add a new joystick click event */
+ ps = _EVT_disableInt();
+ memset(&evt,0,sizeof(evt));
+ evt.what = EVT_JOYCLICK;
+ evt.message = newButState;
+ EVT.evtq[EVT.oldJoyMove].where_x = EVT.joyPrev[0];
+ EVT.evtq[EVT.oldJoyMove].where_y = EVT.joyPrev[1];
+ EVT.evtq[EVT.oldJoyMove].relative_x = EVT.joyPrev[2];
+ EVT.evtq[EVT.oldJoyMove].relative_y = EVT.joyPrev[3];
+ addEvent(&evt);
+ _EVT_restoreInt(ps);
+ }
+ EVT.joyButState = newButState;
+ }
+ }
}
/****************************************************************************
@@ -526,19 +526,19 @@ ibool EVTAPI EVT_post(
uint ps;
if (EVT.count < EVENTQSIZE) {
- /* Save information in event record */
- ps = _EVT_disableInt();
- evt.which = which;
- evt.when = _EVT_getTicks();
- evt.what = what;
- evt.message = message;
- evt.modifiers = modifiers;
- addEvent(&evt); /* Add to EVT.tail of event queue */
- _EVT_restoreInt(ps);
- return true;
- }
+ /* Save information in event record */
+ ps = _EVT_disableInt();
+ evt.which = which;
+ evt.when = _EVT_getTicks();
+ evt.what = what;
+ evt.message = message;
+ evt.modifiers = modifiers;
+ addEvent(&evt); /* Add to EVT.tail of event queue */
+ _EVT_restoreInt(ps);
+ return true;
+ }
else
- return false;
+ return false;
}
/****************************************************************************
@@ -565,8 +565,8 @@ void EVTAPI EVT_flush(
event_t evt;
do { /* Flush all events */
- EVT_getNext(&evt,mask);
- } while (evt.what != EVT_NULLEVT);
+ EVT_getNext(&evt,mask);
+ } while (evt.what != EVT_NULLEVT);
}
/****************************************************************************
@@ -596,10 +596,10 @@ void EVTAPI EVT_halt(
ulong mask)
{
do { /* Wait for an event */
- if (mask & (EVT_JOYEVT))
- EVT_pollJoystick();
- EVT_getNext(evt,EVT_EVERYEVT);
- } while (!(evt->what & mask));
+ if (mask & (EVT_JOYEVT))
+ EVT_pollJoystick();
+ EVT_getNext(evt,EVT_EVERYEVT);
+ } while (!(evt->what & mask));
}
/****************************************************************************
@@ -636,31 +636,31 @@ ibool EVTAPI EVT_peekNext(
uint ps;
if (EVT.heartBeat)
- EVT.heartBeat(EVT.heartBeatParams);
+ EVT.heartBeat(EVT.heartBeatParams);
_EVT_pumpMessages(); /* Pump all messages into queue */
EVT.mouseMove(EVT.mx,EVT.my); /* Move the mouse cursor */
evt->what = EVT_NULLEVT; /* Default to null event */
if (EVT.count) {
- /* It is possible that an event be posted while we are trying
- * to access the event queue. This would create problems since
- * we may end up with invalid data for our event queue pointers. To
- * alleviate this, all interrupts are suspended while we manipulate
- * our pointers.
- */
- ps = _EVT_disableInt(); /* disable interrupts */
- for (evtID = EVT.head; evtID != -1; evtID = EVT.evtq[evtID].next) {
- if (EVT.evtq[evtID].what & mask)
- break; /* Found an event */
- }
- if (evtID == -1) {
- _EVT_restoreInt(ps);
- return false; /* Event was not found */
- }
- *evt = EVT.evtq[evtID]; /* Return the event */
- _EVT_restoreInt(ps);
- if (evt->what & EVT_KEYEVT)
- _EVT_maskKeyCode(evt);
- }
+ /* It is possible that an event be posted while we are trying
+ * to access the event queue. This would create problems since
+ * we may end up with invalid data for our event queue pointers. To
+ * alleviate this, all interrupts are suspended while we manipulate
+ * our pointers.
+ */
+ ps = _EVT_disableInt(); /* disable interrupts */
+ for (evtID = EVT.head; evtID != -1; evtID = EVT.evtq[evtID].next) {
+ if (EVT.evtq[evtID].what & mask)
+ break; /* Found an event */
+ }
+ if (evtID == -1) {
+ _EVT_restoreInt(ps);
+ return false; /* Event was not found */
+ }
+ *evt = EVT.evtq[evtID]; /* Return the event */
+ _EVT_restoreInt(ps);
+ if (evt->what & EVT_KEYEVT)
+ _EVT_maskKeyCode(evt);
+ }
return evt->what != EVT_NULLEVT;
}
@@ -696,10 +696,10 @@ If an event of the specified type was not in the event queue, the what field
of the event will be set to NULLEVT, and the return value will return false.
Note: You should /always/ use the EVT_EVERYEVT mask for extracting events
- from your main event loop handler. Using a mask for only a specific
- type of event for long periods of time will cause the event queue to
- fill up with events of the type you are ignoring, eventually causing
- the application to hang when the event queue becomes full.
+ from your main event loop handler. Using a mask for only a specific
+ type of event for long periods of time will cause the event queue to
+ fill up with events of the type you are ignoring, eventually causing
+ the application to hang when the event queue becomes full.
SEE ALSO:
EVT_flush, EVT_halt, EVT_peekNext
@@ -712,68 +712,68 @@ ibool EVTAPI EVT_getNext(
uint ps;
if (EVT.heartBeat)
- EVT.heartBeat(EVT.heartBeatParams);
+ EVT.heartBeat(EVT.heartBeatParams);
_EVT_pumpMessages(); /* Pump all messages into queue */
EVT.mouseMove(EVT.mx,EVT.my); /* Move the mouse cursor */
evt->what = EVT_NULLEVT; /* Default to null event */
if (EVT.count) {
- /* It is possible that an event be posted while we are trying
- * to access the event queue. This would create problems since
- * we may end up with invalid data for our event queue pointers. To
- * alleviate this, all interrupts are suspended while we manipulate
- * our pointers.
- */
- ps = _EVT_disableInt(); /* disable interrupts */
- for (evtID = EVT.head; evtID != -1; evtID = EVT.evtq[evtID].next) {
- if (EVT.evtq[evtID].what & mask)
- break; /* Found an event */
- }
- if (evtID == -1) {
- _EVT_restoreInt(ps);
- return false; /* Event was not found */
- }
- next = EVT.evtq[evtID].next;
- prev = EVT.evtq[evtID].prev;
- if (prev != -1)
- EVT.evtq[prev].next = next;
- else
- EVT.head = next;
- if (next != -1)
- EVT.evtq[next].prev = prev;
- else
- EVT.tail = prev;
- *evt = EVT.evtq[evtID]; /* Return the event */
- EVT.evtq[evtID].next = EVT.freeHead; /* and return to free list */
- EVT.freeHead = evtID;
- EVT.count--;
- if (evt->what == EVT_MOUSEMOVE)
- EVT.oldMove = -1;
- if (evt->what == EVT_KEYREPEAT)
- EVT.oldKey = -1;
- if (evt->what == EVT_JOYMOVE)
- EVT.oldJoyMove = -1;
- _EVT_restoreInt(ps); /* enable interrupts */
- if (evt->what & EVT_KEYEVT)
- _EVT_maskKeyCode(evt);
- }
+ /* It is possible that an event be posted while we are trying
+ * to access the event queue. This would create problems since
+ * we may end up with invalid data for our event queue pointers. To
+ * alleviate this, all interrupts are suspended while we manipulate
+ * our pointers.
+ */
+ ps = _EVT_disableInt(); /* disable interrupts */
+ for (evtID = EVT.head; evtID != -1; evtID = EVT.evtq[evtID].next) {
+ if (EVT.evtq[evtID].what & mask)
+ break; /* Found an event */
+ }
+ if (evtID == -1) {
+ _EVT_restoreInt(ps);
+ return false; /* Event was not found */
+ }
+ next = EVT.evtq[evtID].next;
+ prev = EVT.evtq[evtID].prev;
+ if (prev != -1)
+ EVT.evtq[prev].next = next;
+ else
+ EVT.head = next;
+ if (next != -1)
+ EVT.evtq[next].prev = prev;
+ else
+ EVT.tail = prev;
+ *evt = EVT.evtq[evtID]; /* Return the event */
+ EVT.evtq[evtID].next = EVT.freeHead; /* and return to free list */
+ EVT.freeHead = evtID;
+ EVT.count--;
+ if (evt->what == EVT_MOUSEMOVE)
+ EVT.oldMove = -1;
+ if (evt->what == EVT_KEYREPEAT)
+ EVT.oldKey = -1;
+ if (evt->what == EVT_JOYMOVE)
+ EVT.oldJoyMove = -1;
+ _EVT_restoreInt(ps); /* enable interrupts */
+ if (evt->what & EVT_KEYEVT)
+ _EVT_maskKeyCode(evt);
+ }
/* If there is no event pending, check if we should generate an auto
* mouse down event if the mouse is still currently down.
*/
if (evt->what == EVT_NULLEVT && EVT.autoRepeat && (mask & EVT_MOUSEAUTO) && (EVT.downMouse.what & EVT_MOUSEDOWN)) {
- ulong ticks = _EVT_getTicks();
- if ((ticks - EVT.autoTicks) >= (EVT.autoRepeat + (EVT.firstAuto ? EVT.autoDelay : 0))) {
- evt->what = EVT_MOUSEAUTO;
- evt->message = EVT.downMouse.message;
- evt->modifiers = EVT.downMouse.modifiers;
- evt->where_x = EVT.autoMouse_x;
- evt->where_y = EVT.autoMouse_y;
- evt->relative_x = 0;
- evt->relative_y = 0;
- EVT.autoTicks = evt->when = ticks;
- EVT.firstAuto = false;
- }
- }
+ ulong ticks = _EVT_getTicks();
+ if ((ticks - EVT.autoTicks) >= (EVT.autoRepeat + (EVT.firstAuto ? EVT.autoDelay : 0))) {
+ evt->what = EVT_MOUSEAUTO;
+ evt->message = EVT.downMouse.message;
+ evt->modifiers = EVT.downMouse.modifiers;
+ evt->where_x = EVT.autoMouse_x;
+ evt->where_y = EVT.autoMouse_y;
+ evt->relative_x = 0;
+ evt->relative_y = 0;
+ EVT.autoTicks = evt->when = ticks;
+ EVT.firstAuto = false;
+ }
+ }
return evt->what != EVT_NULLEVT;
}
@@ -802,18 +802,18 @@ callback unless you plan to use the events immediately that they are
recieved.
Note: Your event callback may be called in response to a hardware
- interrupt and will be executing in the context of the hardware
- interrupt handler under MSDOS (ie: keyboard interrupt or mouse
- interrupt). For this reason the code pages for the callback that
- you register must be locked in memory with the PM_lockCodePages
- function. You must also lock down any data pages that your function
- needs to reference as well.
+ interrupt and will be executing in the context of the hardware
+ interrupt handler under MSDOS (ie: keyboard interrupt or mouse
+ interrupt). For this reason the code pages for the callback that
+ you register must be locked in memory with the PM_lockCodePages
+ function. You must also lock down any data pages that your function
+ needs to reference as well.
Note: You can also use this filter callback to process events at the
- time they are activated by the user (ie: when the user hits the
- key or moves the mouse), but make sure your code runs as fast as
- possible as it will be executing inside the context of an interrupt
- handler on some systems.
+ time they are activated by the user (ie: when the user hits the
+ key or moves the mouse), but make sure your code runs as fast as
+ possible as it will be executing inside the context of an interrupt
+ handler on some systems.
SEE ALSO:
EVT_getNext, EVT_peekNext
@@ -1068,10 +1068,10 @@ the scan code is the result, for example:
code = EVT_scanCode(EVT.myEvent.message);
NOTE: Scan codes in the event library are not really hardware scan codes,
- but rather virtual scan codes as generated by a low level keyboard
- interface driver. All virtual scan code values are defined by the
- EVT_scanCodesType enumeration, and will be identical across all
- supports OS'es and platforms.
+ but rather virtual scan codes as generated by a low level keyboard
+ interface driver. All virtual scan code values are defined by the
+ EVT_scanCodesType enumeration, and will be identical across all
+ supports OS'es and platforms.
SEE ALSO:
EVT_asciiCode, EVT_repeatCount
diff --git a/board/MAI/bios_emulator/scitech/src/pm/linux/event.c b/board/MAI/bios_emulator/scitech/src/pm/linux/event.c
index c2668ceb88..ce38732097 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/linux/event.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/linux/event.c
@@ -89,7 +89,7 @@ mouse_info mouse_infos[] = {
{"BusMouse", STD_FLG, NULL, {0xf8, 0x80, 0x00, 0x00}, 3, 3},
{"MouseMan", CS7 | STD_FLG, _EVT_mouse_init, {0x40, 0x40, 0x40, 0x00}, 3, 1},
{"IntelliMouse", CS7 | STD_FLG, _EVT_pnpmouse_init, {0xc0, 0x40, 0xc0, 0x00}, 4, 1},
- {"IMPS2", CS7 | STD_FLG, NULL, {0xc0, 0x40, 0xc0, 0x00}, 4, 1}, // ?
+ {"IMPS2", CS7 | STD_FLG, NULL, {0xc0, 0x40, 0xc0, 0x00}, 4, 1}, /* ? */
};
#define NB_MICE (sizeof(mouse_infos)/sizeof(mouse_info))
@@ -109,7 +109,7 @@ typedef struct {
int map;
} keymap;
-// TODO: Fix this and set it up so we can do a binary search!
+/* TODO: Fix this and set it up so we can do a binary search! */
keymap keymaps[] = {
{96, KB_padEnter},
@@ -249,131 +249,131 @@ static ibool readMouseData(
/* Read the first byte to check for the protocol */
drv = &mouse_infos[mouse_driver];
if (read(_EVT_mouse_fd, data, drv->read) != drv->read) {
- perror("read");
- return false;
- }
+ perror("read");
+ return false;
+ }
if ((data[0] & drv->proto[0]) != drv->proto[1])
- return false;
+ return false;
/* Load a whole protocol packet */
cnt += drv->read;
while (cnt < drv->packet_len) {
- ret = read(_EVT_mouse_fd, data+cnt, drv->read);
- if (ret == drv->read)
- cnt += ret;
- else {
- perror("read");
- return false;
- }
- }
+ ret = read(_EVT_mouse_fd, data+cnt, drv->read);
+ if (ret == drv->read)
+ cnt += ret;
+ else {
+ perror("read");
+ return false;
+ }
+ }
if ((data[1] & drv->proto[2]) != drv->proto[3])
- return false;
+ return false;
/* Now decode the protocol packet */
switch (mouse_driver) {
- case EVT_microsoft:
- if (data[0] == 0x40 && !(prev|data[1]|data[2]))
- *buttons = 2; /* Third button on MS compatible mouse */
- else
- *buttons= ((data[0] & 0x20) >> 3) | ((data[0] & 0x10) >> 4);
- prev = *buttons;
- *dx = (char)(((data[0] & 0x03) << 6) | (data[1] & 0x3F));
- *dy = (char)(((data[0] & 0x0C) << 4) | (data[2] & 0x3F));
- break;
- case EVT_ps2:
- *buttons = !!(data[0]&1) * 4 + !!(data[0]&2) * 1 + !!(data[0]&4) * 2;
- if (data[1] != 0)
- *dx = (data[0] & 0x10) ? data[1]-256 : data[1];
- else
- *dx = 0;
- if (data[2] != 0)
- *dy = -((data[0] & 0x20) ? data[2]-256 : data[2]);
- else
- *dy = 0;
- break;
- case EVT_mousesystems: case EVT_gpm:
- *buttons = (~data[0]) & 0x07;
- *dx = (char)(data[1]) + (char)(data[3]);
- *dy = -((char)(data[2]) + (char)(data[4]));
- break;
- case EVT_logitech:
- *buttons= data[0] & 0x07;
- *dx = (data[0] & 0x10) ? data[1] : - data[1];
- *dy = (data[0] & 0x08) ? - data[2] : data[2];
- break;
- case EVT_busmouse:
- *buttons= (~data[0]) & 0x07;
- *dx = (char)data[1];
- *dy = -(char)data[2];
- break;
- case EVT_MMseries:
- *buttons = data[0] & 0x07;
- *dx = (data[0] & 0x10) ? data[1] : - data[1];
- *dy = (data[0] & 0x08) ? - data[2] : data[2];
- break;
- case EVT_intellimouse:
- *buttons = ((data[0] & 0x20) >> 3) /* left */
- | ((data[3] & 0x10) >> 3) /* middle */
- | ((data[0] & 0x10) >> 4); /* right */
- *dx = (char)(((data[0] & 0x03) << 6) | (data[1] & 0x3F));
- *dy = (char)(((data[0] & 0x0C) << 4) | (data[2] & 0x3F));
- break;
- case EVT_intellimouse_ps2:
- *buttons = (data[0] & 0x04) >> 1 /* Middle */
- | (data[0] & 0x02) >> 1 /* Right */
- | (data[0] & 0x01) << 2; /* Left */
- *dx = (data[0] & 0x10) ? data[1]-256 : data[1];
- *dy = (data[0] & 0x20) ? -(data[2]-256) : -data[2];
- break;
- case EVT_mouseman: {
- static int getextra;
- static uchar prev=0;
- uchar b;
-
- /* The damned MouseMan has 3/4 bytes packets. The extra byte
- * is only there if the middle button is active.
- * I get the extra byte as a packet with magic numbers in it.
- * and then switch to 4-byte mode.
- */
- if (data[1] == 0xAA && data[2] == 0x55) {
- /* Got unexpected fourth byte */
- if ((b = (*data>>4)) > 0x3)
- return false; /* just a sanity check */
- *dx = *dy = 0;
- drv->packet_len=4;
- getextra=0;
- }
- else {
- /* Got 3/4, as expected */
- /* Motion is independent of packetlen... */
- *dx = (char)(((data[0] & 0x03) << 6) | (data[1] & 0x3F));
- *dy = (char)(((data[0] & 0x0C) << 4) | (data[2] & 0x3F));
- prev = ((data[0] & 0x20) >> 3) | ((data[0] & 0x10) >> 4);
- if (drv->packet_len==4)
- b = data[3]>>4;
- }
- if (drv->packet_len == 4) {
- if (b == 0) {
- drv->packet_len = 3;
- getextra = 1;
- }
- else {
- if (b & 0x2)
- prev |= 2;
- }
- }
- *buttons = prev;
-
- /* This "chord-middle" behaviour was reported by David A. van Leeuwen */
- if (((prev ^ *buttons) & 5) == 5)
- *buttons = *buttons ? 2 : 0;
- prev = *buttons;
- break;
- }
- case EVT_noMouse:
- return false;
- break;
- }
+ case EVT_microsoft:
+ if (data[0] == 0x40 && !(prev|data[1]|data[2]))
+ *buttons = 2; /* Third button on MS compatible mouse */
+ else
+ *buttons= ((data[0] & 0x20) >> 3) | ((data[0] & 0x10) >> 4);
+ prev = *buttons;
+ *dx = (char)(((data[0] & 0x03) << 6) | (data[1] & 0x3F));
+ *dy = (char)(((data[0] & 0x0C) << 4) | (data[2] & 0x3F));
+ break;
+ case EVT_ps2:
+ *buttons = !!(data[0]&1) * 4 + !!(data[0]&2) * 1 + !!(data[0]&4) * 2;
+ if (data[1] != 0)
+ *dx = (data[0] & 0x10) ? data[1]-256 : data[1];
+ else
+ *dx = 0;
+ if (data[2] != 0)
+ *dy = -((data[0] & 0x20) ? data[2]-256 : data[2]);
+ else
+ *dy = 0;
+ break;
+ case EVT_mousesystems: case EVT_gpm:
+ *buttons = (~data[0]) & 0x07;
+ *dx = (char)(data[1]) + (char)(data[3]);
+ *dy = -((char)(data[2]) + (char)(data[4]));
+ break;
+ case EVT_logitech:
+ *buttons= data[0] & 0x07;
+ *dx = (data[0] & 0x10) ? data[1] : - data[1];
+ *dy = (data[0] & 0x08) ? - data[2] : data[2];
+ break;
+ case EVT_busmouse:
+ *buttons= (~data[0]) & 0x07;
+ *dx = (char)data[1];
+ *dy = -(char)data[2];
+ break;
+ case EVT_MMseries:
+ *buttons = data[0] & 0x07;
+ *dx = (data[0] & 0x10) ? data[1] : - data[1];
+ *dy = (data[0] & 0x08) ? - data[2] : data[2];
+ break;
+ case EVT_intellimouse:
+ *buttons = ((data[0] & 0x20) >> 3) /* left */
+ | ((data[3] & 0x10) >> 3) /* middle */
+ | ((data[0] & 0x10) >> 4); /* right */
+ *dx = (char)(((data[0] & 0x03) << 6) | (data[1] & 0x3F));
+ *dy = (char)(((data[0] & 0x0C) << 4) | (data[2] & 0x3F));
+ break;
+ case EVT_intellimouse_ps2:
+ *buttons = (data[0] & 0x04) >> 1 /* Middle */
+ | (data[0] & 0x02) >> 1 /* Right */
+ | (data[0] & 0x01) << 2; /* Left */
+ *dx = (data[0] & 0x10) ? data[1]-256 : data[1];
+ *dy = (data[0] & 0x20) ? -(data[2]-256) : -data[2];
+ break;
+ case EVT_mouseman: {
+ static int getextra;
+ static uchar prev=0;
+ uchar b;
+
+ /* The damned MouseMan has 3/4 bytes packets. The extra byte
+ * is only there if the middle button is active.
+ * I get the extra byte as a packet with magic numbers in it.
+ * and then switch to 4-byte mode.
+ */
+ if (data[1] == 0xAA && data[2] == 0x55) {
+ /* Got unexpected fourth byte */
+ if ((b = (*data>>4)) > 0x3)
+ return false; /* just a sanity check */
+ *dx = *dy = 0;
+ drv->packet_len=4;
+ getextra=0;
+ }
+ else {
+ /* Got 3/4, as expected */
+ /* Motion is independent of packetlen... */
+ *dx = (char)(((data[0] & 0x03) << 6) | (data[1] & 0x3F));
+ *dy = (char)(((data[0] & 0x0C) << 4) | (data[2] & 0x3F));
+ prev = ((data[0] & 0x20) >> 3) | ((data[0] & 0x10) >> 4);
+ if (drv->packet_len==4)
+ b = data[3]>>4;
+ }
+ if (drv->packet_len == 4) {
+ if (b == 0) {
+ drv->packet_len = 3;
+ getextra = 1;
+ }
+ else {
+ if (b & 0x2)
+ prev |= 2;
+ }
+ }
+ *buttons = prev;
+
+ /* This "chord-middle" behaviour was reported by David A. van Leeuwen */
+ if (((prev ^ *buttons) & 5) == 5)
+ *buttons = *buttons ? 2 : 0;
+ prev = *buttons;
+ break;
+ }
+ case EVT_noMouse:
+ return false;
+ break;
+ }
return true;
}
@@ -389,9 +389,9 @@ static int getKeyMapping(
int i;
for(i = 0; i < nb; i++) {
- if (tab[i].scan == key)
- return tab[i].map;
- }
+ if (tab[i].scan == key)
+ return tab[i].map;
+ }
return key;
}
@@ -411,21 +411,21 @@ static void makeJoyEvent(
{
evt->message = 0;
if (buts0 && axis0) {
- if (buts0[0]) evt->message |= EVT_JOY1_BUTTONA;
- if (buts0[1]) evt->message |= EVT_JOY1_BUTTONB;
- evt->where_x = axis0[0];
- evt->where_y = axis0[1];
- }
+ if (buts0[0]) evt->message |= EVT_JOY1_BUTTONA;
+ if (buts0[1]) evt->message |= EVT_JOY1_BUTTONB;
+ evt->where_x = axis0[0];
+ evt->where_y = axis0[1];
+ }
else
- evt->where_x = evt->where_y = 0;
+ evt->where_x = evt->where_y = 0;
if (buts1 && axis1) {
- if (buts1[0]) evt->message |= EVT_JOY2_BUTTONA;
- if (buts1[1]) evt->message |= EVT_JOY2_BUTTONB;
- evt->where_x = axis1[0];
- evt->where_y = axis1[1];
- }
+ if (buts1[0]) evt->message |= EVT_JOY2_BUTTONA;
+ if (buts1[1]) evt->message |= EVT_JOY2_BUTTONB;
+ evt->where_x = axis1[0];
+ evt->where_y = axis1[1];
+ }
else
- evt->where_x = evt->where_y = 0;
+ evt->where_x = evt->where_y = 0;
}
/****************************************************************************
@@ -439,39 +439,39 @@ int EVTAPI _EVT_readJoyAxis(
int mask = 0;
if ((js_version & ~0xffff) == 0) {
- /* Old 0.x driver */
- struct JS_DATA_TYPE js;
- if (joystick0_fd && read(joystick0_fd, &js, JS_RETURN) == JS_RETURN) {
- if (jmask & EVT_JOY_AXIS_X1)
- axis[0] = js.x;
- if (jmask & EVT_JOY_AXIS_Y1)
- axis[1] = js.y;
- mask |= EVT_JOY_AXIS_X1|EVT_JOY_AXIS_Y1;
- }
- if (joystick1_fd && read(joystick1_fd, &js, JS_RETURN) == JS_RETURN) {
- if (jmask & EVT_JOY_AXIS_X2)
- axis[2] = js.x;
- if (jmask & EVT_JOY_AXIS_Y2)
- axis[3] = js.y;
- mask |= EVT_JOY_AXIS_X2|EVT_JOY_AXIS_Y2;
- }
- }
+ /* Old 0.x driver */
+ struct JS_DATA_TYPE js;
+ if (joystick0_fd && read(joystick0_fd, &js, JS_RETURN) == JS_RETURN) {
+ if (jmask & EVT_JOY_AXIS_X1)
+ axis[0] = js.x;
+ if (jmask & EVT_JOY_AXIS_Y1)
+ axis[1] = js.y;
+ mask |= EVT_JOY_AXIS_X1|EVT_JOY_AXIS_Y1;
+ }
+ if (joystick1_fd && read(joystick1_fd, &js, JS_RETURN) == JS_RETURN) {
+ if (jmask & EVT_JOY_AXIS_X2)
+ axis[2] = js.x;
+ if (jmask & EVT_JOY_AXIS_Y2)
+ axis[3] = js.y;
+ mask |= EVT_JOY_AXIS_X2|EVT_JOY_AXIS_Y2;
+ }
+ }
else {
- if (axis0) {
- if (jmask & EVT_JOY_AXIS_X1)
- axis[0] = axis0[0];
- if (jmask & EVT_JOY_AXIS_Y1)
- axis[1] = axis0[1];
- mask |= EVT_JOY_AXIS_X1 | EVT_JOY_AXIS_Y1;
- }
- if (axis1) {
- if (jmask & EVT_JOY_AXIS_X2)
- axis[2] = axis1[0];
- if (jmask & EVT_JOY_AXIS_Y2)
- axis[3] = axis1[1];
- mask |= EVT_JOY_AXIS_X2 | EVT_JOY_AXIS_Y2;
- }
- }
+ if (axis0) {
+ if (jmask & EVT_JOY_AXIS_X1)
+ axis[0] = axis0[0];
+ if (jmask & EVT_JOY_AXIS_Y1)
+ axis[1] = axis0[1];
+ mask |= EVT_JOY_AXIS_X1 | EVT_JOY_AXIS_Y1;
+ }
+ if (axis1) {
+ if (jmask & EVT_JOY_AXIS_X2)
+ axis[2] = axis1[0];
+ if (jmask & EVT_JOY_AXIS_Y2)
+ axis[3] = axis1[1];
+ mask |= EVT_JOY_AXIS_X2 | EVT_JOY_AXIS_Y2;
+ }
+ }
return mask;
}
@@ -484,19 +484,19 @@ int EVTAPI _EVT_readJoyButtons(void)
int buts = 0;
if ((js_version & ~0xffff) == 0) {
- /* Old 0.x driver */
- struct JS_DATA_TYPE js;
- if (joystick0_fd && read(joystick0_fd, &js, JS_RETURN) == JS_RETURN)
- buts = js.buttons;
- if (joystick1_fd && read(joystick1_fd, &js, JS_RETURN) == JS_RETURN)
- buts |= js.buttons << 2;
- }
+ /* Old 0.x driver */
+ struct JS_DATA_TYPE js;
+ if (joystick0_fd && read(joystick0_fd, &js, JS_RETURN) == JS_RETURN)
+ buts = js.buttons;
+ if (joystick1_fd && read(joystick1_fd, &js, JS_RETURN) == JS_RETURN)
+ buts |= js.buttons << 2;
+ }
else {
- if (buts0)
- buts |= EVT_JOY1_BUTTONA*buts0[0] + EVT_JOY1_BUTTONB*buts0[1];
- if (buts1)
- buts |= EVT_JOY2_BUTTONA*buts1[0] + EVT_JOY2_BUTTONB*buts1[1];
- }
+ if (buts0)
+ buts |= EVT_JOY1_BUTTONA*buts0[0] + EVT_JOY1_BUTTONB*buts0[1];
+ if (buts1)
+ buts |= EVT_JOY2_BUTTONA*buts1[0] + EVT_JOY2_BUTTONB*buts1[1];
+ }
return buts;
}
@@ -525,97 +525,97 @@ int EVTAPI EVT_joyIsPresent(void)
static ibool inited = false;
if (inited)
- return mask;
+ return mask;
memset(EVT.joyMin,0,sizeof(EVT.joyMin));
memset(EVT.joyCenter,0,sizeof(EVT.joyCenter));
memset(EVT.joyMax,0,sizeof(EVT.joyMax));
memset(EVT.joyPrev,0,sizeof(EVT.joyPrev));
EVT.joyButState = 0;
if ((tmp = getenv(ENV_JOYDEV0)) != NULL)
- strcpy(joystick0_dev,tmp);
+ strcpy(joystick0_dev,tmp);
if ((tmp = getenv(ENV_JOYDEV1)) != NULL)
- strcpy(joystick1_dev,tmp);
+ strcpy(joystick1_dev,tmp);
if ((joystick0_fd = open(joystick0_dev, O_RDONLY)) < 0)
- joystick0_fd = 0;
+ joystick0_fd = 0;
if ((joystick1_fd = open(joystick1_dev, O_RDONLY)) < 0)
- joystick1_fd = 0;
- if (!joystick0_fd && !joystick1_fd) // No joysticks detected
- return 0;
+ joystick1_fd = 0;
+ if (!joystick0_fd && !joystick1_fd) /* No joysticks detected */
+ return 0;
inited = true;
if (ioctl(joystick0_fd ? joystick0_fd : joystick1_fd, JSIOCGVERSION, &js_version) < 0)
- return 0;
+ return 0;
/* Initialise joystick 0 */
if (joystick0_fd) {
- ioctl(joystick0_fd, JSIOCGNAME(sizeof(name0)), name0);
- if (js_version & ~0xffff) {
- struct js_event js;
-
- ioctl(joystick0_fd, JSIOCGAXES, &js0_axes);
- ioctl(joystick0_fd, JSIOCGBUTTONS, &js0_buttons);
- axis0 = PM_calloc((int)js0_axes, sizeof(short));
- buts0 = PM_malloc((int)js0_buttons);
- /* Read the initial events */
- while(dataReady(joystick0_fd)
- && read(joystick0_fd, &js, sizeof(struct js_event)) == sizeof(struct js_event)
- && (js.type & JS_EVENT_INIT)
- ) {
- if (js.type & JS_EVENT_BUTTON)
- buts0[js.number] = js.value;
- else if (js.type & JS_EVENT_AXIS)
- axis0[js.number] = scaleJoyAxis(js.value,js.number);
- }
- }
- else {
- js0_axes = 2;
- js0_buttons = 2;
- axis0 = PM_calloc((int)js0_axes, sizeof(short));
- buts0 = PM_malloc((int)js0_buttons);
- }
- }
+ ioctl(joystick0_fd, JSIOCGNAME(sizeof(name0)), name0);
+ if (js_version & ~0xffff) {
+ struct js_event js;
+
+ ioctl(joystick0_fd, JSIOCGAXES, &js0_axes);
+ ioctl(joystick0_fd, JSIOCGBUTTONS, &js0_buttons);
+ axis0 = PM_calloc((int)js0_axes, sizeof(short));
+ buts0 = PM_malloc((int)js0_buttons);
+ /* Read the initial events */
+ while(dataReady(joystick0_fd)
+ && read(joystick0_fd, &js, sizeof(struct js_event)) == sizeof(struct js_event)
+ && (js.type & JS_EVENT_INIT)
+ ) {
+ if (js.type & JS_EVENT_BUTTON)
+ buts0[js.number] = js.value;
+ else if (js.type & JS_EVENT_AXIS)
+ axis0[js.number] = scaleJoyAxis(js.value,js.number);
+ }
+ }
+ else {
+ js0_axes = 2;
+ js0_buttons = 2;
+ axis0 = PM_calloc((int)js0_axes, sizeof(short));
+ buts0 = PM_malloc((int)js0_buttons);
+ }
+ }
/* Initialise joystick 1 */
if (joystick1_fd) {
- ioctl(joystick1_fd, JSIOCGNAME(sizeof(name1)), name1);
- if (js_version & ~0xffff) {
- struct js_event js;
-
- ioctl(joystick1_fd, JSIOCGAXES, &js1_axes);
- ioctl(joystick1_fd, JSIOCGBUTTONS, &js1_buttons);
- axis1 = PM_calloc((int)js1_axes, sizeof(short));
- buts1 = PM_malloc((int)js1_buttons);
- /* Read the initial events */
- while(dataReady(joystick1_fd)
- && read(joystick1_fd, &js, sizeof(struct js_event))==sizeof(struct js_event)
- && (js.type & JS_EVENT_INIT)
- ) {
- if (js.type & JS_EVENT_BUTTON)
- buts1[js.number] = js.value;
- else if (js.type & JS_EVENT_AXIS)
- axis1[js.number] = scaleJoyAxis(js.value,js.number<<2);
- }
- }
- else {
- js1_axes = 2;
- js1_buttons = 2;
- axis1 = PM_calloc((int)js1_axes, sizeof(short));
- buts1 = PM_malloc((int)js1_buttons);
- }
- }
+ ioctl(joystick1_fd, JSIOCGNAME(sizeof(name1)), name1);
+ if (js_version & ~0xffff) {
+ struct js_event js;
+
+ ioctl(joystick1_fd, JSIOCGAXES, &js1_axes);
+ ioctl(joystick1_fd, JSIOCGBUTTONS, &js1_buttons);
+ axis1 = PM_calloc((int)js1_axes, sizeof(short));
+ buts1 = PM_malloc((int)js1_buttons);
+ /* Read the initial events */
+ while(dataReady(joystick1_fd)
+ && read(joystick1_fd, &js, sizeof(struct js_event))==sizeof(struct js_event)
+ && (js.type & JS_EVENT_INIT)
+ ) {
+ if (js.type & JS_EVENT_BUTTON)
+ buts1[js.number] = js.value;
+ else if (js.type & JS_EVENT_AXIS)
+ axis1[js.number] = scaleJoyAxis(js.value,js.number<<2);
+ }
+ }
+ else {
+ js1_axes = 2;
+ js1_buttons = 2;
+ axis1 = PM_calloc((int)js1_axes, sizeof(short));
+ buts1 = PM_malloc((int)js1_buttons);
+ }
+ }
#ifdef CHECKED
- fprintf(stderr,"Using joystick driver version %d.%d.%d\n",
- js_version >> 16, (js_version >> 8) & 0xff, js_version & 0xff);
+ fprintf(stderr,"Using joystick driver version %d.%d.%d\n",
+ js_version >> 16, (js_version >> 8) & 0xff, js_version & 0xff);
if (joystick0_fd)
- fprintf(stderr,"Joystick 1 (%s): %s\n", joystick0_dev, name0);
+ fprintf(stderr,"Joystick 1 (%s): %s\n", joystick0_dev, name0);
if (joystick1_fd)
- fprintf(stderr,"Joystick 2 (%s): %s\n", joystick1_dev, name1);
+ fprintf(stderr,"Joystick 2 (%s): %s\n", joystick1_dev, name1);
#endif
mask = _EVT_readJoyAxis(EVT_JOY_AXIS_ALL,EVT.joyCenter);
if (mask) {
- for (i = 0; i < JOY_NUM_AXES; i++)
- EVT.joyMax[i] = EVT.joyCenter[i]*2;
- }
+ for (i = 0; i < JOY_NUM_AXES; i++)
+ EVT.joyMax[i] = EVT.joyCenter[i]*2;
+ }
return mask;
}
@@ -634,9 +634,9 @@ All information polled from the joystick will be posted to the event
queue for later retrieval.
Note: Most analogue joysticks will provide readings that change even
- though the joystick has not moved. Hence if you call this routine
- you will likely get an EVT_JOYMOVE event every time through your
- event loop.
+ though the joystick has not moved. Hence if you call this routine
+ you will likely get an EVT_JOYMOVE event every time through your
+ event loop.
SEE ALSO:
EVT_getNext, EVT_peekNext, EVT_joySetUpperLeft, EVT_joySetLowerRight,
@@ -648,68 +648,68 @@ void EVTAPI EVT_pollJoystick(void)
int i,axis[JOY_NUM_AXES],newButState,mask,moved,ps;
if ((js_version & ~0xFFFF) == 0 && EVT.joyMask) {
- /* Read joystick axes and post movement events if they have
- * changed since the last time we polled. Until the events are
- * actually flushed, we keep modifying the same joystick movement
- * event, so you won't get multiple movement event
- */
- mask = _EVT_readJoyAxis(EVT.joyMask,axis);
- newButState = _EVT_readJoyButtons();
- moved = false;
- for (i = 0; i < JOY_NUM_AXES; i++) {
- if (mask & (EVT_JOY_AXIS_X1 << i))
- axis[i] = scaleJoyAxis(axis[i],i);
- else
- axis[i] = EVT.joyPrev[i];
- if (axis[i] != EVT.joyPrev[i])
- moved = true;
- }
- if (moved) {
- memcpy(EVT.joyPrev,axis,sizeof(EVT.joyPrev));
- ps = _EVT_disableInt();
- if (EVT.oldJoyMove != -1) {
- /* Modify the existing joystick movement event */
- EVT.evtq[EVT.oldJoyMove].message = newButState;
- EVT.evtq[EVT.oldJoyMove].where_x = EVT.joyPrev[0];
- EVT.evtq[EVT.oldJoyMove].where_y = EVT.joyPrev[1];
- EVT.evtq[EVT.oldJoyMove].relative_x = EVT.joyPrev[2];
- EVT.evtq[EVT.oldJoyMove].relative_y = EVT.joyPrev[3];
- }
- else if (EVT.count < EVENTQSIZE) {
- /* Add a new joystick movement event */
- EVT.oldJoyMove = EVT.freeHead;
- memset(&evt,0,sizeof(evt));
- evt.what = EVT_JOYMOVE;
- evt.message = EVT.joyButState;
- evt.where_x = EVT.joyPrev[0];
- evt.where_y = EVT.joyPrev[1];
- evt.relative_x = EVT.joyPrev[2];
- evt.relative_y = EVT.joyPrev[3];
- addEvent(&evt);
- }
- _EVT_restoreInt(ps);
- }
-
- /* Read the joystick buttons, and post events to reflect the change
- * in state for the joystick buttons.
- */
- if (newButState != EVT.joyButState) {
- if (EVT.count < EVENTQSIZE) {
- /* Add a new joystick movement event */
- ps = _EVT_disableInt();
- memset(&evt,0,sizeof(evt));
- evt.what = EVT_JOYCLICK;
- evt.message = newButState;
- EVT.evtq[EVT.oldJoyMove].where_x = EVT.joyPrev[0];
- EVT.evtq[EVT.oldJoyMove].where_y = EVT.joyPrev[1];
- EVT.evtq[EVT.oldJoyMove].relative_x = EVT.joyPrev[2];
- EVT.evtq[EVT.oldJoyMove].relative_y = EVT.joyPrev[3];
- addEvent(&evt);
- _EVT_restoreInt(ps);
- }
- EVT.joyButState = newButState;
- }
- }
+ /* Read joystick axes and post movement events if they have
+ * changed since the last time we polled. Until the events are
+ * actually flushed, we keep modifying the same joystick movement
+ * event, so you won't get multiple movement event
+ */
+ mask = _EVT_readJoyAxis(EVT.joyMask,axis);
+ newButState = _EVT_readJoyButtons();
+ moved = false;
+ for (i = 0; i < JOY_NUM_AXES; i++) {
+ if (mask & (EVT_JOY_AXIS_X1 << i))
+ axis[i] = scaleJoyAxis(axis[i],i);
+ else
+ axis[i] = EVT.joyPrev[i];
+ if (axis[i] != EVT.joyPrev[i])
+ moved = true;
+ }
+ if (moved) {
+ memcpy(EVT.joyPrev,axis,sizeof(EVT.joyPrev));
+ ps = _EVT_disableInt();
+ if (EVT.oldJoyMove != -1) {
+ /* Modify the existing joystick movement event */
+ EVT.evtq[EVT.oldJoyMove].message = newButState;
+ EVT.evtq[EVT.oldJoyMove].where_x = EVT.joyPrev[0];
+ EVT.evtq[EVT.oldJoyMove].where_y = EVT.joyPrev[1];
+ EVT.evtq[EVT.oldJoyMove].relative_x = EVT.joyPrev[2];
+ EVT.evtq[EVT.oldJoyMove].relative_y = EVT.joyPrev[3];
+ }
+ else if (EVT.count < EVENTQSIZE) {
+ /* Add a new joystick movement event */
+ EVT.oldJoyMove = EVT.freeHead;
+ memset(&evt,0,sizeof(evt));
+ evt.what = EVT_JOYMOVE;
+ evt.message = EVT.joyButState;
+ evt.where_x = EVT.joyPrev[0];
+ evt.where_y = EVT.joyPrev[1];
+ evt.relative_x = EVT.joyPrev[2];
+ evt.relative_y = EVT.joyPrev[3];
+ addEvent(&evt);
+ }
+ _EVT_restoreInt(ps);
+ }
+
+ /* Read the joystick buttons, and post events to reflect the change
+ * in state for the joystick buttons.
+ */
+ if (newButState != EVT.joyButState) {
+ if (EVT.count < EVENTQSIZE) {
+ /* Add a new joystick movement event */
+ ps = _EVT_disableInt();
+ memset(&evt,0,sizeof(evt));
+ evt.what = EVT_JOYCLICK;
+ evt.message = newButState;
+ EVT.evtq[EVT.oldJoyMove].where_x = EVT.joyPrev[0];
+ EVT.evtq[EVT.oldJoyMove].where_y = EVT.joyPrev[1];
+ EVT.evtq[EVT.oldJoyMove].relative_x = EVT.joyPrev[2];
+ EVT.evtq[EVT.oldJoyMove].relative_y = EVT.joyPrev[3];
+ addEvent(&evt);
+ _EVT_restoreInt(ps);
+ }
+ EVT.joyButState = newButState;
+ }
+ }
}
/****************************************************************************
@@ -815,287 +815,287 @@ static void _EVT_pumpMessages(void)
/* Poll keyboard events */
while (dataReady(_PM_console_fd) && (numkeys = read(_PM_console_fd, buf, KBDREADBUFFERSIZE)) > 0) {
- for (i = 0; i < numkeys; i++) {
- c = buf[i];
- release = c & 0x80;
- c &= 0x7F;
-
- // TODO: This is wrong! We need this to be the time stamp at
- // ** interrupt ** time!! One solution would be to
- // put the keyboard and mouse polling loops into
- // a separate thread that can block on I/O to the
- // necessay file descriptor.
- evt.when = _EVT_getTicks();
-
- if (release) {
- /* Key released */
- evt.what = EVT_KEYUP;
- switch (c) {
- case KB_leftShift:
- _PM_modifiers &= ~EVT_LEFTSHIFT;
- break;
- case KB_rightShift:
- _PM_modifiers &= ~EVT_RIGHTSHIFT;
- break;
- case 29:
- _PM_modifiers &= ~(EVT_LEFTCTRL|EVT_CTRLSTATE);
- break;
- case 97: /* Control */
- _PM_modifiers &= ~EVT_CTRLSTATE;
- break;
- case 56:
- _PM_modifiers &= ~(EVT_LEFTALT|EVT_ALTSTATE);
- break;
- case 100:
- _PM_modifiers &= ~EVT_ALTSTATE;
- break;
- default:
- }
- evt.modifiers = _PM_modifiers;
- evt.message = keyUpMsg[c];
- if (EVT.count < EVENTQSIZE)
- addEvent(&evt);
- keyUpMsg[c] = 0;
- repeatKey[c] = 0;
- }
- else {
- /* Key pressed */
- evt.what = EVT_KEYDOWN;
- switch (c) {
- case KB_leftShift:
- _PM_modifiers |= EVT_LEFTSHIFT;
- break;
- case KB_rightShift:
- _PM_modifiers |= EVT_RIGHTSHIFT;
- break;
- case 29:
- _PM_modifiers |= EVT_LEFTCTRL|EVT_CTRLSTATE;
- break;
- case 97: /* Control */
- _PM_modifiers |= EVT_CTRLSTATE;
- break;
- case 56:
- _PM_modifiers |= EVT_LEFTALT|EVT_ALTSTATE;
- break;
- case 100:
- _PM_modifiers |= EVT_ALTSTATE;
- break;
- case KB_capsLock: /* Caps Lock */
- _PM_leds ^= LED_CAP;
- ioctl(_PM_console_fd, KDSETLED, _PM_leds);
- break;
- case KB_numLock: /* Num Lock */
- _PM_leds ^= LED_NUM;
- ioctl(_PM_console_fd, KDSETLED, _PM_leds);
- break;
- case KB_scrollLock: /* Scroll Lock */
- _PM_leds ^= LED_SCR;
- ioctl(_PM_console_fd, KDSETLED, _PM_leds);
- break;
- default:
- }
- evt.modifiers = _PM_modifiers;
- if (keyUpMsg[c]) {
- evt.what = EVT_KEYREPEAT;
- evt.message = keyUpMsg[c] | (repeatKey[c]++ << 16);
- }
- else {
- int asc;
-
- evt.message = getKeyMapping(keymaps, NB_KEYMAPS, c) << 8;
- ke.kb_index = c;
- ke.kb_table = 0;
- if ((_PM_modifiers & EVT_SHIFTKEY) || (_PM_leds & LED_CAP))
- ke.kb_table |= K_SHIFTTAB;
- if (_PM_modifiers & (EVT_LEFTALT | EVT_ALTSTATE))
- ke.kb_table |= K_ALTTAB;
- if (ioctl(_PM_console_fd, KDGKBENT, (unsigned long)&ke)<0)
- perror("ioctl(KDGKBENT)");
- if ((_PM_leds & LED_NUM) && (getKeyMapping(keypad, NB_KEYPAD, c)!=c)) {
- asc = getKeyMapping(keypad, NB_KEYPAD, c);
- }
- else {
- switch (c) {
- case 14:
- asc = ASCII_backspace;
- break;
- case 15:
- asc = ASCII_tab;
- break;
- case 28:
- case 96:
- asc = ASCII_enter;
- break;
- case 1:
- asc = ASCII_esc;
- default:
- asc = ke.kb_value & 0xFF;
- if (asc < 0x1B)
- asc = 0;
- break;
- }
- }
- if ((_PM_modifiers & (EVT_CTRLSTATE|EVT_LEFTCTRL)) && isalpha(asc))
- evt.message |= toupper(asc) - 'A' + 1;
- else
- evt.message |= asc;
- keyUpMsg[c] = evt.message;
- repeatKey[c]++;
- }
- if (EVT.count < EVENTQSIZE)
- addEvent(&evt);
- }
- }
- }
+ for (i = 0; i < numkeys; i++) {
+ c = buf[i];
+ release = c & 0x80;
+ c &= 0x7F;
+
+ /* TODO: This is wrong! We need this to be the time stamp at */
+ /* ** interrupt ** time!! One solution would be to */
+ /* put the keyboard and mouse polling loops into */
+ /* a separate thread that can block on I/O to the */
+ /* necessay file descriptor. */
+ evt.when = _EVT_getTicks();
+
+ if (release) {
+ /* Key released */
+ evt.what = EVT_KEYUP;
+ switch (c) {
+ case KB_leftShift:
+ _PM_modifiers &= ~EVT_LEFTSHIFT;
+ break;
+ case KB_rightShift:
+ _PM_modifiers &= ~EVT_RIGHTSHIFT;
+ break;
+ case 29:
+ _PM_modifiers &= ~(EVT_LEFTCTRL|EVT_CTRLSTATE);
+ break;
+ case 97: /* Control */
+ _PM_modifiers &= ~EVT_CTRLSTATE;
+ break;
+ case 56:
+ _PM_modifiers &= ~(EVT_LEFTALT|EVT_ALTSTATE);
+ break;
+ case 100:
+ _PM_modifiers &= ~EVT_ALTSTATE;
+ break;
+ default:
+ }
+ evt.modifiers = _PM_modifiers;
+ evt.message = keyUpMsg[c];
+ if (EVT.count < EVENTQSIZE)
+ addEvent(&evt);
+ keyUpMsg[c] = 0;
+ repeatKey[c] = 0;
+ }
+ else {
+ /* Key pressed */
+ evt.what = EVT_KEYDOWN;
+ switch (c) {
+ case KB_leftShift:
+ _PM_modifiers |= EVT_LEFTSHIFT;
+ break;
+ case KB_rightShift:
+ _PM_modifiers |= EVT_RIGHTSHIFT;
+ break;
+ case 29:
+ _PM_modifiers |= EVT_LEFTCTRL|EVT_CTRLSTATE;
+ break;
+ case 97: /* Control */
+ _PM_modifiers |= EVT_CTRLSTATE;
+ break;
+ case 56:
+ _PM_modifiers |= EVT_LEFTALT|EVT_ALTSTATE;
+ break;
+ case 100:
+ _PM_modifiers |= EVT_ALTSTATE;
+ break;
+ case KB_capsLock: /* Caps Lock */
+ _PM_leds ^= LED_CAP;
+ ioctl(_PM_console_fd, KDSETLED, _PM_leds);
+ break;
+ case KB_numLock: /* Num Lock */
+ _PM_leds ^= LED_NUM;
+ ioctl(_PM_console_fd, KDSETLED, _PM_leds);
+ break;
+ case KB_scrollLock: /* Scroll Lock */
+ _PM_leds ^= LED_SCR;
+ ioctl(_PM_console_fd, KDSETLED, _PM_leds);
+ break;
+ default:
+ }
+ evt.modifiers = _PM_modifiers;
+ if (keyUpMsg[c]) {
+ evt.what = EVT_KEYREPEAT;
+ evt.message = keyUpMsg[c] | (repeatKey[c]++ << 16);
+ }
+ else {
+ int asc;
+
+ evt.message = getKeyMapping(keymaps, NB_KEYMAPS, c) << 8;
+ ke.kb_index = c;
+ ke.kb_table = 0;
+ if ((_PM_modifiers & EVT_SHIFTKEY) || (_PM_leds & LED_CAP))
+ ke.kb_table |= K_SHIFTTAB;
+ if (_PM_modifiers & (EVT_LEFTALT | EVT_ALTSTATE))
+ ke.kb_table |= K_ALTTAB;
+ if (ioctl(_PM_console_fd, KDGKBENT, (unsigned long)&ke)<0)
+ perror("ioctl(KDGKBENT)");
+ if ((_PM_leds & LED_NUM) && (getKeyMapping(keypad, NB_KEYPAD, c)!=c)) {
+ asc = getKeyMapping(keypad, NB_KEYPAD, c);
+ }
+ else {
+ switch (c) {
+ case 14:
+ asc = ASCII_backspace;
+ break;
+ case 15:
+ asc = ASCII_tab;
+ break;
+ case 28:
+ case 96:
+ asc = ASCII_enter;
+ break;
+ case 1:
+ asc = ASCII_esc;
+ default:
+ asc = ke.kb_value & 0xFF;
+ if (asc < 0x1B)
+ asc = 0;
+ break;
+ }
+ }
+ if ((_PM_modifiers & (EVT_CTRLSTATE|EVT_LEFTCTRL)) && isalpha(asc))
+ evt.message |= toupper(asc) - 'A' + 1;
+ else
+ evt.message |= asc;
+ keyUpMsg[c] = evt.message;
+ repeatKey[c]++;
+ }
+ if (EVT.count < EVENTQSIZE)
+ addEvent(&evt);
+ }
+ }
+ }
/* Poll mouse events */
if (_EVT_mouse_fd) {
- int dx, dy, buts;
- static int oldbuts;
-
- while (dataReady(_EVT_mouse_fd)) {
- if (readMouseData(&buts, &dx, &dy)) {
- EVT.mx += dx;
- EVT.my += dy;
- if (EVT.mx < 0) EVT.mx = 0;
- if (EVT.my < 0) EVT.my = 0;
- if (EVT.mx > range_x) EVT.mx = range_x;
- if (EVT.my > range_y) EVT.my = range_y;
- evt.where_x = EVT.mx;
- evt.where_y = EVT.my;
- evt.relative_x = dx;
- evt.relative_y = dy;
-
- // TODO: This is wrong! We need this to be the time stamp at
- // ** interrupt ** time!! One solution would be to
- // put the keyboard and mouse polling loops into
- // a separate thread that can block on I/O to the
- // necessay file descriptor.
- evt.when = _EVT_getTicks();
- evt.modifiers = _PM_modifiers;
- if (buts & 4)
- evt.modifiers |= EVT_LEFTBUT;
- if (buts & 1)
- evt.modifiers |= EVT_RIGHTBUT;
- if (buts & 2)
- evt.modifiers |= EVT_MIDDLEBUT;
-
- /* Left click events */
- if ((buts&4) != (oldbuts&4)) {
- if (buts&4)
- evt.what = EVT_MOUSEDOWN;
- else
- evt.what = EVT_MOUSEUP;
- evt.message = EVT_LEFTBMASK;
- EVT.oldMove = -1;
- if (EVT.count < EVENTQSIZE)
- addEvent(&evt);
- }
-
- /* Right click events */
- if ((buts&1) != (oldbuts&1)) {
- if (buts&1)
- evt.what = EVT_MOUSEDOWN;
- else
- evt.what = EVT_MOUSEUP;
- evt.message = EVT_RIGHTBMASK;
- EVT.oldMove = -1;
- if (EVT.count < EVENTQSIZE)
- addEvent(&evt);
- }
-
- /* Middle click events */
- if ((buts&2) != (oldbuts&2)) {
- if (buts&2)
- evt.what = EVT_MOUSEDOWN;
- else
- evt.what = EVT_MOUSEUP;
- evt.message = EVT_MIDDLEBMASK;
- EVT.oldMove = -1;
- if (EVT.count < EVENTQSIZE)
- addEvent(&evt);
- }
-
- /* Mouse movement event */
- if (dx || dy) {
- evt.what = EVT_MOUSEMOVE;
- evt.message = 0;
- if (EVT.oldMove != -1) {
- /* Modify existing movement event */
- EVT.evtq[EVT.oldMove].where_x = evt.where_x;
- EVT.evtq[EVT.oldMove].where_y = evt.where_y;
- }
- else {
- /* Save id of this movement event */
- EVT.oldMove = EVT.freeHead;
- if (EVT.count < EVENTQSIZE)
- addEvent(&evt);
- }
- }
- oldbuts = buts;
- }
- }
- }
+ int dx, dy, buts;
+ static int oldbuts;
+
+ while (dataReady(_EVT_mouse_fd)) {
+ if (readMouseData(&buts, &dx, &dy)) {
+ EVT.mx += dx;
+ EVT.my += dy;
+ if (EVT.mx < 0) EVT.mx = 0;
+ if (EVT.my < 0) EVT.my = 0;
+ if (EVT.mx > range_x) EVT.mx = range_x;
+ if (EVT.my > range_y) EVT.my = range_y;
+ evt.where_x = EVT.mx;
+ evt.where_y = EVT.my;
+ evt.relative_x = dx;
+ evt.relative_y = dy;
+
+ /* TODO: This is wrong! We need this to be the time stamp at */
+ /* ** interrupt ** time!! One solution would be to */
+ /* put the keyboard and mouse polling loops into */
+ /* a separate thread that can block on I/O to the */
+ /* necessay file descriptor. */
+ evt.when = _EVT_getTicks();
+ evt.modifiers = _PM_modifiers;
+ if (buts & 4)
+ evt.modifiers |= EVT_LEFTBUT;
+ if (buts & 1)
+ evt.modifiers |= EVT_RIGHTBUT;
+ if (buts & 2)
+ evt.modifiers |= EVT_MIDDLEBUT;
+
+ /* Left click events */
+ if ((buts&4) != (oldbuts&4)) {
+ if (buts&4)
+ evt.what = EVT_MOUSEDOWN;
+ else
+ evt.what = EVT_MOUSEUP;
+ evt.message = EVT_LEFTBMASK;
+ EVT.oldMove = -1;
+ if (EVT.count < EVENTQSIZE)
+ addEvent(&evt);
+ }
+
+ /* Right click events */
+ if ((buts&1) != (oldbuts&1)) {
+ if (buts&1)
+ evt.what = EVT_MOUSEDOWN;
+ else
+ evt.what = EVT_MOUSEUP;
+ evt.message = EVT_RIGHTBMASK;
+ EVT.oldMove = -1;
+ if (EVT.count < EVENTQSIZE)
+ addEvent(&evt);
+ }
+
+ /* Middle click events */
+ if ((buts&2) != (oldbuts&2)) {
+ if (buts&2)
+ evt.what = EVT_MOUSEDOWN;
+ else
+ evt.what = EVT_MOUSEUP;
+ evt.message = EVT_MIDDLEBMASK;
+ EVT.oldMove = -1;
+ if (EVT.count < EVENTQSIZE)
+ addEvent(&evt);
+ }
+
+ /* Mouse movement event */
+ if (dx || dy) {
+ evt.what = EVT_MOUSEMOVE;
+ evt.message = 0;
+ if (EVT.oldMove != -1) {
+ /* Modify existing movement event */
+ EVT.evtq[EVT.oldMove].where_x = evt.where_x;
+ EVT.evtq[EVT.oldMove].where_y = evt.where_y;
+ }
+ else {
+ /* Save id of this movement event */
+ EVT.oldMove = EVT.freeHead;
+ if (EVT.count < EVENTQSIZE)
+ addEvent(&evt);
+ }
+ }
+ oldbuts = buts;
+ }
+ }
+ }
#ifdef USE_OS_JOYSTICK
- // Poll joystick events using the 1.x joystick driver API in the 2.2 kernels
+ /* Poll joystick events using the 1.x joystick driver API in the 2.2 kernels */
if (js_version & ~0xffff) {
- static struct js_event js;
-
- /* Read joystick axis 0 */
- evt.when = 0;
- evt.modifiers = _PM_modifiers;
- if (joystick0_fd && dataReady(joystick0_fd) &&
- read(joystick0_fd, &js, sizeof(js)) == sizeof(js)) {
- if (js.type & JS_EVENT_BUTTON) {
- if (js.number < 2) { /* Only 2 buttons for now :( */
- buts0[js.number] = js.value;
- evt.what = EVT_JOYCLICK;
- makeJoyEvent(&evt);
- if (EVT.count < EVENTQSIZE)
- addEvent(&evt);
- }
- }
- else if (js.type & JS_EVENT_AXIS) {
- axis0[js.number] = scaleJoyAxis(js.value,js.number);
- evt.what = EVT_JOYMOVE;
- if (EVT.oldJoyMove != -1) {
- makeJoyEvent(&EVT.evtq[EVT.oldJoyMove]);
- }
- else if (EVT.count < EVENTQSIZE) {
- EVT.oldJoyMove = EVT.freeHead;
- makeJoyEvent(&evt);
- addEvent(&evt);
- }
- }
- }
-
- /* Read joystick axis 1 */
- if (joystick1_fd && dataReady(joystick1_fd) &&
- read(joystick1_fd, &js, sizeof(js))==sizeof(js)) {
- if (js.type & JS_EVENT_BUTTON) {
- if (js.number < 2) { /* Only 2 buttons for now :( */
- buts1[js.number] = js.value;
- evt.what = EVT_JOYCLICK;
- makeJoyEvent(&evt);
- if (EVT.count < EVENTQSIZE)
- addEvent(&evt);
- }
- }
- else if (js.type & JS_EVENT_AXIS) {
- axis1[js.number] = scaleJoyAxis(js.value,js.number<<2);
- evt.what = EVT_JOYMOVE;
- if (EVT.oldJoyMove != -1) {
- makeJoyEvent(&EVT.evtq[EVT.oldJoyMove]);
- }
- else if (EVT.count < EVENTQSIZE) {
- EVT.oldJoyMove = EVT.freeHead;
- makeJoyEvent(&evt);
- addEvent(&evt);
- }
- }
- }
- }
+ static struct js_event js;
+
+ /* Read joystick axis 0 */
+ evt.when = 0;
+ evt.modifiers = _PM_modifiers;
+ if (joystick0_fd && dataReady(joystick0_fd) &&
+ read(joystick0_fd, &js, sizeof(js)) == sizeof(js)) {
+ if (js.type & JS_EVENT_BUTTON) {
+ if (js.number < 2) { /* Only 2 buttons for now :( */
+ buts0[js.number] = js.value;
+ evt.what = EVT_JOYCLICK;
+ makeJoyEvent(&evt);
+ if (EVT.count < EVENTQSIZE)
+ addEvent(&evt);
+ }
+ }
+ else if (js.type & JS_EVENT_AXIS) {
+ axis0[js.number] = scaleJoyAxis(js.value,js.number);
+ evt.what = EVT_JOYMOVE;
+ if (EVT.oldJoyMove != -1) {
+ makeJoyEvent(&EVT.evtq[EVT.oldJoyMove]);
+ }
+ else if (EVT.count < EVENTQSIZE) {
+ EVT.oldJoyMove = EVT.freeHead;
+ makeJoyEvent(&evt);
+ addEvent(&evt);
+ }
+ }
+ }
+
+ /* Read joystick axis 1 */
+ if (joystick1_fd && dataReady(joystick1_fd) &&
+ read(joystick1_fd, &js, sizeof(js))==sizeof(js)) {
+ if (js.type & JS_EVENT_BUTTON) {
+ if (js.number < 2) { /* Only 2 buttons for now :( */
+ buts1[js.number] = js.value;
+ evt.what = EVT_JOYCLICK;
+ makeJoyEvent(&evt);
+ if (EVT.count < EVENTQSIZE)
+ addEvent(&evt);
+ }
+ }
+ else if (js.type & JS_EVENT_AXIS) {
+ axis1[js.number] = scaleJoyAxis(js.value,js.number<<2);
+ evt.what = EVT_JOYMOVE;
+ if (EVT.oldJoyMove != -1) {
+ makeJoyEvent(&EVT.evtq[EVT.oldJoyMove]);
+ }
+ else if (EVT.count < EVENTQSIZE) {
+ EVT.oldJoyMove = EVT.freeHead;
+ makeJoyEvent(&evt);
+ addEvent(&evt);
+ }
+ }
+ }
+ }
#endif
}
@@ -1122,7 +1122,7 @@ static int setspeed(
{
struct termios tty;
char *c;
-
+
tcgetattr(fd, &tty);
tty.c_iflag = IGNBRK | IGNPAR;
tty.c_oflag = 0;
@@ -1131,20 +1131,20 @@ static int setspeed(
tty.c_cc[VTIME] = 0;
tty.c_cc[VMIN] = 1;
switch (old) {
- case 9600: tty.c_cflag = flags | B9600; break;
- case 4800: tty.c_cflag = flags | B4800; break;
- case 2400: tty.c_cflag = flags | B2400; break;
- case 1200:
- default: tty.c_cflag = flags | B1200; break;
- }
+ case 9600: tty.c_cflag = flags | B9600; break;
+ case 4800: tty.c_cflag = flags | B4800; break;
+ case 2400: tty.c_cflag = flags | B2400; break;
+ case 1200:
+ default: tty.c_cflag = flags | B1200; break;
+ }
tcsetattr(fd, TCSAFLUSH, &tty);
switch (new) {
- case 9600: c = "*q"; tty.c_cflag = flags | B9600; break;
- case 4800: c = "*p"; tty.c_cflag = flags | B4800; break;
- case 2400: c = "*o"; tty.c_cflag = flags | B2400; break;
- case 1200:
- default: c = "*n"; tty.c_cflag = flags | B1200; break;
- }
+ case 9600: c = "*q"; tty.c_cflag = flags | B9600; break;
+ case 4800: c = "*p"; tty.c_cflag = flags | B4800; break;
+ case 2400: c = "*o"; tty.c_cflag = flags | B2400; break;
+ case 1200:
+ default: c = "*n"; tty.c_cflag = flags | B1200; break;
+ }
write(fd, c, 2);
usleep(100000);
tcsetattr(fd, TCSAFLUSH, &tty);
@@ -1161,7 +1161,7 @@ static void _EVT_mouse_init(void)
/* Change from any available speed to the chosen one */
for (i = 9600; i >= 1200; i /= 2)
- setspeed(_EVT_mouse_fd, i, opt_baud, mouse_infos[mouse_driver].flags);
+ setspeed(_EVT_mouse_fd, i, opt_baud, mouse_infos[mouse_driver].flags);
}
/****************************************************************************
@@ -1173,29 +1173,29 @@ static void _EVT_logitech_init(void)
int i;
struct stat buf;
int busmouse;
-
+
/* is this a serial- or a bus- mouse? */
if (fstat(_EVT_mouse_fd,&buf) == -1)
- perror("fstat");
+ perror("fstat");
i = MAJOR(buf.st_rdev);
if (stat("/dev/ttyS0",&buf) == -1)
- perror("stat");
+ perror("stat");
busmouse=(i != MAJOR(buf.st_rdev));
-
+
/* Fix the howmany field, so that serial mice have 1, while busmice have 3 */
mouse_infos[mouse_driver].read = busmouse ? 3 : 1;
-
+
/* Change from any available speed to the chosen one */
for (i = 9600; i >= 1200; i /= 2)
- setspeed(_EVT_mouse_fd, i, opt_baud, mouse_infos[mouse_driver].flags);
-
+ setspeed(_EVT_mouse_fd, i, opt_baud, mouse_infos[mouse_driver].flags);
+
/* This stuff is peculiar of logitech mice, also for the serial ones */
write(_EVT_mouse_fd, "S", 1);
setspeed(_EVT_mouse_fd, opt_baud, opt_baud,CS8 |PARENB |PARODD |CREAD |CLOCAL |HUPCL);
-
+
/* Configure the sample rate */
for (i = 0; opt_sample <= sampletab[i].sample; i++)
- ;
+ ;
write(_EVT_mouse_fd,sampletab[i].code,1);
}
@@ -1206,7 +1206,7 @@ Microsoft Intellimouse init code
static void _EVT_pnpmouse_init(void)
{
struct termios tty;
-
+
tcgetattr(_EVT_mouse_fd, &tty);
tty.c_iflag = IGNBRK | IGNPAR;
tty.c_oflag = 0;
@@ -1240,53 +1240,53 @@ void EVTAPI EVT_init(
EVT.mouseMove = mouseMove;
initEventQueue();
for (i = 0; i < 256; i++)
- keyUpMsg[i] = 0;
+ keyUpMsg[i] = 0;
/* Keyboard initialization */
if (_PM_console_fd == -1)
- PM_fatalError("You must first call PM_openConsole to use the EVT functions!");
+ PM_fatalError("You must first call PM_openConsole to use the EVT functions!");
_PM_keyboard_rawmode();
fcntl(_PM_console_fd,F_SETFL,fcntl(_PM_console_fd,F_GETFL) | O_NONBLOCK);
/* Mouse initialization */
if ((tmp = getenv(ENV_MOUSEDRV)) != NULL) {
- for (i = 0; i < NB_MICE; i++) {
- if (!strcasecmp(tmp, mouse_infos[i].name)) {
- mouse_driver = i;
- break;
- }
- }
- if (i == NB_MICE) {
- fprintf(stderr,"Unknown mouse driver: %s\n", tmp);
- mouse_driver = EVT_noMouse;
- _EVT_mouse_fd = 0;
- }
- }
+ for (i = 0; i < NB_MICE; i++) {
+ if (!strcasecmp(tmp, mouse_infos[i].name)) {
+ mouse_driver = i;
+ break;
+ }
+ }
+ if (i == NB_MICE) {
+ fprintf(stderr,"Unknown mouse driver: %s\n", tmp);
+ mouse_driver = EVT_noMouse;
+ _EVT_mouse_fd = 0;
+ }
+ }
if (mouse_driver != EVT_noMouse) {
- if (mouse_driver == EVT_gpm)
- strcpy(mouse_dev,"/dev/gpmdata");
- if ((tmp = getenv(ENV_MOUSEDEV)) != NULL)
- strcpy(mouse_dev,tmp);
+ if (mouse_driver == EVT_gpm)
+ strcpy(mouse_dev,"/dev/gpmdata");
+ if ((tmp = getenv(ENV_MOUSEDEV)) != NULL)
+ strcpy(mouse_dev,tmp);
#ifdef CHECKED
- fprintf(stderr,"Using the %s MGL mouse driver on %s.\n", mouse_infos[mouse_driver].name, mouse_dev);
+ fprintf(stderr,"Using the %s MGL mouse driver on %s.\n", mouse_infos[mouse_driver].name, mouse_dev);
#endif
- if ((_EVT_mouse_fd = open(mouse_dev, O_RDWR)) < 0) {
- perror("open");
- fprintf(stderr, "Unable to open mouse device %s, dropping mouse support.\n", mouse_dev);
- sleep(1);
- mouse_driver = EVT_noMouse;
- _EVT_mouse_fd = 0;
- }
- else {
- char c;
-
- /* Init and flush the mouse pending input queue */
- if (mouse_infos[mouse_driver].init)
- mouse_infos[mouse_driver].init();
- while(dataReady(_EVT_mouse_fd) && read(_EVT_mouse_fd, &c, 1) == 1)
- ;
- }
- }
+ if ((_EVT_mouse_fd = open(mouse_dev, O_RDWR)) < 0) {
+ perror("open");
+ fprintf(stderr, "Unable to open mouse device %s, dropping mouse support.\n", mouse_dev);
+ sleep(1);
+ mouse_driver = EVT_noMouse;
+ _EVT_mouse_fd = 0;
+ }
+ else {
+ char c;
+
+ /* Init and flush the mouse pending input queue */
+ if (mouse_infos[mouse_driver].init)
+ mouse_infos[mouse_driver].init();
+ while(dataReady(_EVT_mouse_fd) && read(_EVT_mouse_fd, &c, 1) == 1)
+ ;
+ }
+ }
}
/****************************************************************************
@@ -1318,7 +1318,7 @@ and this function can be used to resume it again later.
****************************************************************************/
void EVT_resume(void)
{
- // Do nothing for Linux
+ /* Do nothing for Linux */
}
/****************************************************************************
@@ -1328,7 +1328,7 @@ de-install the event handling code.
****************************************************************************/
void EVT_suspend(void)
{
- // Do nothing for Linux
+ /* Do nothing for Linux */
}
/****************************************************************************
@@ -1340,22 +1340,21 @@ void EVT_exit(void)
/* Restore signal handlers */
_PM_restore_kb_mode();
if (_EVT_mouse_fd) {
- close(_EVT_mouse_fd);
- _EVT_mouse_fd = 0;
- }
+ close(_EVT_mouse_fd);
+ _EVT_mouse_fd = 0;
+ }
#ifdef USE_OS_JOYSTICK
if (joystick0_fd) {
- close(joystick0_fd);
- free(axis0);
- free(buts0);
- joystick0_fd = 0;
- }
+ close(joystick0_fd);
+ free(axis0);
+ free(buts0);
+ joystick0_fd = 0;
+ }
if (joystick1_fd) {
- close(joystick1_fd);
- free(axis1);
- free(buts1);
- joystick1_fd = 0;
- }
+ close(joystick1_fd);
+ free(axis1);
+ free(buts1);
+ joystick1_fd = 0;
+ }
#endif
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/linux/oshdr.h b/board/MAI/bios_emulator/scitech/src/pm/linux/oshdr.h
index 6023dff109..eadedfb137 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/linux/oshdr.h
+++ b/board/MAI/bios_emulator/scitech/src/pm/linux/oshdr.h
@@ -58,4 +58,3 @@ void _PM_keyboard_rawmode(void);
/* Linux needs the generic joystick scaling code */
#define NEED_SCALE_JOY_AXIS
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/linux/pm.c b/board/MAI/bios_emulator/scitech/src/pm/linux/pm.c
index 1d52984a6a..c12a83500a 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/linux/pm.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/linux/pm.c
@@ -148,7 +148,7 @@ static inline void port_out(int value, int port)
printk("%04X:%04X: outb.%04X <- %02X\n", traceAddr >> 16, traceAddr & 0xFFFF, (ushort)port, (uchar)value);
#endif
asm volatile ("outb %0,%1"
- ::"a" ((unsigned char) value), "d"((unsigned short) port));
+ ::"a" ((unsigned char) value), "d"((unsigned short) port));
}
static inline void port_outw(int value, int port)
@@ -157,7 +157,7 @@ static inline void port_outw(int value, int port)
printk("%04X:%04X: outw.%04X <- %04X\n", traceAddr >> 16,traceAddr & 0xFFFF, (ushort)port, (ushort)value);
#endif
asm volatile ("outw %0,%1"
- ::"a" ((unsigned short) value), "d"((unsigned short) port));
+ ::"a" ((unsigned short) value), "d"((unsigned short) port));
}
static inline void port_outl(int value, int port)
@@ -166,15 +166,15 @@ static inline void port_outl(int value, int port)
printk("%04X:%04X: outl.%04X <- %08X\n", traceAddr >> 16,traceAddr & 0xFFFF, (ushort)port, (ulong)value);
#endif
asm volatile ("outl %0,%1"
- ::"a" ((unsigned long) value), "d"((unsigned short) port));
+ ::"a" ((unsigned long) value), "d"((unsigned short) port));
}
static inline unsigned int port_in(int port)
{
unsigned char value;
asm volatile ("inb %1,%0"
- :"=a" ((unsigned char)value)
- :"d"((unsigned short) port));
+ :"=a" ((unsigned char)value)
+ :"d"((unsigned short) port));
#ifdef TRACE_IO
printk("%04X:%04X: inb.%04X -> %02X\n", traceAddr >> 16,traceAddr & 0xFFFF, (ushort)port, (uchar)value);
#endif
@@ -185,8 +185,8 @@ static inline unsigned int port_inw(int port)
{
unsigned short value;
asm volatile ("inw %1,%0"
- :"=a" ((unsigned short)value)
- :"d"((unsigned short) port));
+ :"=a" ((unsigned short)value)
+ :"d"((unsigned short) port));
#ifdef TRACE_IO
printk("%04X:%04X: inw.%04X -> %04X\n", traceAddr >> 16,traceAddr & 0xFFFF, (ushort)port, (ushort)value);
#endif
@@ -197,8 +197,8 @@ static inline unsigned int port_inl(int port)
{
unsigned long value;
asm volatile ("inl %1,%0"
- :"=a" ((unsigned long)value)
- :"d"((unsigned short) port));
+ :"=a" ((unsigned long)value)
+ :"d"((unsigned short) port));
#ifdef TRACE_IO
printk("%04X:%04X: inl.%04X -> %08X\n", traceAddr >> 16,traceAddr & 0xFFFF, (ushort)port, (ulong)value);
#endif
@@ -211,16 +211,16 @@ static int real_mem_init(void)
int fd_zero;
if (mem_info.ready)
- return 1;
+ return 1;
if ((fd_zero = open("/dev/zero", O_RDONLY)) == -1)
- PM_fatalError("You must have root privledges to run this program!");
+ PM_fatalError("You must have root privledges to run this program!");
if ((m = mmap((void *)REAL_MEM_BASE, REAL_MEM_SIZE,
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_FIXED | MAP_PRIVATE, fd_zero, 0)) == (void *)-1) {
- close(fd_zero);
- PM_fatalError("You must have root privledges to run this program!");
- }
+ PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_FIXED | MAP_PRIVATE, fd_zero, 0)) == (void *)-1) {
+ close(fd_zero);
+ PM_fatalError("You must have root privledges to run this program!");
+ }
mem_info.ready = 1;
mem_info.count = 1;
mem_info.blocks[0].size = REAL_MEM_SIZE;
@@ -231,9 +231,9 @@ static int real_mem_init(void)
static void insert_block(int i)
{
memmove(
- mem_info.blocks + i + 1,
- mem_info.blocks + i,
- (mem_info.count - i) * sizeof(struct mem_block));
+ mem_info.blocks + i + 1,
+ mem_info.blocks + i,
+ (mem_info.count - i) * sizeof(struct mem_block));
mem_info.count++;
}
@@ -242,9 +242,9 @@ static void delete_block(int i)
mem_info.count--;
memmove(
- mem_info.blocks + i,
- mem_info.blocks + i + 1,
- (mem_info.count - i) * sizeof(struct mem_block));
+ mem_info.blocks + i,
+ mem_info.blocks + i + 1,
+ (mem_info.count - i) * sizeof(struct mem_block));
}
static inline void set_bit(unsigned int bit, void *array)
@@ -279,35 +279,35 @@ void PMAPI PM_init(void)
uint r_seg,r_off;
if (inited)
- return;
+ return;
/* Map the Interrupt Vectors (0x0 - 0x400) + BIOS data (0x400 - 0x502)
* and the physical framebuffer and ROM images from (0xa0000 - 0x100000)
*/
real_mem_init();
if (!fd_mem && (fd_mem = open("/dev/mem", O_RDWR)) == -1) {
- PM_fatalError("You must have root privileges to run this program!");
- }
+ PM_fatalError("You must have root privileges to run this program!");
+ }
if ((m = mmap((void *)0, 0x502,
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_FIXED | MAP_PRIVATE, fd_mem, 0)) == (void *)-1) {
- PM_fatalError("You must have root privileges to run this program!");
- }
+ PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_FIXED | MAP_PRIVATE, fd_mem, 0)) == (void *)-1) {
+ PM_fatalError("You must have root privileges to run this program!");
+ }
if ((m = mmap((void *)0xA0000, 0xC0000 - 0xA0000,
- PROT_READ | PROT_WRITE,
- MAP_FIXED | MAP_SHARED, fd_mem, 0xA0000)) == (void *)-1) {
- PM_fatalError("You must have root privileges to run this program!");
- }
+ PROT_READ | PROT_WRITE,
+ MAP_FIXED | MAP_SHARED, fd_mem, 0xA0000)) == (void *)-1) {
+ PM_fatalError("You must have root privileges to run this program!");
+ }
if ((m = mmap((void *)0xC0000, 0xD0000 - 0xC0000,
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_FIXED | MAP_PRIVATE, fd_mem, 0xC0000)) == (void *)-1) {
- PM_fatalError("You must have root privileges to run this program!");
- }
+ PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_FIXED | MAP_PRIVATE, fd_mem, 0xC0000)) == (void *)-1) {
+ PM_fatalError("You must have root privileges to run this program!");
+ }
if ((m = mmap((void *)0xD0000, 0x100000 - 0xD0000,
- PROT_READ | PROT_WRITE,
- MAP_FIXED | MAP_SHARED, fd_mem, 0xD0000)) == (void *)-1) {
- PM_fatalError("You must have root privileges to run this program!");
- }
+ PROT_READ | PROT_WRITE,
+ MAP_FIXED | MAP_SHARED, fd_mem, 0xD0000)) == (void *)-1) {
+ PM_fatalError("You must have root privileges to run this program!");
+ }
inited = 1;
/* Allocate a stack */
@@ -356,9 +356,9 @@ void PMAPI PM_backslash(char *s)
{
uint pos = strlen(s);
if (s[pos-1] != '/') {
- s[pos] = '/';
- s[pos+1] = '\0';
- }
+ s[pos] = '/';
+ s[pos+1] = '\0';
+ }
}
void PMAPI PM_setFatalErrorCleanup(
@@ -370,7 +370,7 @@ void PMAPI PM_setFatalErrorCleanup(
void PMAPI PM_fatalError(const char *msg)
{
if (fatalErrorCleanup)
- fatalErrorCleanup();
+ fatalErrorCleanup();
fprintf(stderr,"%s\n", msg);
fflush(stderr);
exit(1);
@@ -379,18 +379,18 @@ void PMAPI PM_fatalError(const char *msg)
static void ExitVBEBuf(void)
{
if (VESABuf_ptr)
- PM_freeRealSeg(VESABuf_ptr);
+ PM_freeRealSeg(VESABuf_ptr);
VESABuf_ptr = 0;
}
void * PMAPI PM_getVESABuf(uint *len,uint *rseg,uint *roff)
{
if (!VESABuf_ptr) {
- /* Allocate a global buffer for communicating with the VESA VBE */
- if ((VESABuf_ptr = PM_allocRealSeg(VESABuf_len, &VESABuf_rseg, &VESABuf_roff)) == NULL)
- return NULL;
- atexit(ExitVBEBuf);
- }
+ /* Allocate a global buffer for communicating with the VESA VBE */
+ if ((VESABuf_ptr = PM_allocRealSeg(VESABuf_len, &VESABuf_rseg, &VESABuf_roff)) == NULL)
+ return NULL;
+ atexit(ExitVBEBuf);
+ }
*len = VESABuf_len;
*rseg = VESABuf_rseg;
*roff = VESABuf_roff;
@@ -431,7 +431,7 @@ static FILE *open_kb_mode(
char *path)
{
if (!PM_findBPD("graphics.bpd",path))
- return NULL;
+ return NULL;
PM_backslash(path);
strcat(path,KBMODE_DAT);
return fopen(path,mode);
@@ -448,18 +448,18 @@ void _PM_restore_kb_mode(void)
char path[PM_MAX_PATH];
if (_PM_console_fd != -1 && (kbmode = open_kb_mode("rb",path)) != NULL) {
- if (fread(&mode,1,sizeof(mode),kbmode) == sizeof(mode)) {
- if (mode.startup_vc > 0)
- ioctl(_PM_console_fd, VT_ACTIVATE, mode.startup_vc);
- ioctl(_PM_console_fd, KDSKBMODE, mode.kb_mode);
- ioctl(_PM_console_fd, KDSETLED, mode.leds);
- tcsetattr(_PM_console_fd, TCSAFLUSH, &mode.termios);
- fcntl(_PM_console_fd,F_SETFL,mode.flags);
- }
- fclose(kbmode);
- unlink(path);
- in_raw_mode = false;
- }
+ if (fread(&mode,1,sizeof(mode),kbmode) == sizeof(mode)) {
+ if (mode.startup_vc > 0)
+ ioctl(_PM_console_fd, VT_ACTIVATE, mode.startup_vc);
+ ioctl(_PM_console_fd, KDSKBMODE, mode.kb_mode);
+ ioctl(_PM_console_fd, KDSETLED, mode.leds);
+ tcsetattr(_PM_console_fd, TCSAFLUSH, &mode.termios);
+ fcntl(_PM_console_fd,F_SETFL,mode.flags);
+ }
+ fclose(kbmode);
+ unlink(path);
+ in_raw_mode = false;
+ }
}
/****************************************************************************
@@ -488,49 +488,49 @@ void _PM_keyboard_rawmode(void)
char path[PM_MAX_PATH];
int i;
static int sig_list[] = {
- SIGHUP,
- SIGINT,
- SIGQUIT,
- SIGILL,
- SIGTRAP,
- SIGABRT,
- SIGIOT,
- SIGBUS,
- SIGFPE,
- SIGKILL,
- SIGSEGV,
- SIGTERM,
- };
+ SIGHUP,
+ SIGINT,
+ SIGQUIT,
+ SIGILL,
+ SIGTRAP,
+ SIGABRT,
+ SIGIOT,
+ SIGBUS,
+ SIGFPE,
+ SIGKILL,
+ SIGSEGV,
+ SIGTERM,
+ };
if ((kbmode = open_kb_mode("rb",path)) == NULL) {
- if ((kbmode = open_kb_mode("wb",path)) == NULL)
- PM_fatalError("Unable to open kbmode.dat file for writing!");
- if (ioctl(_PM_console_fd, KDGKBMODE, &mode.kb_mode))
- perror("KDGKBMODE");
- ioctl(_PM_console_fd, KDGETLED, &mode.leds);
- _PM_leds = mode.leds & 0xF;
- _PM_modifiers = 0;
- tcgetattr(_PM_console_fd, &mode.termios);
- conf = mode.termios;
- conf.c_lflag &= ~(ICANON | ECHO | ISIG);
- conf.c_iflag &= ~(ISTRIP | IGNCR | ICRNL | INLCR | BRKINT | PARMRK | INPCK | IUCLC | IXON | IXOFF);
- conf.c_iflag |= (IGNBRK | IGNPAR);
- conf.c_cc[VMIN] = 1;
- conf.c_cc[VTIME] = 0;
- conf.c_cc[VSUSP] = 0;
- tcsetattr(_PM_console_fd, TCSAFLUSH, &conf);
- mode.flags = fcntl(_PM_console_fd,F_GETFL);
- if (ioctl(_PM_console_fd, KDSKBMODE, K_MEDIUMRAW))
- perror("KDSKBMODE");
- atexit(_PM_restore_kb_mode);
- for (i = 0; i < sizeof(sig_list)/sizeof(sig_list[0]); i++)
- signal(sig_list[i], _PM_abort);
- mode.startup_vc = startup_vc;
- if (fwrite(&mode,1,sizeof(mode),kbmode) != sizeof(mode))
- PM_fatalError("Error writing kbmode.dat!");
- fclose(kbmode);
- in_raw_mode = true;
- }
+ if ((kbmode = open_kb_mode("wb",path)) == NULL)
+ PM_fatalError("Unable to open kbmode.dat file for writing!");
+ if (ioctl(_PM_console_fd, KDGKBMODE, &mode.kb_mode))
+ perror("KDGKBMODE");
+ ioctl(_PM_console_fd, KDGETLED, &mode.leds);
+ _PM_leds = mode.leds & 0xF;
+ _PM_modifiers = 0;
+ tcgetattr(_PM_console_fd, &mode.termios);
+ conf = mode.termios;
+ conf.c_lflag &= ~(ICANON | ECHO | ISIG);
+ conf.c_iflag &= ~(ISTRIP | IGNCR | ICRNL | INLCR | BRKINT | PARMRK | INPCK | IUCLC | IXON | IXOFF);
+ conf.c_iflag |= (IGNBRK | IGNPAR);
+ conf.c_cc[VMIN] = 1;
+ conf.c_cc[VTIME] = 0;
+ conf.c_cc[VSUSP] = 0;
+ tcsetattr(_PM_console_fd, TCSAFLUSH, &conf);
+ mode.flags = fcntl(_PM_console_fd,F_GETFL);
+ if (ioctl(_PM_console_fd, KDSKBMODE, K_MEDIUMRAW))
+ perror("KDSKBMODE");
+ atexit(_PM_restore_kb_mode);
+ for (i = 0; i < sizeof(sig_list)/sizeof(sig_list[0]); i++)
+ signal(sig_list[i], _PM_abort);
+ mode.startup_vc = startup_vc;
+ if (fwrite(&mode,1,sizeof(mode),kbmode) != sizeof(mode))
+ PM_fatalError("Error writing kbmode.dat!");
+ fclose(kbmode);
+ in_raw_mode = true;
+ }
}
int PMAPI PM_kbhit(void)
@@ -539,9 +539,9 @@ int PMAPI PM_kbhit(void)
struct timeval tv = { 0, 0 };
if (console_count == 0)
- PM_fatalError("You *must* open a console before using PM_kbhit!");
+ PM_fatalError("You *must* open a console before using PM_kbhit!");
if (!in_raw_mode)
- _PM_keyboard_rawmode();
+ _PM_keyboard_rawmode();
FD_ZERO(&s);
FD_SET(_PM_console_fd, &s);
return select(_PM_console_fd+1, &s, NULL, NULL, &tv) > 0;
@@ -554,62 +554,62 @@ int PMAPI PM_getch(void)
static struct kbentry ke;
if (console_count == 0)
- PM_fatalError("You *must* open a console before using PM_getch!");
+ PM_fatalError("You *must* open a console before using PM_getch!");
if (!in_raw_mode)
- _PM_keyboard_rawmode();
+ _PM_keyboard_rawmode();
while (read(_PM_console_fd, &c, 1) > 0) {
- release = c & 0x80;
- c &= 0x7F;
- if (release) {
- switch(c){
- case 42: case 54: // Shift
- _PM_modifiers &= ~KB_SHIFT;
- break;
- case 29: case 97: // Control
- _PM_modifiers &= ~KB_CONTROL;
- break;
- case 56: case 100: // Alt / AltGr
- _PM_modifiers &= ~KB_ALT;
- break;
- }
- continue;
- }
- switch (c) {
- case 42: case 54: // Shift
- _PM_modifiers |= KB_SHIFT;
- break;
- case 29: case 97: // Control
- _PM_modifiers |= KB_CONTROL;
- break;
- case 56: case 100: // Alt / AltGr
- _PM_modifiers |= KB_ALT;
- break;
- case 58: // Caps Lock
- _PM_modifiers ^= KB_CAPS;
- ioctl(_PM_console_fd, KDSETLED, _PM_modifiers & 7);
- break;
- case 69: // Num Lock
- _PM_modifiers ^= KB_NUMLOCK;
- ioctl(_PM_console_fd, KDSETLED, _PM_modifiers & 7);
- break;
- case 70: // Scroll Lock
- _PM_modifiers ^= KB_SCROLL;
- ioctl(_PM_console_fd, KDSETLED, _PM_modifiers & 7);
- break;
- case 28:
- return 0x1C;
- default:
- ke.kb_index = c;
- ke.kb_table = 0;
- if ((_PM_modifiers & KB_SHIFT) || (_PM_modifiers & KB_CAPS))
- ke.kb_table |= K_SHIFTTAB;
- if (_PM_modifiers & KB_ALT)
- ke.kb_table |= K_ALTTAB;
- ioctl(_PM_console_fd, KDGKBENT, (ulong)&ke);
- c = ke.kb_value & 0xFF;
- return c;
- }
- }
+ release = c & 0x80;
+ c &= 0x7F;
+ if (release) {
+ switch(c){
+ case 42: case 54: /* Shift */
+ _PM_modifiers &= ~KB_SHIFT;
+ break;
+ case 29: case 97: /* Control */
+ _PM_modifiers &= ~KB_CONTROL;
+ break;
+ case 56: case 100: /* Alt / AltGr */
+ _PM_modifiers &= ~KB_ALT;
+ break;
+ }
+ continue;
+ }
+ switch (c) {
+ case 42: case 54: /* Shift */
+ _PM_modifiers |= KB_SHIFT;
+ break;
+ case 29: case 97: /* Control */
+ _PM_modifiers |= KB_CONTROL;
+ break;
+ case 56: case 100: /* Alt / AltGr */
+ _PM_modifiers |= KB_ALT;
+ break;
+ case 58: /* Caps Lock */
+ _PM_modifiers ^= KB_CAPS;
+ ioctl(_PM_console_fd, KDSETLED, _PM_modifiers & 7);
+ break;
+ case 69: /* Num Lock */
+ _PM_modifiers ^= KB_NUMLOCK;
+ ioctl(_PM_console_fd, KDSETLED, _PM_modifiers & 7);
+ break;
+ case 70: /* Scroll Lock */
+ _PM_modifiers ^= KB_SCROLL;
+ ioctl(_PM_console_fd, KDSETLED, _PM_modifiers & 7);
+ break;
+ case 28:
+ return 0x1C;
+ default:
+ ke.kb_index = c;
+ ke.kb_table = 0;
+ if ((_PM_modifiers & KB_SHIFT) || (_PM_modifiers & KB_CAPS))
+ ke.kb_table |= K_SHIFTTAB;
+ if (_PM_modifiers & KB_ALT)
+ ke.kb_table |= K_ALTTAB;
+ ioctl(_PM_console_fd, KDGKBENT, (ulong)&ke);
+ c = ke.kb_value & 0xFF;
+ return c;
+ }
+ }
return 0;
}
@@ -621,12 +621,12 @@ static void wait_vt_active(
int _PM_console_fd)
{
while (ioctl(_PM_console_fd, VT_WAITACTIVE, tty_vc) < 0) {
- if ((errno != EAGAIN) && (errno != EINTR)) {
- perror("ioctl(VT_WAITACTIVE)");
- exit(1);
- }
- usleep(150000);
- }
+ if ((errno != EAGAIN) && (errno != EINTR)) {
+ perror("ioctl(VT_WAITACTIVE)");
+ exit(1);
+ }
+ usleep(150000);
+ }
}
/****************************************************************************
@@ -641,7 +641,7 @@ static int check_owner(
sprintf(fname, "/dev/tty%d", vc);
if ((stat(fname, &sbuf) >= 0) && (getuid() == sbuf.st_uid))
- return 1;
+ return 1;
printf("You must be the owner of the current console to use this program.\n");
return 0;
}
@@ -658,7 +658,7 @@ static void restore_text_console(
int console_id)
{
if (ioctl(console_id, KDSETMODE, KD_TEXT) < 0)
- LOGWARN("ioctl(KDSETMODE) failed");
+ LOGWARN("ioctl(KDSETMODE) failed");
_PM_restore_kb_mode();
}
@@ -682,7 +682,7 @@ PM_HWND PMAPI PM_openConsole(
/* Check if we have already opened the console */
if (console_count++)
- return _PM_console_fd;
+ return _PM_console_fd;
/* Now, it would be great if we could use /dev/tty and see what it is
* connected to. Alas, we cannot find out reliably what VC /dev/tty is
@@ -690,26 +690,26 @@ PM_HWND PMAPI PM_openConsole(
*/
startup_vc = 0;
for (_PM_console_fd = 0; _PM_console_fd < 3; _PM_console_fd++) {
- if (fstat(_PM_console_fd, &sbuf) < 0)
- continue;
- if (ioctl(_PM_console_fd, VT_GETMODE, &vtm) < 0)
- continue;
- if ((sbuf.st_rdev & 0xFF00) != 0x400)
- continue;
- if (!(sbuf.st_rdev & 0xFF))
- continue;
- tty_vc = sbuf.st_rdev & 0xFF;
- restore_text_console(_PM_console_fd);
- return _PM_console_fd;
- }
+ if (fstat(_PM_console_fd, &sbuf) < 0)
+ continue;
+ if (ioctl(_PM_console_fd, VT_GETMODE, &vtm) < 0)
+ continue;
+ if ((sbuf.st_rdev & 0xFF00) != 0x400)
+ continue;
+ if (!(sbuf.st_rdev & 0xFF))
+ continue;
+ tty_vc = sbuf.st_rdev & 0xFF;
+ restore_text_console(_PM_console_fd);
+ return _PM_console_fd;
+ }
if ((_PM_console_fd = open("/dev/console", O_RDWR)) < 0) {
- printf("open_dev_console: can't open /dev/console \n");
- exit(1);
- }
+ printf("open_dev_console: can't open /dev/console \n");
+ exit(1);
+ }
if (ioctl(_PM_console_fd, VT_OPENQRY, &tty_vc) < 0)
- goto Error;
+ goto Error;
if (tty_vc <= 0)
- goto Error;
+ goto Error;
sprintf(fname, "/dev/tty%d", tty_vc);
close(_PM_console_fd);
@@ -718,40 +718,40 @@ PM_HWND PMAPI PM_openConsole(
/* We must use RDWR to allow for output... */
if (((_PM_console_fd = open(fname, O_RDWR)) >= 0) &&
- (ioctl(_PM_console_fd, VT_GETSTATE, &vts) >= 0)) {
- if (!check_owner(vts.v_active))
- goto Error;
- restore_text_console(_PM_console_fd);
-
- /* Success, redirect all stdios */
- fflush(stdin);
- fflush(stdout);
- fflush(stderr);
- close(0);
- close(1);
- close(2);
- dup(_PM_console_fd);
- dup(_PM_console_fd);
- dup(_PM_console_fd);
-
- /* clear screen and switch to it */
- fwrite("\e[H\e[J", 6, 1, stderr);
- fflush(stderr);
- if (tty_vc != vts.v_active) {
- startup_vc = vts.v_active;
- ioctl(_PM_console_fd, VT_ACTIVATE, tty_vc);
- wait_vt_active(_PM_console_fd);
- }
- }
+ (ioctl(_PM_console_fd, VT_GETSTATE, &vts) >= 0)) {
+ if (!check_owner(vts.v_active))
+ goto Error;
+ restore_text_console(_PM_console_fd);
+
+ /* Success, redirect all stdios */
+ fflush(stdin);
+ fflush(stdout);
+ fflush(stderr);
+ close(0);
+ close(1);
+ close(2);
+ dup(_PM_console_fd);
+ dup(_PM_console_fd);
+ dup(_PM_console_fd);
+
+ /* clear screen and switch to it */
+ fwrite("\e[H\e[J", 6, 1, stderr);
+ fflush(stderr);
+ if (tty_vc != vts.v_active) {
+ startup_vc = vts.v_active;
+ ioctl(_PM_console_fd, VT_ACTIVATE, tty_vc);
+ wait_vt_active(_PM_console_fd);
+ }
+ }
return _PM_console_fd;
Error:
if (_PM_console_fd > 2)
- close(_PM_console_fd);
+ close(_PM_console_fd);
console_count = 0;
PM_fatalError(
- "Not running in a graphics capable console,\n"
- "and unable to find one.\n");
+ "Not running in a graphics capable console,\n"
+ "and unable to find one.\n");
return -1;
}
@@ -764,7 +764,7 @@ Returns the size of the console state buffer.
int PMAPI PM_getConsoleStateSize(void)
{
if (!inited)
- PM_init();
+ PM_init();
return PM_getVGAStateSize() + FONT_C*2;
}
@@ -778,11 +778,11 @@ void PMAPI PM_saveConsoleState(void *stateBuf,int console_id)
/* Save the current console font */
if (ioctl(console_id,GIO_FONT,&regs[PM_getVGAStateSize()]) < 0)
- perror("ioctl(GIO_FONT)");
+ perror("ioctl(GIO_FONT)");
/* Inform the Linux console that we are going into graphics mode */
if (ioctl(console_id, KDSETMODE, KD_GRAPHICS) < 0)
- perror("ioctl(KDSETMODE)");
+ perror("ioctl(KDSETMODE)");
/* Save state of VGA registers */
PM_saveVGAState(stateBuf);
@@ -806,11 +806,11 @@ void PMAPI PM_restoreConsoleState(const void *stateBuf,PM_HWND console_id)
/* Inform the Linux console that we are back from graphics modes */
if (ioctl(console_id, KDSETMODE, KD_TEXT) < 0)
- LOGWARN("ioctl(KDSETMODE) failed");
+ LOGWARN("ioctl(KDSETMODE) failed");
/* Restore the old console font */
if (ioctl(console_id,PIO_FONT,&regs[PM_getVGAStateSize()]) < 0)
- LOGWARN("ioctl(KDSETMODE) failed");
+ LOGWARN("ioctl(KDSETMODE) failed");
/* Coming back from graphics mode on Linux also restored the previous
* text mode console contents, so we need to clear the screen to get
@@ -830,15 +830,15 @@ void PMAPI PM_closeConsole(PM_HWND _PM_console_fd)
{
/* Restore console to normal operation */
if (--console_count == 0) {
- /* Re-activate the original virtual console */
- if (startup_vc > 0)
- ioctl(_PM_console_fd, VT_ACTIVATE, startup_vc);
+ /* Re-activate the original virtual console */
+ if (startup_vc > 0)
+ ioctl(_PM_console_fd, VT_ACTIVATE, startup_vc);
- /* Close the console file descriptor */
- if (_PM_console_fd > 2)
- close(_PM_console_fd);
- _PM_console_fd = -1;
- }
+ /* Close the console file descriptor */
+ if (_PM_console_fd > 2)
+ close(_PM_console_fd);
+ _PM_console_fd = -1;
+ }
}
void PM_setOSCursorLocation(int x,int y)
@@ -855,12 +855,12 @@ void PM_setOSScreenWidth(int width,int height)
struct winsize ws;
struct vt_sizes vs;
- // Resize the software terminal
+ /* Resize the software terminal */
ws.ws_col = width;
ws.ws_row = height;
ioctl(_PM_console_fd, TIOCSWINSZ, &ws);
- // And the hardware
+ /* And the hardware */
vs.v_rows = height;
vs.v_cols = width;
vs.v_scrollsize = 0;
@@ -869,18 +869,18 @@ void PM_setOSScreenWidth(int width,int height)
ibool PMAPI PM_setRealTimeClockHandler(PM_intHandler ih, int frequency)
{
- // TODO: Implement this for Linux
+ /* TODO: Implement this for Linux */
return false;
}
void PMAPI PM_setRealTimeClockFrequency(int frequency)
{
- // TODO: Implement this for Linux
+ /* TODO: Implement this for Linux */
}
void PMAPI PM_restoreRealTimeClockHandler(void)
{
- // TODO: Implement this for Linux
+ /* TODO: Implement this for Linux */
}
char * PMAPI PM_getCurrentPath(
@@ -929,7 +929,7 @@ void * PMAPI PM_getBIOSPointer(void)
{
static uchar *zeroPtr = NULL;
if (!zeroPtr)
- zeroPtr = PM_mapPhysicalAddr(0,0xFFFFF,true);
+ zeroPtr = PM_mapPhysicalAddr(0,0xFFFFF,true);
return (void*)(zeroPtr + 0x400);
}
@@ -939,7 +939,7 @@ void * PMAPI PM_getA0000Pointer(void)
* address mapping, so we can return the address here.
*/
if (!inited)
- PM_init();
+ PM_init();
return (void*)(0xA0000);
}
@@ -949,11 +949,11 @@ void * PMAPI PM_mapPhysicalAddr(ulong base,ulong limit,ibool isCached)
ulong baseAddr,baseOfs;
if (!inited)
- PM_init();
+ PM_init();
if (base >= 0xA0000 && base < 0x100000)
- return (void*)base;
+ return (void*)base;
if (!fd_mem && (fd_mem = open("/dev/mem", O_RDWR)) == -1)
- return NULL;
+ return NULL;
/* Round the physical address to a 4Kb boundary and the limit to a
* 4Kb-1 boundary before passing the values to mmap. If we round the
@@ -964,57 +964,57 @@ void * PMAPI PM_mapPhysicalAddr(ulong base,ulong limit,ibool isCached)
baseAddr = base & ~4095;
limit = ((limit+baseOfs+1+4095) & ~4095)-1;
if ((p = mmap(0, limit+1,
- PROT_READ | PROT_WRITE, MAP_SHARED,
- fd_mem, baseAddr)) == (void *)-1)
- return NULL;
+ PROT_READ | PROT_WRITE, MAP_SHARED,
+ fd_mem, baseAddr)) == (void *)-1)
+ return NULL;
return (void*)(p+baseOfs);
}
void PMAPI PM_freePhysicalAddr(void *ptr,ulong limit)
{
if ((ulong)ptr >= 0x100000)
- munmap(ptr,limit+1);
+ munmap(ptr,limit+1);
}
ulong PMAPI PM_getPhysicalAddr(void *p)
{
- // TODO: This function should find the physical address of a linear
- // address.
+ /* TODO: This function should find the physical address of a linear */
+ /* address. */
return 0xFFFFFFFFUL;
}
ibool PMAPI PM_getPhysicalAddrRange(void *p,ulong length,ulong *physAddress)
{
- // TODO: This function should find a range of physical addresses
- // for a linear address.
+ /* TODO: This function should find a range of physical addresses */
+ /* for a linear address. */
return false;
}
void PMAPI PM_sleep(ulong milliseconds)
{
- // TODO: Put the process to sleep for milliseconds
+ /* TODO: Put the process to sleep for milliseconds */
}
int PMAPI PM_getCOMPort(int port)
{
- // TODO: Re-code this to determine real values using the Plug and Play
- // manager for the OS.
+ /* TODO: Re-code this to determine real values using the Plug and Play */
+ /* manager for the OS. */
switch (port) {
- case 0: return 0x3F8;
- case 1: return 0x2F8;
- }
+ case 0: return 0x3F8;
+ case 1: return 0x2F8;
+ }
return 0;
}
int PMAPI PM_getLPTPort(int port)
{
- // TODO: Re-code this to determine real values using the Plug and Play
- // manager for the OS.
+ /* TODO: Re-code this to determine real values using the Plug and Play */
+ /* manager for the OS. */
switch (port) {
- case 0: return 0x3BC;
- case 1: return 0x378;
- case 2: return 0x278;
- }
+ case 0: return 0x3BC;
+ case 1: return 0x378;
+ case 2: return 0x278;
+ }
return 0;
}
@@ -1038,7 +1038,7 @@ void * PMAPI PM_mapRealPointer(uint r_seg,uint r_off)
* mapping so we can simply return the physical address in here.
*/
if (!inited)
- PM_init();
+ PM_init();
return (void*)MK_PHYS(r_seg,r_off);
}
@@ -1048,24 +1048,24 @@ void * PMAPI PM_allocRealSeg(uint size,uint *r_seg,uint *r_off)
char *r = (char *)REAL_MEM_BASE;
if (!inited)
- PM_init();
+ PM_init();
if (!mem_info.ready)
- return NULL;
+ return NULL;
if (mem_info.count == REAL_MEM_BLOCKS)
- return NULL;
+ return NULL;
size = (size + 15) & ~15;
for (i = 0; i < mem_info.count; i++) {
- if (mem_info.blocks[i].free && size < mem_info.blocks[i].size) {
- insert_block(i);
- mem_info.blocks[i].size = size;
- mem_info.blocks[i].free = 0;
- mem_info.blocks[i + 1].size -= size;
- *r_seg = (uint)(r) >> 4;
- *r_off = (uint)(r) & 0xF;
- return (void *)r;
- }
- r += mem_info.blocks[i].size;
- }
+ if (mem_info.blocks[i].free && size < mem_info.blocks[i].size) {
+ insert_block(i);
+ mem_info.blocks[i].size = size;
+ mem_info.blocks[i].free = 0;
+ mem_info.blocks[i + 1].size -= size;
+ *r_seg = (uint)(r) >> 4;
+ *r_off = (uint)(r) & 0xF;
+ return (void *)r;
+ }
+ r += mem_info.blocks[i].size;
+ }
return NULL;
}
@@ -1075,23 +1075,23 @@ void PMAPI PM_freeRealSeg(void *mem)
char *r = (char *)REAL_MEM_BASE;
if (!mem_info.ready)
- return;
+ return;
i = 0;
while (mem != (void *)r) {
- r += mem_info.blocks[i].size;
- i++;
- if (i == mem_info.count)
- return;
- }
+ r += mem_info.blocks[i].size;
+ i++;
+ if (i == mem_info.count)
+ return;
+ }
mem_info.blocks[i].free = 1;
if (i + 1 < mem_info.count && mem_info.blocks[i + 1].free) {
- mem_info.blocks[i].size += mem_info.blocks[i + 1].size;
- delete_block(i + 1);
- }
+ mem_info.blocks[i].size += mem_info.blocks[i + 1].size;
+ delete_block(i + 1);
+ }
if (i - 1 >= 0 && mem_info.blocks[i - 1].free) {
- mem_info.blocks[i - 1].size += mem_info.blocks[i].size;
- delete_block(i);
- }
+ mem_info.blocks[i - 1].size += mem_info.blocks[i].size;
+ delete_block(i);
+ }
}
#define DIRECTION_FLAG (1 << 10)
@@ -1104,27 +1104,27 @@ static void em_ins(int size)
edi = context.vm.regs.edi & 0xffff;
edi += (unsigned int)context.vm.regs.ds << 4;
if (context.vm.regs.eflags & DIRECTION_FLAG) {
- if (size == 4)
- asm volatile ("std; insl; cld"
- : "=D" (edi) : "d" (edx), "0" (edi));
- else if (size == 2)
- asm volatile ("std; insw; cld"
- : "=D" (edi) : "d" (edx), "0" (edi));
- else
- asm volatile ("std; insb; cld"
- : "=D" (edi) : "d" (edx), "0" (edi));
- }
+ if (size == 4)
+ asm volatile ("std; insl; cld"
+ : "=D" (edi) : "d" (edx), "0" (edi));
+ else if (size == 2)
+ asm volatile ("std; insw; cld"
+ : "=D" (edi) : "d" (edx), "0" (edi));
+ else
+ asm volatile ("std; insb; cld"
+ : "=D" (edi) : "d" (edx), "0" (edi));
+ }
else {
- if (size == 4)
- asm volatile ("cld; insl"
- : "=D" (edi) : "d" (edx), "0" (edi));
- else if (size == 2)
- asm volatile ("cld; insw"
- : "=D" (edi) : "d" (edx), "0" (edi));
- else
- asm volatile ("cld; insb"
- : "=D" (edi) : "d" (edx), "0" (edi));
- }
+ if (size == 4)
+ asm volatile ("cld; insl"
+ : "=D" (edi) : "d" (edx), "0" (edi));
+ else if (size == 2)
+ asm volatile ("cld; insw"
+ : "=D" (edi) : "d" (edx), "0" (edi));
+ else
+ asm volatile ("cld; insb"
+ : "=D" (edi) : "d" (edx), "0" (edi));
+ }
edi -= (unsigned int)context.vm.regs.ds << 4;
context.vm.regs.edi &= 0xffff0000;
context.vm.regs.edi |= edi & 0xffff;
@@ -1139,33 +1139,33 @@ static void em_rep_ins(int size)
edi = context.vm.regs.edi & 0xffff;
edi += (unsigned int)context.vm.regs.ds << 4;
if (context.vm.regs.eflags & DIRECTION_FLAG) {
- if (size == 4)
- asm volatile ("std; rep; insl; cld"
- : "=D" (edi), "=c" (ecx)
- : "d" (edx), "0" (edi), "1" (ecx));
- else if (size == 2)
- asm volatile ("std; rep; insw; cld"
- : "=D" (edi), "=c" (ecx)
- : "d" (edx), "0" (edi), "1" (ecx));
- else
- asm volatile ("std; rep; insb; cld"
- : "=D" (edi), "=c" (ecx)
- : "d" (edx), "0" (edi), "1" (ecx));
- }
+ if (size == 4)
+ asm volatile ("std; rep; insl; cld"
+ : "=D" (edi), "=c" (ecx)
+ : "d" (edx), "0" (edi), "1" (ecx));
+ else if (size == 2)
+ asm volatile ("std; rep; insw; cld"
+ : "=D" (edi), "=c" (ecx)
+ : "d" (edx), "0" (edi), "1" (ecx));
+ else
+ asm volatile ("std; rep; insb; cld"
+ : "=D" (edi), "=c" (ecx)
+ : "d" (edx), "0" (edi), "1" (ecx));
+ }
else {
- if (size == 4)
- asm volatile ("cld; rep; insl"
- : "=D" (edi), "=c" (ecx)
- : "d" (edx), "0" (edi), "1" (ecx));
- else if (size == 2)
- asm volatile ("cld; rep; insw"
- : "=D" (edi), "=c" (ecx)
- : "d" (edx), "0" (edi), "1" (ecx));
- else
- asm volatile ("cld; rep; insb"
- : "=D" (edi), "=c" (ecx)
- : "d" (edx), "0" (edi), "1" (ecx));
- }
+ if (size == 4)
+ asm volatile ("cld; rep; insl"
+ : "=D" (edi), "=c" (ecx)
+ : "d" (edx), "0" (edi), "1" (ecx));
+ else if (size == 2)
+ asm volatile ("cld; rep; insw"
+ : "=D" (edi), "=c" (ecx)
+ : "d" (edx), "0" (edi), "1" (ecx));
+ else
+ asm volatile ("cld; rep; insb"
+ : "=D" (edi), "=c" (ecx)
+ : "d" (edx), "0" (edi), "1" (ecx));
+ }
edi -= (unsigned int)context.vm.regs.ds << 4;
context.vm.regs.edi &= 0xffff0000;
@@ -1182,27 +1182,27 @@ static void em_outs(int size)
esi = context.vm.regs.esi & 0xffff;
esi += (unsigned int)context.vm.regs.ds << 4;
if (context.vm.regs.eflags & DIRECTION_FLAG) {
- if (size == 4)
- asm volatile ("std; outsl; cld"
- : "=S" (esi) : "d" (edx), "0" (esi));
- else if (size == 2)
- asm volatile ("std; outsw; cld"
- : "=S" (esi) : "d" (edx), "0" (esi));
- else
- asm volatile ("std; outsb; cld"
- : "=S" (esi) : "d" (edx), "0" (esi));
- }
+ if (size == 4)
+ asm volatile ("std; outsl; cld"
+ : "=S" (esi) : "d" (edx), "0" (esi));
+ else if (size == 2)
+ asm volatile ("std; outsw; cld"
+ : "=S" (esi) : "d" (edx), "0" (esi));
+ else
+ asm volatile ("std; outsb; cld"
+ : "=S" (esi) : "d" (edx), "0" (esi));
+ }
else {
- if (size == 4)
- asm volatile ("cld; outsl"
- : "=S" (esi) : "d" (edx), "0" (esi));
- else if (size == 2)
- asm volatile ("cld; outsw"
- : "=S" (esi) : "d" (edx), "0" (esi));
- else
- asm volatile ("cld; outsb"
- : "=S" (esi) : "d" (edx), "0" (esi));
- }
+ if (size == 4)
+ asm volatile ("cld; outsl"
+ : "=S" (esi) : "d" (edx), "0" (esi));
+ else if (size == 2)
+ asm volatile ("cld; outsw"
+ : "=S" (esi) : "d" (edx), "0" (esi));
+ else
+ asm volatile ("cld; outsb"
+ : "=S" (esi) : "d" (edx), "0" (esi));
+ }
esi -= (unsigned int)context.vm.regs.ds << 4;
context.vm.regs.esi &= 0xffff0000;
@@ -1218,33 +1218,33 @@ static void em_rep_outs(int size)
esi = context.vm.regs.esi & 0xffff;
esi += (unsigned int)context.vm.regs.ds << 4;
if (context.vm.regs.eflags & DIRECTION_FLAG) {
- if (size == 4)
- asm volatile ("std; rep; outsl; cld"
- : "=S" (esi), "=c" (ecx)
- : "d" (edx), "0" (esi), "1" (ecx));
- else if (size == 2)
- asm volatile ("std; rep; outsw; cld"
- : "=S" (esi), "=c" (ecx)
- : "d" (edx), "0" (esi), "1" (ecx));
- else
- asm volatile ("std; rep; outsb; cld"
- : "=S" (esi), "=c" (ecx)
- : "d" (edx), "0" (esi), "1" (ecx));
- }
+ if (size == 4)
+ asm volatile ("std; rep; outsl; cld"
+ : "=S" (esi), "=c" (ecx)
+ : "d" (edx), "0" (esi), "1" (ecx));
+ else if (size == 2)
+ asm volatile ("std; rep; outsw; cld"
+ : "=S" (esi), "=c" (ecx)
+ : "d" (edx), "0" (esi), "1" (ecx));
+ else
+ asm volatile ("std; rep; outsb; cld"
+ : "=S" (esi), "=c" (ecx)
+ : "d" (edx), "0" (esi), "1" (ecx));
+ }
else {
- if (size == 4)
- asm volatile ("cld; rep; outsl"
- : "=S" (esi), "=c" (ecx)
- : "d" (edx), "0" (esi), "1" (ecx));
- else if (size == 2)
- asm volatile ("cld; rep; outsw"
- : "=S" (esi), "=c" (ecx)
- : "d" (edx), "0" (esi), "1" (ecx));
- else
- asm volatile ("cld; rep; outsb"
- : "=S" (esi), "=c" (ecx)
- : "d" (edx), "0" (esi), "1" (ecx));
- }
+ if (size == 4)
+ asm volatile ("cld; rep; outsl"
+ : "=S" (esi), "=c" (ecx)
+ : "d" (edx), "0" (esi), "1" (ecx));
+ else if (size == 2)
+ asm volatile ("cld; rep; outsw"
+ : "=S" (esi), "=c" (ecx)
+ : "d" (edx), "0" (esi), "1" (ecx));
+ else
+ asm volatile ("cld; rep; outsb"
+ : "=S" (esi), "=c" (ecx)
+ : "d" (edx), "0" (esi), "1" (ecx));
+ }
esi -= (unsigned int)context.vm.regs.ds << 4;
context.vm.regs.esi &= 0xffff0000;
@@ -1257,9 +1257,9 @@ static int emulate(void)
{
unsigned char *insn;
struct {
- unsigned int size : 1;
- unsigned int rep : 1;
- } prefix = { 0, 0 };
+ unsigned int size : 1;
+ unsigned int rep : 1;
+ } prefix = { 0, 0 };
int i = 0;
insn = (unsigned char *)((unsigned int)context.vm.regs.cs << 4);
@@ -1267,101 +1267,101 @@ static int emulate(void)
while (1) {
#ifdef TRACE_IO
- traceAddr = ((ulong)context.vm.regs.cs << 16) + context.vm.regs.eip + i;
+ traceAddr = ((ulong)context.vm.regs.cs << 16) + context.vm.regs.eip + i;
#endif
- if (insn[i] == 0x66) {
- prefix.size = 1 - prefix.size;
- i++;
- }
- else if (insn[i] == 0xf3) {
- prefix.rep = 1;
- i++;
- }
- else if (insn[i] == 0xf0 || insn[i] == 0xf2
- || insn[i] == 0x26 || insn[i] == 0x2e
- || insn[i] == 0x36 || insn[i] == 0x3e
- || insn[i] == 0x64 || insn[i] == 0x65
- || insn[i] == 0x67) {
- /* these prefixes are just ignored */
- i++;
- }
- else if (insn[i] == 0x6c) {
- if (prefix.rep)
- em_rep_ins(1);
- else
- em_ins(1);
- i++;
- break;
- }
- else if (insn[i] == 0x6d) {
- if (prefix.rep) {
- if (prefix.size)
- em_rep_ins(4);
- else
- em_rep_ins(2);
- }
- else {
- if (prefix.size)
- em_ins(4);
- else
- em_ins(2);
- }
- i++;
- break;
- }
- else if (insn[i] == 0x6e) {
- if (prefix.rep)
- em_rep_outs(1);
- else
- em_outs(1);
- i++;
- break;
- }
- else if (insn[i] == 0x6f) {
- if (prefix.rep) {
- if (prefix.size)
- em_rep_outs(4);
- else
- em_rep_outs(2);
- }
- else {
- if (prefix.size)
- em_outs(4);
- else
- em_outs(2);
- }
- i++;
- break;
- }
- else if (insn[i] == 0xec) {
- *((uchar*)&context.vm.regs.eax) = port_in(context.vm.regs.edx);
- i++;
- break;
- }
- else if (insn[i] == 0xed) {
- if (prefix.size)
- *((ulong*)&context.vm.regs.eax) = port_inl(context.vm.regs.edx);
- else
- *((ushort*)&context.vm.regs.eax) = port_inw(context.vm.regs.edx);
- i++;
- break;
- }
- else if (insn[i] == 0xee) {
- port_out(context.vm.regs.eax,context.vm.regs.edx);
- i++;
- break;
- }
- else if (insn[i] == 0xef) {
- if (prefix.size)
- port_outl(context.vm.regs.eax,context.vm.regs.edx);
- else
- port_outw(context.vm.regs.eax,context.vm.regs.edx);
- i++;
- break;
- }
- else
- return 0;
- }
+ if (insn[i] == 0x66) {
+ prefix.size = 1 - prefix.size;
+ i++;
+ }
+ else if (insn[i] == 0xf3) {
+ prefix.rep = 1;
+ i++;
+ }
+ else if (insn[i] == 0xf0 || insn[i] == 0xf2
+ || insn[i] == 0x26 || insn[i] == 0x2e
+ || insn[i] == 0x36 || insn[i] == 0x3e
+ || insn[i] == 0x64 || insn[i] == 0x65
+ || insn[i] == 0x67) {
+ /* these prefixes are just ignored */
+ i++;
+ }
+ else if (insn[i] == 0x6c) {
+ if (prefix.rep)
+ em_rep_ins(1);
+ else
+ em_ins(1);
+ i++;
+ break;
+ }
+ else if (insn[i] == 0x6d) {
+ if (prefix.rep) {
+ if (prefix.size)
+ em_rep_ins(4);
+ else
+ em_rep_ins(2);
+ }
+ else {
+ if (prefix.size)
+ em_ins(4);
+ else
+ em_ins(2);
+ }
+ i++;
+ break;
+ }
+ else if (insn[i] == 0x6e) {
+ if (prefix.rep)
+ em_rep_outs(1);
+ else
+ em_outs(1);
+ i++;
+ break;
+ }
+ else if (insn[i] == 0x6f) {
+ if (prefix.rep) {
+ if (prefix.size)
+ em_rep_outs(4);
+ else
+ em_rep_outs(2);
+ }
+ else {
+ if (prefix.size)
+ em_outs(4);
+ else
+ em_outs(2);
+ }
+ i++;
+ break;
+ }
+ else if (insn[i] == 0xec) {
+ *((uchar*)&context.vm.regs.eax) = port_in(context.vm.regs.edx);
+ i++;
+ break;
+ }
+ else if (insn[i] == 0xed) {
+ if (prefix.size)
+ *((ulong*)&context.vm.regs.eax) = port_inl(context.vm.regs.edx);
+ else
+ *((ushort*)&context.vm.regs.eax) = port_inw(context.vm.regs.edx);
+ i++;
+ break;
+ }
+ else if (insn[i] == 0xee) {
+ port_out(context.vm.regs.eax,context.vm.regs.edx);
+ i++;
+ break;
+ }
+ else if (insn[i] == 0xef) {
+ if (prefix.size)
+ port_outl(context.vm.regs.eax,context.vm.regs.edx);
+ else
+ port_outw(context.vm.regs.eax,context.vm.regs.edx);
+ i++;
+ break;
+ }
+ else
+ return 0;
+ }
context.vm.regs.eip += i;
return 1;
@@ -1393,7 +1393,7 @@ static void debug_info(int vret)
fputs("cs:ip = [ ", stderr);
p = (unsigned char *)((context.vm.regs.cs << 4) + (context.vm.regs.eip & 0xffff));
for (i = 0; i < 16; ++i)
- fprintf(stderr, "%02x ", (unsigned int)p[i]);
+ fprintf(stderr, "%02x ", (unsigned int)p[i]);
fputs("]\n", stderr);
fflush(stderr);
}
@@ -1403,24 +1403,24 @@ static int run_vm86(void)
unsigned int vret;
for (;;) {
- vret = vm86(&context.vm);
- if (VM86_TYPE(vret) == VM86_INTx) {
- unsigned int v = VM86_ARG(vret);
- if (v == RETURN_TO_32_INT)
- return 1;
- pushw(context.vm.regs.eflags);
- pushw(context.vm.regs.cs);
- pushw(context.vm.regs.eip);
- context.vm.regs.cs = get_int_seg(v);
- context.vm.regs.eip = get_int_off(v);
- context.vm.regs.eflags &= ~(VIF_MASK | TF_MASK);
- continue;
- }
- if (VM86_TYPE(vret) != VM86_UNKNOWN)
- break;
- if (!emulate())
- break;
- }
+ vret = vm86(&context.vm);
+ if (VM86_TYPE(vret) == VM86_INTx) {
+ unsigned int v = VM86_ARG(vret);
+ if (v == RETURN_TO_32_INT)
+ return 1;
+ pushw(context.vm.regs.eflags);
+ pushw(context.vm.regs.cs);
+ pushw(context.vm.regs.eip);
+ context.vm.regs.cs = get_int_seg(v);
+ context.vm.regs.eip = get_int_off(v);
+ context.vm.regs.eflags &= ~(VIF_MASK | TF_MASK);
+ continue;
+ }
+ if (VM86_TYPE(vret) != VM86_UNKNOWN)
+ break;
+ if (!emulate())
+ break;
+ }
debug_info(vret);
return 0;
}
@@ -1431,7 +1431,7 @@ static int run_vm86(void)
void PMAPI DPMI_int86(int intno, DPMI_regs *regs)
{
if (!inited)
- PM_init();
+ PM_init();
memset(&context.vm.regs, 0, sizeof(context.vm.regs));
IND(eax); IND(ebx); IND(ecx); IND(edx); IND(esi); IND(edi);
context.vm.regs.eflags = DEFAULT_VM86_FLAGS;
@@ -1453,7 +1453,7 @@ void PMAPI DPMI_int86(int intno, DPMI_regs *regs)
int PMAPI PM_int86(int intno, RMREGS *in, RMREGS *out)
{
if (!inited)
- PM_init();
+ PM_init();
memset(&context.vm.regs, 0, sizeof(context.vm.regs));
IN(eax); IN(ebx); IN(ecx); IN(edx); IN(esi); IN(edi);
context.vm.regs.eflags = DEFAULT_VM86_FLAGS;
@@ -1474,41 +1474,41 @@ int PMAPI PM_int86x(int intno, RMREGS *in, RMREGS *out,
RMSREGS *sregs)
{
if (!inited)
- PM_init();
+ PM_init();
if (intno == 0x21) {
- time_t today = time(NULL);
- struct tm *t;
- t = localtime(&today);
- out->x.cx = t->tm_year + 1900;
- out->h.dh = t->tm_mon + 1;
- out->h.dl = t->tm_mday;
- }
+ time_t today = time(NULL);
+ struct tm *t;
+ t = localtime(&today);
+ out->x.cx = t->tm_year + 1900;
+ out->h.dh = t->tm_mon + 1;
+ out->h.dl = t->tm_mday;
+ }
else {
- unsigned int seg, off;
- seg = get_int_seg(intno);
- off = get_int_off(intno);
- memset(&context.vm.regs, 0, sizeof(context.vm.regs));
- IN(eax); IN(ebx); IN(ecx); IN(edx); IN(esi); IN(edi);
- context.vm.regs.eflags = DEFAULT_VM86_FLAGS;
- context.vm.regs.cs = seg;
- context.vm.regs.eip = off;
- context.vm.regs.es = sregs->es;
- context.vm.regs.ds = sregs->ds;
- context.vm.regs.fs = sregs->fs;
- context.vm.regs.gs = sregs->gs;
- context.vm.regs.ss = context.stack_seg;
- context.vm.regs.esp = context.stack_off;
- pushw(DEFAULT_VM86_FLAGS);
- pushw(context.ret_seg);
- pushw(context.ret_off);
- run_vm86();
- OUT(eax); OUT(ebx); OUT(ecx); OUT(edx); OUT(esi); OUT(edi);
- sregs->es = context.vm.regs.es;
- sregs->ds = context.vm.regs.ds;
- sregs->fs = context.vm.regs.fs;
- sregs->gs = context.vm.regs.gs;
- out->x.cflag = context.vm.regs.eflags & 1;
- }
+ unsigned int seg, off;
+ seg = get_int_seg(intno);
+ off = get_int_off(intno);
+ memset(&context.vm.regs, 0, sizeof(context.vm.regs));
+ IN(eax); IN(ebx); IN(ecx); IN(edx); IN(esi); IN(edi);
+ context.vm.regs.eflags = DEFAULT_VM86_FLAGS;
+ context.vm.regs.cs = seg;
+ context.vm.regs.eip = off;
+ context.vm.regs.es = sregs->es;
+ context.vm.regs.ds = sregs->ds;
+ context.vm.regs.fs = sregs->fs;
+ context.vm.regs.gs = sregs->gs;
+ context.vm.regs.ss = context.stack_seg;
+ context.vm.regs.esp = context.stack_off;
+ pushw(DEFAULT_VM86_FLAGS);
+ pushw(context.ret_seg);
+ pushw(context.ret_off);
+ run_vm86();
+ OUT(eax); OUT(ebx); OUT(ecx); OUT(edx); OUT(esi); OUT(edi);
+ sregs->es = context.vm.regs.es;
+ sregs->ds = context.vm.regs.ds;
+ sregs->fs = context.vm.regs.fs;
+ sregs->gs = context.vm.regs.gs;
+ out->x.cflag = context.vm.regs.eflags & 1;
+ }
return out->e.eax;
}
@@ -1518,7 +1518,7 @@ void PMAPI PM_callRealMode(uint seg,uint off, RMREGS *in,
RMSREGS *sregs)
{
if (!inited)
- PM_init();
+ PM_init();
memset(&context.vm.regs, 0, sizeof(context.vm.regs));
IN(eax); IN(ebx); IN(ecx); IN(edx); IN(esi); IN(edi);
context.vm.regs.eflags = DEFAULT_VM86_FLAGS;
@@ -1558,32 +1558,32 @@ void PMAPI PM_availableMemory(ulong *physical,ulong *total)
void * PMAPI PM_allocLockedMem(uint size,ulong *physAddr,ibool contiguous,ibool below16M)
{
- // TODO: Implement this for Linux
+ /* TODO: Implement this for Linux */
return NULL;
}
void PMAPI PM_freeLockedMem(void *p,uint size,ibool contiguous)
{
- // TODO: Implement this for Linux
+ /* TODO: Implement this for Linux */
}
void * PMAPI PM_allocPage(
ibool locked)
{
- // TODO: Implement this for Linux
+ /* TODO: Implement this for Linux */
return NULL;
}
void PMAPI PM_freePage(
void *p)
{
- // TODO: Implement this for Linux
+ /* TODO: Implement this for Linux */
}
void PMAPI PM_setBankA(int bank)
{
if (!inited)
- PM_init();
+ PM_init();
memset(&context.vm.regs, 0, sizeof(context.vm.regs));
context.vm.regs.eax = 0x4F05;
context.vm.regs.ebx = 0x0000;
@@ -1602,7 +1602,7 @@ void PMAPI PM_setBankA(int bank)
void PMAPI PM_setBankAB(int bank)
{
if (!inited)
- PM_init();
+ PM_init();
memset(&context.vm.regs, 0, sizeof(context.vm.regs));
context.vm.regs.eax = 0x4F05;
context.vm.regs.ebx = 0x0000;
@@ -1633,7 +1633,7 @@ void PMAPI PM_setBankAB(int bank)
void PMAPI PM_setCRTStart(int x,int y,int waitVRT)
{
if (!inited)
- PM_init();
+ PM_init();
memset(&context.vm.regs, 0, sizeof(context.vm.regs));
context.vm.regs.eax = 0x4F07;
context.vm.regs.ebx = waitVRT;
@@ -1656,14 +1656,14 @@ int PMAPI PM_enableWriteCombine(ulong base,ulong length,uint type)
struct mtrr_sentry sentry;
if (mtrr_fd < 0)
- return PM_MTRR_ERR_NO_OS_SUPPORT;
+ return PM_MTRR_ERR_NO_OS_SUPPORT;
sentry.base = base;
sentry.size = length;
sentry.type = type;
if (ioctl(mtrr_fd, MTRRIOC_ADD_ENTRY, &sentry) == -1) {
- // TODO: Need to decode MTRR error codes!!
- return PM_MTRR_NOT_SUPPORTED;
- }
+ /* TODO: Need to decode MTRR error codes!! */
+ return PM_MTRR_NOT_SUPPORTED;
+ }
return PM_MTRR_ERR_OK;
#else
return PM_MTRR_ERR_NO_OS_SUPPORT;
@@ -1685,15 +1685,15 @@ int PMAPI PM_enumWriteCombine(
struct mtrr_gentry gentry;
if (mtrr_fd < 0)
- return PM_MTRR_ERR_NO_OS_SUPPORT;
+ return PM_MTRR_ERR_NO_OS_SUPPORT;
for (gentry.regnum = 0; ioctl (mtrr_fd, MTRRIOC_GET_ENTRY, &gentry) == 0;
- ++gentry.regnum) {
- if (gentry.size > 0) {
- // WARNING: This code assumes that the types in pmapi.h match the ones
- // in the Linux kernel (mtrr.h)
- callback(gentry.base, gentry.size, gentry.type);
- }
+ ++gentry.regnum) {
+ if (gentry.size > 0) {
+ /* WARNING: This code assumes that the types in pmapi.h match the ones */
+ /* in the Linux kernel (mtrr.h) */
+ callback(gentry.base, gentry.size, gentry.type);
+ }
}
return PM_MTRR_ERR_OK;
@@ -1719,13 +1719,13 @@ ibool PMAPI PM_doBIOSPOST(
* the secondary BIOS image over the top of the old one.
*/
if (!inited)
- PM_init();
+ PM_init();
if ((old_bios = PM_malloc(BIOSLen)) == NULL)
- return false;
+ return false;
if (BIOSPhysAddr != 0xC0000) {
- memcpy(old_bios,bios_ptr,BIOSLen);
- memcpy(bios_ptr,copyOfBIOS,BIOSLen);
- }
+ memcpy(old_bios,bios_ptr,BIOSLen);
+ memcpy(bios_ptr,copyOfBIOS,BIOSLen);
+ }
/* The interrupt vectors should already be mmap()'ed from 0-0x400 in PM_init */
Current10 = rvec[0x10];
@@ -1742,7 +1742,7 @@ ibool PMAPI PM_doBIOSPOST(
/* Restore original BIOS image */
if (BIOSPhysAddr != 0xC0000)
- memcpy(bios_ptr,old_bios,BIOSLen);
+ memcpy(bios_ptr,old_bios,BIOSLen);
PM_free(old_bios);
return true;
}
@@ -1774,7 +1774,7 @@ int PMAPI PM_unlockCodePages(void (*p)(),uint len,PM_lockHandle *lh)
PM_MODULE PMAPI PM_loadLibrary(
const char *szDLLName)
{
- // TODO: Implement this to load shared libraries!
+ /* TODO: Implement this to load shared libraries! */
(void)szDLLName;
return NULL;
}
@@ -1783,7 +1783,7 @@ void * PMAPI PM_getProcAddress(
PM_MODULE hModule,
const char *szProcName)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
(void)hModule;
(void)szProcName;
return NULL;
@@ -1792,19 +1792,18 @@ void * PMAPI PM_getProcAddress(
void PMAPI PM_freeLibrary(
PM_MODULE hModule)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
(void)hModule;
}
int PMAPI PM_setIOPL(
int level)
{
- // TODO: Move the IOPL switching into this function!!
+ /* TODO: Move the IOPL switching into this function!! */
return level;
}
void PMAPI PM_flushTLB(void)
{
- // Do nothing on Linux.
+ /* Do nothing on Linux. */
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/cpuinfo.c b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/cpuinfo.c
index e72a856019..d15b07c290 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/cpuinfo.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/cpuinfo.c
@@ -62,4 +62,3 @@ Read the counter and return the counter value.
(t)->low = lt.LowPart; \
(t)->high = lt.HighPart; \
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/int86.c b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/int86.c
index f93d9c22e7..c82648b787 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/int86.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/int86.c
@@ -1,7 +1,7 @@
/****************************************************************************
*
* SciTech OS Portability Manager Library
-*
+*
* ========================================================================
*
* The contents of this file are subject to the SciTech MGL Public
@@ -43,7 +43,7 @@ We do have limited BIOS access under Windows NT device drivers.
****************************************************************************/
ibool PMAPI PM_haveBIOSAccess(void)
{
- // Return false unless we have full buffer passing!
+ /* Return false unless we have full buffer passing! */
return false;
}
@@ -63,8 +63,8 @@ void * PMAPI PM_getVESABuf(
uint *rseg,
uint *roff)
{
- // No buffers supported under Windows NT (Windows XP has them however if
- // we ever decide to support this!)
+ /* No buffers supported under Windows NT (Windows XP has them however if */
+ /* we ever decide to support this!) */
return NULL;
}
@@ -90,7 +90,7 @@ void * PMAPI PM_mapRealPointer(
uint r_seg,
uint r_off)
{
- // Not used for Windows NT drivers!
+ /* Not used for Windows NT drivers! */
return NULL;
}
@@ -103,7 +103,7 @@ void * PMAPI PM_allocRealSeg(
uint *r_seg,
uint *r_off)
{
- // Not supported in NT drivers
+ /* Not supported in NT drivers */
(void)size;
(void)r_seg;
(void)r_off;
@@ -117,7 +117,7 @@ Free a block of real mode memory.
void PMAPI PM_freeRealSeg(
void *mem)
{
- // Not supported in NT drivers
+ /* Not supported in NT drivers */
(void)mem;
}
@@ -129,7 +129,7 @@ void PMAPI DPMI_int86(
int intno,
DPMI_regs *regs)
{
- // Not used in NT drivers
+ /* Not used in NT drivers */
}
/****************************************************************************
@@ -143,7 +143,7 @@ void PMAPI PM_callRealMode(
RMREGS *regs,
RMSREGS *sregs)
{
- // TODO!!
+ /* TODO!! */
#if 0
CLIENT_STRUCT saveRegs;
@@ -151,7 +151,7 @@ void PMAPI PM_callRealMode(
* loaded, and not statically loaded.
*/
if (!_PM_haveBIOS)
- return;
+ return;
TRACE("SDDHELP: Entering PM_callRealMode()\n");
Begin_Nest_V86_Exec();
@@ -174,7 +174,7 @@ int PMAPI PM_int86(
RMREGS *in,
RMREGS *out)
{
- // TODO!!
+ /* TODO!! */
#if 0
RMSREGS sregs = {0};
CLIENT_STRUCT saveRegs;
@@ -183,9 +183,9 @@ int PMAPI PM_int86(
/* Disable pass-up to our VxD handler so we directly call BIOS */
TRACE("SDDHELP: Entering PM_int86()\n");
if (disableTSRFlag) {
- oldDisable = *disableTSRFlag;
- *disableTSRFlag = 0;
- }
+ oldDisable = *disableTSRFlag;
+ *disableTSRFlag = 0;
+ }
Begin_Nest_V86_Exec();
LoadV86Registers(&saveRegs,in,&sregs);
Exec_Int(intno);
@@ -194,7 +194,7 @@ int PMAPI PM_int86(
/* Re-enable pass-up to our VxD handler if previously enabled */
if (disableTSRFlag)
- *disableTSRFlag = oldDisable;
+ *disableTSRFlag = oldDisable;
TRACE("SDDHELP: Exiting PM_int86()\n");
#else
@@ -214,7 +214,7 @@ int PMAPI PM_int86x(
RMREGS *out,
RMSREGS *sregs)
{
- // TODO!!
+ /* TODO!! */
#if 0
CLIENT_STRUCT saveRegs;
ushort oldDisable;
@@ -223,16 +223,16 @@ int PMAPI PM_int86x(
* loaded, and not statically loaded.
*/
if (!_PM_haveBIOS) {
- *out = *in;
- return out->x.ax;
- }
+ *out = *in;
+ return out->x.ax;
+ }
/* Disable pass-up to our VxD handler so we directly call BIOS */
TRACE("SDDHELP: Entering PM_int86x()\n");
if (disableTSRFlag) {
- oldDisable = *disableTSRFlag;
- *disableTSRFlag = 0;
- }
+ oldDisable = *disableTSRFlag;
+ *disableTSRFlag = 0;
+ }
Begin_Nest_V86_Exec();
LoadV86Registers(&saveRegs,in,sregs);
Exec_Int(intno);
@@ -241,7 +241,7 @@ int PMAPI PM_int86x(
/* Re-enable pass-up to our VxD handler if previously enabled */
if (disableTSRFlag)
- *disableTSRFlag = oldDisable;
+ *disableTSRFlag = oldDisable;
TRACE("SDDHELP: Exiting PM_int86x()\n");
#else
@@ -249,4 +249,3 @@ int PMAPI PM_int86x(
#endif
return out->x.ax;
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/irq.c b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/irq.c
index bc6b4274df..9cd52047b7 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/irq.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/irq.c
@@ -1,7 +1,7 @@
/****************************************************************************
*
* SciTech OS Portability Manager Library
-*
+*
* ========================================================================
*
* The contents of this file are subject to the SciTech MGL Public
@@ -67,41 +67,41 @@ void PMAPI PM_setRealTimeClockFrequency(
int frequency)
{
static short convert[] = {
- 8192,
- 4096,
- 2048,
- 1024,
- 512,
- 256,
- 128,
- 64,
- 32,
- 16,
- 8,
- 4,
- 2,
- -1,
- };
+ 8192,
+ 4096,
+ 2048,
+ 1024,
+ 512,
+ 256,
+ 128,
+ 64,
+ 32,
+ 16,
+ 8,
+ 4,
+ 2,
+ -1,
+ };
int i;
/* First clear any pending RTC timeout if not cleared */
_PM_readCMOS(0x0C);
if (frequency == 0) {
- /* Disable RTC timout */
- _PM_writeCMOS(0x0A,(uchar)_PM_oldCMOSRegA);
- _PM_writeCMOS(0x0B,(uchar)(_PM_oldCMOSRegB & 0x0F));
- }
+ /* Disable RTC timout */
+ _PM_writeCMOS(0x0A,(uchar)_PM_oldCMOSRegA);
+ _PM_writeCMOS(0x0B,(uchar)(_PM_oldCMOSRegB & 0x0F));
+ }
else {
- /* Convert frequency value to RTC clock indexes */
- for (i = 0; convert[i] != -1; i++) {
- if (convert[i] == frequency)
- break;
- }
-
- /* Set RTC timout value and enable timeout */
- _PM_writeCMOS(0x0A,(uchar)(0x20 | (i+3)));
- _PM_writeCMOS(0x0B,(uchar)((_PM_oldCMOSRegB & 0x0F) | 0x40));
- }
+ /* Convert frequency value to RTC clock indexes */
+ for (i = 0; convert[i] != -1; i++) {
+ if (convert[i] == frequency)
+ break;
+ }
+
+ /* Set RTC timout value and enable timeout */
+ _PM_writeCMOS(0x0A,(uchar)(0x20 | (i+3)));
+ _PM_writeCMOS(0x0B,(uchar)((_PM_oldCMOSRegB & 0x0F) | 0x40));
+ }
}
ibool PMAPI PM_setRealTimeClockHandler(PM_intHandler th,int frequency)
@@ -130,14 +130,13 @@ ibool PMAPI PM_setRealTimeClockHandler(PM_intHandler th,int frequency)
void PMAPI PM_restoreRealTimeClockHandler(void)
{
if (_PM_rtcHandler) {
- /* Restore CMOS registers and mask RTC clock */
- _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
- _PM_writeCMOS(0x0B,_PM_oldCMOSRegB);
- PM_outpb(0xA1,(uchar)((PM_inpb(0xA1) & 0xFE) | (_PM_oldRTCPIC2 & ~0xFE)));
-
- /* Restore the interrupt vector */
- _PM_restoreISR(RTC_idtEntry, &_PM_prevRTC);
- _PM_rtcHandler = NULL;
- }
+ /* Restore CMOS registers and mask RTC clock */
+ _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
+ _PM_writeCMOS(0x0B,_PM_oldCMOSRegB);
+ PM_outpb(0xA1,(uchar)((PM_inpb(0xA1) & 0xFE) | (_PM_oldRTCPIC2 & ~0xFE)));
+
+ /* Restore the interrupt vector */
+ _PM_restoreISR(RTC_idtEntry, &_PM_prevRTC);
+ _PM_rtcHandler = NULL;
+ }
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/mem.c b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/mem.c
index b30d2be860..3128c6ae38 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/mem.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/mem.c
@@ -1,7 +1,7 @@
/****************************************************************************
*
* SciTech OS Portability Manager Library
-*
+*
* ========================================================================
*
* The contents of this file are subject to the SciTech MGL Public
@@ -70,7 +70,7 @@ static memlocked locked[MAX_MEMORY_LOCKED];
ulong PMAPI _PM_getPDB(void);
-// Page table entry flags
+/* Page table entry flags */
#define PAGE_FLAGS_PRESENT 0x00000001
#define PAGE_FLAGS_WRITEABLE 0x00000002
@@ -100,14 +100,14 @@ static ulong _PM_mapPhysicalToLinear(
ulong length = limit+1;
PHYSICAL_ADDRESS paIoBase = {0};
- // NT loves large Ints
+ /* NT loves large Ints */
paIoBase = RtlConvertUlongToLargeInteger( base );
- // Map IO space into Kernel
+ /* Map IO space into Kernel */
if (isCached)
- return (ULONG)MmMapIoSpace(paIoBase, length, MmCached );
+ return (ULONG)MmMapIoSpace(paIoBase, length, MmCached );
else
- return (ULONG)MmMapIoSpace(paIoBase, length, MmNonCached );
+ return (ULONG)MmMapIoSpace(paIoBase, length, MmNonCached );
}
/****************************************************************************
@@ -135,7 +135,7 @@ static void _PM_adjustPageTables(
mask &= ~PAGE_FLAGS_USER;
bits |= PAGE_FLAGS_USER;
}
-
+
/* Disable PCD bit if page table entry should be uncached */
if (!isCached) {
mask &= ~(PAGE_FLAGS_CACHE_DISABLE | PAGE_FLAGS_WRITE_THROUGH);
@@ -144,30 +144,30 @@ static void _PM_adjustPageTables(
pPDB = (ulong*)_PM_mapPhysicalToLinear(_PM_getPDB(),0xFFF,true);
if (pPDB) {
- startPDB = (linear >> 22) & 0x3FF;
- startPage = (linear >> 12) & 0x3FF;
- endPDB = ((linear+limit) >> 22) & 0x3FF;
- endPage = ((linear+limit) >> 12) & 0x3FF;
- for (iPDB = startPDB; iPDB <= endPDB; iPDB++) {
- // Set the bits in the page directory entry - required as per
- // Pentium 4 manual. This also takes care of the 4MB page entries
- pPDB[iPDB] = (pPDB[iPDB] & mask) | bits;
- if (!(pPDB[iPDB] & PAGE_FLAGS_4MB)) {
- // If we are dealing with 4KB pages then we need to iterate
- // through each of the page table entries
- pageTable = pPDB[iPDB] & ~0xFFF;
- pPageTable = (ulong*)_PM_mapPhysicalToLinear(pageTable,0xFFF,true);
- start = (iPDB == startPDB) ? startPage : 0;
- end = (iPDB == endPDB) ? endPage : 0x3FF;
- for (iPage = start; iPage <= end; iPage++) {
- pPageTable[iPage] = (pPageTable[iPage] & mask) | bits;
- }
- MmUnmapIoSpace(pPageTable,0xFFF);
- }
- }
- MmUnmapIoSpace(pPDB,0xFFF);
- PM_flushTLB();
- }
+ startPDB = (linear >> 22) & 0x3FF;
+ startPage = (linear >> 12) & 0x3FF;
+ endPDB = ((linear+limit) >> 22) & 0x3FF;
+ endPage = ((linear+limit) >> 12) & 0x3FF;
+ for (iPDB = startPDB; iPDB <= endPDB; iPDB++) {
+ /* Set the bits in the page directory entry - required as per */
+ /* Pentium 4 manual. This also takes care of the 4MB page entries */
+ pPDB[iPDB] = (pPDB[iPDB] & mask) | bits;
+ if (!(pPDB[iPDB] & PAGE_FLAGS_4MB)) {
+ /* If we are dealing with 4KB pages then we need to iterate */
+ /* through each of the page table entries */
+ pageTable = pPDB[iPDB] & ~0xFFF;
+ pPageTable = (ulong*)_PM_mapPhysicalToLinear(pageTable,0xFFF,true);
+ start = (iPDB == startPDB) ? startPage : 0;
+ end = (iPDB == endPDB) ? endPage : 0x3FF;
+ for (iPage = start; iPage <= end; iPage++) {
+ pPageTable[iPage] = (pPageTable[iPage] & mask) | bits;
+ }
+ MmUnmapIoSpace(pPageTable,0xFFF);
+ }
+ }
+ MmUnmapIoSpace(pPDB,0xFFF);
+ PM_flushTLB();
+ }
}
/****************************************************************************
@@ -183,24 +183,24 @@ void * PMAPI PM_mallocShared(
{
int i;
- // First find a free slot in our shared memory table
+ /* First find a free slot in our shared memory table */
for (i = 0; i < MAX_MEMORY_SHARED; i++) {
- if (shared[i].linear == 0)
- break;
- }
+ if (shared[i].linear == 0)
+ break;
+ }
if (i == MAX_MEMORY_SHARED)
- return NULL;
+ return NULL;
- // Allocate the paged pool
+ /* Allocate the paged pool */
shared[i].linear = ExAllocatePool(PagedPool, size);
- // Create a list to manage this allocation
+ /* Create a list to manage this allocation */
shared[i].pMdl = IoAllocateMdl(shared[i].linear,size,FALSE,FALSE,(PIRP) NULL);
- // Lock this allocation in memory
+ /* Lock this allocation in memory */
MmProbeAndLockPages(shared[i].pMdl,KernelMode,IoModifyAccess);
- // Modify bits to grant user access
+ /* Modify bits to grant user access */
_PM_adjustPageTables((ulong)shared[i].linear, size, true, true);
return (void*)shared[i].linear;
}
@@ -214,23 +214,23 @@ void PMAPI PM_freeShared(
{
int i;
- // Find a shared memory block in our table and free it
+ /* Find a shared memory block in our table and free it */
for (i = 0; i < MAX_MEMORY_SHARED; i++) {
- if (shared[i].linear == p) {
- // Unlock what we locked
- MmUnlockPages(shared[i].pMdl);
+ if (shared[i].linear == p) {
+ /* Unlock what we locked */
+ MmUnlockPages(shared[i].pMdl);
- // Free our MDL
- IoFreeMdl(shared[i].pMdl);
+ /* Free our MDL */
+ IoFreeMdl(shared[i].pMdl);
- // Free our mem
- ExFreePool(shared[i].linear);
+ /* Free our mem */
+ ExFreePool(shared[i].linear);
- // Flag that is entry is available
- shared[i].linear = 0;
- break;
- }
- }
+ /* Flag that is entry is available */
+ shared[i].linear = 0;
+ break;
+ }
+ }
}
/****************************************************************************
@@ -245,27 +245,27 @@ void * PMAPI PM_mapPhysicalAddr(
ulong linear,length = limit+1;
int i;
- // Search table of existing mappings to see if we have already mapped
- // a region of memory that will serve this purpose.
+ /* Search table of existing mappings to see if we have already mapped */
+ /* a region of memory that will serve this purpose. */
for (i = 0; i < numMappings; i++) {
- if (maps[i].physical == base && maps[i].length == length && maps[i].isCached == isCached) {
- _PM_adjustPageTables((ulong)maps[i].linear, maps[i].length, true, isCached);
- return (void*)maps[i].linear;
- }
- }
+ if (maps[i].physical == base && maps[i].length == length && maps[i].isCached == isCached) {
+ _PM_adjustPageTables((ulong)maps[i].linear, maps[i].length, true, isCached);
+ return (void*)maps[i].linear;
+ }
+ }
if (numMappings == MAX_MEMORY_MAPPINGS)
- return NULL;
+ return NULL;
- // We did not find any previously mapped memory region, so maps it in.
+ /* We did not find any previously mapped memory region, so maps it in. */
if ((linear = _PM_mapPhysicalToLinear(base,limit,isCached)) == 0xFFFFFFFF)
- return NULL;
+ return NULL;
maps[numMappings].physical = base;
maps[numMappings].length = length;
maps[numMappings].linear = linear;
maps[numMappings].isCached = isCached;
numMappings++;
- // Grant user access to this I/O space
+ /* Grant user access to this I/O space */
_PM_adjustPageTables((ulong)linear, length, true, isCached);
return (void*)linear;
}
@@ -278,8 +278,8 @@ void PMAPI PM_freePhysicalAddr(
void *ptr,
ulong limit)
{
- // We don't free the memory mappings in here because we cache all
- // the memory mappings we create in the system for later use.
+ /* We don't free the memory mappings in here because we cache all */
+ /* the memory mappings we create in the system for later use. */
}
/****************************************************************************
@@ -291,7 +291,7 @@ void PMAPI _PM_freeMemoryMappings(void)
int i;
for (i = 0; i < numMappings; i++)
- MmUnmapIoSpace((void *)maps[i].linear,maps[i].length);
+ MmUnmapIoSpace((void *)maps[i].linear,maps[i].length);
}
/****************************************************************************
@@ -320,10 +320,10 @@ ibool PMAPI PM_getPhysicalAddrRange(
ulong linear = (ulong)p & ~0xFFF;
for (i = (length + 0xFFF) >> 12; i > 0; i--) {
- if ((*physAddress++ = PM_getPhysicalAddr((void*)linear)) == 0xFFFFFFFF)
- return false;
- linear += 4096;
- }
+ if ((*physAddress++ = PM_getPhysicalAddr((void*)linear)) == 0xFFFFFFFF)
+ return false;
+ linear += 4096;
+ }
return true;
}
@@ -340,58 +340,58 @@ void * PMAPI PM_allocLockedMem(
int i;
PHYSICAL_ADDRESS paOurAddress;
- // First find a free slot in our shared memory table
+ /* First find a free slot in our shared memory table */
for (i = 0; i < MAX_MEMORY_LOCKED; i++) {
- if (locked[i].linear == 0)
- break;
- }
+ if (locked[i].linear == 0)
+ break;
+ }
if (i == MAX_MEMORY_LOCKED)
- return NULL;
+ return NULL;
- // HighestAcceptableAddress - Specifies the highest valid physical address
- // the driver can use. For example, if a device can only reference physical
- // memory in the lower 16MB, this value would be set to 0x00000000FFFFFF.
+ /* HighestAcceptableAddress - Specifies the highest valid physical address */
+ /* the driver can use. For example, if a device can only reference physical */
+ /* memory in the lower 16MB, this value would be set to 0x00000000FFFFFF. */
paOurAddress.HighPart = 0;
if (below16M)
- paOurAddress.LowPart = 0x00FFFFFF;
+ paOurAddress.LowPart = 0x00FFFFFF;
else
- paOurAddress.LowPart = 0xFFFFFFFF;
+ paOurAddress.LowPart = 0xFFFFFFFF;
if (contiguous) {
- // Allocate from the non-paged pool (unfortunately 4MB pages)
- locked[i].linear = MmAllocateContiguousMemory(size, paOurAddress);
- if (!locked[i].linear)
- return NULL;
+ /* Allocate from the non-paged pool (unfortunately 4MB pages) */
+ locked[i].linear = MmAllocateContiguousMemory(size, paOurAddress);
+ if (!locked[i].linear)
+ return NULL;
- // Flag no MDL
- locked[i].pMdl = NULL;
+ /* Flag no MDL */
+ locked[i].pMdl = NULL;
- // Map the physical address for the memory so we can manage
- // the page tables in 4KB chunks mapped into user space.
+ /* Map the physical address for the memory so we can manage */
+ /* the page tables in 4KB chunks mapped into user space. */
- // TODO: Map this with the physical address to the linear addresss
- locked[i].mmIoMapped = locked[i].linear;
+ /* TODO: Map this with the physical address to the linear addresss */
+ locked[i].mmIoMapped = locked[i].linear;
- // Modify bits to grant user access, flag not cached
- _PM_adjustPageTables((ulong)locked[i].mmIoMapped, size, true, false);
- return (void*)locked[i].mmIoMapped;
- }
+ /* Modify bits to grant user access, flag not cached */
+ _PM_adjustPageTables((ulong)locked[i].mmIoMapped, size, true, false);
+ return (void*)locked[i].mmIoMapped;
+ }
else {
- // Allocate from the paged pool
- locked[i].linear = ExAllocatePool(PagedPool, size);
- if (!locked[i].linear)
- return NULL;
+ /* Allocate from the paged pool */
+ locked[i].linear = ExAllocatePool(PagedPool, size);
+ if (!locked[i].linear)
+ return NULL;
- // Create a list to manage this allocation
- locked[i].pMdl = IoAllocateMdl(locked[i].linear,size,FALSE,FALSE,(PIRP) NULL);
+ /* Create a list to manage this allocation */
+ locked[i].pMdl = IoAllocateMdl(locked[i].linear,size,FALSE,FALSE,(PIRP) NULL);
- // Lock this allocation in memory
- MmProbeAndLockPages(locked[i].pMdl,KernelMode,IoModifyAccess);
+ /* Lock this allocation in memory */
+ MmProbeAndLockPages(locked[i].pMdl,KernelMode,IoModifyAccess);
- // Modify bits to grant user access, flag not cached
- _PM_adjustPageTables((ulong)locked[i].linear, size, true, false);
- return (void*)locked[i].linear;
- }
+ /* Modify bits to grant user access, flag not cached */
+ _PM_adjustPageTables((ulong)locked[i].linear, size, true, false);
+ return (void*)locked[i].linear;
+ }
}
/****************************************************************************
@@ -407,27 +407,27 @@ void PMAPI PM_freeLockedMem(
/* Find a locked memory block in our table and free it */
for (i = 0; i < MAX_MEMORY_LOCKED; i++) {
- if (locked[i].linear == p) {
- // An Mdl indicates that we used the paged pool, and locked it,
- // so now we have to unlock, free the MDL, and free paged
- if (locked[i].pMdl) {
- // Unlock what we locked and free the Mdl
- MmUnlockPages(locked[i].pMdl);
- IoFreeMdl(locked[i].pMdl);
- ExFreePool(locked[i].linear);
- }
- else {
- // TODO: Free the mmIoMap mapping for the memory!
-
- // Free non-paged pool
- MmFreeContiguousMemory(locked[i].linear);
- }
-
- // Flag that is entry is available
- locked[i].linear = 0;
- break;
- }
- }
+ if (locked[i].linear == p) {
+ /* An Mdl indicates that we used the paged pool, and locked it, */
+ /* so now we have to unlock, free the MDL, and free paged */
+ if (locked[i].pMdl) {
+ /* Unlock what we locked and free the Mdl */
+ MmUnlockPages(locked[i].pMdl);
+ IoFreeMdl(locked[i].pMdl);
+ ExFreePool(locked[i].linear);
+ }
+ else {
+ /* TODO: Free the mmIoMap mapping for the memory! */
+
+ /* Free non-paged pool */
+ MmFreeContiguousMemory(locked[i].linear);
+ }
+
+ /* Flag that is entry is available */
+ locked[i].linear = 0;
+ break;
+ }
+ }
}
/****************************************************************************
@@ -437,11 +437,11 @@ Allocates a page aligned and page sized block of memory
void * PMAPI PM_allocPage(
ibool locked)
{
- // Allocate the memory from the non-paged pool if we want the memory
- // to be locked.
+ /* Allocate the memory from the non-paged pool if we want the memory */
+ /* to be locked. */
return ExAllocatePool(
- locked ? NonPagedPoolCacheAligned : PagedPoolCacheAligned,
- PAGE_SIZE);
+ locked ? NonPagedPoolCacheAligned : PagedPoolCacheAligned,
+ PAGE_SIZE);
}
/****************************************************************************
@@ -465,11 +465,11 @@ int PMAPI PM_lockDataPages(
{
MDL *pMdl;
- // Create a list to manage this allocation
+ /* Create a list to manage this allocation */
if ((pMdl = IoAllocateMdl(p,len,FALSE,FALSE,(PIRP)NULL)) == NULL)
- return false;
+ return false;
- // Lock this allocation in memory
+ /* Lock this allocation in memory */
MmProbeAndLockPages(pMdl,KernelMode,IoModifyAccess);
*((PMDL*)(&lh->h)) = pMdl;
return true;
@@ -485,11 +485,11 @@ int PMAPI PM_unlockDataPages(
PM_lockHandle *lh)
{
if (p && lh) {
- // Unlock what we locked
- MDL *pMdl = *((PMDL*)(&lh->h));
- MmUnlockPages(pMdl);
- IoFreeMdl(pMdl);
- }
+ /* Unlock what we locked */
+ MDL *pMdl = *((PMDL*)(&lh->h));
+ MmUnlockPages(pMdl);
+ IoFreeMdl(pMdl);
+ }
return true;
}
@@ -516,4 +516,3 @@ int PMAPI PM_unlockCodePages(
{
return PM_unlockDataPages((void*)p,len,lh);
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/oshdr.h b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/oshdr.h
index 3f747bb9ce..65b7bae23c 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/oshdr.h
+++ b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/oshdr.h
@@ -42,5 +42,4 @@
UNICODE_STRING * _PM_CStringToUnicodeString(const char *cstr);
void _PM_FreeUnicodeString(UNICODE_STRING *uniStr);
-#endif // __NTDRV_OSHDR_H
-
+#endif /* __NTDRV_OSHDR_H */
diff --git a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/pm.c b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/pm.c
index d4bbe228b7..c6606314c1 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/pm.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/pm.c
@@ -1,7 +1,7 @@
/****************************************************************************
*
* SciTech OS Portability Manager Library
-*
+*
* ========================================================================
*
* The contents of this file are subject to the SciTech MGL Public
@@ -88,9 +88,9 @@ void PMAPI PM_backslash(char *s)
{
uint pos = strlen(s);
if (s[pos-1] != '\\') {
- s[pos] = '\\';
- s[pos+1] = '\0';
- }
+ s[pos] = '\\';
+ s[pos+1] = '\0';
+ }
}
/****************************************************************************
@@ -116,25 +116,25 @@ void PMAPI PM_fatalError(
ULONG len;
if (fatalErrorCleanup)
- fatalErrorCleanup();
+ fatalErrorCleanup();
-#ifdef DBG // Send output to debugger, just return so as not to force a reboot
-#pragma message("INFO: building for debug, PM_fatalError() re-routed")
- DBGMSG2("SDDHELP> PM_fatalError(): ERROR: %s\n", msg);
+#ifdef DBG /* Send output to debugger, just return so as not to force a reboot */
+#pragma message("INFO: building for debug, PM_fatalError() re-routed")
+ DBGMSG2("SDDHELP> PM_fatalError(): ERROR: %s\n", msg);
return ;
#endif
- // KeBugCheckEx brings down the system in a controlled
- // manner when the caller discovers an unrecoverable
- // inconsistency that would corrupt the system if
- // the caller continued to run.
- //
- // hack - dump the first 20 chars in hex using the variables
- // provided - Each ULONG is equal to four characters...
+ /* KeBugCheckEx brings down the system in a controlled */
+ /* manner when the caller discovers an unrecoverable */
+ /* inconsistency that would corrupt the system if */
+ /* the caller continued to run. */
+ /* */
+ /* hack - dump the first 20 chars in hex using the variables */
+ /* provided - Each ULONG is equal to four characters... */
for(len = 0; len < 20; len++)
- if (msg[len] == (char)0)
- break;
+ if (msg[len] == (char)0)
+ break;
- // This looks bad but it's quick and reliable...
+ /* This looks bad but it's quick and reliable... */
p = (char *)&BugCheckCode;
if(len > 0) p[3] = msg[0];
if(len > 1) p[2] = msg[1];
@@ -165,7 +165,7 @@ void PMAPI PM_fatalError(
if(len > 18) p[1] = msg[18];
if(len > 19) p[0] = msg[19];
- // Halt the system!
+ /* Halt the system! */
KeBugCheckEx(BugCheckCode, MoreBugCheckData[0], MoreBugCheckData[1], MoreBugCheckData[2], MoreBugCheckData[3]);
}
@@ -209,50 +209,50 @@ static ibool REG_queryString(
STRING stringdata;
UNICODE_STRING unidata;
- // Convert strings to UniCode
+ /* Convert strings to UniCode */
status = false;
if ((uniKey = _PM_CStringToUnicodeString(szKey)) == NULL)
- goto Exit;
+ goto Exit;
if ((uniValue = _PM_CStringToUnicodeString(szValue)) == NULL)
- goto Exit;
+ goto Exit;
- // Open the key
+ /* Open the key */
InitializeObjectAttributes( &keyAttributes,
- uniKey,
- OBJ_CASE_INSENSITIVE,
- NULL,
- NULL );
+ uniKey,
+ OBJ_CASE_INSENSITIVE,
+ NULL,
+ NULL );
rval = ZwOpenKey( &Handle,
- KEY_ALL_ACCESS,
- &keyAttributes );
+ KEY_ALL_ACCESS,
+ &keyAttributes );
if (!NT_SUCCESS(rval))
- goto Exit;
+ goto Exit;
- // Query the value
+ /* Query the value */
length = sizeof (KEY_VALUE_FULL_INFORMATION)
- + size * sizeof(WCHAR);
+ + size * sizeof(WCHAR);
if ((fullInfo = ExAllocatePool (PagedPool, length)) == NULL)
- goto Exit;
+ goto Exit;
RtlZeroMemory(fullInfo, length);
rval = ZwQueryValueKey (Handle,
- uniValue,
- KeyValueFullInformation,
- fullInfo,
- length,
- &length);
+ uniValue,
+ KeyValueFullInformation,
+ fullInfo,
+ length,
+ &length);
if (NT_SUCCESS (rval)) {
- // Create the UniCode string so we can convert it
- unidata.Buffer = (PWCHAR)(((PCHAR)fullInfo) + fullInfo->DataOffset);
- unidata.Length = (USHORT)fullInfo->DataLength;
- unidata.MaximumLength = (USHORT)fullInfo->DataLength + sizeof(WCHAR);
-
- // Convert unicode univalue to ansi string.
- rval = RtlUnicodeStringToAnsiString(&stringdata, &unidata, TRUE);
- if (NT_SUCCESS(rval)) {
- strcpy(value,stringdata.Buffer);
- status = true;
- }
- }
+ /* Create the UniCode string so we can convert it */
+ unidata.Buffer = (PWCHAR)(((PCHAR)fullInfo) + fullInfo->DataOffset);
+ unidata.Length = (USHORT)fullInfo->DataLength;
+ unidata.MaximumLength = (USHORT)fullInfo->DataLength + sizeof(WCHAR);
+
+ /* Convert unicode univalue to ansi string. */
+ rval = RtlUnicodeStringToAnsiString(&stringdata, &unidata, TRUE);
+ if (NT_SUCCESS(rval)) {
+ strcpy(value,stringdata.Buffer);
+ status = true;
+ }
+ }
Exit:
if (fullInfo) ExFreePool(fullInfo);
@@ -269,7 +269,7 @@ char PMAPI PM_getBootDrive(void)
{
char path[256];
if (REG_queryString(szNTWindowsKey,szNTSystemRoot,path,sizeof(path)))
- return 'c';
+ return 'c';
return path[0];
}
@@ -291,12 +291,12 @@ const char * PMAPI PM_getNucleusPath(void)
static char path[256];
if (strlen(_PM_nucleusPath) > 0) {
- strcpy(path,_PM_nucleusPath);
- PM_backslash(path);
- return path;
- }
+ strcpy(path,_PM_nucleusPath);
+ PM_backslash(path);
+ return path;
+ }
if (!REG_queryString(szNTWindowsKey,szNTSystemRoot,path,sizeof(path)))
- strcpy(path,"c:\\winnt");
+ strcpy(path,"c:\\winnt");
PM_backslash(path);
strcat(path,"system32\\nucleus");
return path;
@@ -333,9 +333,9 @@ const char * PMAPI PM_getMachineName(void)
static char name[256];
if (REG_queryString(szMachineNameKey,szMachineName,name,sizeof(name)))
- return name;
+ return name;
if (REG_queryString(szMachineNameKeyNT,szMachineName,name,sizeof(name)))
- return name;
+ return name;
return "Unknown";
}
@@ -345,7 +345,7 @@ Check if a key has been pressed.
****************************************************************************/
int PMAPI PM_kbhit(void)
{
- // Not used in NT drivers
+ /* Not used in NT drivers */
return true;
}
@@ -355,7 +355,7 @@ Wait for and return the next keypress.
****************************************************************************/
int PMAPI PM_getch(void)
{
- // Not used in NT drivers
+ /* Not used in NT drivers */
return 0xD;
}
@@ -372,7 +372,7 @@ PM_HWND PMAPI PM_openConsole(
int bpp,
ibool fullScreen)
{
- // Not used in NT drivers
+ /* Not used in NT drivers */
(void)hwndUser;
(void)device;
(void)xRes;
@@ -388,7 +388,7 @@ Find the size of the console state buffer.
****************************************************************************/
int PMAPI PM_getConsoleStateSize(void)
{
- // Not used in NT drivers
+ /* Not used in NT drivers */
return 1;
}
@@ -400,7 +400,7 @@ void PMAPI PM_saveConsoleState(
void *stateBuf,
PM_HWND hwndConsole)
{
- // Not used in NT drivers
+ /* Not used in NT drivers */
(void)stateBuf;
(void)hwndConsole;
}
@@ -412,7 +412,7 @@ Set the suspend application callback for the fullscreen console.
void PMAPI PM_setSuspendAppCallback(
PM_saveState_cb saveState)
{
- // Not used in NT drivers
+ /* Not used in NT drivers */
(void)saveState;
}
@@ -424,7 +424,7 @@ void PMAPI PM_restoreConsoleState(
const void *stateBuf,
PM_HWND hwndConsole)
{
- // Not used in NT drivers
+ /* Not used in NT drivers */
(void)stateBuf;
(void)hwndConsole;
}
@@ -436,7 +436,7 @@ Close the fullscreen console.
void PMAPI PM_closeConsole(
PM_HWND hwndConsole)
{
- // Not used in NT drivers
+ /* Not used in NT drivers */
(void)hwndConsole;
}
@@ -475,7 +475,7 @@ void * PMAPI PM_mapToProcess(
void *base,
ulong limit)
{
- // Not used anymore
+ /* Not used anymore */
(void)base;
(void)limit;
return NULL;
@@ -491,7 +491,7 @@ ibool PMAPI PM_doBIOSPOST(
void *mappedBIOS,
ulong BIOSLen)
{
- // This may not be possible in NT and should be done by the OS anyway
+ /* This may not be possible in NT and should be done by the OS anyway */
(void)axVal;
(void)BIOSPhysAddr;
(void)mappedBIOS;
@@ -505,7 +505,7 @@ Return a pointer to the real mode BIOS data area.
****************************************************************************/
void * PMAPI PM_getBIOSPointer(void)
{
- // Note that on NT this probably does not do what we expect!
+ /* Note that on NT this probably does not do what we expect! */
return PM_mapPhysicalAddr(0x400, 0x1000, true);
}
@@ -525,7 +525,7 @@ Sleep for the specified number of milliseconds.
void PMAPI PM_sleep(
ulong milliseconds)
{
- // We never use this in NT drivers
+ /* We never use this in NT drivers */
(void)milliseconds;
}
@@ -535,14 +535,14 @@ Return the base I/O port for the specified COM port.
****************************************************************************/
int PMAPI PM_getCOMPort(int port)
{
- // TODO: Re-code this to determine real values using the Plug and Play
- // manager for the OS.
+ /* TODO: Re-code this to determine real values using the Plug and Play */
+ /* manager for the OS. */
switch (port) {
- case 0: return 0x3F8;
- case 1: return 0x2F8;
- case 2: return 0x3E8;
- case 3: return 0x2E8;
- }
+ case 0: return 0x3F8;
+ case 1: return 0x2F8;
+ case 2: return 0x3E8;
+ case 3: return 0x2E8;
+ }
return 0;
}
@@ -552,13 +552,13 @@ Return the base I/O port for the specified LPT port.
****************************************************************************/
int PMAPI PM_getLPTPort(int port)
{
- // TODO: Re-code this to determine real values using the Plug and Play
- // manager for the OS.
+ /* TODO: Re-code this to determine real values using the Plug and Play */
+ /* manager for the OS. */
switch (port) {
- case 0: return 0x3BC;
- case 1: return 0x378;
- case 2: return 0x278;
- }
+ case 0: return 0x3BC;
+ case 1: return 0x378;
+ case 2: return 0x278;
+ }
return 0;
}
@@ -580,7 +580,7 @@ OS specific shared libraries not supported inside a VxD
PM_MODULE PMAPI PM_loadLibrary(
const char *szDLLName)
{
- // Not used in NT drivers
+ /* Not used in NT drivers */
(void)szDLLName;
return NULL;
}
@@ -593,7 +593,7 @@ void * PMAPI PM_getProcAddress(
PM_MODULE hModule,
const char *szProcName)
{
- // Not used in NT drivers
+ /* Not used in NT drivers */
(void)hModule;
(void)szProcName;
return NULL;
@@ -606,7 +606,7 @@ OS specific shared libraries not supported inside a VxD
void PMAPI PM_freeLibrary(
PM_MODULE hModule)
{
- // Not used in NT drivers
+ /* Not used in NT drivers */
(void)hModule;
}
@@ -618,9 +618,9 @@ void *PMAPI PM_findFirstFile(
const char *filename,
PM_findData *findData)
{
- // TODO: This function should start a directory enumeration search
- // given the filename (with wildcards). The data should be
- // converted and returned in the findData standard form.
+ /* TODO: This function should start a directory enumeration search */
+ /* given the filename (with wildcards). The data should be */
+ /* converted and returned in the findData standard form. */
(void)filename;
(void)findData;
return PM_FILE_INVALID;
@@ -634,10 +634,10 @@ ibool PMAPI PM_findNextFile(
void *handle,
PM_findData *findData)
{
- // TODO: This function should find the next file in directory enumeration
- // search given the search criteria defined in the call to
- // PM_findFirstFile. The data should be converted and returned
- // in the findData standard form.
+ /* TODO: This function should find the next file in directory enumeration */
+ /* search given the search criteria defined in the call to */
+ /* PM_findFirstFile. The data should be converted and returned */
+ /* in the findData standard form. */
(void)handle;
(void)findData;
return false;
@@ -650,8 +650,8 @@ Function to close the find process
void PMAPI PM_findClose(
void *handle)
{
- // TODO: This function should close the find process. This may do
- // nothing for some OS'es.
+ /* TODO: This function should close the find process. This may do */
+ /* nothing for some OS'es. */
(void)handle;
}
@@ -671,7 +671,7 @@ numbering is:
ibool PMAPI PM_driveValid(
char drive)
{
- // Not supported in NT drivers
+ /* Not supported in NT drivers */
(void)drive;
return false;
}
@@ -687,7 +687,7 @@ void PMAPI PM_getdcwd(
char *dir,
int len)
{
- // Not supported in NT drivers
+ /* Not supported in NT drivers */
(void)drive;
(void)dir;
(void)len;
@@ -733,67 +733,67 @@ void PMAPI PM_setFileAttr(
char kernelFilename[PM_MAX_PATH+5];
ULONG FileAttributes = 0;
- // Convert file attribute flags
+ /* Convert file attribute flags */
if (attrib & PM_FILE_READONLY)
- FileAttributes |= FILE_ATTRIBUTE_READONLY;
+ FileAttributes |= FILE_ATTRIBUTE_READONLY;
if (attrib & PM_FILE_ARCHIVE)
- FileAttributes |= FILE_ATTRIBUTE_ARCHIVE;
+ FileAttributes |= FILE_ATTRIBUTE_ARCHIVE;
if (attrib & PM_FILE_HIDDEN)
- FileAttributes |= FILE_ATTRIBUTE_HIDDEN;
+ FileAttributes |= FILE_ATTRIBUTE_HIDDEN;
if (attrib & PM_FILE_SYSTEM)
- FileAttributes |= FILE_ATTRIBUTE_SYSTEM;
+ FileAttributes |= FILE_ATTRIBUTE_SYSTEM;
- // Add prefix for addressing the file system. "\??\" is short for "\DosDevices\"
+ /* Add prefix for addressing the file system. "\??\" is short for "\DosDevices\" */
strcpy(kernelFilename, "\\??\\");
strcat(kernelFilename, filename);
- // Convert filename string to ansi string
+ /* Convert filename string to ansi string */
if ((uniFile = _PM_CStringToUnicodeString(kernelFilename)) == NULL)
- goto Exit;
+ goto Exit;
- // Must open a file to query it's attributes
+ /* Must open a file to query it's attributes */
InitializeObjectAttributes (&ObjectAttributes,
- uniFile,
- OBJ_CASE_INSENSITIVE,
- NULL,
- NULL );
+ uniFile,
+ OBJ_CASE_INSENSITIVE,
+ NULL,
+ NULL );
status = ZwCreateFile( &FileHandle,
- DesiredAccess | SYNCHRONIZE,
- &ObjectAttributes,
- &IoStatusBlock,
- NULL, //AllocationSize OPTIONAL,
- FILE_ATTRIBUTE_NORMAL,
- ShareAccess,
- CreateDisposition,
- FILE_RANDOM_ACCESS, //CreateOptions,
- NULL, //EaBuffer OPTIONAL,
- 0 //EaLength (required if EaBuffer)
- );
+ DesiredAccess | SYNCHRONIZE,
+ &ObjectAttributes,
+ &IoStatusBlock,
+ NULL, /*AllocationSize OPTIONAL, */
+ FILE_ATTRIBUTE_NORMAL,
+ ShareAccess,
+ CreateDisposition,
+ FILE_RANDOM_ACCESS, /*CreateOptions, */
+ NULL, /*EaBuffer OPTIONAL, */
+ 0 /*EaLength (required if EaBuffer) */
+ );
if (!NT_SUCCESS (status))
- goto Exit;
+ goto Exit;
- // Query timestamps
+ /* Query timestamps */
status = ZwQueryInformationFile(FileHandle,
- &IoStatusBlock,
- &FileBasic,
- sizeof(FILE_BASIC_INFORMATION),
- FileBasicInformation
- );
+ &IoStatusBlock,
+ &FileBasic,
+ sizeof(FILE_BASIC_INFORMATION),
+ FileBasicInformation
+ );
if (!NT_SUCCESS (status))
- goto Exit;
+ goto Exit;
- // Change the four bits we change
+ /* Change the four bits we change */
FileBasic.FileAttributes &= ~(FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_ARCHIVE
- | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM);
+ | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM);
FileBasic.FileAttributes |= FileAttributes;
- // Set timestamps
+ /* Set timestamps */
ZwSetInformationFile( FileHandle,
- &IoStatusBlock,
- &FileBasic,
- sizeof(FILE_BASIC_INFORMATION),
- FileBasicInformation
- );
+ &IoStatusBlock,
+ &FileBasic,
+ sizeof(FILE_BASIC_INFORMATION),
+ FileBasicInformation
+ );
Exit:
if (FileHandle) ZwClose(FileHandle);
@@ -821,54 +821,54 @@ uint PMAPI PM_getFileAttr(
ULONG FileAttributes = 0;
uint retval = 0;
- // Add prefix for addressing the file system. "\??\" is short for "\DosDevices\"
+ /* Add prefix for addressing the file system. "\??\" is short for "\DosDevices\" */
strcpy(kernelFilename, "\\??\\");
strcat(kernelFilename, filename);
- // Convert filename string to ansi string
+ /* Convert filename string to ansi string */
if ((uniFile = _PM_CStringToUnicodeString(kernelFilename)) == NULL)
- goto Exit;
+ goto Exit;
- // Must open a file to query it's attributes
+ /* Must open a file to query it's attributes */
InitializeObjectAttributes (&ObjectAttributes,
- uniFile,
- OBJ_CASE_INSENSITIVE,
- NULL,
- NULL );
+ uniFile,
+ OBJ_CASE_INSENSITIVE,
+ NULL,
+ NULL );
status = ZwCreateFile( &FileHandle,
- DesiredAccess | SYNCHRONIZE,
- &ObjectAttributes,
- &IoStatusBlock,
- NULL, //AllocationSize OPTIONAL,
- FILE_ATTRIBUTE_NORMAL,
- ShareAccess,
- CreateDisposition,
- FILE_RANDOM_ACCESS, //CreateOptions,
- NULL, //EaBuffer OPTIONAL,
- 0 //EaLength (required if EaBuffer)
- );
+ DesiredAccess | SYNCHRONIZE,
+ &ObjectAttributes,
+ &IoStatusBlock,
+ NULL, /*AllocationSize OPTIONAL, */
+ FILE_ATTRIBUTE_NORMAL,
+ ShareAccess,
+ CreateDisposition,
+ FILE_RANDOM_ACCESS, /*CreateOptions, */
+ NULL, /*EaBuffer OPTIONAL, */
+ 0 /*EaLength (required if EaBuffer) */
+ );
if (!NT_SUCCESS (status))
- goto Exit;
+ goto Exit;
- // Query timestamps
+ /* Query timestamps */
status = ZwQueryInformationFile(FileHandle,
- &IoStatusBlock,
- &FileBasic,
- sizeof(FILE_BASIC_INFORMATION),
- FileBasicInformation
- );
+ &IoStatusBlock,
+ &FileBasic,
+ sizeof(FILE_BASIC_INFORMATION),
+ FileBasicInformation
+ );
if (!NT_SUCCESS (status))
- goto Exit;
+ goto Exit;
- // Translate the file attributes
+ /* Translate the file attributes */
if (FileBasic.FileAttributes & FILE_ATTRIBUTE_READONLY)
- retval |= PM_FILE_READONLY;
+ retval |= PM_FILE_READONLY;
if (FileBasic.FileAttributes & FILE_ATTRIBUTE_ARCHIVE)
- retval |= PM_FILE_ARCHIVE;
+ retval |= PM_FILE_ARCHIVE;
if (FileBasic.FileAttributes & FILE_ATTRIBUTE_HIDDEN)
- retval |= PM_FILE_HIDDEN;
+ retval |= PM_FILE_HIDDEN;
if (FileBasic.FileAttributes & FILE_ATTRIBUTE_SYSTEM)
- retval |= PM_FILE_SYSTEM;
+ retval |= PM_FILE_SYSTEM;
Exit:
if (FileHandle) ZwClose(FileHandle);
@@ -883,7 +883,7 @@ Function to create a directory.
ibool PMAPI PM_mkdir(
const char *filename)
{
- // Not supported in NT drivers
+ /* Not supported in NT drivers */
(void)filename;
return false;
}
@@ -895,7 +895,7 @@ Function to remove a directory.
ibool PMAPI PM_rmdir(
const char *filename)
{
- // Not supported in NT drivers
+ /* Not supported in NT drivers */
(void)filename;
return false;
}
@@ -909,7 +909,7 @@ ibool PMAPI PM_getFileTime(
ibool gmTime,
PM_time *time)
{
- // Not supported in NT drivers
+ /* Not supported in NT drivers */
(void)filename;
(void)gmTime;
(void)time;
@@ -925,10 +925,9 @@ ibool PMAPI PM_setFileTime(
ibool gmTime,
PM_time *time)
{
- // Not supported in NT drivers
+ /* Not supported in NT drivers */
(void)filename;
(void)gmTime;
(void)time;
return false;
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/stdio.c b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/stdio.c
index 856215206f..658f1c80ab 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/stdio.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/stdio.c
@@ -42,7 +42,7 @@ FILE * fopen(
const char *filename,
const char *mode)
{
- ACCESS_MASK DesiredAccess; // for ZwCreateFile...
+ ACCESS_MASK DesiredAccess; /* for ZwCreateFile... */
OBJECT_ATTRIBUTES ObjectAttributes;
ULONG ShareAccess;
ULONG CreateDisposition;
@@ -56,86 +56,86 @@ FILE * fopen(
char kernelFilename[PM_MAX_PATH+5];
FILE *f;
- // Add prefix for addressing the file system. "\??\" is short for "\DosDevices\"
+ /* Add prefix for addressing the file system. "\??\" is short for "\DosDevices\" */
strcpy(kernelFilename, "\\??\\");
strcat(kernelFilename, filename);
if ((f = PM_malloc(sizeof(FILE))) == NULL)
- goto Error;
+ goto Error;
f->offset = 0;
f->text = (mode[1] == 't' || mode[2] == 't');
f->writemode = (mode[0] == 'w') || (mode[0] == 'a');
if (mode[0] == 'r') {
- // omode = OPEN_ACCESS_READONLY | OPEN_SHARE_COMPATIBLE;
- // action = ACTION_IFEXISTS_OPEN | ACTION_IFNOTEXISTS_FAIL;
- DesiredAccess = GENERIC_READ;
- ShareAccess = FILE_SHARE_READ | FILE_SHARE_WRITE;
- CreateDisposition = FILE_OPEN;
- }
+ /* omode = OPEN_ACCESS_READONLY | OPEN_SHARE_COMPATIBLE; */
+ /* action = ACTION_IFEXISTS_OPEN | ACTION_IFNOTEXISTS_FAIL; */
+ DesiredAccess = GENERIC_READ;
+ ShareAccess = FILE_SHARE_READ | FILE_SHARE_WRITE;
+ CreateDisposition = FILE_OPEN;
+ }
else if (mode[0] == 'w') {
- // omode = OPEN_ACCESS_WRITEONLY | OPEN_SHARE_COMPATIBLE;
- // action = ACTION_IFEXISTS_TRUNCATE | ACTION_IFNOTEXISTS_CREATE;
- DesiredAccess = GENERIC_WRITE;
- ShareAccess = FILE_SHARE_READ | FILE_SHARE_WRITE;
- CreateDisposition = FILE_SUPERSEDE;
- }
+ /* omode = OPEN_ACCESS_WRITEONLY | OPEN_SHARE_COMPATIBLE; */
+ /* action = ACTION_IFEXISTS_TRUNCATE | ACTION_IFNOTEXISTS_CREATE; */
+ DesiredAccess = GENERIC_WRITE;
+ ShareAccess = FILE_SHARE_READ | FILE_SHARE_WRITE;
+ CreateDisposition = FILE_SUPERSEDE;
+ }
else {
- // omode = OPEN_ACCESS_READWRITE | OPEN_SHARE_COMPATIBLE;
- // action = ACTION_IFEXISTS_OPEN | ACTION_IFNOTEXISTS_CREATE;
- DesiredAccess = GENERIC_READ | GENERIC_WRITE;
- ShareAccess = FILE_SHARE_READ;
- CreateDisposition = FILE_OPEN_IF;
- }
+ /* omode = OPEN_ACCESS_READWRITE | OPEN_SHARE_COMPATIBLE; */
+ /* action = ACTION_IFEXISTS_OPEN | ACTION_IFNOTEXISTS_CREATE; */
+ DesiredAccess = GENERIC_READ | GENERIC_WRITE;
+ ShareAccess = FILE_SHARE_READ;
+ CreateDisposition = FILE_OPEN_IF;
+ }
- // Convert filename string to ansi string and then to UniCode string
+ /* Convert filename string to ansi string and then to UniCode string */
if ((uniFile = _PM_CStringToUnicodeString(kernelFilename)) == NULL)
- return NULL;
+ return NULL;
- // Create the file
+ /* Create the file */
InitializeObjectAttributes (&ObjectAttributes,
- uniFile,
- OBJ_CASE_INSENSITIVE,
- NULL,
- NULL);
+ uniFile,
+ OBJ_CASE_INSENSITIVE,
+ NULL,
+ NULL);
status = ZwCreateFile( &FileHandle,
- DesiredAccess | SYNCHRONIZE,
- &ObjectAttributes,
- &IoStatusBlock,
- NULL, // AllocationSize OPTIONAL,
- FILE_ATTRIBUTE_NORMAL,
- ShareAccess,
- CreateDisposition,
- FILE_RANDOM_ACCESS, // CreateOptions,
- NULL, // EaBuffer OPTIONAL,
- 0 // EaLength (required if EaBuffer)
- );
+ DesiredAccess | SYNCHRONIZE,
+ &ObjectAttributes,
+ &IoStatusBlock,
+ NULL, /* AllocationSize OPTIONAL, */
+ FILE_ATTRIBUTE_NORMAL,
+ ShareAccess,
+ CreateDisposition,
+ FILE_RANDOM_ACCESS, /* CreateOptions, */
+ NULL, /* EaBuffer OPTIONAL, */
+ 0 /* EaLength (required if EaBuffer) */
+ );
if (!NT_SUCCESS (status))
- goto Error;
+ goto Error;
f->handle = (int)FileHandle;
- // Determine size of the file
+ /* Determine size of the file */
status = ZwQueryInformationFile( FileHandle,
- &IoStatusBlock,
- &FileInformation,
- sizeof(FILE_STANDARD_INFORMATION),
- FileStandardInformation
- );
+ &IoStatusBlock,
+ &FileInformation,
+ sizeof(FILE_STANDARD_INFORMATION),
+ FileStandardInformation
+ );
if (!NT_SUCCESS (status))
- goto Error;
+ goto Error;
f->filesize = FileInformation.EndOfFile.LowPart;
- // Move to the end of the file if we are appending
+ /* Move to the end of the file if we are appending */
if (mode[0] == 'a') {
- FilePosition.CurrentByteOffset.HighPart = 0;
- FilePosition.CurrentByteOffset.LowPart = f->filesize;
- status = ZwSetInformationFile( FileHandle,
- &IoStatusBlock,
- &FilePosition,
- sizeof(FILE_POSITION_INFORMATION),
- FilePositionInformation
- );
- if (!NT_SUCCESS (status))
- goto Error;
- }
+ FilePosition.CurrentByteOffset.HighPart = 0;
+ FilePosition.CurrentByteOffset.LowPart = f->filesize;
+ status = ZwSetInformationFile( FileHandle,
+ &IoStatusBlock,
+ &FilePosition,
+ sizeof(FILE_POSITION_INFORMATION),
+ FilePositionInformation
+ );
+ if (!NT_SUCCESS (status))
+ goto Error;
+ }
return f;
Error:
@@ -158,21 +158,21 @@ size_t fread(
IO_STATUS_BLOCK IoStatusBlock;
LARGE_INTEGER ByteOffset;
- // Read any extra bytes from the file
+ /* Read any extra bytes from the file */
ByteOffset.HighPart = 0;
ByteOffset.LowPart = f->offset;
status = ZwReadFile( (HANDLE)f->handle,
- NULL, //IN HANDLE Event OPTIONAL,
- NULL, // IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
- NULL, // IN PVOID ApcContext OPTIONAL,
- &IoStatusBlock,
- ptr, // OUT PVOID Buffer,
- size * n, //IN ULONG Length,
- &ByteOffset, //OPTIONAL,
- NULL //IN PULONG Key OPTIONAL
- );
+ NULL, /*IN HANDLE Event OPTIONAL, */
+ NULL, /* IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, */
+ NULL, /* IN PVOID ApcContext OPTIONAL, */
+ &IoStatusBlock,
+ ptr, /* OUT PVOID Buffer, */
+ size * n, /*IN ULONG Length, */
+ &ByteOffset, /*OPTIONAL, */
+ NULL /*IN PULONG Key OPTIONAL */
+ );
if (!NT_SUCCESS (status))
- return 0;
+ return 0;
f->offset += IoStatusBlock.Information;
return IoStatusBlock.Information / size;
}
@@ -192,24 +192,24 @@ size_t fwrite(
LARGE_INTEGER ByteOffset;
if (!f->writemode)
- return 0;
+ return 0;
ByteOffset.HighPart = 0;
ByteOffset.LowPart = f->offset;
status = ZwWriteFile( (HANDLE)f->handle,
- NULL, //IN HANDLE Event OPTIONAL,
- NULL, // IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
- NULL, // IN PVOID ApcContext OPTIONAL,
- &IoStatusBlock,
- (void*)ptr, // OUT PVOID Buffer,
- size * n, //IN ULONG Length,
- &ByteOffset, //OPTIONAL,
- NULL //IN PULONG Key OPTIONAL
- );
+ NULL, /*IN HANDLE Event OPTIONAL, */
+ NULL, /* IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, */
+ NULL, /* IN PVOID ApcContext OPTIONAL, */
+ &IoStatusBlock,
+ (void*)ptr, /* OUT PVOID Buffer, */
+ size * n, /*IN ULONG Length, */
+ &ByteOffset, /*OPTIONAL, */
+ NULL /*IN PULONG Key OPTIONAL */
+ );
if (!NT_SUCCESS (status))
- return 0;
+ return 0;
f->offset += IoStatusBlock.Information;
if (f->offset > f->filesize)
- f->filesize = f->offset;
+ f->filesize = f->offset;
return IoStatusBlock.Information / size;
}
@@ -220,7 +220,7 @@ NT driver implementation of the ANSI C fflush function.
int fflush(
FILE *f)
{
- // Nothing to do here as we are not doing buffered I/O
+ /* Nothing to do here as we are not doing buffered I/O */
(void)f;
return 0;
}
@@ -239,21 +239,21 @@ int fseek(
IO_STATUS_BLOCK IoStatusBlock;
if (whence == 0)
- f->offset = offset;
+ f->offset = offset;
else if (whence == 1)
- f->offset += offset;
+ f->offset += offset;
else if (whence == 2)
- f->offset = f->filesize + offset;
+ f->offset = f->filesize + offset;
FilePosition.CurrentByteOffset.HighPart = 0;
FilePosition.CurrentByteOffset.LowPart = f->offset;
status = ZwSetInformationFile( (HANDLE)f->handle,
- &IoStatusBlock,
- &FilePosition,
- sizeof(FILE_POSITION_INFORMATION),
- FilePositionInformation
- );
+ &IoStatusBlock,
+ &FilePosition,
+ sizeof(FILE_POSITION_INFORMATION),
+ FilePositionInformation
+ );
if (!NT_SUCCESS (status))
- return -1;
+ return -1;
return 0;
}
@@ -289,19 +289,19 @@ char *fgets(
int len;
char *cs;
- // Read the entire buffer into memory (our functions are unbuffered!)
+ /* Read the entire buffer into memory (our functions are unbuffered!) */
if ((len = fread(s,1,n,f)) == 0)
- return NULL;
+ return NULL;
- // Search for '\n' or end of string
+ /* Search for '\n' or end of string */
if (n > len)
- n = len;
+ n = len;
cs = s;
while (--n > 0) {
- if (*cs == '\n')
- break;
- cs++;
- }
+ if (*cs == '\n')
+ break;
+ cs++;
+ }
*cs = '\0';
return s;
}
@@ -328,4 +328,3 @@ int fclose(
PM_free(f);
return 0;
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/stdlib.c b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/stdlib.c
index d7705130b7..bbf0cbf4a7 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/stdlib.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/stdlib.c
@@ -54,7 +54,7 @@ void * calloc(
{
void *p = PM_mallocShared(nelem * size);
if (p)
- memset(p,0,nelem * size);
+ memset(p,0,nelem * size);
return p;
}
@@ -68,9 +68,9 @@ void * realloc(
{
void *p = PM_mallocShared(size);
if (p) {
- memcpy(p,ptr,size);
- PM_freeShared(ptr);
- }
+ memcpy(p,ptr,size);
+ PM_freeShared(ptr);
+ }
return p;
}
@@ -102,21 +102,21 @@ UNICODE_STRING *_PM_CStringToUnicodeString(
ANSI_STRING ansiStr;
UNICODE_STRING *uniStr;
- // Allocate memory for the string structure
+ /* Allocate memory for the string structure */
if ((uniStr = ExAllocatePool(NonPagedPool, sizeof(UNICODE_STRING))) == NULL)
- return NULL;
+ return NULL;
- // Allocate memory for the wide string itself
+ /* Allocate memory for the wide string itself */
length = (strlen(cstr) * sizeof(WCHAR)) + sizeof(WCHAR);
if ((uniStr->Buffer = ExAllocatePool(NonPagedPool, length)) == NULL) {
- ExFreePool(uniStr);
- return NULL;
- }
+ ExFreePool(uniStr);
+ return NULL;
+ }
RtlZeroMemory(uniStr->Buffer, length);
uniStr->Length = 0;
uniStr->MaximumLength = (USHORT)length;
- // Convert filename string to ansi string and then to UniCode string
+ /* Convert filename string to ansi string and then to UniCode string */
RtlInitAnsiString(&ansiStr, cstr);
RtlAnsiStringToUnicodeString(uniStr, &ansiStr, FALSE);
return uniStr;
@@ -133,8 +133,7 @@ void _PM_FreeUnicodeString(
UNICODE_STRING *uniStr)
{
if (uniStr) {
- ExFreePool(uniStr->Buffer);
- ExFreePool(uniStr);
- }
+ ExFreePool(uniStr->Buffer);
+ ExFreePool(uniStr);
+ }
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/ztimer.c b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/ztimer.c
index ef27294107..f4c4bd41b2 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/ztimer.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/ztimer.c
@@ -121,4 +121,3 @@ passed, so if this happens we will be generating erronous results.
****************************************************************************/
ulong __ULZElapsedTime(ulong start,ulong finish)
{ return finish - start; }
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/os2/event.c b/board/MAI/bios_emulator/scitech/src/pm/os2/event.c
index 706e84d6f3..91cc19b915 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/os2/event.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/os2/event.c
@@ -87,8 +87,8 @@ Converts a mickey movement value to a pixel adjustment value.
static int MickeyToPixel(
int mickey)
{
- // TODO: We can add some code in here to handle 'acceleration' for
- // the mouse cursor. For now just use the mickeys.
+ /* TODO: We can add some code in here to handle 'acceleration' for */
+ /* the mouse cursor. For now just use the mickeys. */
return mickey;
}
@@ -116,196 +116,196 @@ static void _EVT_pumpMessages(void)
/* Pump all keyboard messages from our circular buffer */
for (;;) {
- /* Check that the monitor thread is still running */
- if (!bMonRunning)
- PM_fatalError("Keyboard monitor thread died!");
-
- /* Protect keypacket buffer with mutex */
- DosRequestMutexSem(hmtxKeyBuf, SEM_INDEFINITE_WAIT);
- if (kpHead == kpTail) {
- DosReleaseMutexSem(hmtxKeyBuf);
- break;
- }
-
- noInput = FALSE;
-
- /* Read packet from circular buffer and remove it */
- memcpy(&kp, &keyMonPkts[kpTail], sizeof(KEYPACKET));
- if (++kpTail == KEYBUFSIZE)
- kpTail = 0;
- DosReleaseMutexSem(hmtxKeyBuf);
-
- /* Compensate for the 0xE0 character */
- if (kp.XlatedScan && kp.XlatedChar == 0xE0)
- kp.XlatedChar = 0;
-
- /* Determine type of keyboard event */
- memset(&evt,0,sizeof(evt));
- if (kp.KbdDDFlagWord & KEY_RELEASE)
- evt.what = EVT_KEYUP;
- else
- evt.what = EVT_KEYDOWN;
-
- /* Convert keyboard codes */
- scan = kp.MonFlagWord >> 8;
- if (evt.what == EVT_KEYUP) {
- /* Get message for keyup code from table of cached down values */
- evt.message = keyUpMsg[scan];
- keyUpMsg[scan] = 0;
- oldKeyMessage = -1;
- }
- else {
- evt.message = ((ulong)scan << 8) | kp.XlatedChar;
- if (evt.message == keyUpMsg[scan]) {
- evt.what = EVT_KEYREPEAT;
- evt.message |= 0x10000;
- }
- oldKeyMessage = evt.message & 0x0FFFF;
- keyUpMsg[scan] = (ushort)evt.message;
- }
-
- /* Convert shift state modifiers */
- if (kp.u.ShiftState & 0x0001)
- evt.modifiers |= EVT_RIGHTSHIFT;
- if (kp.u.ShiftState & 0x0002)
- evt.modifiers |= EVT_LEFTSHIFT;
- if (kp.u.ShiftState & 0x0100)
- evt.modifiers |= EVT_LEFTCTRL;
- if (kp.u.ShiftState & 0x0200)
- evt.modifiers |= EVT_LEFTALT;
- if (kp.u.ShiftState & 0x0400)
- evt.modifiers |= EVT_RIGHTCTRL;
- if (kp.u.ShiftState & 0x0800)
- evt.modifiers |= EVT_RIGHTALT;
- EVT.oldMove = -1;
-
- /* Add time stamp and add the event to the queue */
- evt.when = key.time;
- if (EVT.count < EVENTQSIZE)
- addEvent(&evt);
- }
+ /* Check that the monitor thread is still running */
+ if (!bMonRunning)
+ PM_fatalError("Keyboard monitor thread died!");
+
+ /* Protect keypacket buffer with mutex */
+ DosRequestMutexSem(hmtxKeyBuf, SEM_INDEFINITE_WAIT);
+ if (kpHead == kpTail) {
+ DosReleaseMutexSem(hmtxKeyBuf);
+ break;
+ }
+
+ noInput = FALSE;
+
+ /* Read packet from circular buffer and remove it */
+ memcpy(&kp, &keyMonPkts[kpTail], sizeof(KEYPACKET));
+ if (++kpTail == KEYBUFSIZE)
+ kpTail = 0;
+ DosReleaseMutexSem(hmtxKeyBuf);
+
+ /* Compensate for the 0xE0 character */
+ if (kp.XlatedScan && kp.XlatedChar == 0xE0)
+ kp.XlatedChar = 0;
+
+ /* Determine type of keyboard event */
+ memset(&evt,0,sizeof(evt));
+ if (kp.KbdDDFlagWord & KEY_RELEASE)
+ evt.what = EVT_KEYUP;
+ else
+ evt.what = EVT_KEYDOWN;
+
+ /* Convert keyboard codes */
+ scan = kp.MonFlagWord >> 8;
+ if (evt.what == EVT_KEYUP) {
+ /* Get message for keyup code from table of cached down values */
+ evt.message = keyUpMsg[scan];
+ keyUpMsg[scan] = 0;
+ oldKeyMessage = -1;
+ }
+ else {
+ evt.message = ((ulong)scan << 8) | kp.XlatedChar;
+ if (evt.message == keyUpMsg[scan]) {
+ evt.what = EVT_KEYREPEAT;
+ evt.message |= 0x10000;
+ }
+ oldKeyMessage = evt.message & 0x0FFFF;
+ keyUpMsg[scan] = (ushort)evt.message;
+ }
+
+ /* Convert shift state modifiers */
+ if (kp.u.ShiftState & 0x0001)
+ evt.modifiers |= EVT_RIGHTSHIFT;
+ if (kp.u.ShiftState & 0x0002)
+ evt.modifiers |= EVT_LEFTSHIFT;
+ if (kp.u.ShiftState & 0x0100)
+ evt.modifiers |= EVT_LEFTCTRL;
+ if (kp.u.ShiftState & 0x0200)
+ evt.modifiers |= EVT_LEFTALT;
+ if (kp.u.ShiftState & 0x0400)
+ evt.modifiers |= EVT_RIGHTCTRL;
+ if (kp.u.ShiftState & 0x0800)
+ evt.modifiers |= EVT_RIGHTALT;
+ EVT.oldMove = -1;
+
+ /* Add time stamp and add the event to the queue */
+ evt.when = key.time;
+ if (EVT.count < EVENTQSIZE)
+ addEvent(&evt);
+ }
/* Don't just flush because that terminally confuses the monitor */
do {
- KbdCharIn(&key, IO_NOWAIT, 0);
- } while (key.fbStatus & KBDTRF_FINAL_CHAR_IN);
+ KbdCharIn(&key, IO_NOWAIT, 0);
+ } while (key.fbStatus & KBDTRF_FINAL_CHAR_IN);
/* Pump all mouse messages */
KbdGetStatus(&keyInfo,0);
/* Check return code - mouse may not be operational!! */
if (MouGetNumQueEl(&mqueue,_EVT_hMouse) == NO_ERROR) {
- while (mqueue.cEvents) {
- while (mqueue.cEvents--) {
- memset(&evt,0,sizeof(evt));
- mWait = MOU_NOWAIT;
- MouReadEventQue(&mouse,&mWait,_EVT_hMouse);
-
- /* Update the mouse position. We get the mouse coordinates
- * in mickeys so we have to translate these into pixels and
- * move our mouse position. If we don't do this, OS/2 gives
- * us the coordinates in character positions since it still
- * thinks we are in text mode!
- */
- EVT.mx += MickeyToPixel(mouse.col);
- EVT.my += MickeyToPixel(mouse.row);
- if (EVT.mx < 0) EVT.mx = 0;
- if (EVT.my < 0) EVT.my = 0;
- if (EVT.mx > rangeX) EVT.mx = rangeX;
- if (EVT.my > rangeY) EVT.my = rangeY;
- evt.where_x = EVT.mx;
- evt.where_y = EVT.my;
- evt.relative_x = mouse.col;
- evt.relative_y = mouse.row;
- evt.when = key.time;
- if (mouse.fs & (MOUSE_BN1_DOWN | MOUSE_MOTION_WITH_BN1_DOWN))
- evt.modifiers |= EVT_LEFTBUT;
- if (mouse.fs & (MOUSE_BN2_DOWN | MOUSE_MOTION_WITH_BN2_DOWN))
- evt.modifiers |= EVT_RIGHTBUT;
- if (mouse.fs & (MOUSE_BN3_DOWN | MOUSE_MOTION_WITH_BN3_DOWN))
- evt.modifiers |= EVT_MIDDLEBUT;
- if (keyInfo.fsState & 0x0001)
- evt.modifiers |= EVT_RIGHTSHIFT;
- if (keyInfo.fsState & 0x0002)
- evt.modifiers |= EVT_LEFTSHIFT;
- if (keyInfo.fsState & 0x0100)
- evt.modifiers |= EVT_LEFTCTRL;
- if (keyInfo.fsState & 0x0200)
- evt.modifiers |= EVT_LEFTALT;
- if (keyInfo.fsState & 0x0400)
- evt.modifiers |= EVT_RIGHTCTRL;
- if (keyInfo.fsState & 0x0800)
- evt.modifiers |= EVT_RIGHTALT;
-
- /* Check for left mouse click events */
- /* 0x06 == (MOUSE_BN1_DOWN | MOUSE_MOTION_WITH_BN1_DOWN) */
- if (((mouse.fs & 0x0006) && !(oldMouseState & 0x0006))
- || (!(mouse.fs & 0x0006) && (oldMouseState & 0x0006))) {
- if (mouse.fs & 0x0006)
- evt.what = EVT_MOUSEDOWN;
- else
- evt.what = EVT_MOUSEUP;
- evt.message = EVT_LEFTBMASK;
- EVT.oldMove = -1;
- if (EVT.count < EVENTQSIZE)
- addEvent(&evt);
- }
-
- /* Check for right mouse click events */
- /* 0x0018 == (MOUSE_BN2_DOWN | MOUSE_MOTION_WITH_BN2_DOWN) */
- if (((mouse.fs & 0x0018) && !(oldMouseState & 0x0018))
- || (!(mouse.fs & 0x0018) && (oldMouseState & 0x0018))) {
- if (mouse.fs & 0x0018)
- evt.what = EVT_MOUSEDOWN;
- else
- evt.what = EVT_MOUSEUP;
- evt.message = EVT_RIGHTBMASK;
- EVT.oldMove = -1;
- if (EVT.count < EVENTQSIZE)
- addEvent(&evt);
- }
-
- /* Check for middle mouse click events */
- /* 0x0060 == (MOUSE_BN3_DOWN | MOUSE_MOTION_WITH_BN3_DOWN) */
- if (((mouse.fs & 0x0060) && !(oldMouseState & 0x0060))
- || (!(mouse.fs & 0x0060) && (oldMouseState & 0x0060))) {
- if (mouse.fs & 0x0060)
- evt.what = EVT_MOUSEDOWN;
- else
- evt.what = EVT_MOUSEUP;
- evt.message = EVT_MIDDLEBMASK;
- EVT.oldMove = -1;
- if (EVT.count < EVENTQSIZE)
- addEvent(&evt);
- }
-
- /* Check for mouse movement event */
- if (mouse.fs & 0x002B) {
- evt.what = EVT_MOUSEMOVE;
- if (EVT.oldMove != -1) {
- EVT.evtq[EVT.oldMove].where_x = evt.where_x;/* Modify existing one */
- EVT.evtq[EVT.oldMove].where_y = evt.where_y;
- }
- else {
- EVT.oldMove = EVT.freeHead; /* Save id of this move event */
- if (EVT.count < EVENTQSIZE)
- addEvent(&evt);
- }
- }
-
- /* Save current mouse state */
- oldMouseState = mouse.fs;
- }
- MouGetNumQueEl(&mqueue,_EVT_hMouse);
- }
- noInput = FALSE;
- }
+ while (mqueue.cEvents) {
+ while (mqueue.cEvents--) {
+ memset(&evt,0,sizeof(evt));
+ mWait = MOU_NOWAIT;
+ MouReadEventQue(&mouse,&mWait,_EVT_hMouse);
+
+ /* Update the mouse position. We get the mouse coordinates
+ * in mickeys so we have to translate these into pixels and
+ * move our mouse position. If we don't do this, OS/2 gives
+ * us the coordinates in character positions since it still
+ * thinks we are in text mode!
+ */
+ EVT.mx += MickeyToPixel(mouse.col);
+ EVT.my += MickeyToPixel(mouse.row);
+ if (EVT.mx < 0) EVT.mx = 0;
+ if (EVT.my < 0) EVT.my = 0;
+ if (EVT.mx > rangeX) EVT.mx = rangeX;
+ if (EVT.my > rangeY) EVT.my = rangeY;
+ evt.where_x = EVT.mx;
+ evt.where_y = EVT.my;
+ evt.relative_x = mouse.col;
+ evt.relative_y = mouse.row;
+ evt.when = key.time;
+ if (mouse.fs & (MOUSE_BN1_DOWN | MOUSE_MOTION_WITH_BN1_DOWN))
+ evt.modifiers |= EVT_LEFTBUT;
+ if (mouse.fs & (MOUSE_BN2_DOWN | MOUSE_MOTION_WITH_BN2_DOWN))
+ evt.modifiers |= EVT_RIGHTBUT;
+ if (mouse.fs & (MOUSE_BN3_DOWN | MOUSE_MOTION_WITH_BN3_DOWN))
+ evt.modifiers |= EVT_MIDDLEBUT;
+ if (keyInfo.fsState & 0x0001)
+ evt.modifiers |= EVT_RIGHTSHIFT;
+ if (keyInfo.fsState & 0x0002)
+ evt.modifiers |= EVT_LEFTSHIFT;
+ if (keyInfo.fsState & 0x0100)
+ evt.modifiers |= EVT_LEFTCTRL;
+ if (keyInfo.fsState & 0x0200)
+ evt.modifiers |= EVT_LEFTALT;
+ if (keyInfo.fsState & 0x0400)
+ evt.modifiers |= EVT_RIGHTCTRL;
+ if (keyInfo.fsState & 0x0800)
+ evt.modifiers |= EVT_RIGHTALT;
+
+ /* Check for left mouse click events */
+ /* 0x06 == (MOUSE_BN1_DOWN | MOUSE_MOTION_WITH_BN1_DOWN) */
+ if (((mouse.fs & 0x0006) && !(oldMouseState & 0x0006))
+ || (!(mouse.fs & 0x0006) && (oldMouseState & 0x0006))) {
+ if (mouse.fs & 0x0006)
+ evt.what = EVT_MOUSEDOWN;
+ else
+ evt.what = EVT_MOUSEUP;
+ evt.message = EVT_LEFTBMASK;
+ EVT.oldMove = -1;
+ if (EVT.count < EVENTQSIZE)
+ addEvent(&evt);
+ }
+
+ /* Check for right mouse click events */
+ /* 0x0018 == (MOUSE_BN2_DOWN | MOUSE_MOTION_WITH_BN2_DOWN) */
+ if (((mouse.fs & 0x0018) && !(oldMouseState & 0x0018))
+ || (!(mouse.fs & 0x0018) && (oldMouseState & 0x0018))) {
+ if (mouse.fs & 0x0018)
+ evt.what = EVT_MOUSEDOWN;
+ else
+ evt.what = EVT_MOUSEUP;
+ evt.message = EVT_RIGHTBMASK;
+ EVT.oldMove = -1;
+ if (EVT.count < EVENTQSIZE)
+ addEvent(&evt);
+ }
+
+ /* Check for middle mouse click events */
+ /* 0x0060 == (MOUSE_BN3_DOWN | MOUSE_MOTION_WITH_BN3_DOWN) */
+ if (((mouse.fs & 0x0060) && !(oldMouseState & 0x0060))
+ || (!(mouse.fs & 0x0060) && (oldMouseState & 0x0060))) {
+ if (mouse.fs & 0x0060)
+ evt.what = EVT_MOUSEDOWN;
+ else
+ evt.what = EVT_MOUSEUP;
+ evt.message = EVT_MIDDLEBMASK;
+ EVT.oldMove = -1;
+ if (EVT.count < EVENTQSIZE)
+ addEvent(&evt);
+ }
+
+ /* Check for mouse movement event */
+ if (mouse.fs & 0x002B) {
+ evt.what = EVT_MOUSEMOVE;
+ if (EVT.oldMove != -1) {
+ EVT.evtq[EVT.oldMove].where_x = evt.where_x;/* Modify existing one */
+ EVT.evtq[EVT.oldMove].where_y = evt.where_y;
+ }
+ else {
+ EVT.oldMove = EVT.freeHead; /* Save id of this move event */
+ if (EVT.count < EVENTQSIZE)
+ addEvent(&evt);
+ }
+ }
+
+ /* Save current mouse state */
+ oldMouseState = mouse.fs;
+ }
+ MouGetNumQueEl(&mqueue,_EVT_hMouse);
+ }
+ noInput = FALSE;
+ }
/* If there was no input available, give up the current timeslice
* Note: DosSleep(0) will effectively do nothing if no other thread is ready. Hence
* DosSleep(0) will still use 100% CPU _but_ should not interfere with other programs.
*/
if (noInput)
- DosSleep(0);
+ DosSleep(0);
}
/****************************************************************************
@@ -341,78 +341,78 @@ static void _kbdMonThread(
/* Register the buffers to be used for monitoring for current session */
if (DosMonReg(_EVT_hKbdMon, &monInbuf, (ULONG*)&monOutbuf,MONITOR_END, -1)) {
- DosPostEventSem(hevStart); /* unblock the main thread */
- return;
- }
+ DosPostEventSem(hevStart); /* unblock the main thread */
+ return;
+ }
/* Unblock the main thread and tell it we're OK*/
bMonRunning = TRUE;
DosPostEventSem(hevStart);
while (bMonRunning) { /* Start an endless loop */
- /* Read data from keyboard driver */
- rc = DosMonRead((PBYTE)&monInbuf, IO_WAIT, (PBYTE)&kp, (PUSHORT)&count);
- if (rc) {
+ /* Read data from keyboard driver */
+ rc = DosMonRead((PBYTE)&monInbuf, IO_WAIT, (PBYTE)&kp, (PUSHORT)&count);
+ if (rc) {
#ifdef CHECKED
- if (bMonRunning)
- printf("Error in DosMonRead, rc = %ld\n", rc);
+ if (bMonRunning)
+ printf("Error in DosMonRead, rc = %ld\n", rc);
#endif
- bMonRunning = FALSE;
- return;
- }
+ bMonRunning = FALSE;
+ return;
+ }
- /* Pass FLUSH packets immediately */
- if (kp.MonFlagWord & 4) {
+ /* Pass FLUSH packets immediately */
+ if (kp.MonFlagWord & 4) {
#ifdef CHECKED
- printf("Flush packet!\n");
+ printf("Flush packet!\n");
#endif
- DosMonWrite((PBYTE)&monOutbuf, (PBYTE)&kp, count);
- continue;
- }
-
- //TODO: to be removed
- /* Skip extended scancodes & some others */
- if (((kp.MonFlagWord >> 8) == 0xE0) || ((kp.KbdDDFlagWord & 0x0F) == 0x0F)) {
- DosMonWrite((PBYTE)&monOutbuf, (PBYTE)&kp, count);
- continue;
- }
-
-// printf("RawScan = %X, XlatedScan = %X, fbStatus = %X, KbdDDFlags = %X\n",
-// kp.MonFlagWord >> 8, kp.XlatedScan, kp.u.ShiftState, kp.KbdDDFlagWord);
-
- /* Protect access to buffer with mutex semaphore */
- rc = DosRequestMutexSem(hmtxKeyBuf, 1000);
- if (rc) {
+ DosMonWrite((PBYTE)&monOutbuf, (PBYTE)&kp, count);
+ continue;
+ }
+
+ /*TODO: to be removed */
+ /* Skip extended scancodes & some others */
+ if (((kp.MonFlagWord >> 8) == 0xE0) || ((kp.KbdDDFlagWord & 0x0F) == 0x0F)) {
+ DosMonWrite((PBYTE)&monOutbuf, (PBYTE)&kp, count);
+ continue;
+ }
+
+/* printf("RawScan = %X, XlatedScan = %X, fbStatus = %X, KbdDDFlags = %X\n", */
+/* kp.MonFlagWord >> 8, kp.XlatedScan, kp.u.ShiftState, kp.KbdDDFlagWord); */
+
+ /* Protect access to buffer with mutex semaphore */
+ rc = DosRequestMutexSem(hmtxKeyBuf, 1000);
+ if (rc) {
#ifdef CHECKED
- printf("Can't get access to mutex, rc = %ld\n", rc);
+ printf("Can't get access to mutex, rc = %ld\n", rc);
#endif
- bMonRunning = FALSE;
- return;
- }
-
- /* Store packet in circular buffer, drop it if it's full */
- kpNew = kpHead + 1;
- if (kpNew == KEYBUFSIZE)
- kpNew = 0;
- if (kpNew != kpTail) {
- memcpy(&keyMonPkts[kpHead], &kp, sizeof(KEYPACKET));
- // TODO: fix this!
- /* Convert break to make code */
- keyMonPkts[kpHead].MonFlagWord &= 0x7FFF;
- kpHead = kpNew;
- }
- DosReleaseMutexSem(hmtxKeyBuf);
-
- /* Finally write the packet */
- rc = DosMonWrite((PBYTE)&monOutbuf, (PBYTE)&kp, count);
- if (rc) {
+ bMonRunning = FALSE;
+ return;
+ }
+
+ /* Store packet in circular buffer, drop it if it's full */
+ kpNew = kpHead + 1;
+ if (kpNew == KEYBUFSIZE)
+ kpNew = 0;
+ if (kpNew != kpTail) {
+ memcpy(&keyMonPkts[kpHead], &kp, sizeof(KEYPACKET));
+ /* TODO: fix this! */
+ /* Convert break to make code */
+ keyMonPkts[kpHead].MonFlagWord &= 0x7FFF;
+ kpHead = kpNew;
+ }
+ DosReleaseMutexSem(hmtxKeyBuf);
+
+ /* Finally write the packet */
+ rc = DosMonWrite((PBYTE)&monOutbuf, (PBYTE)&kp, count);
+ if (rc) {
#ifdef CHECKED
- if (bMonRunning)
- printf("Error in DosMonWrite, rc = %ld\n", rc);
+ if (bMonRunning)
+ printf("Error in DosMonWrite, rc = %ld\n", rc);
#endif
- bMonRunning = FALSE;
- return;
- }
- }
+ bMonRunning = FALSE;
+ return;
+ }
+ }
(void)params;
}
@@ -461,15 +461,15 @@ void EVTAPI EVT_init(
/* Open the keyboard monitor */
if (DosMonOpen((PSZ)"KBD$", &_EVT_hKbdMon))
- PM_fatalError("Unable to open keyboard monitor!");
+ PM_fatalError("Unable to open keyboard monitor!");
/* Create event semaphore, the monitor will post it when it's initalized */
if (DosCreateEventSem(NULL, &hevStart, 0, FALSE))
- PM_fatalError("Unable to create event semaphore!");
+ PM_fatalError("Unable to create event semaphore!");
/* Create mutex semaphore protecting the keypacket buffer */
if (DosCreateMutexSem(NULL, &hmtxKeyBuf, 0, FALSE))
- PM_fatalError("Unable to create mutex semaphore!");
+ PM_fatalError("Unable to create mutex semaphore!");
/* Start keyboard monitor thread, use 32K stack */
kbdMonTID = _beginthread(_kbdMonThread, NULL, 0x8000, NULL);
@@ -478,9 +478,9 @@ void EVTAPI EVT_init(
/* Give the thread one second */
DosWaitEventSem(hevStart, 1000);
if (!bMonRunning) { /* Check the thread is OK */
- DosMonClose(_EVT_hKbdMon);
- PM_fatalError("Keyboard monitor thread didn't initialize!");
- }
+ DosMonClose(_EVT_hKbdMon);
+ PM_fatalError("Keyboard monitor thread didn't initialize!");
+ }
/* Catch program termination signals so we can clean up properly */
signal(SIGABRT, _EVT_abort);
@@ -517,7 +517,7 @@ and this function can be used to resume it again later.
****************************************************************************/
void EVT_resume(void)
{
- // Do nothing for OS/2
+ /* Do nothing for OS/2 */
}
/****************************************************************************
@@ -527,7 +527,7 @@ de-install the event handling code.
****************************************************************************/
void EVT_suspend(void)
{
- // Do nothing for OS/2
+ /* Do nothing for OS/2 */
}
/****************************************************************************
@@ -551,16 +551,15 @@ void EVT_exit(void)
rc = DosKillThread(kbdMonTID);
#ifdef CHECKED
if (rc)
- printf("DosKillThread failed, rc = %ld\n", rc);
+ printf("DosKillThread failed, rc = %ld\n", rc);
#endif
rc = DosMonClose(_EVT_hKbdMon);
#ifdef CHECKED
if (rc) {
- printf("DosMonClose failed, rc = %ld\n", rc);
- }
+ printf("DosMonClose failed, rc = %ld\n", rc);
+ }
#endif
DosCloseEventSem(hevStart);
DosCloseMutexSem(hmtxKeyBuf);
KbdFlushBuffer(0);
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/os2/mon.h b/board/MAI/bios_emulator/scitech/src/pm/os2/mon.h
index 52f12f0d2d..28d39fba4b 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/os2/mon.h
+++ b/board/MAI/bios_emulator/scitech/src/pm/os2/mon.h
@@ -63,55 +63,55 @@ typedef struct _MLNPACKET {
USHORT KbdDDFlagWord;
} MLNPACKET;
-// DBCSStatus
-
-#define SF_SHIFTS 1 // If set to 1, shift status returned without a character
-#define SF_NOTCHAR 2 // 0 - Scan code is a character
- // 1 - Scan code is not a character;
- // instead it is an extended key code from the keyboard.
-#define SF_IMMEDIATE 32 // If set to 1, immediate conversion requested
-#define SF_TYPEMASK 192 // Has the following values:
- // 00 - Undefined
- // 01 - Final character; interim character flag is turned off
- // 10 - Interim character
- // 11 - Final character; interim character flag is turned on.
-// MonFlagWord
-
-#define MF_OPEN 1 // open
-#define MF_CLOSE 2 // close
-#define MF_FLUSH 4 // is flush packet
-
-// KbdDDFlagWord
-
-#define KF_NOTSQPACKET 1024 // Don't put this packet in SQ buffer
-#define KF_ACCENTEDKEY 512 // Key was translated using previous accent.
-#define KF_MULTIMAKE 256 // Key was repeated make of a toggle key.
-#define KF_SECONDARYKEY 128 // Previous scan code was the E0 prefix code.
-#define KF_KEYBREAK 64 // This is the break of the key.
-#define KF_KEYTYPEMASK 63 // Isolates the Key Type field of DDFlags.
-#define KF_UNDEFKEY 63 // Key packet is undefined
-#define KF_SYSREQKEY 23 // This key packet is the SysReq key (4990)
-#define KF_PRINTFLUSHKEY 22 // This packet is Ct-Alt-PrtScr
-#define KF_PSPRINTECHOKEY 21 // This packet is Ctl-P
-#define KF_PRINTECHOKEY 20 // This packet is Ctl-PrtScr
-#define KF_PRTSCRKEY 19 // This packet is PrtScr
-#define KF_PSBREAKKEY 18 // This packet is Ctl-C
-#define KF_BREAKKEY 17 // This packet is Ctl-Break
-#define KF_ACCENTKEY 16 // This packet is an accent key
-#define KF_XRORPNOT 13 // This packet is a Read or Peek Notification Pct.
-#define KF_MLNOTIFICATION 14 // packet is a Multi-Layer NLS packet
-#define KF_HOTKEYPACKET 12 // This packet is the hot key.
-#define KF_BADKEYCOMBO 11 // Accent/char combo undefined, beep only.
-#define KF_WAKEUPKEY 10 // This packet is one following PAUSEKEY
-#define KF_PSPAUSEKEY 9 // This packet is Ctl-S
-#define KF_PAUSEKEY 8 // This packet is Ctl-Numlock or PAUSE
-#define KF_SHIFTMASK 7 // Key is a shift Key
-#define KF_DUMPKEY 6 // This packet is Ctl-Numlock-NumLock
-#define KF_REBOOTKEY 5 // This packet is Ctl-Alt-Del
-#define KF_RESENDCODE 4 // This packet is resend code from controller
-#define KF_OVERRUNCODE 3 // This packet is overrun code from controller
-#define KF_SECPREFIXCODE 2 // This packet is E0/E1 scan code
-#define KF_ACKCODE 1 // This packet is ack code from keyboard
+/* DBCSStatus */
+
+#define SF_SHIFTS 1 /* If set to 1, shift status returned without a character */
+#define SF_NOTCHAR 2 /* 0 - Scan code is a character */
+ /* 1 - Scan code is not a character; */
+ /* instead it is an extended key code from the keyboard. */
+#define SF_IMMEDIATE 32 /* If set to 1, immediate conversion requested */
+#define SF_TYPEMASK 192 /* Has the following values: */
+ /* 00 - Undefined */
+ /* 01 - Final character; interim character flag is turned off */
+ /* 10 - Interim character */
+ /* 11 - Final character; interim character flag is turned on. */
+/* MonFlagWord */
+
+#define MF_OPEN 1 /* open */
+#define MF_CLOSE 2 /* close */
+#define MF_FLUSH 4 /* is flush packet */
+
+/* KbdDDFlagWord */
+
+#define KF_NOTSQPACKET 1024 /* Don't put this packet in SQ buffer */
+#define KF_ACCENTEDKEY 512 /* Key was translated using previous accent. */
+#define KF_MULTIMAKE 256 /* Key was repeated make of a toggle key. */
+#define KF_SECONDARYKEY 128 /* Previous scan code was the E0 prefix code. */
+#define KF_KEYBREAK 64 /* This is the break of the key. */
+#define KF_KEYTYPEMASK 63 /* Isolates the Key Type field of DDFlags. */
+#define KF_UNDEFKEY 63 /* Key packet is undefined */
+#define KF_SYSREQKEY 23 /* This key packet is the SysReq key (4990) */
+#define KF_PRINTFLUSHKEY 22 /* This packet is Ct-Alt-PrtScr */
+#define KF_PSPRINTECHOKEY 21 /* This packet is Ctl-P */
+#define KF_PRINTECHOKEY 20 /* This packet is Ctl-PrtScr */
+#define KF_PRTSCRKEY 19 /* This packet is PrtScr */
+#define KF_PSBREAKKEY 18 /* This packet is Ctl-C */
+#define KF_BREAKKEY 17 /* This packet is Ctl-Break */
+#define KF_ACCENTKEY 16 /* This packet is an accent key */
+#define KF_XRORPNOT 13 /* This packet is a Read or Peek Notification Pct. */
+#define KF_MLNOTIFICATION 14 /* packet is a Multi-Layer NLS packet */
+#define KF_HOTKEYPACKET 12 /* This packet is the hot key. */
+#define KF_BADKEYCOMBO 11 /* Accent/char combo undefined, beep only. */
+#define KF_WAKEUPKEY 10 /* This packet is one following PAUSEKEY */
+#define KF_PSPAUSEKEY 9 /* This packet is Ctl-S */
+#define KF_PAUSEKEY 8 /* This packet is Ctl-Numlock or PAUSE */
+#define KF_SHIFTMASK 7 /* Key is a shift Key */
+#define KF_DUMPKEY 6 /* This packet is Ctl-Numlock-NumLock */
+#define KF_REBOOTKEY 5 /* This packet is Ctl-Alt-Del */
+#define KF_RESENDCODE 4 /* This packet is resend code from controller */
+#define KF_OVERRUNCODE 3 /* This packet is overrun code from controller */
+#define KF_SECPREFIXCODE 2 /* This packet is E0/E1 scan code */
+#define KF_ACKCODE 1 /* This packet is ack code from keyboard */
typedef struct _MONBUF {
@@ -120,29 +120,29 @@ typedef struct _MONBUF {
BYTE Reserved[20];
} MONBUF;
-#define RS_SYSREG 32768 // Bit 15 SysReq key down
-#define RS_CAPSLOCK 16384 // Bit 14 Caps Lock key down
-#define RS_NUMLOCK 8192 // Bit 13 NumLock key down
-#define RS_SCROLLLOCK 4096 // Bit 12 Scroll Lock key down
-#define RS_RALT 2048 // Bit 11 Right Alt key down
-#define RS_RCONTROL 1024 // Bit 10 Right Ctrl key down
-#define RS_LALT 512 // Bit 9 Left Alt key down
-#define RS_LCONTROL 256 // Bit 8 Left Ctrl key down
-#define RS_INSERT 128 // Bit 7 Insert on
-#define RS_CAPS 64 // Bit 6 Caps Lock on
-#define RS_NUM 32 // Bit 5 NumLock on
-#define RS_SCROLL 16 // Bit 4 Scroll Lock on
-#define RS_ALT 8 // Bit 3 Either Alt key down
-#define RS_CONTROL 4 // Bit 2 Either Ctrl key down
-#define RS_LSHIFT 2 // Bit 1 Left Shift key down
-#define RS_RSHIFT 1 // Bit 0 Right Shift key down
-
-
-#define CS_RCONTROL 91 // Right Control
-#define CS_LSHIFT 42 // Left Shift
-#define CS_RSHIFT 54 // Right Shift
-#define CS_LALT 56 // Left Alt
-#define CS_RALT 94 // Right Alt
+#define RS_SYSREG 32768 /* Bit 15 SysReq key down */
+#define RS_CAPSLOCK 16384 /* Bit 14 Caps Lock key down */
+#define RS_NUMLOCK 8192 /* Bit 13 NumLock key down */
+#define RS_SCROLLLOCK 4096 /* Bit 12 Scroll Lock key down */
+#define RS_RALT 2048 /* Bit 11 Right Alt key down */
+#define RS_RCONTROL 1024 /* Bit 10 Right Ctrl key down */
+#define RS_LALT 512 /* Bit 9 Left Alt key down */
+#define RS_LCONTROL 256 /* Bit 8 Left Ctrl key down */
+#define RS_INSERT 128 /* Bit 7 Insert on */
+#define RS_CAPS 64 /* Bit 6 Caps Lock on */
+#define RS_NUM 32 /* Bit 5 NumLock on */
+#define RS_SCROLL 16 /* Bit 4 Scroll Lock on */
+#define RS_ALT 8 /* Bit 3 Either Alt key down */
+#define RS_CONTROL 4 /* Bit 2 Either Ctrl key down */
+#define RS_LSHIFT 2 /* Bit 1 Left Shift key down */
+#define RS_RSHIFT 1 /* Bit 0 Right Shift key down */
+
+
+#define CS_RCONTROL 91 /* Right Control */
+#define CS_LSHIFT 42 /* Left Shift */
+#define CS_RSHIFT 54 /* Right Shift */
+#define CS_LALT 56 /* Left Alt */
+#define CS_RALT 94 /* Right Alt */
/* DosMon* prototypes */
diff --git a/board/MAI/bios_emulator/scitech/src/pm/os2/oshdr.h b/board/MAI/bios_emulator/scitech/src/pm/os2/oshdr.h
index ae1f97a06c..e7aa1c6764 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/os2/oshdr.h
+++ b/board/MAI/bios_emulator/scitech/src/pm/os2/oshdr.h
@@ -39,4 +39,3 @@
#include "os2/mon.h"
void __PM_checkConsoleSwitch(void);
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/os2/pm.c b/board/MAI/bios_emulator/scitech/src/pm/os2/pm.c
index 5025102806..756eead1dd 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/os2/pm.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/os2/pm.c
@@ -116,16 +116,16 @@ typedef struct _VIDEO_ADAPTER {
/* PMIREQUEST_SOFTWAREINT structures from OS/2 DDK */
typedef struct {
- ULONG ulFlags; // VDM initialization type
-#define VDM_POSTLOAD 0x1 // adapter just loaded, used internally for initialization
-#define VDM_INITIALIZE 0x2 // force initialization of a permanently open VDM, even if previously initialized
-#define VDM_TERMINATE_POSTINITIALIZE 0x6 //start VDM with initialization, but close it afterwards (includes VDM_INITIALIZE)
-#define VDM_QUERY_CAPABILITY 0x10 // query the current int 10 capability
-#define VDM_FULL_VDM_CREATED 0x20 // a full VDM is created
-#define VDM_MINI_VDM_CREATED 0x40 // a mini VDM is created
-#define VDM_MINI_VDM_SUPPORTED 0x80 // mini VDM support is available
- PCHAR szName; // VDM initialization program
- PCHAR szArgs; // VDM initialization arguments
+ ULONG ulFlags; /* VDM initialization type */
+#define VDM_POSTLOAD 0x1 /* adapter just loaded, used internally for initialization */
+#define VDM_INITIALIZE 0x2 /* force initialization of a permanently open VDM, even if previously initialized */
+#define VDM_TERMINATE_POSTINITIALIZE 0x6 /*start VDM with initialization, but close it afterwards (includes VDM_INITIALIZE) */
+#define VDM_QUERY_CAPABILITY 0x10 /* query the current int 10 capability */
+#define VDM_FULL_VDM_CREATED 0x20 /* a full VDM is created */
+#define VDM_MINI_VDM_CREATED 0x40 /* a mini VDM is created */
+#define VDM_MINI_VDM_SUPPORTED 0x80 /* mini VDM support is available */
+ PCHAR szName; /* VDM initialization program */
+ PCHAR szArgs; /* VDM initialization arguments */
}INITVDM;
typedef struct {
@@ -218,7 +218,7 @@ typedef struct _SESWITCHREC {
HEV Event; /* Posted after callback is called */
} SESWITCHREC;
-// Page sized block cache
+/* Page sized block cache */
#define PAGES_PER_BLOCK 32
#define PAGE_BLOCK_SIZE (PAGES_PER_BLOCK * PM_PAGE_SIZE + (PM_PAGE_SIZE-1) + sizeof(pageblock))
@@ -269,29 +269,29 @@ static ulong CallSDDHelp(
ulong result;
if ((rc = DosOpen(PMHELP_NAME,&hSDDHelp,&result,0,0,
- FILE_OPEN, OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,
- NULL)) != 0) {
- if (rc == 4) { /* Did we run out of file handles? */
- ULONG ulNewFHs;
- LONG lAddFHs = 5;
-
- if (DosSetRelMaxFH(&lAddFHs, &ulNewFHs) != 0)
- PM_fatalError("Failed to raise the file handles limit!");
- else {
- if ((rc = DosOpen(PMHELP_NAME,&hSDDHelp,&result,0,0,
- FILE_OPEN, OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,
- NULL)) != 0) {
- PM_fatalError("Unable to open SDDHELP$ helper device driver! (#2)");
- }
- }
- }
- else
- PM_fatalError("Unable to open SDDHELP$ helper device driver!");
- }
+ FILE_OPEN, OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,
+ NULL)) != 0) {
+ if (rc == 4) { /* Did we run out of file handles? */
+ ULONG ulNewFHs;
+ LONG lAddFHs = 5;
+
+ if (DosSetRelMaxFH(&lAddFHs, &ulNewFHs) != 0)
+ PM_fatalError("Failed to raise the file handles limit!");
+ else {
+ if ((rc = DosOpen(PMHELP_NAME,&hSDDHelp,&result,0,0,
+ FILE_OPEN, OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,
+ NULL)) != 0) {
+ PM_fatalError("Unable to open SDDHELP$ helper device driver! (#2)");
+ }
+ }
+ }
+ else
+ PM_fatalError("Unable to open SDDHELP$ helper device driver!");
+ }
if (DosDevIOCtl(hSDDHelp,PMHELP_IOCTL,func,
- &parmsIn, inLen = sizeof(parmsIn), &inLen,
- &parmsOut, outLen = sizeof(parmsOut), &outLen) != 0)
- PM_fatalError("Failure calling SDDHELP$ helper device driver!");
+ &parmsIn, inLen = sizeof(parmsIn), &inLen,
+ &parmsOut, outLen = sizeof(parmsOut), &outLen) != 0)
+ PM_fatalError("Failure calling SDDHELP$ helper device driver!");
DosClose(hSDDHelp);
return parmsOut[0];
}
@@ -310,9 +310,9 @@ ibool __IsDBCSSystem(void)
/* Get the DBCS vector - if it's not empty, we're on DBCS */
DosQueryDBCSEnv(sizeof(achDBCSInfo), &ccStruct, achDBCSInfo);
if (achDBCSInfo[0] != 0)
- return true;
+ return true;
else
- return false;
+ return false;
}
/****************************************************************************
@@ -324,9 +324,9 @@ ibool __isShellLoaded(void)
PVOID ptr;
if (DosGetNamedSharedMem(&ptr, (PSZ)"\\SHAREMEM\\PMGLOBAL.MEM", PAG_READ) == NO_ERROR) {
- DosFreeMem(ptr);
- return true;
- }
+ DosFreeMem(ptr);
+ return true;
+ }
return false;
}
@@ -339,19 +339,19 @@ message.
void PMAPI PM_init(void)
{
if (!lowMem) {
- /* Obtain the 32->16 callgate from the device driver to enable IOPL */
- if ((_PM_gdt = CallSDDHelp(PMHELP_GETGDT32)) == 0)
- PM_fatalError("Unable to obtain call gate selector!");
+ /* Obtain the 32->16 callgate from the device driver to enable IOPL */
+ if ((_PM_gdt = CallSDDHelp(PMHELP_GETGDT32)) == 0)
+ PM_fatalError("Unable to obtain call gate selector!");
- PM_setIOPL(3);
+ PM_setIOPL(3);
- /* Map the first Mb of physical memory into lowMem */
- if ((lowMem = PM_mapPhysicalAddr(0,0xFFFFF,true)) == NULL)
- PM_fatalError("Unable to map first Mb physical memory!");
+ /* Map the first Mb of physical memory into lowMem */
+ if ((lowMem = PM_mapPhysicalAddr(0,0xFFFFF,true)) == NULL)
+ PM_fatalError("Unable to map first Mb physical memory!");
- /* Initialise the MTRR interface functions */
- MTRR_init();
- }
+ /* Initialise the MTRR interface functions */
+ MTRR_init();
+ }
}
/****************************************************************************
@@ -367,79 +367,79 @@ static ibool InitInt10(void)
RESULTCODES resCodes;
if (haveInt10 == -1) {
- /* Connect to VIDEOPMI and get entry point. Note that we only
- * do this if GENPMI or SDDPMI are already loaded, since we need
- * a GRADD based driver for this to work.
- */
- PM_init();
- haveInt10 = false;
- if (DosQueryModuleHandle((PSZ)"GENPMI.DLL",&hModGENPMI) != 0)
- hModGENPMI = NULLHANDLE;
- if (DosQueryModuleHandle((PSZ)"SDDPMI.DLL",&hModSDDPMI) != 0)
- hModSDDPMI = NULLHANDLE;
- if (hModGENPMI || hModSDDPMI) {
- if (DosLoadModule((PSZ)buf,sizeof(buf),(PSZ)"VIDEOPMI.DLL",&hModVideoPMI) == 0) {
- if (DosQueryProcAddr(hModVideoPMI,0,(PSZ)"VIDEOPMI32Request",(void*)&PM_VIDEOPMI32Request) != 0)
- PM_fatalError("Unable to get VIDEOPMI32Request entry point!");
- strcpy(path,"X:\\OS2\\SVGADATA.PMI");
- path[0] = PM_getBootDrive();
- if (PM_VIDEOPMI32Request(&Adapter,PMIREQUEST_LOADPMIFILE,path,NULL) != 0) {
- DosFreeModule(hModVideoPMI);
- PM_VIDEOPMI32Request = NULL;
- haveInt10 = false;
- }
- else {
- /* Attempt to initialise the full VDM in the system. This will only
- * work if VPRPMI.SYS is loaded, but it provides support for passing
- * values in ES/DS/ESI/EDI between the BIOS which does not work with
- * kernel VDM's in fixpacks earlier than FP15. FP15 and later and
- * the new Warp 4.51 and Warp Server convenience packs should work
- * fine with the kernel mini-VDM.
- *
- * Also the full VDM is the only solution for really old kernels
- * (but GRADD won't run on them so this is superfluous ;-).
- */
- INITVDM InitVDM = {VDM_INITIALIZE,NULL,NULL};
- PM_VIDEOPMI32Request(&Adapter,PMIREQUEST_SOFTWAREINT,&InitVDM,NULL);
- haveInt10 = true;
- }
- }
- }
- else {
- /* A GRADD driver isn't loaded, hence we can't use VIDEOPMI. But we will try
- * to access the mini-VDM directly, first verifying that the support is
- * available in the kernel (it should be for kernels that support GRADD).
- * This may be needed in a command line boot or if non-GRADD driver is
- * used (Matrox or classic VGA).
- * Note: because of problems with mini-VDM support in the kernel, we have to
- * spawn a daemon process that will do the actual mini-VDM access for us.
- */
- /* Try to open shared semaphore to see if our daemon is already up */
- if (DosOpenEventSem(SHAREDSEM, &hevDaemon) == NO_ERROR) {
- if (DosWaitEventSem(hevDaemon, 1) == NO_ERROR) {
- /* If semaphore is posted, all is well */
- useVPMI = false;
- haveInt10 = true;
- }
- }
- else {
- /* Create shared event semaphore */
- if (DosCreateEventSem(SHAREDSEM, &hevDaemon, DC_SEM_SHARED, FALSE) == NO_ERROR) {
- PM_findBPD(DAEMON_NAME, path);
- strcat(path, DAEMON_NAME);
- if (DosExecPgm(buf, sizeof(buf), EXEC_BACKGROUND, (PSZ)DAEMON_NAME,
- NULL, &resCodes, (PSZ)path) == NO_ERROR) {
- /* The daemon was successfully spawned, now give it a sec to come up */
- if (DosWaitEventSem(hevDaemon, 2000) == NO_ERROR) {
- /* It's up! */
- useVPMI = false;
- haveInt10 = true;
- }
- }
- }
- }
- }
- }
+ /* Connect to VIDEOPMI and get entry point. Note that we only
+ * do this if GENPMI or SDDPMI are already loaded, since we need
+ * a GRADD based driver for this to work.
+ */
+ PM_init();
+ haveInt10 = false;
+ if (DosQueryModuleHandle((PSZ)"GENPMI.DLL",&hModGENPMI) != 0)
+ hModGENPMI = NULLHANDLE;
+ if (DosQueryModuleHandle((PSZ)"SDDPMI.DLL",&hModSDDPMI) != 0)
+ hModSDDPMI = NULLHANDLE;
+ if (hModGENPMI || hModSDDPMI) {
+ if (DosLoadModule((PSZ)buf,sizeof(buf),(PSZ)"VIDEOPMI.DLL",&hModVideoPMI) == 0) {
+ if (DosQueryProcAddr(hModVideoPMI,0,(PSZ)"VIDEOPMI32Request",(void*)&PM_VIDEOPMI32Request) != 0)
+ PM_fatalError("Unable to get VIDEOPMI32Request entry point!");
+ strcpy(path,"X:\\OS2\\SVGADATA.PMI");
+ path[0] = PM_getBootDrive();
+ if (PM_VIDEOPMI32Request(&Adapter,PMIREQUEST_LOADPMIFILE,path,NULL) != 0) {
+ DosFreeModule(hModVideoPMI);
+ PM_VIDEOPMI32Request = NULL;
+ haveInt10 = false;
+ }
+ else {
+ /* Attempt to initialise the full VDM in the system. This will only
+ * work if VPRPMI.SYS is loaded, but it provides support for passing
+ * values in ES/DS/ESI/EDI between the BIOS which does not work with
+ * kernel VDM's in fixpacks earlier than FP15. FP15 and later and
+ * the new Warp 4.51 and Warp Server convenience packs should work
+ * fine with the kernel mini-VDM.
+ *
+ * Also the full VDM is the only solution for really old kernels
+ * (but GRADD won't run on them so this is superfluous ;-).
+ */
+ INITVDM InitVDM = {VDM_INITIALIZE,NULL,NULL};
+ PM_VIDEOPMI32Request(&Adapter,PMIREQUEST_SOFTWAREINT,&InitVDM,NULL);
+ haveInt10 = true;
+ }
+ }
+ }
+ else {
+ /* A GRADD driver isn't loaded, hence we can't use VIDEOPMI. But we will try
+ * to access the mini-VDM directly, first verifying that the support is
+ * available in the kernel (it should be for kernels that support GRADD).
+ * This may be needed in a command line boot or if non-GRADD driver is
+ * used (Matrox or classic VGA).
+ * Note: because of problems with mini-VDM support in the kernel, we have to
+ * spawn a daemon process that will do the actual mini-VDM access for us.
+ */
+ /* Try to open shared semaphore to see if our daemon is already up */
+ if (DosOpenEventSem(SHAREDSEM, &hevDaemon) == NO_ERROR) {
+ if (DosWaitEventSem(hevDaemon, 1) == NO_ERROR) {
+ /* If semaphore is posted, all is well */
+ useVPMI = false;
+ haveInt10 = true;
+ }
+ }
+ else {
+ /* Create shared event semaphore */
+ if (DosCreateEventSem(SHAREDSEM, &hevDaemon, DC_SEM_SHARED, FALSE) == NO_ERROR) {
+ PM_findBPD(DAEMON_NAME, path);
+ strcat(path, DAEMON_NAME);
+ if (DosExecPgm(buf, sizeof(buf), EXEC_BACKGROUND, (PSZ)DAEMON_NAME,
+ NULL, &resCodes, (PSZ)path) == NO_ERROR) {
+ /* The daemon was successfully spawned, now give it a sec to come up */
+ if (DosWaitEventSem(hevDaemon, 2000) == NO_ERROR) {
+ /* It's up! */
+ useVPMI = false;
+ haveInt10 = true;
+ }
+ }
+ }
+ }
+ }
+ }
return haveInt10;
}
@@ -480,9 +480,9 @@ void PMAPI PM_backslash(
{
uint pos = strlen(s);
if (s[pos-1] != '\\') {
- s[pos] = '\\';
- s[pos+1] = '\0';
- }
+ s[pos] = '\\';
+ s[pos+1] = '\0';
+ }
}
/****************************************************************************
@@ -505,9 +505,9 @@ void PMAPI PM_fatalError(
/* Be prepare to be called recursively (failed to fail situation :-) */
static int fatalErrorCount = 0;
if (fatalErrorCount++ == 0) {
- if (fatalErrorCleanup)
- fatalErrorCleanup();
- }
+ if (fatalErrorCleanup)
+ fatalErrorCleanup();
+ }
fprintf(stderr,"%s\n", msg);
exit(1);
}
@@ -522,10 +522,10 @@ void * PMAPI PM_getVESABuf(
uint *roff)
{
if (!VESABuf_ptr) {
- /* Allocate a global buffer for communicating with the VESA VBE */
- if ((VESABuf_ptr = PM_allocRealSeg(VESABuf_len, &VESABuf_rseg, &VESABuf_roff)) == NULL)
- return NULL;
- }
+ /* Allocate a global buffer for communicating with the VESA VBE */
+ if ((VESABuf_ptr = PM_allocRealSeg(VESABuf_len, &VESABuf_rseg, &VESABuf_roff)) == NULL)
+ return NULL;
+ }
*len = VESABuf_len;
*rseg = VESABuf_rseg;
*roff = VESABuf_roff;
@@ -632,11 +632,11 @@ void __PM_checkConsoleSwitch(void)
/* Quick optimized path for most common case */
if (SesSwitchRec.Flags == -1)
- return;
+ return;
again:
if (DosRequestMutexSem(SesSwitchRec.Mutex, 100))
- return;
+ return;
Flags = SesSwitchRec.Flags;
Callback = SesSwitchRec.Callback;
SesSwitchRec.Flags = -1;
@@ -647,15 +647,15 @@ again:
isSessionSwitching = false;
DosPostEventSem(SesSwitchRec.Event);
if (Flags == PM_DEACTIVATE && Mode == PM_SUSPEND_APP)
- /* Suspend application until we switch back to our application */
- for (;;) {
- DosSleep (500);
- /* SesSwitchRec.Flags is volatile so optimizer
- * won't load it into a register
- */
- if (SesSwitchRec.Flags != -1)
- goto again;
- }
+ /* Suspend application until we switch back to our application */
+ for (;;) {
+ DosSleep (500);
+ /* SesSwitchRec.Flags is volatile so optimizer
+ * won't load it into a register
+ */
+ if (SesSwitchRec.Flags != -1)
+ goto again;
+ }
}
/****************************************************************************
@@ -669,7 +669,7 @@ static void _PM_SessionSwitchEvent(
ULONG Count;
if (DosRequestMutexSem(SesSwitchRec.Mutex, 10000))
- return;
+ return;
/* We're going to wait on that semaphore */
DosResetEventSem(SesSwitchRec.Event, &Count);
@@ -692,10 +692,10 @@ static void _PM_ConsoleSwitch(
USHORT NotifyType;
for (;;) {
- if (VioModeWait(VMWR_POPUP, &NotifyType, 0) != 0)
- break;
- _PM_SessionSwitchEvent(saveState, PM_REACTIVATE);
- }
+ if (VioModeWait(VMWR_POPUP, &NotifyType, 0) != 0)
+ break;
+ _PM_SessionSwitchEvent(saveState, PM_REACTIVATE);
+ }
VioModeUndo(UNDOI_RELEASEOWNER, UNDOK_ERRORCODE, (HVIO)0);
}
@@ -709,13 +709,13 @@ static void _PM_ConsolePopup(
{
USHORT NotifyType;
for (;;) {
- if (VioSavRedrawWait(VSRWI_SAVEANDREDRAW, &NotifyType, 0) != 0)
- break;
- if (NotifyType == VSRWN_SAVE)
- _PM_SessionSwitchEvent(saveState, PM_DEACTIVATE);
- else if (NotifyType == VSRWN_REDRAW)
- _PM_SessionSwitchEvent(saveState, PM_REACTIVATE);
- }
+ if (VioSavRedrawWait(VSRWI_SAVEANDREDRAW, &NotifyType, 0) != 0)
+ break;
+ if (NotifyType == VSRWN_SAVE)
+ _PM_SessionSwitchEvent(saveState, PM_DEACTIVATE);
+ else if (NotifyType == VSRWN_REDRAW)
+ _PM_SessionSwitchEvent(saveState, PM_REACTIVATE);
+ }
VioSavRedrawUndo(UNDOI_RELEASEOWNER, UNDOK_ERRORCODE, (HVIO)0);
}
@@ -726,24 +726,24 @@ Set the suspend application callback for the fullscreen console.
void PMAPI PM_setSuspendAppCallback(
PM_saveState_cb saveState)
{
- // If PM isn't loaded, this stuff will cause crashes!
+ /* If PM isn't loaded, this stuff will cause crashes! */
if (__isShellLoaded()) {
- if (saveState) {
- /* Create the threads responsible for tracking console switches */
- SesSwitchRec.Flags = -1;
- DosCreateMutexSem(NULL, &SesSwitchRec.Mutex, 0, FALSE);
- DosCreateEventSem(NULL, &SesSwitchRec.Event, 0, FALSE);
- _beginthread ((void(*)(void*))_PM_ConsoleSwitch,NULL,SESSION_SWITCH_STACK_SIZE, (void*)saveState);
- _beginthread ((void(*)(void*))_PM_ConsolePopup,NULL,SESSION_SWITCH_STACK_SIZE, (void*)saveState);
- }
- else {
- /* Kill the threads responsible for tracking console switches */
- VioModeUndo(UNDOI_RELEASEOWNER, UNDOK_TERMINATE, (HVIO)0);
- VioSavRedrawUndo(UNDOI_RELEASEOWNER, UNDOK_TERMINATE, (HVIO)0);
- DosCloseEventSem(SesSwitchRec.Event);
- DosCloseMutexSem(SesSwitchRec.Mutex);
- }
- }
+ if (saveState) {
+ /* Create the threads responsible for tracking console switches */
+ SesSwitchRec.Flags = -1;
+ DosCreateMutexSem(NULL, &SesSwitchRec.Mutex, 0, FALSE);
+ DosCreateEventSem(NULL, &SesSwitchRec.Event, 0, FALSE);
+ _beginthread ((void(*)(void*))_PM_ConsoleSwitch,NULL,SESSION_SWITCH_STACK_SIZE, (void*)saveState);
+ _beginthread ((void(*)(void*))_PM_ConsolePopup,NULL,SESSION_SWITCH_STACK_SIZE, (void*)saveState);
+ }
+ else {
+ /* Kill the threads responsible for tracking console switches */
+ VioModeUndo(UNDOI_RELEASEOWNER, UNDOK_TERMINATE, (HVIO)0);
+ VioSavRedrawUndo(UNDOI_RELEASEOWNER, UNDOK_TERMINATE, (HVIO)0);
+ DosCloseEventSem(SesSwitchRec.Event);
+ DosCloseMutexSem(SesSwitchRec.Mutex);
+ }
+ }
}
/****************************************************************************
@@ -758,7 +758,7 @@ void PMAPI PM_restoreConsoleState(
VIOMODEINFO vmi;
if (!cs)
- return;
+ return;
memcpy(&vmi, &cs->vmi, sizeof (VIOMODEINFO));
VioSetMode(&vmi, (HVIO)0);
@@ -789,7 +789,7 @@ void PM_setOSCursorLocation(
/* If session switch is in progress, calling into VIO causes deadlocks! */
/* Also this call to VIO screws up our console library on DBCS boxes... */
if (!isSessionSwitching && !__IsDBCSSystem())
- VioSetCurPos(y,x,0);
+ VioSetCurPos(y,x,0);
}
/****************************************************************************
@@ -813,7 +813,7 @@ ibool PMAPI PM_setRealTimeClockHandler(
PM_intHandler ih,
int frequency)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
(void)ih;
(void)frequency;
return false;
@@ -826,7 +826,7 @@ Set the real time clock frequency (for stereo modes).
void PMAPI PM_setRealTimeClockFrequency(
int frequency)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
(void)frequency;
}
@@ -836,7 +836,7 @@ Restore the original real time clock handler.
****************************************************************************/
void PMAPI PM_restoreRealTimeClockHandler(void)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
}
/****************************************************************************
@@ -881,7 +881,7 @@ const char * PMAPI PM_getNucleusPath(void)
{
static char path[CCHMAXPATH];
if (getenv("NUCLEUS_PATH") != NULL)
- return getenv("NUCLEUS_PATH");
+ return getenv("NUCLEUS_PATH");
strcpy(path,"x:\\os2\\drivers");
path[0] = PM_getBootDrive();
PM_backslash(path);
@@ -920,10 +920,10 @@ const char * PMAPI PM_getMachineName(void)
static char name[40],*env;
if ((env = getenv("HOSTNAME")) != NULL) {
- strncpy(name,env,sizeof(name));
- name[sizeof(name)-1] = 0;
- return name;
- }
+ strncpy(name,env,sizeof(name));
+ name[sizeof(name)-1] = 0;
+ return name;
+ }
return "OS2";
}
@@ -970,7 +970,7 @@ void * PMAPI PM_mapPhysicalAddr(
parmsIn[1] = limit;
parmsIn[2] = isCached;
if ((linear = CallSDDHelp(PMHELP_MAPPHYS)) == 0)
- return NULL;
+ return NULL;
return (void*)(linear + baseOfs);
}
@@ -1031,9 +1031,9 @@ int PMAPI PM_getCOMPort(
int port)
{
switch (port) {
- case 0: return 0x3F8;
- case 1: return 0x2F8;
- }
+ case 0: return 0x3F8;
+ case 1: return 0x2F8;
+ }
return 0;
}
@@ -1045,10 +1045,10 @@ int PMAPI PM_getLPTPort(
int port)
{
switch (port) {
- case 0: return 0x3BC;
- case 1: return 0x378;
- case 2: return 0x278;
- }
+ case 0: return 0x3BC;
+ case 1: return 0x378;
+ case 2: return 0x278;
+ }
return 0;
}
@@ -1112,7 +1112,7 @@ void * PMAPI PM_mapRealPointer(
uint r_off)
{
if (r_seg == 0xFFFF)
- return &RMBuf[r_off];
+ return &RMBuf[r_off];
return lowMem + MK_PHYS(r_seg,r_off);
}
@@ -1126,7 +1126,7 @@ void * PMAPI PM_allocRealSeg(
uint *r_off)
{
if (size > sizeof(RMBuf))
- return NULL;
+ return NULL;
*r_seg = 0xFFFF;
*r_off = 0x0000;
return &RMBuf;
@@ -1160,79 +1160,79 @@ void PMAPI DPMI_int86(
ulong eax = 0;
if (!InitInt10())
- return;
+ return;
memset(&rmregs, 0, sizeof(rmregs));
rmregs.ulBIOSIntNo = intno;
INDPMI(eax); INDPMI(ebx); INDPMI(ecx); INDPMI(edx); INDPMI(esi); INDPMI(edi);
rmregs.aCRF.reg_ds = regs->ds;
rmregs.aCRF.reg_es = regs->es;
if (intno == 0x10) {
- eax = rmregs.aCRF.reg_eax;
- switch (eax & 0xFFFF) {
- case 0x4F00:
- /* We have to hack the way this function works, due to
- * some bugs in the IBM mini-VDM BIOS support. Specifically
- * we need to make the input buffer and output buffer the
- * 'same' buffer, and that ES:SI points to the output
- * buffer (ignored by the BIOS). The data will end up
- * being returned in the input buffer, except for the
- * first four bytes ('VESA') that will not be returned.
- */
- rmregs.pB[0].bBufferType = INPUT_BUFFER;
- rmregs.pB[0].bSelCRF = REG_OFFSET(reg_es);
- rmregs.pB[0].bOffCRF = REG_OFFSET(reg_edi);
- rmregs.pB[0].pAddress = RMBuf;
- rmregs.pB[0].ulSize = 4;
- rmregs.pB[1].bBufferType = OUTPUT_BUFFER;
- rmregs.pB[1].bSelCRF = REG_OFFSET(reg_es);
- rmregs.pB[1].bOffCRF = REG_OFFSET(reg_esi);
- rmregs.pB[1].pAddress = ((PBYTE)RMBuf)+4;
- rmregs.pB[1].ulSize = 512-4;
- break;
- case 0x4F01:
- rmregs.pB[0].bBufferType = OUTPUT_BUFFER;
- rmregs.pB[0].bSelCRF = REG_OFFSET(reg_es);
- rmregs.pB[0].bOffCRF = REG_OFFSET(reg_edi);
- rmregs.pB[0].pAddress = RMBuf;
- rmregs.pB[0].ulSize = 256;
- break;
- case 0x4F02:
- rmregs.pB[0].bBufferType = INPUT_BUFFER;
- rmregs.pB[0].bSelCRF = REG_OFFSET(reg_es);
- rmregs.pB[0].bOffCRF = REG_OFFSET(reg_edi);
- rmregs.pB[0].pAddress = RMBuf;
- rmregs.pB[0].ulSize = 256;
- break;
- case 0x4F09:
- rmregs.pB[0].bBufferType = INPUT_BUFFER;
- rmregs.pB[0].bSelCRF = REG_OFFSET(reg_es);
- rmregs.pB[0].bOffCRF = REG_OFFSET(reg_edi);
- rmregs.pB[0].pAddress = RMBuf;
- rmregs.pB[0].ulSize = 1024;
- break;
- case 0x4F0A:
- /* Due to bugs in the mini-VDM in OS/2, the 0x4F0A protected
- * mode interface functions will not work (we never get any
- * selectors returned), so we fail this function here. The
- * rest of the VBE/Core driver will work properly if this
- * function is failed, because the VBE 2.0 and 3.0 specs
- * allow for this.
- */
- regs->eax = 0x014F;
- return;
- }
- }
+ eax = rmregs.aCRF.reg_eax;
+ switch (eax & 0xFFFF) {
+ case 0x4F00:
+ /* We have to hack the way this function works, due to
+ * some bugs in the IBM mini-VDM BIOS support. Specifically
+ * we need to make the input buffer and output buffer the
+ * 'same' buffer, and that ES:SI points to the output
+ * buffer (ignored by the BIOS). The data will end up
+ * being returned in the input buffer, except for the
+ * first four bytes ('VESA') that will not be returned.
+ */
+ rmregs.pB[0].bBufferType = INPUT_BUFFER;
+ rmregs.pB[0].bSelCRF = REG_OFFSET(reg_es);
+ rmregs.pB[0].bOffCRF = REG_OFFSET(reg_edi);
+ rmregs.pB[0].pAddress = RMBuf;
+ rmregs.pB[0].ulSize = 4;
+ rmregs.pB[1].bBufferType = OUTPUT_BUFFER;
+ rmregs.pB[1].bSelCRF = REG_OFFSET(reg_es);
+ rmregs.pB[1].bOffCRF = REG_OFFSET(reg_esi);
+ rmregs.pB[1].pAddress = ((PBYTE)RMBuf)+4;
+ rmregs.pB[1].ulSize = 512-4;
+ break;
+ case 0x4F01:
+ rmregs.pB[0].bBufferType = OUTPUT_BUFFER;
+ rmregs.pB[0].bSelCRF = REG_OFFSET(reg_es);
+ rmregs.pB[0].bOffCRF = REG_OFFSET(reg_edi);
+ rmregs.pB[0].pAddress = RMBuf;
+ rmregs.pB[0].ulSize = 256;
+ break;
+ case 0x4F02:
+ rmregs.pB[0].bBufferType = INPUT_BUFFER;
+ rmregs.pB[0].bSelCRF = REG_OFFSET(reg_es);
+ rmregs.pB[0].bOffCRF = REG_OFFSET(reg_edi);
+ rmregs.pB[0].pAddress = RMBuf;
+ rmregs.pB[0].ulSize = 256;
+ break;
+ case 0x4F09:
+ rmregs.pB[0].bBufferType = INPUT_BUFFER;
+ rmregs.pB[0].bSelCRF = REG_OFFSET(reg_es);
+ rmregs.pB[0].bOffCRF = REG_OFFSET(reg_edi);
+ rmregs.pB[0].pAddress = RMBuf;
+ rmregs.pB[0].ulSize = 1024;
+ break;
+ case 0x4F0A:
+ /* Due to bugs in the mini-VDM in OS/2, the 0x4F0A protected
+ * mode interface functions will not work (we never get any
+ * selectors returned), so we fail this function here. The
+ * rest of the VBE/Core driver will work properly if this
+ * function is failed, because the VBE 2.0 and 3.0 specs
+ * allow for this.
+ */
+ regs->eax = 0x014F;
+ return;
+ }
+ }
if (useVPMI)
- PM_VIDEOPMI32Request(&Adapter,PMIREQUEST_SOFTWAREINT,NULL,&rmregs);
+ PM_VIDEOPMI32Request(&Adapter,PMIREQUEST_SOFTWAREINT,NULL,&rmregs);
else {
- DosSysCtl(6, &rmregs);
- }
+ DosSysCtl(6, &rmregs);
+ }
OUTDPMI(eax); OUTDPMI(ebx); OUTDPMI(ecx); OUTDPMI(edx); OUTDPMI(esi); OUTDPMI(edi);
if (((regs->eax & 0xFFFF) == 0x004F) && ((eax & 0xFFFF) == 0x4F00)) {
- /* Hack to fix up the missing 'VESA' string for mini-VDM */
- memcpy(RMBuf,"VESA",4);
- }
+ /* Hack to fix up the missing 'VESA' string for mini-VDM */
+ memcpy(RMBuf,"VESA",4);
+ }
regs->ds = rmregs.aCRF.reg_ds;
regs->es = rmregs.aCRF.reg_es;
regs->flags = rmregs.aCRF.reg_eflag;
@@ -1354,13 +1354,13 @@ static pageblock *PM_addNewPageBlock(void)
/* Allocate memory for the new page block, and add to head of list */
if (DosAllocSharedMem((void**)&newBlock,NULL,PAGE_BLOCK_SIZE,OBJ_GETTABLE | PAG_READ | PAG_WRITE | PAG_COMMIT))
- return NULL;
+ return NULL;
if (!PM_lockDataPages(newBlock,PAGE_BLOCK_SIZE,&newBlock->lockHandle))
- return NULL;
+ return NULL;
newBlock->prev = NULL;
newBlock->next = pageBlocks;
if (pageBlocks)
- pageBlocks->prev = newBlock;
+ pageBlocks->prev = newBlock;
pageBlocks = newBlock;
/* Initialise the page aligned free list for the page block */
@@ -1369,7 +1369,7 @@ static pageblock *PM_addNewPageBlock(void)
newBlock->freeListStart = newBlock->freeList;
newBlock->freeListEnd = p + (PAGES_PER_BLOCK-1) * PM_PAGE_SIZE;
for (i = 0; i < PAGES_PER_BLOCK; i++,p = next)
- FREELIST_NEXT(p) = next = p + PM_PAGE_SIZE;
+ FREELIST_NEXT(p) = next = p + PM_PAGE_SIZE;
FREELIST_NEXT(p - PM_PAGE_SIZE) = NULL;
return newBlock;
}
@@ -1388,11 +1388,11 @@ void * PMAPI PM_allocPage(
* page block if no free blocks are found.
*/
for (block = pageBlocks; block != NULL; block = block->next) {
- if (block->freeCount)
- break;
- }
+ if (block->freeCount)
+ break;
+ }
if (block == NULL && (block = PM_addNewPageBlock()) == NULL)
- return NULL;
+ return NULL;
block->freeCount--;
p = block->freeList;
block->freeList = FREELIST_NEXT(p);
@@ -1411,36 +1411,36 @@ void PMAPI PM_freePage(
/* First find the page block that this page belongs to */
for (block = pageBlocks; block != NULL; block = block->next) {
- if (p >= block->freeListStart && p <= block->freeListEnd)
- break;
- }
+ if (p >= block->freeListStart && p <= block->freeListEnd)
+ break;
+ }
CHECK(block != NULL);
/* Now free the block by adding it to the free list */
FREELIST_NEXT(p) = block->freeList;
block->freeList = p;
if (++block->freeCount == PAGES_PER_BLOCK) {
- /* If all pages in the page block are now free, free the entire
- * page block itself.
- */
- if (block == pageBlocks) {
- /* Delete from head */
- pageBlocks = block->next;
- if (block->next)
- block->next->prev = NULL;
- }
- else {
- /* Delete from middle of list */
- CHECK(block->prev != NULL);
- block->prev->next = block->next;
- if (block->next)
- block->next->prev = block->prev;
- }
-
- /* Unlock the memory and free it */
- PM_unlockDataPages(block,PAGE_BLOCK_SIZE,&block->lockHandle);
- DosFreeMem(block);
- }
+ /* If all pages in the page block are now free, free the entire
+ * page block itself.
+ */
+ if (block == pageBlocks) {
+ /* Delete from head */
+ pageBlocks = block->next;
+ if (block->next)
+ block->next->prev = NULL;
+ }
+ else {
+ /* Delete from middle of list */
+ CHECK(block->prev != NULL);
+ block->prev->next = block->next;
+ if (block->next)
+ block->next->prev = block->prev;
+ }
+
+ /* Unlock the memory and free it */
+ PM_unlockDataPages(block,PAGE_BLOCK_SIZE,&block->lockHandle);
+ DosFreeMem(block);
+ }
}
/****************************************************************************
@@ -1453,8 +1453,8 @@ void PMAPI PM_mapSharedPages(void)
/* Map all the page blocks above into the shared memory for process */
for (block = pageBlocks; block != NULL; block = block->next) {
- DosGetSharedMem(block, PAG_READ | PAG_WRITE);
- }
+ DosGetSharedMem(block, PAG_READ | PAG_WRITE);
+ }
}
/****************************************************************************
@@ -1533,7 +1533,7 @@ void PMAPI PM_setBankA(
INTCRF rmregs;
if (!InitInt10())
- return;
+ return;
memset(&rmregs, 0, sizeof(rmregs));
rmregs.ulBIOSIntNo = 0x10;
rmregs.aCRF.reg_eax = 0x4F05;
@@ -1552,7 +1552,7 @@ void PMAPI PM_setBankAB(
INTCRF rmregs;
if (!InitInt10())
- return;
+ return;
memset(&rmregs, 0, sizeof(rmregs));
rmregs.ulBIOSIntNo = 0x10;
rmregs.aCRF.reg_eax = 0x4F05;
@@ -1578,7 +1578,7 @@ void PMAPI PM_setCRTStart(
INTCRF rmregs;
if (!InitInt10())
- return;
+ return;
memset(&rmregs, 0, sizeof(rmregs));
rmregs.ulBIOSIntNo = 0x10;
rmregs.aCRF.reg_eax = 0x4F07;
@@ -1625,8 +1625,8 @@ int PMAPI PM_enableWriteCombine(
return MTRR_enableWriteCombine(base,size,type);
}
-// TODO: Move the MTRR helper stuff into the call gate, or better yet
-// entirely into the ring 0 helper driver!!
+/* TODO: Move the MTRR helper stuff into the call gate, or better yet */
+/* entirely into the ring 0 helper driver!! */
/* MTRR helper functions. To make it easier to implement the MTRR support
* under OS/2, we simply put our ring 0 helper functions into the
@@ -1705,7 +1705,7 @@ void _ASMAPI _MTRR_writeMSR(
PM_MODULE PMAPI PM_loadLibrary(
const char *szDLLName)
{
- // TODO: Implement this to load shared libraries!
+ /* TODO: Implement this to load shared libraries! */
(void)szDLLName;
return NULL;
}
@@ -1714,7 +1714,7 @@ void * PMAPI PM_getProcAddress(
PM_MODULE hModule,
const char *szProcName)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
(void)hModule;
(void)szProcName;
return NULL;
@@ -1723,7 +1723,7 @@ void * PMAPI PM_getProcAddress(
void PMAPI PM_freeLibrary(
PM_MODULE hModule)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
(void)hModule;
}
@@ -1740,15 +1740,15 @@ static void convertFindData(
memset(findData,0,findData->dwSize);
findData->dwSize = dwSize;
if (blk->attrFile & FILE_READONLY)
- findData->attrib |= PM_FILE_READONLY;
+ findData->attrib |= PM_FILE_READONLY;
if (blk->attrFile & FILE_DIRECTORY)
- findData->attrib |= PM_FILE_DIRECTORY;
+ findData->attrib |= PM_FILE_DIRECTORY;
if (blk->attrFile & FILE_ARCHIVED)
- findData->attrib |= PM_FILE_ARCHIVE;
+ findData->attrib |= PM_FILE_ARCHIVE;
if (blk->attrFile & FILE_HIDDEN)
- findData->attrib |= PM_FILE_HIDDEN;
+ findData->attrib |= PM_FILE_HIDDEN;
if (blk->attrFile & FILE_SYSTEM)
- findData->attrib |= PM_FILE_SYSTEM;
+ findData->attrib |= PM_FILE_SYSTEM;
findData->sizeLo = blk->cbFile;
findData->sizeHi = 0;
strncpy(findData->name,blk->achName,PM_MAX_PATH);
@@ -1770,9 +1770,9 @@ void *PMAPI PM_findFirstFile(
ulong count = 1;
if (DosFindFirst((PSZ)filename,&hdir,FIND_MASK,&blk,sizeof(blk),&count,FIL_STANDARD) == NO_ERROR) {
- convertFindData(findData,&blk);
- return (void*)hdir;
- }
+ convertFindData(findData,&blk);
+ return (void*)hdir;
+ }
return PM_FILE_INVALID;
}
@@ -1788,9 +1788,9 @@ ibool PMAPI PM_findNextFile(
ulong count = 1;
if (DosFindNext((HDIR)handle,&blk,sizeof(blk),&count) == NO_ERROR) {
- convertFindData(findData,&blk);
- return true;
- }
+ convertFindData(findData,&blk);
+ return true;
+ }
return false;
}
@@ -1857,16 +1857,16 @@ void PMAPI PM_setFileAttr(
FILESTATUS3 s;
if (DosQueryPathInfo((PSZ)filename,FIL_STANDARD,(PVOID)&s,sizeof(s)))
- return;
+ return;
s.attrFile = 0;
if (attrib & PM_FILE_READONLY)
- s.attrFile |= FILE_READONLY;
+ s.attrFile |= FILE_READONLY;
if (attrib & PM_FILE_ARCHIVE)
- s.attrFile |= FILE_ARCHIVED;
+ s.attrFile |= FILE_ARCHIVED;
if (attrib & PM_FILE_HIDDEN)
- s.attrFile |= FILE_HIDDEN;
+ s.attrFile |= FILE_HIDDEN;
if (attrib & PM_FILE_SYSTEM)
- s.attrFile |= FILE_SYSTEM;
+ s.attrFile |= FILE_SYSTEM;
DosSetPathInfo((PSZ)filename,FIL_STANDARD,(PVOID)&s,sizeof(s),0L);
}
@@ -1881,15 +1881,15 @@ uint PMAPI PM_getFileAttr(
uint retval = 0;
if (DosQueryPathInfo((PSZ)filename, FIL_STANDARD, &fs3, sizeof(FILESTATUS3)))
- return 0;
+ return 0;
if (fs3.attrFile & FILE_READONLY)
- retval |= PM_FILE_READONLY;
+ retval |= PM_FILE_READONLY;
if (fs3.attrFile & FILE_ARCHIVED)
- retval |= PM_FILE_ARCHIVE;
+ retval |= PM_FILE_ARCHIVE;
if (fs3.attrFile & FILE_HIDDEN)
- retval |= PM_FILE_HIDDEN;
+ retval |= PM_FILE_HIDDEN;
if (fs3.attrFile & FILE_SYSTEM)
- retval |= PM_FILE_SYSTEM;
+ retval |= PM_FILE_SYSTEM;
return retval;
}
@@ -1928,33 +1928,33 @@ ibool PMAPI PM_getFileTime(
time_t tt;
if (DosQueryPathInfo((PSZ)filename, FIL_STANDARD, &fs3, sizeof(FILESTATUS3)))
- return false;
+ return false;
if (gmTime) {
- tc.tm_year = fs3.fdateLastWrite.year + 80;
- tc.tm_mon = fs3.fdateLastWrite.month - 1;
- tc.tm_mday = fs3.fdateLastWrite.day;
- tc.tm_hour = fs3.ftimeLastWrite.hours;
- tc.tm_min = fs3.ftimeLastWrite.minutes;
- tc.tm_sec = fs3.ftimeLastWrite.twosecs * 2;
- if((tt = mktime(&tc)) == -1)
- return false;
- if(!(ret = gmtime(&tt)))
- return false;
- time->sec = ret->tm_sec;
- time->day = ret->tm_mday;
- time->mon = ret->tm_mon + 1;
- time->year = ret->tm_year - 80;
- time->min = ret->tm_min;
- time->hour = ret->tm_hour;
- }
+ tc.tm_year = fs3.fdateLastWrite.year + 80;
+ tc.tm_mon = fs3.fdateLastWrite.month - 1;
+ tc.tm_mday = fs3.fdateLastWrite.day;
+ tc.tm_hour = fs3.ftimeLastWrite.hours;
+ tc.tm_min = fs3.ftimeLastWrite.minutes;
+ tc.tm_sec = fs3.ftimeLastWrite.twosecs * 2;
+ if((tt = mktime(&tc)) == -1)
+ return false;
+ if(!(ret = gmtime(&tt)))
+ return false;
+ time->sec = ret->tm_sec;
+ time->day = ret->tm_mday;
+ time->mon = ret->tm_mon + 1;
+ time->year = ret->tm_year - 80;
+ time->min = ret->tm_min;
+ time->hour = ret->tm_hour;
+ }
else {
- time->sec = fs3.ftimeLastWrite.twosecs * 2;
- time->day = fs3.fdateLastWrite.day;
- time->mon = fs3.fdateLastWrite.month;
- time->year = fs3.fdateLastWrite.year;
- time->min = fs3.ftimeLastWrite.minutes;
- time->hour = fs3.ftimeLastWrite.hours;
- }
+ time->sec = fs3.ftimeLastWrite.twosecs * 2;
+ time->day = fs3.fdateLastWrite.day;
+ time->mon = fs3.fdateLastWrite.month;
+ time->year = fs3.fdateLastWrite.year;
+ time->min = fs3.ftimeLastWrite.minutes;
+ time->hour = fs3.ftimeLastWrite.hours;
+ }
return true;
}
@@ -1973,32 +1973,32 @@ ibool PMAPI PM_setFileTime(
time_t tt;
if (DosQueryPathInfo((PSZ)filename,FIL_STANDARD,(PVOID)&fs3,sizeof(fs3)))
- return false;
+ return false;
if (gmTime) {
- tc.tm_year = time->year + 80;
- tc.tm_mon = time->mon - 1;
- tc.tm_mday = time->day;
- tc.tm_hour = time->hour;
- tc.tm_min = time->min;
- tc.tm_sec = time->sec;
- if((tt = mktime(&tc)) == -1)
- return false;
- ret = localtime(&tt);
- fs3.ftimeLastWrite.twosecs = ret->tm_sec / 2;
- fs3.fdateLastWrite.day = ret->tm_mday;
- fs3.fdateLastWrite.month = ret->tm_mon + 1;
- fs3.fdateLastWrite.year = ret->tm_year - 80;
- fs3.ftimeLastWrite.minutes = ret->tm_min;
- fs3.ftimeLastWrite.hours = ret->tm_hour;
- }
+ tc.tm_year = time->year + 80;
+ tc.tm_mon = time->mon - 1;
+ tc.tm_mday = time->day;
+ tc.tm_hour = time->hour;
+ tc.tm_min = time->min;
+ tc.tm_sec = time->sec;
+ if((tt = mktime(&tc)) == -1)
+ return false;
+ ret = localtime(&tt);
+ fs3.ftimeLastWrite.twosecs = ret->tm_sec / 2;
+ fs3.fdateLastWrite.day = ret->tm_mday;
+ fs3.fdateLastWrite.month = ret->tm_mon + 1;
+ fs3.fdateLastWrite.year = ret->tm_year - 80;
+ fs3.ftimeLastWrite.minutes = ret->tm_min;
+ fs3.ftimeLastWrite.hours = ret->tm_hour;
+ }
else {
- fs3.ftimeLastWrite.twosecs = time->sec / 2;
- fs3.fdateLastWrite.day = time->day;
- fs3.fdateLastWrite.month = time->mon;
- fs3.fdateLastWrite.year = time->year;
- fs3.ftimeLastWrite.minutes = time->min;
- fs3.ftimeLastWrite.hours = time->hour;
- }
+ fs3.ftimeLastWrite.twosecs = time->sec / 2;
+ fs3.fdateLastWrite.day = time->day;
+ fs3.fdateLastWrite.month = time->mon;
+ fs3.fdateLastWrite.year = time->year;
+ fs3.ftimeLastWrite.minutes = time->min;
+ fs3.ftimeLastWrite.hours = time->hour;
+ }
memcpy(&fs3.fdateLastAccess, &fs3.fdateLastWrite, sizeof(FDATE));
memcpy(&fs3.fdateCreation, &fs3.fdateLastWrite, sizeof(FDATE));
memcpy(&fs3.ftimeLastAccess, &fs3.ftimeLastWrite, sizeof(FTIME));
diff --git a/board/MAI/bios_emulator/scitech/src/pm/os2pm/event.c b/board/MAI/bios_emulator/scitech/src/pm/os2pm/event.c
index 97c2caa82f..7af20a9568 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/os2pm/event.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/os2pm/event.c
@@ -59,7 +59,7 @@ Pumps all messages in the message queue from OS/2 into our event queue.
****************************************************************************/
static void _EVT_pumpMessages(void)
{
- // TODO: Implement this for OS/2 Presentation Manager apps!
+ /* TODO: Implement this for OS/2 Presentation Manager apps! */
}
/****************************************************************************
@@ -105,7 +105,7 @@ void EVTAPI EVT_init(
oldKeyMessage = 0;
memset(keyUpMsg,0,sizeof(keyUpMsg));
- // TODO: OS/2 PM specific initialisation code!
+ /* TODO: OS/2 PM specific initialisation code! */
/* Catch program termination signals so we can clean up properly */
signal(SIGABRT, _EVT_abort);
@@ -135,7 +135,7 @@ and this function can be used to resume it again later.
****************************************************************************/
void EVT_resume(void)
{
- // Do nothing for OS/2
+ /* Do nothing for OS/2 */
}
/****************************************************************************
@@ -145,7 +145,7 @@ de-install the event handling code.
****************************************************************************/
void EVT_suspend(void)
{
- // Do nothing for OS/2
+ /* Do nothing for OS/2 */
}
/****************************************************************************
@@ -159,7 +159,7 @@ void EVT_exit(void)
signal(SIGFPE, SIG_DFL);
signal(SIGINT, SIG_DFL);
- // TODO: OS/2 PM specific exit code
+ /* TODO: OS/2 PM specific exit code */
}
/****************************************************************************
diff --git a/board/MAI/bios_emulator/scitech/src/pm/photon/event.c b/board/MAI/bios_emulator/scitech/src/pm/photon/event.c
index 738dfea379..581da16fdf 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/photon/event.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/photon/event.c
@@ -51,7 +51,7 @@ static ibool _EVT_isKeyDown(
uchar scancode)
{
return (KeyState[(scancode & 0xf8) >> 3] & (1 << (scancode & 0x7)) ?
- true : false);
+ true : false);
}
/****************************************************************************
@@ -71,100 +71,100 @@ static void _EVT_pumpMessages(void)
event_t _evt;
while (count < EVENTQSIZE) {
- uint mods = 0, keyp = 0;
+ uint mods = 0, keyp = 0;
- pid = Creceive(0, &msg, sizeof (msg));
+ pid = Creceive(0, &msg, sizeof (msg));
- if (pid == -1)
- return;
+ if (pid == -1)
+ return;
- if (PhEventRead(pid, event, sizeof (evt)) == Ph_EVENT_MSG) {
- memset(&evt, 0, sizeof (evt));
- if (event->type == Ph_EV_KEY) {
- key = PhGetData(event);
+ if (PhEventRead(pid, event, sizeof (evt)) == Ph_EVENT_MSG) {
+ memset(&evt, 0, sizeof (evt));
+ if (event->type == Ph_EV_KEY) {
+ key = PhGetData(event);
- if (key->key_flags & KEY_SCAN_VALID) {
- keyp = key->key_scan;
- if (key->key_flags & KEY_DOWN)
- KeyState[(keyp & 0xf800) >> 11]
- |= 1 << ((keyp & 0x700) >> 8);
- else
- KeyState[(keyp & 0xf800) >> 11]
- &= ~(1 << ((keyp & 0x700) >> 8));
- }
- if ((key->key_flags & KEY_SYM_VALID) || extended)
- keyp |= key->key_sym;
+ if (key->key_flags & KEY_SCAN_VALID) {
+ keyp = key->key_scan;
+ if (key->key_flags & KEY_DOWN)
+ KeyState[(keyp & 0xf800) >> 11]
+ |= 1 << ((keyp & 0x700) >> 8);
+ else
+ KeyState[(keyp & 0xf800) >> 11]
+ &= ~(1 << ((keyp & 0x700) >> 8));
+ }
+ if ((key->key_flags & KEY_SYM_VALID) || extended)
+ keyp |= key->key_sym;
- /* No way to tell left from right... */
- if (key->key_mods & KEYMOD_SHIFT)
- mods = (EVT_LEFTSHIFT | EVT_RIGHTSHIFT);
- if (key->key_mods & KEYMOD_CTRL)
- mods |= (EVT_CTRLSTATE | EVT_LEFTCTRL);
- if (key->key_mods & KEYMOD_ALT)
- mods |= (EVT_ALTSTATE | EVT_LEFTALT);
+ /* No way to tell left from right... */
+ if (key->key_mods & KEYMOD_SHIFT)
+ mods = (EVT_LEFTSHIFT | EVT_RIGHTSHIFT);
+ if (key->key_mods & KEYMOD_CTRL)
+ mods |= (EVT_CTRLSTATE | EVT_LEFTCTRL);
+ if (key->key_mods & KEYMOD_ALT)
+ mods |= (EVT_ALTSTATE | EVT_LEFTALT);
- _evt.when = evt->timestamp;
- if (key->key_flags & KEY_REPEAT) {
- _evt.what = EVT_KEYREPEAT;
- _evt.message = 0x10000;
- }
- else if (key->key_flags & KEY_DOWN)
- _evt.what = EVT_KEYDOWN;
- else
- _evt.what = EVT_KEYUP;
- _evt.modifiers = mods;
- _evt.message |= keyp;
+ _evt.when = evt->timestamp;
+ if (key->key_flags & KEY_REPEAT) {
+ _evt.what = EVT_KEYREPEAT;
+ _evt.message = 0x10000;
+ }
+ else if (key->key_flags & KEY_DOWN)
+ _evt.what = EVT_KEYDOWN;
+ else
+ _evt.what = EVT_KEYUP;
+ _evt.modifiers = mods;
+ _evt.message |= keyp;
- addEvent(&_evt);
+ addEvent(&_evt);
- switch(key->key_scan & 0xff00) {
- case 0xe000:
- extended = 1;
- break;
- case 0xe001:
- extended = 2;
- break;
- default:
- if (extended)
- extended--;
- }
- }
- else if (event->type & Ph_EV_PTR_ALL) {
- but_stat = message = 0;
- mouse = PhGetData(event);
+ switch(key->key_scan & 0xff00) {
+ case 0xe000:
+ extended = 1;
+ break;
+ case 0xe001:
+ extended = 2;
+ break;
+ default:
+ if (extended)
+ extended--;
+ }
+ }
+ else if (event->type & Ph_EV_PTR_ALL) {
+ but_stat = message = 0;
+ mouse = PhGetData(event);
- if (mouse->button_state & Ph_BUTTON_3)
- but_stat = EVT_LEFTBUT;
- if (mouse->buttons & Ph_BUTTON_3)
- message = EVT_LEFTBMASK;
+ if (mouse->button_state & Ph_BUTTON_3)
+ but_stat = EVT_LEFTBUT;
+ if (mouse->buttons & Ph_BUTTON_3)
+ message = EVT_LEFTBMASK;
- if (mouse->button_state & Ph_BUTTON_1)
- but_stat |= EVT_RIGHTBUT;
- if (mouse->buttons & Ph_BUTTON_1)
- message |= EVT_RIGHTBMASK;
+ if (mouse->button_state & Ph_BUTTON_1)
+ but_stat |= EVT_RIGHTBUT;
+ if (mouse->buttons & Ph_BUTTON_1)
+ message |= EVT_RIGHTBMASK;
- _evt.when = evt->timestamp;
- if (event->type & Ph_EV_PTR_MOTION) {
- _evt.what = EVT_MOUSEMOVE;
- _evt.where_x = mouse->pos.x;
- _evt.where_y = mouse->pos.y;
- _evt.modifiers = but_stat;
- addEvent(&_evt);
- }
- if (event->type & Ph_EV_BUT_PRESS)
- _evt.what = EVT_MOUSEDOWN;
- else
- _evt.what = EVT_MOUSEUP;
- _evt.where_x = mouse->pos.x;
- _evt.where_y = mouse->pos.y;
- _evt.modifiers = but_stat;
- _evt.message = message;
- addEvent(&_evt);
- }
- }
- else
- return;
- }
+ _evt.when = evt->timestamp;
+ if (event->type & Ph_EV_PTR_MOTION) {
+ _evt.what = EVT_MOUSEMOVE;
+ _evt.where_x = mouse->pos.x;
+ _evt.where_y = mouse->pos.y;
+ _evt.modifiers = but_stat;
+ addEvent(&_evt);
+ }
+ if (event->type & Ph_EV_BUT_PRESS)
+ _evt.what = EVT_MOUSEDOWN;
+ else
+ _evt.what = EVT_MOUSEUP;
+ _evt.where_x = mouse->pos.x;
+ _evt.where_y = mouse->pos.y;
+ _evt.modifiers = but_stat;
+ _evt.message = message;
+ addEvent(&_evt);
+ }
+ }
+ else
+ return;
+ }
}
/****************************************************************************
@@ -230,8 +230,8 @@ void EVTAPI EVT_setMouseRange(
int xRes,
int yRes)
{
- // TODO: Need to call Input to change the coordinates that it returns
- // for mouse events!!
+ /* TODO: Need to call Input to change the coordinates that it returns */
+ /* for mouse events!! */
}
/****************************************************************************
@@ -242,7 +242,7 @@ and this function can be used to resume it again later.
****************************************************************************/
void EVT_resume(void)
{
- // Do nothing for Photon
+ /* Do nothing for Photon */
}
/****************************************************************************
@@ -252,7 +252,7 @@ de-install the event handling code.
****************************************************************************/
void EVT_suspend(void)
{
- // Do nothing for Photon
+ /* Do nothing for Photon */
}
/****************************************************************************
diff --git a/board/MAI/bios_emulator/scitech/src/pm/qnx/event.c b/board/MAI/bios_emulator/scitech/src/pm/qnx/event.c
index e16f8a5392..45cd514454 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/qnx/event.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/qnx/event.c
@@ -37,7 +37,7 @@
#ifndef __QNXNTO__
static struct _mouse_ctrl *_PM_mouse_ctl;
static int _PM_keyboard_fd = -1;
-//static int _PM_modifiers, _PM_leds;
+/*static int _PM_modifiers, _PM_leds; */
#else
static int kbd_fd = -1, mouse_fd = -1;
#endif
@@ -58,7 +58,7 @@ typedef struct {
int map;
} keymap;
-// TODO: Fix this and set it up so we can do a binary search!
+/* TODO: Fix this and set it up so we can do a binary search! */
keymap keymaps[] = {
{96, KB_padEnter},
@@ -146,8 +146,8 @@ Converts a mickey movement value to a pixel adjustment value.
static int MickeyToPixel(
int mickey)
{
- // TODO: We can add some code in here to handle 'acceleration' for
- // the mouse cursor. For now just use the mickeys.
+ /* TODO: We can add some code in here to handle 'acceleration' for */
+ /* the mouse cursor. For now just use the mickeys. */
return mickey;
}
@@ -167,110 +167,110 @@ static void _EVT_pumpMessages(void)
event_t evt;
while (EVT.count < EVENTQSIZE) {
- rc1 = read(kbd_fd, (void *)&key, sizeof(key));
- if (rc1 == -1) {
- if (errno == EAGAIN)
- rc1 = 0;
- else {
- perror("getEvents");
- PM_fatalError("Keyboard error");
- }
- }
- if (rc1 > 0) {
- memset(&evt, 0, sizeof(evt));
- if (key.data.modifiers & KEYMOD_SHIFT)
- mods |= EVT_LEFTSHIFT;
- if (key.data.modifiers & KEYMOD_CTRL)
- mods |= EVT_CTRLSTATE;
- if (key.data.modifiers & KEYMOD_ALT)
- mods |= EVT_ALTSTATE;
-
- /* Now store the keyboard event data */
- evt.when = TIME_TO_MSEC(key.time);
- if (key.data.flags & KEY_SCAN_VALID)
- evt.message |= (key.data.key_scan & 0x7F) << 8;
- if ((key.data.flags & KEY_SYM_VALID) &&
- (((key.data.key_sym & 0xff00) == 0xf000 &&
- (key.data.key_sym & 0xff) < 0x20) ||
- key.data.key_sym < 0x80))
- evt.message |= (key.data.key_sym & 0xFF);
- evt.modifiers = mods;
- if (key.data.flags & KEY_DOWN) {
- evt.what = EVT_KEYDOWN;
- keyUpMsg[evt.message >> 8] = (ushort)evt.message;
- }
- else if (key.data.flags & KEY_REPEAT) {
- evt.message |= 0x10000;
- evt.what = EVT_KEYREPEAT;
- }
- else {
- evt.what = EVT_KEYUP;
- evt.message = keyUpMsg[evt.message >> 8];
- if (evt.message == 0)
- continue;
- keyUpMsg[evt.message >> 8] = 0;
- }
-
- /* Now add the new event to the event queue */
- addEvent(&evt);
- }
- rc2 = read(mouse_fd, (void *)&ms, sizeof (ms));
- if (rc2 == -1) {
- if (errno == EAGAIN)
- rc2 = 0;
- else {
- perror("getEvents");
- PM_fatalError("Mouse error");
- }
- }
- if (rc2 > 0) {
- memset(&evt, 0, sizeof(evt));
- ms.hdr.buttons &=
- (_POINTER_BUTTON_LEFT | _POINTER_BUTTON_RIGHT);
- if (ms.hdr.buttons & _POINTER_BUTTON_LEFT)
- but_stat = EVT_LEFTBUT;
- if ((ms.hdr.buttons & _POINTER_BUTTON_LEFT) !=
- (old_buttons & _POINTER_BUTTON_LEFT))
- message = EVT_LEFTBMASK;
- if (ms.hdr.buttons & _POINTER_BUTTON_RIGHT)
- but_stat |= EVT_RIGHTBUT;
- if ((ms.hdr.buttons & _POINTER_BUTTON_RIGHT) !=
- (old_buttons & _POINTER_BUTTON_RIGHT))
- message |= EVT_RIGHTBMASK;
- if (ms.dx || ms.dy) {
- ms.dy = -ms.dy;
- EVT.mx += MickeyToPixel(ms.dx);
- EVT.my += MickeyToPixel(ms.dy);
- if (EVT.mx < 0) EVT.mx = 0;
- if (EVT.my < 0) EVT.my = 0;
- if (EVT.mx > rangeX) EVT.mx = rangeX;
- if (EVT.my > rangeY) EVT.my = rangeY;
- evt.what = EVT_MOUSEMOVE;
- evt.when = TIME_TO_MSEC(ms.hdr.time);
- evt.where_x = EVT.mx;
- evt.where_y = EVT.my;
- evt.relative_x = ms.dx;
- evt.relative_y = ms.dy;
- evt.modifiers = but_stat;
- addEvent(&evt);
- }
- evt.what = ms.hdr.buttons < old_buttons ?
- EVT_MOUSEUP : EVT_MOUSEDOWN;
- evt.when = TIME_TO_MSEC(ms.hdr.time);
- evt.where_x = EVT.mx;
- evt.where_y = EVT.my;
- evt.relative_x = ms.dx;
- evt.relative_y = ms.dy;
- evt.modifiers = but_stat;
- evt.message = message;
- if (ms.hdr.buttons != old_buttons) {
- addEvent(&evt);
- old_buttons = ms.hdr.buttons;
- }
- }
- if (rc1 + rc2 == 0)
- break;
- }
+ rc1 = read(kbd_fd, (void *)&key, sizeof(key));
+ if (rc1 == -1) {
+ if (errno == EAGAIN)
+ rc1 = 0;
+ else {
+ perror("getEvents");
+ PM_fatalError("Keyboard error");
+ }
+ }
+ if (rc1 > 0) {
+ memset(&evt, 0, sizeof(evt));
+ if (key.data.modifiers & KEYMOD_SHIFT)
+ mods |= EVT_LEFTSHIFT;
+ if (key.data.modifiers & KEYMOD_CTRL)
+ mods |= EVT_CTRLSTATE;
+ if (key.data.modifiers & KEYMOD_ALT)
+ mods |= EVT_ALTSTATE;
+
+ /* Now store the keyboard event data */
+ evt.when = TIME_TO_MSEC(key.time);
+ if (key.data.flags & KEY_SCAN_VALID)
+ evt.message |= (key.data.key_scan & 0x7F) << 8;
+ if ((key.data.flags & KEY_SYM_VALID) &&
+ (((key.data.key_sym & 0xff00) == 0xf000 &&
+ (key.data.key_sym & 0xff) < 0x20) ||
+ key.data.key_sym < 0x80))
+ evt.message |= (key.data.key_sym & 0xFF);
+ evt.modifiers = mods;
+ if (key.data.flags & KEY_DOWN) {
+ evt.what = EVT_KEYDOWN;
+ keyUpMsg[evt.message >> 8] = (ushort)evt.message;
+ }
+ else if (key.data.flags & KEY_REPEAT) {
+ evt.message |= 0x10000;
+ evt.what = EVT_KEYREPEAT;
+ }
+ else {
+ evt.what = EVT_KEYUP;
+ evt.message = keyUpMsg[evt.message >> 8];
+ if (evt.message == 0)
+ continue;
+ keyUpMsg[evt.message >> 8] = 0;
+ }
+
+ /* Now add the new event to the event queue */
+ addEvent(&evt);
+ }
+ rc2 = read(mouse_fd, (void *)&ms, sizeof (ms));
+ if (rc2 == -1) {
+ if (errno == EAGAIN)
+ rc2 = 0;
+ else {
+ perror("getEvents");
+ PM_fatalError("Mouse error");
+ }
+ }
+ if (rc2 > 0) {
+ memset(&evt, 0, sizeof(evt));
+ ms.hdr.buttons &=
+ (_POINTER_BUTTON_LEFT | _POINTER_BUTTON_RIGHT);
+ if (ms.hdr.buttons & _POINTER_BUTTON_LEFT)
+ but_stat = EVT_LEFTBUT;
+ if ((ms.hdr.buttons & _POINTER_BUTTON_LEFT) !=
+ (old_buttons & _POINTER_BUTTON_LEFT))
+ message = EVT_LEFTBMASK;
+ if (ms.hdr.buttons & _POINTER_BUTTON_RIGHT)
+ but_stat |= EVT_RIGHTBUT;
+ if ((ms.hdr.buttons & _POINTER_BUTTON_RIGHT) !=
+ (old_buttons & _POINTER_BUTTON_RIGHT))
+ message |= EVT_RIGHTBMASK;
+ if (ms.dx || ms.dy) {
+ ms.dy = -ms.dy;
+ EVT.mx += MickeyToPixel(ms.dx);
+ EVT.my += MickeyToPixel(ms.dy);
+ if (EVT.mx < 0) EVT.mx = 0;
+ if (EVT.my < 0) EVT.my = 0;
+ if (EVT.mx > rangeX) EVT.mx = rangeX;
+ if (EVT.my > rangeY) EVT.my = rangeY;
+ evt.what = EVT_MOUSEMOVE;
+ evt.when = TIME_TO_MSEC(ms.hdr.time);
+ evt.where_x = EVT.mx;
+ evt.where_y = EVT.my;
+ evt.relative_x = ms.dx;
+ evt.relative_y = ms.dy;
+ evt.modifiers = but_stat;
+ addEvent(&evt);
+ }
+ evt.what = ms.hdr.buttons < old_buttons ?
+ EVT_MOUSEUP : EVT_MOUSEDOWN;
+ evt.when = TIME_TO_MSEC(ms.hdr.time);
+ evt.where_x = EVT.mx;
+ evt.where_y = EVT.my;
+ evt.relative_x = ms.dx;
+ evt.relative_y = ms.dy;
+ evt.modifiers = but_stat;
+ evt.message = message;
+ if (ms.hdr.buttons != old_buttons) {
+ addEvent(&evt);
+ old_buttons = ms.hdr.buttons;
+ }
+ }
+ if (rc1 + rc2 == 0)
+ break;
+ }
}
#else
/****************************************************************************
@@ -290,66 +290,66 @@ static void _EVT_pumpMessages(void)
/* Poll keyboard events */
while ((numkeys = read(_PM_keyboard_fd, buf, sizeof buf)) > 0) {
- for (i = 0; i < numkeys; i++) {
- processRawScanCode(buf[i]);
- }
- }
+ for (i = 0; i < numkeys; i++) {
+ processRawScanCode(buf[i]);
+ }
+ }
if (_PM_mouse_ctl == NULL)
- return;
+ return;
/* Gobble pending mouse events */
while (EVT.count < EVENTQSIZE) {
- rc = mouse_read(_PM_mouse_ctl, &ev, 1, 0, NULL);
- if (rc == -1) {
- perror("getEvents");
- PM_fatalError("Mouse error (Input terminated?)");
- }
- if (rc == 0)
- break;
-
- message = 0, but_stat = 0;
- memset(&evt, 0, sizeof(evt));
-
- ev.buttons &= (_MOUSE_LEFT | _MOUSE_RIGHT);
- if (ev.buttons & _MOUSE_LEFT)
- but_stat = EVT_LEFTBUT;
- if ((ev.buttons & _MOUSE_LEFT) != (old_buttons & _MOUSE_LEFT))
- message = EVT_LEFTBMASK;
- if (ev.buttons & _MOUSE_RIGHT)
- but_stat |= EVT_RIGHTBUT;
- if ((ev.buttons & _MOUSE_RIGHT) != (old_buttons & _MOUSE_RIGHT))
- message |= EVT_RIGHTBMASK;
- if (ev.dx || ev.dy) {
- ev.dy = -ev.dy;
- EVT.mx += MickeyToPixel(ev.dx);
- EVT.my += MickeyToPixel(ev.dy);
- if (EVT.mx < 0) EVT.mx = 0;
- if (EVT.my < 0) EVT.my = 0;
- if (EVT.mx > rangeX) EVT.mx = rangeX;
- if (EVT.my > rangeY) EVT.my = rangeY;
- evt.what = EVT_MOUSEMOVE;
- evt.when = ev.timestamp*100;
- evt.where_x = EVT.mx;
- evt.where_y = EVT.my;
- evt.relative_x = ev.dx;
- evt.relative_y = ev.dy;
- evt.modifiers = but_stat;
- addEvent(&evt);
- }
- evt.what = ev.buttons < old_buttons ? EVT_MOUSEUP : EVT_MOUSEDOWN;
- evt.when = ev.timestamp*100;
- evt.where_x = EVT.mx;
- evt.where_y = EVT.my;
- evt.relative_x = ev.dx;
- evt.relative_y = ev.dy;
- evt.modifiers = but_stat;
- evt.message = message;
- if (ev.buttons != old_buttons) {
- addEvent(&evt);
- old_buttons = ev.buttons;
- }
- }
+ rc = mouse_read(_PM_mouse_ctl, &ev, 1, 0, NULL);
+ if (rc == -1) {
+ perror("getEvents");
+ PM_fatalError("Mouse error (Input terminated?)");
+ }
+ if (rc == 0)
+ break;
+
+ message = 0, but_stat = 0;
+ memset(&evt, 0, sizeof(evt));
+
+ ev.buttons &= (_MOUSE_LEFT | _MOUSE_RIGHT);
+ if (ev.buttons & _MOUSE_LEFT)
+ but_stat = EVT_LEFTBUT;
+ if ((ev.buttons & _MOUSE_LEFT) != (old_buttons & _MOUSE_LEFT))
+ message = EVT_LEFTBMASK;
+ if (ev.buttons & _MOUSE_RIGHT)
+ but_stat |= EVT_RIGHTBUT;
+ if ((ev.buttons & _MOUSE_RIGHT) != (old_buttons & _MOUSE_RIGHT))
+ message |= EVT_RIGHTBMASK;
+ if (ev.dx || ev.dy) {
+ ev.dy = -ev.dy;
+ EVT.mx += MickeyToPixel(ev.dx);
+ EVT.my += MickeyToPixel(ev.dy);
+ if (EVT.mx < 0) EVT.mx = 0;
+ if (EVT.my < 0) EVT.my = 0;
+ if (EVT.mx > rangeX) EVT.mx = rangeX;
+ if (EVT.my > rangeY) EVT.my = rangeY;
+ evt.what = EVT_MOUSEMOVE;
+ evt.when = ev.timestamp*100;
+ evt.where_x = EVT.mx;
+ evt.where_y = EVT.my;
+ evt.relative_x = ev.dx;
+ evt.relative_y = ev.dy;
+ evt.modifiers = but_stat;
+ addEvent(&evt);
+ }
+ evt.what = ev.buttons < old_buttons ? EVT_MOUSEUP : EVT_MOUSEDOWN;
+ evt.when = ev.timestamp*100;
+ evt.where_x = EVT.mx;
+ evt.where_y = EVT.my;
+ evt.relative_x = ev.dx;
+ evt.relative_y = ev.dy;
+ evt.modifiers = but_stat;
+ evt.message = message;
+ if (ev.buttons != old_buttons) {
+ addEvent(&evt);
+ old_buttons = ev.buttons;
+ }
+ }
}
#endif /* __QNXNTO__ */
@@ -400,7 +400,7 @@ void EVTAPI EVT_init(
char buf[128];
FILE *p;
int argno,len;
-#endif
+#endif
#ifdef __QNXNTO__
ThreadCtl(_NTO_TCTL_IO, 0); /* So joystick code won't blow up */
@@ -410,7 +410,7 @@ void EVTAPI EVT_init(
EVT.mouseMove = mouseMove;
initEventQueue();
memset(keyUpMsg,0,sizeof(keyUpMsg));
-
+
#ifdef __QNXNTO__
/*
* User may already have input running with the right parameters.
@@ -419,82 +419,82 @@ void EVTAPI EVT_init(
* manager.
*/
if ((mouse_fd = open("/dev/mouse0", O_RDONLY | O_NONBLOCK)) < 0) {
- /* Run inputtrap to get the args for input */
- if ((p = popen("inputtrap", "r")) == NULL)
- PM_fatalError("Error running 'inputtrap'");
- fgets(buf, sizeof(buf), p);
- pclose(p);
-
- /* Build the argument list */
- len = strlen(buf);
- iarg[0] = buf;
- for (i = 0, argno = 0; i < len && argno < 15;) {
- if (argno == 1) {
- /*
- * Add flags to input's arg list.
- * '-r' means run as resource
- * manager, providing the /dev/mouse
- * and /dev/keyboard interfaces.
- * '-P' supresses the /dev/photon
- * mechanism.
- */
- iarg[argno++] = "-Pr";
- continue;
- }
- while (buf[i] == ' ')
- i++;
- if (buf[i] == '\0' || buf[i] == '\n')
- break;
- iarg[argno++] = &buf[i];
- while (buf[i] != ' '
- && buf[i] != '\0' && buf[i] != '\n')
- i++;
- buf[i++] = '\0';
- }
- iarg[argno] = NULL;
-
- if ((kill_pid = spawnvp(P_NOWAITO, iarg[0], iarg)) == -1) {
- perror("spawning input resmgr");
- PM_fatalError("Could not start input resmgr");
- }
- for (i = 0; i < 10; i++) {
- if (stat("/dev/mouse0", &st) == 0)
- break;
- sleep(1);
- }
- if ((mouse_fd = open("/dev/mouse0", O_RDONLY|O_NONBLOCK)) < 0) {
- perror("/dev/mouse0");
- PM_fatalError("Could not open /dev/mouse0");
- }
- }
+ /* Run inputtrap to get the args for input */
+ if ((p = popen("inputtrap", "r")) == NULL)
+ PM_fatalError("Error running 'inputtrap'");
+ fgets(buf, sizeof(buf), p);
+ pclose(p);
+
+ /* Build the argument list */
+ len = strlen(buf);
+ iarg[0] = buf;
+ for (i = 0, argno = 0; i < len && argno < 15;) {
+ if (argno == 1) {
+ /*
+ * Add flags to input's arg list.
+ * '-r' means run as resource
+ * manager, providing the /dev/mouse
+ * and /dev/keyboard interfaces.
+ * '-P' supresses the /dev/photon
+ * mechanism.
+ */
+ iarg[argno++] = "-Pr";
+ continue;
+ }
+ while (buf[i] == ' ')
+ i++;
+ if (buf[i] == '\0' || buf[i] == '\n')
+ break;
+ iarg[argno++] = &buf[i];
+ while (buf[i] != ' '
+ && buf[i] != '\0' && buf[i] != '\n')
+ i++;
+ buf[i++] = '\0';
+ }
+ iarg[argno] = NULL;
+
+ if ((kill_pid = spawnvp(P_NOWAITO, iarg[0], iarg)) == -1) {
+ perror("spawning input resmgr");
+ PM_fatalError("Could not start input resmgr");
+ }
+ for (i = 0; i < 10; i++) {
+ if (stat("/dev/mouse0", &st) == 0)
+ break;
+ sleep(1);
+ }
+ if ((mouse_fd = open("/dev/mouse0", O_RDONLY|O_NONBLOCK)) < 0) {
+ perror("/dev/mouse0");
+ PM_fatalError("Could not open /dev/mouse0");
+ }
+ }
if ((kbd_fd = open("/dev/keyboard0", O_RDONLY|O_NONBLOCK)) < 0) {
- perror("/dev/keyboard0");
- PM_fatalError("Could not open /dev/keyboard0");
- }
+ perror("/dev/keyboard0");
+ PM_fatalError("Could not open /dev/keyboard0");
+ }
#else
/* Connect to Input/Mouse for event handling */
if (_PM_mouse_ctl == NULL) {
- _PM_mouse_ctl = mouse_open(0, "/dev/mouse", 0);
-
- /* "Mouse" is not running; attempt to start it */
- if (_PM_mouse_ctl == NULL) {
- iarg[0] = "mousetrap";
- iarg[1] = "start";
- iarg[2] = NULL;
- if ((kill_pid = spawnvp(P_NOWAITO, iarg[0], (void*)iarg)) == -1)
- perror("spawn (mousetrap)");
- else {
- for (i = 0; i < 10; i++) {
- if (stat("/dev/mouse", &st) == 0)
- break;
- sleep(1);
- }
- _PM_mouse_ctl = mouse_open(0, "/dev/mouse", 0);
- }
- }
- }
+ _PM_mouse_ctl = mouse_open(0, "/dev/mouse", 0);
+
+ /* "Mouse" is not running; attempt to start it */
+ if (_PM_mouse_ctl == NULL) {
+ iarg[0] = "mousetrap";
+ iarg[1] = "start";
+ iarg[2] = NULL;
+ if ((kill_pid = spawnvp(P_NOWAITO, iarg[0], (void*)iarg)) == -1)
+ perror("spawn (mousetrap)");
+ else {
+ for (i = 0; i < 10; i++) {
+ if (stat("/dev/mouse", &st) == 0)
+ break;
+ sleep(1);
+ }
+ _PM_mouse_ctl = mouse_open(0, "/dev/mouse", 0);
+ }
+ }
+ }
if (_PM_keyboard_fd == -1)
- _PM_keyboard_fd = open("/dev/kbd", O_RDONLY|O_NONBLOCK);
+ _PM_keyboard_fd = open("/dev/kbd", O_RDONLY|O_NONBLOCK);
#endif
/* Catch program termination signals so we can clean up properly */
@@ -532,7 +532,7 @@ and this function can be used to resume it again later.
****************************************************************************/
void EVT_resume(void)
{
- // Do nothing for QNX
+ /* Do nothing for QNX */
}
/****************************************************************************
@@ -542,7 +542,7 @@ de-install the event handling code.
****************************************************************************/
void EVT_suspend(void)
{
- // Do nothing for QNX
+ /* Do nothing for QNX */
}
/****************************************************************************
@@ -556,13 +556,13 @@ void EVT_exit(void)
int flags;
if (kbd_fd != -1) {
- close(kbd_fd);
- kbd_fd = -1;
- }
+ close(kbd_fd);
+ kbd_fd = -1;
+ }
if (mouse_fd != -1) {
- close(mouse_fd);
- mouse_fd = -1;
- }
+ close(mouse_fd);
+ mouse_fd = -1;
+ }
#endif
/* Restore signal handlers */
@@ -573,30 +573,29 @@ void EVT_exit(void)
#ifndef __QNXNTO__
/* Kill the Input/Mouse driver if we have spawned it */
if (_PM_mouse_ctl != NULL) {
- struct _fd_entry fde;
- uint pid = 0;
-
- /* Find out the pid of the mouse driver */
- if (kill_pid > 0) {
- if (qnx_fd_query(0,
- 0, _PM_mouse_ctl->fd, &fde) != -1)
- pid = fde.pid;
- }
- mouse_close(_PM_mouse_ctl);
- _PM_mouse_ctl = NULL;
-
- if (pid > 0) {
- /* For some reasons the PID's are different under QNX4,
- * so we use the old mechanism to kill the mouse server.
- */
- kill(pid, SIGTERM);
- kill_pid = 0;
- }
- }
+ struct _fd_entry fde;
+ uint pid = 0;
+
+ /* Find out the pid of the mouse driver */
+ if (kill_pid > 0) {
+ if (qnx_fd_query(0,
+ 0, _PM_mouse_ctl->fd, &fde) != -1)
+ pid = fde.pid;
+ }
+ mouse_close(_PM_mouse_ctl);
+ _PM_mouse_ctl = NULL;
+
+ if (pid > 0) {
+ /* For some reasons the PID's are different under QNX4,
+ * so we use the old mechanism to kill the mouse server.
+ */
+ kill(pid, SIGTERM);
+ kill_pid = 0;
+ }
+ }
#endif
if (kill_pid > 0) {
- kill(kill_pid, SIGTERM);
- kill_pid = 0;
- }
+ kill(kill_pid, SIGTERM);
+ kill_pid = 0;
+ }
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/qnx/mtrrqnx.c b/board/MAI/bios_emulator/scitech/src/pm/qnx/mtrrqnx.c
index de749e3834..f960c75714 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/qnx/mtrrqnx.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/qnx/mtrrqnx.c
@@ -75,7 +75,7 @@ Return true if ring 0 (or if we can call the helpers functions at ring 0)
ibool _ASMAPI _MTRR_isRing0(void)
{
#ifdef __QNXNTO__
- return false; // Not implemented yet!
+ return false; /* Not implemented yet! */
#else
return true;
#endif
@@ -101,15 +101,15 @@ static void CallRing0(void)
#endif
#ifdef __QNXNTO__
if ((intrid = InterruptAttach(_NTO_INTR_CLASS_EXTERNAL | clock_intno,
- _PM_ring0_isr, (void*)&_PM_R0, sizeof(_PM_R0), _NTO_INTR_FLAGS_END)) == -1) {
+ _PM_ring0_isr, (void*)&_PM_R0, sizeof(_PM_R0), _NTO_INTR_FLAGS_END)) == -1) {
#else
if ((intrid = qnx_hint_attach(clock_intno, _PM_ring0_isr, FP_SEG(&_PM_R0))) == -1) {
#endif
- perror("Attach");
- exit(-1);
- }
+ perror("Attach");
+ exit(-1);
+ }
while (_PM_R0.service != -1)
- ;
+ ;
#ifdef __QNXNTO__
InterruptDetachId(intrid);
#else
diff --git a/board/MAI/bios_emulator/scitech/src/pm/qnx/pm.c b/board/MAI/bios_emulator/scitech/src/pm/qnx/pm.c
index c2b41eb09f..c993ee0837 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/qnx/pm.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/qnx/pm.c
@@ -77,11 +77,11 @@ void PMAPI PM_init(void)
if (VRegs == NULL) {
#ifdef __QNXNTO__
- ThreadCtl(_NTO_TCTL_IO, 0); /* Get IO privilidge */
+ ThreadCtl(_NTO_TCTL_IO, 0); /* Get IO privilidge */
#endif
- force = getenv("VBIOS_METHOD");
- VRegs = VBIOSinit(force ? atoi(force) : 0);
- }
+ force = getenv("VBIOS_METHOD");
+ VRegs = VBIOSinit(force ? atoi(force) : 0);
+ }
#ifndef __QNXNTO__
MTRR_init();
#endif
@@ -100,9 +100,9 @@ void PMAPI PM_backslash(char *s)
{
uint pos = strlen(s);
if (s[pos-1] != '/') {
- s[pos] = '/';
- s[pos+1] = '\0';
- }
+ s[pos] = '/';
+ s[pos+1] = '\0';
+ }
}
void PMAPI PM_setFatalErrorCleanup(
@@ -114,7 +114,7 @@ void PMAPI PM_setFatalErrorCleanup(
void PMAPI PM_fatalError(const char *msg)
{
if (fatalErrorCleanup)
- fatalErrorCleanup();
+ fatalErrorCleanup();
fprintf(stderr,"%s\n", msg);
exit(1);
}
@@ -122,18 +122,18 @@ void PMAPI PM_fatalError(const char *msg)
static void ExitVBEBuf(void)
{
if (VESABuf_ptr)
- PM_freeRealSeg(VESABuf_ptr);
+ PM_freeRealSeg(VESABuf_ptr);
VESABuf_ptr = 0;
}
void * PMAPI PM_getVESABuf(uint *len,uint *rseg,uint *roff)
{
if (!VESABuf_ptr) {
- /* Allocate a global buffer for communicating with the VESA VBE */
- if ((VESABuf_ptr = PM_allocRealSeg(VESABuf_len, &VESABuf_rseg, &VESABuf_roff)) == NULL)
- return NULL;
- atexit(ExitVBEBuf);
- }
+ /* Allocate a global buffer for communicating with the VESA VBE */
+ if ((VESABuf_ptr = PM_allocRealSeg(VESABuf_len, &VESABuf_rseg, &VESABuf_roff)) == NULL)
+ return NULL;
+ atexit(ExitVBEBuf);
+ }
*len = VESABuf_len;
*rseg = VESABuf_rseg;
*roff = VESABuf_roff;
@@ -145,11 +145,11 @@ static int term_raw(void)
struct termios termios_p;
if (raw_count++ > 0)
- return 0;
+ return 0;
/* Go into "raw" input mode */
if (tcgetattr(STDIN_FILENO, &termios_p))
- return -1;
+ return -1;
termios_p.c_cc[VMIN] = 1;
termios_p.c_cc[VTIME] = 0;
@@ -163,7 +163,7 @@ static void term_restore(void)
struct termios termios_p;
if (raw_count-- != 1)
- return;
+ return;
tcgetattr(STDIN_FILENO, &termios_p);
termios_p.c_lflag |= (ECHO|ICANON|ISIG|ECHOE|ECHOK|ECHONL);
@@ -176,7 +176,7 @@ int PMAPI PM_kbhit(void)
int blocking, c;
if (term_raw() == -1)
- return 0;
+ return 0;
/* Go into non blocking mode */
blocking = fcntl(STDIN_FILENO, F_GETFL) | O_NONBLOCK;
@@ -187,9 +187,9 @@ int PMAPI PM_kbhit(void)
fcntl(STDIN_FILENO, F_SETFL, blocking & ~O_NONBLOCK);
term_restore();
if (c != EOF) {
- ungetc(c, stdin);
- return c;
- }
+ ungetc(c, stdin);
+ return c;
+ }
clearerr(stdin);
return 0;
}
@@ -199,13 +199,13 @@ int PMAPI PM_getch(void)
int c;
if (term_raw() == -1)
- return (0);
+ return (0);
c = getc(stdin);
#if defined(__QNX__) && !defined(__QNXNTO__)
if (c == 0xA)
- c = 0x0D;
+ c = 0x0D;
else if (c == 0x7F)
- c = 0x08;
+ c = 0x08;
#endif
term_restore();
return c;
@@ -223,13 +223,13 @@ PM_HWND PMAPI PM_openConsole(
int fd;
if (console_count++)
- return 0;
+ return 0;
if ((fd = open("/dev/con1", O_RDWR)) == -1)
- return -1;
+ return -1;
cc = console_open(fd, O_RDWR);
close(fd);
if (cc == NULL)
- return -1;
+ return -1;
#endif
return 1;
}
@@ -246,7 +246,7 @@ void PMAPI PM_saveConsoleState(void *stateBuf,int console_id)
int flags;
if ((fd = open("/dev/con1", O_RDWR)) == -1)
- return;
+ return;
flags = _CONCTL_INVISIBLE_CHG | _CONCTL_INVISIBLE;
devctl(fd, DCMD_CHR_SERCTL, &flags, sizeof flags, 0);
close(fd);
@@ -255,10 +255,10 @@ void PMAPI PM_saveConsoleState(void *stateBuf,int console_id)
/* Save QNX 4 console state */
console_read(cc, -1, 0, NULL, 0,
- (int *)buf+1, (int *)buf+2, NULL);
+ (int *)buf+1, (int *)buf+2, NULL);
*(int *)buf = console_ctrl(cc, -1,
- CONSOLE_NORESIZE | CONSOLE_NOSWITCH | CONSOLE_INVISIBLE,
- CONSOLE_NORESIZE | CONSOLE_NOSWITCH | CONSOLE_INVISIBLE);
+ CONSOLE_NORESIZE | CONSOLE_NOSWITCH | CONSOLE_INVISIBLE,
+ CONSOLE_NORESIZE | CONSOLE_NOSWITCH | CONSOLE_INVISIBLE);
/* Save state of VGA registers */
PM_saveVGAState(stateBuf);
@@ -277,7 +277,7 @@ void PMAPI PM_restoreConsoleState(const void *stateBuf,PM_HWND hwndConsole)
int flags;
if ((fd = open("/dev/con1", O_RDWR)) == -1)
- return;
+ return;
flags = _CONCTL_INVISIBLE_CHG;
devctl(fd, DCMD_CHR_SERCTL, &flags, sizeof flags, 0);
close(fd);
@@ -289,9 +289,9 @@ void PMAPI PM_restoreConsoleState(const void *stateBuf,PM_HWND hwndConsole)
/* Restore QNX 4 console state */
console_ctrl(cc, -1, *(int *)buf,
- CONSOLE_NORESIZE | CONSOLE_NOSWITCH | CONSOLE_INVISIBLE);
+ CONSOLE_NORESIZE | CONSOLE_NOSWITCH | CONSOLE_INVISIBLE);
console_write(cc, -1, 0, NULL, 0,
- (int *)buf+1, (int *)buf+2, NULL);
+ (int *)buf+1, (int *)buf+2, NULL);
#endif
}
@@ -299,16 +299,16 @@ void PMAPI PM_closeConsole(PM_HWND hwndConsole)
{
#ifndef __QNXNTO__
if (--console_count == 0) {
- console_close(cc);
- cc = NULL;
- }
+ console_close(cc);
+ cc = NULL;
+ }
#endif
}
void PM_setOSCursorLocation(int x,int y)
{
if (!cc)
- return;
+ return;
#ifndef __QNXNTO__
console_write(cc, -1, 0, NULL, 0, &y, &x, NULL);
#endif
@@ -320,18 +320,18 @@ void PM_setOSScreenWidth(int width,int height)
ibool PMAPI PM_setRealTimeClockHandler(PM_intHandler ih, int frequency)
{
- // TODO: Implement this for QNX
+ /* TODO: Implement this for QNX */
return false;
}
void PMAPI PM_setRealTimeClockFrequency(int frequency)
{
- // TODO: Implement this for QNX
+ /* TODO: Implement this for QNX */
}
void PMAPI PM_restoreRealTimeClockHandler(void)
{
- // TODO: Implement this for QNX
+ /* TODO: Implement this for QNX */
}
char * PMAPI PM_getCurrentPath(
@@ -388,10 +388,10 @@ const char * PMAPI PM_getNucleusConfigPath(void)
sprintf(path,"/etc/config/scitech/%d/config", getnid());
#endif
if ((env = getenv("NUCLEUS_PATH")) != NULL) {
- strcpy(path,env);
- PM_backslash(path);
- strcat(path,"config");
- }
+ strcpy(path,env);
+ PM_backslash(path);
+ strcat(path,"config");
+ }
return path;
}
@@ -429,26 +429,26 @@ void * PMAPI PM_getA0000Pointer(void)
unsigned offset, i, maplen;
if (ptr != NULL)
- return ptr;
+ return ptr;
/* Some trickery is required to get the linear address 64K aligned */
for (i = 0; i < 5; i++) {
- ptr = PM_mapPhysicalAddr(0xA0000,0xFFFF,true);
- offset = 0x10000 - ((unsigned)ptr % 0x10000);
- if (!offset)
- break;
- munmap(ptr, 0x10000);
- maplen = 0x10000 + offset;
- freeptr = PM_mapPhysicalAddr(0xA0000-offset, maplen-1,true);
- ptr = (void *)(offset + (unsigned)freeptr);
- if (0x10000 - ((unsigned)ptr % 0x10000))
- break;
- munmap(freeptr, maplen);
- }
+ ptr = PM_mapPhysicalAddr(0xA0000,0xFFFF,true);
+ offset = 0x10000 - ((unsigned)ptr % 0x10000);
+ if (!offset)
+ break;
+ munmap(ptr, 0x10000);
+ maplen = 0x10000 + offset;
+ freeptr = PM_mapPhysicalAddr(0xA0000-offset, maplen-1,true);
+ ptr = (void *)(offset + (unsigned)freeptr);
+ if (0x10000 - ((unsigned)ptr % 0x10000))
+ break;
+ munmap(freeptr, maplen);
+ }
if (i == 5) {
- printf("Could not get a 64K aligned linear address for A0000 region\n");
- exit(1);
- }
+ printf("Could not get a 64K aligned linear address for A0000 region\n");
+ exit(1);
+ }
return ptr;
}
@@ -468,31 +468,31 @@ void * PMAPI PM_mapPhysicalAddr(ulong base,ulong limit,ibool isCached)
#endif
if (rounddown) {
- if (base < rounddown)
- return NULL;
- base -= rounddown;
- limit += rounddown;
- }
+ if (base < rounddown)
+ return NULL;
+ base -= rounddown;
+ limit += rounddown;
+ }
#ifndef __QNXNTO__
if (__VidFD < 0) {
- if ((__VidFD = shm_open( "Physical", O_RDWR, 0777 )) == -1) {
- perror( "Cannot open Physical memory" );
- exit(1);
- }
- }
+ if ((__VidFD = shm_open( "Physical", O_RDWR, 0777 )) == -1) {
+ perror( "Cannot open Physical memory" );
+ exit(1);
+ }
+ }
o = base & 0xFFF;
limit = (limit + o + 0xFFF) & ~0xFFF;
if ((int)(p = mmap( 0, limit, prot, MAP_SHARED,
- __VidFD, base )) == -1 ) {
- return NULL;
- }
+ __VidFD, base )) == -1 ) {
+ return NULL;
+ }
p += o;
#else
if ((p = mmap(0, limit, prot, MAP_PHYS | MAP_SHARED,
- NOFD, base)) == MAP_FAILED) {
- return (void *)-1;
- }
+ NOFD, base)) == MAP_FAILED) {
+ return (void *)-1;
+ }
#endif
return (p + rounddown);
}
@@ -504,8 +504,8 @@ void PMAPI PM_freePhysicalAddr(void *ptr,ulong limit)
ulong PMAPI PM_getPhysicalAddr(void *p)
{
- // TODO: This function should find the physical address of a linear
- // address.
+ /* TODO: This function should find the physical address of a linear */
+ /* address. */
return 0xFFFFFFFFUL;
}
@@ -514,35 +514,35 @@ ibool PMAPI PM_getPhysicalAddrRange(
ulong length,
ulong *physAddress)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
return false;
}
void PMAPI PM_sleep(ulong milliseconds)
{
- // TODO: Put the process to sleep for milliseconds
+ /* TODO: Put the process to sleep for milliseconds */
}
int PMAPI PM_getCOMPort(int port)
{
- // TODO: Re-code this to determine real values using the Plug and Play
- // manager for the OS.
+ /* TODO: Re-code this to determine real values using the Plug and Play */
+ /* manager for the OS. */
switch (port) {
- case 0: return 0x3F8;
- case 1: return 0x2F8;
- }
+ case 0: return 0x3F8;
+ case 1: return 0x2F8;
+ }
return 0;
}
int PMAPI PM_getLPTPort(int port)
{
- // TODO: Re-code this to determine real values using the Plug and Play
- // manager for the OS.
+ /* TODO: Re-code this to determine real values using the Plug and Play */
+ /* manager for the OS. */
switch (port) {
- case 0: return 0x3BC;
- case 1: return 0x378;
- case 2: return 0x278;
- }
+ case 0: return 0x3BC;
+ case 1: return 0x378;
+ case 2: return 0x278;
+ }
return 0;
}
@@ -566,20 +566,20 @@ void * PMAPI PM_mapRealPointer(uint r_seg,uint r_off)
PM_init();
if ((p = VBIOSgetmemptr(r_seg, r_off, VRegs)) == (void *)-1)
- return NULL;
+ return NULL;
return p;
}
void * PMAPI PM_allocRealSeg(uint size,uint *r_seg,uint *r_off)
{
if (size > 1024) {
- printf("PM_allocRealSeg: can't handle %d bytes\n", size);
- return 0;
- }
+ printf("PM_allocRealSeg: can't handle %d bytes\n", size);
+ return 0;
+ }
if (rmbuf_inuse != 0) {
- printf("PM_allocRealSeg: transfer area already in use\n");
- return 0;
- }
+ printf("PM_allocRealSeg: transfer area already in use\n");
+ return 0;
+ }
PM_init();
rmbuf_inuse = 1;
*r_seg = VBIOS_TransBufVSeg(VRegs);
@@ -590,9 +590,9 @@ void * PMAPI PM_allocRealSeg(uint size,uint *r_seg,uint *r_off)
void PMAPI PM_freeRealSeg(void *mem)
{
if (rmbuf_inuse == 0) {
- printf("PM_freeRealSeg: nothing was allocated\n");
- return;
- }
+ printf("PM_freeRealSeg: nothing was allocated\n");
+ return;
+ }
rmbuf_inuse = 0;
}
@@ -600,7 +600,7 @@ void PMAPI DPMI_int86(int intno, DPMI_regs *regs)
{
PM_init();
if (VRegs == NULL)
- return;
+ return;
VRegs->l.eax = regs->eax;
VRegs->l.ebx = regs->ebx;
@@ -624,7 +624,7 @@ int PMAPI PM_int86(int intno, RMREGS *in, RMREGS *out)
{
PM_init();
if (VRegs == NULL)
- return 0;
+ return 0;
VRegs->l.eax = in->e.eax;
VRegs->l.ebx = in->e.ebx;
@@ -651,41 +651,41 @@ int PMAPI PM_int86x(int intno, RMREGS *in, RMREGS *out,
{
PM_init();
if (VRegs == NULL)
- return 0;
+ return 0;
if (intno == 0x21) {
- time_t today = time(NULL);
- struct tm *t;
- t = localtime(&today);
- out->x.cx = t->tm_year + 1900;
- out->h.dh = t->tm_mon + 1;
- out->h.dl = t->tm_mday;
- return 0;
- }
+ time_t today = time(NULL);
+ struct tm *t;
+ t = localtime(&today);
+ out->x.cx = t->tm_year + 1900;
+ out->h.dh = t->tm_mon + 1;
+ out->h.dl = t->tm_mday;
+ return 0;
+ }
else {
- VRegs->l.eax = in->e.eax;
- VRegs->l.ebx = in->e.ebx;
- VRegs->l.ecx = in->e.ecx;
- VRegs->l.edx = in->e.edx;
- VRegs->l.esi = in->e.esi;
- VRegs->l.edi = in->e.edi;
- VRegs->w.es = sregs->es;
- VRegs->w.ds = sregs->ds;
-
- VBIOSint(intno, VRegs, 1024);
-
- out->e.eax = VRegs->l.eax;
- out->e.ebx = VRegs->l.ebx;
- out->e.ecx = VRegs->l.ecx;
- out->e.edx = VRegs->l.edx;
- out->e.esi = VRegs->l.esi;
- out->e.edi = VRegs->l.edi;
- out->x.cflag = VRegs->w.flags & 0x1;
- sregs->es = VRegs->w.es;
- sregs->ds = VRegs->w.ds;
-
- return out->x.ax;
- }
+ VRegs->l.eax = in->e.eax;
+ VRegs->l.ebx = in->e.ebx;
+ VRegs->l.ecx = in->e.ecx;
+ VRegs->l.edx = in->e.edx;
+ VRegs->l.esi = in->e.esi;
+ VRegs->l.edi = in->e.edi;
+ VRegs->w.es = sregs->es;
+ VRegs->w.ds = sregs->ds;
+
+ VBIOSint(intno, VRegs, 1024);
+
+ out->e.eax = VRegs->l.eax;
+ out->e.ebx = VRegs->l.ebx;
+ out->e.ecx = VRegs->l.ecx;
+ out->e.edx = VRegs->l.edx;
+ out->e.esi = VRegs->l.esi;
+ out->e.edi = VRegs->l.edi;
+ out->x.cflag = VRegs->w.flags & 0x1;
+ sregs->es = VRegs->w.es;
+ sregs->ds = VRegs->w.ds;
+
+ return out->x.ax;
+ }
}
void PMAPI PM_callRealMode(uint seg,uint off, RMREGS *in,
@@ -693,7 +693,7 @@ void PMAPI PM_callRealMode(uint seg,uint off, RMREGS *in,
{
PM_init();
if (VRegs == NULL)
- return;
+ return;
VRegs->l.eax = in->e.eax;
VRegs->l.ebx = in->e.ebx;
@@ -730,7 +730,7 @@ void * PMAPI PM_allocLockedMem(
ibool contiguous,
ibool below16M)
{
- // TODO: Implement this on QNX
+ /* TODO: Implement this on QNX */
return NULL;
}
@@ -739,27 +739,27 @@ void PMAPI PM_freeLockedMem(
uint size,
ibool contiguous)
{
- // TODO: Implement this on QNX
+ /* TODO: Implement this on QNX */
}
void * PMAPI PM_allocPage(
ibool locked)
{
- // TODO: Implement this on QNX
+ /* TODO: Implement this on QNX */
return NULL;
}
void PMAPI PM_freePage(
void *p)
{
- // TODO: Implement this on QNX
+ /* TODO: Implement this on QNX */
}
void PMAPI PM_setBankA(int bank)
{
PM_init();
if (VRegs == NULL)
- return;
+ return;
VRegs->l.eax = 0x4F05;
VRegs->l.ebx = 0x0000;
@@ -771,7 +771,7 @@ void PMAPI PM_setBankAB(int bank)
{
PM_init();
if (VRegs == NULL)
- return;
+ return;
VRegs->l.eax = 0x4F05;
VRegs->l.ebx = 0x0000;
@@ -788,7 +788,7 @@ void PMAPI PM_setCRTStart(int x,int y,int waitVRT)
{
PM_init();
if (VRegs == NULL)
- return;
+ return;
VRegs->l.eax = 0x4F07;
VRegs->l.ebx = waitVRT;
@@ -837,7 +837,7 @@ int PMAPI PM_unlockCodePages(void (*p)(),uint len,PM_lockHandle *lh)
PM_MODULE PMAPI PM_loadLibrary(
const char *szDLLName)
{
- // TODO: Implement this to load shared libraries!
+ /* TODO: Implement this to load shared libraries! */
(void)szDLLName;
return NULL;
}
@@ -846,7 +846,7 @@ void * PMAPI PM_getProcAddress(
PM_MODULE hModule,
const char *szProcName)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
(void)hModule;
(void)szProcName;
return NULL;
@@ -855,14 +855,14 @@ void * PMAPI PM_getProcAddress(
void PMAPI PM_freeLibrary(
PM_MODULE hModule)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
(void)hModule;
}
int PMAPI PM_setIOPL(
int level)
{
- // QNX handles IOPL selection at the program link level.
+ /* QNX handles IOPL selection at the program link level. */
return level;
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/rttarget/cpuinfo.c b/board/MAI/bios_emulator/scitech/src/pm/rttarget/cpuinfo.c
index 3d6dd44313..4f32c3e887 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/rttarget/cpuinfo.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/rttarget/cpuinfo.c
@@ -46,7 +46,7 @@ static int SetMaxThreadPriority(void)
oldPriority = GetThreadPriority(hThread);
if (oldPriority != THREAD_PRIORITY_ERROR_RETURN)
- SetThreadPriority(hThread, THREAD_PRIORITY_TIME_CRITICAL);
+ SetThreadPriority(hThread, THREAD_PRIORITY_TIME_CRITICAL);
return oldPriority;
}
@@ -60,7 +60,7 @@ static void RestoreThreadPriority(
HANDLE hThread = GetCurrentThread();
if (oldPriority != THREAD_PRIORITY_ERROR_RETURN)
- SetThreadPriority(hThread, oldPriority);
+ SetThreadPriority(hThread, oldPriority);
}
/****************************************************************************
@@ -71,12 +71,12 @@ static void GetCounterFrequency(
CPU_largeInteger *freq)
{
if (!QueryPerformanceFrequency((LARGE_INTEGER*)freq)) {
- havePerformanceCounter = false;
- freq->low = 100000;
- freq->high = 0;
- }
+ havePerformanceCounter = false;
+ freq->low = 100000;
+ freq->high = 0;
+ }
else
- havePerformanceCounter = true;
+ havePerformanceCounter = true;
}
/****************************************************************************
@@ -86,9 +86,9 @@ Read the counter and return the counter value.
#define GetCounter(t) \
{ \
if (havePerformanceCounter) \
- QueryPerformanceCounter((LARGE_INTEGER*)t); \
+ QueryPerformanceCounter((LARGE_INTEGER*)t); \
else { \
- (t)->low = timeGetTime() * 100; \
- (t)->high = 0; \
- } \
+ (t)->low = timeGetTime() * 100; \
+ (t)->high = 0; \
+ } \
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/rttarget/event.c b/board/MAI/bios_emulator/scitech/src/pm/rttarget/event.c
index e9aba21b9f..962a14a3c1 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/rttarget/event.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/rttarget/event.c
@@ -71,113 +71,113 @@ void _EVT_pumpMessages(void)
event_t evt;
while (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) {
- memset(&evt,0,sizeof(evt));
- switch (msg.message) {
- case WM_MOUSEMOVE:
- evt.what = EVT_MOUSEMOVE;
- break;
- case WM_LBUTTONDBLCLK:
- evt.what = EVT_MOUSEDOWN;
- evt.message = EVT_LEFTBMASK | EVT_DBLCLICK;
- break;
- case WM_LBUTTONDOWN:
- evt.what = EVT_MOUSEDOWN;
- evt.message = EVT_LEFTBMASK;
- break;
- case WM_LBUTTONUP:
- evt.what = EVT_MOUSEUP;
- evt.message = EVT_LEFTBMASK;
- break;
- case WM_RBUTTONDBLCLK:
- evt.what = EVT_MOUSEDOWN | EVT_DBLCLICK;
- evt.message = EVT_RIGHTBMASK;
- break;
- case WM_RBUTTONDOWN:
- evt.what = EVT_MOUSEDOWN;
- evt.message = EVT_RIGHTBMASK;
- break;
- case WM_RBUTTONUP:
- evt.what = EVT_MOUSEUP;
- evt.message = EVT_RIGHTBMASK;
- break;
- case WM_KEYDOWN:
- case WM_SYSKEYDOWN:
- if (HIWORD(msg.lParam) & KF_REPEAT) {
- evt.what = EVT_KEYREPEAT;
- }
- else {
- evt.what = EVT_KEYDOWN;
- }
- break;
- case WM_KEYUP:
- case WM_SYSKEYUP:
- evt.what = EVT_KEYUP;
- break;
- }
+ memset(&evt,0,sizeof(evt));
+ switch (msg.message) {
+ case WM_MOUSEMOVE:
+ evt.what = EVT_MOUSEMOVE;
+ break;
+ case WM_LBUTTONDBLCLK:
+ evt.what = EVT_MOUSEDOWN;
+ evt.message = EVT_LEFTBMASK | EVT_DBLCLICK;
+ break;
+ case WM_LBUTTONDOWN:
+ evt.what = EVT_MOUSEDOWN;
+ evt.message = EVT_LEFTBMASK;
+ break;
+ case WM_LBUTTONUP:
+ evt.what = EVT_MOUSEUP;
+ evt.message = EVT_LEFTBMASK;
+ break;
+ case WM_RBUTTONDBLCLK:
+ evt.what = EVT_MOUSEDOWN | EVT_DBLCLICK;
+ evt.message = EVT_RIGHTBMASK;
+ break;
+ case WM_RBUTTONDOWN:
+ evt.what = EVT_MOUSEDOWN;
+ evt.message = EVT_RIGHTBMASK;
+ break;
+ case WM_RBUTTONUP:
+ evt.what = EVT_MOUSEUP;
+ evt.message = EVT_RIGHTBMASK;
+ break;
+ case WM_KEYDOWN:
+ case WM_SYSKEYDOWN:
+ if (HIWORD(msg.lParam) & KF_REPEAT) {
+ evt.what = EVT_KEYREPEAT;
+ }
+ else {
+ evt.what = EVT_KEYDOWN;
+ }
+ break;
+ case WM_KEYUP:
+ case WM_SYSKEYUP:
+ evt.what = EVT_KEYUP;
+ break;
+ }
- /* Convert mouse event modifier flags */
- if (evt.what & EVT_MOUSEEVT) {
- evt.where_x = msg.pt.x;
- evt.where_y = msg.pt.y;
- if (evt.what == EVT_MOUSEMOVE) {
- if (oldMove != -1) {
- evtq[oldMove].where_x = evt.where_x;/* Modify existing one */
- evtq[oldMove].where_y = evt.where_y;
- evt.what = 0;
- }
- else {
- oldMove = freeHead; /* Save id of this move event */
- }
- }
- else
- oldMove = -1;
- if (msg.wParam & MK_LBUTTON)
- evt.modifiers |= EVT_LEFTBUT;
- if (msg.wParam & MK_RBUTTON)
- evt.modifiers |= EVT_RIGHTBUT;
- if (msg.wParam & MK_SHIFT)
- evt.modifiers |= EVT_SHIFTKEY;
- if (msg.wParam & MK_CONTROL)
- evt.modifiers |= EVT_CTRLSTATE;
- }
+ /* Convert mouse event modifier flags */
+ if (evt.what & EVT_MOUSEEVT) {
+ evt.where_x = msg.pt.x;
+ evt.where_y = msg.pt.y;
+ if (evt.what == EVT_MOUSEMOVE) {
+ if (oldMove != -1) {
+ evtq[oldMove].where_x = evt.where_x;/* Modify existing one */
+ evtq[oldMove].where_y = evt.where_y;
+ evt.what = 0;
+ }
+ else {
+ oldMove = freeHead; /* Save id of this move event */
+ }
+ }
+ else
+ oldMove = -1;
+ if (msg.wParam & MK_LBUTTON)
+ evt.modifiers |= EVT_LEFTBUT;
+ if (msg.wParam & MK_RBUTTON)
+ evt.modifiers |= EVT_RIGHTBUT;
+ if (msg.wParam & MK_SHIFT)
+ evt.modifiers |= EVT_SHIFTKEY;
+ if (msg.wParam & MK_CONTROL)
+ evt.modifiers |= EVT_CTRLSTATE;
+ }
- /* Convert keyboard codes */
- TranslateMessage(&msg);
- if (evt.what & EVT_KEYEVT) {
- int scanCode = (msg.lParam >> 16) & 0xFF;
- if (evt.what == EVT_KEYUP) {
- /* Get message for keyup code from table of cached down values */
- evt.message = keyUpMsg[scanCode];
- keyUpMsg[scanCode] = 0;
- }
- else {
- if (PeekMessage(&charMsg,NULL,WM_CHAR,WM_CHAR,PM_REMOVE))
- evt.message = charMsg.wParam;
- if (PeekMessage(&charMsg,NULL,WM_SYSCHAR,WM_SYSCHAR,PM_REMOVE))
- evt.message = charMsg.wParam;
- evt.message |= ((msg.lParam >> 8) & 0xFF00);
- keyUpMsg[scanCode] = (ushort)evt.message;
- }
- if (evt.what == EVT_KEYREPEAT)
- evt.message |= (msg.lParam << 16);
- if (HIWORD(msg.lParam) & KF_ALTDOWN)
- evt.modifiers |= EVT_ALTSTATE;
- if (GetKeyState(VK_SHIFT) & 0x8000U)
- evt.modifiers |= EVT_SHIFTKEY;
- if (GetKeyState(VK_CONTROL) & 0x8000U)
- evt.modifiers |= EVT_CTRLSTATE;
- oldMove = -1;
- }
+ /* Convert keyboard codes */
+ TranslateMessage(&msg);
+ if (evt.what & EVT_KEYEVT) {
+ int scanCode = (msg.lParam >> 16) & 0xFF;
+ if (evt.what == EVT_KEYUP) {
+ /* Get message for keyup code from table of cached down values */
+ evt.message = keyUpMsg[scanCode];
+ keyUpMsg[scanCode] = 0;
+ }
+ else {
+ if (PeekMessage(&charMsg,NULL,WM_CHAR,WM_CHAR,PM_REMOVE))
+ evt.message = charMsg.wParam;
+ if (PeekMessage(&charMsg,NULL,WM_SYSCHAR,WM_SYSCHAR,PM_REMOVE))
+ evt.message = charMsg.wParam;
+ evt.message |= ((msg.lParam >> 8) & 0xFF00);
+ keyUpMsg[scanCode] = (ushort)evt.message;
+ }
+ if (evt.what == EVT_KEYREPEAT)
+ evt.message |= (msg.lParam << 16);
+ if (HIWORD(msg.lParam) & KF_ALTDOWN)
+ evt.modifiers |= EVT_ALTSTATE;
+ if (GetKeyState(VK_SHIFT) & 0x8000U)
+ evt.modifiers |= EVT_SHIFTKEY;
+ if (GetKeyState(VK_CONTROL) & 0x8000U)
+ evt.modifiers |= EVT_CTRLSTATE;
+ oldMove = -1;
+ }
- if (evt.what != 0) {
- /* Add time stamp and add the event to the queue */
- evt.when = msg.time;
- if (count < EVENTQSIZE) {
- addEvent(&evt);
- }
- }
- DispatchMessage(&msg);
- }
+ if (evt.what != 0) {
+ /* Add time stamp and add the event to the queue */
+ evt.when = msg.time;
+ if (count < EVENTQSIZE) {
+ addEvent(&evt);
+ }
+ }
+ DispatchMessage(&msg);
+ }
}
/****************************************************************************
@@ -261,7 +261,7 @@ and this function can be used to resume it again later.
****************************************************************************/
void EVT_resume(void)
{
- // Do nothing for Win32
+ /* Do nothing for Win32 */
}
/****************************************************************************
@@ -271,7 +271,7 @@ de-install the event handling code.
****************************************************************************/
void EVT_suspend(void)
{
- // Do nothing for Win32
+ /* Do nothing for Win32 */
}
/****************************************************************************
diff --git a/board/MAI/bios_emulator/scitech/src/pm/rttarget/pm.c b/board/MAI/bios_emulator/scitech/src/pm/rttarget/pm.c
index e6c1fbd8b3..47d7ed6ab1 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/rttarget/pm.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/rttarget/pm.c
@@ -59,7 +59,7 @@ Initialise the PM library.
****************************************************************************/
void PMAPI PM_init(void)
{
- // TODO: dO any special init code in here.
+ /* TODO: dO any special init code in here. */
MTRR_init();
}
@@ -90,9 +90,9 @@ void PMAPI PM_backslash(
{
uint pos = strlen(s);
if (s[pos-1] != '\\') {
- s[pos] = '\\';
- s[pos+1] = '\0';
- }
+ s[pos] = '\\';
+ s[pos+1] = '\0';
+ }
}
/****************************************************************************
@@ -113,9 +113,9 @@ void PMAPI PM_fatalError(
const char *msg)
{
if (fatalErrorCleanup)
- fatalErrorCleanup();
- // TODO: Display a fatal error message and exit!
-// MessageBox(NULL,msg,"Fatal Error!", MB_ICONEXCLAMATION);
+ fatalErrorCleanup();
+ /* TODO: Display a fatal error message and exit! */
+/* MessageBox(NULL,msg,"Fatal Error!", MB_ICONEXCLAMATION); */
exit(1);
}
@@ -138,7 +138,7 @@ Check if a key has been pressed.
****************************************************************************/
int PMAPI PM_kbhit(void)
{
- // TODO: Need to check if a key is waiting on the keyboard queue
+ /* TODO: Need to check if a key is waiting on the keyboard queue */
return true;
}
@@ -148,7 +148,7 @@ Wait for and return the next keypress.
****************************************************************************/
int PMAPI PM_getch(void)
{
- // TODO: Need to obtain the next keypress, and block until one is hit
+ /* TODO: Need to obtain the next keypress, and block until one is hit */
return 0xD;
}
@@ -240,7 +240,7 @@ Return the path to the Nucleus driver files.
****************************************************************************/
const char * PMAPI PM_getNucleusPath(void)
{
- // TODO: Point this at the path when the Nucleus drivers will be found
+ /* TODO: Point this at the path when the Nucleus drivers will be found */
return "c:\\nucleus";
}
@@ -294,7 +294,7 @@ void * PMAPI PM_getA0000Pointer(void)
{
static void *bankPtr;
if (!bankPtr)
- bankPtr = PM_mapPhysicalAddr(0xA0000,0xFFFF,true);
+ bankPtr = PM_mapPhysicalAddr(0xA0000,0xFFFF,true);
return bankPtr;
}
@@ -307,7 +307,7 @@ void * PMAPI PM_mapPhysicalAddr(
ulong limit,
ibool isCached)
{
- // TODO: Map a physical memory address to a linear address
+ /* TODO: Map a physical memory address to a linear address */
return NULL;
}
@@ -319,13 +319,13 @@ void PMAPI PM_freePhysicalAddr(
void *ptr,
ulong limit)
{
- // TODO: Free the physical address mapping
+ /* TODO: Free the physical address mapping */
}
ulong PMAPI PM_getPhysicalAddr(void *p)
{
- // TODO: This function should find the physical address of a linear
- // address.
+ /* TODO: This function should find the physical address of a linear */
+ /* address. */
return 0xFFFFFFFFUL;
}
@@ -336,24 +336,24 @@ void PMAPI PM_sleep(ulong milliseconds)
int PMAPI PM_getCOMPort(int port)
{
- // TODO: Re-code this to determine real values using the Plug and Play
- // manager for the OS.
+ /* TODO: Re-code this to determine real values using the Plug and Play */
+ /* manager for the OS. */
switch (port) {
- case 0: return 0x3F8;
- case 1: return 0x2F8;
- }
+ case 0: return 0x3F8;
+ case 1: return 0x2F8;
+ }
return 0;
}
int PMAPI PM_getLPTPort(int port)
{
- // TODO: Re-code this to determine real values using the Plug and Play
- // manager for the OS.
+ /* TODO: Re-code this to determine real values using the Plug and Play */
+ /* manager for the OS. */
switch (port) {
- case 0: return 0x3BC;
- case 1: return 0x378;
- case 2: return 0x278;
- }
+ case 0: return 0x3BC;
+ case 1: return 0x378;
+ case 2: return 0x278;
+ }
return 0;
}
@@ -484,8 +484,8 @@ void PMAPI PM_availableMemory(
ulong *physical,
ulong *total)
{
- // TODO: Figure out how to determine the available memory. Not entirely
- // critical so returning 0 is OK.
+ /* TODO: Figure out how to determine the available memory. Not entirely */
+ /* critical so returning 0 is OK. */
*physical = *total = 0;
}
@@ -499,7 +499,7 @@ void * PMAPI PM_allocLockedMem(
ibool contiguous,
ibool below16M)
{
- // TODO: Allocate a block of locked, phsyically contigous memory for DMA
+ /* TODO: Allocate a block of locked, phsyically contigous memory for DMA */
return 0;
}
@@ -510,10 +510,10 @@ Free a block of locked physical memory.
void PMAPI PM_freeLockedMem(
void *p,
uint size,
-
+
ibool contiguous)
{
- // TODO: Free a locked memory buffer
+ /* TODO: Free a locked memory buffer */
}
/****************************************************************************
@@ -564,7 +564,7 @@ ibool PMAPI PM_doBIOSPOST(
PM_MODULE PMAPI PM_loadLibrary(
const char *szDLLName)
{
- // TODO: Implement this to load shared libraries!
+ /* TODO: Implement this to load shared libraries! */
(void)szDLLName;
return NULL;
}
@@ -573,7 +573,7 @@ void * PMAPI PM_getProcAddress(
PM_MODULE hModule,
const char *szProcName)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
(void)hModule;
(void)szProcName;
return NULL;
@@ -582,7 +582,7 @@ void * PMAPI PM_getProcAddress(
void PMAPI PM_freeLibrary(
PM_MODULE hModule)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
(void)hModule;
}
@@ -594,9 +594,9 @@ ulong PMAPI PM_findFirstFile(
const char *filename,
PM_findData *findData)
{
- // TODO: This function should start a directory enumeration search
- // given the filename (with wildcards). The data should be
- // converted and returned in the findData standard form.
+ /* TODO: This function should start a directory enumeration search */
+ /* given the filename (with wildcards). The data should be */
+ /* converted and returned in the findData standard form. */
(void)filename;
(void)findData;
return PM_FILE_INVALID;
@@ -610,10 +610,10 @@ ibool PMAPI PM_findNextFile(
ulong handle,
PM_findData *findData)
{
- // TODO: This function should find the next file in directory enumeration
- // search given the search criteria defined in the call to
- // PM_findFirstFile. The data should be converted and returned
- // in the findData standard form.
+ /* TODO: This function should find the next file in directory enumeration */
+ /* search given the search criteria defined in the call to */
+ /* PM_findFirstFile. The data should be converted and returned */
+ /* in the findData standard form. */
(void)handle;
(void)findData;
return false;
@@ -626,8 +626,8 @@ Function to close the find process
void PMAPI PM_findClose(
ulong handle)
{
- // TODO: This function should close the find process. This may do
- // nothing for some OS'es.
+ /* TODO: This function should close the find process. This may do */
+ /* nothing for some OS'es. */
(void)handle;
}
@@ -648,7 +648,7 @@ ibool PMAPI PM_driveValid(
char drive)
{
if (drive == 3)
- return true;
+ return true;
return false;
}
@@ -675,7 +675,7 @@ void PMAPI PM_setFileAttr(
const char *filename,
uint attrib)
{
- // TODO: Set the file attributes for a file
+ /* TODO: Set the file attributes for a file */
(void)filename;
(void)attrib;
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/rttarget/ztimer.c b/board/MAI/bios_emulator/scitech/src/pm/rttarget/ztimer.c
index 52472c385a..80c184dff1 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/rttarget/ztimer.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/rttarget/ztimer.c
@@ -57,9 +57,9 @@ static void __LZTimerOn(
LZTimerObject *tm)
{
if (havePerformanceCounter)
- QueryPerformanceCounter((LARGE_INTEGER*)&tm->start);
+ QueryPerformanceCounter((LARGE_INTEGER*)&tm->start);
else
- tm->start.low = timeGetTime();
+ tm->start.low = timeGetTime();
}
/****************************************************************************
@@ -72,14 +72,14 @@ static ulong __LZTimerLap(
CPU_largeInteger tmLap,tmCount;
if (havePerformanceCounter) {
- QueryPerformanceCounter((LARGE_INTEGER*)&tmLap);
- _CPU_diffTime64(&tm->start,&tmLap,&tmCount);
- return _CPU_calcMicroSec(&tmCount,countFreq.low);
- }
+ QueryPerformanceCounter((LARGE_INTEGER*)&tmLap);
+ _CPU_diffTime64(&tm->start,&tmLap,&tmCount);
+ return _CPU_calcMicroSec(&tmCount,countFreq.low);
+ }
else {
- tmLap.low = timeGetTime();
- return (tmLap.low - tm->start.low) * 1000L;
- }
+ tmLap.low = timeGetTime();
+ return (tmLap.low - tm->start.low) * 1000L;
+ }
}
/****************************************************************************
@@ -90,9 +90,9 @@ static void __LZTimerOff(
LZTimerObject *tm)
{
if (havePerformanceCounter)
- QueryPerformanceCounter((LARGE_INTEGER*)&tm->end);
+ QueryPerformanceCounter((LARGE_INTEGER*)&tm->end);
else
- tm->end.low = timeGetTime();
+ tm->end.low = timeGetTime();
}
/****************************************************************************
@@ -105,11 +105,11 @@ static ulong __LZTimerCount(
CPU_largeInteger tmCount;
if (havePerformanceCounter) {
- _CPU_diffTime64(&tm->start,&tm->end,&tmCount);
- return _CPU_calcMicroSec(&tmCount,countFreq.low);
- }
+ _CPU_diffTime64(&tm->start,&tm->end,&tmCount);
+ return _CPU_calcMicroSec(&tmCount,countFreq.low);
+ }
else
- return (tm->end.low - tm->start.low) * 1000L;
+ return (tm->end.low - tm->start.low) * 1000L;
}
/****************************************************************************
diff --git a/board/MAI/bios_emulator/scitech/src/pm/smx/event.c b/board/MAI/bios_emulator/scitech/src/pm/smx/event.c
index fc13bbbe42..533c2615b1 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/smx/event.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/smx/event.c
@@ -98,8 +98,8 @@ Adds a new mouse event to the event queue. This routine is called from within
the mouse interrupt subroutine, so it must be efficient.
NOTE: Interrupts MUST be OFF while this routine is called to ensure we have
- mutually exclusive access to our internal data structures for
- interrupt driven systems (like under DOS).
+ mutually exclusive access to our internal data structures for
+ interrupt driven systems (like under DOS).
****************************************************************************/
static void addMouseEvent(
uint what,
@@ -113,18 +113,18 @@ static void addMouseEvent(
event_t evt;
if (EVT.count < EVENTQSIZE) {
- /* Save information in event record. */
- evt.when = _EVT_getTicks();
- evt.what = what;
- evt.message = message;
- evt.modifiers = but_stat;
- evt.where_x = x; /* Save mouse event position */
- evt.where_y = y;
- evt.relative_x = mickeyX;
- evt.relative_y = mickeyY;
- evt.modifiers |= EVT.keyModifiers;
- addEvent(&evt); /* Add to tail of event queue */
- }
+ /* Save information in event record. */
+ evt.when = _EVT_getTicks();
+ evt.what = what;
+ evt.message = message;
+ evt.modifiers = but_stat;
+ evt.where_x = x; /* Save mouse event position */
+ evt.where_y = y;
+ evt.relative_x = mickeyX;
+ evt.relative_y = mickeyY;
+ evt.modifiers |= EVT.keyModifiers;
+ addEvent(&evt); /* Add to tail of event queue */
+ }
}
/****************************************************************************
@@ -140,8 +140,8 @@ and we call the addMouseEvent() routine to add the appropriate mouse event
to the event queue.
Note: Interrupts are ON when this routine is called by the mouse driver code.
-//AM: NOTE: This function has not actually been ported from DOS yet and should not
-//AM: be installed until it is.
+/*AM: NOTE: This function has not actually been ported from DOS yet and should not */
+/*AM: be installed until it is. */
****************************************************************************/
static void EVTAPI mouseISR(
uint mask,
@@ -155,39 +155,39 @@ static void EVTAPI mouseISR(
uint ps;
if (mask & 1) {
- /* Save the current mouse coordinates */
- EVT.mx = x; EVT.my = y;
-
- /* If the last event was a movement event, then modify the last
- * event rather than post a new one, so that the queue will not
- * become saturated. Before we modify the data structures, we
- * MUST ensure that interrupts are off.
- */
- ps = _EVT_disableInt();
- if (EVT.oldMove != -1) {
- EVT.evtq[EVT.oldMove].where_x = x; /* Modify existing one */
- EVT.evtq[EVT.oldMove].where_y = y;
- EVT.evtq[EVT.oldMove].relative_x += mickeyX;
- EVT.evtq[EVT.oldMove].relative_y += mickeyY;
- }
- else {
- EVT.oldMove = EVT.freeHead; /* Save id of this move event */
- addMouseEvent(EVT_MOUSEMOVE,0,x,y,mickeyX,mickeyY,butstate);
- }
- _EVT_restoreInt(ps);
- }
+ /* Save the current mouse coordinates */
+ EVT.mx = x; EVT.my = y;
+
+ /* If the last event was a movement event, then modify the last
+ * event rather than post a new one, so that the queue will not
+ * become saturated. Before we modify the data structures, we
+ * MUST ensure that interrupts are off.
+ */
+ ps = _EVT_disableInt();
+ if (EVT.oldMove != -1) {
+ EVT.evtq[EVT.oldMove].where_x = x; /* Modify existing one */
+ EVT.evtq[EVT.oldMove].where_y = y;
+ EVT.evtq[EVT.oldMove].relative_x += mickeyX;
+ EVT.evtq[EVT.oldMove].relative_y += mickeyY;
+ }
+ else {
+ EVT.oldMove = EVT.freeHead; /* Save id of this move event */
+ addMouseEvent(EVT_MOUSEMOVE,0,x,y,mickeyX,mickeyY,butstate);
+ }
+ _EVT_restoreInt(ps);
+ }
if (mask & 0x2A) {
- ps = _EVT_disableInt();
- addMouseEvent(EVT_MOUSEDOWN,mask >> 1,x,y,0,0,butstate);
- EVT.oldMove = -1;
- _EVT_restoreInt(ps);
- }
+ ps = _EVT_disableInt();
+ addMouseEvent(EVT_MOUSEDOWN,mask >> 1,x,y,0,0,butstate);
+ EVT.oldMove = -1;
+ _EVT_restoreInt(ps);
+ }
if (mask & 0x54) {
- ps = _EVT_disableInt();
- addMouseEvent(EVT_MOUSEUP,mask >> 2,x,y,0,0,butstate);
- EVT.oldMove = -1;
- _EVT_restoreInt(ps);
- }
+ ps = _EVT_disableInt();
+ addMouseEvent(EVT_MOUSEUP,mask >> 2,x,y,0,0,butstate);
+ EVT.oldMove = -1;
+ _EVT_restoreInt(ps);
+ }
EVT.oldKey = -1;
}
@@ -196,7 +196,7 @@ REMARKS:
Keyboard interrupt handler function.
NOTE: Interrupts are OFF when this routine is called by the keyboard ISR,
- and we leave them OFF the entire time. This has been modified to work
+ and we leave them OFF the entire time. This has been modified to work
in conjunction with smx keyboard handler.
****************************************************************************/
static void EVTAPI keyboardISR(void)
@@ -252,51 +252,51 @@ void EVTAPI EVT_resume(void)
PM_lockHandle lh;
if (_EVT_useEvents) {
- /* Initialise the event queue and enable our interrupt handlers */
- initEventQueue();
- PM_setKeyHandler(keyboardISR);
- if ((haveMouse = detectMouse()) != 0)
- PM_setMouseHandler(0xFFFF,mouseISR);
-
- /* Read the keyboard modifier flags from the BIOS to get the
- * correct initialisation state. The only state we care about is
- * the correct toggle state flags such as SCROLLLOCK, NUMLOCK and
- * CAPSLOCK.
- */
- EVT.keyModifiers = 0;
- mods = PM_getByte(_EVT_biosPtr+0x17);
- if (mods & 0x10)
- EVT.keyModifiers |= EVT_SCROLLLOCK;
- if (mods & 0x20)
- EVT.keyModifiers |= EVT_NUMLOCK;
- if (mods & 0x40)
- EVT.keyModifiers |= EVT_CAPSLOCK;
-
- /* Lock all of the code and data used by our protected mode interrupt
- * handling routines, so that it will continue to work correctly
- * under real mode.
- */
- if (!locked) {
- /* It is difficult to ensure that we lock our global data, so we
- * do this by taking the address of a variable locking all data
- * 2Kb on either side. This should properly cover the global data
- * used by the module (the other alternative is to declare the
- * variables in assembler, in which case we know it will be
- * correct).
- */
- stat = !PM_lockDataPages(&EVT,sizeof(EVT),&lh);
- stat |= !PM_lockDataPages(&_EVT_biosPtr,sizeof(_EVT_biosPtr),&lh);
- stat |= !PM_lockCodePages((__codePtr)_EVT_cCodeStart,(int)_EVT_cCodeEnd-(int)_EVT_cCodeStart,&lh);
- stat |= !PM_lockCodePages((__codePtr)_EVT_codeStart,(int)_EVT_codeEnd-(int)_EVT_codeStart,&lh);
- if (stat) {
- PM_fatalError("Page locking services failed - interrupt handling not safe!");
- exit(1);
- }
- locked = 1;
- }
-
- _EVT_installed = true;
- }
+ /* Initialise the event queue and enable our interrupt handlers */
+ initEventQueue();
+ PM_setKeyHandler(keyboardISR);
+ if ((haveMouse = detectMouse()) != 0)
+ PM_setMouseHandler(0xFFFF,mouseISR);
+
+ /* Read the keyboard modifier flags from the BIOS to get the
+ * correct initialisation state. The only state we care about is
+ * the correct toggle state flags such as SCROLLLOCK, NUMLOCK and
+ * CAPSLOCK.
+ */
+ EVT.keyModifiers = 0;
+ mods = PM_getByte(_EVT_biosPtr+0x17);
+ if (mods & 0x10)
+ EVT.keyModifiers |= EVT_SCROLLLOCK;
+ if (mods & 0x20)
+ EVT.keyModifiers |= EVT_NUMLOCK;
+ if (mods & 0x40)
+ EVT.keyModifiers |= EVT_CAPSLOCK;
+
+ /* Lock all of the code and data used by our protected mode interrupt
+ * handling routines, so that it will continue to work correctly
+ * under real mode.
+ */
+ if (!locked) {
+ /* It is difficult to ensure that we lock our global data, so we
+ * do this by taking the address of a variable locking all data
+ * 2Kb on either side. This should properly cover the global data
+ * used by the module (the other alternative is to declare the
+ * variables in assembler, in which case we know it will be
+ * correct).
+ */
+ stat = !PM_lockDataPages(&EVT,sizeof(EVT),&lh);
+ stat |= !PM_lockDataPages(&_EVT_biosPtr,sizeof(_EVT_biosPtr),&lh);
+ stat |= !PM_lockCodePages((__codePtr)_EVT_cCodeStart,(int)_EVT_cCodeEnd-(int)_EVT_cCodeStart,&lh);
+ stat |= !PM_lockCodePages((__codePtr)_EVT_codeStart,(int)_EVT_codeEnd-(int)_EVT_codeStart,&lh);
+ if (stat) {
+ PM_fatalError("Page locking services failed - interrupt handling not safe!");
+ exit(1);
+ }
+ locked = 1;
+ }
+
+ _EVT_installed = true;
+ }
}
/****************************************************************************
@@ -310,9 +310,9 @@ void EVTAPI EVT_setMouseRange(
int yRes)
{
if (haveMouse) {
- ps2MouseStop();
- ps2MouseStart( 0, xRes, 0, yRes, -1, -1, -1);
- }
+ ps2MouseStop();
+ ps2MouseStart( 0, xRes, 0, yRes, -1, -1, -1);
+ }
}
/****************************************************************************
@@ -325,7 +325,7 @@ void _EVT_setMousePos(
int *y)
{
if (haveMouse)
- ps2MouseMove(*x, *y);
+ ps2MouseMove(*x, *y);
}
/****************************************************************************
@@ -338,24 +338,24 @@ void EVTAPI EVT_suspend(void)
uchar mods;
if (_EVT_installed) {
- PM_restoreKeyHandler();
+ PM_restoreKeyHandler();
if (haveMouse)
- PM_restoreMouseHandler();
-
- /* Set the keyboard modifier flags in the BIOS to our values */
- EVT_allowLEDS(true);
- mods = PM_getByte(_EVT_biosPtr+0x17) & ~0x70;
- if (EVT.keyModifiers & EVT_SCROLLLOCK)
- mods |= 0x10;
- if (EVT.keyModifiers & EVT_NUMLOCK)
- mods |= 0x20;
- if (EVT.keyModifiers & EVT_CAPSLOCK)
- mods |= 0x40;
- PM_setByte(_EVT_biosPtr+0x17,mods);
-
- /* Flag that we are no longer installed */
- _EVT_installed = false;
- }
+ PM_restoreMouseHandler();
+
+ /* Set the keyboard modifier flags in the BIOS to our values */
+ EVT_allowLEDS(true);
+ mods = PM_getByte(_EVT_biosPtr+0x17) & ~0x70;
+ if (EVT.keyModifiers & EVT_SCROLLLOCK)
+ mods |= 0x10;
+ if (EVT.keyModifiers & EVT_NUMLOCK)
+ mods |= 0x20;
+ if (EVT.keyModifiers & EVT_CAPSLOCK)
+ mods |= 0x40;
+ PM_setByte(_EVT_biosPtr+0x17,mods);
+
+ /* Flag that we are no longer installed */
+ _EVT_installed = false;
+ }
}
/****************************************************************************
diff --git a/board/MAI/bios_emulator/scitech/src/pm/smx/pm.c b/board/MAI/bios_emulator/scitech/src/pm/smx/pm.c
index d6c95d688c..99ee3d4be4 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/smx/pm.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/smx/pm.c
@@ -147,9 +147,9 @@ void PMAPI PM_backslash(char *s)
{
uint pos = strlen(s);
if (s[pos-1] != '\\') {
- s[pos] = '\\';
- s[pos+1] = '\0';
- }
+ s[pos] = '\\';
+ s[pos+1] = '\0';
+ }
}
void PMAPI PM_setFatalErrorCleanup(
@@ -163,28 +163,28 @@ void MGLOutput(char *);
void PMAPI PM_fatalError(const char *msg)
{
if (fatalErrorCleanup)
- fatalErrorCleanup();
+ fatalErrorCleanup();
MGLOutput(msg);
-// No support for fprintf() under smx currently!
-// fprintf(stderr,"%s\n", msg);
+/* No support for fprintf() under smx currently! */
+/* fprintf(stderr,"%s\n", msg); */
exit(1);
}
static void ExitVBEBuf(void)
{
if (VESABuf_ptr)
- PM_freeRealSeg(VESABuf_ptr);
+ PM_freeRealSeg(VESABuf_ptr);
VESABuf_ptr = 0;
}
void * PMAPI PM_getVESABuf(uint *len,uint *rseg,uint *roff)
{
if (!VESABuf_ptr) {
- /* Allocate a global buffer for communicating with the VESA VBE */
- if ((VESABuf_ptr = PM_allocRealSeg(VESABuf_len, &VESABuf_rseg, &VESABuf_roff)) == NULL)
- return NULL;
- atexit(ExitVBEBuf);
- }
+ /* Allocate a global buffer for communicating with the VESA VBE */
+ if ((VESABuf_ptr = PM_allocRealSeg(VESABuf_len, &VESABuf_rseg, &VESABuf_roff)) == NULL)
+ return NULL;
+ atexit(ExitVBEBuf);
+ }
*len = VESABuf_len;
*rseg = VESABuf_rseg;
*roff = VESABuf_roff;
@@ -234,12 +234,12 @@ void PMAPI _PM_addRealModeBlock(void *mem,uint tag)
int i;
for (i = 0; i < MAX_RM_BLOCKS; i++) {
- if (rmBlocks[i].p == NULL) {
- rmBlocks[i].p = mem;
- rmBlocks[i].tag = tag;
- return;
- }
- }
+ if (rmBlocks[i].p == NULL) {
+ rmBlocks[i].p = mem;
+ rmBlocks[i].tag = tag;
+ return;
+ }
+ }
PM_fatalError("To many real mode memory block allocations!");
}
@@ -248,9 +248,9 @@ uint PMAPI _PM_findRealModeBlock(void *mem)
int i;
for (i = 0; i < MAX_RM_BLOCKS; i++) {
- if (rmBlocks[i].p == mem)
- return rmBlocks[i].tag;
- }
+ if (rmBlocks[i].p == mem)
+ return rmBlocks[i].tag;
+ }
PM_fatalError("Could not find prior real mode memory block allocation!");
return 0;
}
@@ -274,7 +274,7 @@ const char * PMAPI PM_getNucleusPath(void)
char *env;
if ((env = getenv("NUCLEUS_PATH")) != NULL)
- return env;
+ return env;
return "c:\\nucleus";
}
@@ -339,12 +339,12 @@ void PMAPI PM_saveConsoleState(void *stateBuf,PM_HWND hwndConsole)
sb->oldMode = regs.h.al & 0x7F;
sb->old50Lines = false;
if (sb->oldMode == 0x3) {
- regs.x.ax = 0x1130;
- regs.x.bx = 0;
- regs.x.dx = 0;
- PM_int86(0x10,&regs,&regs);
- sb->old50Lines = (regs.h.dl == 42 || regs.h.dl == 49);
- }
+ regs.x.ax = 0x1130;
+ regs.x.bx = 0;
+ regs.x.dx = 0;
+ PM_int86(0x10,&regs,&regs);
+ sb->old50Lines = (regs.h.dl == 42 || regs.h.dl == 49);
+ }
(void)hwndConsole;
}
@@ -361,10 +361,10 @@ void PMAPI PM_restoreConsoleState(const void *stateBuf,PM_HWND hwndConsole)
/* Retore 50 line mode if set */
if (sb->old50Lines) {
- regs.x.ax = 0x1112;
- regs.x.bx = 0;
- PM_int86(0x10,&regs,&regs);
- }
+ regs.x.ax = 0x1112;
+ regs.x.bx = 0;
+ PM_int86(0x10,&regs,&regs);
+ }
(void)hwndConsole;
}
@@ -388,13 +388,13 @@ void PMAPI PM_setOSScreenWidth(int width,int height)
PM_setWord(_biosPtr+0x4C,width*2);
PM_setByte(_biosPtr+0x84,height-1);
if (height > 25) {
- PM_setWord(_biosPtr+0x60,0x0607);
- PM_setByte(_biosPtr+0x85,0x08);
- }
+ PM_setWord(_biosPtr+0x60,0x0607);
+ PM_setByte(_biosPtr+0x85,0x08);
+ }
else {
- PM_setWord(_biosPtr+0x60,0x0D0E);
- PM_setByte(_biosPtr+0x85,0x016);
- }
+ PM_setWord(_biosPtr+0x60,0x0D0E);
+ PM_setByte(_biosPtr+0x85,0x016);
+ }
}
void * PMAPI PM_mallocShared(long size)
@@ -424,22 +424,22 @@ ibool PMAPI PM_doBIOSPOST(
/* Create a zero memory mapping for us to use */
if (firstTime) {
- rmZeroPtr = PM_mapPhysicalAddr(0,0x7FFF,true);
- firstTime = false;
- }
+ rmZeroPtr = PM_mapPhysicalAddr(0,0x7FFF,true);
+ firstTime = false;
+ }
/* Remap the secondary BIOS to 0xC0000 physical */
if (BIOSPhysAddr != 0xC0000L || BIOSLen > 32768) {
- /* SMX cannot virtually remap the BIOS, so we can only work if all
- * the secondary controllers are identical, and we then use the
- * BIOS on the first controller for all the remaining controllers.
- *
- * For OS'es that do virtual memory, and remapping of 0xC0000
- * physical (perhaps a copy on write mapping) should be all that
- * is needed.
- */
- return false;
- }
+ /* SMX cannot virtually remap the BIOS, so we can only work if all
+ * the secondary controllers are identical, and we then use the
+ * BIOS on the first controller for all the remaining controllers.
+ *
+ * For OS'es that do virtual memory, and remapping of 0xC0000
+ * physical (perhaps a copy on write mapping) should be all that
+ * is needed.
+ */
+ return false;
+ }
/* Save current handlers of int 10h and 6Dh */
GetRMVect(0x10,&Current10);
@@ -457,9 +457,9 @@ ibool PMAPI PM_doBIOSPOST(
/* Second the primary BIOS mappin 1:1 for 0xC0000 physical */
if (BIOSPhysAddr != 0xC0000L) {
- /* SMX does not support this */
- (void)mappedBIOS;
- }
+ /* SMX does not support this */
+ (void)mappedBIOS;
+ }
return true;
}
@@ -470,26 +470,26 @@ void PMAPI PM_sleep(ulong milliseconds)
LZTimerOnExt(&tm);
while (LZTimerLapExt(&tm) < microseconds)
- ;
+ ;
LZTimerOffExt(&tm);
}
int PMAPI PM_getCOMPort(int port)
{
switch (port) {
- case 0: return 0x3F8;
- case 1: return 0x2F8;
- }
+ case 0: return 0x3F8;
+ case 1: return 0x2F8;
+ }
return 0;
}
int PMAPI PM_getLPTPort(int port)
{
switch (port) {
- case 0: return 0x3BC;
- case 1: return 0x378;
- case 2: return 0x278;
- }
+ case 0: return 0x3BC;
+ case 1: return 0x378;
+ case 2: return 0x278;
+ }
return 0;
}
@@ -534,15 +534,15 @@ static void convertFindData(
memset(findData,0,findData->dwSize);
findData->dwSize = dwSize;
if (blk->attrib & _A_RDONLY)
- findData->attrib |= PM_FILE_READONLY;
+ findData->attrib |= PM_FILE_READONLY;
if (blk->attrib & _A_SUBDIR)
- findData->attrib |= PM_FILE_DIRECTORY;
+ findData->attrib |= PM_FILE_DIRECTORY;
if (blk->attrib & _A_ARCH)
- findData->attrib |= PM_FILE_ARCHIVE;
+ findData->attrib |= PM_FILE_ARCHIVE;
if (blk->attrib & _A_HIDDEN)
- findData->attrib |= PM_FILE_HIDDEN;
+ findData->attrib |= PM_FILE_HIDDEN;
if (blk->attrib & _A_SYSTEM)
- findData->attrib |= PM_FILE_SYSTEM;
+ findData->attrib |= PM_FILE_SYSTEM;
findData->sizeLo = blk->size;
strncpy(findData->name,blk->name,PM_MAX_PATH);
findData->name[PM_MAX_PATH-1] = 0;
@@ -561,11 +561,11 @@ void * PMAPI PM_findFirstFile(
struct find_t *blk;
if ((blk = PM_malloc(sizeof(*blk))) == NULL)
- return PM_FILE_INVALID;
+ return PM_FILE_INVALID;
if (_dos_findfirst((char*)filename,FIND_MASK,blk) == 0) {
- convertFindData(findData,blk);
- return blk;
- }
+ convertFindData(findData,blk);
+ return blk;
+ }
return PM_FILE_INVALID;
}
@@ -580,9 +580,9 @@ ibool PMAPI PM_findNextFile(
struct find_t *blk = handle;
if (_dos_findnext(blk) == 0) {
- convertFindData(findData,blk);
- return true;
- }
+ convertFindData(findData,blk);
+ return true;
+ }
return false;
}
@@ -614,9 +614,9 @@ ibool PMAPI PM_driveValid(
{
RMREGS regs;
regs.h.dl = (uchar)(drive - 'A' + 1);
- regs.h.ah = 0x36; // Get disk information service
+ regs.h.ah = 0x36; /* Get disk information service */
PM_int86(0x21,&regs,&regs);
- return regs.x.ax != 0xFFFF; // AX = 0xFFFF if disk is invalid
+ return regs.x.ax != 0xFFFF; /* AX = 0xFFFF if disk is invalid */
}
/****************************************************************************
@@ -649,25 +649,25 @@ void PMAPI PM_setFileAttr(
DWORD attr = 0;
if (attrib & PM_FILE_READONLY)
- attr |= FILE_ATTRIBUTE_READONLY;
+ attr |= FILE_ATTRIBUTE_READONLY;
if (attrib & PM_FILE_ARCHIVE)
- attr |= FILE_ATTRIBUTE_ARCHIVE;
+ attr |= FILE_ATTRIBUTE_ARCHIVE;
if (attrib & PM_FILE_HIDDEN)
- attr |= FILE_ATTRIBUTE_HIDDEN;
+ attr |= FILE_ATTRIBUTE_HIDDEN;
if (attrib & PM_FILE_SYSTEM)
- attr |= FILE_ATTRIBUTE_SYSTEM;
+ attr |= FILE_ATTRIBUTE_SYSTEM;
SetFileAttributes((LPSTR)filename, attr);
#else
uint attr = 0;
if (attrib & PM_FILE_READONLY)
- attr |= _A_RDONLY;
+ attr |= _A_RDONLY;
if (attrib & PM_FILE_ARCHIVE)
- attr |= _A_ARCH;
+ attr |= _A_ARCH;
if (attrib & PM_FILE_HIDDEN)
- attr |= _A_HIDDEN;
+ attr |= _A_HIDDEN;
if (attrib & PM_FILE_SYSTEM)
- attr |= _A_SYSTEM;
+ attr |= _A_SYSTEM;
_dos_setfileattr(filename,attr);
#endif
}
@@ -682,7 +682,7 @@ ibool PMAPI PM_mkdir(
#ifdef __GNUC__
return mkdir(filename,S_IRUSR) == 0;
#else
-//AM: return mkdir(filename) == 0;
+/*AM: return mkdir(filename) == 0; */
return(false);
#endif
}
@@ -694,7 +694,7 @@ Function to remove a directory.
ibool PMAPI PM_rmdir(
const char *filename)
{
-//AM: return rmdir(filename) == 0;
+/*AM: return rmdir(filename) == 0; */
return(false);
}
@@ -719,9 +719,9 @@ void * PMAPI PM_allocLockedMem(
* properly page align the start of the memory block for DMA operations.
*/
if (size > 4096)
- return NULL;
+ return NULL;
if ((p = PM_allocRealSeg((size + 0xFFF) & ~0xFFF,&r_seg,&r_off)) == NULL)
- return NULL;
+ return NULL;
*physAddr = ((r_seg << 4) + r_off + 0xFFF) & ~0xFFF;
PM_lockDataPages(p,size*2,&lh);
return p;
@@ -743,11 +743,11 @@ ulong PMAPI DPMI_mapPhysicalToLinear(ulong physAddr,ulong limit)
ulong physOfs;
if (physAddr < 0x100000L) {
- /* We can't map memory below 1Mb, but the linear address are already
- * mapped 1:1 for this memory anyway so we just return the base address.
- */
- return physAddr;
- }
+ /* We can't map memory below 1Mb, but the linear address are already
+ * mapped 1:1 for this memory anyway so we just return the base address.
+ */
+ return physAddr;
+ }
/* Round the physical address to a 4Kb boundary and the limit to a
* 4Kb-1 boundary before passing the values to DPMI as some extenders
@@ -766,7 +766,7 @@ ulong PMAPI DPMI_mapPhysicalToLinear(ulong physAddr,ulong limit)
r.x.di = limit & 0xFFFF;
PM_int386(0x31, &r, &r);
if (r.x.cflag)
- return 0xFFFFFFFFUL;
+ return 0xFFFFFFFFUL;
return ((ulong)r.x.bx << 16) + r.x.cx + physOfs;
}
@@ -780,7 +780,7 @@ int PMAPI DPMI_setSelectorBase(ushort sel,ulong linAddr)
r.x.dx = linAddr & 0xFFFF;
PM_int386(0x31, &r, &r);
if (r.x.cflag)
- return 0;
+ return 0;
return 1;
}
@@ -804,7 +804,7 @@ int PMAPI DPMI_setSelectorLimit(ushort sel,ulong limit)
r.x.dx = limit & 0xFFFF;
PM_int386(0x31, &r, &r);
if (r.x.cflag)
- return 0;
+ return 0;
return 1;
}
@@ -830,11 +830,11 @@ uint PMAPI DPMI_createSelector(ulong base,ulong limit)
/* Map physical memory and create selector */
if ((base = DPMI_mapPhysicalToLinear(base,limit)) == 0xFFFFFFFFUL)
- return 0;
+ return 0;
if (!DPMI_setSelectorBase(sel,base))
- return 0;
+ return 0;
if (!DPMI_setSelectorLimit(sel,limit))
- return 0;
+ return 0;
return sel;
}
@@ -883,28 +883,28 @@ void * PMAPI DPMI_mapPhysicalAddr(ulong base,ulong limit,ibool isCached)
PM_segread(&sregs);
DSBaseAddr = DPMI_getSelectorBase(sregs.ds);
if ((base < 0x100000) && (DSBaseAddr == 0)) {
- /* DS is zero based, so we can directly access the first 1Mb of
- * system memory (like under DOS4GW).
- */
- return (void*)base;
- }
+ /* DS is zero based, so we can directly access the first 1Mb of
+ * system memory (like under DOS4GW).
+ */
+ return (void*)base;
+ }
/* Map the memory to a linear address using DPMI function 0x800 */
if ((linAddr = DPMI_mapPhysicalToLinear(base,limit)) == 0) {
- if (base >= 0x100000)
- return NULL;
- /* If the linear address mapping fails but we are trying to
- * map an area in the first 1Mb of system memory, then we must
- * be running under a Windows or OS/2 DOS box. Under these
- * environments we can use the segment wrap around as a fallback
- * measure, as this does work properly.
- */
- linAddr = base;
- }
+ if (base >= 0x100000)
+ return NULL;
+ /* If the linear address mapping fails but we are trying to
+ * map an area in the first 1Mb of system memory, then we must
+ * be running under a Windows or OS/2 DOS box. Under these
+ * environments we can use the segment wrap around as a fallback
+ * measure, as this does work properly.
+ */
+ linAddr = base;
+ }
/* Now expand the default DS selector to 4Gb so we can access it */
if (!DPMI_setSelectorLimit(sregs.ds,0xFFFFFFFFUL))
- return NULL;
+ return NULL;
/* Finally enable caching for the page tables that we just mapped in,
* since DOS4GW and PMODE/W create the page table entries without
@@ -916,34 +916,34 @@ void * PMAPI DPMI_mapPhysicalAddr(ulong base,ulong limit,ibool isCached)
* caching) so that MMIO register regions do not screw up.
*/
if (isCached) {
- if ((PDB = _PM_getPDB()) != 0 && DSBaseAddr == 0) {
- int startPDB,endPDB,iPDB,startPage,endPage,start,end,iPage;
- ulong pageTable,*pPageTable;
- if (!pPDB) {
- if (PDB >= 0x100000)
- pPDB = (ulong*)DPMI_mapPhysicalToLinear(PDB,0xFFF);
- else
- pPDB = (ulong*)PDB;
- }
- if (pPDB) {
- startPDB = (linAddr >> 22) & 0x3FF;
- startPage = (linAddr >> 12) & 0x3FF;
- endPDB = ((linAddr+limit) >> 22) & 0x3FF;
- endPage = ((linAddr+limit) >> 12) & 0x3FF;
- for (iPDB = startPDB; iPDB <= endPDB; iPDB++) {
- pageTable = pPDB[iPDB] & ~0xFFF;
- if (pageTable >= 0x100000)
- pPageTable = (ulong*)DPMI_mapPhysicalToLinear(pageTable,0xFFF);
- else
- pPageTable = (ulong*)pageTable;
- start = (iPDB == startPDB) ? startPage : 0;
- end = (iPDB == endPDB) ? endPage : 0x3FF;
- for (iPage = start; iPage <= end; iPage++)
- pPageTable[iPage] &= ~0x18;
- }
- }
- }
- }
+ if ((PDB = _PM_getPDB()) != 0 && DSBaseAddr == 0) {
+ int startPDB,endPDB,iPDB,startPage,endPage,start,end,iPage;
+ ulong pageTable,*pPageTable;
+ if (!pPDB) {
+ if (PDB >= 0x100000)
+ pPDB = (ulong*)DPMI_mapPhysicalToLinear(PDB,0xFFF);
+ else
+ pPDB = (ulong*)PDB;
+ }
+ if (pPDB) {
+ startPDB = (linAddr >> 22) & 0x3FF;
+ startPage = (linAddr >> 12) & 0x3FF;
+ endPDB = ((linAddr+limit) >> 22) & 0x3FF;
+ endPage = ((linAddr+limit) >> 12) & 0x3FF;
+ for (iPDB = startPDB; iPDB <= endPDB; iPDB++) {
+ pageTable = pPDB[iPDB] & ~0xFFF;
+ if (pageTable >= 0x100000)
+ pPageTable = (ulong*)DPMI_mapPhysicalToLinear(pageTable,0xFFF);
+ else
+ pPageTable = (ulong*)pageTable;
+ start = (iPDB == startPDB) ? startPage : 0;
+ end = (iPDB == endPDB) ? endPage : 0x3FF;
+ for (iPage = start; iPage <= end; iPage++)
+ pPageTable[iPage] &= ~0x18;
+ }
+ }
+ }
+ }
/* Now return the base address of the memory into the default DS */
return (void*)(linAddr - DSBaseAddr);
@@ -971,10 +971,10 @@ void PMAPI PM_callRealMode(uint seg,uint off, RMREGS *in,
uint oldSeg,oldOff;
if (!crPtr) {
- /* Allocate and copy the memory block only once */
- crPtr = PM_allocRealSeg(sizeof(int6AHandler), &crRSeg, &crROff);
- memcpy(crPtr,int6AHandler,sizeof(int6AHandler));
- }
+ /* Allocate and copy the memory block only once */
+ crPtr = PM_allocRealSeg(sizeof(int6AHandler), &crRSeg, &crROff);
+ memcpy(crPtr,int6AHandler,sizeof(int6AHandler));
+ }
PM_setWord(crPtr,off); /* Plug in address to call */
PM_setWord(crPtr+2,seg);
p = PM_mapRealPointer(0,0x6A * 4);
@@ -1003,8 +1003,8 @@ void PMAPI PM_freePhysicalAddr(void *ptr,ulong limit)
ulong PMAPI PM_getPhysicalAddr(void *p)
{
- // TODO: This function should find the physical address of a linear
- // address.
+ /* TODO: This function should find the physical address of a linear */
+ /* address. */
(void)p;
return 0xFFFFFFFFUL;
}
@@ -1020,7 +1020,7 @@ void * PMAPI PM_mapRealPointer(uint r_seg,uint r_off)
static uchar *zeroPtr = NULL;
if (!zeroPtr)
- zeroPtr = PM_mapPhysicalAddr(0,0xFFFFF,true);
+ zeroPtr = PM_mapPhysicalAddr(0,0xFFFFF,true);
return (void*)(zeroPtr + MK_PHYS(r_seg,r_off));
}
@@ -1033,7 +1033,7 @@ void * PMAPI PM_allocRealSeg(uint size,uint *r_seg,uint *r_off)
r.x.bx = (size + 0xF) >> 4; /* number of paragraphs */
PM_int386(0x31, &r, &r);
if (r.x.cflag)
- return NULL; /* DPMI call failed */
+ return NULL; /* DPMI call failed */
*r_seg = r.x.ax; /* Real mode segment */
*r_off = 0;
p = PM_mapRealPointer(*r_seg,*r_off);
@@ -1063,9 +1063,9 @@ void PMAPI DPMI_int86(int intno, DPMI_regs *regs)
PMSREGS sr;
if (intno == 0x10 && DPMI_int10) {
- if (DPMI_int10(regs))
- return;
- }
+ if (DPMI_int10(regs))
+ return;
+ }
PM_segread(&sr);
r.x.ax = 0x300; /* DPMI issue real interrupt */
r.h.bl = intno;
@@ -1086,8 +1086,8 @@ int PMAPI PM_int86(int intno, RMREGS *in, RMREGS *out)
memset(&rmregs, 0, sizeof(rmregs));
IN(eax); IN(ebx); IN(ecx); IN(edx); IN(esi); IN(edi);
-// These real mode ints may cause crashes.
-//AM: DPMI_int86(intno,&rmregs); /* DPMI issue real interrupt */
+/* These real mode ints may cause crashes. */
+/*AM: DPMI_int86(intno,&rmregs); /###* DPMI issue real interrupt */
OUT(eax); OUT(ebx); OUT(ecx); OUT(edx); OUT(esi); OUT(edi);
out->x.cflag = rmregs.flags & 0x1;
@@ -1104,7 +1104,7 @@ int PMAPI PM_int86x(int intno, RMREGS *in, RMREGS *out,
rmregs.es = sregs->es;
rmregs.ds = sregs->ds;
-//AM: DPMI_int86(intno,&rmregs); /* DPMI issue real interrupt */
+/*AM: DPMI_int86(intno,&rmregs); /###* DPMI issue real interrupt */
OUT(eax); OUT(ebx); OUT(ecx); OUT(edx); OUT(esi); OUT(edi);
sregs->es = rmregs.es;
@@ -1118,17 +1118,17 @@ int PMAPI PM_int86x(int intno, RMREGS *in, RMREGS *out,
#pragma pack(1)
typedef struct {
- uint LargestBlockAvail;
- uint MaxUnlockedPage;
- uint LargestLockablePage;
- uint LinAddrSpace;
- uint NumFreePagesAvail;
- uint NumPhysicalPagesFree;
- uint TotalPhysicalPages;
- uint FreeLinAddrSpace;
- uint SizeOfPageFile;
- uint res[3];
- } MemInfo;
+ uint LargestBlockAvail;
+ uint MaxUnlockedPage;
+ uint LargestLockablePage;
+ uint LinAddrSpace;
+ uint NumFreePagesAvail;
+ uint NumPhysicalPagesFree;
+ uint TotalPhysicalPages;
+ uint FreeLinAddrSpace;
+ uint SizeOfPageFile;
+ uint res[3];
+ } MemInfo;
#pragma pack()
@@ -1146,7 +1146,7 @@ void PMAPI PM_availableMemory(ulong *physical,ulong *total)
*physical = memInfo.NumPhysicalPagesFree * 4096;
*total = memInfo.LargestBlockAvail;
if (*total < *physical)
- *physical = *total;
+ *physical = *total;
}
/****************************************************************************
@@ -1156,7 +1156,7 @@ Function to get the file attributes for a specific file.
uint PMAPI PM_getFileAttr(
const char *filename)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
return 0;
}
@@ -1169,7 +1169,7 @@ ibool PMAPI PM_getFileTime(
ibool gmTime,
PM_time *time)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
return false;
}
@@ -1182,6 +1182,6 @@ ibool PMAPI PM_setFileTime(
ibool gmTime,
PM_time *time)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
return false;
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/smx/pmsmx.c b/board/MAI/bios_emulator/scitech/src/pm/smx/pmsmx.c
index 2596c76a36..98e31bc638 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/smx/pmsmx.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/smx/pmsmx.c
@@ -134,41 +134,41 @@ void PMAPI PM_resetMouseDriver(int hardReset)
void PMAPI PM_setRealTimeClockFrequency(int frequency)
{
static short convert[] = {
- 8192,
- 4096,
- 2048,
- 1024,
- 512,
- 256,
- 128,
- 64,
- 32,
- 16,
- 8,
- 4,
- 2,
- -1,
- };
+ 8192,
+ 4096,
+ 2048,
+ 1024,
+ 512,
+ 256,
+ 128,
+ 64,
+ 32,
+ 16,
+ 8,
+ 4,
+ 2,
+ -1,
+ };
int i;
/* First clear any pending RTC timeout if not cleared */
_PM_readCMOS(0x0C);
if (frequency == 0) {
- /* Disable RTC timout */
- _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
- _PM_writeCMOS(0x0B,_PM_oldCMOSRegB & 0x0F);
- }
+ /* Disable RTC timout */
+ _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
+ _PM_writeCMOS(0x0B,_PM_oldCMOSRegB & 0x0F);
+ }
else {
- /* Convert frequency value to RTC clock indexes */
- for (i = 0; convert[i] != -1; i++) {
- if (convert[i] == frequency)
- break;
- }
-
- /* Set RTC timout value and enable timeout */
- _PM_writeCMOS(0x0A,(_PM_oldCMOSRegA & 0xF0) | (i+3));
- _PM_writeCMOS(0x0B,(_PM_oldCMOSRegB & 0x0F) | 0x40);
- }
+ /* Convert frequency value to RTC clock indexes */
+ for (i = 0; convert[i] != -1; i++) {
+ if (convert[i] == frequency)
+ break;
+ }
+
+ /* Set RTC timout value and enable timeout */
+ _PM_writeCMOS(0x0A,(_PM_oldCMOSRegA & 0xF0) | (i+3));
+ _PM_writeCMOS(0x0B,(_PM_oldCMOSRegB & 0x0F) | 0x40);
+ }
}
static void PMAPI lockPMHandlers(void)
@@ -176,22 +176,22 @@ static void PMAPI lockPMHandlers(void)
static int locked = 0;
int stat = 0;
PM_lockHandle lh;
-
+
/* Lock all of the code and data used by our protected mode interrupt
* handling routines, so that it will continue to work correctly
* under real mode.
*/
if (!locked) {
- PM_saveDS();
- stat = !PM_lockDataPages(&globalDataStart-2048,4096,&lh);
- stat |= !PM_lockDataPages(&_PM_pmsmxDataStart,(int)&_PM_pmsmxDataEnd - (int)&_PM_pmsmxDataStart,&lh);
- stat |= !PM_lockCodePages((__codePtr)_PM_pmsmxCodeStart,(int)_PM_pmsmxCodeEnd-(int)_PM_pmsmxCodeStart,&lh);
- if (stat) {
- printf("Page locking services failed - interrupt handling not safe!\n");
- exit(1);
- }
- locked = 1;
- }
+ PM_saveDS();
+ stat = !PM_lockDataPages(&globalDataStart-2048,4096,&lh);
+ stat |= !PM_lockDataPages(&_PM_pmsmxDataStart,(int)&_PM_pmsmxDataEnd - (int)&_PM_pmsmxDataStart,&lh);
+ stat |= !PM_lockCodePages((__codePtr)_PM_pmsmxCodeStart,(int)_PM_pmsmxCodeEnd-(int)_PM_pmsmxCodeStart,&lh);
+ if (stat) {
+ printf("Page locking services failed - interrupt handling not safe!\n");
+ exit(1);
+ }
+ locked = 1;
+ }
}
void PMAPI PM_getPMvect(int intno, PMFARPTR *isr)
@@ -245,7 +245,7 @@ int PMAPI PM_setMouseHandler(int mask, PM_mouseHandler mh)
void PMAPI PM_restoreMouseHandler(void)
{
if (_PM_mouseHandler)
- _PM_mouseHandler = NULL;
+ _PM_mouseHandler = NULL;
}
static void getISR(int intno, PMFARPTR *pmisr, long *realisr)
@@ -274,9 +274,9 @@ void PMAPI PM_setTimerHandler(PM_intHandler th)
void PMAPI PM_restoreTimerHandler(void)
{
if (_PM_timerHandler) {
- restoreISR(PM_IRQ0, _PM_prevTimer, _PM_prevRealTimer);
- _PM_timerHandler = NULL;
- }
+ restoreISR(PM_IRQ0, _PM_prevTimer, _PM_prevRealTimer);
+ _PM_timerHandler = NULL;
+ }
}
ibool PMAPI PM_setRealTimeClockHandler(PM_intHandler th,int frequency)
@@ -302,15 +302,15 @@ ibool PMAPI PM_setRealTimeClockHandler(PM_intHandler th,int frequency)
void PMAPI PM_restoreRealTimeClockHandler(void)
{
if (_PM_rtcHandler) {
- /* Restore CMOS registers and mask RTC clock */
- _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
- _PM_writeCMOS(0x0B,_PM_oldCMOSRegB);
- PM_outpb(0xA1,(PM_inpb(0xA1) & 0xFE) | (_PM_oldRTCPIC2 & ~0xFE));
-
- /* Restore the interrupt vector */
- restoreISR(0x70, _PM_prevRTC, _PM_prevRealRTC);
- _PM_rtcHandler = NULL;
- }
+ /* Restore CMOS registers and mask RTC clock */
+ _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
+ _PM_writeCMOS(0x0B,_PM_oldCMOSRegB);
+ PM_outpb(0xA1,(PM_inpb(0xA1) & 0xFE) | (_PM_oldRTCPIC2 & ~0xFE));
+
+ /* Restore the interrupt vector */
+ restoreISR(0x70, _PM_prevRTC, _PM_prevRealRTC);
+ _PM_rtcHandler = NULL;
+ }
}
void PMAPI PM_setKeyHandler(PM_intHandler kh)
@@ -323,9 +323,9 @@ void PMAPI PM_setKeyHandler(PM_intHandler kh)
void PMAPI PM_restoreKeyHandler(void)
{
if (_PM_keyHandler) {
- restoreISR(PM_IRQ1, _PM_prevKey, _PM_prevRealKey);
- _PM_keyHandler = NULL;
- }
+ restoreISR(PM_IRQ1, _PM_prevKey, _PM_prevRealKey);
+ _PM_keyHandler = NULL;
+ }
}
void PMAPI PM_setKey15Handler(PM_key15Handler kh)
@@ -338,9 +338,9 @@ void PMAPI PM_setKey15Handler(PM_key15Handler kh)
void PMAPI PM_restoreKey15Handler(void)
{
if (_PM_key15Handler) {
- restoreISR(0x15, _PM_prevKey15, _PM_prevRealKey15);
- _PM_key15Handler = NULL;
- }
+ restoreISR(0x15, _PM_prevKey15, _PM_prevRealKey15);
+ _PM_key15Handler = NULL;
+ }
}
/* Real mode Ctrl-C and Ctrl-Break handler. This handler simply sets a
@@ -385,12 +385,12 @@ void PMAPI PM_installBreakHandler(void)
void PMAPI PM_restoreBreakHandler(void)
{
if (_PM_prevBreak.sel) {
- restoreISR(0x1B, _PM_prevBreak, prevRealBreak);
- restoreISR(0x23, _PM_prevCtrlC, prevRealCtrlC);
- _PM_prevBreak.sel = 0;
- _PM_breakHandler = NULL;
- PM_freeRealSeg(_PM_ctrlBPtr);
- }
+ restoreISR(0x1B, _PM_prevBreak, prevRealBreak);
+ restoreISR(0x23, _PM_prevCtrlC, prevRealCtrlC);
+ _PM_prevBreak.sel = 0;
+ _PM_breakHandler = NULL;
+ PM_freeRealSeg(_PM_ctrlBPtr);
+ }
}
/* Real mode Critical Error handler. This handler simply saves the AX and
@@ -432,11 +432,11 @@ void PMAPI PM_installCriticalHandler(void)
void PMAPI PM_restoreCriticalHandler(void)
{
if (_PM_prevCritical.sel) {
- restoreISR(0x24, _PM_prevCritical, prevRealCritical);
- PM_freeRealSeg(_PM_critPtr);
- _PM_prevCritical.sel = 0;
- _PM_critHandler = NULL;
- }
+ restoreISR(0x24, _PM_prevCritical, prevRealCritical);
+ PM_freeRealSeg(_PM_critPtr);
+ _PM_prevCritical.sel = 0;
+ _PM_critHandler = NULL;
+ }
}
int PMAPI PM_lockDataPages(void *p,uint len,PM_lockHandle *lh)
@@ -457,9 +457,9 @@ int PMAPI PM_lockCodePages(void (*p)(),uint len,PM_lockHandle *lh)
{
PMSREGS sregs;
PM_segread(&sregs);
-//AM: causes minor glitch with
-//AM: older versions pmEasy which don't allow DPMI 06 on
-//AM: Code selector 0x0C -- assume base is 0 which it should be.
+/*AM: causes minor glitch with */
+/*AM: older versions pmEasy which don't allow DPMI 06 on */
+/*AM: Code selector 0x0C -- assume base is 0 which it should be. */
return DPMI_lockLinearPages((uint)p,len);
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/smx/ztimer.c b/board/MAI/bios_emulator/scitech/src/pm/smx/ztimer.c
index 01e180bdca..794119282e 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/smx/ztimer.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/smx/ztimer.c
@@ -110,6 +110,6 @@ passed, so if this happens we will be generating erronous results.
ulong __ULZElapsedTime(ulong start,ulong finish)
{
if (finish < start)
- finish += xticks_per_second() * 3600 *24; /* Number of ticks in 24 hours */
+ finish += xticks_per_second() * 3600 *24; /* Number of ticks in 24 hours */
return finish - start;
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/stub/cpuinfo.c b/board/MAI/bios_emulator/scitech/src/pm/stub/cpuinfo.c
index 2833a72f44..0615e90165 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/stub/cpuinfo.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/stub/cpuinfo.c
@@ -37,8 +37,8 @@ Increase the thread priority to maximum, if possible.
****************************************************************************/
static int SetMaxThreadPriority(void)
{
- // TODO: If you have thread priorities, increase it to maximum for the
- // thread for timing the CPU frequency.
+ /* TODO: If you have thread priorities, increase it to maximum for the */
+ /* thread for timing the CPU frequency. */
return oldPriority;
}
@@ -49,7 +49,7 @@ Restore the original thread priority.
static void RestoreThreadPriority(
int priority)
{
- // TODO: Restore the original thread priority on exit.
+ /* TODO: Restore the original thread priority on exit. */
}
/****************************************************************************
@@ -59,8 +59,8 @@ Initialise the counter and return the frequency of the counter.
static void GetCounterFrequency(
CPU_largeInteger *freq)
{
- // TODO: Return the frequency of the counter in here. You should try to
- // normalise this value to be around 100,000 ticks per second.
+ /* TODO: Return the frequency of the counter in here. You should try to */
+ /* normalise this value to be around 100,000 ticks per second. */
freq->low = 0;
freq->high = 0;
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/stub/event.c b/board/MAI/bios_emulator/scitech/src/pm/stub/event.c
index 8e805d060f..204c492540 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/stub/event.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/stub/event.c
@@ -59,7 +59,7 @@ events.
****************************************************************************/
ulong _EVT_getTicks(void)
{
- // TODO: Implement this for your OS!
+ /* TODO: Implement this for your OS! */
}
/****************************************************************************
@@ -68,36 +68,36 @@ Pumps all messages in the application message queue into our event queue.
****************************************************************************/
static void _EVT_pumpMessages(void)
{
- // TODO: The purpose of this function is to read all keyboard and mouse
- // events from the OS specific event queue, translate them and post
- // them into the SciTech event queue.
- //
- // NOTE: There are a couple of important things that this function must
- // take care of:
- //
- // 1. Support for KEYDOWN, KEYREPEAT and KEYUP is required.
- //
- // 2. Support for reading hardware scan code as well as ASCII
- // translated values is required. Games use the scan codes rather
- // than ASCII values. Scan codes go into the high order byte of the
- // keyboard message field.
- //
- // 3. Support for at least reading mouse motion data (mickeys) from the
- // mouse is required. Using the mickey values, we can then translate
- // to mouse cursor coordinates scaled to the range of the current
- // graphics display mode. Mouse values are scaled based on the
- // global 'rangeX' and 'rangeY'.
- //
- // 4. Support for a timestamp for the events is required, which is
- // defined as the number of milliseconds since some event (usually
- // system startup). This is the timestamp when the event occurred
- // (ie: at interrupt time) not when it was stuff into the SciTech
- // event queue.
- //
- // 5. Support for mouse double click events. If the OS has a native
- // mechanism to determine this, it should be used. Otherwise the
- // time stamp information will be used by the generic event code
- // to generate double click events.
+ /* TODO: The purpose of this function is to read all keyboard and mouse */
+ /* events from the OS specific event queue, translate them and post */
+ /* them into the SciTech event queue. */
+ /* */
+ /* NOTE: There are a couple of important things that this function must */
+ /* take care of: */
+ /* */
+ /* 1. Support for KEYDOWN, KEYREPEAT and KEYUP is required. */
+ /* */
+ /* 2. Support for reading hardware scan code as well as ASCII */
+ /* translated values is required. Games use the scan codes rather */
+ /* than ASCII values. Scan codes go into the high order byte of the */
+ /* keyboard message field. */
+ /* */
+ /* 3. Support for at least reading mouse motion data (mickeys) from the */
+ /* mouse is required. Using the mickey values, we can then translate */
+ /* to mouse cursor coordinates scaled to the range of the current */
+ /* graphics display mode. Mouse values are scaled based on the */
+ /* global 'rangeX' and 'rangeY'. */
+ /* */
+ /* 4. Support for a timestamp for the events is required, which is */
+ /* defined as the number of milliseconds since some event (usually */
+ /* system startup). This is the timestamp when the event occurred */
+ /* (ie: at interrupt time) not when it was stuff into the SciTech */
+ /* event queue. */
+ /* */
+ /* 5. Support for mouse double click events. If the OS has a native */
+ /* mechanism to determine this, it should be used. Otherwise the */
+ /* time stamp information will be used by the generic event code */
+ /* to generate double click events. */
}
/****************************************************************************
@@ -141,7 +141,7 @@ void EVTAPI EVT_init(
initEventQueue();
memset(keyUpMsg,0,sizeof(keyUpMsg));
- // TODO: Do any OS specific initialisation here
+ /* TODO: Do any OS specific initialisation here */
/* Catch program termination signals so we can clean up properly */
signal(SIGABRT, _EVT_abort);
@@ -171,7 +171,7 @@ and this function can be used to resume it again later.
****************************************************************************/
void EVT_resume(void)
{
- // Do nothing for non DOS systems
+ /* Do nothing for non DOS systems */
}
/****************************************************************************
@@ -181,7 +181,7 @@ de-install the event handling code.
****************************************************************************/
void EVT_suspend(void)
{
- // Do nothing for non DOS systems
+ /* Do nothing for non DOS systems */
}
/****************************************************************************
@@ -195,5 +195,5 @@ void EVT_exit(void)
signal(SIGFPE, SIG_DFL);
signal(SIGINT, SIG_DFL);
- // TODO: Do any OS specific cleanup in here
+ /* TODO: Do any OS specific cleanup in here */
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/stub/oshdr.h b/board/MAI/bios_emulator/scitech/src/pm/stub/oshdr.h
index 81a20aaf15..1395cbc3c4 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/stub/oshdr.h
+++ b/board/MAI/bios_emulator/scitech/src/pm/stub/oshdr.h
@@ -28,6 +28,6 @@
*
****************************************************************************/
-// TODO: This is where you include OS specific headers for the event handling
-// library. You may leave this empty if you have no OS specific headers
-// to include.
+/* TODO: This is where you include OS specific headers for the event handling */
+/* library. You may leave this empty if you have no OS specific headers */
+/* to include. */
diff --git a/board/MAI/bios_emulator/scitech/src/pm/stub/pm.c b/board/MAI/bios_emulator/scitech/src/pm/stub/pm.c
index 51656b05e3..5f278c32df 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/stub/pm.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/stub/pm.c
@@ -38,13 +38,13 @@
#include <stdlib.h>
#include <string.h>
-// TODO: Include any OS specific headers here!
+/* TODO: Include any OS specific headers here! */
/*--------------------------- Global variables ----------------------------*/
-// TODO: If you support access to the BIOS, the following VESABuf globals
-// keep track of a single VESA transfer buffer. If you don't support
-// access to the BIOS, remove these variables.
+/* TODO: If you support access to the BIOS, the following VESABuf globals */
+/* keep track of a single VESA transfer buffer. If you don't support */
+/* access to the BIOS, remove these variables. */
static uint VESABuf_len = 1024; /* Length of the VESABuf buffer */
static void *VESABuf_ptr = NULL; /* Near pointer to VESABuf */
@@ -61,12 +61,12 @@ Initialise the PM library.
****************************************************************************/
void PMAPI PM_init(void)
{
- // TODO: Do any initialisation in here. This includes getting IOPL
- // access for the process calling PM_init. This will get called
- // more than once.
+ /* TODO: Do any initialisation in here. This includes getting IOPL */
+ /* access for the process calling PM_init. This will get called */
+ /* more than once. */
- // TODO: If you support the supplied MTRR register stuff (you need to
- // be at ring 0 for this!), you should initialise it in here.
+ /* TODO: If you support the supplied MTRR register stuff (you need to */
+ /* be at ring 0 for this!), you should initialise it in here. */
/* MTRR_init(); */
}
@@ -77,7 +77,7 @@ Return the operating system type identifier.
****************************************************************************/
long PMAPI PM_getOSType(void)
{
- // TODO: Change this to return the define for your OS from drvlib/os.h
+ /* TODO: Change this to return the define for your OS from drvlib/os.h */
return _OS_MYOS;
}
@@ -97,9 +97,9 @@ void PMAPI PM_backslash(
{
uint pos = strlen(s);
if (s[pos-1] != '/') {
- s[pos] = '/';
- s[pos+1] = '\0';
- }
+ s[pos] = '/';
+ s[pos+1] = '\0';
+ }
}
/****************************************************************************
@@ -119,11 +119,11 @@ Report a fatal error condition and halt the program.
void PMAPI PM_fatalError(
const char *msg)
{
- // TODO: If you are running in a GUI environment without a console,
- // this needs to be changed to bring up a fatal error message
- // box and terminate the program.
+ /* TODO: If you are running in a GUI environment without a console, */
+ /* this needs to be changed to bring up a fatal error message */
+ /* box and terminate the program. */
if (fatalErrorCleanup)
- fatalErrorCleanup();
+ fatalErrorCleanup();
fprintf(stderr,"%s\n", msg);
exit(1);
}
@@ -134,9 +134,9 @@ Exit handler to kill the VESA transfer buffer.
****************************************************************************/
static void ExitVBEBuf(void)
{
- // TODO: If you do not have BIOS access, remove this function.
+ /* TODO: If you do not have BIOS access, remove this function. */
if (VESABuf_ptr)
- PM_freeRealSeg(VESABuf_ptr);
+ PM_freeRealSeg(VESABuf_ptr);
VESABuf_ptr = 0;
}
@@ -149,14 +149,14 @@ void * PMAPI PM_getVESABuf(
uint *rseg,
uint *roff)
{
- // TODO: If you do not have BIOS access, simply delete the guts of
- // this function and return NULL.
+ /* TODO: If you do not have BIOS access, simply delete the guts of */
+ /* this function and return NULL. */
if (!VESABuf_ptr) {
- /* Allocate a global buffer for communicating with the VESA VBE */
- if ((VESABuf_ptr = PM_allocRealSeg(VESABuf_len, &VESABuf_rseg, &VESABuf_roff)) == NULL)
- return NULL;
- atexit(ExitVBEBuf);
- }
+ /* Allocate a global buffer for communicating with the VESA VBE */
+ if ((VESABuf_ptr = PM_allocRealSeg(VESABuf_len, &VESABuf_rseg, &VESABuf_roff)) == NULL)
+ return NULL;
+ atexit(ExitVBEBuf);
+ }
*len = VESABuf_len;
*rseg = VESABuf_rseg;
*roff = VESABuf_roff;
@@ -169,9 +169,9 @@ Check if a key has been pressed.
****************************************************************************/
int PMAPI PM_kbhit(void)
{
- // TODO: This function checks if a key is available to be read. This
- // should be implemented, but is mostly used by the test programs
- // these days.
+ /* TODO: This function checks if a key is available to be read. This */
+ /* should be implemented, but is mostly used by the test programs */
+ /* these days. */
return true;
}
@@ -181,9 +181,9 @@ Wait for and return the next keypress.
****************************************************************************/
int PMAPI PM_getch(void)
{
- // TODO: This returns the ASCII code of the key pressed. This
- // should be implemented, but is mostly used by the test programs
- // these days.
+ /* TODO: This returns the ASCII code of the key pressed. This */
+ /* should be implemented, but is mostly used by the test programs */
+ /* these days. */
return 0xD;
}
@@ -193,12 +193,12 @@ Open a fullscreen console mode for output.
****************************************************************************/
int PMAPI PM_openConsole(void)
{
- // TODO: Opens up a fullscreen console for graphics output. If your
- // console does not have graphics/text modes, this can be left
- // empty. The main purpose of this is to disable console switching
- // when in graphics modes if you can switch away from fullscreen
- // consoles (if you want to allow switching, this can be done
- // elsewhere with a full save/restore state of the graphics mode).
+ /* TODO: Opens up a fullscreen console for graphics output. If your */
+ /* console does not have graphics/text modes, this can be left */
+ /* empty. The main purpose of this is to disable console switching */
+ /* when in graphics modes if you can switch away from fullscreen */
+ /* consoles (if you want to allow switching, this can be done */
+ /* elsewhere with a full save/restore state of the graphics mode). */
return 0;
}
@@ -208,9 +208,9 @@ Return the size of the state buffer used to save the console state.
****************************************************************************/
int PMAPI PM_getConsoleStateSize(void)
{
- // TODO: Returns the size of the console state buffer used to save the
- // state of the console before going into graphics mode. This is
- // used to restore the console back to normal when we are done.
+ /* TODO: Returns the size of the console state buffer used to save the */
+ /* state of the console before going into graphics mode. This is */
+ /* used to restore the console back to normal when we are done. */
return 1;
}
@@ -222,11 +222,11 @@ void PMAPI PM_saveConsoleState(
void *stateBuf,
int console_id)
{
- // TODO: Saves the state of the console into the state buffer. This is
- // used to restore the console back to normal when we are done.
- // We will always restore 80x25 text mode after being in graphics
- // mode, so if restoring text mode is all you need to do this can
- // be left empty.
+ /* TODO: Saves the state of the console into the state buffer. This is */
+ /* used to restore the console back to normal when we are done. */
+ /* We will always restore 80x25 text mode after being in graphics */
+ /* mode, so if restoring text mode is all you need to do this can */
+ /* be left empty. */
}
/****************************************************************************
@@ -237,11 +237,11 @@ void PMAPI PM_restoreConsoleState(
const void *stateBuf,
int console_id)
{
- // TODO: Restore the state of the console from the state buffer. This is
- // used to restore the console back to normal when we are done.
- // We will always restore 80x25 text mode after being in graphics
- // mode, so if restoring text mode is all you need to do this can
- // be left empty.
+ /* TODO: Restore the state of the console from the state buffer. This is */
+ /* used to restore the console back to normal when we are done. */
+ /* We will always restore 80x25 text mode after being in graphics */
+ /* mode, so if restoring text mode is all you need to do this can */
+ /* be left empty. */
}
/****************************************************************************
@@ -251,7 +251,7 @@ Close the console and return to non-fullscreen console mode.
void PMAPI PM_closeConsole(
int console_id)
{
- // TODO: Close the console when we are done, going back to text mode.
+ /* TODO: Close the console when we are done, going back to text mode. */
}
/****************************************************************************
@@ -262,8 +262,8 @@ void PM_setOSCursorLocation(
int x,
int y)
{
- // TODO: Set the OS console cursor location to the new value. This is
- // generally used for new OS ports (used mostly for DOS).
+ /* TODO: Set the OS console cursor location to the new value. This is */
+ /* generally used for new OS ports (used mostly for DOS). */
}
/****************************************************************************
@@ -274,8 +274,8 @@ void PM_setOSScreenWidth(
int width,
int height)
{
- // TODO: Set the OS console screen width. This is generally unused for
- // new OS ports.
+ /* TODO: Set the OS console screen width. This is generally unused for */
+ /* new OS ports. */
}
/****************************************************************************
@@ -286,12 +286,12 @@ ibool PMAPI PM_setRealTimeClockHandler(
PM_intHandler ih,
int frequency)
{
- // TODO: Install a real time clock interrupt handler. Normally this
- // will not be supported from most OS'es in user land, so an
- // alternative mechanism is needed to enable software stereo.
- // Hence leave this unimplemented unless you have a high priority
- // mechanism to call the 32-bit callback when the real time clock
- // interrupt fires.
+ /* TODO: Install a real time clock interrupt handler. Normally this */
+ /* will not be supported from most OS'es in user land, so an */
+ /* alternative mechanism is needed to enable software stereo. */
+ /* Hence leave this unimplemented unless you have a high priority */
+ /* mechanism to call the 32-bit callback when the real time clock */
+ /* interrupt fires. */
return false;
}
@@ -302,9 +302,9 @@ Set the real time clock frequency (for stereo modes).
void PMAPI PM_setRealTimeClockFrequency(
int frequency)
{
- // TODO: Set the real time clock interrupt frequency. Used for stereo
- // LC shutter glasses when doing software stereo. Usually sets
- // the frequency to around 2048 Hz.
+ /* TODO: Set the real time clock interrupt frequency. Used for stereo */
+ /* LC shutter glasses when doing software stereo. Usually sets */
+ /* the frequency to around 2048 Hz. */
}
/****************************************************************************
@@ -313,7 +313,7 @@ Restore the original real time clock handler.
****************************************************************************/
void PMAPI PM_restoreRealTimeClockHandler(void)
{
- // TODO: Restores the real time clock handler.
+ /* TODO: Restores the real time clock handler. */
}
/****************************************************************************
@@ -333,8 +333,8 @@ Return the drive letter for the boot drive.
****************************************************************************/
char PMAPI PM_getBootDrive(void)
{
- // TODO: Return the boot drive letter for the OS. Normally this is 'c'
- // for DOS based OS'es and '/' for Unices.
+ /* TODO: Return the boot drive letter for the OS. Normally this is 'c' */
+ /* for DOS based OS'es and '/' for Unices. */
return '/';
}
@@ -353,8 +353,8 @@ Return the path to the Nucleus driver files.
****************************************************************************/
const char * PMAPI PM_getNucleusPath(void)
{
- // TODO: Change this to the default path to Nucleus driver files. The
- // following is the default for Unices.
+ /* TODO: Change this to the default path to Nucleus driver files. The */
+ /* following is the default for Unices. */
char *env = getenv("NUCLEUS_PATH");
return env ? env : "/usr/lib/nucleus";
}
@@ -378,8 +378,8 @@ Return a unique identifier for the machine if possible.
****************************************************************************/
const char * PMAPI PM_getUniqueID(void)
{
- // TODO: Return a unique ID for the machine. If a unique ID is not
- // available, return the machine name.
+ /* TODO: Return a unique ID for the machine. If a unique ID is not */
+ /* available, return the machine name. */
static char buf[128];
gethostname(buf, 128);
return buf;
@@ -391,7 +391,7 @@ Get the name of the machine on the network.
****************************************************************************/
const char * PMAPI PM_getMachineName(void)
{
- // TODO: Return the network machine name for the machine.
+ /* TODO: Return the network machine name for the machine. */
static char buf[128];
gethostname(buf, 128);
return buf;
@@ -403,10 +403,10 @@ Return a pointer to the real mode BIOS data area.
****************************************************************************/
void * PMAPI PM_getBIOSPointer(void)
{
- // TODO: This returns a pointer to the real mode BIOS data area. If you
- // do not support BIOS access, you can simply return NULL here.
+ /* TODO: This returns a pointer to the real mode BIOS data area. If you */
+ /* do not support BIOS access, you can simply return NULL here. */
if (!zeroPtr)
- zeroPtr = PM_mapPhysicalAddr(0,0xFFFFF,true);
+ zeroPtr = PM_mapPhysicalAddr(0,0xFFFFF,true);
return (void*)(zeroPtr + 0x400);
}
@@ -418,7 +418,7 @@ void * PMAPI PM_getA0000Pointer(void)
{
static void *bankPtr;
if (!bankPtr)
- bankPtr = PM_mapPhysicalAddr(0xA0000,0xFFFF,true);
+ bankPtr = PM_mapPhysicalAddr(0xA0000,0xFFFF,true);
return bankPtr;
}
@@ -431,23 +431,23 @@ void * PMAPI PM_mapPhysicalAddr(
ulong limit,
ibool isCached)
{
- // TODO: This function maps a physical memory address to a linear
- // address in the address space of the calling process.
-
- // NOTE: This function *must* be able to handle any phsyical base
- // address, and hence you will have to handle rounding of
- // the physical base address to a page boundary (ie: 4Kb on
- // x86 CPU's) to be able to properly map in the memory
- // region.
-
- // NOTE: If possible the isCached bit should be used to ensure that
- // the PCD (Page Cache Disable) and PWT (Page Write Through)
- // bits are set to disable caching for a memory mapping used
- // for MMIO register access. We also disable caching using
- // the MTRR registers for Pentium Pro and later chipsets so if
- // MTRR support is enabled for your OS then you can safely ignore
- // the isCached flag and always enable caching in the page
- // tables.
+ /* TODO: This function maps a physical memory address to a linear */
+ /* address in the address space of the calling process. */
+
+ /* NOTE: This function *must* be able to handle any phsyical base */
+ /* address, and hence you will have to handle rounding of */
+ /* the physical base address to a page boundary (ie: 4Kb on */
+ /* x86 CPU's) to be able to properly map in the memory */
+ /* region. */
+
+ /* NOTE: If possible the isCached bit should be used to ensure that */
+ /* the PCD (Page Cache Disable) and PWT (Page Write Through) */
+ /* bits are set to disable caching for a memory mapping used */
+ /* for MMIO register access. We also disable caching using */
+ /* the MTRR registers for Pentium Pro and later chipsets so if */
+ /* MTRR support is enabled for your OS then you can safely ignore */
+ /* the isCached flag and always enable caching in the page */
+ /* tables. */
return NULL;
}
@@ -459,9 +459,9 @@ void PMAPI PM_freePhysicalAddr(
void *ptr,
ulong limit)
{
- // TODO: This function will free a physical memory mapping previously
- // allocated with PM_mapPhysicalAddr() if at all possible. If
- // you can't free physical memory mappings, simply do nothing.
+ /* TODO: This function will free a physical memory mapping previously */
+ /* allocated with PM_mapPhysicalAddr() if at all possible. If */
+ /* you can't free physical memory mappings, simply do nothing. */
}
/****************************************************************************
@@ -470,36 +470,36 @@ Find the physical address of a linear memory address in current process.
****************************************************************************/
ulong PMAPI PM_getPhysicalAddr(void *p)
{
- // TODO: This function should find the physical address of a linear
- // address.
+ /* TODO: This function should find the physical address of a linear */
+ /* address. */
return 0xFFFFFFFFUL;
}
void PMAPI PM_sleep(ulong milliseconds)
{
- // TODO: Put the process to sleep for milliseconds
+ /* TODO: Put the process to sleep for milliseconds */
}
int PMAPI PM_getCOMPort(int port)
{
- // TODO: Re-code this to determine real values using the Plug and Play
- // manager for the OS.
+ /* TODO: Re-code this to determine real values using the Plug and Play */
+ /* manager for the OS. */
switch (port) {
- case 0: return 0x3F8;
- case 1: return 0x2F8;
- }
+ case 0: return 0x3F8;
+ case 1: return 0x2F8;
+ }
return 0;
}
int PMAPI PM_getLPTPort(int port)
{
- // TODO: Re-code this to determine real values using the Plug and Play
- // manager for the OS.
+ /* TODO: Re-code this to determine real values using the Plug and Play */
+ /* manager for the OS. */
switch (port) {
- case 0: return 0x3BC;
- case 1: return 0x378;
- case 2: return 0x278;
- }
+ case 0: return 0x3BC;
+ case 1: return 0x378;
+ case 2: return 0x278;
+ }
return 0;
}
@@ -510,11 +510,11 @@ Allocate a block of (unnamed) shared memory.
void * PMAPI PM_mallocShared(
long size)
{
- // TODO: This is used to allocate memory that is shared between process
- // that all access the common Nucleus drivers via a common display
- // driver DLL. If your OS does not support shared memory (or if
- // the display driver does not need to allocate shared memory
- // for each process address space), this should just call PM_malloc.
+ /* TODO: This is used to allocate memory that is shared between process */
+ /* that all access the common Nucleus drivers via a common display */
+ /* driver DLL. If your OS does not support shared memory (or if */
+ /* the display driver does not need to allocate shared memory */
+ /* for each process address space), this should just call PM_malloc. */
return PM_malloc(size);
}
@@ -525,10 +525,10 @@ Free a block of shared memory.
void PMAPI PM_freeShared(
void *ptr)
{
- // TODO: Free the shared memory block. This will be called in the context
- // of the original calling process that allocated the shared
- // memory with PM_mallocShared. Simply call PM_free if you do not
- // need this.
+ /* TODO: Free the shared memory block. This will be called in the context */
+ /* of the original calling process that allocated the shared */
+ /* memory with PM_mallocShared. Simply call PM_free if you do not */
+ /* need this. */
PM_free(ptr);
}
@@ -542,16 +542,16 @@ void * PMAPI PM_mapToProcess(
void *base,
ulong limit)
{
- // TODO: This function is used to map a physical memory mapping
- // previously allocated with PM_mapPhysicalAddr into the
- // address space of the calling process. If the memory mapping
- // allocated by PM_mapPhysicalAddr is global to all processes,
- // simply return the pointer.
+ /* TODO: This function is used to map a physical memory mapping */
+ /* previously allocated with PM_mapPhysicalAddr into the */
+ /* address space of the calling process. If the memory mapping */
+ /* allocated by PM_mapPhysicalAddr is global to all processes, */
+ /* simply return the pointer. */
- // NOTE: This function must also handle rounding to page boundaries,
- // since this function is used to map in shared memory buffers
- // allocated with PM_mapPhysicalAddr(). Hence if you aligned
- // the physical address above, then you also need to do it here.
+ /* NOTE: This function must also handle rounding to page boundaries, */
+ /* since this function is used to map in shared memory buffers */
+ /* allocated with PM_mapPhysicalAddr(). Hence if you aligned */
+ /* the physical address above, then you also need to do it here. */
return base;
}
@@ -563,11 +563,11 @@ void * PMAPI PM_mapRealPointer(
uint r_seg,
uint r_off)
{
- // TODO: This function maps a real mode memory pointer into the
- // calling processes address space as a 32-bit near pointer. If
- // you do not support BIOS access, simply return NULL here.
+ /* TODO: This function maps a real mode memory pointer into the */
+ /* calling processes address space as a 32-bit near pointer. If */
+ /* you do not support BIOS access, simply return NULL here. */
if (!zeroPtr)
- zeroPtr = PM_mapPhysicalAddr(0,0xFFFFF);
+ zeroPtr = PM_mapPhysicalAddr(0,0xFFFFF);
return (void*)(zeroPtr + MK_PHYS(r_seg,r_off));
}
@@ -580,10 +580,10 @@ void * PMAPI PM_allocRealSeg(
uint *r_seg,
uint *r_off)
{
- // TODO: This function allocates a block of real mode memory for the
- // calling process used to communicate with real mode BIOS
- // functions. If you do not support BIOS access, simply return
- // NULL here.
+ /* TODO: This function allocates a block of real mode memory for the */
+ /* calling process used to communicate with real mode BIOS */
+ /* functions. If you do not support BIOS access, simply return */
+ /* NULL here. */
return NULL;
}
@@ -594,8 +594,8 @@ Free a block of real mode memory.
void PMAPI PM_freeRealSeg(
void *mem)
{
- // TODO: Frees a previously allocated real mode memory block. If you
- // do not support BIOS access, this function should be empty.
+ /* TODO: Frees a previously allocated real mode memory block. If you */
+ /* do not support BIOS access, this function should be empty. */
}
/****************************************************************************
@@ -606,9 +606,9 @@ void PMAPI DPMI_int86(
int intno,
DPMI_regs *regs)
{
- // TODO: This function calls the real mode BIOS using the passed in
- // register structure. If you do not support real mode BIOS
- // access, this function should be empty.
+ /* TODO: This function calls the real mode BIOS using the passed in */
+ /* register structure. If you do not support real mode BIOS */
+ /* access, this function should be empty. */
}
/****************************************************************************
@@ -620,9 +620,9 @@ int PMAPI PM_int86(
RMREGS *in,
RMREGS *out)
{
- // TODO: This function calls the real mode BIOS using the passed in
- // register structure. If you do not support real mode BIOS
- // access, this function should return 0.
+ /* TODO: This function calls the real mode BIOS using the passed in */
+ /* register structure. If you do not support real mode BIOS */
+ /* access, this function should return 0. */
return 0;
}
@@ -636,9 +636,9 @@ int PMAPI PM_int86x(
RMREGS *out,
RMSREGS *sregs)
{
- // TODO: This function calls the real mode BIOS using the passed in
- // register structure. If you do not support real mode BIOS
- // access, this function should return 0.
+ /* TODO: This function calls the real mode BIOS using the passed in */
+ /* register structure. If you do not support real mode BIOS */
+ /* access, this function should return 0. */
return 0;
}
@@ -652,9 +652,9 @@ void PMAPI PM_callRealMode(
RMREGS *in,
RMSREGS *sregs)
{
- // TODO: This function calls a real mode far function with a far call.
- // If you do not support BIOS access, this function should be
- // empty.
+ /* TODO: This function calls a real mode far function with a far call. */
+ /* If you do not support BIOS access, this function should be */
+ /* empty. */
}
/****************************************************************************
@@ -665,9 +665,9 @@ void PMAPI PM_availableMemory(
ulong *physical,
ulong *total)
{
- // TODO: Report the amount of available memory, both the amount of
- // physical memory left and the amount of virtual memory left.
- // If the OS does not provide these services, report 0's.
+ /* TODO: Report the amount of available memory, both the amount of */
+ /* physical memory left and the amount of virtual memory left. */
+ /* If the OS does not provide these services, report 0's. */
*physical = *total = 0;
}
@@ -681,10 +681,10 @@ void * PMAPI PM_allocLockedMem(
ibool contiguous,
ibool below16M)
{
- // TODO: Allocate a block of locked, physical memory of the specified
- // size. This is used for bus master operations. If this is not
- // supported by the OS, return NULL and bus mastering will not
- // be used.
+ /* TODO: Allocate a block of locked, physical memory of the specified */
+ /* size. This is used for bus master operations. If this is not */
+ /* supported by the OS, return NULL and bus mastering will not */
+ /* be used. */
return NULL;
}
@@ -697,7 +697,7 @@ void PMAPI PM_freeLockedMem(
uint size,
ibool contiguous)
{
- // TODO: Free a memory block allocated with PM_allocLockedMem.
+ /* TODO: Free a memory block allocated with PM_allocLockedMem. */
}
/****************************************************************************
@@ -709,9 +709,9 @@ void PMAPI PM_setBankA(
{
RMREGS regs;
- // TODO: This does a bank switch function by calling the real mode
- // VESA BIOS. If you do not support BIOS access, this function should
- // be empty.
+ /* TODO: This does a bank switch function by calling the real mode */
+ /* VESA BIOS. If you do not support BIOS access, this function should */
+ /* be empty. */
regs.x.ax = 0x4F05;
regs.x.bx = 0x0000;
regs.x.dx = bank;
@@ -727,9 +727,9 @@ void PMAPI PM_setBankAB(
{
RMREGS regs;
- // TODO: This does a bank switch function by calling the real mode
- // VESA BIOS. If you do not support BIOS access, this function should
- // be empty.
+ /* TODO: This does a bank switch function by calling the real mode */
+ /* VESA BIOS. If you do not support BIOS access, this function should */
+ /* be empty. */
regs.x.ax = 0x4F05;
regs.x.bx = 0x0000;
regs.x.dx = bank;
@@ -751,9 +751,9 @@ void PMAPI PM_setCRTStart(
{
RMREGS regs;
- // TODO: This changes the display start address by calling the real mode
- // VESA BIOS. If you do not support BIOS access, this function
- // should be empty.
+ /* TODO: This changes the display start address by calling the real mode */
+ /* VESA BIOS. If you do not support BIOS access, this function */
+ /* should be empty. */
regs.x.ax = 0x4F07;
regs.x.bx = waitVRT;
regs.x.cx = x;
@@ -770,17 +770,17 @@ ibool PMAPI PM_enableWriteCombine(
ulong length,
uint type)
{
- // TODO: This function should enable Pentium Pro and Pentium II MTRR
- // write combining for the passed in physical memory base address
- // and length. Normally this is done via calls to an OS specific
- // device driver as this can only be done at ring 0.
- //
- // NOTE: This is a *very* important function to implement! If you do
- // not implement, graphics performance on the latest Intel chips
- // will be severly impaired. For sample code that can be used
- // directly in a ring 0 device driver, see the MSDOS implementation
- // which includes assembler code to do this directly (if the
- // program is running at ring 0).
+ /* TODO: This function should enable Pentium Pro and Pentium II MTRR */
+ /* write combining for the passed in physical memory base address */
+ /* and length. Normally this is done via calls to an OS specific */
+ /* device driver as this can only be done at ring 0. */
+ /* */
+ /* NOTE: This is a *very* important function to implement! If you do */
+ /* not implement, graphics performance on the latest Intel chips */
+ /* will be severly impaired. For sample code that can be used */
+ /* directly in a ring 0 device driver, see the MSDOS implementation */
+ /* which includes assembler code to do this directly (if the */
+ /* program is running at ring 0). */
return false;
}
@@ -793,19 +793,19 @@ ibool PMAPI PM_doBIOSPOST(
ulong BIOSPhysAddr,
void *mappedBIOS)
{
- // TODO: This function is used to run the BIOS POST code on a secondary
- // controller to initialise it for use. This is not necessary
- // for multi-controller operation, but it will make it a lot
- // more convenicent for end users (otherwise they have to boot
- // the system once with the secondary controller as primary, and
- // then boot with both controllers installed).
- //
- // Even if you don't support full BIOS access, it would be
- // adviseable to be able to POST the secondary controllers in the
- // system using this function as a minimum requirement. Some
- // graphics hardware has registers that contain values that only
- // the BIOS knows about, which makes bring up a card from cold
- // reset difficult if the BIOS has not POST'ed it.
+ /* TODO: This function is used to run the BIOS POST code on a secondary */
+ /* controller to initialise it for use. This is not necessary */
+ /* for multi-controller operation, but it will make it a lot */
+ /* more convenicent for end users (otherwise they have to boot */
+ /* the system once with the secondary controller as primary, and */
+ /* then boot with both controllers installed). */
+ /* */
+ /* Even if you don't support full BIOS access, it would be */
+ /* adviseable to be able to POST the secondary controllers in the */
+ /* system using this function as a minimum requirement. Some */
+ /* graphics hardware has registers that contain values that only */
+ /* the BIOS knows about, which makes bring up a card from cold */
+ /* reset difficult if the BIOS has not POST'ed it. */
return false;
}
@@ -817,8 +817,8 @@ shared libraries, simply return NULL.
PM_MODULE PMAPI PM_loadLibrary(
const char *szDLLName)
{
- // TODO: This function should load a native shared library from disk
- // given the path to the library.
+ /* TODO: This function should load a native shared library from disk */
+ /* given the path to the library. */
(void)szDLLName;
return NULL;
}
@@ -831,8 +831,8 @@ void * PMAPI PM_getProcAddress(
PM_MODULE hModule,
const char *szProcName)
{
- // TODO: This function should return the address of a named procedure
- // from a native shared library.
+ /* TODO: This function should return the address of a named procedure */
+ /* from a native shared library. */
(void)hModule;
(void)szProcName;
return NULL;
@@ -845,7 +845,7 @@ Unload a shared library.
void PMAPI PM_freeLibrary(
PM_MODULE hModule)
{
- // TODO: This function free a previously loaded native shared library.
+ /* TODO: This function free a previously loaded native shared library. */
(void)hModule;
}
@@ -860,8 +860,8 @@ the switch occurred so it can be properly restored.
int PMAPI PM_setIOPL(
int level)
{
- // TODO: This function should enable IOPL for the task (if IOPL is
- // not always enabled for the app through some other means).
+ /* TODO: This function should enable IOPL for the task (if IOPL is */
+ /* not always enabled for the app through some other means). */
return level;
}
@@ -873,9 +873,9 @@ void *PMAPI PM_findFirstFile(
const char *filename,
PM_findData *findData)
{
- // TODO: This function should start a directory enumeration search
- // given the filename (with wildcards). The data should be
- // converted and returned in the findData standard form.
+ /* TODO: This function should start a directory enumeration search */
+ /* given the filename (with wildcards). The data should be */
+ /* converted and returned in the findData standard form. */
(void)filename;
(void)findData;
return PM_FILE_INVALID;
@@ -889,10 +889,10 @@ ibool PMAPI PM_findNextFile(
void *handle,
PM_findData *findData)
{
- // TODO: This function should find the next file in directory enumeration
- // search given the search criteria defined in the call to
- // PM_findFirstFile. The data should be converted and returned
- // in the findData standard form.
+ /* TODO: This function should find the next file in directory enumeration */
+ /* search given the search criteria defined in the call to */
+ /* PM_findFirstFile. The data should be converted and returned */
+ /* in the findData standard form. */
(void)handle;
(void)findData;
return false;
@@ -905,8 +905,8 @@ Function to close the find process
void PMAPI PM_findClose(
void *handle)
{
- // TODO: This function should close the find process. This may do
- // nothing for some OS'es.
+ /* TODO: This function should close the find process. This may do */
+ /* nothing for some OS'es. */
(void)handle;
}
@@ -927,7 +927,7 @@ ibool PMAPI PM_driveValid(
char drive)
{
if (drive == 3)
- return true;
+ return true;
return false;
}
@@ -954,7 +954,7 @@ void PMAPI PM_setFileAttr(
const char *filename,
uint attrib)
{
- // TODO: Set the file attributes for a file
+ /* TODO: Set the file attributes for a file */
(void)filename;
(void)attrib;
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/stub/ztimer.c b/board/MAI/bios_emulator/scitech/src/pm/stub/ztimer.c
index 9bad6c0975..820e292390 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/stub/ztimer.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/stub/ztimer.c
@@ -36,7 +36,7 @@ Initialise the Zen Timer module internals.
****************************************************************************/
void __ZTimerInit(void)
{
- // TODO: Do any specific internal initialisation in here
+ /* TODO: Do any specific internal initialisation in here */
}
/****************************************************************************
@@ -46,8 +46,8 @@ Start the Zen Timer counting.
static void __LZTimerOn(
LZTimerObject *tm)
{
- // TODO: Start the Zen Timer counting. This should be a macro if
- // possible.
+ /* TODO: Start the Zen Timer counting. This should be a macro if */
+ /* possible. */
}
/****************************************************************************
@@ -57,8 +57,8 @@ Compute the lap time since the timer was started.
static ulong __LZTimerLap(
LZTimerObject *tm)
{
- // TODO: Compute the lap time between the current time and when the
- // timer was started.
+ /* TODO: Compute the lap time between the current time and when the */
+ /* timer was started. */
return 0;
}
@@ -69,7 +69,7 @@ Stop the Zen Timer counting.
static void __LZTimerOff(
LZTimerObject *tm)
{
- // TODO: Stop the timer counting. Should be a macro if possible.
+ /* TODO: Stop the timer counting. Should be a macro if possible. */
}
/****************************************************************************
@@ -79,7 +79,7 @@ Compute the elapsed time in microseconds between start and end timings.
static ulong __LZTimerCount(
LZTimerObject *tm)
{
- // TODO: Compute the elapsed time and return it. Always microseconds.
+ /* TODO: Compute the elapsed time and return it. Always microseconds. */
return 0;
}
@@ -95,9 +95,9 @@ Read the Long Period timer from the OS
****************************************************************************/
static ulong __ULZReadTime(void)
{
- // TODO: Read the long period timer from the OS. The resolution of this
- // timer should be around 1/20 of a second for timing long
- // periods if possible.
+ /* TODO: Read the long period timer from the OS. The resolution of this */
+ /* timer should be around 1/20 of a second for timing long */
+ /* periods if possible. */
}
/****************************************************************************
diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/altbrk.c b/board/MAI/bios_emulator/scitech/src/pm/tests/altbrk.c
index 5d899b7a67..ba90262745 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/tests/altbrk.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/tests/altbrk.c
@@ -47,43 +47,43 @@ volatile int ctrlCHit = false;
void PMAPI breakHandler(uint bHit)
{
if (bHit)
- breakHit = true;
+ breakHit = true;
else
- ctrlCHit = true;
+ ctrlCHit = true;
}
int main(void)
{
printf("Program running in ");
switch (PM_getModeType()) {
- case PM_realMode:
- printf("real mode.\n\n");
- break;
- case PM_286:
- printf("16 bit protected mode.\n\n");
- break;
- case PM_386:
- printf("32 bit protected mode.\n\n");
- break;
- }
+ case PM_realMode:
+ printf("real mode.\n\n");
+ break;
+ case PM_286:
+ printf("16 bit protected mode.\n\n");
+ break;
+ case PM_386:
+ printf("32 bit protected mode.\n\n");
+ break;
+ }
PM_installAltBreakHandler(breakHandler);
printf("Control C/Break interrupt handler installed\n");
while (1) {
- if (ctrlCHit) {
- printf("Code termimated with Ctrl-C.\n");
- break;
- }
- if (breakHit) {
- printf("Code termimated with Ctrl-Break.\n");
- break;
- }
- if (PM_kbhit() && PM_getch() == 0x1B) {
- printf("No break code detected!\n");
- break;
- }
- printf("Hit Ctrl-C or Ctrl-Break to exit!\n");
- }
+ if (ctrlCHit) {
+ printf("Code termimated with Ctrl-C.\n");
+ break;
+ }
+ if (breakHit) {
+ printf("Code termimated with Ctrl-Break.\n");
+ break;
+ }
+ if (PM_kbhit() && PM_getch() == 0x1B) {
+ printf("No break code detected!\n");
+ break;
+ }
+ printf("Hit Ctrl-C or Ctrl-Break to exit!\n");
+ }
PM_restoreBreakHandler();
return 0;
diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/altcrit.c b/board/MAI/bios_emulator/scitech/src/pm/tests/altcrit.c
index c5390f68a9..e13730758e 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/tests/altcrit.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/tests/altcrit.c
@@ -59,27 +59,27 @@ int main(void)
printf("Program running in ");
switch (PM_getModeType()) {
- case PM_realMode:
- printf("real mode.\n\n");
- break;
- case PM_286:
- printf("16 bit protected mode.\n\n");
- break;
- case PM_386:
- printf("32 bit protected mode.\n\n");
- break;
- }
+ case PM_realMode:
+ printf("real mode.\n\n");
+ break;
+ case PM_286:
+ printf("16 bit protected mode.\n\n");
+ break;
+ case PM_386:
+ printf("32 bit protected mode.\n\n");
+ break;
+ }
PM_installAltCriticalHandler(criticalHandler);
printf("Critical Error handler installed - trying to read from A: drive...\n");
f = fopen("a:\bog.bog","rb");
if (f) fclose(f);
if (criticalError) {
- printf("Critical error occured on INT 21h function %02X!\n",
- axValue >> 8);
- }
+ printf("Critical error occured on INT 21h function %02X!\n",
+ axValue >> 8);
+ }
else
- printf("Critical error was not caught!\n");
+ printf("Critical error was not caught!\n");
PM_restoreCriticalHandler();
return 0;
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/biosptr.c b/board/MAI/bios_emulator/scitech/src/pm/tests/biosptr.c
index 43668487af..5fa3382483 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/tests/biosptr.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/tests/biosptr.c
@@ -64,29 +64,29 @@ int main(void)
printf("Program running in ");
switch (PM_getModeType()) {
- case PM_realMode:
- printf("real mode.\n\n");
- break;
- case PM_286:
- printf("16 bit protected mode.\n\n");
- break;
- case PM_386:
- printf("32 bit protected mode.\n\n");
- break;
- }
+ case PM_realMode:
+ printf("real mode.\n\n");
+ break;
+ case PM_286:
+ printf("16 bit protected mode.\n\n");
+ break;
+ case PM_386:
+ printf("32 bit protected mode.\n\n");
+ break;
+ }
bios = PM_getBIOSPointer();
printf("Hit any key to test, Ctrl-Shift-Esc to quit\n");
while (!done) {
- if (KB_HIT()) {
- c = PM_getch();
- if (c == 0) PM_getch();
- printf("TIME=%-8lX ST=%02X CHAR=%02X ", TICKS(), KB_STAT, c);
- printf("\n");
- if ((c == ESC) && SHIFT() && CTRL())/* Ctrl-Shift-Esc */
- break;
- }
- }
+ if (KB_HIT()) {
+ c = PM_getch();
+ if (c == 0) PM_getch();
+ printf("TIME=%-8lX ST=%02X CHAR=%02X ", TICKS(), KB_STAT, c);
+ printf("\n");
+ if ((c == ESC) && SHIFT() && CTRL())/* Ctrl-Shift-Esc */
+ break;
+ }
+ }
return 0;
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/block.c b/board/MAI/bios_emulator/scitech/src/pm/tests/block.c
index e948872956..15d503c0de 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/tests/block.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/tests/block.c
@@ -61,9 +61,9 @@ int main(void)
ZTimerInit();
LZTimerOn();
for (i = 0; i < LOOPS; i++) {
- PM_blockUntilTimeout(DELAY_MSECS);
- ReportTime(LZTimerLap());
- }
+ PM_blockUntilTimeout(DELAY_MSECS);
+ ReportTime(LZTimerLap());
+ }
LZTimerOff();
return 0;
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/brk.c b/board/MAI/bios_emulator/scitech/src/pm/tests/brk.c
index 3561fee921..10b644656e 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/tests/brk.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/tests/brk.c
@@ -44,34 +44,34 @@ int main(void)
{
printf("Program running in ");
switch (PM_getModeType()) {
- case PM_realMode:
- printf("real mode.\n\n");
- break;
- case PM_286:
- printf("16 bit protected mode.\n\n");
- break;
- case PM_386:
- printf("32 bit protected mode.\n\n");
- break;
- }
+ case PM_realMode:
+ printf("real mode.\n\n");
+ break;
+ case PM_286:
+ printf("16 bit protected mode.\n\n");
+ break;
+ case PM_386:
+ printf("32 bit protected mode.\n\n");
+ break;
+ }
PM_installBreakHandler();
printf("Control C/Break interrupt handler installed\n");
while (1) {
- if (PM_ctrlCHit(1)) {
- printf("Code termimated with Ctrl-C.\n");
- break;
- }
- if (PM_ctrlBreakHit(1)) {
- printf("Code termimated with Ctrl-Break.\n");
- break;
- }
- if (PM_kbhit() && PM_getch() == 0x1B) {
- printf("No break code detected!\n");
- break;
- }
- printf("Hit Ctrl-C or Ctrl-Break to exit!\n");
- }
+ if (PM_ctrlCHit(1)) {
+ printf("Code termimated with Ctrl-C.\n");
+ break;
+ }
+ if (PM_ctrlBreakHit(1)) {
+ printf("Code termimated with Ctrl-Break.\n");
+ break;
+ }
+ if (PM_kbhit() && PM_getch() == 0x1B) {
+ printf("No break code detected!\n");
+ break;
+ }
+ printf("Hit Ctrl-C or Ctrl-Break to exit!\n");
+ }
PM_restoreBreakHandler();
return 0;
diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/callreal.c b/board/MAI/bios_emulator/scitech/src/pm/tests/callreal.c
index 3897ce9999..4d37cab465 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/tests/callreal.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/tests/callreal.c
@@ -58,22 +58,22 @@ int main(void)
printf("Program running in ");
switch (PM_getModeType()) {
- case PM_realMode:
- printf("real mode.\n\n");
- break;
- case PM_286:
- printf("16 bit protected mode.\n\n");
- break;
- case PM_386:
- printf("32 bit protected mode.\n\n");
- break;
- }
+ case PM_realMode:
+ printf("real mode.\n\n");
+ break;
+ case PM_286:
+ printf("16 bit protected mode.\n\n");
+ break;
+ case PM_386:
+ printf("32 bit protected mode.\n\n");
+ break;
+ }
/* Allocate a the block of real mode memory */
if ((p = PM_allocRealSeg(sizeof(realModeCode), &r_seg, &r_off)) == NULL) {
- printf("Unable to allocate real mode memory!\n");
- exit(1);
- }
+ printf("Unable to allocate real mode memory!\n");
+ exit(1);
+ }
/* Copy the real mode code */
memcpy(p,realModeCode,sizeof(realModeCode));
@@ -89,17 +89,17 @@ int main(void)
sregs.ds = 8;
PM_callRealMode(r_seg,r_off,&regs,&sregs);
if (regs.x.ax != 2 || regs.x.bx != 1 || regs.x.cx != 4 || regs.x.dx != 3
- || regs.x.si != 5 || regs.x.di != 6 || sregs.es != 7
- || sregs.ds != 8) {
- printf("Real mode call failed!\n");
- printf("\n");
- printf("ax = %04X, bx = %04X, cx = %04X, dx = %04X\n",
- regs.x.ax,regs.x.bx,regs.x.cx,regs.x.dx);
- printf("si = %04X, di = %04X, es = %04X, ds = %04X\n",
- regs.x.si,regs.x.di,sregs.es,sregs.ds);
- }
+ || regs.x.si != 5 || regs.x.di != 6 || sregs.es != 7
+ || sregs.ds != 8) {
+ printf("Real mode call failed!\n");
+ printf("\n");
+ printf("ax = %04X, bx = %04X, cx = %04X, dx = %04X\n",
+ regs.x.ax,regs.x.bx,regs.x.cx,regs.x.dx);
+ printf("si = %04X, di = %04X, es = %04X, ds = %04X\n",
+ regs.x.si,regs.x.di,sregs.es,sregs.ds);
+ }
else
- printf("Real mode call succeeded!\n");
+ printf("Real mode call succeeded!\n");
/* Free the memory we allocated */
PM_freeRealSeg(p);
diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/checks.c b/board/MAI/bios_emulator/scitech/src/pm/tests/checks.c
index 81737e17d7..5933ac9f73 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/tests/checks.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/tests/checks.c
@@ -80,21 +80,21 @@ void _CHK_defaultFail(
sprintf(buf,msg,cond,file,line);
if (log) {
- fputs(buf,log);
- fflush(log);
- fclose(log);
+ fputs(buf,log);
+ fflush(log);
+ fclose(log);
#ifdef __WINDOWS__
- OutputDebugStr(buf);
+ OutputDebugStr(buf);
#endif
- }
+ }
if (fatal) {
#ifdef __WINDOWS__
- MessageBox(NULL, buf,"Fatal Error!",MB_ICONEXCLAMATION);
+ MessageBox(NULL, buf,"Fatal Error!",MB_ICONEXCLAMATION);
#else
- fputs(buf,stderr);
+ fputs(buf,stderr);
#endif
- exit(-1);
- }
+ exit(-1);
+ }
}
#endif /* CHECKED */
diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/cpu.c b/board/MAI/bios_emulator/scitech/src/pm/tests/cpu.c
index 34abb2418d..30e5dd30df 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/tests/cpu.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/tests/cpu.c
@@ -41,6 +41,6 @@ int main(void)
fflush(stdout);
printf("\n\n%s\n", CPU_getProcessorName());
if (CPU_haveRDTSC())
- printf("\nProcessor supports Read Time Stamp Counter performance timer.\n");
+ printf("\nProcessor supports Read Time Stamp Counter performance timer.\n");
return 0;
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/critical.c b/board/MAI/bios_emulator/scitech/src/pm/tests/critical.c
index 21ec9946f7..60f1251a5d 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/tests/critical.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/tests/critical.c
@@ -45,25 +45,25 @@ int main(void)
printf("Program running in ");
switch (PM_getModeType()) {
- case PM_realMode:
- printf("real mode.\n\n");
- break;
- case PM_286:
- printf("16 bit protected mode.\n\n");
- break;
- case PM_386:
- printf("32 bit protected mode.\n\n");
- break;
- }
+ case PM_realMode:
+ printf("real mode.\n\n");
+ break;
+ case PM_286:
+ printf("16 bit protected mode.\n\n");
+ break;
+ case PM_386:
+ printf("32 bit protected mode.\n\n");
+ break;
+ }
PM_installCriticalHandler();
printf("Critical Error handler installed - trying to read from A: drive...\n");
f = fopen("a:\bog.bog","rb");
if (f) fclose(f);
if (PM_criticalError(&axcode,&dicode,1)) {
- printf("Critical error occured on INT 21h function %02X!\n",
- axcode >> 8);
- }
+ printf("Critical error occured on INT 21h function %02X!\n",
+ axcode >> 8);
+ }
else printf("Critical error was not caught!\n");
PM_restoreCriticalHandler();
return 0;
diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/getch.c b/board/MAI/bios_emulator/scitech/src/pm/tests/getch.c
index c70f7ee3c3..06c2180ceb 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/tests/getch.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/tests/getch.c
@@ -309,9 +309,9 @@ KeyEntry *FindKey(
KeyEntry *key;
for (key = keys; key->code != 0; key++) {
- if (key->code == code)
- break;
- }
+ if (key->code == code)
+ break;
+ }
return key;
}
@@ -326,29 +326,29 @@ void DisplayModifiers(
event_t *evt)
{
if (evt->modifiers & EVT_LEFTBUT)
- printf(", LBUT");
+ printf(", LBUT");
if (evt->modifiers & EVT_RIGHTBUT)
- printf(", RBUT");
+ printf(", RBUT");
if (evt->modifiers & EVT_MIDDLEBUT)
- printf(", MBUT");
+ printf(", MBUT");
if (evt->modifiers & EVT_SHIFTKEY) {
- if (evt->modifiers & EVT_LEFTSHIFT)
- printf(", LSHIFT");
- if (evt->modifiers & EVT_RIGHTSHIFT)
- printf(", RSHIFT");
- }
+ if (evt->modifiers & EVT_LEFTSHIFT)
+ printf(", LSHIFT");
+ if (evt->modifiers & EVT_RIGHTSHIFT)
+ printf(", RSHIFT");
+ }
if (evt->modifiers & EVT_CTRLSTATE) {
- if (evt->modifiers & EVT_LEFTCTRL)
- printf(", LCTRL");
- if (evt->modifiers & EVT_RIGHTCTRL)
- printf(", RCTRL");
- }
+ if (evt->modifiers & EVT_LEFTCTRL)
+ printf(", LCTRL");
+ if (evt->modifiers & EVT_RIGHTCTRL)
+ printf(", RCTRL");
+ }
if (evt->modifiers & EVT_ALTSTATE) {
- if (evt->modifiers & EVT_LEFTALT)
- printf(", LALT");
- if (evt->modifiers & EVT_RIGHTALT)
- printf(", RALT");
- }
+ if (evt->modifiers & EVT_LEFTALT)
+ printf(", LALT");
+ if (evt->modifiers & EVT_RIGHTALT)
+ printf(", RALT");
+ }
}
/****************************************************************************
@@ -369,7 +369,7 @@ void DisplayKey(
ascii = FindKey(ch,ASCIICodes);
scan = FindKey(EVT_scanCode(evt->message),ScanCodes);
printf("%s: 0x%04X -> %s, %s, '%c'",
- msg, (int)evt->message & 0xFFFF, scan->name, ascii->name, isprint(ch) ? ch : ' ');
+ msg, (int)evt->message & 0xFFFF, scan->name, ascii->name, isprint(ch) ? ch : ' ');
DisplayModifiers(evt);
printf("\n");
}
@@ -388,15 +388,15 @@ void DisplayMouse(
{
printf("%s: ", msg);
if (evt->message & EVT_LEFTBMASK)
- printf("LEFT ");
+ printf("LEFT ");
if (evt->message & EVT_RIGHTBMASK)
- printf("RIGHT ");
+ printf("RIGHT ");
if (evt->message & EVT_MIDDLEBMASK)
- printf("MIDDLE ");
+ printf("MIDDLE ");
printf("abs(%d,%d), rel(%d,%d)", evt->where_x, evt->where_y, evt->relative_x, evt->relative_y);
DisplayModifiers(evt);
if (evt->message & EVT_DBLCLICK)
- printf(", DBLCLICK");
+ printf(", DBLCLICK");
printf("\n");
}
@@ -413,12 +413,12 @@ void DisplayJoy(
event_t *evt)
{
printf("%s: Joy1(%4d,%4d,%c%c), Joy2(%4d,%4d,%c%c)\n", msg,
- evt->where_x,evt->where_y,
- (evt->message & EVT_JOY1_BUTTONA) ? 'A' : 'a',
- (evt->message & EVT_JOY1_BUTTONB) ? 'B' : 'b',
- evt->relative_x,evt->relative_y,
- (evt->message & EVT_JOY2_BUTTONA) ? 'A' : 'a',
- (evt->message & EVT_JOY2_BUTTONB) ? 'B' : 'b');
+ evt->where_x,evt->where_y,
+ (evt->message & EVT_JOY1_BUTTONA) ? 'A' : 'a',
+ (evt->message & EVT_JOY1_BUTTONB) ? 'B' : 'b',
+ evt->relative_x,evt->relative_y,
+ (evt->message & EVT_JOY2_BUTTONA) ? 'A' : 'a',
+ (evt->message & EVT_JOY2_BUTTONB) ? 'B' : 'b');
}
/****************************************************************************
@@ -460,41 +460,41 @@ int main(void)
EVT_setMouseRange(1024,768);
CalibrateJoy();
do {
- EVT_pollJoystick();
- if (EVT_getNext(&evt,EVT_EVERYEVT)) {
- switch (evt.what) {
- case EVT_KEYDOWN:
- DisplayKey("EVT_KEYDOWN ", &evt);
- if (EVT_scanCode(evt.message) == KB_esc)
- done = true;
- break;
- case EVT_KEYREPEAT:
- DisplayKey("EVT_KEYREPEAT", &evt);
- break;
- case EVT_KEYUP:
- DisplayKey("EVT_KEYUP ", &evt);
- break;
- case EVT_MOUSEDOWN:
- DisplayMouse("EVT_MOUSEDOWN", &evt);
- break;
- case EVT_MOUSEAUTO:
- DisplayMouse("EVT_MOUSEAUTO", &evt);
- break;
- case EVT_MOUSEUP:
- DisplayMouse("EVT_MOUSEUP ", &evt);
- break;
- case EVT_MOUSEMOVE:
- DisplayMouse("EVT_MOUSEMOVE", &evt);
- break;
- case EVT_JOYCLICK:
- DisplayJoy("EVT_JOYCLICK ", &evt);
- break;
- case EVT_JOYMOVE:
- DisplayJoy("EVT_JOYMOVE ", &evt);
- break;
- }
- }
- } while (!done);
+ EVT_pollJoystick();
+ if (EVT_getNext(&evt,EVT_EVERYEVT)) {
+ switch (evt.what) {
+ case EVT_KEYDOWN:
+ DisplayKey("EVT_KEYDOWN ", &evt);
+ if (EVT_scanCode(evt.message) == KB_esc)
+ done = true;
+ break;
+ case EVT_KEYREPEAT:
+ DisplayKey("EVT_KEYREPEAT", &evt);
+ break;
+ case EVT_KEYUP:
+ DisplayKey("EVT_KEYUP ", &evt);
+ break;
+ case EVT_MOUSEDOWN:
+ DisplayMouse("EVT_MOUSEDOWN", &evt);
+ break;
+ case EVT_MOUSEAUTO:
+ DisplayMouse("EVT_MOUSEAUTO", &evt);
+ break;
+ case EVT_MOUSEUP:
+ DisplayMouse("EVT_MOUSEUP ", &evt);
+ break;
+ case EVT_MOUSEMOVE:
+ DisplayMouse("EVT_MOUSEMOVE", &evt);
+ break;
+ case EVT_JOYCLICK:
+ DisplayJoy("EVT_JOYCLICK ", &evt);
+ break;
+ case EVT_JOYMOVE:
+ DisplayJoy("EVT_JOYMOVE ", &evt);
+ break;
+ }
+ }
+ } while (!done);
EVT_exit();
PM_closeConsole(hwndConsole);
return 0;
diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/isvesa.c b/board/MAI/bios_emulator/scitech/src/pm/tests/isvesa.c
index 9c02452bb3..67ad2456e8 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/tests/isvesa.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/tests/isvesa.c
@@ -68,24 +68,24 @@ int main(void)
printf("Program running in ");
switch (PM_getModeType()) {
- case PM_realMode:
- printf("real mode.\n\n");
- break;
- case PM_286:
- printf("16 bit protected mode.\n\n");
- break;
- case PM_386:
- printf("32 bit protected mode.\n\n");
- break;
- }
+ case PM_realMode:
+ printf("real mode.\n\n");
+ break;
+ case PM_286:
+ printf("16 bit protected mode.\n\n");
+ break;
+ case PM_386:
+ printf("32 bit protected mode.\n\n");
+ break;
+ }
/* Allocate a 256 byte block of real memory for communicating with
* the VESA BIOS.
*/
if ((vgPtr = PM_getVESABuf(&vgLen,&r_vgseg,&r_vgoff)) == NULL) {
- printf("Unable to allocate VESA memory buffer!\n");
- exit(1);
- }
+ printf("Unable to allocate VESA memory buffer!\n");
+ exit(1);
+ }
/* Call the VESA VBE to see if it is out there */
regs.x.ax = 0x4F00;
@@ -95,16 +95,16 @@ int main(void)
PM_int86x(0x10, &regs, &regs, &sregs);
memcpy(&vgaInfo,vgPtr,sizeof(VgaInfoBlock));
if (regs.x.ax == 0x4F && strncmp(vgaInfo.VESASignature,"VESA",4) == 0) {
- printf("VESA VBE version %d.%d BIOS detected\n\n",
- vgaInfo.VESAVersion >> 8, vgaInfo.VESAVersion & 0xF);
- printf("Available video modes:\n");
- mode = PM_mapRealPointer(vgaInfo.VideoModePtr >> 16, vgaInfo.VideoModePtr & 0xFFFF);
- while (*mode != 0xFFFF) {
- printf(" %04hXh (%08X)\n", *mode, (int)mode);
- mode++;
- }
- }
+ printf("VESA VBE version %d.%d BIOS detected\n\n",
+ vgaInfo.VESAVersion >> 8, vgaInfo.VESAVersion & 0xF);
+ printf("Available video modes:\n");
+ mode = PM_mapRealPointer(vgaInfo.VideoModePtr >> 16, vgaInfo.VideoModePtr & 0xFFFF);
+ while (*mode != 0xFFFF) {
+ printf(" %04hXh (%08X)\n", *mode, (int)mode);
+ mode++;
+ }
+ }
else
- printf("VESA VBE not found\n");
+ printf("VESA VBE not found\n");
return 0;
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/key.c b/board/MAI/bios_emulator/scitech/src/pm/tests/key.c
index cf89f79fb7..dba88853c2 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/tests/key.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/tests/key.c
@@ -56,16 +56,16 @@ int main(void)
printf("Program running in ");
switch (PM_getModeType()) {
- case PM_realMode:
- printf("real mode.\n\n");
- break;
- case PM_286:
- printf("16 bit protected mode.\n\n");
- break;
- case PM_386:
- printf("32 bit protected mode.\n\n");
- break;
- }
+ case PM_realMode:
+ printf("real mode.\n\n");
+ break;
+ case PM_286:
+ printf("16 bit protected mode.\n\n");
+ break;
+ case PM_386:
+ printf("32 bit protected mode.\n\n");
+ break;
+ }
/* Install our timer handler and lock handler pages in memory. It is
* difficult to get the size of a function in C, but we know our
@@ -79,9 +79,9 @@ int main(void)
printf("Keyboard interrupt handler installed - Type some characters and\n");
printf("hit ESC to exit\n");
while ((ch = PM_getch()) != 0x1B) {
- printf("%c", ch);
- fflush(stdout);
- }
+ printf("%c", ch);
+ fflush(stdout);
+ }
PM_restoreKeyHandler();
PM_restoreBreakHandler();
diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/key15.c b/board/MAI/bios_emulator/scitech/src/pm/tests/key15.c
index 5c0d27a174..b0b94be9c2 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/tests/key15.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/tests/key15.c
@@ -59,16 +59,16 @@ int main(void)
printf("Program running in ");
switch (PM_getModeType()) {
- case PM_realMode:
- printf("real mode.\n\n");
- break;
- case PM_286:
- printf("16 bit protected mode.\n\n");
- break;
- case PM_386:
- printf("32 bit protected mode.\n\n");
- break;
- }
+ case PM_realMode:
+ printf("real mode.\n\n");
+ break;
+ case PM_286:
+ printf("16 bit protected mode.\n\n");
+ break;
+ case PM_386:
+ printf("32 bit protected mode.\n\n");
+ break;
+ }
/* Install our timer handler and lock handler pages in memory. It is
* difficult to get the size of a function in C, but we know our
@@ -82,9 +82,9 @@ int main(void)
printf("Keyboard interrupt handler installed - Type some characters and\n");
printf("hit ESC to exit\n");
while ((ch = PM_getch()) != 0x1B) {
- printf("%c", ch);
- fflush(stdout);
- }
+ printf("%c", ch);
+ fflush(stdout);
+ }
PM_restoreKey15Handler();
PM_restoreBreakHandler();
diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/memtest.c b/board/MAI/bios_emulator/scitech/src/pm/tests/memtest.c
index 221bfb1a02..a2c655b4a3 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/tests/memtest.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/tests/memtest.c
@@ -56,16 +56,16 @@ int main(void)
printf("Program running in ");
switch (PM_getModeType()) {
- case PM_realMode:
- printf("real mode.\n\n");
- break;
- case PM_286:
- printf("16 bit protected mode.\n\n");
- break;
- case PM_386:
- printf("32 bit protected mode.\n\n");
- break;
- }
+ case PM_realMode:
+ printf("real mode.\n\n");
+ break;
+ case PM_286:
+ printf("16 bit protected mode.\n\n");
+ break;
+ case PM_386:
+ printf("32 bit protected mode.\n\n");
+ break;
+ }
printf("Memory available at start:\n");
PM_availableMemory(&physical,&total);
@@ -73,18 +73,18 @@ int main(void)
printf(" Total (including virtual): %ld Kb\n", total / 1024);
printf("\n");
for (allocs = i = 0; i < MAXALLOC; i++) {
- if ((pa[i] = PM_malloc(10*1024)) != 0) { /* in 10k blocks */
- p = pa[allocs];
- memset(p, 0, 10*1024); /* touch every byte */
- *p = 'x'; /* do something, anything with */
- p[1023] = 'y'; /* the allocated memory */
- allocs++;
- printf("Allocated %lu bytes\r", 10*(allocs << 10));
- }
- else break;
- if (PM_kbhit() && (PM_getch() == 0x1B))
- break;
- }
+ if ((pa[i] = PM_malloc(10*1024)) != 0) { /* in 10k blocks */
+ p = pa[allocs];
+ memset(p, 0, 10*1024); /* touch every byte */
+ *p = 'x'; /* do something, anything with */
+ p[1023] = 'y'; /* the allocated memory */
+ allocs++;
+ printf("Allocated %lu bytes\r", 10*(allocs << 10));
+ }
+ else break;
+ if (PM_kbhit() && (PM_getch() == 0x1B))
+ break;
+ }
printf("\n\nAllocated total of %lu bytes\n", 10 * (allocs << 10));
@@ -94,7 +94,7 @@ int main(void)
printf(" Total (including virtual): %ld Kb\n", total / 1024);
for (i = allocs-1; i >= 0; i--)
- PM_free(pa[i]);
+ PM_free(pa[i]);
printf("\nMemory available after freeing all blocks (note that under protected mode\n");
printf("this will most likely not be correct after freeing blocks):\n\n");
diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/mouse.c b/board/MAI/bios_emulator/scitech/src/pm/tests/mouse.c
index 5b426517c8..2765a0d1cc 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/tests/mouse.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/tests/mouse.c
@@ -69,23 +69,23 @@ int main(void)
printf("Program running in ");
switch (PM_getModeType()) {
- case PM_realMode:
- printf("real mode.\n\n");
- break;
- case PM_286:
- printf("16 bit protected mode.\n\n");
- break;
- case PM_386:
- printf("32 bit protected mode.\n\n");
- break;
- }
+ case PM_realMode:
+ printf("real mode.\n\n");
+ break;
+ case PM_286:
+ printf("16 bit protected mode.\n\n");
+ break;
+ case PM_386:
+ printf("32 bit protected mode.\n\n");
+ break;
+ }
regs.x.ax = 33; /* Mouse function 33 - Software reset */
PM_int86(0x33,&regs,&regs);
if (regs.x.bx == 0) {
- printf("No mouse installed.\n");
- exit(1);
- }
+ printf("No mouse installed.\n");
+ exit(1);
+ }
/* Install our mouse handler and lock handler pages in memory. It is
* difficult to get the size of a function in C, but we know our
@@ -95,9 +95,9 @@ int main(void)
PM_lockCodePages((__codePtr)mouseHandler,100,&lh);
PM_lockDataPages((void*)&count,sizeof(count),&lh);
if (!PM_setMouseHandler(0xFFFF, mouseHandler)) {
- printf("Unable to install mouse handler!\n");
- exit(1);
- }
+ printf("Unable to install mouse handler!\n");
+ exit(1);
+ }
printf("Mouse handler installed - Hit any key to exit\n");
PM_getch();
diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/restore.c b/board/MAI/bios_emulator/scitech/src/pm/tests/restore.c
index b808052c02..e00be750e3 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/tests/restore.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/tests/restore.c
@@ -45,24 +45,24 @@ void setVideoMode(int mode)
int main(void)
{
PM_HWND hwndConsole;
- ulong stateSize;
+ ulong stateSize;
void *stateBuf;
FILE *f;
/* Write the saved console state buffer to disk */
if ((f = fopen("/etc/pmsave.dat","rb")) == NULL) {
- printf("Unable to open /etc/pmsave.dat for reading!\n");
- return -1;
- }
+ printf("Unable to open /etc/pmsave.dat for reading!\n");
+ return -1;
+ }
fread(&stateSize,1,sizeof(stateSize),f);
if (stateSize != PM_getConsoleStateSize()) {
- printf("Size mismatch in /etc/pmsave.dat!\n");
- return -1;
- }
+ printf("Size mismatch in /etc/pmsave.dat!\n");
+ return -1;
+ }
if ((stateBuf = PM_malloc(stateSize)) == NULL) {
- printf("Unable to allocate console state buffer!\n");
- return -1;
- }
+ printf("Unable to allocate console state buffer!\n");
+ return -1;
+ }
fread(stateBuf,1,stateSize,f);
fclose(f);
@@ -71,7 +71,7 @@ int main(void)
/* Forcibly set 80x25 text mode using the BIOS */
setVideoMode(0x3);
-
+
/* Restore the previous console state */
PM_restoreConsoleState(stateBuf,0);
PM_closeConsole(hwndConsole);
@@ -79,4 +79,3 @@ int main(void)
printf("Console state successfully restored from /etc/pmsave.dat\n");
return 0;
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/rtc.c b/board/MAI/bios_emulator/scitech/src/pm/tests/rtc.c
index 07c6eaafd4..acef9226a8 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/tests/rtc.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/tests/rtc.c
@@ -52,16 +52,16 @@ int main(void)
printf("Program running in ");
switch (PM_getModeType()) {
- case PM_realMode:
- printf("real mode.\n\n");
- break;
- case PM_286:
- printf("16 bit protected mode.\n\n");
- break;
- case PM_386:
- printf("32 bit protected mode.\n\n");
- break;
- }
+ case PM_realMode:
+ printf("real mode.\n\n");
+ break;
+ case PM_286:
+ printf("16 bit protected mode.\n\n");
+ break;
+ case PM_386:
+ printf("32 bit protected mode.\n\n");
+ break;
+ }
/* Install our timer handler and lock handler pages in memory. It is
* difficult to get the size of a function in C, but we know our
@@ -75,13 +75,13 @@ int main(void)
printf("RealTimeClock interrupt handler installed - Hit ESC to exit\n");
oldCount = count;
while (1) {
- if (PM_kbhit() && (PM_getch() == 0x1B))
- break;
- if (count != oldCount) {
- printf("Tick, Tock: %ld\n", count);
- oldCount = count;
- }
- }
+ if (PM_kbhit() && (PM_getch() == 0x1B))
+ break;
+ if (count != oldCount) {
+ printf("Tick, Tock: %ld\n", count);
+ oldCount = count;
+ }
+ }
PM_restoreRealTimeClockHandler();
PM_restoreBreakHandler();
diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/save.c b/board/MAI/bios_emulator/scitech/src/pm/tests/save.c
index be96968f62..f7324562f8 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/tests/save.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/tests/save.c
@@ -37,7 +37,7 @@
int main(void)
{
PM_HWND hwndConsole;
- ulong stateSize;
+ ulong stateSize;
void *stateBuf;
FILE *f;
@@ -45,26 +45,25 @@ int main(void)
hwndConsole = PM_openConsole(0,0,0,0,0,true);
stateSize = PM_getConsoleStateSize();
if ((stateBuf = PM_malloc(stateSize)) == NULL) {
- PM_closeConsole(hwndConsole);
- printf("Unable to allocate console state buffer!\n");
- return -1;
- }
+ PM_closeConsole(hwndConsole);
+ printf("Unable to allocate console state buffer!\n");
+ return -1;
+ }
PM_saveConsoleState(stateBuf,0);
-
+
/* Restore the console state on exit */
PM_restoreConsoleState(stateBuf,0);
PM_closeConsole(hwndConsole);
-
+
/* Write the saved console state buffer to disk */
if ((f = fopen("/etc/pmsave.dat","wb")) == NULL)
- printf("Unable to open /etc/pmsave/dat for writing!\n");
+ printf("Unable to open /etc/pmsave/dat for writing!\n");
else {
- fwrite(&stateSize,1,sizeof(stateSize),f);
- fwrite(stateBuf,1,stateSize,f);
- fclose(f);
- printf("Console state successfully saved to /etc/pmsave.dat\n");
- }
+ fwrite(&stateSize,1,sizeof(stateSize),f);
+ fwrite(stateBuf,1,stateSize,f);
+ fclose(f);
+ printf("Console state successfully saved to /etc/pmsave.dat\n");
+ }
PM_free(stateBuf);
return 0;
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/showpci.c b/board/MAI/bios_emulator/scitech/src/pm/tests/showpci.c
index 8222b86024..be275e1a04 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/tests/showpci.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/tests/showpci.c
@@ -58,123 +58,123 @@ static void EnumeratePCI(void)
PCIDeviceInfo *info;
printf("Displaying enumeration of PCI bus (%d devices, %d display devices)\n",
- NumPCI, NumDevices);
+ NumPCI, NumDevices);
for (index = 0; index < NumDevices; index++)
- printf(" Display device %d is PCI device %d\n",index,DeviceIndex[index]);
+ printf(" Display device %d is PCI device %d\n",index,DeviceIndex[index]);
printf("\n");
printf("Bus Slot Fnc DeviceID SubSystem Rev Class IRQ Int Cmd\n");
for (i = 0; i < NumPCI; i++) {
- printf("%2d %2d %2d %04X:%04X %04X:%04X %02X %02X:%02X %02X %02X %04X ",
- PCI[i].slot.p.Bus,
- PCI[i].slot.p.Device,
- PCI[i].slot.p.Function,
- PCI[i].VendorID,
- PCI[i].DeviceID,
- PCI[i].u.type0.SubSystemVendorID,
- PCI[i].u.type0.SubSystemID,
- PCI[i].RevID,
- PCI[i].BaseClass,
- PCI[i].SubClass,
- PCI[i].u.type0.InterruptLine,
- PCI[i].u.type0.InterruptPin,
- PCI[i].Command);
- for (index = 0; index < NumDevices; index++) {
- if (DeviceIndex[index] == i)
- break;
- }
- if (index < NumDevices)
- printf("<- %d\n", index);
- else
- printf("\n");
- }
+ printf("%2d %2d %2d %04X:%04X %04X:%04X %02X %02X:%02X %02X %02X %04X ",
+ PCI[i].slot.p.Bus,
+ PCI[i].slot.p.Device,
+ PCI[i].slot.p.Function,
+ PCI[i].VendorID,
+ PCI[i].DeviceID,
+ PCI[i].u.type0.SubSystemVendorID,
+ PCI[i].u.type0.SubSystemID,
+ PCI[i].RevID,
+ PCI[i].BaseClass,
+ PCI[i].SubClass,
+ PCI[i].u.type0.InterruptLine,
+ PCI[i].u.type0.InterruptPin,
+ PCI[i].Command);
+ for (index = 0; index < NumDevices; index++) {
+ if (DeviceIndex[index] == i)
+ break;
+ }
+ if (index < NumDevices)
+ printf("<- %d\n", index);
+ else
+ printf("\n");
+ }
printf("\n");
printf("DeviceID Stat Ifc Cch Lat Hdr BIST\n");
for (i = 0; i < NumPCI; i++) {
- printf("%04X:%04X %04X %02X %02X %02X %02X %02X ",
- PCI[i].VendorID,
- PCI[i].DeviceID,
- PCI[i].Status,
- PCI[i].Interface,
- PCI[i].CacheLineSize,
- PCI[i].LatencyTimer,
- PCI[i].HeaderType,
- PCI[i].BIST);
- for (index = 0; index < NumDevices; index++) {
- if (DeviceIndex[index] == i)
- break;
- }
- if (index < NumDevices)
- printf("<- %d\n", index);
- else
- printf("\n");
- }
+ printf("%04X:%04X %04X %02X %02X %02X %02X %02X ",
+ PCI[i].VendorID,
+ PCI[i].DeviceID,
+ PCI[i].Status,
+ PCI[i].Interface,
+ PCI[i].CacheLineSize,
+ PCI[i].LatencyTimer,
+ PCI[i].HeaderType,
+ PCI[i].BIST);
+ for (index = 0; index < NumDevices; index++) {
+ if (DeviceIndex[index] == i)
+ break;
+ }
+ if (index < NumDevices)
+ printf("<- %d\n", index);
+ else
+ printf("\n");
+ }
printf("\n");
printf("DeviceID Base10h Base14h Base18h Base1Ch Base20h Base24h ROMBase\n");
for (i = 0; i < NumPCI; i++) {
- printf("%04X:%04X %08lX %08lX %08lX %08lX %08lX %08lX %08lX ",
- PCI[i].VendorID,
- PCI[i].DeviceID,
- PCI[i].u.type0.BaseAddress10,
- PCI[i].u.type0.BaseAddress14,
- PCI[i].u.type0.BaseAddress18,
- PCI[i].u.type0.BaseAddress1C,
- PCI[i].u.type0.BaseAddress20,
- PCI[i].u.type0.BaseAddress24,
- PCI[i].u.type0.ROMBaseAddress);
- for (index = 0; index < NumDevices; index++) {
- if (DeviceIndex[index] == i)
- break;
- }
- if (index < NumDevices)
- printf("<- %d\n", index);
- else
- printf("\n");
- }
+ printf("%04X:%04X %08lX %08lX %08lX %08lX %08lX %08lX %08lX ",
+ PCI[i].VendorID,
+ PCI[i].DeviceID,
+ PCI[i].u.type0.BaseAddress10,
+ PCI[i].u.type0.BaseAddress14,
+ PCI[i].u.type0.BaseAddress18,
+ PCI[i].u.type0.BaseAddress1C,
+ PCI[i].u.type0.BaseAddress20,
+ PCI[i].u.type0.BaseAddress24,
+ PCI[i].u.type0.ROMBaseAddress);
+ for (index = 0; index < NumDevices; index++) {
+ if (DeviceIndex[index] == i)
+ break;
+ }
+ if (index < NumDevices)
+ printf("<- %d\n", index);
+ else
+ printf("\n");
+ }
printf("\n");
printf("DeviceID BAR10Len BAR14Len BAR18Len BAR1CLen BAR20Len BAR24Len ROMLen\n");
for (i = 0; i < NumPCI; i++) {
- printf("%04X:%04X %08lX %08lX %08lX %08lX %08lX %08lX %08lX ",
- PCI[i].VendorID,
- PCI[i].DeviceID,
- PCI[i].u.type0.BaseAddress10Len,
- PCI[i].u.type0.BaseAddress14Len,
- PCI[i].u.type0.BaseAddress18Len,
- PCI[i].u.type0.BaseAddress1CLen,
- PCI[i].u.type0.BaseAddress20Len,
- PCI[i].u.type0.BaseAddress24Len,
- PCI[i].u.type0.ROMBaseAddressLen);
- for (index = 0; index < NumDevices; index++) {
- if (DeviceIndex[index] == i)
- break;
- }
- if (index < NumDevices)
- printf("<- %d\n", index);
- else
- printf("\n");
- }
+ printf("%04X:%04X %08lX %08lX %08lX %08lX %08lX %08lX %08lX ",
+ PCI[i].VendorID,
+ PCI[i].DeviceID,
+ PCI[i].u.type0.BaseAddress10Len,
+ PCI[i].u.type0.BaseAddress14Len,
+ PCI[i].u.type0.BaseAddress18Len,
+ PCI[i].u.type0.BaseAddress1CLen,
+ PCI[i].u.type0.BaseAddress20Len,
+ PCI[i].u.type0.BaseAddress24Len,
+ PCI[i].u.type0.ROMBaseAddressLen);
+ for (index = 0; index < NumDevices; index++) {
+ if (DeviceIndex[index] == i)
+ break;
+ }
+ if (index < NumDevices)
+ printf("<- %d\n", index);
+ else
+ printf("\n");
+ }
printf("\n");
printf("Displaying enumeration of %d bridge devices\n",NumBridges);
printf("\n");
printf("DeviceID P# S# B# IOB IOL MemBase MemLimit PreBase PreLimit Ctrl\n");
for (i = 0; i < NumBridges; i++) {
- info = (PCIDeviceInfo*)&PCI[BridgeIndex[i]];
- printf("%04X:%04X %02X %02X %02X %04X %04X %08X %08X %08X %08X %04X\n",
- info->VendorID,
- info->DeviceID,
- info->u.type1.PrimaryBusNumber,
- info->u.type1.SecondayBusNumber,
- info->u.type1.SubordinateBusNumber,
- ((u16)info->u.type1.IOBase << 8) & 0xF000,
- info->u.type1.IOLimit ?
- ((u16)info->u.type1.IOLimit << 8) | 0xFFF : 0,
- ((u32)info->u.type1.MemoryBase << 16) & 0xFFF00000,
- info->u.type1.MemoryLimit ?
- ((u32)info->u.type1.MemoryLimit << 16) | 0xFFFFF : 0,
- ((u32)info->u.type1.PrefetchableMemoryBase << 16) & 0xFFF00000,
- info->u.type1.PrefetchableMemoryLimit ?
- ((u32)info->u.type1.PrefetchableMemoryLimit << 16) | 0xFFFFF : 0,
- info->u.type1.BridgeControl);
- }
+ info = (PCIDeviceInfo*)&PCI[BridgeIndex[i]];
+ printf("%04X:%04X %02X %02X %02X %04X %04X %08X %08X %08X %08X %04X\n",
+ info->VendorID,
+ info->DeviceID,
+ info->u.type1.PrimaryBusNumber,
+ info->u.type1.SecondayBusNumber,
+ info->u.type1.SubordinateBusNumber,
+ ((u16)info->u.type1.IOBase << 8) & 0xF000,
+ info->u.type1.IOLimit ?
+ ((u16)info->u.type1.IOLimit << 8) | 0xFFF : 0,
+ ((u32)info->u.type1.MemoryBase << 16) & 0xFFF00000,
+ info->u.type1.MemoryLimit ?
+ ((u32)info->u.type1.MemoryLimit << 16) | 0xFFFFF : 0,
+ ((u32)info->u.type1.PrefetchableMemoryBase << 16) & 0xFFF00000,
+ info->u.type1.PrefetchableMemoryLimit ?
+ ((u32)info->u.type1.PrefetchableMemoryLimit << 16) | 0xFFFFF : 0,
+ info->u.type1.BridgeControl);
+ }
printf("\n");
}
@@ -191,63 +191,63 @@ static int PCI_enumerateDevices(void)
int i,j;
PCIDeviceInfo *info;
- // If this is the first time we have been called, enumerate all
- // devices on the PCI bus.
+ /* If this is the first time we have been called, enumerate all */
+ /* devices on the PCI bus. */
if (NumPCI == -1) {
- if ((NumPCI = PCI_getNumDevices()) == 0)
- return -1;
- PCI = malloc(NumPCI * sizeof(PCI[0]));
- BridgeIndex = malloc(NumPCI * sizeof(BridgeIndex[0]));
- DeviceIndex = malloc(NumPCI * sizeof(DeviceIndex[0]));
- if (!PCI || !BridgeIndex || !DeviceIndex)
- return -1;
- for (i = 0; i < NumPCI; i++)
- PCI[i].dwSize = sizeof(PCI[i]);
- if (PCI_enumerate(PCI) == 0)
- return -1;
+ if ((NumPCI = PCI_getNumDevices()) == 0)
+ return -1;
+ PCI = malloc(NumPCI * sizeof(PCI[0]));
+ BridgeIndex = malloc(NumPCI * sizeof(BridgeIndex[0]));
+ DeviceIndex = malloc(NumPCI * sizeof(DeviceIndex[0]));
+ if (!PCI || !BridgeIndex || !DeviceIndex)
+ return -1;
+ for (i = 0; i < NumPCI; i++)
+ PCI[i].dwSize = sizeof(PCI[i]);
+ if (PCI_enumerate(PCI) == 0)
+ return -1;
- // Build a list of all PCI bridge devices
- for (i = 0,NumBridges = 0,BridgeIndex[0] = -1; i < NumPCI; i++) {
- if (PCI[i].BaseClass == PCI_BRIDGE_CLASS)
- BridgeIndex[NumBridges++] = i;
- }
+ /* Build a list of all PCI bridge devices */
+ for (i = 0,NumBridges = 0,BridgeIndex[0] = -1; i < NumPCI; i++) {
+ if (PCI[i].BaseClass == PCI_BRIDGE_CLASS)
+ BridgeIndex[NumBridges++] = i;
+ }
- // Now build a list of all display class devices
- for (i = 0,NumDevices = 1,DeviceIndex[0] = -1; i < NumPCI; i++) {
- if (PCI_IS_DISPLAY_CLASS(&PCI[i])) {
- if ((PCI[i].Command & 0x3) == 0x3)
- DeviceIndex[0] = i;
- else
- DeviceIndex[NumDevices++] = i;
- if (PCI[i].slot.p.Bus != 0) {
- // This device is on a different bus than the primary
- // PCI bus, so it is probably an AGP device. Find the
- // AGP bus device that controls that bus so we can
- // control it.
- for (j = 0; j < NumBridges; j++) {
- info = (PCIDeviceInfo*)&PCI[BridgeIndex[j]];
- if (info->u.type1.SecondayBusNumber == PCI[i].slot.p.Bus) {
- AGPBridge = info;
- break;
- }
- }
- }
- }
- }
+ /* Now build a list of all display class devices */
+ for (i = 0,NumDevices = 1,DeviceIndex[0] = -1; i < NumPCI; i++) {
+ if (PCI_IS_DISPLAY_CLASS(&PCI[i])) {
+ if ((PCI[i].Command & 0x3) == 0x3)
+ DeviceIndex[0] = i;
+ else
+ DeviceIndex[NumDevices++] = i;
+ if (PCI[i].slot.p.Bus != 0) {
+ /* This device is on a different bus than the primary */
+ /* PCI bus, so it is probably an AGP device. Find the */
+ /* AGP bus device that controls that bus so we can */
+ /* control it. */
+ for (j = 0; j < NumBridges; j++) {
+ info = (PCIDeviceInfo*)&PCI[BridgeIndex[j]];
+ if (info->u.type1.SecondayBusNumber == PCI[i].slot.p.Bus) {
+ AGPBridge = info;
+ break;
+ }
+ }
+ }
+ }
+ }
- // Enumerate all PCI and bridge devices to standard output
- EnumeratePCI();
- }
+ /* Enumerate all PCI and bridge devices to standard output */
+ EnumeratePCI();
+ }
return NumDevices;
}
int main(void)
{
- // Enumerate all PCI devices
+ /* Enumerate all PCI devices */
PM_init();
if (PCI_enumerateDevices() < 1) {
- printf("No PCI display devices found!\n");
- return -1;
- }
+ printf("No PCI display devices found!\n");
+ return -1;
+ }
return 0;
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/tick.c b/board/MAI/bios_emulator/scitech/src/pm/tests/tick.c
index ee1014fb9f..378725ebe6 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/tests/tick.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/tests/tick.c
@@ -54,16 +54,16 @@ int main(void)
printf("Program running in ");
switch (PM_getModeType()) {
- case PM_realMode:
- printf("real mode.\n\n");
- break;
- case PM_286:
- printf("16 bit protected mode.\n\n");
- break;
- case PM_386:
- printf("32 bit protected mode.\n\n");
- break;
- }
+ case PM_realMode:
+ printf("real mode.\n\n");
+ break;
+ case PM_286:
+ printf("16 bit protected mode.\n\n");
+ break;
+ case PM_386:
+ printf("32 bit protected mode.\n\n");
+ break;
+ }
/* Install our timer handler and lock handler pages in memory. It is
* difficult to get the size of a function in C, but we know our
@@ -77,13 +77,13 @@ int main(void)
printf("Timer interrupt handler installed - Hit ESC to exit\n");
oldCount = count;
while (1) {
- if (PM_kbhit() && (PM_getch() == 0x1B))
- break;
- if (count != oldCount) {
- printf("Tick, Tock: %ld\n", count);
- oldCount = count;
- }
- }
+ if (PM_kbhit() && (PM_getch() == 0x1B))
+ break;
+ if (count != oldCount) {
+ printf("Tick, Tock: %ld\n", count);
+ oldCount = count;
+ }
+ }
PM_restoreTimerHandler();
PM_restoreBreakHandler();
diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/timerc.c b/board/MAI/bios_emulator/scitech/src/pm/tests/timerc.c
index 55e95a85d6..7fa77b77b8 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/tests/timerc.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/tests/timerc.c
@@ -69,8 +69,8 @@ int main(void)
LZTimerOn();
for (j = 0; j < 10; j++)
- for (i = 0; i < 20000; i++)
- i = i;
+ for (i = 0; i < 20000; i++)
+ i = i;
LZTimerOff();
ReportTime(LZTimerCount());
@@ -80,7 +80,7 @@ int main(void)
delay(DELAY_SECS * 1000);
finish = ULZReadTime();
printf("Delay of %d secs took %d 1/10ths of a second\n",
- DELAY_SECS,ULZElapsedTime(start,finish));
+ DELAY_SECS,ULZElapsedTime(start,finish));
#endif
return 0;
diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/uswc.c b/board/MAI/bios_emulator/scitech/src/pm/tests/uswc.c
index 0892e25f3a..f0c7bd6311 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/tests/uswc.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/tests/uswc.c
@@ -66,50 +66,50 @@ static int PCI_enumerateDevices(void)
int i,j;
PCIDeviceInfo *info;
- // If this is the first time we have been called, enumerate all
- // devices on the PCI bus.
+ /* If this is the first time we have been called, enumerate all */
+ /* devices on the PCI bus. */
if (NumPCI == -1) {
- if ((NumPCI = PCI_getNumDevices()) == 0)
- return -1;
- PCI = malloc(NumPCI * sizeof(PCI[0]));
- BridgeIndex = malloc(NumPCI * sizeof(BridgeIndex[0]));
- DeviceIndex = malloc(NumPCI * sizeof(DeviceIndex[0]));
- if (!PCI || !BridgeIndex || !DeviceIndex)
- return -1;
- for (i = 0; i < NumPCI; i++)
- PCI[i].dwSize = sizeof(PCI[i]);
- if (PCI_enumerate(PCI) == 0)
- return -1;
+ if ((NumPCI = PCI_getNumDevices()) == 0)
+ return -1;
+ PCI = malloc(NumPCI * sizeof(PCI[0]));
+ BridgeIndex = malloc(NumPCI * sizeof(BridgeIndex[0]));
+ DeviceIndex = malloc(NumPCI * sizeof(DeviceIndex[0]));
+ if (!PCI || !BridgeIndex || !DeviceIndex)
+ return -1;
+ for (i = 0; i < NumPCI; i++)
+ PCI[i].dwSize = sizeof(PCI[i]);
+ if (PCI_enumerate(PCI) == 0)
+ return -1;
- // Build a list of all PCI bridge devices
- for (i = 0,NumBridges = 0,BridgeIndex[0] = -1; i < NumPCI; i++) {
- if (PCI[i].BaseClass == PCI_BRIDGE_CLASS)
- BridgeIndex[NumBridges++] = i;
- }
+ /* Build a list of all PCI bridge devices */
+ for (i = 0,NumBridges = 0,BridgeIndex[0] = -1; i < NumPCI; i++) {
+ if (PCI[i].BaseClass == PCI_BRIDGE_CLASS)
+ BridgeIndex[NumBridges++] = i;
+ }
- // Now build a list of all display class devices
- for (i = 0,NumDevices = 1,DeviceIndex[0] = -1; i < NumPCI; i++) {
- if (PCI_IS_DISPLAY_CLASS(&PCI[i])) {
- if ((PCI[i].Command & 0x3) == 0x3)
- DeviceIndex[0] = i;
- else
- DeviceIndex[NumDevices++] = i;
- if (PCI[i].slot.p.Bus != 0) {
- // This device is on a different bus than the primary
- // PCI bus, so it is probably an AGP device. Find the
- // AGP bus device that controls that bus so we can
- // control it.
- for (j = 0; j < NumBridges; j++) {
- info = (PCIDeviceInfo*)&PCI[BridgeIndex[j]];
- if (info->u.type1.SecondayBusNumber == PCI[i].slot.p.Bus) {
- AGPBridge = info;
- break;
- }
- }
- }
- }
- }
- }
+ /* Now build a list of all display class devices */
+ for (i = 0,NumDevices = 1,DeviceIndex[0] = -1; i < NumPCI; i++) {
+ if (PCI_IS_DISPLAY_CLASS(&PCI[i])) {
+ if ((PCI[i].Command & 0x3) == 0x3)
+ DeviceIndex[0] = i;
+ else
+ DeviceIndex[NumDevices++] = i;
+ if (PCI[i].slot.p.Bus != 0) {
+ /* This device is on a different bus than the primary */
+ /* PCI bus, so it is probably an AGP device. Find the */
+ /* AGP bus device that controls that bus so we can */
+ /* control it. */
+ for (j = 0; j < NumBridges; j++) {
+ info = (PCIDeviceInfo*)&PCI[BridgeIndex[j]];
+ if (info->u.type1.SecondayBusNumber == PCI[i].slot.p.Bus) {
+ AGPBridge = info;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
return NumDevices;
}
@@ -125,17 +125,17 @@ static void ShowDisplayDevices(void)
printf("\n");
printf("DeviceID SubSystem Base10h (length ) Base14h (length )\n");
for (index = 0; index < NumDevices; index++) {
- i = DeviceIndex[index];
- printf("%04X:%04X %04X:%04X %08lX (%6ld KB) %08lX (%6ld KB)\n",
- PCI[i].VendorID,
- PCI[i].DeviceID,
- PCI[i].u.type0.SubSystemVendorID,
- PCI[i].u.type0.SubSystemID,
- PCI[i].u.type0.BaseAddress10,
- PCI[i].u.type0.BaseAddress10Len / 1024,
- PCI[i].u.type0.BaseAddress14,
- PCI[i].u.type0.BaseAddress14Len / 1024);
- }
+ i = DeviceIndex[index];
+ printf("%04X:%04X %04X:%04X %08lX (%6ld KB) %08lX (%6ld KB)\n",
+ PCI[i].VendorID,
+ PCI[i].DeviceID,
+ PCI[i].u.type0.SubSystemVendorID,
+ PCI[i].u.type0.SubSystemID,
+ PCI[i].u.type0.BaseAddress10,
+ PCI[i].u.type0.BaseAddress10Len / 1024,
+ PCI[i].u.type0.BaseAddress14,
+ PCI[i].u.type0.BaseAddress14Len / 1024);
+ }
printf("\n");
}
@@ -147,16 +147,16 @@ static char *DecodeWCType(
uint type)
{
static char *names[] = {
- "UNCACHABLE",
- "WRCOMB",
- "UNKNOWN",
- "UNKNOWN",
- "WRTHROUGH",
- "WRPROT",
- "WRBACK",
- };
+ "UNCACHABLE",
+ "WRCOMB",
+ "UNKNOWN",
+ "UNKNOWN",
+ "WRTHROUGH",
+ "WRPROT",
+ "WRBACK",
+ };
if (type <= PM_MTRR_MAX)
- return names[type];
+ return names[type];
return "UNKNOWN";
}
@@ -183,42 +183,42 @@ static void LogMTRRError(
int err)
{
if (err == PM_MTRR_ERR_OK)
- return;
+ return;
switch (err) {
- case PM_MTRR_NOT_SUPPORTED:
- printf("Failed: MTRR is not supported by host CPU\n");
- break;
- case PM_MTRR_ERR_PARAMS:
- printf("Failed: Invalid parameters passed to PM_enableWriteCombined!\n");
- break;
- case PM_MTRR_ERR_NOT_4KB_ALIGNED:
- printf("Failed: Address is not 4Kb aligned!\n");
- break;
- case PM_MTRR_ERR_BELOW_1MB:
- printf("Failed: Addresses below 1Mb cannot be write combined!\n");
- break;
- case PM_MTRR_ERR_NOT_ALIGNED:
- printf("Failed: Address is not correctly aligned for processor!\n");
- break;
- case PM_MTRR_ERR_OVERLAP:
- printf("Failed: Address overlaps an existing region!\n");
- break;
- case PM_MTRR_ERR_TYPE_MISMATCH:
- printf("Failed: Adress is contained with existing region, but type is different!\n");
- break;
- case PM_MTRR_ERR_NONE_FREE:
- printf("Failed: Out of MTRR registers!\n");
- break;
- case PM_MTRR_ERR_NOWRCOMB:
- printf("Failed: This processor does not support write combining!\n");
- break;
- case PM_MTRR_ERR_NO_OS_SUPPORT:
- printf("Failed: MTRR is not supported by host OS\n");
- break;
- default:
- printf("Failed: UNKNOWN ERROR!\n");
- break;
- }
+ case PM_MTRR_NOT_SUPPORTED:
+ printf("Failed: MTRR is not supported by host CPU\n");
+ break;
+ case PM_MTRR_ERR_PARAMS:
+ printf("Failed: Invalid parameters passed to PM_enableWriteCombined!\n");
+ break;
+ case PM_MTRR_ERR_NOT_4KB_ALIGNED:
+ printf("Failed: Address is not 4Kb aligned!\n");
+ break;
+ case PM_MTRR_ERR_BELOW_1MB:
+ printf("Failed: Addresses below 1Mb cannot be write combined!\n");
+ break;
+ case PM_MTRR_ERR_NOT_ALIGNED:
+ printf("Failed: Address is not correctly aligned for processor!\n");
+ break;
+ case PM_MTRR_ERR_OVERLAP:
+ printf("Failed: Address overlaps an existing region!\n");
+ break;
+ case PM_MTRR_ERR_TYPE_MISMATCH:
+ printf("Failed: Adress is contained with existing region, but type is different!\n");
+ break;
+ case PM_MTRR_ERR_NONE_FREE:
+ printf("Failed: Out of MTRR registers!\n");
+ break;
+ case PM_MTRR_ERR_NOWRCOMB:
+ printf("Failed: This processor does not support write combining!\n");
+ break;
+ case PM_MTRR_ERR_NO_OS_SUPPORT:
+ printf("Failed: MTRR is not supported by host OS\n");
+ break;
+ default:
+ printf("Failed: UNKNOWN ERROR!\n");
+ break;
+ }
exit(-1);
}
@@ -242,20 +242,20 @@ static void EnableWriteCombine(void)
int i,index;
for (index = 0; index < NumDevices; index++) {
- i = DeviceIndex[index];
- if (PCI[i].u.type0.BaseAddress10 & 0x8) {
- LogMTRRError(PM_enableWriteCombine(
- PCI[i].u.type0.BaseAddress10 & 0xFFFFFFF0,
- PCI[i].u.type0.BaseAddress10Len,
- PM_MTRR_WRCOMB));
- }
- if (PCI[i].u.type0.BaseAddress14 & 0x8) {
- LogMTRRError(PM_enableWriteCombine(
- PCI[i].u.type0.BaseAddress14 & 0xFFFFFFF0,
- PCI[i].u.type0.BaseAddress14Len,
- PM_MTRR_WRCOMB));
- }
- }
+ i = DeviceIndex[index];
+ if (PCI[i].u.type0.BaseAddress10 & 0x8) {
+ LogMTRRError(PM_enableWriteCombine(
+ PCI[i].u.type0.BaseAddress10 & 0xFFFFFFF0,
+ PCI[i].u.type0.BaseAddress10Len,
+ PM_MTRR_WRCOMB));
+ }
+ if (PCI[i].u.type0.BaseAddress14 & 0x8) {
+ LogMTRRError(PM_enableWriteCombine(
+ PCI[i].u.type0.BaseAddress14 & 0xFFFFFFF0,
+ PCI[i].u.type0.BaseAddress14Len,
+ PM_MTRR_WRCOMB));
+ }
+ }
printf("\n");
ShowDisplayDevices();
ShowWriteCombine();
@@ -270,20 +270,20 @@ static void DisableWriteCombine(void)
int i,index;
for (index = 0; index < NumDevices; index++) {
- i = DeviceIndex[index];
- if (PCI[i].u.type0.BaseAddress10 & 0x8) {
- LogMTRRError(PM_enableWriteCombine(
- PCI[i].u.type0.BaseAddress10 & 0xFFFFFFF0,
- PCI[i].u.type0.BaseAddress10Len,
- PM_MTRR_UNCACHABLE));
- }
- if (PCI[i].u.type0.BaseAddress14 & 0x8) {
- LogMTRRError(PM_enableWriteCombine(
- PCI[i].u.type0.BaseAddress14 & 0xFFFFFFF0,
- PCI[i].u.type0.BaseAddress14Len,
- PM_MTRR_UNCACHABLE));
- }
- }
+ i = DeviceIndex[index];
+ if (PCI[i].u.type0.BaseAddress10 & 0x8) {
+ LogMTRRError(PM_enableWriteCombine(
+ PCI[i].u.type0.BaseAddress10 & 0xFFFFFFF0,
+ PCI[i].u.type0.BaseAddress10Len,
+ PM_MTRR_UNCACHABLE));
+ }
+ if (PCI[i].u.type0.BaseAddress14 & 0x8) {
+ LogMTRRError(PM_enableWriteCombine(
+ PCI[i].u.type0.BaseAddress14 & 0xFFFFFFF0,
+ PCI[i].u.type0.BaseAddress14Len,
+ PM_MTRR_UNCACHABLE));
+ }
+ }
printf("\n");
ShowDisplayDevices();
ShowWriteCombine();
@@ -293,19 +293,19 @@ int main(int argc,char *argv[])
{
PM_init();
if (PCI_enumerateDevices() < 1) {
- printf("No PCI display devices found!\n");
- return -1;
- }
+ printf("No PCI display devices found!\n");
+ return -1;
+ }
if (argc < 2) {
- printf("usage: uswc [-show -on -off]\n\n");
- ShowDisplayDevices();
- return -1;
- }
+ printf("usage: uswc [-show -on -off]\n\n");
+ ShowDisplayDevices();
+ return -1;
+ }
if (stricmp(argv[1],"-show") == 0)
- ShowWriteCombine();
+ ShowWriteCombine();
else if (stricmp(argv[1],"-on") == 0)
- EnableWriteCombine();
+ EnableWriteCombine();
else if (stricmp(argv[1],"-off") == 0)
- DisableWriteCombine();
+ DisableWriteCombine();
return 0;
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/vftest.c b/board/MAI/bios_emulator/scitech/src/pm/tests/vftest.c
index 633a76d2b7..b7e3bb7846 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/tests/vftest.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/tests/vftest.c
@@ -51,27 +51,27 @@ int main(void)
printf("Program running in ");
switch (PM_getModeType()) {
- case PM_realMode:
- printf("real mode.\n\n");
- break;
- case PM_286:
- printf("16 bit protected mode.\n\n");
- break;
- case PM_386:
- printf("32 bit protected mode.\n\n");
- break;
- }
+ case PM_realMode:
+ printf("real mode.\n\n");
+ break;
+ case PM_286:
+ printf("16 bit protected mode.\n\n");
+ break;
+ case PM_386:
+ printf("32 bit protected mode.\n\n");
+ break;
+ }
if (!VF_available()) {
- printf("Virtual Linear Framebuffer not available.\n");
- exit(1);
- }
+ printf("Virtual Linear Framebuffer not available.\n");
+ exit(1);
+ }
vfBuffer = VF_init(0xA0000,64,sizeof(code),code);
if (!vfBuffer) {
- printf("Failure to initialise Virtual Linear Framebuffer!\n");
- exit(1);
- }
+ printf("Failure to initialise Virtual Linear Framebuffer!\n");
+ exit(1);
+ }
VF_exit();
printf("Virtual Linear Framebuffer set up successfully!\n");
return 0;
diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/video.c b/board/MAI/bios_emulator/scitech/src/pm/tests/video.c
index 7f6f67f67e..92adcddd49 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/tests/video.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/tests/video.c
@@ -90,12 +90,12 @@ void fill(int startx, int starty, int endx, int endy, unsigned char c,
int x,y;
for (y = starty; y <= endy; y++) {
- v = SCREEN(startx,y);
- for (x = startx; x <= endx; x++) {
- *v++ = c;
- *v++ = attr;
- }
- }
+ v = SCREEN(startx,y);
+ for (x = startx; x <= endx; x++) {
+ *v++ = c;
+ *v++ = attr;
+ }
+ }
}
/* Routine to display a single character using direct video writes */
@@ -124,18 +124,18 @@ void border(int startx, int starty, int endx, int endy, unsigned char attr)
b = border_chars;
for (i = starty+1; i < endy; i++) {
- writeChar(startx, i, *b, attr);
- writeChar(endx, i, *b, attr);
- }
+ writeChar(startx, i, *b, attr);
+ writeChar(endx, i, *b, attr);
+ }
b++;
for (i = startx+1, v = SCREEN(startx+1, starty); i < endx; i++) {
- *v++ = *b;
- *v++ = attr;
- }
+ *v++ = *b;
+ *v++ = attr;
+ }
for (i = startx+1, v = SCREEN(startx+1, endy); i < endx; i++) {
- *v++ = *b;
- *v++ = attr;
- }
+ *v++ = *b;
+ *v++ = attr;
+ }
b++;
writeChar(startx, starty, *b++, attr);
writeChar(endx, starty, *b++, attr);
@@ -150,16 +150,16 @@ int main(void)
printf("Program running in ");
switch (PM_getModeType()) {
- case PM_realMode:
- printf("real mode.\n\n");
- break;
- case PM_286:
- printf("16 bit protected mode.\n\n");
- break;
- case PM_386:
- printf("32 bit protected mode.\n\n");
- break;
- }
+ case PM_realMode:
+ printf("real mode.\n\n");
+ break;
+ case PM_286:
+ printf("16 bit protected mode.\n\n");
+ break;
+ case PM_386:
+ printf("32 bit protected mode.\n\n");
+ break;
+ }
hwndConsole = PM_openConsole(0,0,0,0,0,true);
printf("Hit any key to start 80x25 text mode and perform some direct video output.\n");
@@ -167,17 +167,17 @@ int main(void)
/* Allocate a buffer to save console state and save the state */
if ((stateBuf = PM_malloc(PM_getConsoleStateSize())) == NULL) {
- printf("Unable to allocate console state buffer!\n");
- exit(1);
- }
+ printf("Unable to allocate console state buffer!\n");
+ exit(1);
+ }
PM_saveConsoleState(stateBuf,0);
bios = PM_getBIOSPointer();
orgMode = getVideoMode();
setVideoMode(0x3);
if ((videoPtr = PM_mapPhysicalAddr(0xB8000,0xFFFF,true)) == NULL) {
- printf("Unable to obtain pointer to framebuffer!\n");
- exit(1);
- }
+ printf("Unable to obtain pointer to framebuffer!\n");
+ exit(1);
+ }
/* Draw some text on the screen */
fill(0, 0, 79, 24, 176, 0x1E);
@@ -197,4 +197,3 @@ int main(void)
printf("Video Memory = %08X\n", (int)videoPtr);
return 0;
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/vdd/fileio.c b/board/MAI/bios_emulator/scitech/src/pm/vdd/fileio.c
index dbbaf37dfa..93742de914 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/vdd/fileio.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/vdd/fileio.c
@@ -63,54 +63,54 @@ FILE * fopen(
ULONG omode, oflags;
if (f != NULL) {
- f->offset = 0;
- f->text = (mode[1] == 't' || mode[2] == 't');
- f->writemode = (mode[0] == 'w') || (mode[0] == 'a');
- f->unputc = EOF;
- f->endp = f->buf + sizeof(f->buf);
- f->curp = f->startp = f->buf;
+ f->offset = 0;
+ f->text = (mode[1] == 't' || mode[2] == 't');
+ f->writemode = (mode[0] == 'w') || (mode[0] == 'a');
+ f->unputc = EOF;
+ f->endp = f->buf + sizeof(f->buf);
+ f->curp = f->startp = f->buf;
- if (mode[0] == 'r') {
- #ifdef __OS2_VDD__
- omode = VDHOPEN_ACCESS_READONLY | VDHOPEN_SHARE_DENYNONE;
- oflags = VDHOPEN_ACTION_OPEN_IF_EXISTS | VDHOPEN_ACTION_FAIL_IF_NEW;
- #else
- omode = OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE;
- oflags = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW;
- #endif
- }
- else if (mode[0] == 'w') {
- #ifdef __OS2_VDD__
- omode = VDHOPEN_ACCESS_WRITEONLY | VDHOPEN_SHARE_DENYWRITE;
- oflags = VDHOPEN_ACTION_REPLACE_IF_EXISTS | VDHOPEN_ACTION_CREATE_IF_NEW;
- #else
- omode = OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYWRITE;
- oflags = OPEN_ACTION_REPLACE_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
- #endif
- }
- else {
- #ifdef __OS2_VDD__
- omode = VDHOPEN_ACCESS_READWRITE | VDHOPEN_SHARE_DENYWRITE;
- oflags = VDHOPEN_ACTION_OPEN_IF_EXISTS | VDHOPEN_ACTION_CREATE_IF_NEW;
- #else
- omode = OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYWRITE;
- oflags = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
- #endif
- }
- rc = _OS2Open((PSZ)filename, (PHFILE)&f->handle, &ulAction, 0, VDHOPEN_FILE_NORMAL, oflags, omode, NULL);
- if (rc != 0) {
- PM_free(f);
- return NULL;
- }
+ if (mode[0] == 'r') {
+ #ifdef __OS2_VDD__
+ omode = VDHOPEN_ACCESS_READONLY | VDHOPEN_SHARE_DENYNONE;
+ oflags = VDHOPEN_ACTION_OPEN_IF_EXISTS | VDHOPEN_ACTION_FAIL_IF_NEW;
+ #else
+ omode = OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE;
+ oflags = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW;
+ #endif
+ }
+ else if (mode[0] == 'w') {
+ #ifdef __OS2_VDD__
+ omode = VDHOPEN_ACCESS_WRITEONLY | VDHOPEN_SHARE_DENYWRITE;
+ oflags = VDHOPEN_ACTION_REPLACE_IF_EXISTS | VDHOPEN_ACTION_CREATE_IF_NEW;
+ #else
+ omode = OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYWRITE;
+ oflags = OPEN_ACTION_REPLACE_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
+ #endif
+ }
+ else {
+ #ifdef __OS2_VDD__
+ omode = VDHOPEN_ACCESS_READWRITE | VDHOPEN_SHARE_DENYWRITE;
+ oflags = VDHOPEN_ACTION_OPEN_IF_EXISTS | VDHOPEN_ACTION_CREATE_IF_NEW;
+ #else
+ omode = OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYWRITE;
+ oflags = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
+ #endif
+ }
+ rc = _OS2Open((PSZ)filename, (PHFILE)&f->handle, &ulAction, 0, VDHOPEN_FILE_NORMAL, oflags, omode, NULL);
+ if (rc != 0) {
+ PM_free(f);
+ return NULL;
+ }
- #ifdef __OS2_VDD__
- f->filesize = VDHSeek((HFILE)f->handle, 0, VDHSK_END_OF_FILE);
- #else
- rc = DosSetFilePtr((HFILE)f->handle, 0, FILE_END, &f->filesize);
- #endif
+ #ifdef __OS2_VDD__
+ f->filesize = VDHSeek((HFILE)f->handle, 0, VDHSK_END_OF_FILE);
+ #else
+ rc = DosSetFilePtr((HFILE)f->handle, 0, FILE_END, &f->filesize);
+ #endif
- if (mode[0] == 'a')
- fseek(f,0,2);
+ if (mode[0] == 'a')
+ fseek(f,0,2);
}
return f;
}
@@ -131,23 +131,23 @@ size_t fread(
/* First copy any data already read into our buffer */
if ((bytes = (f->curp - f->startp)) > 0) {
- memcpy(buf,f->curp,bytes);
- f->startp = f->curp = f->buf;
- buf += bytes;
- totalbytes += bytes;
- bytes = (size * n) - bytes;
- }
+ memcpy(buf,f->curp,bytes);
+ f->startp = f->curp = f->buf;
+ buf += bytes;
+ totalbytes += bytes;
+ bytes = (size * n) - bytes;
+ }
else
- bytes = size * n;
+ bytes = size * n;
if (bytes) {
- #ifdef __OS2_VDD__
- readbytes = VDHRead((HFILE)f->handle, buf, bytes);
- #else
- DosRead((HFILE)f->handle, buf, bytes, &readbytes);
- #endif
- totalbytes += readbytes;
- f->offset += readbytes;
- }
+ #ifdef __OS2_VDD__
+ readbytes = VDHRead((HFILE)f->handle, buf, bytes);
+ #else
+ DosRead((HFILE)f->handle, buf, bytes, &readbytes);
+ #endif
+ totalbytes += readbytes;
+ f->offset += readbytes;
+ }
return totalbytes / size;
}
@@ -166,7 +166,7 @@ size_t fwrite(
/* Flush anything already in the buffer */
if (!f->writemode)
- return 0;
+ return 0;
fflush(f);
bytes = size * n;
#ifdef __OS2_VDD__
@@ -177,7 +177,7 @@ size_t fwrite(
totalbytes += writtenbytes;
f->offset += writtenbytes;
if (f->offset > f->filesize)
- f->filesize = f->offset;
+ f->filesize = f->offset;
return totalbytes / size;
}
@@ -192,16 +192,16 @@ int fflush(
/* First copy any data already written into our buffer */
if (f->writemode && (bytes = (f->curp - f->startp)) > 0) {
- #ifdef __OS2_VDD__
- bytes = VDHWrite((HFILE)f->handle, f->startp, bytes);
- #else
- DosWrite((HFILE)f->handle, f->startp, bytes, &bytes);
- #endif
- f->offset += bytes;
- if (f->offset > f->filesize)
- f->filesize = f->offset;
- f->startp = f->curp = f->buf;
- }
+ #ifdef __OS2_VDD__
+ bytes = VDHWrite((HFILE)f->handle, f->startp, bytes);
+ #else
+ DosWrite((HFILE)f->handle, f->startp, bytes, &bytes);
+ #endif
+ f->offset += bytes;
+ if (f->offset > f->filesize)
+ f->filesize = f->offset;
+ f->startp = f->curp = f->buf;
+ }
return 0;
}
@@ -217,11 +217,11 @@ int fseek(
fflush(f);
if (whence == 0)
- f->offset = offset;
+ f->offset = offset;
else if (whence == 1)
- f->offset += offset;
+ f->offset += offset;
else if (whence == 2)
- f->offset = f->filesize + offset;
+ f->offset = f->filesize + offset;
#ifdef __OS2_VDD__
VDHSeek((HFILE)f->handle, f->offset, VDHSK_ABSOLUTE);
@@ -267,23 +267,23 @@ static int __getc(
int c;
if (f->unputc != EOF) {
- c = f->unputc;
- f->unputc = EOF;
- }
+ c = f->unputc;
+ f->unputc = EOF;
+ }
else {
- if (f->startp == f->curp) {
- int bytes = fread(f->buf,1,sizeof(f->buf),f);
- if (bytes == 0)
- return EOF;
- f->curp = f->startp + bytes;
- }
- c = *f->startp++;
- if (f->text && c == '\r') {
- int nc = __getc(f);
- if (nc != '\n')
- f->unputc = nc;
- }
- }
+ if (f->startp == f->curp) {
+ int bytes = fread(f->buf,1,sizeof(f->buf),f);
+ if (bytes == 0)
+ return EOF;
+ f->curp = f->startp + bytes;
+ }
+ c = *f->startp++;
+ if (f->text && c == '\r') {
+ int nc = __getc(f);
+ if (nc != '\n')
+ f->unputc = nc;
+ }
+ }
return c;
}
@@ -296,11 +296,11 @@ static int __putc(int c,FILE *f)
{
int count = 1;
if (f->text && c == '\n') {
- __putc('\r',f);
- count = 2;
- }
+ __putc('\r',f);
+ count = 2;
+ }
if (f->curp == f->endp)
- fflush(f);
+ fflush(f);
*f->curp++ = c;
return count;
}
@@ -319,12 +319,12 @@ char *fgets(
cs = s;
while (--n > 0 && (c = __getc(f)) != EOF) {
- *cs++ = c;
- if (c == '\n')
- break;
- }
+ *cs++ = c;
+ if (c == '\n')
+ break;
+ }
if (c == EOF && cs == s)
- return NULL;
+ return NULL;
*cs = '\0';
return s;
}
@@ -341,7 +341,7 @@ int fputs(
int c;
while ((c = *s++) != 0)
- r = __putc(c, f);
+ r = __putc(c, f);
return r;
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/vdd/pm.c b/board/MAI/bios_emulator/scitech/src/pm/vdd/pm.c
index 32177f810d..6688babd0d 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/vdd/pm.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/vdd/pm.c
@@ -44,7 +44,7 @@
#define MAX_MEMORY_SHARED 100
#define MAX_MEMORY_MAPPINGS 100
-// TODO: I think the global and linear members will be the same, but not sure yet.
+/* TODO: I think the global and linear members will be the same, but not sure yet. */
typedef struct {
void *linear;
ulong global;
@@ -90,18 +90,18 @@ void PMAPI PM_init(void)
{
MTRR_init();
- // Initialize VDD-specific data
- // Note: PM_init must be (obviously) called in VDM task context!
+ /* Initialize VDD-specific data */
+ /* Note: PM_init must be (obviously) called in VDM task context! */
VDHCreateSem(&hevFarCallRet, VDH_EVENTSEM);
VDHCreateSem(&hevIRet, VDH_EVENTSEM);
hhookUserReturnHook = VDHAllocHook(VDH_RETURN_HOOK, (PFNARM)UserReturnHook, 0);
hhookUserIRetHook = VDHAllocHook(VDH_RETURN_HOOK, (PFNARM)UserIRetHook, 0);
if ((hevIRet == NULL) || (hevFarCallRet == NULL) ||
- (hhookUserReturnHook == NULL) || (hhookUserIRetHook == NULL)) {
- // something failed, we can't go on
- // TODO: take some action here!
- }
+ (hhookUserReturnHook == NULL) || (hhookUserIRetHook == NULL)) {
+ /* something failed, we can't go on */
+ /* TODO: take some action here! */
+ }
}
/* Do some cleaning up */
@@ -109,17 +109,17 @@ void PMAPI PM_exit(void)
{
/* Note: Hooks allocated during or after VDM creation are deallocated automatically */
if (hevIRet != NULL)
- VDHDestroySem(hevIRet);
+ VDHDestroySem(hevIRet);
if (hevFarCallRet != NULL)
- VDHDestroySem(hevFarCallRet);
+ VDHDestroySem(hevFarCallRet);
}
ibool PMAPI PM_haveBIOSAccess(void)
{ return _PM_haveBIOS; }
long PMAPI PM_getOSType(void)
-{ return /*_OS_OS2VDD*/ _OS_OS2; } //FIX!!
+{ return /*_OS_OS2VDD*/ _OS_OS2; } /*FIX!! */
int PMAPI PM_getModeType(void)
{ return PM_386; }
@@ -128,9 +128,9 @@ void PMAPI PM_backslash(char *s)
{
uint pos = strlen(s);
if (s[pos-1] != '\\') {
- s[pos] = '\\';
- s[pos+1] = '\0';
- }
+ s[pos] = '\\';
+ s[pos+1] = '\0';
+ }
}
void PMAPI PM_setFatalErrorCleanup(
@@ -142,8 +142,8 @@ void PMAPI PM_setFatalErrorCleanup(
void PMAPI PM_fatalError(const char *msg)
{
if (fatalErrorCleanup)
- fatalErrorCleanup();
-// Fatal_Error_Handler(msg,0); TODO: implement somehow!
+ fatalErrorCleanup();
+/* Fatal_Error_Handler(msg,0); TODO: implement somehow! */
}
/****************************************************************************
@@ -162,11 +162,11 @@ void * PMAPI PM_getVESABuf(
uint *roff)
{
if (_PM_rmBufAddr) {
- *len = 0; //VESA_BUF_SIZE;
- *rseg = (ulong)(_PM_rmBufAddr) >> 4;
- *roff = (ulong)(_PM_rmBufAddr) & 0xF;
- return _PM_rmBufAddr;
- }
+ *len = 0; /*VESA_BUF_SIZE; */
+ *rseg = (ulong)(_PM_rmBufAddr) >> 4;
+ *roff = (ulong)(_PM_rmBufAddr) & 0xF;
+ return _PM_rmBufAddr;
+ }
return NULL;
}
@@ -200,12 +200,12 @@ const char * PMAPI PM_getVBEAFPath(void)
const char * PMAPI PM_getNucleusPath(void)
{
- static char path[CCHMAXPATH];
- strcpy(path,"x:\\os2\\drivers");
- path[0] = PM_getBootDrive();
- PM_backslash(path);
- strcat(path,"nucleus");
- return path;
+ static char path[CCHMAXPATH];
+ strcpy(path,"x:\\os2\\drivers");
+ path[0] = PM_getBootDrive();
+ PM_backslash(path);
+ strcat(path,"nucleus");
+ return path;
}
const char * PMAPI PM_getNucleusConfigPath(void)
@@ -292,15 +292,15 @@ void * PMAPI PM_mallocShared(long size)
/* First find a free slot in our shared memory table */
for (i = 0; i < MAX_MEMORY_SHARED; i++) {
- if (shared[i].linear == 0)
- break;
- }
+ if (shared[i].linear == 0)
+ break;
+ }
if (i < MAX_MEMORY_SHARED) {
- shared[i].linear = VDHAllocPages(NULL, nPages, VDHAP_SYSTEM | VDHAP_FIXED);
- shared[i].npages = nPages;
- shared[i].global = (ULONG)shared[i].linear;
- return (void*)shared[i].global;
- }
+ shared[i].linear = VDHAllocPages(NULL, nPages, VDHAP_SYSTEM | VDHAP_FIXED);
+ shared[i].npages = nPages;
+ shared[i].global = (ULONG)shared[i].linear;
+ return (void*)shared[i].global;
+ }
return NULL;
}
@@ -314,12 +314,12 @@ void PMAPI PM_freeShared(void *p)
/* Find a shared memory block in our table and free it */
for (i = 0; i < MAX_MEMORY_SHARED; i++) {
- if (shared[i].global == (ulong)p) {
- VDHFreePages(shared[i].linear);
- shared[i].linear = 0;
- break;
- }
- }
+ if (shared[i].global == (ulong)p) {
+ VDHFreePages(shared[i].linear);
+ shared[i].linear = 0;
+ break;
+ }
+ }
}
void * PMAPI PM_mapToProcess(void *base,ulong limit)
@@ -331,7 +331,7 @@ ibool PMAPI PM_doBIOSPOST(
void *mappedBIOS,
ulong BIOSLen)
{
- // TODO: Figure out how to do this
+ /* TODO: Figure out how to do this */
return false;
}
@@ -364,18 +364,18 @@ ulong MapPhysicalToLinear(
*npages = (length + (base & 0xFFF) + 4095) >> 12;
flags = PR_FIXED | PR_STATIC;
if (base == 0xA0000) {
- /* We require the linear address to be aligned to a 64Kb boundary
- * for mapping the banked framebuffer (so we can do efficient
- * carry checking for bank changes in the assembler code). The only
- * way to ensure this is to force the linear address to be aligned
- * to a 4Mb boundary.
- */
- flags |= PR_4MEG;
- }
+ /* We require the linear address to be aligned to a 64Kb boundary
+ * for mapping the banked framebuffer (so we can do efficient
+ * carry checking for bank changes in the assembler code). The only
+ * way to ensure this is to force the linear address to be aligned
+ * to a 4Mb boundary.
+ */
+ flags |= PR_4MEG;
+ }
if ((linear = (ulong)PageReserve(PR_SYSTEM,*npages,flags)) == (ulong)-1)
- return 0;
+ return 0;
if (!PageCommitPhys(linear >> 12,*npages,ppage,PC_INCR | PC_USER | PC_WRITEABLE))
- return 0;
+ return 0;
#endif
return linear + (base & 0xFFF);
}
@@ -397,9 +397,9 @@ memory below 1Mb, which gets this memory out of the way of the Windows VxD's
sticky paws.
NOTE: If the memory is not expected to be cached, this function will
- directly re-program the PCD (Page Cache Disable) bit in the
- page tables. There does not appear to be a mechanism in the VMM
- to control this bit via the regular interface.
+ directly re-program the PCD (Page Cache Disable) bit in the
+ page tables. There does not appear to be a mechanism in the VMM
+ to control this bit via the regular interface.
****************************************************************************/
void * PMAPI PM_mapPhysicalAddr(
ulong base,
@@ -414,11 +414,11 @@ void * PMAPI PM_mapPhysicalAddr(
* a region of memory that will serve this purpose.
*/
for (i = 0; i < numMappings; i++) {
- if (maps[i].physical == base && maps[i].length == length && maps[i].isCached == isCached)
- return (void*)maps[i].linear;
- }
+ if (maps[i].physical == base && maps[i].length == length && maps[i].isCached == isCached)
+ return (void*)maps[i].linear;
+ }
if (numMappings == MAX_MEMORY_MAPPINGS)
- return NULL;
+ return NULL;
/* We did not find any previously mapped memory region, so map it in.
* Note that we do not use MapPhysToLinear, since this function appears
@@ -426,7 +426,7 @@ void * PMAPI PM_mapPhysicalAddr(
* Hence we use PageReserve and PageCommitPhys.
*/
if ((linear = MapPhysicalToLinear(base,limit,&npages)) == 0)
- return NULL;
+ return NULL;
maps[numMappings].physical = base;
maps[numMappings].length = length;
maps[numMappings].linear = linear;
@@ -437,33 +437,33 @@ void * PMAPI PM_mapPhysicalAddr(
#if 0
/* Finally disable caching where necessary */
if (!isCached && (PDB = _PM_getPDB()) != 0) {
- int startPDB,endPDB,iPDB,startPage,endPage,start,end,iPage;
- ulong pageTable,*pPageTable;
-
- if (PDB >= 0x100000)
- pPDB = (ulong*)MapPhysicalToLinear(PDB,0xFFF,&npages);
- else
- pPDB = (ulong*)PDB;
- if (pPDB) {
- startPDB = (linear >> 22) & 0x3FF;
- startPage = (linear >> 12) & 0x3FF;
- endPDB = ((linear+limit) >> 22) & 0x3FF;
- endPage = ((linear+limit) >> 12) & 0x3FF;
- for (iPDB = startPDB; iPDB <= endPDB; iPDB++) {
- pageTable = pPDB[iPDB] & ~0xFFF;
- if (pageTable >= 0x100000)
- pPageTable = (ulong*)MapPhysicalToLinear(pageTable,0xFFF,&npages);
- else
- pPageTable = (ulong*)pageTable;
- start = (iPDB == startPDB) ? startPage : 0;
- end = (iPDB == endPDB) ? endPage : 0x3FF;
- for (iPage = start; iPage <= end; iPage++)
- pPageTable[iPage] |= 0x10;
- PageFree((ulong)pPageTable,PR_STATIC);
- }
- PageFree((ulong)pPDB,PR_STATIC);
- }
- }
+ int startPDB,endPDB,iPDB,startPage,endPage,start,end,iPage;
+ ulong pageTable,*pPageTable;
+
+ if (PDB >= 0x100000)
+ pPDB = (ulong*)MapPhysicalToLinear(PDB,0xFFF,&npages);
+ else
+ pPDB = (ulong*)PDB;
+ if (pPDB) {
+ startPDB = (linear >> 22) & 0x3FF;
+ startPage = (linear >> 12) & 0x3FF;
+ endPDB = ((linear+limit) >> 22) & 0x3FF;
+ endPage = ((linear+limit) >> 12) & 0x3FF;
+ for (iPDB = startPDB; iPDB <= endPDB; iPDB++) {
+ pageTable = pPDB[iPDB] & ~0xFFF;
+ if (pageTable >= 0x100000)
+ pPageTable = (ulong*)MapPhysicalToLinear(pageTable,0xFFF,&npages);
+ else
+ pPageTable = (ulong*)pageTable;
+ start = (iPDB == startPDB) ? startPage : 0;
+ end = (iPDB == endPDB) ? endPage : 0x3FF;
+ for (iPage = start; iPage <= end; iPage++)
+ pPageTable[iPage] |= 0x10;
+ PageFree((ulong)pPageTable,PR_STATIC);
+ }
+ PageFree((ulong)pPDB,PR_STATIC);
+ }
+ }
#endif
return (void*)linear;
}
@@ -480,39 +480,39 @@ void PMAPI PM_sleep(ulong milliseconds)
int PMAPI PM_getCOMPort(int port)
{
- // TODO: Re-code this to determine real values using the Plug and Play
- // manager for the OS.
+ /* TODO: Re-code this to determine real values using the Plug and Play */
+ /* manager for the OS. */
switch (port) {
- case 0: return 0x3F8;
- case 1: return 0x2F8;
- }
+ case 0: return 0x3F8;
+ case 1: return 0x2F8;
+ }
return 0;
}
int PMAPI PM_getLPTPort(int port)
{
- // TODO: Re-code this to determine real values using the Plug and Play
- // manager for the OS.
+ /* TODO: Re-code this to determine real values using the Plug and Play */
+ /* manager for the OS. */
switch (port) {
- case 0: return 0x3BC;
- case 1: return 0x378;
- case 2: return 0x278;
- }
+ case 0: return 0x3BC;
+ case 1: return 0x378;
+ case 2: return 0x278;
+ }
return 0;
}
ulong PMAPI PM_getPhysicalAddr(void *p)
{
- // TODO: This function should find the physical address of a linear
- // address.
- return 0xFFFFFFFFUL;
+ /* TODO: This function should find the physical address of a linear */
+ /* address. */
+ return 0xFFFFFFFFUL;
}
void PMAPI _PM_freeMemoryMappings(void)
{
int i;
-// for (i = 0; i < numMappings; i++)
-// PageFree(maps[i].linear,PR_STATIC);
+/* for (i = 0; i < numMappings; i++) */
+/* PageFree(maps[i].linear,PR_STATIC); */
}
void * PMAPI PM_mapRealPointer(uint r_seg,uint r_off)
@@ -539,16 +539,16 @@ static void LoadV86Registers(
RMREGS *in,
RMSREGS *sregs)
{
- PCRF pcrf; // current client register frame
+ PCRF pcrf; /* current client register frame */
- // get pointer to registers
+ /* get pointer to registers */
pcrf = (PCRF)VDHQuerySysValue(CURRENT_VDM, VDHLSV_PCRF);
- // Note: We could do VDHPushRegs instead but this should be safer as it
- // doesn't rely on the VDM session having enough free stack space.
- *saveRegs = *pcrf; // save all registers
+ /* Note: We could do VDHPushRegs instead but this should be safer as it */
+ /* doesn't rely on the VDM session having enough free stack space. */
+ *saveRegs = *pcrf; /* save all registers */
- pcrf->crf_eax = in->e.eax; // load new values
+ pcrf->crf_eax = in->e.eax; /* load new values */
pcrf->crf_ebx = in->e.ebx;
pcrf->crf_ecx = in->e.ecx;
pcrf->crf_edx = in->e.edx;
@@ -568,12 +568,12 @@ static void ReadV86Registers(
RMREGS *out,
RMSREGS *sregs)
{
- PCRF pcrf; // current client register frame
+ PCRF pcrf; /* current client register frame */
- // get pointer to registers
+ /* get pointer to registers */
pcrf = (PCRF)VDHQuerySysValue(CURRENT_VDM, VDHLSV_PCRF);
- // read new register values
+ /* read new register values */
out->e.eax = pcrf->crf_eax;
out->e.ebx = pcrf->crf_ebx;
out->e.ecx = pcrf->crf_ecx;
@@ -583,7 +583,7 @@ static void ReadV86Registers(
sregs->es = pcrf->crf_es;
sregs->ds = pcrf->crf_ds;
- // restore original client registers
+ /* restore original client registers */
*pcrf = *saveRegs;
}
@@ -626,18 +626,18 @@ void PMAPI PM_callRealMode(
TRACE("SDDHELP: Entering PM_callRealMode()\n");
LoadV86Registers(SSToDS(&saveRegs),regs,sregs);
- // set up return hook for call
+ /* set up return hook for call */
rc = VDHArmReturnHook(hhookUserReturnHook, VDHARH_CSEIP_HOOK);
VDHResetEventSem(hevFarCallRet);
- // the address is a 16:32 pointer
+ /* the address is a 16:32 pointer */
OFFSETOF32(fnAddress) = off;
SEGMENTOF32(fnAddress) = seg;
rc = VDHPushFarCall(fnAddress);
VDHYield(0);
- // wait until the V86 call returns - our return hook posts the semaphore
+ /* wait until the V86 call returns - our return hook posts the semaphore */
rc = VDHWaitEventSem(hevFarCallRet, SEM_INDEFINITE_WAIT);
ReadV86Registers(SSToDS(&saveRegs),regs,sregs);
@@ -662,13 +662,13 @@ int PMAPI PM_int86(
memset(SSToDS(&sregs), 0, sizeof(sregs));
-#if 0 // do we need this??
+#if 0 /* do we need this?? */
/* Disable pass-up to our VDD handler so we directly call BIOS */
TRACE("SDDHELP: Entering PM_int86()\n");
if (disableTSRFlag) {
- oldDisable = *disableTSRFlag;
- *disableTSRFlag = 0;
- }
+ oldDisable = *disableTSRFlag;
+ *disableTSRFlag = 0;
+ }
#endif
LoadV86Registers(SSToDS(&saveRegs), in, SSToDS(&sregs));
@@ -676,20 +676,20 @@ int PMAPI PM_int86(
VDHResetEventSem(hevIRet);
rc = VDHPushInt(intno);
- // set up return hook for interrupt
+ /* set up return hook for interrupt */
rc = VDHArmReturnHook(hhookUserIRetHook, VDHARH_NORMAL_IRET);
VDHYield(0);
- // wait until the V86 IRETs - our return hook posts the semaphore
- rc = VDHWaitEventSem(hevIRet, 5000); //SEM_INDEFINITE_WAIT);
+ /* wait until the V86 IRETs - our return hook posts the semaphore */
+ rc = VDHWaitEventSem(hevIRet, 5000); /*SEM_INDEFINITE_WAIT); */
ReadV86Registers(SSToDS(&saveRegs), out, SSToDS(&sregs));
#if 0
/* Re-enable pass-up to our VDD handler if previously enabled */
if (disableTSRFlag)
- *disableTSRFlag = oldDisable;
+ *disableTSRFlag = oldDisable;
#endif
TRACE("SDDHELP: Exiting PM_int86()\n");
@@ -716,29 +716,29 @@ int PMAPI PM_int86x(
/* Disable pass-up to our VxD handler so we directly call BIOS */
TRACE("SDDHELP: Entering PM_int86x()\n");
if (disableTSRFlag) {
- oldDisable = *disableTSRFlag;
- *disableTSRFlag = 0;
- }
+ oldDisable = *disableTSRFlag;
+ *disableTSRFlag = 0;
+ }
#endif
LoadV86Registers(SSToDS(&saveRegs), in, sregs);
VDHResetEventSem(hevIRet);
rc = VDHPushInt(intno);
- // set up return hook for interrupt
+ /* set up return hook for interrupt */
rc = VDHArmReturnHook(hhookUserIRetHook, VDHARH_NORMAL_IRET);
VDHYield(0);
- // wait until the V86 IRETs - our return hook posts the semaphore
- rc = VDHWaitEventSem(hevIRet, 5000); //SEM_INDEFINITE_WAIT);
+ /* wait until the V86 IRETs - our return hook posts the semaphore */
+ rc = VDHWaitEventSem(hevIRet, 5000); /*SEM_INDEFINITE_WAIT); */
ReadV86Registers(SSToDS(&saveRegs), out, sregs);
#if 0
/* Re-enable pass-up to our VxD handler if previously enabled */
if (disableTSRFlag)
- *disableTSRFlag = oldDisable;
+ *disableTSRFlag = oldDisable;
#endif
TRACE("SDDHELP: Exiting PM_int86x()\n");
@@ -776,7 +776,7 @@ void PMAPI PM_freeLockedMem(
ibool contiguous)
{
if (p)
- VDHFreePages((PVOID)p);
+ VDHFreePages((PVOID)p);
}
/****************************************************************************
@@ -787,7 +787,7 @@ int PMAPI PM_lockDataPages(void *p,uint len,PM_lockHandle *lh)
{
ULONG lockHandle;
- // TODO: the lock handle is essential for the unlock operation!!
+ /* TODO: the lock handle is essential for the unlock operation!! */
lockHandle = VDHLockMem(p, len, 0, (PVOID)VDHLM_NO_ADDR, NULL);
if (lockHandle != NULL)
@@ -802,8 +802,8 @@ Unlock linear memory so it won't be paged.
****************************************************************************/
int PMAPI PM_unlockDataPages(void *p,uint len,PM_lockHandle *lh)
{
- // TODO: implement - use a table of lock handles?
- // VDHUnlockPages(lockHandle);
+ /* TODO: implement - use a table of lock handles? */
+ /* VDHUnlockPages(lockHandle); */
return 0;
}
@@ -867,9 +867,9 @@ void *PMAPI PM_findFirstFile(
const char *filename,
PM_findData *findData)
{
- // TODO: This function should start a directory enumeration search
- // given the filename (with wildcards). The data should be
- // converted and returned in the findData standard form.
+ /* TODO: This function should start a directory enumeration search */
+ /* given the filename (with wildcards). The data should be */
+ /* converted and returned in the findData standard form. */
(void)filename;
(void)findData;
return PM_FILE_INVALID;
@@ -883,10 +883,10 @@ ibool PMAPI PM_findNextFile(
void *handle,
PM_findData *findData)
{
- // TODO: This function should find the next file in directory enumeration
- // search given the search criteria defined in the call to
- // PM_findFirstFile. The data should be converted and returned
- // in the findData standard form.
+ /* TODO: This function should find the next file in directory enumeration */
+ /* search given the search criteria defined in the call to */
+ /* PM_findFirstFile. The data should be converted and returned */
+ /* in the findData standard form. */
(void)handle;
(void)findData;
return false;
@@ -899,8 +899,8 @@ Function to close the find process
void PMAPI PM_findClose(
void *handle)
{
- // TODO: This function should close the find process. This may do
- // nothing for some OS'es.
+ /* TODO: This function should close the find process. This may do */
+ /* nothing for some OS'es. */
(void)handle;
}
@@ -920,7 +920,7 @@ numbering is:
ibool PMAPI PM_driveValid(
char drive)
{
- // Not applicable in a VDD
+ /* Not applicable in a VDD */
(void)drive;
return false;
}
@@ -936,7 +936,7 @@ void PMAPI PM_getdcwd(
char *dir,
int len)
{
- // Not applicable in a VDD
+ /* Not applicable in a VDD */
(void)drive;
(void)dir;
(void)len;
@@ -970,7 +970,7 @@ void PMAPI PM_setFileAttr(
const char *filename,
uint attrib)
{
- // TODO: Implement this ?
+ /* TODO: Implement this ? */
(void)filename;
(void)attrib;
PM_fatalError("PM_setFileAttr not implemented!");
@@ -983,7 +983,7 @@ Function to get the file attributes for a specific file.
uint PMAPI PM_getFileAttr(
const char *filename)
{
- // TODO: Implement this ?
+ /* TODO: Implement this ? */
(void)filename;
PM_fatalError("PM_getFileAttr not implemented!");
return 0;
@@ -996,7 +996,7 @@ Function to create a directory.
ibool PMAPI PM_mkdir(
const char *filename)
{
- // TODO: Implement this ?
+ /* TODO: Implement this ? */
(void)filename;
PM_fatalError("PM_mkdir not implemented!");
return false;
@@ -1009,7 +1009,7 @@ Function to remove a directory.
ibool PMAPI PM_rmdir(
const char *filename)
{
- // TODO: Implement this ?
+ /* TODO: Implement this ? */
(void)filename;
PM_fatalError("PM_rmdir not implemented!");
return false;
@@ -1024,7 +1024,7 @@ ibool PMAPI PM_getFileTime(
ibool gmTime,
PM_time *time)
{
- // TODO: Implement this ?
+ /* TODO: Implement this ? */
(void)filename;
(void)gmTime;
(void)time;
@@ -1041,7 +1041,7 @@ ibool PMAPI PM_setFileTime(
ibool gmTime,
PM_time *time)
{
- // TODO: Implement this ?
+ /* TODO: Implement this ? */
(void)filename;
(void)gmTime;
(void)time;
diff --git a/board/MAI/bios_emulator/scitech/src/pm/vdd/vflat.c b/board/MAI/bios_emulator/scitech/src/pm/vdd/vflat.c
index 10c63e3405..21639281a7 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/vdd/vflat.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/vdd/vflat.c
@@ -32,12 +32,12 @@
ibool PMAPI VF_available(void)
{
- return false;
+ return false;
}
void * PMAPI VF_init(ulong baseAddr,int bankSize,int codeLen,void *bankFunc)
{
- return NULL;
+ return NULL;
}
void PMAPI VF_exit(void)
diff --git a/board/MAI/bios_emulator/scitech/src/pm/vxd/fileio.c b/board/MAI/bios_emulator/scitech/src/pm/vxd/fileio.c
index e2ff585839..3c6ce99208 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/vxd/fileio.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/vxd/fileio.c
@@ -47,62 +47,62 @@ FILE * fopen(
long oldpos;
if (f) {
- f->offset = 0;
- f->text = (mode[1] == 't' || mode[2] == 't');
- f->writemode = (mode[0] == 'w') || (mode[0] == 'a');
- if (initComplete) {
- WORD omode,error;
- BYTE action;
+ f->offset = 0;
+ f->text = (mode[1] == 't' || mode[2] == 't');
+ f->writemode = (mode[0] == 'w') || (mode[0] == 'a');
+ if (initComplete) {
+ WORD omode,error;
+ BYTE action;
- if (mode[0] == 'r') {
- omode = OPEN_ACCESS_READONLY | OPEN_SHARE_COMPATIBLE;
- action = ACTION_IFEXISTS_OPEN | ACTION_IFNOTEXISTS_FAIL;
- }
- else if (mode[0] == 'w') {
- omode = OPEN_ACCESS_WRITEONLY | OPEN_SHARE_COMPATIBLE;
- action = ACTION_IFEXISTS_TRUNCATE | ACTION_IFNOTEXISTS_CREATE;
- }
- else {
- omode = OPEN_ACCESS_READWRITE | OPEN_SHARE_COMPATIBLE;
- action = ACTION_IFEXISTS_OPEN | ACTION_IFNOTEXISTS_CREATE;
- }
- f->handle = (int)R0_OpenCreateFile(false,(char*)filename,omode,ATTR_NORMAL,action,0,&error,&action);
- if (f->handle == 0) {
- PM_free(f);
- return NULL;
- }
- f->filesize = R0_GetFileSize((HANDLE)f->handle,&error);
- if (mode[0] == 'a')
- fseek(f,0,2);
- }
- else {
- int oflag,pmode;
+ if (mode[0] == 'r') {
+ omode = OPEN_ACCESS_READONLY | OPEN_SHARE_COMPATIBLE;
+ action = ACTION_IFEXISTS_OPEN | ACTION_IFNOTEXISTS_FAIL;
+ }
+ else if (mode[0] == 'w') {
+ omode = OPEN_ACCESS_WRITEONLY | OPEN_SHARE_COMPATIBLE;
+ action = ACTION_IFEXISTS_TRUNCATE | ACTION_IFNOTEXISTS_CREATE;
+ }
+ else {
+ omode = OPEN_ACCESS_READWRITE | OPEN_SHARE_COMPATIBLE;
+ action = ACTION_IFEXISTS_OPEN | ACTION_IFNOTEXISTS_CREATE;
+ }
+ f->handle = (int)R0_OpenCreateFile(false,(char*)filename,omode,ATTR_NORMAL,action,0,&error,&action);
+ if (f->handle == 0) {
+ PM_free(f);
+ return NULL;
+ }
+ f->filesize = R0_GetFileSize((HANDLE)f->handle,&error);
+ if (mode[0] == 'a')
+ fseek(f,0,2);
+ }
+ else {
+ int oflag,pmode;
- if (mode[0] == 'r') {
- pmode = _S_IREAD;
- oflag = _O_RDONLY;
- }
- else if (mode[0] == 'w') {
- pmode = _S_IWRITE;
- oflag = _O_WRONLY | _O_CREAT | _O_TRUNC;
- }
- else {
- pmode = _S_IWRITE;
- oflag = _O_RDWR | _O_CREAT | _O_APPEND;
- }
- if (f->text)
- oflag |= _O_TEXT;
- else
- oflag |= _O_BINARY;
- if ((f->handle = i_open(filename,oflag,pmode)) == -1) {
- PM_free(f);
- return NULL;
- }
- oldpos = i_lseek(f->handle,0,1);
- f->filesize = i_lseek(f->handle,0,2);
- i_lseek(f->handle,oldpos,0);
- }
- }
+ if (mode[0] == 'r') {
+ pmode = _S_IREAD;
+ oflag = _O_RDONLY;
+ }
+ else if (mode[0] == 'w') {
+ pmode = _S_IWRITE;
+ oflag = _O_WRONLY | _O_CREAT | _O_TRUNC;
+ }
+ else {
+ pmode = _S_IWRITE;
+ oflag = _O_RDWR | _O_CREAT | _O_APPEND;
+ }
+ if (f->text)
+ oflag |= _O_TEXT;
+ else
+ oflag |= _O_BINARY;
+ if ((f->handle = i_open(filename,oflag,pmode)) == -1) {
+ PM_free(f);
+ return NULL;
+ }
+ oldpos = i_lseek(f->handle,0,1);
+ f->filesize = i_lseek(f->handle,0,2);
+ i_lseek(f->handle,oldpos,0);
+ }
+ }
return f;
}
@@ -125,27 +125,27 @@ size_t fread(
int readbytes,totalbytes = 0;
while (bytes > 0x10000) {
- if (initComplete) {
- readbytes = R0_ReadFile(false,(HANDLE)f->handle,buf,0x8000,f->offset,&error);
- readbytes += R0_ReadFile(false,(HANDLE)f->handle,buf+0x8000,0x8000,f->offset+0x8000,&error);
- }
- else {
- readbytes = i_read(f->handle,buf,0x8000);
- readbytes += i_read(f->handle,buf+0x8000,0x8000);
- }
- totalbytes += readbytes;
- f->offset += readbytes;
- buf += 0x10000;
- bytes -= 0x10000;
- }
+ if (initComplete) {
+ readbytes = R0_ReadFile(false,(HANDLE)f->handle,buf,0x8000,f->offset,&error);
+ readbytes += R0_ReadFile(false,(HANDLE)f->handle,buf+0x8000,0x8000,f->offset+0x8000,&error);
+ }
+ else {
+ readbytes = i_read(f->handle,buf,0x8000);
+ readbytes += i_read(f->handle,buf+0x8000,0x8000);
+ }
+ totalbytes += readbytes;
+ f->offset += readbytes;
+ buf += 0x10000;
+ bytes -= 0x10000;
+ }
if (bytes) {
- if (initComplete)
- readbytes = R0_ReadFile(false,(HANDLE)f->handle,buf,bytes,f->offset,&error);
- else
- readbytes = i_read(f->handle,buf,bytes);
- totalbytes += readbytes;
- f->offset += readbytes;
- }
+ if (initComplete)
+ readbytes = R0_ReadFile(false,(HANDLE)f->handle,buf,bytes,f->offset,&error);
+ else
+ readbytes = i_read(f->handle,buf,bytes);
+ totalbytes += readbytes;
+ f->offset += readbytes;
+ }
return totalbytes / size;
}
@@ -168,29 +168,29 @@ size_t fwrite(
int writtenbytes,totalbytes = 0;
if (!f->writemode)
- return 0;
+ return 0;
while (bytes > 0x10000) {
- if (initComplete) {
- writtenbytes = R0_WriteFile(false,(HANDLE)f->handle,buf,0x8000,f->offset,&error);
- writtenbytes += R0_WriteFile(false,(HANDLE)f->handle,buf+0x8000,0x8000,f->offset+0x8000,&error);
- }
- else {
- writtenbytes = i_write(f->handle,buf,0x8000);
- writtenbytes += i_write(f->handle,buf+0x8000,0x8000);
- }
- totalbytes += writtenbytes;
- f->offset += writtenbytes;
- buf += 0x10000;
- bytes -= 0x10000;
- }
+ if (initComplete) {
+ writtenbytes = R0_WriteFile(false,(HANDLE)f->handle,buf,0x8000,f->offset,&error);
+ writtenbytes += R0_WriteFile(false,(HANDLE)f->handle,buf+0x8000,0x8000,f->offset+0x8000,&error);
+ }
+ else {
+ writtenbytes = i_write(f->handle,buf,0x8000);
+ writtenbytes += i_write(f->handle,buf+0x8000,0x8000);
+ }
+ totalbytes += writtenbytes;
+ f->offset += writtenbytes;
+ buf += 0x10000;
+ bytes -= 0x10000;
+ }
if (initComplete)
- writtenbytes = R0_WriteFile(false,(HANDLE)f->handle,buf,bytes,f->offset,&error);
+ writtenbytes = R0_WriteFile(false,(HANDLE)f->handle,buf,bytes,f->offset,&error);
else
- writtenbytes = i_write(f->handle,buf,bytes);
+ writtenbytes = i_write(f->handle,buf,bytes);
totalbytes += writtenbytes;
f->offset += writtenbytes;
if (f->offset > f->filesize)
- f->filesize = f->offset;
+ f->filesize = f->offset;
return totalbytes / size;
}
@@ -201,7 +201,7 @@ VxD implementation of the ANSI C fflush function.
int fflush(
FILE *f)
{
- // Nothing to do since we are not doing buffered file I/O
+ /* Nothing to do since we are not doing buffered file I/O */
(void)f;
return 0;
}
@@ -216,13 +216,13 @@ int fseek(
int whence)
{
if (whence == 0)
- f->offset = offset;
+ f->offset = offset;
else if (whence == 1)
- f->offset += offset;
+ f->offset += offset;
else if (whence == 2)
- f->offset = f->filesize + offset;
+ f->offset = f->filesize + offset;
if (!initComplete)
- i_lseek(f->handle,f->offset,0);
+ i_lseek(f->handle,f->offset,0);
return 0;
}
@@ -258,19 +258,19 @@ char *fgets(
int len;
char *cs;
- // Read the entire buffer into memory (our functions are unbuffered!)
+ /* Read the entire buffer into memory (our functions are unbuffered!) */
if ((len = fread(s,1,n,f)) == 0)
- return NULL;
+ return NULL;
- // Search for '\n' or end of string
+ /* Search for '\n' or end of string */
if (n > len)
- n = len;
+ n = len;
cs = s;
while (--n > 0) {
- if (*cs == '\n')
- break;
- cs++;
- }
+ if (*cs == '\n')
+ break;
+ cs++;
+ }
*cs = '\0';
return s;
}
@@ -296,10 +296,9 @@ int fclose(
WORD error;
if (initComplete)
- R0_CloseFile((HANDLE)f->handle,&error);
+ R0_CloseFile((HANDLE)f->handle,&error);
else
- i_close(f->handle);
+ i_close(f->handle);
PM_free(f);
return 0;
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/vxd/pm.c b/board/MAI/bios_emulator/scitech/src/pm/vxd/pm.c
index 8d00df9065..4cb7f19ed4 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/vxd/pm.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/vxd/pm.c
@@ -105,7 +105,7 @@ void * VXD_calloc(
{
void *p = PM_mallocShared(nelem * size);
if (p)
- memset(p,0,nelem * size);
+ memset(p,0,nelem * size);
return p;
}
@@ -119,9 +119,9 @@ void * VXD_realloc(
{
void *p = PM_mallocShared(size);
if (p) {
- memcpy(p,ptr,size);
- PM_freeShared(ptr);
- }
+ memcpy(p,ptr,size);
+ PM_freeShared(ptr);
+ }
return p;
}
@@ -166,9 +166,9 @@ void PMAPI PM_backslash(char *s)
{
uint pos = strlen(s);
if (s[pos-1] != '\\') {
- s[pos] = '\\';
- s[pos+1] = '\0';
- }
+ s[pos] = '\\';
+ s[pos+1] = '\0';
+ }
}
void PMAPI PM_setFatalErrorCleanup(
@@ -180,7 +180,7 @@ void PMAPI PM_setFatalErrorCleanup(
void PMAPI PM_fatalError(const char *msg)
{
if (fatalErrorCleanup)
- fatalErrorCleanup();
+ fatalErrorCleanup();
Fatal_Error_Handler(msg,0);
}
@@ -204,11 +204,11 @@ void * PMAPI PM_getVESABuf(
* transfer buffer to return, so we fail the call.
*/
if (_PM_rmBufAddr) {
- *len = VESA_BUF_SIZE;
- *rseg = (ulong)(_PM_rmBufAddr) >> 4;
- *roff = (ulong)(_PM_rmBufAddr) & 0xF;
- return _PM_rmBufAddr;
- }
+ *len = VESA_BUF_SIZE;
+ *rseg = (ulong)(_PM_rmBufAddr) >> 4;
+ *roff = (ulong)(_PM_rmBufAddr) & 0xF;
+ return _PM_rmBufAddr;
+ }
return NULL;
}
@@ -276,10 +276,10 @@ static ibool REG_queryString(
memset(value,0,sizeof(value));
if (RegOpenKey(HKEY_LOCAL_MACHINE,szKey,&hKey) == ERROR_SUCCESS) {
- if (RegQueryValueEx(hKey,(PCHAR)szValue,(ulong*)NULL,(ulong*)&type,value,(ulong*)&size) == ERROR_SUCCESS)
- status = true;
- RegCloseKey(hKey);
- }
+ if (RegQueryValueEx(hKey,(PCHAR)szValue,(ulong*)NULL,(ulong*)&type,value,(ulong*)&size) == ERROR_SUCCESS)
+ status = true;
+ RegCloseKey(hKey);
+ }
return status;
}
@@ -288,12 +288,12 @@ const char * PMAPI PM_getNucleusPath(void)
static char path[256];
if (strlen(_PM_nucleusPath) > 0) {
- strcpy(path,_PM_nucleusPath);
- PM_backslash(path);
- return path;
- }
+ strcpy(path,_PM_nucleusPath);
+ PM_backslash(path);
+ return path;
+ }
if (!REG_queryString(szWindowsKey,szSystemRoot,path,sizeof(path)))
- strcpy(path,"c:\\windows");
+ strcpy(path,"c:\\windows");
PM_backslash(path);
strcat(path,"system\\nucleus");
return path;
@@ -315,7 +315,7 @@ const char * PMAPI PM_getMachineName(void)
{
static char name[256];
if (REG_queryString(szMachineNameKey,szMachineName,name,sizeof(name)))
- return name;
+ return name;
return "Unknown";
}
@@ -352,7 +352,7 @@ void PMAPI PM_saveConsoleState(
void PMAPI PM_setSuspendAppCallback(
int (_ASMAPIP saveState)(
- int flags))
+ int flags))
{
/* Unused in VxDs */
}
@@ -405,16 +405,16 @@ void * PMAPI PM_mallocShared(
/* First find a free slot in our shared memory table */
for (i = 0; i < MAX_MEMORY_SHARED; i++) {
- if (shared[i].linear == 0)
- break;
- }
+ if (shared[i].linear == 0)
+ break;
+ }
if (i < MAX_MEMORY_SHARED) {
- PageAllocate(nPages,PG_SYS,0,0,0,0,NULL,0,&hMem,&shared[i].linear);
- shared[i].npages = nPages;
- pgNum = (ulong)shared[i].linear >> 12;
- shared[i].global = LinPageLock(pgNum,nPages,PAGEMAPGLOBAL);
- return (void*)shared[i].global;
- }
+ PageAllocate(nPages,PG_SYS,0,0,0,0,NULL,0,&hMem,&shared[i].linear);
+ shared[i].npages = nPages;
+ pgNum = (ulong)shared[i].linear >> 12;
+ shared[i].global = LinPageLock(pgNum,nPages,PAGEMAPGLOBAL);
+ return (void*)shared[i].global;
+ }
return NULL;
}
@@ -428,13 +428,13 @@ void PMAPI PM_freeShared(void *p)
/* Find a shared memory block in our table and free it */
for (i = 0; i < MAX_MEMORY_SHARED; i++) {
- if (shared[i].global == (ulong)p) {
- LinPageUnLock(shared[i].global >> 12,shared[i].npages,PAGEMAPGLOBAL);
- PageFree((ulong)shared[i].linear,0);
- shared[i].linear = 0;
- break;
- }
- }
+ if (shared[i].global == (ulong)p) {
+ LinPageUnLock(shared[i].global >> 12,shared[i].npages,PAGEMAPGLOBAL);
+ PageFree((ulong)shared[i].linear,0);
+ shared[i].linear = 0;
+ break;
+ }
+ }
}
/****************************************************************************
@@ -455,7 +455,7 @@ ibool PMAPI PM_doBIOSPOST(
void *mappedBIOS,
ulong BIOSLen)
{
- // TODO: Figure out how to do this
+ /* TODO: Figure out how to do this */
return false;
}
@@ -485,29 +485,29 @@ ulong _PM_mapPhysicalToLinear(
int i,ppage,flags;
if (base < 0x100000) {
- /* Windows 9x is zero based for the first meg of memory */
- return base;
- }
+ /* Windows 9x is zero based for the first meg of memory */
+ return base;
+ }
ppage = base >> 12;
*npages = (length + (base & 0xFFF) + 4095) >> 12;
flags = PR_FIXED | PR_STATIC;
if (base == 0xA0000) {
- /* We require the linear address to be aligned to a 64Kb boundary
- * for mapping the banked framebuffer (so we can do efficient
- * carry checking for bank changes in the assembler code). The only
- * way to ensure this is to force the linear address to be aligned
- * to a 4Mb boundary.
- */
- flags |= PR_4MEG;
- }
+ /* We require the linear address to be aligned to a 64Kb boundary
+ * for mapping the banked framebuffer (so we can do efficient
+ * carry checking for bank changes in the assembler code). The only
+ * way to ensure this is to force the linear address to be aligned
+ * to a 4Mb boundary.
+ */
+ flags |= PR_4MEG;
+ }
if ((linear = (ulong)PageReserve(PR_SYSTEM,*npages,flags)) == (ulong)-1)
- return 0xFFFFFFFF;
+ return 0xFFFFFFFF;
if (!PageCommitPhys(linear >> 12,*npages,ppage,PC_INCR | PC_USER | PC_WRITEABLE))
- return 0xFFFFFFFF;
+ return 0xFFFFFFFF;
return linear + (base & 0xFFF);
}
-// Page table flags
+/* Page table flags */
#define PAGE_FLAGS_PRESENT 0x00000001
#define PAGE_FLAGS_WRITEABLE 0x00000002
@@ -535,9 +535,9 @@ memory below 1Mb, which gets this memory out of the way of the Windows VDD's
sticky paws.
NOTE: If the memory is not expected to be cached, this function will
- directly re-program the PCD (Page Cache Disable) bit in the
- page tables. There does not appear to be a mechanism in the VMM
- to control this bit via the regular interface.
+ directly re-program the PCD (Page Cache Disable) bit in the
+ page tables. There does not appear to be a mechanism in the VMM
+ to control this bit via the regular interface.
****************************************************************************/
void * PMAPI PM_mapPhysicalAddr(
ulong base,
@@ -552,11 +552,11 @@ void * PMAPI PM_mapPhysicalAddr(
* a region of memory that will serve this purpose.
*/
for (i = 0; i < numMappings; i++) {
- if (maps[i].physical == base && maps[i].length == length && maps[i].isCached == isCached)
- return (void*)maps[i].linear;
- }
+ if (maps[i].physical == base && maps[i].length == length && maps[i].isCached == isCached)
+ return (void*)maps[i].linear;
+ }
if (numMappings == MAX_MEMORY_MAPPINGS)
- return NULL;
+ return NULL;
/* We did not find any previously mapped memory region, so maps it in.
* Note that we do not use MapPhysToLinear, since this function appears
@@ -564,7 +564,7 @@ void * PMAPI PM_mapPhysicalAddr(
* Hence we use PageReserve and PageCommitPhys.
*/
if ((linear = _PM_mapPhysicalToLinear(base,limit,&npages)) == 0xFFFFFFFF)
- return NULL;
+ return NULL;
maps[numMappings].physical = base;
maps[numMappings].length = length;
maps[numMappings].linear = linear;
@@ -574,34 +574,34 @@ void * PMAPI PM_mapPhysicalAddr(
/* Finally disable caching where necessary */
if (!isCached && (PDB = _PM_getPDB()) != 0) {
- int startPDB,endPDB,iPDB,startPage,endPage,start,end,iPage;
- ulong pageTable,*pPageTable;
- pPDB = (ulong*)_PM_mapPhysicalToLinear(PDB,0xFFF,&npages);
- if (pPDB) {
- startPDB = (linear >> 22) & 0x3FF;
- startPage = (linear >> 12) & 0x3FF;
- endPDB = ((linear+limit) >> 22) & 0x3FF;
- endPage = ((linear+limit) >> 12) & 0x3FF;
- for (iPDB = startPDB; iPDB <= endPDB; iPDB++) {
- // Set the bits in the page directory entry - required as per
- // Pentium 4 manual. This also takes care of the 4MB page entries
- pPDB[iPDB] = pPDB[iPDB] |= (PAGE_FLAGS_WRITE_THROUGH | PAGE_FLAGS_CACHE_DISABLE);
- if (!(pPDB[iPDB] & PAGE_FLAGS_4MB)) {
- // If we are dealing with 4KB pages then we need to iterate
- // through each of the page table entries
- pageTable = pPDB[iPDB] & ~0xFFF;
- pPageTable = (ulong*)_PM_mapPhysicalToLinear(pageTable,0xFFF,&npages);
- start = (iPDB == startPDB) ? startPage : 0;
- end = (iPDB == endPDB) ? endPage : 0x3FF;
- for (iPage = start; iPage <= end; iPage++)
- pPageTable[iPage] |= (PAGE_FLAGS_WRITE_THROUGH | PAGE_FLAGS_CACHE_DISABLE);
- PageFree((ulong)pPageTable,PR_STATIC);
- }
- }
- PageFree((ulong)pPDB,PR_STATIC);
- PM_flushTLB();
- }
- }
+ int startPDB,endPDB,iPDB,startPage,endPage,start,end,iPage;
+ ulong pageTable,*pPageTable;
+ pPDB = (ulong*)_PM_mapPhysicalToLinear(PDB,0xFFF,&npages);
+ if (pPDB) {
+ startPDB = (linear >> 22) & 0x3FF;
+ startPage = (linear >> 12) & 0x3FF;
+ endPDB = ((linear+limit) >> 22) & 0x3FF;
+ endPage = ((linear+limit) >> 12) & 0x3FF;
+ for (iPDB = startPDB; iPDB <= endPDB; iPDB++) {
+ /* Set the bits in the page directory entry - required as per */
+ /* Pentium 4 manual. This also takes care of the 4MB page entries */
+ pPDB[iPDB] = pPDB[iPDB] |= (PAGE_FLAGS_WRITE_THROUGH | PAGE_FLAGS_CACHE_DISABLE);
+ if (!(pPDB[iPDB] & PAGE_FLAGS_4MB)) {
+ /* If we are dealing with 4KB pages then we need to iterate */
+ /* through each of the page table entries */
+ pageTable = pPDB[iPDB] & ~0xFFF;
+ pPageTable = (ulong*)_PM_mapPhysicalToLinear(pageTable,0xFFF,&npages);
+ start = (iPDB == startPDB) ? startPage : 0;
+ end = (iPDB == endPDB) ? endPage : 0x3FF;
+ for (iPage = start; iPage <= end; iPage++)
+ pPageTable[iPage] |= (PAGE_FLAGS_WRITE_THROUGH | PAGE_FLAGS_CACHE_DISABLE);
+ PageFree((ulong)pPageTable,PR_STATIC);
+ }
+ }
+ PageFree((ulong)pPDB,PR_STATIC);
+ PM_flushTLB();
+ }
+ }
return (void*)linear;
}
@@ -619,26 +619,26 @@ void PMAPI PM_sleep(ulong milliseconds)
int PMAPI PM_getCOMPort(int port)
{
- // TODO: Re-code this to determine real values using the Plug and Play
- // manager for the OS.
+ /* TODO: Re-code this to determine real values using the Plug and Play */
+ /* manager for the OS. */
switch (port) {
- case 0: return 0x3F8;
- case 1: return 0x2F8;
- case 2: return 0x3E8;
- case 3: return 0x2E8;
- }
+ case 0: return 0x3F8;
+ case 1: return 0x2F8;
+ case 2: return 0x3E8;
+ case 3: return 0x2E8;
+ }
return 0;
}
int PMAPI PM_getLPTPort(int port)
{
- // TODO: Re-code this to determine real values using the Plug and Play
- // manager for the OS.
+ /* TODO: Re-code this to determine real values using the Plug and Play */
+ /* manager for the OS. */
switch (port) {
- case 0: return 0x3BC;
- case 1: return 0x378;
- case 2: return 0x278;
- }
+ case 0: return 0x3BC;
+ case 1: return 0x378;
+ case 2: return 0x278;
+ }
return 0;
}
@@ -647,18 +647,18 @@ ulong PMAPI PM_getPhysicalAddr(
{
DWORD pte;
- // Touch the memory before calling CopyPageTable. For some reason
- // we need to do this on Windows 9x, otherwise the memory may not
- // be paged in correctly. Of course if the passed in pointer is
- // invalid, this function will fault, but we shouldn't be passed bogus
- // pointers anyway ;-)
+ /* Touch the memory before calling CopyPageTable. For some reason */
+ /* we need to do this on Windows 9x, otherwise the memory may not */
+ /* be paged in correctly. Of course if the passed in pointer is */
+ /* invalid, this function will fault, but we shouldn't be passed bogus */
+ /* pointers anyway ;-) */
pte = *((ulong*)p);
- // Return assembled address value only if VMM service succeeds
+ /* Return assembled address value only if VMM service succeeds */
if (CopyPageTable(((DWORD)p) >> 12, 1, (PVOID*)&pte, 0))
- return (pte & ~0xFFF) | (((DWORD)p) & 0xFFF);
+ return (pte & ~0xFFF) | (((DWORD)p) & 0xFFF);
- // Return failure to the caller!
+ /* Return failure to the caller! */
return 0xFFFFFFFFUL;
}
@@ -671,10 +671,10 @@ ibool PMAPI PM_getPhysicalAddrRange(
ulong linear = (ulong)p & ~0xFFF;
for (i = (length + 0xFFF) >> 12; i > 0; i--) {
- if ((*physAddress++ = PM_getPhysicalAddr((void*)linear)) == 0xFFFFFFFF)
- return false;
- linear += 4096;
- }
+ if ((*physAddress++ = PM_getPhysicalAddr((void*)linear)) == 0xFFFFFFFF)
+ return false;
+ linear += 4096;
+ }
return true;
}
@@ -682,7 +682,7 @@ void PMAPI _PM_freeMemoryMappings(void)
{
int i;
for (i = 0; i < numMappings; i++)
- PageFree(maps[i].linear,PR_STATIC);
+ PageFree(maps[i].linear,PR_STATIC);
}
void * PMAPI PM_mapRealPointer(
@@ -777,7 +777,7 @@ void PMAPI PM_callRealMode(
* loaded, and not statically loaded.
*/
if (!_PM_haveBIOS)
- return;
+ return;
_TRACE("SDDHELP: Entering PM_callRealMode()\n");
Begin_Nest_V86_Exec();
@@ -807,16 +807,16 @@ int PMAPI PM_int86(
* loaded, and not statically loaded.
*/
if (!_PM_haveBIOS) {
- *out = *in;
- return out->x.ax;
- }
+ *out = *in;
+ return out->x.ax;
+ }
/* Disable pass-up to our VxD handler so we directly call BIOS */
_TRACE("SDDHELP: Entering PM_int86()\n");
if (disableTSRFlag) {
- oldDisable = *disableTSRFlag;
- *disableTSRFlag = 0;
- }
+ oldDisable = *disableTSRFlag;
+ *disableTSRFlag = 0;
+ }
Begin_Nest_V86_Exec();
LoadV86Registers(&saveRegs,in,&sregs);
Exec_Int(intno);
@@ -825,7 +825,7 @@ int PMAPI PM_int86(
/* Re-enable pass-up to our VxD handler if previously enabled */
if (disableTSRFlag)
- *disableTSRFlag = oldDisable;
+ *disableTSRFlag = oldDisable;
_TRACE("SDDHELP: Exiting PM_int86()\n");
return out->x.ax;
@@ -849,16 +849,16 @@ int PMAPI PM_int86x(
* loaded, and not statically loaded.
*/
if (!_PM_haveBIOS) {
- *out = *in;
- return out->x.ax;
- }
+ *out = *in;
+ return out->x.ax;
+ }
/* Disable pass-up to our VxD handler so we directly call BIOS */
_TRACE("SDDHELP: Entering PM_int86x()\n");
if (disableTSRFlag) {
- oldDisable = *disableTSRFlag;
- *disableTSRFlag = 0;
- }
+ oldDisable = *disableTSRFlag;
+ *disableTSRFlag = 0;
+ }
Begin_Nest_V86_Exec();
LoadV86Registers(&saveRegs,in,sregs);
Exec_Int(intno);
@@ -867,7 +867,7 @@ int PMAPI PM_int86x(
/* Re-enable pass-up to our VxD handler if previously enabled */
if (disableTSRFlag)
- *disableTSRFlag = oldDisable;
+ *disableTSRFlag = oldDisable;
_TRACE("SDDHELP: Exiting PM_int86x()\n");
return out->x.ax;
@@ -900,14 +900,14 @@ void * PMAPI PM_allocLockedMem(
DWORD maxPhys = below16M ? 0x00FFFFFF : 0xFFFFFFFF;
void *p;
- // TODO: This may need to be modified if the memory needs to be globally
- // accessible. Check how we implemented PM_mallocShared() as we
- // may need to do something similar in here.
+ /* TODO: This may need to be modified if the memory needs to be globally */
+ /* accessible. Check how we implemented PM_mallocShared() as we */
+ /* may need to do something similar in here. */
PageAllocate(nPages,PG_SYS,0,0,0,maxPhys,physAddr,flags,&hMem,&p);
- // TODO: We may need to modify the memory blocks to disable caching via
- // the page tables (PCD|PWT) since DMA memory blocks *cannot* be
- // cached!
+ /* TODO: We may need to modify the memory blocks to disable caching via */
+ /* the page tables (PCD|PWT) since DMA memory blocks *cannot* be */
+ /* cached! */
return p;
}
@@ -921,7 +921,7 @@ void PMAPI PM_freeLockedMem(
ibool contiguous)
{
if (p)
- PageFree((ulong)p,0);
+ PageFree((ulong)p,0);
}
/****************************************************************************
@@ -934,9 +934,9 @@ void * PMAPI PM_allocPage(
MEMHANDLE hMem;
void *p;
- // TODO: This will need to be modified if the memory needs to be globally
- // accessible. Check how we implemented PM_mallocShared() as we
- // may need to do something similar in here.
+ /* TODO: This will need to be modified if the memory needs to be globally */
+ /* accessible. Check how we implemented PM_mallocShared() as we */
+ /* may need to do something similar in here. */
PageAllocate(1,PG_SYS,0,0,0,0,0,PAGEFIXED,&hMem,&p);
return p;
}
@@ -949,7 +949,7 @@ void PMAPI PM_freePage(
void *p)
{
if (p)
- PageFree((ulong)p,0);
+ PageFree((ulong)p,0);
}
/****************************************************************************
@@ -1012,41 +1012,41 @@ void PMAPI PM_setRealTimeClockFrequency(
int frequency)
{
static short convert[] = {
- 8192,
- 4096,
- 2048,
- 1024,
- 512,
- 256,
- 128,
- 64,
- 32,
- 16,
- 8,
- 4,
- 2,
- -1,
- };
+ 8192,
+ 4096,
+ 2048,
+ 1024,
+ 512,
+ 256,
+ 128,
+ 64,
+ 32,
+ 16,
+ 8,
+ 4,
+ 2,
+ -1,
+ };
int i;
/* First clear any pending RTC timeout if not cleared */
_PM_readCMOS(0x0C);
if (frequency == 0) {
- /* Disable RTC timout */
- _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
- _PM_writeCMOS(0x0B,_PM_oldCMOSRegB & 0x0F);
- }
+ /* Disable RTC timout */
+ _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
+ _PM_writeCMOS(0x0B,_PM_oldCMOSRegB & 0x0F);
+ }
else {
- /* Convert frequency value to RTC clock indexes */
- for (i = 0; convert[i] != -1; i++) {
- if (convert[i] == frequency)
- break;
- }
+ /* Convert frequency value to RTC clock indexes */
+ for (i = 0; convert[i] != -1; i++) {
+ if (convert[i] == frequency)
+ break;
+ }
- /* Set RTC timout value and enable timeout */
- _PM_writeCMOS(0x0A,0x20 | (i+3));
- _PM_writeCMOS(0x0B,(_PM_oldCMOSRegB & 0x0F) | 0x40);
- }
+ /* Set RTC timout value and enable timeout */
+ _PM_writeCMOS(0x0A,0x20 | (i+3));
+ _PM_writeCMOS(0x0B,(_PM_oldCMOSRegB & 0x0F) | 0x40);
+ }
}
/****************************************************************************
@@ -1072,11 +1072,11 @@ static BOOL __stdcall RTCInt_Handler(
* new one comes along; if that happens we ignore the old one).
*/
if (!inside) {
- inside = 1;
- enable();
- _PM_rtcHandler();
- inside = 0;
- }
+ inside = 1;
+ enable();
+ _PM_rtcHandler();
+ inside = 0;
+ }
return TRUE;
}
@@ -1106,7 +1106,7 @@ ibool PMAPI PM_setRealTimeClockHandler(
IRQdesc.VID_IRET_Proc = 0;
IRQdesc.VID_IRET_Time_Out = 500;
if ((RTCIRQHandle = VPICD_Virtualize_IRQ(&IRQdesc)) == 0)
- return false;
+ return false;
/* Program the real time clock default frequency */
PM_setRealTimeClockFrequency(frequency);
@@ -1123,15 +1123,15 @@ Restore the original real time clock handler.
void PMAPI PM_restoreRealTimeClockHandler(void)
{
if (RTCIRQHandle) {
- /* Restore CMOS registers and mask RTC clock */
- _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
- _PM_writeCMOS(0x0B,_PM_oldCMOSRegB);
+ /* Restore CMOS registers and mask RTC clock */
+ _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
+ _PM_writeCMOS(0x0B,_PM_oldCMOSRegB);
- /* Restore the interrupt vector */
- VPICD_Set_Auto_Masking(RTCIRQHandle);
- VPICD_Force_Default_Behavior(RTCIRQHandle);
- RTCIRQHandle = 0;
- }
+ /* Restore the interrupt vector */
+ VPICD_Set_Auto_Masking(RTCIRQHandle);
+ VPICD_Force_Default_Behavior(RTCIRQHandle);
+ RTCIRQHandle = 0;
+ }
}
/****************************************************************************
@@ -1176,9 +1176,9 @@ void *PMAPI PM_findFirstFile(
const char *filename,
PM_findData *findData)
{
- // TODO: This function should start a directory enumeration search
- // given the filename (with wildcards). The data should be
- // converted and returned in the findData standard form.
+ /* TODO: This function should start a directory enumeration search */
+ /* given the filename (with wildcards). The data should be */
+ /* converted and returned in the findData standard form. */
(void)filename;
(void)findData;
return PM_FILE_INVALID;
@@ -1192,10 +1192,10 @@ ibool PMAPI PM_findNextFile(
void *handle,
PM_findData *findData)
{
- // TODO: This function should find the next file in directory enumeration
- // search given the search criteria defined in the call to
- // PM_findFirstFile. The data should be converted and returned
- // in the findData standard form.
+ /* TODO: This function should find the next file in directory enumeration */
+ /* search given the search criteria defined in the call to */
+ /* PM_findFirstFile. The data should be converted and returned */
+ /* in the findData standard form. */
(void)handle;
(void)findData;
return false;
@@ -1208,8 +1208,8 @@ Function to close the find process
void PMAPI PM_findClose(
void *handle)
{
- // TODO: This function should close the find process. This may do
- // nothing for some OS'es.
+ /* TODO: This function should close the find process. This may do */
+ /* nothing for some OS'es. */
(void)handle;
}
@@ -1229,7 +1229,7 @@ numbering is:
ibool PMAPI PM_driveValid(
char drive)
{
- // Not supported in a VxD
+ /* Not supported in a VxD */
(void)drive;
return false;
}
@@ -1245,7 +1245,7 @@ void PMAPI PM_getdcwd(
char *dir,
int len)
{
- // Not supported in a VxD
+ /* Not supported in a VxD */
(void)drive;
(void)dir;
(void)len;
@@ -1279,7 +1279,7 @@ void PMAPI PM_setFileAttr(
const char *filename,
uint attrib)
{
- // TODO: Implement this
+ /* TODO: Implement this */
(void)filename;
(void)attrib;
PM_fatalError("PM_setFileAttr not implemented yet!");
@@ -1292,7 +1292,7 @@ Function to get the file attributes for a specific file.
uint PMAPI PM_getFileAttr(
const char *filename)
{
- // TODO: Implement this
+ /* TODO: Implement this */
(void)filename;
PM_fatalError("PM_getFileAttr not implemented yet!");
return 0;
@@ -1305,7 +1305,7 @@ Function to create a directory.
ibool PMAPI PM_mkdir(
const char *filename)
{
- // TODO: Implement this
+ /* TODO: Implement this */
(void)filename;
PM_fatalError("PM_mkdir not implemented yet!");
return false;
@@ -1318,7 +1318,7 @@ Function to remove a directory.
ibool PMAPI PM_rmdir(
const char *filename)
{
- // TODO: Implement this
+ /* TODO: Implement this */
(void)filename;
PM_fatalError("PM_rmdir not implemented yet!");
return false;
@@ -1333,7 +1333,7 @@ ibool PMAPI PM_getFileTime(
ibool gmTime,
PM_time *time)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
(void)filename;
(void)gmTime;
(void)time;
@@ -1350,11 +1350,10 @@ ibool PMAPI PM_setFileTime(
ibool gmTime,
PM_time *time)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
(void)filename;
(void)gmTime;
(void)time;
PM_fatalError("PM_setFileTime not implemented yet!");
return false;
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/win32/cpuinfo.c b/board/MAI/bios_emulator/scitech/src/pm/win32/cpuinfo.c
index 5978b9f76e..7da9752051 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/win32/cpuinfo.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/win32/cpuinfo.c
@@ -46,7 +46,7 @@ static int SetMaxThreadPriority(void)
oldPriority = GetThreadPriority(hThread);
if (oldPriority != THREAD_PRIORITY_ERROR_RETURN)
- SetThreadPriority(hThread, THREAD_PRIORITY_TIME_CRITICAL);
+ SetThreadPriority(hThread, THREAD_PRIORITY_TIME_CRITICAL);
return oldPriority;
}
@@ -60,7 +60,7 @@ static void RestoreThreadPriority(
HANDLE hThread = GetCurrentThread();
if (oldPriority != THREAD_PRIORITY_ERROR_RETURN)
- SetThreadPriority(hThread, oldPriority);
+ SetThreadPriority(hThread, oldPriority);
}
/****************************************************************************
@@ -71,12 +71,12 @@ static void GetCounterFrequency(
CPU_largeInteger *freq)
{
if (!QueryPerformanceFrequency((LARGE_INTEGER*)freq)) {
- havePerformanceCounter = false;
- freq->low = 100000;
- freq->high = 0;
- }
+ havePerformanceCounter = false;
+ freq->low = 100000;
+ freq->high = 0;
+ }
else
- havePerformanceCounter = true;
+ havePerformanceCounter = true;
}
/****************************************************************************
@@ -86,9 +86,9 @@ Read the counter and return the counter value.
#define GetCounter(t) \
{ \
if (havePerformanceCounter) \
- QueryPerformanceCounter((LARGE_INTEGER*)t); \
+ QueryPerformanceCounter((LARGE_INTEGER*)t); \
else { \
- (t)->low = timeGetTime() * 100; \
- (t)->high = 0; \
- } \
+ (t)->low = timeGetTime() * 100; \
+ (t)->high = 0; \
+ } \
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/win32/ddraw.c b/board/MAI/bios_emulator/scitech/src/pm/win32/ddraw.c
index cf89401fe6..d6c3f60e84 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/win32/ddraw.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/win32/ddraw.c
@@ -85,11 +85,11 @@ static void DisableAutoPlay(void)
HKEY hKey;
if (RegOpenKeyEx(HKEY_CURRENT_USER,szAutoPlayKey,0,KEY_EXECUTE | KEY_WRITE,&hKey) == ERROR_SUCCESS) {
- RegQueryValueEx(hKey,szAutoPlayValue,NULL,NULL,(void*)&dwAutoPlay,&dwSize);
- dwAutoPlay |= AUTOPLAY_DRIVE_CDROM;
- RegSetValueEx(hKey,szAutoPlayValue,0,REG_DWORD,(void*)&dwAutoPlay,dwSize);
- RegCloseKey(hKey);
- }
+ RegQueryValueEx(hKey,szAutoPlayValue,NULL,NULL,(void*)&dwAutoPlay,&dwSize);
+ dwAutoPlay |= AUTOPLAY_DRIVE_CDROM;
+ RegSetValueEx(hKey,szAutoPlayValue,0,REG_DWORD,(void*)&dwAutoPlay,dwSize);
+ RegCloseKey(hKey);
+ }
}
/****************************************************************************
@@ -102,11 +102,11 @@ static void RestoreAutoPlay(void)
HKEY hKey;
if (RegOpenKeyEx(HKEY_CURRENT_USER,szAutoPlayKey,0,KEY_EXECUTE | KEY_WRITE,&hKey) == ERROR_SUCCESS) {
- RegQueryValueEx(hKey,szAutoPlayValue,NULL,NULL,(void*)&dwAutoPlay,&dwSize);
- dwAutoPlay &= ~AUTOPLAY_DRIVE_CDROM;
- RegSetValueEx(hKey,szAutoPlayValue,0,REG_DWORD,(void*)&dwAutoPlay,dwSize);
- RegCloseKey(hKey);
- }
+ RegQueryValueEx(hKey,szAutoPlayValue,NULL,NULL,(void*)&dwAutoPlay,&dwSize);
+ dwAutoPlay &= ~AUTOPLAY_DRIVE_CDROM;
+ RegSetValueEx(hKey,szAutoPlayValue,0,REG_DWORD,(void*)&dwAutoPlay,dwSize);
+ RegCloseKey(hKey);
+ }
}
/****************************************************************************
@@ -121,20 +121,20 @@ static void LeaveFullScreen(void)
int retCode = PM_SUSPEND_APP;
if (backInGDI)
- return;
+ return;
if (suspendApp)
- retCode = suspendApp(PM_DEACTIVATE);
+ retCode = suspendApp(PM_DEACTIVATE);
RestoreAutoPlay();
backInGDI = true;
/* Now process messages normally until we are re-activated */
waitActive = true;
if (retCode != PM_NO_SUSPEND_APP) {
- while (waitActive) {
- _EVT_pumpMessages();
- Sleep(200);
- }
- }
+ while (waitActive) {
+ _EVT_pumpMessages();
+ Sleep(200);
+ }
+ }
}
/****************************************************************************
@@ -147,27 +147,27 @@ static void RestoreFullScreen(void)
static ibool firstTime = true;
if (firstTime) {
- /* Clear the message queue while waiting for the surfaces to be
- * restored.
- */
- firstTime = false;
- while (1) {
- /* Continue looping until out application has been restored
- * and we have reset the display mode.
- */
- _EVT_pumpMessages();
- if (GetActiveWindow() == _PM_hwndConsole) {
- if (suspendApp)
- suspendApp(PM_REACTIVATE);
- DisableAutoPlay();
- backInGDI = false;
- waitActive = false;
- firstTime = true;
- return;
- }
- Sleep(200);
- }
- }
+ /* Clear the message queue while waiting for the surfaces to be
+ * restored.
+ */
+ firstTime = false;
+ while (1) {
+ /* Continue looping until out application has been restored
+ * and we have reset the display mode.
+ */
+ _EVT_pumpMessages();
+ if (GetActiveWindow() == _PM_hwndConsole) {
+ if (suspendApp)
+ suspendApp(PM_REACTIVATE);
+ DisableAutoPlay();
+ backInGDI = false;
+ waitActive = false;
+ firstTime = true;
+ return;
+ }
+ Sleep(200);
+ }
+ }
}
/****************************************************************************
@@ -192,17 +192,17 @@ void PMAPI PM_doSuspendApp(void)
/* Call system DLL version if found */
if (_PM_imports.PM_doSuspendApp != PM_doSuspendApp) {
- _PM_imports.PM_doSuspendApp();
- return;
- }
+ _PM_imports.PM_doSuspendApp();
+ return;
+ }
if (firstTime) {
- if (suspendApp)
- suspendApp(PM_DEACTIVATE);
- RestoreAutoPlay();
- firstTime = false;
- backInGDI = true;
- }
+ if (suspendApp)
+ suspendApp(PM_DEACTIVATE);
+ RestoreAutoPlay();
+ firstTime = false;
+ backInGDI = true;
+ }
RestoreFullScreen();
firstTime = true;
}
@@ -220,60 +220,60 @@ static LONG CALLBACK PM_winProc(
LONG lParam)
{
switch (msg) {
- case WM_SYSCHAR:
- /* Stop Alt-Space from pausing our application */
- return 0;
- case WM_KEYDOWN:
- case WM_SYSKEYDOWN:
- if (HIWORD(lParam) & KF_REPEAT) {
- if (msg == WM_SYSKEYDOWN)
- return 0;
- break;
- }
- /* Fall through for keydown events */
- case WM_KEYUP:
- case WM_SYSKEYUP:
- if (msg == WM_SYSKEYDOWN || msg == WM_SYSKEYUP) {
- if ((HIWORD(lParam) & KF_ALTDOWN) && wParam == VK_RETURN)
- break;
- /* We ignore the remainder of the system keys to stop the
- * system menu from being activated from the keyboard and pausing
- * our app while fullscreen (ie: pressing the Alt key).
- */
- return 0;
- }
- break;
- case WM_SYSCOMMAND:
- switch (wParam & ~0x0F) {
- case SC_SCREENSAVE:
- case SC_MONITORPOWER:
- /* Ignore screensaver requests in fullscreen modes */
- return 0;
- }
- break;
- case WM_SIZE:
- if (waitActive && backInGDI && (wParam != SIZE_MINIMIZED)) {
- /* Start the re-activation process */
- PostMessage(hwnd,WM_DO_SUSPEND_APP,WM_PM_RESTORE_FULLSCREEN,0);
- }
- else if (!waitActive && isFullScreen && !backInGDI && (wParam == SIZE_MINIMIZED)) {
- /* Start the de-activation process */
- PostMessage(hwnd,WM_DO_SUSPEND_APP,WM_PM_LEAVE_FULLSCREEN,0);
- }
- break;
- case WM_DO_SUSPEND_APP:
- switch (wParam) {
+ case WM_SYSCHAR:
+ /* Stop Alt-Space from pausing our application */
+ return 0;
+ case WM_KEYDOWN:
+ case WM_SYSKEYDOWN:
+ if (HIWORD(lParam) & KF_REPEAT) {
+ if (msg == WM_SYSKEYDOWN)
+ return 0;
+ break;
+ }
+ /* Fall through for keydown events */
+ case WM_KEYUP:
+ case WM_SYSKEYUP:
+ if (msg == WM_SYSKEYDOWN || msg == WM_SYSKEYUP) {
+ if ((HIWORD(lParam) & KF_ALTDOWN) && wParam == VK_RETURN)
+ break;
+ /* We ignore the remainder of the system keys to stop the
+ * system menu from being activated from the keyboard and pausing
+ * our app while fullscreen (ie: pressing the Alt key).
+ */
+ return 0;
+ }
+ break;
+ case WM_SYSCOMMAND:
+ switch (wParam & ~0x0F) {
+ case SC_SCREENSAVE:
+ case SC_MONITORPOWER:
+ /* Ignore screensaver requests in fullscreen modes */
+ return 0;
+ }
+ break;
+ case WM_SIZE:
+ if (waitActive && backInGDI && (wParam != SIZE_MINIMIZED)) {
+ /* Start the re-activation process */
+ PostMessage(hwnd,WM_DO_SUSPEND_APP,WM_PM_RESTORE_FULLSCREEN,0);
+ }
+ else if (!waitActive && isFullScreen && !backInGDI && (wParam == SIZE_MINIMIZED)) {
+ /* Start the de-activation process */
+ PostMessage(hwnd,WM_DO_SUSPEND_APP,WM_PM_LEAVE_FULLSCREEN,0);
+ }
+ break;
+ case WM_DO_SUSPEND_APP:
+ switch (wParam) {
case WM_PM_RESTORE_FULLSCREEN:
RestoreFullScreen();
break;
case WM_PM_LEAVE_FULLSCREEN:
LeaveFullScreen();
break;
- }
- return 0;
- }
+ }
+ return 0;
+ }
if (oldWinProc)
- return oldWinProc(hwnd,msg,wParam,lParam);
+ return oldWinProc(hwnd,msg,wParam,lParam);
return DefWindowProc(hwnd,msg,wParam,lParam);
}
@@ -349,32 +349,32 @@ void * PMAPI PM_loadDirectDraw(
/* Call system DLL version if found */
if (_PM_imports.PM_loadDirectDraw != PM_loadDirectDraw)
- return _PM_imports.PM_loadDirectDraw(device);
+ return _PM_imports.PM_loadDirectDraw(device);
- // TODO: Handle multi-monitor!!
+ /* TODO: Handle multi-monitor!! */
if (device != 0)
- return NULL;
+ return NULL;
/* Load the DirectDraw DLL if not presently loaded */
GET_DEFAULT_CW();
if (!hInstDD) {
- hdc = GetDC(NULL);
- bits = GetDeviceCaps(hdc,BITSPIXEL);
- ReleaseDC(NULL,hdc);
- if (bits < 8)
- return NULL;
- if ((hInstDD = LoadLibrary("ddraw.dll")) == NULL)
- return NULL;
- pDirectDrawCreate = (void*)GetProcAddress(hInstDD,"DirectDrawCreate");
- if (!pDirectDrawCreate)
- return NULL;
- }
+ hdc = GetDC(NULL);
+ bits = GetDeviceCaps(hdc,BITSPIXEL);
+ ReleaseDC(NULL,hdc);
+ if (bits < 8)
+ return NULL;
+ if ((hInstDD = LoadLibrary("ddraw.dll")) == NULL)
+ return NULL;
+ pDirectDrawCreate = (void*)GetProcAddress(hInstDD,"DirectDrawCreate");
+ if (!pDirectDrawCreate)
+ return NULL;
+ }
/* Create the DirectDraw object */
if (!lpDD && pDirectDrawCreate(NULL, &lpDD, NULL) != DD_OK) {
- lpDD = NULL;
- return NULL;
- }
+ lpDD = NULL;
+ return NULL;
+ }
RESET_DEFAULT_CW();
return lpDD;
}
@@ -394,13 +394,13 @@ void PMAPI PM_unloadDirectDraw(
{
/* Call system DLL version if found */
if (_PM_imports.PM_unloadDirectDraw != PM_unloadDirectDraw) {
- _PM_imports.PM_unloadDirectDraw(device);
- return;
- }
+ _PM_imports.PM_unloadDirectDraw(device);
+ return;
+ }
if (lpDD) {
- IDirectDraw_Release(lpDD);
- lpDD = NULL;
- }
+ IDirectDraw_Release(lpDD);
+ lpDD = NULL;
+ }
(void)device;
}
@@ -423,56 +423,56 @@ PM_HWND PMAPI PM_openConsole(
/* Call system DLL version if found */
GA_getSystemPMImports();
if (_PM_imports.PM_openConsole != PM_openConsole) {
- if (fullScreen) {
- _PM_deskX = xRes;
- _PM_deskY = yRes;
- }
- return _PM_imports.PM_openConsole(hWndUser,device,xRes,yRes,bpp,fullScreen);
- }
+ if (fullScreen) {
+ _PM_deskX = xRes;
+ _PM_deskY = yRes;
+ }
+ return _PM_imports.PM_openConsole(hWndUser,device,xRes,yRes,bpp,fullScreen);
+ }
/* Create the fullscreen window if necessary */
hwndUser = hWndUser;
if (fullScreen) {
- if (!classRegistered) {
- /* Create a Window class for the fullscreen window in here, since
- * we need to register one that will do all our event handling for
- * us.
- */
- hInstApp = GetModuleHandle(NULL);
- cls.hCursor = LoadCursor(NULL,IDC_ARROW);
- cls.hIcon = LoadIcon(hInstApp,MAKEINTRESOURCE(1));
- cls.lpszMenuName = NULL;
- cls.lpszClassName = szWinClassName;
- cls.hbrBackground = GetStockObject(BLACK_BRUSH);
- cls.hInstance = hInstApp;
- cls.style = CS_DBLCLKS;
- cls.lpfnWndProc = PM_winProc;
- cls.cbWndExtra = 0;
- cls.cbClsExtra = 0;
- if (!RegisterClass(&cls))
- return NULL;
- classRegistered = true;
- }
- _PM_deskX = xRes;
- _PM_deskY = yRes;
- if (!hwndUser) {
- char windowTitle[80];
- if (LoadString(hInstApp,1,windowTitle,sizeof(windowTitle)) == 0)
- strcpy(windowTitle,"MGL Fullscreen Application");
- _PM_hwndConsole = CreateWindowEx(WS_EX_APPWINDOW,szWinClassName,
- windowTitle,WS_POPUP | WS_SYSMENU,0,0,xRes,yRes,
- NULL,NULL,hInstApp,NULL);
- }
- else {
- _PM_hwndConsole = _PM_convertUserWindow(hwndUser,xRes,yRes);
- }
- ShowCursor(false);
- isFullScreen = true;
- }
+ if (!classRegistered) {
+ /* Create a Window class for the fullscreen window in here, since
+ * we need to register one that will do all our event handling for
+ * us.
+ */
+ hInstApp = GetModuleHandle(NULL);
+ cls.hCursor = LoadCursor(NULL,IDC_ARROW);
+ cls.hIcon = LoadIcon(hInstApp,MAKEINTRESOURCE(1));
+ cls.lpszMenuName = NULL;
+ cls.lpszClassName = szWinClassName;
+ cls.hbrBackground = GetStockObject(BLACK_BRUSH);
+ cls.hInstance = hInstApp;
+ cls.style = CS_DBLCLKS;
+ cls.lpfnWndProc = PM_winProc;
+ cls.cbWndExtra = 0;
+ cls.cbClsExtra = 0;
+ if (!RegisterClass(&cls))
+ return NULL;
+ classRegistered = true;
+ }
+ _PM_deskX = xRes;
+ _PM_deskY = yRes;
+ if (!hwndUser) {
+ char windowTitle[80];
+ if (LoadString(hInstApp,1,windowTitle,sizeof(windowTitle)) == 0)
+ strcpy(windowTitle,"MGL Fullscreen Application");
+ _PM_hwndConsole = CreateWindowEx(WS_EX_APPWINDOW,szWinClassName,
+ windowTitle,WS_POPUP | WS_SYSMENU,0,0,xRes,yRes,
+ NULL,NULL,hInstApp,NULL);
+ }
+ else {
+ _PM_hwndConsole = _PM_convertUserWindow(hwndUser,xRes,yRes);
+ }
+ ShowCursor(false);
+ isFullScreen = true;
+ }
else {
- _PM_hwndConsole = hwndUser;
- isFullScreen = false;
- }
+ _PM_hwndConsole = hwndUser;
+ isFullScreen = false;
+ }
SetFocus(_PM_hwndConsole);
SetForegroundWindow(_PM_hwndConsole);
DisableAutoPlay();
@@ -488,7 +488,7 @@ int PMAPI PM_getConsoleStateSize(void)
{
/* Call system DLL version if found */
if (_PM_imports.PM_getConsoleStateSize != PM_getConsoleStateSize)
- return _PM_imports.PM_getConsoleStateSize();
+ return _PM_imports.PM_getConsoleStateSize();
/* Not used in Windows */
return 1;
@@ -504,9 +504,9 @@ void PMAPI PM_saveConsoleState(
{
/* Call system DLL version if found */
if (_PM_imports.PM_saveConsoleState != PM_saveConsoleState) {
- _PM_imports.PM_saveConsoleState(stateBuf,hwndConsole);
- return;
- }
+ _PM_imports.PM_saveConsoleState(stateBuf,hwndConsole);
+ return;
+ }
/* Not used in Windows */
(void)stateBuf;
@@ -522,9 +522,9 @@ void PMAPI PM_setSuspendAppCallback(
{
/* Call system DLL version if found */
if (_PM_imports.PM_setSuspendAppCallback != PM_setSuspendAppCallback) {
- _PM_imports.PM_setSuspendAppCallback(saveState);
- return;
- }
+ _PM_imports.PM_setSuspendAppCallback(saveState);
+ return;
+ }
suspendApp = saveState;
}
@@ -538,9 +538,9 @@ void PMAPI PM_restoreConsoleState(
{
/* Call system DLL version if found */
if (_PM_imports.PM_restoreConsoleState != PM_restoreConsoleState) {
- _PM_imports.PM_restoreConsoleState(stateBuf,hwndConsole);
- return;
- }
+ _PM_imports.PM_restoreConsoleState(stateBuf,hwndConsole);
+ return;
+ }
/* Not used in Windows */
(void)stateBuf;
@@ -556,15 +556,15 @@ void PMAPI PM_closeConsole(
{
/* Call system DLL version if found */
if (_PM_imports.PM_closeConsole != PM_closeConsole) {
- _PM_imports.PM_closeConsole(hwndConsole);
- return;
- }
+ _PM_imports.PM_closeConsole(hwndConsole);
+ return;
+ }
ShowCursor(true);
RestoreAutoPlay();
if (hwndUser)
- _PM_restoreUserWindow(hwndConsole);
+ _PM_restoreUserWindow(hwndConsole);
else
- DestroyWindow(hwndConsole);
+ DestroyWindow(hwndConsole);
hwndUser = NULL;
_PM_hwndConsole = NULL;
}
@@ -577,7 +577,6 @@ PM_HWND PMAPI PM_getDirectDrawWindow(void)
{
/* Call system DLL version if found */
if (_PM_imports.PM_getDirectDrawWindow != PM_getDirectDrawWindow)
- return _PM_imports.PM_getDirectDrawWindow();
+ return _PM_imports.PM_getDirectDrawWindow();
return _PM_hwndConsole;
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/win32/event.c b/board/MAI/bios_emulator/scitech/src/pm/win32/event.c
index c14377dcda..86448e32fa 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/win32/event.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/win32/event.c
@@ -70,143 +70,143 @@ void _EVT_pumpMessages(void)
MSG charMsg;
event_t evt;
- // TODO: Add support for DirectInput! We can't support relative mouse
- // movement motion counters without DirectInput ;-(.
+ /* TODO: Add support for DirectInput! We can't support relative mouse */
+ /* movement motion counters without DirectInput ;-(. */
while (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) {
- memset(&evt,0,sizeof(evt));
- switch (msg.message) {
- case WM_MOUSEMOVE:
- evt.what = EVT_MOUSEMOVE;
- break;
- case WM_LBUTTONDBLCLK:
- evt.what = EVT_MOUSEDOWN;
- evt.message = EVT_LEFTBMASK | EVT_DBLCLICK;
- break;
- case WM_LBUTTONDOWN:
- evt.what = EVT_MOUSEDOWN;
- evt.message = EVT_LEFTBMASK;
- break;
- case WM_LBUTTONUP:
- evt.what = EVT_MOUSEUP;
- evt.message = EVT_LEFTBMASK;
- break;
- case WM_RBUTTONDBLCLK:
- evt.what = EVT_MOUSEDOWN | EVT_DBLCLICK;
- evt.message = EVT_RIGHTBMASK;
- break;
- case WM_RBUTTONDOWN:
- evt.what = EVT_MOUSEDOWN;
- evt.message = EVT_RIGHTBMASK;
- break;
- case WM_RBUTTONUP:
- evt.what = EVT_MOUSEUP;
- evt.message = EVT_RIGHTBMASK;
- break;
- case WM_MBUTTONDBLCLK:
- evt.what = EVT_MOUSEDOWN | EVT_DBLCLICK;
- evt.message = EVT_MIDDLEBMASK;
- break;
- case WM_MBUTTONDOWN:
- evt.what = EVT_MOUSEDOWN;
- evt.message = EVT_MIDDLEBMASK;
- break;
- case WM_MBUTTONUP:
- evt.what = EVT_MOUSEUP;
- evt.message = EVT_MIDDLEBMASK;
- break;
- case WM_KEYDOWN:
- case WM_SYSKEYDOWN:
- if (HIWORD(msg.lParam) & KF_REPEAT) {
- evt.what = EVT_KEYREPEAT;
- }
- else {
- evt.what = EVT_KEYDOWN;
- }
- break;
- case WM_KEYUP:
- case WM_SYSKEYUP:
- evt.what = EVT_KEYUP;
- break;
- }
-
- /* Convert mouse event modifier flags */
- if (evt.what & EVT_MOUSEEVT) {
- if (_PM_deskX) {
- evt.where_x = ((long)msg.pt.x * rangeX) / _PM_deskX;
- evt.where_y = ((long)msg.pt.y * rangeY) / _PM_deskY;
- }
- else {
- ScreenToClient(_PM_hwndConsole, &msg.pt);
- evt.where_x = msg.pt.x;
- evt.where_y = msg.pt.y;
- }
- if (evt.what == EVT_MOUSEMOVE) {
- /* Save the current mouse position */
- EVT.mx = evt.where_x;
- EVT.my = evt.where_y;
- if (EVT.oldMove != -1) {
- EVT.evtq[EVT.oldMove].where_x = evt.where_x;/* Modify existing one */
- EVT.evtq[EVT.oldMove].where_y = evt.where_y;
-// EVT.evtq[EVT.oldMove].relative_x += mickeyX; // TODO!
-// EVT.evtq[EVT.oldMove].relative_y += mickeyY; // TODO!
- evt.what = 0;
- }
- else {
- EVT.oldMove = EVT.freeHead; /* Save id of this move event */
-// evt.relative_x = mickeyX; // TODO!
-// evt.relative_y = mickeyY; // TODO!
- }
- }
- else
- EVT.oldMove = -1;
- if (msg.wParam & MK_LBUTTON)
- evt.modifiers |= EVT_LEFTBUT;
- if (msg.wParam & MK_RBUTTON)
- evt.modifiers |= EVT_RIGHTBUT;
- if (msg.wParam & MK_MBUTTON)
- evt.modifiers |= EVT_MIDDLEBUT;
- if (msg.wParam & MK_SHIFT)
- evt.modifiers |= EVT_SHIFTKEY;
- if (msg.wParam & MK_CONTROL)
- evt.modifiers |= EVT_CTRLSTATE;
- }
-
- /* Convert keyboard codes */
- TranslateMessage(&msg);
- if (evt.what & EVT_KEYEVT) {
- int scanCode = (msg.lParam >> 16) & 0xFF;
- if (evt.what == EVT_KEYUP) {
- /* Get message for keyup code from table of cached down values */
- evt.message = keyUpMsg[scanCode];
- keyUpMsg[scanCode] = 0;
- }
- else {
- if (PeekMessage(&charMsg,NULL,WM_CHAR,WM_CHAR,PM_REMOVE))
- evt.message = charMsg.wParam;
- if (PeekMessage(&charMsg,NULL,WM_SYSCHAR,WM_SYSCHAR,PM_REMOVE))
- evt.message = charMsg.wParam;
- evt.message |= ((msg.lParam >> 8) & 0xFF00);
- keyUpMsg[scanCode] = (ushort)evt.message;
- }
- if (evt.what == EVT_KEYREPEAT)
- evt.message |= (msg.lParam << 16);
- if (HIWORD(msg.lParam) & KF_ALTDOWN)
- evt.modifiers |= EVT_ALTSTATE;
- if (GetKeyState(VK_SHIFT) & 0x8000U)
- evt.modifiers |= EVT_SHIFTKEY;
- if (GetKeyState(VK_CONTROL) & 0x8000U)
- evt.modifiers |= EVT_CTRLSTATE;
- EVT.oldMove = -1;
- }
-
- if (evt.what != 0) {
- /* Add time stamp and add the event to the queue */
- evt.when = msg.time;
- if (EVT.count < EVENTQSIZE)
- addEvent(&evt);
- }
- DispatchMessage(&msg);
- }
+ memset(&evt,0,sizeof(evt));
+ switch (msg.message) {
+ case WM_MOUSEMOVE:
+ evt.what = EVT_MOUSEMOVE;
+ break;
+ case WM_LBUTTONDBLCLK:
+ evt.what = EVT_MOUSEDOWN;
+ evt.message = EVT_LEFTBMASK | EVT_DBLCLICK;
+ break;
+ case WM_LBUTTONDOWN:
+ evt.what = EVT_MOUSEDOWN;
+ evt.message = EVT_LEFTBMASK;
+ break;
+ case WM_LBUTTONUP:
+ evt.what = EVT_MOUSEUP;
+ evt.message = EVT_LEFTBMASK;
+ break;
+ case WM_RBUTTONDBLCLK:
+ evt.what = EVT_MOUSEDOWN | EVT_DBLCLICK;
+ evt.message = EVT_RIGHTBMASK;
+ break;
+ case WM_RBUTTONDOWN:
+ evt.what = EVT_MOUSEDOWN;
+ evt.message = EVT_RIGHTBMASK;
+ break;
+ case WM_RBUTTONUP:
+ evt.what = EVT_MOUSEUP;
+ evt.message = EVT_RIGHTBMASK;
+ break;
+ case WM_MBUTTONDBLCLK:
+ evt.what = EVT_MOUSEDOWN | EVT_DBLCLICK;
+ evt.message = EVT_MIDDLEBMASK;
+ break;
+ case WM_MBUTTONDOWN:
+ evt.what = EVT_MOUSEDOWN;
+ evt.message = EVT_MIDDLEBMASK;
+ break;
+ case WM_MBUTTONUP:
+ evt.what = EVT_MOUSEUP;
+ evt.message = EVT_MIDDLEBMASK;
+ break;
+ case WM_KEYDOWN:
+ case WM_SYSKEYDOWN:
+ if (HIWORD(msg.lParam) & KF_REPEAT) {
+ evt.what = EVT_KEYREPEAT;
+ }
+ else {
+ evt.what = EVT_KEYDOWN;
+ }
+ break;
+ case WM_KEYUP:
+ case WM_SYSKEYUP:
+ evt.what = EVT_KEYUP;
+ break;
+ }
+
+ /* Convert mouse event modifier flags */
+ if (evt.what & EVT_MOUSEEVT) {
+ if (_PM_deskX) {
+ evt.where_x = ((long)msg.pt.x * rangeX) / _PM_deskX;
+ evt.where_y = ((long)msg.pt.y * rangeY) / _PM_deskY;
+ }
+ else {
+ ScreenToClient(_PM_hwndConsole, &msg.pt);
+ evt.where_x = msg.pt.x;
+ evt.where_y = msg.pt.y;
+ }
+ if (evt.what == EVT_MOUSEMOVE) {
+ /* Save the current mouse position */
+ EVT.mx = evt.where_x;
+ EVT.my = evt.where_y;
+ if (EVT.oldMove != -1) {
+ EVT.evtq[EVT.oldMove].where_x = evt.where_x;/* Modify existing one */
+ EVT.evtq[EVT.oldMove].where_y = evt.where_y;
+/* EVT.evtq[EVT.oldMove].relative_x += mickeyX; // TODO! */
+/* EVT.evtq[EVT.oldMove].relative_y += mickeyY; // TODO! */
+ evt.what = 0;
+ }
+ else {
+ EVT.oldMove = EVT.freeHead; /* Save id of this move event */
+/* evt.relative_x = mickeyX; // TODO! */
+/* evt.relative_y = mickeyY; // TODO! */
+ }
+ }
+ else
+ EVT.oldMove = -1;
+ if (msg.wParam & MK_LBUTTON)
+ evt.modifiers |= EVT_LEFTBUT;
+ if (msg.wParam & MK_RBUTTON)
+ evt.modifiers |= EVT_RIGHTBUT;
+ if (msg.wParam & MK_MBUTTON)
+ evt.modifiers |= EVT_MIDDLEBUT;
+ if (msg.wParam & MK_SHIFT)
+ evt.modifiers |= EVT_SHIFTKEY;
+ if (msg.wParam & MK_CONTROL)
+ evt.modifiers |= EVT_CTRLSTATE;
+ }
+
+ /* Convert keyboard codes */
+ TranslateMessage(&msg);
+ if (evt.what & EVT_KEYEVT) {
+ int scanCode = (msg.lParam >> 16) & 0xFF;
+ if (evt.what == EVT_KEYUP) {
+ /* Get message for keyup code from table of cached down values */
+ evt.message = keyUpMsg[scanCode];
+ keyUpMsg[scanCode] = 0;
+ }
+ else {
+ if (PeekMessage(&charMsg,NULL,WM_CHAR,WM_CHAR,PM_REMOVE))
+ evt.message = charMsg.wParam;
+ if (PeekMessage(&charMsg,NULL,WM_SYSCHAR,WM_SYSCHAR,PM_REMOVE))
+ evt.message = charMsg.wParam;
+ evt.message |= ((msg.lParam >> 8) & 0xFF00);
+ keyUpMsg[scanCode] = (ushort)evt.message;
+ }
+ if (evt.what == EVT_KEYREPEAT)
+ evt.message |= (msg.lParam << 16);
+ if (HIWORD(msg.lParam) & KF_ALTDOWN)
+ evt.modifiers |= EVT_ALTSTATE;
+ if (GetKeyState(VK_SHIFT) & 0x8000U)
+ evt.modifiers |= EVT_SHIFTKEY;
+ if (GetKeyState(VK_CONTROL) & 0x8000U)
+ evt.modifiers |= EVT_CTRLSTATE;
+ EVT.oldMove = -1;
+ }
+
+ if (evt.what != 0) {
+ /* Add time stamp and add the event to the queue */
+ evt.when = msg.time;
+ if (EVT.count < EVENTQSIZE)
+ addEvent(&evt);
+ }
+ DispatchMessage(&msg);
+ }
}
/****************************************************************************
@@ -299,7 +299,7 @@ and this function can be used to resume it again later.
****************************************************************************/
void EVT_resume(void)
{
- // Do nothing for Win32
+ /* Do nothing for Win32 */
}
/****************************************************************************
@@ -309,7 +309,7 @@ de-install the event handling code.
****************************************************************************/
void EVT_suspend(void)
{
- // Do nothing for Win32
+ /* Do nothing for Win32 */
}
/****************************************************************************
@@ -343,7 +343,7 @@ EVT_joySetLowerRight, EVT_joySetCenter, EVT_joyIsPresent
****************************************************************************/
int EVTAPI EVT_joyIsPresent(void)
{
- // TODO: Implement joystick code based on DirectX!
+ /* TODO: Implement joystick code based on DirectX! */
return 0;
}
@@ -362,9 +362,9 @@ All information polled from the joystick will be posted to the event
queue for later retrieval.
Note: Most analogue joysticks will provide readings that change even
- though the joystick has not moved. Hence if you call this routine
- you will likely get an EVT_JOYMOVE event every time through your
- event loop.
+ though the joystick has not moved. Hence if you call this routine
+ you will likely get an EVT_JOYMOVE event every time through your
+ event loop.
SEE ALSO:
EVT_getNext, EVT_peekNext, EVT_joySetUpperLeft, EVT_joySetLowerRight,
@@ -457,4 +457,3 @@ EVT_joySetUpperLeft, EVT_joySetLowerRight, EVT_joySetCenter
void EVTAPI EVT_joySetCenter(void)
{
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/win32/ntservc.c b/board/MAI/bios_emulator/scitech/src/pm/win32/ntservc.c
index a3324d33b8..59d9aa0c7c 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/win32/ntservc.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/win32/ntservc.c
@@ -64,63 +64,63 @@ ulong PMAPI PM_installService(
char keyPath[MAX_PATH];
ulong status;
- // Obtain a handle to the service control manager requesting all access
+ /* Obtain a handle to the service control manager requesting all access */
if ((scmHandle = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS)) == NULL)
- return GetLastError();
+ return GetLastError();
- // Find the path to the driver in system directory
+ /* Find the path to the driver in system directory */
GetSystemDirectory(szDriverPath, sizeof(szDriverPath));
strcat(szDriverPath, "\\drivers\\");
strcat(szDriverPath, szDriverName);
- // Create the service with the Service Control Manager.
+ /* Create the service with the Service Control Manager. */
driverHandle = CreateService(scmHandle,
- szServiceName,
- szServiceName,
- SERVICE_ALL_ACCESS,
- dwServiceType,
- SERVICE_BOOT_START,
- SERVICE_ERROR_NORMAL,
- szDriverPath,
- szLoadGroup,
- NULL,
- NULL,
- NULL,
- NULL);
-
- // Check to see if the driver could actually be installed.
+ szServiceName,
+ szServiceName,
+ SERVICE_ALL_ACCESS,
+ dwServiceType,
+ SERVICE_BOOT_START,
+ SERVICE_ERROR_NORMAL,
+ szDriverPath,
+ szLoadGroup,
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+
+ /* Check to see if the driver could actually be installed. */
if (!driverHandle) {
- status = GetLastError();
- CloseServiceHandle(scmHandle);
- return status;
- }
+ status = GetLastError();
+ CloseServiceHandle(scmHandle);
+ return status;
+ }
- // Get a handle to the key for driver so that it can be altered in the
- // next step.
+ /* Get a handle to the key for driver so that it can be altered in the */
+ /* next step. */
strcpy(keyPath, "SYSTEM\\CurrentControlSet\\Services\\");
strcat(keyPath, szServiceName);
if ((status = RegOpenKeyEx(HKEY_LOCAL_MACHINE,keyPath,0,KEY_ALL_ACCESS,&key)) != ERROR_SUCCESS) {
- // A problem has occured. Delete the service so that it is not installed.
- status = GetLastError();
- DeleteService(driverHandle);
- CloseServiceHandle(driverHandle);
- CloseServiceHandle(scmHandle);
- return status;
- }
-
- // Delete the ImagePath value in the newly created key so that the
- // system looks for the driver in the normal location.
+ /* A problem has occured. Delete the service so that it is not installed. */
+ status = GetLastError();
+ DeleteService(driverHandle);
+ CloseServiceHandle(driverHandle);
+ CloseServiceHandle(scmHandle);
+ return status;
+ }
+
+ /* Delete the ImagePath value in the newly created key so that the */
+ /* system looks for the driver in the normal location. */
if ((status = RegDeleteValue(key, "ImagePath")) != ERROR_SUCCESS) {
- // A problem has occurred. Delete the service so that it is not
- // installed and will not try to start.
- RegCloseKey(key);
- DeleteService(driverHandle);
- CloseServiceHandle(driverHandle);
- CloseServiceHandle(scmHandle);
- return status;
- }
-
- // Clean up and exit
+ /* A problem has occurred. Delete the service so that it is not */
+ /* installed and will not try to start. */
+ RegCloseKey(key);
+ DeleteService(driverHandle);
+ CloseServiceHandle(driverHandle);
+ CloseServiceHandle(scmHandle);
+ return status;
+ }
+
+ /* Clean up and exit */
RegCloseKey(key);
CloseServiceHandle(driverHandle);
CloseServiceHandle(scmHandle);
@@ -145,32 +145,32 @@ ulong PMAPI PM_startService(
SERVICE_STATUS serviceStatus;
ulong status;
- // Obtain a handle to the service control manager requesting all access
+ /* Obtain a handle to the service control manager requesting all access */
if ((scmHandle = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS)) == NULL)
- return GetLastError();
+ return GetLastError();
- // Open the service with the Service Control Manager.
+ /* Open the service with the Service Control Manager. */
if ((driverHandle = OpenService(scmHandle,szServiceName,SERVICE_ALL_ACCESS)) == NULL) {
- status = GetLastError();
- CloseServiceHandle(scmHandle);
- return status;
- }
+ status = GetLastError();
+ CloseServiceHandle(scmHandle);
+ return status;
+ }
- // Start the service
+ /* Start the service */
if (!StartService(driverHandle,0,NULL)) {
- status = GetLastError();
- CloseServiceHandle(driverHandle);
- CloseServiceHandle(scmHandle);
- return status;
- }
-
- // Query the service to make sure it is there
- if (!QueryServiceStatus(driverHandle,&serviceStatus)) {
- status = GetLastError();
- CloseServiceHandle(driverHandle);
- CloseServiceHandle(scmHandle);
- return status;
- }
+ status = GetLastError();
+ CloseServiceHandle(driverHandle);
+ CloseServiceHandle(scmHandle);
+ return status;
+ }
+
+ /* Query the service to make sure it is there */
+ if (!QueryServiceStatus(driverHandle,&serviceStatus)) {
+ status = GetLastError();
+ CloseServiceHandle(driverHandle);
+ CloseServiceHandle(scmHandle);
+ return status;
+ }
CloseServiceHandle(driverHandle);
CloseServiceHandle(scmHandle);
return ERROR_SUCCESS;
@@ -194,24 +194,24 @@ ulong PMAPI PM_stopService(
SERVICE_STATUS serviceStatus;
ulong status;
- // Obtain a handle to the service control manager requesting all access
+ /* Obtain a handle to the service control manager requesting all access */
if ((scmHandle = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS)) == NULL)
- return GetLastError();
+ return GetLastError();
- // Open the service with the Service Control Manager.
+ /* Open the service with the Service Control Manager. */
if ((driverHandle = OpenService(scmHandle,szServiceName,SERVICE_ALL_ACCESS)) == NULL) {
- status = GetLastError();
- CloseServiceHandle(scmHandle);
- return status;
- }
+ status = GetLastError();
+ CloseServiceHandle(scmHandle);
+ return status;
+ }
- // Stop the service from running
+ /* Stop the service from running */
if (!ControlService(driverHandle, SERVICE_CONTROL_STOP, &serviceStatus)) {
- status = GetLastError();
- CloseServiceHandle(driverHandle);
- CloseServiceHandle(scmHandle);
- return status;
- }
+ status = GetLastError();
+ CloseServiceHandle(driverHandle);
+ CloseServiceHandle(scmHandle);
+ return status;
+ }
CloseServiceHandle(driverHandle);
CloseServiceHandle(scmHandle);
return ERROR_SUCCESS;
@@ -234,26 +234,25 @@ ulong PMAPI PM_removeService(
SC_HANDLE driverHandle;
ulong status;
- // Obtain a handle to the service control manager requesting all access
+ /* Obtain a handle to the service control manager requesting all access */
if ((scmHandle = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS)) == NULL)
- return GetLastError();
+ return GetLastError();
- // Open the service with the Service Control Manager.
+ /* Open the service with the Service Control Manager. */
if ((driverHandle = OpenService(scmHandle,szServiceName,SERVICE_ALL_ACCESS)) == NULL) {
- status = GetLastError();
- CloseServiceHandle(scmHandle);
- return status;
- }
+ status = GetLastError();
+ CloseServiceHandle(scmHandle);
+ return status;
+ }
- // Remove the service
+ /* Remove the service */
if (!DeleteService(driverHandle)) {
- status = GetLastError();
- CloseServiceHandle(driverHandle);
- CloseServiceHandle(scmHandle);
- return status;
- }
+ status = GetLastError();
+ CloseServiceHandle(driverHandle);
+ CloseServiceHandle(scmHandle);
+ return status;
+ }
CloseServiceHandle(driverHandle);
CloseServiceHandle(scmHandle);
return ERROR_SUCCESS;
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/win32/oshdr.h b/board/MAI/bios_emulator/scitech/src/pm/win32/oshdr.h
index 018c936d8a..0c59e9006f 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/win32/oshdr.h
+++ b/board/MAI/bios_emulator/scitech/src/pm/win32/oshdr.h
@@ -47,7 +47,7 @@
#define GET_DEFAULT_CW() \
{ \
if (_PM_cw_default == 0) \
- _PM_cw_default = _control87(0,0); \
+ _PM_cw_default = _control87(0,0); \
}
#define RESET_DEFAULT_CW() \
_control87(_PM_cw_default,0xFFFFFFFF)
@@ -77,4 +77,3 @@ extern HWND _PM_hwndConsole; /* Window handle for console */
/*-------------------------- Internal Functions ---------------------------*/
void _EVT_pumpMessages(void);
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/win32/pm.c b/board/MAI/bios_emulator/scitech/src/pm/win32/pm.c
index d08da4c630..1ffdbccabc 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/win32/pm.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/win32/pm.c
@@ -69,10 +69,10 @@ static char *szMachineName = "ComputerName";
#define CHECK_FOR_PMHELP() \
{ \
if (_PM_hDevice == INVALID_HANDLE_VALUE) \
- if (_PM_haveWinNT) \
- PM_fatalError("Unable to connect to PMHELP.SYS or SDDHELP.SYS!"); \
- else \
- PM_fatalError("Unable to connect to PMHELP.VXD or SDDHELP.VXD!"); \
+ if (_PM_haveWinNT) \
+ PM_fatalError("Unable to connect to PMHELP.SYS or SDDHELP.SYS!"); \
+ else \
+ PM_fatalError("Unable to connect to PMHELP.VXD or SDDHELP.VXD!"); \
}
/****************************************************************************
@@ -95,71 +95,71 @@ void PMAPI PM_init(void)
* of SDD is loaded, we use the PMHELP VxD instead.
*/
if (!inited) {
- /* Determine if we are running under Windows NT or not and
- * set the global OS type variable.
- */
- _PM_haveWinNT = false;
- if ((GetVersion() & 0x80000000UL) == 0)
- _PM_haveWinNT = true;
- ___drv_os_type = (_PM_haveWinNT) ? _OS_WINNT : _OS_WIN95;
-
- /* Now try to connect to SDDHELP.VXD or SDDHELP.SYS */
- _PM_hDevice = CreateFile(SDDHELP_MODULE_PATH, 0,0,0, CREATE_NEW, FILE_FLAG_DELETE_ON_CLOSE, 0);
- if (_PM_hDevice != INVALID_HANDLE_VALUE) {
- if (!DeviceIoControl(_PM_hDevice, PMHELP_GETVER32, NULL, 0,
- outBuf, sizeof(outBuf), &count, NULL) || outBuf[0] < PMHELP_VERSION) {
- /* Old version of SDDHELP loaded, so use PMHELP instead */
- CloseHandle(_PM_hDevice);
- _PM_hDevice = INVALID_HANDLE_VALUE;
- }
- }
- if (_PM_hDevice == INVALID_HANDLE_VALUE) {
- /* First try to see if there is a currently loaded PMHELP driver.
- * This is usually the case when we are running under Windows NT/2K.
- */
- _PM_hDevice = CreateFile(PMHELP_MODULE_PATH, 0,0,0, CREATE_NEW, FILE_FLAG_DELETE_ON_CLOSE, 0);
- if (_PM_hDevice == INVALID_HANDLE_VALUE) {
- /* The driver was not staticly loaded, so try creating a file handle
- * to a dynamic version of the VxD if possible. Note that on WinNT/2K we
- * cannot support dynamically loading the drivers.
- */
- _PM_hDevice = CreateFile(PMHELP_VXD_PATH, 0,0,0, CREATE_NEW, FILE_FLAG_DELETE_ON_CLOSE, 0);
- }
- }
- if (_PM_hDevice != INVALID_HANDLE_VALUE) {
- /* Call the driver to determine the version number */
- if (!DeviceIoControl(_PM_hDevice, PMHELP_GETVER32, inBuf, sizeof(inBuf),
- outBuf, sizeof(outBuf), &count, NULL) || outBuf[0] < PMHELP_VERSION) {
- if (_PM_haveWinNT)
- PM_fatalError("Older version of PMHELP.SYS found!");
- else
- PM_fatalError("Older version of PMHELP.VXD found!");
- }
-
- /* Now set the current path inside the VxD so it knows what the
- * current directory is for loading Nucleus drivers.
- */
- inBuf[0] = (ulong)PM_getCurrentPath(cntPath,sizeof(cntPath));
- if (!DeviceIoControl(_PM_hDevice, PMHELP_SETCNTPATH32, inBuf, sizeof(inBuf), outBuf, sizeof(outBuf), &count, NULL))
- PM_fatalError("Unable to set VxD current path!");
-
- /* Now pass down the NUCLEUS_PATH environment variable to the device
- * driver so it can use this value if it is found.
- */
- if ((env = getenv("NUCLEUS_PATH")) != NULL) {
- inBuf[0] = (ulong)env;
- if (!DeviceIoControl(_PM_hDevice, PMHELP_SETNUCLEUSPATH32, inBuf, sizeof(inBuf), outBuf, sizeof(outBuf), &count, NULL))
- PM_fatalError("Unable to set VxD Nucleus path!");
- }
-
- /* Enable IOPL for ring-3 code by default if driver is present */
- if (_PM_haveWinNT)
- PM_setIOPL(3);
- }
-
- /* Indicate that we have been initialised */
- inited = true;
- }
+ /* Determine if we are running under Windows NT or not and
+ * set the global OS type variable.
+ */
+ _PM_haveWinNT = false;
+ if ((GetVersion() & 0x80000000UL) == 0)
+ _PM_haveWinNT = true;
+ ___drv_os_type = (_PM_haveWinNT) ? _OS_WINNT : _OS_WIN95;
+
+ /* Now try to connect to SDDHELP.VXD or SDDHELP.SYS */
+ _PM_hDevice = CreateFile(SDDHELP_MODULE_PATH, 0,0,0, CREATE_NEW, FILE_FLAG_DELETE_ON_CLOSE, 0);
+ if (_PM_hDevice != INVALID_HANDLE_VALUE) {
+ if (!DeviceIoControl(_PM_hDevice, PMHELP_GETVER32, NULL, 0,
+ outBuf, sizeof(outBuf), &count, NULL) || outBuf[0] < PMHELP_VERSION) {
+ /* Old version of SDDHELP loaded, so use PMHELP instead */
+ CloseHandle(_PM_hDevice);
+ _PM_hDevice = INVALID_HANDLE_VALUE;
+ }
+ }
+ if (_PM_hDevice == INVALID_HANDLE_VALUE) {
+ /* First try to see if there is a currently loaded PMHELP driver.
+ * This is usually the case when we are running under Windows NT/2K.
+ */
+ _PM_hDevice = CreateFile(PMHELP_MODULE_PATH, 0,0,0, CREATE_NEW, FILE_FLAG_DELETE_ON_CLOSE, 0);
+ if (_PM_hDevice == INVALID_HANDLE_VALUE) {
+ /* The driver was not staticly loaded, so try creating a file handle
+ * to a dynamic version of the VxD if possible. Note that on WinNT/2K we
+ * cannot support dynamically loading the drivers.
+ */
+ _PM_hDevice = CreateFile(PMHELP_VXD_PATH, 0,0,0, CREATE_NEW, FILE_FLAG_DELETE_ON_CLOSE, 0);
+ }
+ }
+ if (_PM_hDevice != INVALID_HANDLE_VALUE) {
+ /* Call the driver to determine the version number */
+ if (!DeviceIoControl(_PM_hDevice, PMHELP_GETVER32, inBuf, sizeof(inBuf),
+ outBuf, sizeof(outBuf), &count, NULL) || outBuf[0] < PMHELP_VERSION) {
+ if (_PM_haveWinNT)
+ PM_fatalError("Older version of PMHELP.SYS found!");
+ else
+ PM_fatalError("Older version of PMHELP.VXD found!");
+ }
+
+ /* Now set the current path inside the VxD so it knows what the
+ * current directory is for loading Nucleus drivers.
+ */
+ inBuf[0] = (ulong)PM_getCurrentPath(cntPath,sizeof(cntPath));
+ if (!DeviceIoControl(_PM_hDevice, PMHELP_SETCNTPATH32, inBuf, sizeof(inBuf), outBuf, sizeof(outBuf), &count, NULL))
+ PM_fatalError("Unable to set VxD current path!");
+
+ /* Now pass down the NUCLEUS_PATH environment variable to the device
+ * driver so it can use this value if it is found.
+ */
+ if ((env = getenv("NUCLEUS_PATH")) != NULL) {
+ inBuf[0] = (ulong)env;
+ if (!DeviceIoControl(_PM_hDevice, PMHELP_SETNUCLEUSPATH32, inBuf, sizeof(inBuf), outBuf, sizeof(outBuf), &count, NULL))
+ PM_fatalError("Unable to set VxD Nucleus path!");
+ }
+
+ /* Enable IOPL for ring-3 code by default if driver is present */
+ if (_PM_haveWinNT)
+ PM_setIOPL(3);
+ }
+
+ /* Indicate that we have been initialised */
+ inited = true;
+ }
}
/****************************************************************************
@@ -177,14 +177,14 @@ int PMAPI PM_setIOPL(
/* Enable I/O by adjusting the I/O permissions map on Windows NT */
if (_PM_haveWinNT) {
- CHECK_FOR_PMHELP();
- if (iopl == 3)
- DeviceIoControl(_PM_hDevice, PMHELP_ENABLERING3IOPL, inBuf, sizeof(inBuf),outBuf, sizeof(outBuf), &count, NULL);
- else
- DeviceIoControl(_PM_hDevice, PMHELP_DISABLERING3IOPL, inBuf, sizeof(inBuf),outBuf, sizeof(outBuf), &count, NULL);
- cntIOPL = iopl;
- return oldIOPL;
- }
+ CHECK_FOR_PMHELP();
+ if (iopl == 3)
+ DeviceIoControl(_PM_hDevice, PMHELP_ENABLERING3IOPL, inBuf, sizeof(inBuf),outBuf, sizeof(outBuf), &count, NULL);
+ else
+ DeviceIoControl(_PM_hDevice, PMHELP_DISABLERING3IOPL, inBuf, sizeof(inBuf),outBuf, sizeof(outBuf), &count, NULL);
+ cntIOPL = iopl;
+ return oldIOPL;
+ }
/* We always have IOPL on Windows 9x */
return 3;
@@ -197,9 +197,9 @@ We do have BIOS access under Windows 9x, but not under Windows NT.
ibool PMAPI PM_haveBIOSAccess(void)
{
if (PM_getOSType() == _OS_WINNT)
- return false;
+ return false;
else
- return _PM_hDevice != INVALID_HANDLE_VALUE;
+ return _PM_hDevice != INVALID_HANDLE_VALUE;
}
/****************************************************************************
@@ -209,9 +209,9 @@ Return the operating system type identifier.
long PMAPI PM_getOSType(void)
{
if ((GetVersion() & 0x80000000UL) == 0)
- return ___drv_os_type = _OS_WINNT;
+ return ___drv_os_type = _OS_WINNT;
else
- return ___drv_os_type = _OS_WIN95;
+ return ___drv_os_type = _OS_WIN95;
}
/****************************************************************************
@@ -232,9 +232,9 @@ void PMAPI PM_backslash(
{
uint pos = strlen(s);
if (s[pos-1] != '\\') {
- s[pos] = '\\';
- s[pos+1] = '\0';
- }
+ s[pos] = '\\';
+ s[pos+1] = '\0';
+ }
}
/****************************************************************************
@@ -255,7 +255,7 @@ void PMAPI PM_fatalError(
const char *msg)
{
if (fatalErrorCleanup)
- fatalErrorCleanup();
+ fatalErrorCleanup();
MessageBox(NULL,msg,"Fatal Error!", MB_ICONEXCLAMATION);
exit(1);
}
@@ -279,19 +279,19 @@ void * PMAPI PM_getVESABuf(
* memory blocks out of order).
*/
if (!inited)
- PM_init();
+ PM_init();
if (!VESABuf_ptr) {
- CHECK_FOR_PMHELP();
- if (DeviceIoControl(_PM_hDevice, PMHELP_GETVESABUF32, NULL, 0,
- outBuf, sizeof(outBuf), &count, NULL)) {
- if (!outBuf[0])
- return NULL;
- VESABuf_ptr = (void*)outBuf[0];
- VESABuf_len = outBuf[1];
- VESABuf_rseg = outBuf[2];
- VESABuf_roff = outBuf[3];
- }
- }
+ CHECK_FOR_PMHELP();
+ if (DeviceIoControl(_PM_hDevice, PMHELP_GETVESABUF32, NULL, 0,
+ outBuf, sizeof(outBuf), &count, NULL)) {
+ if (!outBuf[0])
+ return NULL;
+ VESABuf_ptr = (void*)outBuf[0];
+ VESABuf_len = outBuf[1];
+ VESABuf_rseg = outBuf[2];
+ VESABuf_roff = outBuf[3];
+ }
+ }
*len = VESABuf_len;
*rseg = VESABuf_rseg;
*roff = VESABuf_roff;
@@ -405,7 +405,7 @@ static ibool REG_queryStringEx(
DWORD type;
if (RegQueryValueEx(hKey,(PCHAR)szValue,(PDWORD)NULL,(PDWORD)&type,(LPBYTE)value,(PDWORD)&size) == ERROR_SUCCESS)
- return true;
+ return true;
return false;
}
@@ -424,9 +424,9 @@ static ibool REG_queryString(
memset(value,0,sizeof(value));
if (RegOpenKey(HKEY_LOCAL_MACHINE,szKey,&hKey) == ERROR_SUCCESS) {
- status = REG_queryStringEx(hKey,szValue,value,size);
- RegCloseKey(hKey);
- }
+ status = REG_queryStringEx(hKey,szValue,value,size);
+ RegCloseKey(hKey);
+ }
return status;
}
@@ -460,7 +460,7 @@ const char * PMAPI PM_getNucleusPath(void)
char *env;
if ((env = getenv("NUCLEUS_PATH")) != NULL)
- return env;
+ return env;
GetSystemDirectory(path,sizeof(path));
strcat(path,"\\nucleus");
return path;
@@ -497,9 +497,9 @@ const char * PMAPI PM_getMachineName(void)
static char name[256];
if (REG_queryString(szMachineNameKey,szMachineName,name,sizeof(name)))
- return name;
+ return name;
if (REG_queryString(szMachineNameKeyNT,szMachineName,name,sizeof(name)))
- return name;
+ return name;
return "Unknown";
}
@@ -510,13 +510,13 @@ Return a pointer to the real mode BIOS data area.
void * PMAPI PM_getBIOSPointer(void)
{
if (_PM_haveWinNT) {
- /* On Windows NT we have to map it physically directly */
+ /* On Windows NT we have to map it physically directly */
return PM_mapPhysicalAddr(0x400, 0x1000, true);
- }
+ }
else {
- /* For Windows 9x we can access this memory directly */
- return (void*)0x400;
- }
+ /* For Windows 9x we can access this memory directly */
+ return (void*)0x400;
+ }
}
/****************************************************************************
@@ -526,16 +526,16 @@ Return a pointer to 0xA0000 physical VGA graphics framebuffer.
void * PMAPI PM_getA0000Pointer(void)
{
if (_PM_haveWinNT) {
- /* On Windows NT we have to map it physically directly */
+ /* On Windows NT we have to map it physically directly */
return PM_mapPhysicalAddr(0xA0000, 0x0FFFF, false);
- }
+ }
else {
- /* Always use the 0xA0000 linear address so that we will use
- * whatever page table mappings are set up for us (ie: for virtual
- * bank switching.
- */
- return (void*)0xA0000;
- }
+ /* Always use the 0xA0000 linear address so that we will use
+ * whatever page table mappings are set up for us (ie: for virtual
+ * bank switching.
+ */
+ return (void*)0xA0000;
+ }
}
/****************************************************************************
@@ -552,14 +552,14 @@ void * PMAPI PM_mapPhysicalAddr(
DWORD count; /* Count of bytes returned from VxD */
if (!inited)
- PM_init();
+ PM_init();
inBuf[0] = base;
inBuf[1] = limit;
inBuf[2] = isCached;
CHECK_FOR_PMHELP();
if (DeviceIoControl(_PM_hDevice, PMHELP_MAPPHYS32, inBuf, sizeof(inBuf),
- outBuf, sizeof(outBuf), &count, NULL))
- return (void*)outBuf[0];
+ outBuf, sizeof(outBuf), &count, NULL))
+ return (void*)outBuf[0];
return NULL;
}
@@ -590,12 +590,12 @@ ulong PMAPI PM_getPhysicalAddr(
DWORD count; /* Count of bytes returned from VxD */
if (!inited)
- PM_init();
+ PM_init();
inBuf[0] = (ulong)p;
CHECK_FOR_PMHELP();
if (DeviceIoControl(_PM_hDevice, PMHELP_GETPHYSICALADDR32, inBuf, sizeof(inBuf),
- outBuf, sizeof(outBuf), &count, NULL))
- return outBuf[0];
+ outBuf, sizeof(outBuf), &count, NULL))
+ return outBuf[0];
return 0xFFFFFFFFUL;
}
@@ -613,14 +613,14 @@ ibool PMAPI PM_getPhysicalAddrRange(
DWORD count; /* Count of bytes returned from VxD */
if (!inited)
- PM_init();
+ PM_init();
inBuf[0] = (ulong)p;
inBuf[1] = (ulong)length;
inBuf[2] = (ulong)physAddress;
CHECK_FOR_PMHELP();
if (DeviceIoControl(_PM_hDevice, PMHELP_GETPHYSICALADDRRANGE32, inBuf, sizeof(inBuf),
- outBuf, sizeof(outBuf), &count, NULL))
- return outBuf[0];
+ outBuf, sizeof(outBuf), &count, NULL))
+ return outBuf[0];
return false;
}
@@ -640,14 +640,14 @@ Return the base I/O port for the specified COM port.
****************************************************************************/
int PMAPI PM_getCOMPort(int port)
{
- // TODO: Re-code this to determine real values using the Plug and Play
- // manager for the OS.
+ /* TODO: Re-code this to determine real values using the Plug and Play */
+ /* manager for the OS. */
switch (port) {
- case 0: return 0x3F8;
- case 1: return 0x2F8;
- case 2: return 0x3E8;
- case 3: return 0x2E8;
- }
+ case 0: return 0x3F8;
+ case 1: return 0x2F8;
+ case 2: return 0x3E8;
+ case 3: return 0x2E8;
+ }
return 0;
}
@@ -657,13 +657,13 @@ Return the base I/O port for the specified LPT port.
****************************************************************************/
int PMAPI PM_getLPTPort(int port)
{
- // TODO: Re-code this to determine real values using the Plug and Play
- // manager for the OS.
+ /* TODO: Re-code this to determine real values using the Plug and Play */
+ /* manager for the OS. */
switch (port) {
- case 0: return 0x3BC;
- case 1: return 0x378;
- case 2: return 0x278;
- }
+ case 0: return 0x3BC;
+ case 1: return 0x378;
+ case 2: return 0x278;
+ }
return 0;
}
@@ -685,8 +685,8 @@ void * PMAPI PM_mallocShared(
inBuf[0] = size;
CHECK_FOR_PMHELP();
if (DeviceIoControl(_PM_hDevice, PMHELP_MALLOCSHARED32, inBuf, sizeof(inBuf),
- outBuf, sizeof(outBuf), &count, NULL))
- return (void*)outBuf[0];
+ outBuf, sizeof(outBuf), &count, NULL))
+ return (void*)outBuf[0];
return NULL;
}
@@ -772,12 +772,12 @@ void PMAPI DPMI_int86(
DWORD count; /* Count of bytes returned from VxD */
if (!inited)
- PM_init();
+ PM_init();
inBuf[0] = intno;
inBuf[1] = (ulong)regs;
CHECK_FOR_PMHELP();
DeviceIoControl(_PM_hDevice, PMHELP_DPMIINT8632, inBuf, sizeof(inBuf),
- NULL, 0, &count, NULL);
+ NULL, 0, &count, NULL);
}
/****************************************************************************
@@ -794,14 +794,14 @@ int PMAPI PM_int86(
DWORD count; /* Count of bytes returned from VxD */
if (!inited)
- PM_init();
+ PM_init();
inBuf[0] = intno;
inBuf[1] = (ulong)in;
inBuf[2] = (ulong)out;
CHECK_FOR_PMHELP();
if (DeviceIoControl(_PM_hDevice, PMHELP_INT8632, inBuf, sizeof(inBuf),
- outBuf, sizeof(outBuf), &count, NULL))
- return outBuf[0];
+ outBuf, sizeof(outBuf), &count, NULL))
+ return outBuf[0];
return 0;
}
@@ -820,15 +820,15 @@ int PMAPI PM_int86x(
DWORD count; /* Count of bytes returned from VxD */
if (!inited)
- PM_init();
+ PM_init();
inBuf[0] = intno;
inBuf[1] = (ulong)in;
inBuf[2] = (ulong)out;
inBuf[3] = (ulong)sregs;
CHECK_FOR_PMHELP();
if (DeviceIoControl(_PM_hDevice, PMHELP_INT86X32, inBuf, sizeof(inBuf),
- outBuf, sizeof(outBuf), &count, NULL))
- return outBuf[0];
+ outBuf, sizeof(outBuf), &count, NULL))
+ return outBuf[0];
return 0;
}
@@ -846,14 +846,14 @@ void PMAPI PM_callRealMode(
DWORD count; /* Count of bytes returned from VxD */
if (!inited)
- PM_init();
+ PM_init();
inBuf[0] = seg;
inBuf[1] = off;
inBuf[2] = (ulong)in;
inBuf[3] = (ulong)sregs;
CHECK_FOR_PMHELP();
DeviceIoControl(_PM_hDevice, PMHELP_CALLREALMODE32, inBuf, sizeof(inBuf),
- NULL, 0, &count, NULL);
+ NULL, 0, &count, NULL);
}
/****************************************************************************
@@ -883,15 +883,15 @@ void * PMAPI PM_allocLockedMem(
DWORD count; /* Count of bytes returned from VxD */
if (!inited)
- PM_init();
+ PM_init();
inBuf[0] = size;
inBuf[1] = (ulong)physAddr;
inBuf[2] = (ulong)contiguous;
inBuf[3] = (ulong)below16M;
CHECK_FOR_PMHELP();
if (DeviceIoControl(_PM_hDevice, PMHELP_ALLOCLOCKED32, inBuf, sizeof(inBuf),
- outBuf, sizeof(outBuf), &count, NULL))
- return (void*)outBuf[0];
+ outBuf, sizeof(outBuf), &count, NULL))
+ return (void*)outBuf[0];
return NULL;
}
@@ -908,13 +908,13 @@ void PMAPI PM_freeLockedMem(
DWORD count; /* Count of bytes returned from VxD */
if (!inited)
- PM_init();
+ PM_init();
inBuf[0] = (ulong)p;
inBuf[1] = size;
inBuf[2] = contiguous;
CHECK_FOR_PMHELP();
DeviceIoControl(_PM_hDevice, PMHELP_FREELOCKED32, inBuf, sizeof(inBuf),
- NULL, 0, &count, NULL);
+ NULL, 0, &count, NULL);
}
/****************************************************************************
@@ -929,12 +929,12 @@ void * PMAPI PM_allocPage(
DWORD count; /* Count of bytes returned from VxD */
if (!inited)
- PM_init();
+ PM_init();
inBuf[0] = locked;
CHECK_FOR_PMHELP();
if (DeviceIoControl(_PM_hDevice, PMHELP_ALLOCPAGE32, inBuf, sizeof(inBuf),
- outBuf, sizeof(outBuf), &count, NULL))
- return (void*)outBuf[0];
+ outBuf, sizeof(outBuf), &count, NULL))
+ return (void*)outBuf[0];
return NULL;
}
@@ -949,11 +949,11 @@ void PMAPI PM_freePage(
DWORD count; /* Count of bytes returned from VxD */
if (!inited)
- PM_init();
+ PM_init();
inBuf[0] = (ulong)p;
CHECK_FOR_PMHELP();
DeviceIoControl(_PM_hDevice, PMHELP_FREEPAGE32, inBuf, sizeof(inBuf),
- NULL, 0, &count, NULL);
+ NULL, 0, &count, NULL);
}
/****************************************************************************
@@ -971,8 +971,8 @@ int PMAPI PM_lockDataPages(void *p,uint len,PM_lockHandle *lh)
inBuf[2] = (ulong)lh;
CHECK_FOR_PMHELP();
if (DeviceIoControl(_PM_hDevice, PMHELP_LOCKDATAPAGES32, inBuf, sizeof(inBuf),
- outBuf, sizeof(outBuf), &count, NULL))
- return outBuf[0];
+ outBuf, sizeof(outBuf), &count, NULL))
+ return outBuf[0];
return 0;
}
@@ -991,8 +991,8 @@ int PMAPI PM_unlockDataPages(void *p,uint len,PM_lockHandle *lh)
inBuf[2] = (ulong)lh;
CHECK_FOR_PMHELP();
if (DeviceIoControl(_PM_hDevice, PMHELP_UNLOCKDATAPAGES32, inBuf, sizeof(inBuf),
- outBuf, sizeof(outBuf), &count, NULL))
- return outBuf[0];
+ outBuf, sizeof(outBuf), &count, NULL))
+ return outBuf[0];
return 0;
}
@@ -1011,8 +1011,8 @@ int PMAPI PM_lockCodePages(void (*p)(),uint len,PM_lockHandle *lh)
inBuf[2] = (ulong)lh;
CHECK_FOR_PMHELP();
if (DeviceIoControl(_PM_hDevice, PMHELP_LOCKCODEPAGES32, inBuf, sizeof(inBuf),
- outBuf, sizeof(outBuf), &count, NULL))
- return outBuf[0];
+ outBuf, sizeof(outBuf), &count, NULL))
+ return outBuf[0];
return 0;
}
@@ -1031,8 +1031,8 @@ int PMAPI PM_unlockCodePages(void (*p)(),uint len,PM_lockHandle *lh)
inBuf[2] = (ulong)lh;
CHECK_FOR_PMHELP();
if (DeviceIoControl(_PM_hDevice, PMHELP_UNLOCKCODEPAGES32, inBuf, sizeof(inBuf),
- outBuf, sizeof(outBuf), &count, NULL))
- return outBuf[0];
+ outBuf, sizeof(outBuf), &count, NULL))
+ return outBuf[0];
return 0;
}
@@ -1099,14 +1099,14 @@ ibool PMAPI PM_enableWriteCombine(
DWORD count; /* Count of bytes returned from VxD */
if (!inited)
- PM_init();
+ PM_init();
inBuf[0] = base;
inBuf[1] = length;
inBuf[2] = type;
CHECK_FOR_PMHELP();
if (DeviceIoControl(_PM_hDevice, PMHELP_ENABLELFBCOMB32, inBuf, sizeof(inBuf),
- outBuf, sizeof(outBuf), &count, NULL))
- return outBuf[0];
+ outBuf, sizeof(outBuf), &count, NULL))
+ return outBuf[0];
return false;
}
@@ -1121,8 +1121,8 @@ ulong PMAPI _PM_getPDB(void)
CHECK_FOR_PMHELP();
if (DeviceIoControl(_PM_hDevice, PMHELP_GETPDB32, NULL, 0,
- outBuf, sizeof(outBuf), &count, NULL))
- return outBuf[0];
+ outBuf, sizeof(outBuf), &count, NULL))
+ return outBuf[0];
return 0;
}
@@ -1201,15 +1201,15 @@ static void convertFindData(
memset(findData,0,findData->dwSize);
findData->dwSize = dwSize;
if (blk->dwFileAttributes & FILE_ATTRIBUTE_READONLY)
- findData->attrib |= PM_FILE_READONLY;
+ findData->attrib |= PM_FILE_READONLY;
if (blk->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
- findData->attrib |= PM_FILE_DIRECTORY;
+ findData->attrib |= PM_FILE_DIRECTORY;
if (blk->dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE)
- findData->attrib |= PM_FILE_ARCHIVE;
+ findData->attrib |= PM_FILE_ARCHIVE;
if (blk->dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)
- findData->attrib |= PM_FILE_HIDDEN;
+ findData->attrib |= PM_FILE_HIDDEN;
if (blk->dwFileAttributes & FILE_ATTRIBUTE_SYSTEM)
- findData->attrib |= PM_FILE_SYSTEM;
+ findData->attrib |= PM_FILE_SYSTEM;
findData->sizeLo = blk->nFileSizeLow;
findData->sizeHi = blk->nFileSizeHigh;
strncpy(findData->name,blk->cFileName,PM_MAX_PATH);
@@ -1228,9 +1228,9 @@ void *PMAPI PM_findFirstFile(
HANDLE hfile;
if ((hfile = FindFirstFile(filename,&blk)) != INVALID_HANDLE_VALUE) {
- convertFindData(findData,&blk);
- return (void*)hfile;
- }
+ convertFindData(findData,&blk);
+ return (void*)hfile;
+ }
return PM_FILE_INVALID;
}
@@ -1245,9 +1245,9 @@ ibool PMAPI PM_findNextFile(
WIN32_FIND_DATA blk;
if (FindNextFile((HANDLE)handle,&blk)) {
- convertFindData(findData,&blk);
- return true;
- }
+ convertFindData(findData,&blk);
+ return true;
+ }
return false;
}
@@ -1295,8 +1295,8 @@ void PMAPI PM_getdcwd(
char *dir,
int len)
{
- // NT stores the current directory for drive N in the magic environment
- // variable =N: so we simply look for that environment variable.
+ /* NT stores the current directory for drive N in the magic environment */
+ /* variable =N: so we simply look for that environment variable. */
char envname[4];
envname[0] = '=';
@@ -1304,14 +1304,14 @@ void PMAPI PM_getdcwd(
envname[2] = ':';
envname[3] = '\0';
if (GetEnvironmentVariable(envname,dir,len) == 0) {
- // The current directory or the drive has not been set yet, so
- // simply set it to the root.
- dir[0] = envname[1];
- dir[1] = ':';
- dir[2] = '\\';
- dir[3] = '\0';
- SetEnvironmentVariable(envname,dir);
- }
+ /* The current directory or the drive has not been set yet, so */
+ /* simply set it to the root. */
+ dir[0] = envname[1];
+ dir[1] = ':';
+ dir[2] = '\\';
+ dir[3] = '\0';
+ SetEnvironmentVariable(envname,dir);
+ }
}
/****************************************************************************
@@ -1325,13 +1325,13 @@ void PMAPI PM_setFileAttr(
DWORD attr = 0;
if (attrib & PM_FILE_READONLY)
- attr |= FILE_ATTRIBUTE_READONLY;
+ attr |= FILE_ATTRIBUTE_READONLY;
if (attrib & PM_FILE_ARCHIVE)
- attr |= FILE_ATTRIBUTE_ARCHIVE;
+ attr |= FILE_ATTRIBUTE_ARCHIVE;
if (attrib & PM_FILE_HIDDEN)
- attr |= FILE_ATTRIBUTE_HIDDEN;
+ attr |= FILE_ATTRIBUTE_HIDDEN;
if (attrib & PM_FILE_SYSTEM)
- attr |= FILE_ATTRIBUTE_SYSTEM;
+ attr |= FILE_ATTRIBUTE_SYSTEM;
SetFileAttributes((LPSTR)filename, attr);
}
@@ -1346,13 +1346,13 @@ uint PMAPI PM_getFileAttr(
uint attrib = 0;
if (attr & FILE_ATTRIBUTE_READONLY)
- attrib |= PM_FILE_READONLY;
+ attrib |= PM_FILE_READONLY;
if (attr & FILE_ATTRIBUTE_ARCHIVE)
- attrib |= PM_FILE_ARCHIVE;
+ attrib |= PM_FILE_ARCHIVE;
if (attr & FILE_ATTRIBUTE_HIDDEN)
- attrib |= PM_FILE_HIDDEN;
+ attrib |= PM_FILE_HIDDEN;
if (attr & FILE_ATTRIBUTE_SYSTEM)
- attrib |= PM_FILE_SYSTEM;
+ attrib |= PM_FILE_SYSTEM;
return attrib;
}
@@ -1393,17 +1393,17 @@ ibool PMAPI PM_getFileTime(
of.cBytes = sizeof(of);
if ((f = OpenFile(filename,&of,OF_READ)) == HFILE_ERROR)
- return false;
+ return false;
if (!GetFileTime((HANDLE)f,NULL,NULL,&utcTime))
- goto Exit;
+ goto Exit;
if (!gmTime) {
- if (!FileTimeToLocalFileTime(&utcTime,&localTime))
- goto Exit;
- }
+ if (!FileTimeToLocalFileTime(&utcTime,&localTime))
+ goto Exit;
+ }
else
- localTime = utcTime;
+ localTime = utcTime;
if (!FileTimeToSystemTime(&localTime,&sysTime))
- goto Exit;
+ goto Exit;
time->year = sysTime.wYear;
time->mon = sysTime.wMonth-1;
time->day = sysTime.wYear;
@@ -1434,7 +1434,7 @@ ibool PMAPI PM_setFileTime(
of.cBytes = sizeof(of);
if ((f = OpenFile(filename,&of,OF_WRITE)) == HFILE_ERROR)
- return false;
+ return false;
sysTime.wYear = time->year;
sysTime.wMonth = time->mon+1;
sysTime.wYear = time->day;
@@ -1442,19 +1442,18 @@ ibool PMAPI PM_setFileTime(
sysTime.wMinute = time->min;
sysTime.wSecond = time->sec;
if (!SystemTimeToFileTime(&sysTime,&localTime))
- goto Exit;
+ goto Exit;
if (!gmTime) {
- if (!LocalFileTimeToFileTime(&localTime,&utcTime))
- goto Exit;
- }
+ if (!LocalFileTimeToFileTime(&localTime,&utcTime))
+ goto Exit;
+ }
else
- utcTime = localTime;
+ utcTime = localTime;
if (!SetFileTime((HANDLE)f,NULL,NULL,&utcTime))
- goto Exit;
+ goto Exit;
status = true;
Exit:
CloseHandle((HANDLE)f);
return status;
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/win32/ztimer.c b/board/MAI/bios_emulator/scitech/src/pm/win32/ztimer.c
index 318929a2c0..5a901a4422 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/win32/ztimer.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/win32/ztimer.c
@@ -57,9 +57,9 @@ static void __LZTimerOn(
LZTimerObject *tm)
{
if (havePerformanceCounter)
- QueryPerformanceCounter((LARGE_INTEGER*)&tm->start);
+ QueryPerformanceCounter((LARGE_INTEGER*)&tm->start);
else
- tm->start.low = timeGetTime();
+ tm->start.low = timeGetTime();
}
/****************************************************************************
@@ -72,14 +72,14 @@ static ulong __LZTimerLap(
CPU_largeInteger tmLap,tmCount;
if (havePerformanceCounter) {
- QueryPerformanceCounter((LARGE_INTEGER*)&tmLap);
- _CPU_diffTime64(&tm->start,&tmLap,&tmCount);
- return _CPU_calcMicroSec(&tmCount,countFreq.low);
- }
+ QueryPerformanceCounter((LARGE_INTEGER*)&tmLap);
+ _CPU_diffTime64(&tm->start,&tmLap,&tmCount);
+ return _CPU_calcMicroSec(&tmCount,countFreq.low);
+ }
else {
- tmLap.low = timeGetTime();
- return (tmLap.low - tm->start.low) * 1000L;
- }
+ tmLap.low = timeGetTime();
+ return (tmLap.low - tm->start.low) * 1000L;
+ }
}
/****************************************************************************
@@ -90,9 +90,9 @@ static void __LZTimerOff(
LZTimerObject *tm)
{
if (havePerformanceCounter)
- QueryPerformanceCounter((LARGE_INTEGER*)&tm->end);
+ QueryPerformanceCounter((LARGE_INTEGER*)&tm->end);
else
- tm->end.low = timeGetTime();
+ tm->end.low = timeGetTime();
}
/****************************************************************************
@@ -105,11 +105,11 @@ static ulong __LZTimerCount(
CPU_largeInteger tmCount;
if (havePerformanceCounter) {
- _CPU_diffTime64(&tm->start,&tm->end,&tmCount);
- return _CPU_calcMicroSec(&tmCount,countFreq.low);
- }
+ _CPU_diffTime64(&tm->start,&tm->end,&tmCount);
+ return _CPU_calcMicroSec(&tmCount,countFreq.low);
+ }
else
- return (tm->end.low - tm->start.low) * 1000L;
+ return (tm->end.low - tm->start.low) * 1000L;
}
/****************************************************************************
diff --git a/board/MAI/bios_emulator/scitech/src/pm/x11/event.c b/board/MAI/bios_emulator/scitech/src/pm/x11/event.c
index 23b938023d..b34bfac22f 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/x11/event.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/x11/event.c
@@ -83,7 +83,7 @@ ulong _EVT_getTicks(void)
{
static unsigned starttime = 0;
struct timeval t;
-
+
gettimeofday(&t, NULL);
if (starttime == 0)
starttime = t.tv_sec * 1000 + (t.tv_usec/1000);
@@ -105,14 +105,14 @@ static void _EVT_pumpX11Messages(void)
static void _EVT_pumpMessages(void)
#endif
{
- // TODO: The purpose of this function is to read all keyboard and mouse
- // events from the OS specific event queue, translate them and post
- // them into the SciTech event queue.
+ /* TODO: The purpose of this function is to read all keyboard and mouse */
+ /* events from the OS specific event queue, translate them and post */
+ /* them into the SciTech event queue. */
event_t evt;
XEvent ev;
static int old_mx = 0, old_my = 0, buts = 0, c;
char buf[2];
-
+
while (XPending(_EVT_dpy) && XNextEvent(_EVT_dpy,&ev)) {
evt.when = _MGL_getTicks();
@@ -129,36 +129,36 @@ static void _EVT_pumpMessages(void)
evt.what = EVT_KEYUP;
evt.message = keyUpMsg[c];
if(count < EVENTQSIZE)
- addEvent(&evt);
+ addEvent(&evt);
keyUpMsg[c] = 0;
repeatKey[c] = 0;
break;
case ButtonPress:
evt.what = EVT_MOUSEDOWN;
if(ev.xbutton.button == 1){
- buts |= EVT_LEFTBUT;
- evt.message = EVT_LEFTBMASK;
+ buts |= EVT_LEFTBUT;
+ evt.message = EVT_LEFTBMASK;
}else if(ev.xbutton.button == 2){
- buts |= EVT_MIDDLEBUT;
- evt.message = EVT_MIDDLEBMASK;
+ buts |= EVT_MIDDLEBUT;
+ evt.message = EVT_MIDDLEBMASK;
}else if(ev.xbutton.button == 3){
- buts |= EVT_RIGHTBUT;
- evt.message = EVT_RIGHTBMASK;
+ buts |= EVT_RIGHTBUT;
+ evt.message = EVT_RIGHTBMASK;
}
evt.modifiers = modifiers | buts;
-
+
break;
case ButtonRelease:
evt.what = EVT_MOUSEUP;
if(ev.xbutton.button == 1){
- buts &= ~EVT_LEFTBUT;
- evt.message = EVT_LEFTBMASK;
+ buts &= ~EVT_LEFTBUT;
+ evt.message = EVT_LEFTBMASK;
}else if(ev.xbutton.button == 2){
- buts &= ~EVT_MIDDLEBUT;
- evt.message = EVT_MIDDLEBMASK;
+ buts &= ~EVT_MIDDLEBUT;
+ evt.message = EVT_MIDDLEBMASK;
}else if(ev.xbutton.button == 3){
- buts &= ~EVT_RIGHTBUT;
- evt.message = EVT_RIGHTBMASK;
+ buts &= ~EVT_RIGHTBUT;
+ evt.message = EVT_RIGHTBMASK;
}
evt.modifiers = modifiers | buts;
@@ -226,7 +226,7 @@ void EVTAPI EVT_init(
_mouseMove = mouseMove;
initEventQueue();
memset(keyUpMsg,0,sizeof(keyUpMsg));
-
+
/* query server for input extensions */
result =XQueryExtension(_EVT_dpy,"XInputExtension",&i,&j,&k);
@@ -269,7 +269,7 @@ and this function can be used to resume it again later.
****************************************************************************/
void EVT_resume(void)
{
- // Do nothing for non DOS systems
+ /* Do nothing for non DOS systems */
}
/****************************************************************************
@@ -279,7 +279,7 @@ de-install the event handling code.
****************************************************************************/
void EVT_suspend(void)
{
- // Do nothing for non DOS systems
+ /* Do nothing for non DOS systems */
}
/****************************************************************************
@@ -293,7 +293,7 @@ void EVT_exit(void)
signal(SIGFPE, SIG_DFL);
signal(SIGINT, SIG_DFL);
- // TODO: Do any OS specific cleanup in here
+ /* TODO: Do any OS specific cleanup in here */
}
/****************************************************************************
diff --git a/board/MAI/bios_emulator/scitech/src/pm/ztimer.c b/board/MAI/bios_emulator/scitech/src/pm/ztimer.c
index 35081e9a36..5acf7b1f0c 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/ztimer.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/ztimer.c
@@ -104,12 +104,12 @@ void ZAPI ZTimerInitExt(
ibool accurate)
{
if (cpuSpeed == -1) {
- __ZTimerInit();
+ __ZTimerInit();
#ifdef __INTEL__
- cpuSpeed = CPU_getProcessorSpeedInHZ(accurate);
- haveRDTSC = CPU_haveRDTSC() && (cpuSpeed > 0);
+ cpuSpeed = CPU_getProcessorSpeedInHZ(accurate);
+ haveRDTSC = CPU_haveRDTSC() && (cpuSpeed > 0);
#endif
- }
+ }
}
/****************************************************************************
@@ -174,11 +174,11 @@ void ZAPI LZTimerOnExt(
{
#ifdef __INTEL__
if (haveRDTSC) {
- _CPU_readTimeStamp(&tm->start);
- }
+ _CPU_readTimeStamp(&tm->start);
+ }
else
#endif
- __LZTimerOn(tm);
+ __LZTimerOn(tm);
}
/****************************************************************************
@@ -210,13 +210,13 @@ ulong ZAPI LZTimerLapExt(
CPU_largeInteger tmLap,tmCount;
if (haveRDTSC) {
- _CPU_readTimeStamp(&tmLap);
- _CPU_diffTime64(&tm->start,&tmLap,&tmCount);
- return _CPU_calcMicroSec(&tmCount,cpuSpeed);
- }
+ _CPU_readTimeStamp(&tmLap);
+ _CPU_diffTime64(&tm->start,&tmLap,&tmCount);
+ return _CPU_calcMicroSec(&tmCount,cpuSpeed);
+ }
else
#endif
- return __LZTimerLap(tm);
+ return __LZTimerLap(tm);
}
/****************************************************************************
@@ -244,11 +244,11 @@ void ZAPI LZTimerOffExt(
{
#ifdef __INTEL__
if (haveRDTSC) {
- _CPU_readTimeStamp(&tm->end);
- }
+ _CPU_readTimeStamp(&tm->end);
+ }
else
#endif
- __LZTimerOff(tm);
+ __LZTimerOff(tm);
}
/****************************************************************************
@@ -278,12 +278,12 @@ ulong ZAPI LZTimerCountExt(
CPU_largeInteger tmCount;
if (haveRDTSC) {
- _CPU_diffTime64(&tm->start,&tm->end,&tmCount);
- return _CPU_calcMicroSec(&tmCount,cpuSpeed);
- }
+ _CPU_diffTime64(&tm->start,&tm->end,&tmCount);
+ return _CPU_calcMicroSec(&tmCount,cpuSpeed);
+ }
else
#endif
- return __LZTimerCount(tm);
+ return __LZTimerCount(tm);
}
/****************************************************************************
@@ -514,4 +514,3 @@ ULZReadTime, ULZElapsedTime, ULZTimerCount
void ZAPI ULZTimerResolution(
ulong *resolution)
{ *resolution = ULZTIMER_RESOLUTION; }
-
diff --git a/board/MAI/bios_emulator/scitech/src/v86bios/AsmMacros.h b/board/MAI/bios_emulator/scitech/src/v86bios/AsmMacros.h
index e824299c05..77c545aef4 100644
--- a/board/MAI/bios_emulator/scitech/src/v86bios/AsmMacros.h
+++ b/board/MAI/bios_emulator/scitech/src/v86bios/AsmMacros.h
@@ -2,24 +2,24 @@
/*
* (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
*
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
- *
+ *
* Except as contained in this notice, the name of David Wexelblat shall not be
* used in advertising or otherwise to promote the sale, use or other dealings
* in this Software without prior written authorization from David Wexelblat.
@@ -28,32 +28,32 @@
/*
* Copyright 1997
* Digital Equipment Corporation. All rights reserved.
- * This software is furnished under license and may be used and copied only in
- * accordance with the following terms and conditions. Subject to these
- * conditions, you may download, copy, install, use, modify and distribute
- * this software in source and/or binary form. No title or ownership is
+ * This software is furnished under license and may be used and copied only in
+ * accordance with the following terms and conditions. Subject to these
+ * conditions, you may download, copy, install, use, modify and distribute
+ * this software in source and/or binary form. No title or ownership is
* transferred hereby.
*
- * 1) Any source code used, modified or distributed must reproduce and retain
+ * 1) Any source code used, modified or distributed must reproduce and retain
* this copyright notice and list of conditions as they appear in the source
* file.
*
- * 2) No right is granted to use any trade name, trademark, or logo of Digital
- * Equipment Corporation. Neither the "Digital Equipment Corporation" name
- * nor any trademark or logo of Digital Equipment Corporation may be used
- * to endorse or promote products derived from this software without the
+ * 2) No right is granted to use any trade name, trademark, or logo of Digital
+ * Equipment Corporation. Neither the "Digital Equipment Corporation" name
+ * nor any trademark or logo of Digital Equipment Corporation may be used
+ * to endorse or promote products derived from this software without the
* prior written permission of Digital Equipment Corporation.
*
- * 3) This software is provided "AS-IS" and any express or implied warranties,
- * including but not limited to, any implied warranties of merchantability,
- * fitness for a particular purpose, or non-infringement are disclaimed. In
- * no event shall DIGITAL be liable for any damages whatsoever, and in
- * particular, DIGITAL shall not be liable for special, indirect,
- * consequential, or incidental damages or damages for
- * lost profits, loss of revenue or loss of use, whether such damages arise
- * in contract,
- * negligence, tort, under statute, in equity, at law or otherwise, even if
- * advised of the possibility of such damage.
+ * 3) This software is provided "AS-IS" and any express or implied warranties,
+ * including but not limited to, any implied warranties of merchantability,
+ * fitness for a particular purpose, or non-infringement are disclaimed. In
+ * no event shall DIGITAL be liable for any damages whatsoever, and in
+ * particular, DIGITAL shall not be liable for special, indirect,
+ * consequential, or incidental damages or damages for
+ * lost profits, loss of revenue or loss of use, whether such damages arise
+ * in contract,
+ * negligence, tort, under statute, in equity, at law or otherwise, even if
+ * advised of the possibility of such damage.
*
*/
@@ -356,8 +356,8 @@ inb(port)
{
unsigned int ret;
__asm__ __volatile__("in%B0 (%1)" :
- "=a" (ret) :
- "d" (port));
+ "=a" (ret) :
+ "d" (port));
return ret;
}
@@ -367,8 +367,8 @@ inw(port)
{
unsigned int ret;
__asm__ __volatile__("in%W0 (%1)" :
- "=a" (ret) :
- "d" (port));
+ "=a" (ret) :
+ "d" (port));
return ret;
}
@@ -378,8 +378,8 @@ inl(port)
{
unsigned int ret;
__asm__ __volatile__("in%L0 (%1)" :
- "=a" (ret) :
- "d" (port));
+ "=a" (ret) :
+ "d" (port));
return ret;
}
@@ -395,7 +395,7 @@ inl(port)
#define intr_disable()
#define intr_enable()
-#else
+#else
static __inline__ void
intr_disable()
diff --git a/board/MAI/bios_emulator/scitech/src/v86bios/README b/board/MAI/bios_emulator/scitech/src/v86bios/README
index 4b7d0fa029..cb65674b2d 100644
--- a/board/MAI/bios_emulator/scitech/src/v86bios/README
+++ b/board/MAI/bios_emulator/scitech/src/v86bios/README
@@ -2,12 +2,12 @@
This is a preliminary version of a VGA softbooter for LINUX.
It makes use of the of the vm86() call and is therefore only
-usable on ix86 systems.
+usable on ix86 systems.
There are plans to port this program to use a x86 emulator
like x86emu. Also it may be ported to other operating systems.
So far it has been tested on a small number of cards. It might
-well be that it will fail on your card.
+well be that it will fail on your card.
If you need to make modifications to the programs to be able
to boot your card please let the author know.
@@ -16,20 +16,17 @@ So far there is no command line interface. All options need
to be hardcoded. You can do this by editing debug.h. You can
turn on a bunch of debug output. Other options allow you to
boot the primary card (CONFIG_ACTIVE_DEVICE), save the bios
-to a file (SAVE_BIOS), and map the original system bios
+to a file (SAVE_BIOS), and map the original system bios
(MAP_SYS_BIOS).
The author wants to thank
Hans Lermen (dosemu)
and
Kendall Bennett (x86emu)
-for their support.
+for their support.
Parts of the code - especially in v86.c and io.c - are based on code
taken from dosemu. Parts of the code in int.c are based on code taken
from x86emu
Egbert Eich. <Egbert.Eich@Physik.TU-Darmstadt.DE>
-
-
-
diff --git a/board/MAI/bios_emulator/scitech/src/v86bios/cbios.c b/board/MAI/bios_emulator/scitech/src/v86bios/cbios.c
index 4173c953ba..6b12dff4f9 100644
--- a/board/MAI/bios_emulator/scitech/src/v86bios/cbios.c
+++ b/board/MAI/bios_emulator/scitech/src/v86bios/cbios.c
@@ -57,18 +57,18 @@ main(int argc,char **argv)
Config.IoStatistics = IO_STATISTICS;
Config.PrintIrq = PRINT_IRQ;
Config.PrintPci = PRINT_PCI;
- Config.ShowAllDev = SHOW_ALL_DEV;
- Config.PrintIp = PRINT_IP;
- Config.SaveBios = SAVE_BIOS;
- Config.Trace = TRACE;
- Config.ConfigActiveOnly = CONFIG_ACTIVE_ONLY;
+ Config.ShowAllDev = SHOW_ALL_DEV;
+ Config.PrintIp = PRINT_IP;
+ Config.SaveBios = SAVE_BIOS;
+ Config.Trace = TRACE;
+ Config.ConfigActiveOnly = CONFIG_ACTIVE_ONLY;
Config.ConfigActiveDevice = CONFIG_ACTIVE_DEVICE;
- Config.MapSysBios = MAP_SYS_BIOS;
- Config.Resort = RESORT;
- Config.FixRom = FIX_ROM;
- Config.NoConsole = NO_CONSOLE;
+ Config.MapSysBios = MAP_SYS_BIOS;
+ Config.Resort = RESORT;
+ Config.FixRom = FIX_ROM;
+ Config.NoConsole = NO_CONSOLE;
Config.Verbose = VERBOSE;
-
+
if (!map())
exit(1);
if (!copy_sys_bios())
@@ -79,7 +79,7 @@ main(int argc,char **argv)
exit(1);
if (!copy_vbios(vbios_base))
exit(1);
-
+
iopl(3);
setup_io();
runBIOS(argc,argv);
@@ -91,18 +91,18 @@ main(int argc,char **argv)
exit (1);
}
-int
+int
map(void)
{
void* mem;
mem = mmap(0, (size_t)SIZE,
- PROT_EXEC | PROT_READ | PROT_WRITE,
- MAP_FIXED | MAP_PRIVATE | MAP_ANON,
- -1, 0 );
+ PROT_EXEC | PROT_READ | PROT_WRITE,
+ MAP_FIXED | MAP_PRIVATE | MAP_ANON,
+ -1, 0 );
if (mem != 0) {
- perror("anonymous map");
- return (0);
+ perror("anonymous map");
+ return (0);
}
memset(mem,0,SIZE);
@@ -117,14 +117,14 @@ copy_sys_bios(void)
int mem_fd;
if ((mem_fd = open(MEM_FILE,O_RDONLY))<0) {
- perror("opening memory");
- return (0);
+ perror("opening memory");
+ return (0);
}
-
- if (lseek(mem_fd,(off_t) SYS_BIOS,SEEK_SET) != (off_t) SYS_BIOS)
- goto Error;
- if (read(mem_fd, (char *)SYS_BIOS, (size_t) 0xFFFF) != (size_t) 0xFFFF)
- goto Error;
+
+ if (lseek(mem_fd,(off_t) SYS_BIOS,SEEK_SET) != (off_t) SYS_BIOS)
+ goto Error;
+ if (read(mem_fd, (char *)SYS_BIOS, (size_t) 0xFFFF) != (size_t) 0xFFFF)
+ goto Error;
close(mem_fd);
return (1);
@@ -141,33 +141,33 @@ map_vram(void)
int mem_fd;
#ifdef __ia64__
- if ((mem_fd = open(MEM_FILE,O_RDWR | O_SYNC))<0)
+ if ((mem_fd = open(MEM_FILE,O_RDWR | O_SYNC))<0)
#else
- if ((mem_fd = open(MEM_FILE,O_RDWR))<0)
+ if ((mem_fd = open(MEM_FILE,O_RDWR))<0)
#endif
{
- perror("opening memory");
- return 0;
+ perror("opening memory");
+ return 0;
}
#ifndef __alpha__
if (mmap((void *) VRAM_START, (size_t) VRAM_SIZE,
- PROT_EXEC | PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED,
- mem_fd, VRAM_START) == (void *) -1)
+ PROT_EXEC | PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED,
+ mem_fd, VRAM_START) == (void *) -1)
#else
- if (!_bus_base()) sparse_shift = 7; /* Uh, oh, JENSEN... */
- if (!_bus_base_sparse()) sparse_shift = 0;
- if ((vram_map = mmap(0,(size_t) (VRAM_SIZE << sparse_shift),
- PROT_READ | PROT_WRITE,
- MAP_SHARED,
- mem_fd, (VRAM_START << sparse_shift)
- | _bus_base_sparse())) == (void *) -1)
+ if (!_bus_base()) sparse_shift = 7; /* Uh, oh, JENSEN... */
+ if (!_bus_base_sparse()) sparse_shift = 0;
+ if ((vram_map = mmap(0,(size_t) (VRAM_SIZE << sparse_shift),
+ PROT_READ | PROT_WRITE,
+ MAP_SHARED,
+ mem_fd, (VRAM_START << sparse_shift)
+ | _bus_base_sparse())) == (void *) -1)
#endif
{
- perror("mmap error in map_hardware_ram");
- close(mem_fd);
- return (0);
- }
+ perror("mmap error in map_hardware_ram");
+ close(mem_fd);
+ return (0);
+ }
vram_mapped = 1;
close(mem_fd);
return (1);
@@ -181,39 +181,39 @@ copy_vbios(memType v_base)
int size;
if ((mem_fd = open(MEM_FILE,O_RDONLY))<0) {
- perror("opening memory");
- return (0);
+ perror("opening memory");
+ return (0);
}
- if (lseek(mem_fd,(off_t) v_base, SEEK_SET) != (off_t) v_base) {
- fprintf(stderr,"Cannot lseek\n");
- goto Error;
+ if (lseek(mem_fd,(off_t) v_base, SEEK_SET) != (off_t) v_base) {
+ fprintf(stderr,"Cannot lseek\n");
+ goto Error;
}
tmp = (unsigned char *)malloc(3);
if (read(mem_fd, (char *)tmp, (size_t) 3) != (size_t) 3) {
- fprintf(stderr,"Cannot read\n");
- goto Error;
+ fprintf(stderr,"Cannot read\n");
+ goto Error;
}
- if (lseek(mem_fd,(off_t) v_base,SEEK_SET) != (off_t) v_base)
- goto Error;
+ if (lseek(mem_fd,(off_t) v_base,SEEK_SET) != (off_t) v_base)
+ goto Error;
if (*tmp != 0x55 || *(tmp+1) != 0xAA ) {
- fprintf(stderr,"No bios found at: 0x%lx\n",v_base);
- goto Error;
+ fprintf(stderr,"No bios found at: 0x%lx\n",v_base);
+ goto Error;
}
#ifdef DEBUG
- dprint((unsigned long)tmp,0x100);
+ dprint((unsigned long)tmp,0x100);
#endif
size = *(tmp+2) * 512;
if (read(mem_fd, (char *)v_base, (size_t) size) != (size_t) size) {
- fprintf(stderr,"Cannot read\n");
- goto Error;
+ fprintf(stderr,"Cannot read\n");
+ goto Error;
}
free(tmp);
close(mem_fd);
if (!chksum((CARD8*)v_base))
- return (0);
+ return (0);
return (1);
@@ -233,7 +233,7 @@ static void
unmap_vram(void)
{
if (!vram_mapped) return;
-
+
munmap((void*)VRAM_START,VRAM_SIZE);
vram_mapped = 0;
}
@@ -259,15 +259,15 @@ setup_int_vect(void)
int mem_fd;
CARD32 vbase;
void *map;
-
+
if ((mem_fd = open(MEM_FILE,O_RDONLY))<0) {
perror("opening memory");
return (0);
}
-
+
if ((map = mmap((void *) 0, (size_t) 0x2000,
- PROT_EXEC | PROT_READ | PROT_WRITE, MAP_SHARED,
- mem_fd, 0)) == (void *)-1) {
+ PROT_EXEC | PROT_READ | PROT_WRITE, MAP_SHARED,
+ mem_fd, 0)) == (void *)-1) {
perror("mmap error in map_hardware_ram");
close(mem_fd);
return (0);
@@ -282,7 +282,7 @@ setup_int_vect(void)
*/
bios_var = (char *)malloc(BIOS_MEM);
memcpy(bios_var,0,BIOS_MEM);
-
+
vbase = (*((CARD16*)(0x10 << 2) + 1)) << 4;
fprintf(stderr,"vbase: 0x%x\n",vbase);
return vbase;
@@ -294,28 +294,28 @@ update_bios_vars(void)
int mem_fd;
void *map;
memType i;
-
+
#ifdef __ia64__
- if ((mem_fd = open(MEM_FILE,O_RDWR | O_SYNC))<0)
+ if ((mem_fd = open(MEM_FILE,O_RDWR | O_SYNC))<0)
#else
- if ((mem_fd = open(MEM_FILE,O_RDWR))<0)
+ if ((mem_fd = open(MEM_FILE,O_RDWR))<0)
#endif
{
- perror("opening memory");
- return;
+ perror("opening memory");
+ return;
}
-
+
if ((map = mmap((void *) 0, (size_t) 0x2000,
- PROT_EXEC | PROT_READ | PROT_WRITE, MAP_SHARED,
- mem_fd, 0)) == (void *)-1) {
+ PROT_EXEC | PROT_READ | PROT_WRITE, MAP_SHARED,
+ mem_fd, 0)) == (void *)-1) {
perror("mmap error in map_hardware_ram");
close(mem_fd);
return;
}
for (i = 0; i < BIOS_MEM; i++) {
- if (bios_var[i] != *(CARD8*)i)
- *((CARD8*)map + i) = *(CARD8*)i;
+ if (bios_var[i] != *(CARD8*)i)
+ *((CARD8*)map + i) = *(CARD8*)i;
}
munmap(map,0x2000);
@@ -338,23 +338,23 @@ setup_bios_regs(i86biosRegsPtr regs, int argc, char **argv)
while ((c = getopt(argc,argv,"a:b:c:d:e:i:")) != EOF) {
switch (c) {
case 'a':
- regs->ax = strtol(optarg,NULL,0);
- break;
+ regs->ax = strtol(optarg,NULL,0);
+ break;
case 'b':
- regs->bx = strtol(optarg,NULL,0);
- break;
+ regs->bx = strtol(optarg,NULL,0);
+ break;
case 'c':
- regs->cx = strtol(optarg,NULL,0);
- break;
+ regs->cx = strtol(optarg,NULL,0);
+ break;
case 'd':
- regs->dx = strtol(optarg,NULL,0);
- break;
+ regs->dx = strtol(optarg,NULL,0);
+ break;
case 'e':
- regs->es = strtol(optarg,NULL,0);
- break;
+ regs->es = strtol(optarg,NULL,0);
+ break;
case 'i':
- regs->di = strtol(optarg,NULL,0);
- break;
+ regs->di = strtol(optarg,NULL,0);
+ break;
}
}
}
@@ -367,10 +367,10 @@ chksum(CARD8 *start)
CARD8 val = 0;
int i;
- size = *(start+2) * 512;
+ size = *(start+2) * 512;
for (i = 0; i<size; i++)
val += *(start + i);
-
+
if (!val)
return 1;
@@ -391,25 +391,25 @@ loadCodeToMem(unsigned char *ptr, CARD8 code[])
{
int i;
CARD8 val;
-
+
for ( i=0;;i++) {
- val = code[i];
- *ptr++ = val;
- if (val == 0xf4) break;
+ val = code[i];
+ *ptr++ = val;
+ if (val == 0xf4) break;
}
return;
}
-void
+void
dprint(unsigned long start, unsigned long size)
{
int i,j;
char *c = (char *)start;
for (j = 0; j < (size >> 4); j++) {
- printf ("\n0x%lx: ",(unsigned long)c);
- for (i = 0; i<16; i++)
- printf("%x ",(unsigned char) (*(c++)));
+ printf ("\n0x%lx: ",(unsigned long)c);
+ for (i = 0; i<16; i++)
+ printf("%x ",(unsigned char) (*(c++)));
}
printf("\n");
}
diff --git a/board/MAI/bios_emulator/scitech/src/v86bios/command.c b/board/MAI/bios_emulator/scitech/src/v86bios/command.c
index 5494ff83ae..e2bce6df1b 100644
--- a/board/MAI/bios_emulator/scitech/src/v86bios/command.c
+++ b/board/MAI/bios_emulator/scitech/src/v86bios/command.c
@@ -15,24 +15,24 @@ getline(char *buf,int *num,int max_num)
static int len = 0;
int tmp_len;
char *buff;
-
+
if (len <= 0) {
buff = readline(PROMPT);
add_history(buff);
-
+
if ((tmp_len = strlen(buff)) > line_len) {
- free(line);
- line = malloc(tmp_len);
- line_len = tmp_len;
+ free(line);
+ line = malloc(tmp_len);
+ line_len = tmp_len;
}
sprintf(line,"%s\n",buff);
free(buff);
line_pointer = line;
len = strlen(line);
}
-
- *num = max_num > len? len : max_num;
- strncpy(buf,line_pointer,*num);
+
+ *num = max_num > len? len : max_num;
+ strncpy(buf,line_pointer,*num);
line_pointer = line_pointer + *num;
len = len - *num;
}
diff --git a/board/MAI/bios_emulator/scitech/src/v86bios/console.c b/board/MAI/bios_emulator/scitech/src/v86bios/console.c
index 46805155f8..5e9c924b64 100644
--- a/board/MAI/bios_emulator/scitech/src/v86bios/console.c
+++ b/board/MAI/bios_emulator/scitech/src/v86bios/console.c
@@ -36,43 +36,43 @@ open_console(void)
char VTname[11];
console Con = {-1,-1};
struct vt_stat vts;
-
+
if (NO_CONSOLE)
- return Con;
-
+ return Con;
+
if ((fd = open("/dev/tty0",O_WRONLY,0)) < 0)
- return Con;
+ return Con;
if ((ioctl(fd, VT_OPENQRY, &VTno) < 0) || (VTno == -1)) {
- fprintf(stderr,"cannot get a vt\n");
- return Con;
+ fprintf(stderr,"cannot get a vt\n");
+ return Con;
}
-
+
close(fd);
sprintf(VTname,"/dev/tty%i",VTno);
-
+
if ((fd = open(VTname, O_RDWR|O_NDELAY, 0)) < 0) {
- fprintf(stderr,"cannot open console\n");
- return Con;
+ fprintf(stderr,"cannot open console\n");
+ return Con;
}
-
- if (ioctl(fd, VT_GETSTATE, &vts) == 0)
- Con.vt = vts.v_active;
+
+ if (ioctl(fd, VT_GETSTATE, &vts) == 0)
+ Con.vt = vts.v_active;
if (ioctl(fd, VT_ACTIVATE, VTno) != 0) {
- fprintf(stderr,"cannot activate console\n");
- close(fd);
- return Con;
+ fprintf(stderr,"cannot activate console\n");
+ close(fd);
+ return Con;
}
if (ioctl(fd, VT_WAITACTIVE, VTno) != 0) {
- fprintf(stderr,"wait for active console failed\n");
- close(fd);
- return Con;
+ fprintf(stderr,"wait for active console failed\n");
+ close(fd);
+ return Con;
}
#if 0
if (ioctl(fd, KDSETMODE, KD_GRAPHICS) < 0) {
- close(fd);
- return Con;
+ close(fd);
+ return Con;
}
#endif
Con.fd = fd;
@@ -83,22 +83,13 @@ void
close_console(console Con)
{
if (Con.fd == -1)
- return;
-
+ return;
+
#if 0
ioctl(Con.fd, KDSETMODE, KD_TEXT);
#endif
if (Con.vt >=0)
- ioctl(Con.fd, VT_ACTIVATE, Con.vt);
-
+ ioctl(Con.fd, VT_ACTIVATE, Con.vt);
+
close(Con.fd);
}
-
-
-
-
-
-
-
-
-
diff --git a/board/MAI/bios_emulator/scitech/src/v86bios/debug.h b/board/MAI/bios_emulator/scitech/src/v86bios/debug.h
index bc0b1117db..c5c906b622 100644
--- a/board/MAI/bios_emulator/scitech/src/v86bios/debug.h
+++ b/board/MAI/bios_emulator/scitech/src/v86bios/debug.h
@@ -19,7 +19,7 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
-//#define V86BIOS_DEBUG
+/*#define V86BIOS_DEBUG */
/*
* uncomment the following if needed
@@ -32,7 +32,7 @@
#define PRINT_PCI 1
#define PRINT_IP 0 /* print IP address with PIO information */
#define TRACE 0 /* turn on debugger in x86emu */
- /* requires x86emu compiled with -DDEBUG */
+ /* requires x86emu compiled with -DDEBUG */
/*
* these should not be here.
@@ -48,10 +48,8 @@
#define SHOW_ALL_DEV 0
#define VERBOSE 0
-//#define V_BIOS 0xe0000
-//#define V_BIOS 0xe4000
-
-
+/*#define V_BIOS 0xe0000 */
+/*#define V_BIOS 0xe4000 */
#if (PRINT_IO == 1) && (PRINT_PORT == 0)
diff --git a/board/MAI/bios_emulator/scitech/src/v86bios/int.c b/board/MAI/bios_emulator/scitech/src/v86bios/int.c
index 40b17b1d70..3504c6cc3c 100644
--- a/board/MAI/bios_emulator/scitech/src/v86bios/int.c
+++ b/board/MAI/bios_emulator/scitech/src/v86bios/int.c
@@ -37,11 +37,11 @@ int_handler(int num, struct regs86 *regs)
switch (num) {
case 0x10:
case 0x42:
- return (int42_handler(num,regs));
+ return (int42_handler(num,regs));
case 0x1A:
- return (int1A_handler(regs));
+ return (int1A_handler(regs));
default:
- return 0;
+ return 0;
}
return 0;
}
@@ -53,38 +53,38 @@ int42_handler(int num,struct regs86 *regs)
CARD32 val;
i_printf("int 0x%x: ax:0x%lx bx:0x%lx cx:0x%lx dx:0x%lx\n",num,
- regs->eax,regs->ebx, regs->ecx, regs->edx);
-
+ regs->eax,regs->ebx, regs->ecx, regs->edx);
+
/*
* video bios has modified these -
* leave it to the video bios to do this
*/
val = getIntVect(num);
- if (val != 0xF000F065)
+ if (val != 0xF000F065)
return 0;
-
+
if ((regs->ebx & 0xff) == 0x32) {
- switch (regs->eax & 0xFFFF) {
- case 0x1200:
- i_printf("enabling video\n");
- c = inb(0x3cc);
- c |= 0x02;
- outb(0x3c2,c);
- return 1;
- case 0x1201:
- i_printf("disabling video\n");
- c = inb(0x3cc);
- c &= ~0x02;
- outb(0x3c2,c);
- return 1;
- default:
- }
+ switch (regs->eax & 0xFFFF) {
+ case 0x1200:
+ i_printf("enabling video\n");
+ c = inb(0x3cc);
+ c |= 0x02;
+ outb(0x3c2,c);
+ return 1;
+ case 0x1201:
+ i_printf("disabling video\n");
+ c = inb(0x3cc);
+ c &= ~0x02;
+ outb(0x3c2,c);
+ return 1;
+ default:
+ }
}
if (num == 0x42)
- return 1;
+ return 1;
else
- return 0;
+ return 0;
}
#define SUCCESSFUL 0x00
@@ -100,139 +100,139 @@ int1A_handler(struct regs86 *regs)
if (! CurrentPci) return 0; /* oops */
i_printf("int 0x1a: ax=0x%lx bx=0x%lx cx=0x%lx dx=0x%lx di=0x%lx"
- " si=0x%lx\n", regs->eax,regs->ebx,regs->ecx,regs->edx,
- regs->edi,regs->esi);
+ " si=0x%lx\n", regs->eax,regs->ebx,regs->ecx,regs->edx,
+ regs->edi,regs->esi);
switch (regs->eax & 0xFFFF) {
case 0xb101:
- regs->eax &= 0xFF00; /* no config space/special cycle support */
- regs->edx = 0x20494350; /* " ICP" */
- regs->ebx = 0x0210; /* Version 2.10 */
- regs->ecx &= 0xFF00;
- regs->ecx |= (pciMaxBus & 0xFF); /* Max bus number in system */
- regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
- i_printf("ax=0x%lx dx=0x%lx bx=0x%lx cx=0x%lx flags=0x%lx\n",
- regs->eax,regs->edx,regs->ebx,regs->ecx,regs->eflags);
- return 1;
+ regs->eax &= 0xFF00; /* no config space/special cycle support */
+ regs->edx = 0x20494350; /* " ICP" */
+ regs->ebx = 0x0210; /* Version 2.10 */
+ regs->ecx &= 0xFF00;
+ regs->ecx |= (pciMaxBus & 0xFF); /* Max bus number in system */
+ regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
+ i_printf("ax=0x%lx dx=0x%lx bx=0x%lx cx=0x%lx flags=0x%lx\n",
+ regs->eax,regs->edx,regs->ebx,regs->ecx,regs->eflags);
+ return 1;
case 0xb102:
- if (((regs->edx & 0xFFFF) == CurrentPci->VendorID) &&
- ((regs->ecx & 0xFFFF) == CurrentPci->DeviceID) &&
- (regs->esi == 0)) {
- regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
- regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
- regs->ebx = pciSlotBX(CurrentPci);
- }
- else if (Config.ShowAllDev &&
- (pPci = findPciDevice(regs->edx,regs->ecx,regs->esi)) != NULL) {
- regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
- regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
- regs->ebx = pciSlotBX(pPci);
- } else {
- regs->eax = (regs->eax & 0x00FF) | (DEVICE_NOT_FOUND << 8);
- regs->eflags |= ((unsigned long)0x01); /* set carry flag */
- }
- i_printf("ax=0x%lx bx=0x%lx flags=0x%lx\n",
- regs->eax,regs->ebx,regs->eflags);
- return 1;
+ if (((regs->edx & 0xFFFF) == CurrentPci->VendorID) &&
+ ((regs->ecx & 0xFFFF) == CurrentPci->DeviceID) &&
+ (regs->esi == 0)) {
+ regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
+ regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
+ regs->ebx = pciSlotBX(CurrentPci);
+ }
+ else if (Config.ShowAllDev &&
+ (pPci = findPciDevice(regs->edx,regs->ecx,regs->esi)) != NULL) {
+ regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
+ regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
+ regs->ebx = pciSlotBX(pPci);
+ } else {
+ regs->eax = (regs->eax & 0x00FF) | (DEVICE_NOT_FOUND << 8);
+ regs->eflags |= ((unsigned long)0x01); /* set carry flag */
+ }
+ i_printf("ax=0x%lx bx=0x%lx flags=0x%lx\n",
+ regs->eax,regs->ebx,regs->eflags);
+ return 1;
case 0xb103:
- if (((regs->ecx & 0xFF) == CurrentPci->Interface) &&
- (((regs->ecx & 0xFF00) >> 8) == CurrentPci->SubClass) &&
- (((regs->ecx & 0xFFFF0000) >> 16) == CurrentPci->BaseClass) &&
- ((regs->esi & 0xff) == 0)) {
- regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
- regs->ebx = pciSlotBX(CurrentPci);
- regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
- }
- else if (Config.ShowAllDev
- && (pPci = findPciClass(regs->ecx & 0xFF, (regs->ecx & 0xff00) >> 8,
- (regs->ecx & 0xffff0000) >> 16, regs->esi)) != NULL) {
- regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
- regs->ebx = pciSlotBX(pPci);
- regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
- regs->eax = (regs->eax & 0x00FF) | (DEVICE_NOT_FOUND << 8);
- regs->eflags |= ((unsigned long)0x01); /* set carry flag */
- }
- i_printf("ax=0x%lx flags=0x%lx\n",regs->eax,regs->eflags);
- return 1;
+ if (((regs->ecx & 0xFF) == CurrentPci->Interface) &&
+ (((regs->ecx & 0xFF00) >> 8) == CurrentPci->SubClass) &&
+ (((regs->ecx & 0xFFFF0000) >> 16) == CurrentPci->BaseClass) &&
+ ((regs->esi & 0xff) == 0)) {
+ regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
+ regs->ebx = pciSlotBX(CurrentPci);
+ regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
+ }
+ else if (Config.ShowAllDev
+ && (pPci = findPciClass(regs->ecx & 0xFF, (regs->ecx & 0xff00) >> 8,
+ (regs->ecx & 0xffff0000) >> 16, regs->esi)) != NULL) {
+ regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
+ regs->ebx = pciSlotBX(pPci);
+ regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
+ } else {
+ regs->eax = (regs->eax & 0x00FF) | (DEVICE_NOT_FOUND << 8);
+ regs->eflags |= ((unsigned long)0x01); /* set carry flag */
+ }
+ i_printf("ax=0x%lx flags=0x%lx\n",regs->eax,regs->eflags);
+ return 1;
case 0xb108:
- i_printf("Slot=0x%x\n",CurrentPci->Slot.l);
- if ((Slot = findPci(regs->ebx))) {
- regs->ecx &= 0xFFFFFF00;
- regs->ecx |= PciRead8(regs->edi,Slot);
- regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
- regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
- regs->eax = (regs->eax & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
- regs->eflags |= ((unsigned long)0x01); /* set carry flag */
- }
- i_printf("ax=0x%lx cx=0x%lx flags=0x%lx\n",
- regs->eax,regs->ecx,regs->eflags);
- return 1;
+ i_printf("Slot=0x%x\n",CurrentPci->Slot.l);
+ if ((Slot = findPci(regs->ebx))) {
+ regs->ecx &= 0xFFFFFF00;
+ regs->ecx |= PciRead8(regs->edi,Slot);
+ regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
+ regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
+ } else {
+ regs->eax = (regs->eax & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
+ regs->eflags |= ((unsigned long)0x01); /* set carry flag */
+ }
+ i_printf("ax=0x%lx cx=0x%lx flags=0x%lx\n",
+ regs->eax,regs->ecx,regs->eflags);
+ return 1;
case 0xb109:
- i_printf("Slot=0x%x\n",CurrentPci->Slot.l);
- if ((Slot = findPci(regs->ebx))) {
- regs->ecx &= 0xFFFF0000;
- regs->ecx |= PciRead16(regs->edi,Slot);
- regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
- regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
- regs->eax = (regs->eax & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
- regs->eflags |= ((unsigned long)0x01); /* set carry flag */
- }
- i_printf("ax=0x%lx cx=0x%lx flags=0x%lx\n",
- regs->eax,regs->ecx,regs->eflags);
- return 1;
+ i_printf("Slot=0x%x\n",CurrentPci->Slot.l);
+ if ((Slot = findPci(regs->ebx))) {
+ regs->ecx &= 0xFFFF0000;
+ regs->ecx |= PciRead16(regs->edi,Slot);
+ regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
+ regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
+ } else {
+ regs->eax = (regs->eax & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
+ regs->eflags |= ((unsigned long)0x01); /* set carry flag */
+ }
+ i_printf("ax=0x%lx cx=0x%lx flags=0x%lx\n",
+ regs->eax,regs->ecx,regs->eflags);
+ return 1;
case 0xb10a:
- i_printf("Slot=0x%x\n",CurrentPci->Slot.l);
- if ((Slot = findPci(regs->ebx))) {
- regs->ecx &= 0;
- regs->ecx |= PciRead32(regs->edi,Slot);
- regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
- regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
- regs->eax = (regs->eax & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
- regs->eflags |= ((unsigned long)0x01); /* set carry flag */
- }
- i_printf("ax=0x%lx cx=0x%lx flags=0x%lx\n",
- regs->eax,regs->ecx,regs->eflags);
- return 1;
+ i_printf("Slot=0x%x\n",CurrentPci->Slot.l);
+ if ((Slot = findPci(regs->ebx))) {
+ regs->ecx &= 0;
+ regs->ecx |= PciRead32(regs->edi,Slot);
+ regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
+ regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
+ } else {
+ regs->eax = (regs->eax & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
+ regs->eflags |= ((unsigned long)0x01); /* set carry flag */
+ }
+ i_printf("ax=0x%lx cx=0x%lx flags=0x%lx\n",
+ regs->eax,regs->ecx,regs->eflags);
+ return 1;
case 0xb10b:
- i_printf("Slot=0x%x\n",CurrentPci->Slot.l);
- if ((Slot = findPci(regs->ebx))) {
- PciWrite8(regs->edi,(CARD8)regs->ecx,Slot);
- regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
- regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
- regs->eax = (regs->eax & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
- regs->eflags |= ((unsigned long)0x01); /* set carry flag */
- }
- i_printf("ax=0x%lx flags=0x%lx\n", regs->eax,regs->eflags);
- return 1;
+ i_printf("Slot=0x%x\n",CurrentPci->Slot.l);
+ if ((Slot = findPci(regs->ebx))) {
+ PciWrite8(regs->edi,(CARD8)regs->ecx,Slot);
+ regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
+ regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
+ } else {
+ regs->eax = (regs->eax & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
+ regs->eflags |= ((unsigned long)0x01); /* set carry flag */
+ }
+ i_printf("ax=0x%lx flags=0x%lx\n", regs->eax,regs->eflags);
+ return 1;
case 0xb10c:
- i_printf("Slot=0x%x\n",CurrentPci->Slot.l);
- if ((Slot = findPci(regs->ebx))) {
- PciWrite16(regs->edi,(CARD16)regs->ecx,Slot);
- regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
- regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
- regs->eax = (regs->eax & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
- regs->eflags |= ((unsigned long)0x01); /* set carry flag */
- }
- i_printf("ax=0x%lx flags=0x%lx\n", regs->eax,regs->eflags);
- return 1;
+ i_printf("Slot=0x%x\n",CurrentPci->Slot.l);
+ if ((Slot = findPci(regs->ebx))) {
+ PciWrite16(regs->edi,(CARD16)regs->ecx,Slot);
+ regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
+ regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
+ } else {
+ regs->eax = (regs->eax & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
+ regs->eflags |= ((unsigned long)0x01); /* set carry flag */
+ }
+ i_printf("ax=0x%lx flags=0x%lx\n", regs->eax,regs->eflags);
+ return 1;
case 0xb10d:
- i_printf("Slot=0x%x\n",CurrentPci->Slot.l);
- if ((Slot = findPci(regs->ebx))) {
- PciWrite32(regs->edi,(CARD32)regs->ecx,Slot);
- regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
- regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
- regs->eax = (regs->eax & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
- regs->eflags |= ((unsigned long)0x01); /* set carry flag */
- }
- i_printf("ax=0x%lx flags=0x%lx\n", regs->eax,regs->eflags);
- return 1;
+ i_printf("Slot=0x%x\n",CurrentPci->Slot.l);
+ if ((Slot = findPci(regs->ebx))) {
+ PciWrite32(regs->edi,(CARD32)regs->ecx,Slot);
+ regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
+ regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
+ } else {
+ regs->eax = (regs->eax & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
+ regs->eflags |= ((unsigned long)0x01); /* set carry flag */
+ }
+ i_printf("ax=0x%lx flags=0x%lx\n", regs->eax,regs->eflags);
+ return 1;
default:
- return 0;
+ return 0;
}
}
diff --git a/board/MAI/bios_emulator/scitech/src/v86bios/io.c b/board/MAI/bios_emulator/scitech/src/v86bios/io.c
index 129e24f383..f35b43e9b9 100644
--- a/board/MAI/bios_emulator/scitech/src/v86bios/io.c
+++ b/board/MAI/bios_emulator/scitech/src/v86bios/io.c
@@ -38,17 +38,17 @@ port_rep_inb(CARD16 port, CARD8 *base, int d_f, CARD32 count)
{
register int inc = d_f ? -1 : 1;
CARD8 *dst = base;
-
+
p_printf(" rep_insb(%#x) %d bytes at %p %s",
- port, count, base, d_f?"up":"down");
+ port, count, base, d_f?"up":"down");
if (Config.PrintIp)
- p_printf(" %x\n",getIP());
+ p_printf(" %x\n",getIP());
else p_printf("\n");
r_inb++;
while (count--) {
- *dst = inb(port);
- dst += inc;
+ *dst = inb(port);
+ dst += inc;
}
return (dst-base);
}
@@ -58,17 +58,17 @@ port_rep_inw(CARD16 port, CARD16 *base, int d_f, CARD32 count)
{
register int inc = d_f ? -1 : 1;
CARD16 *dst = base;
-
+
p_printf(" rep_insw(%#x) %d bytes at %p %s",
- port, count, base, d_f?"up":"down");
+ port, count, base, d_f?"up":"down");
if (Config.PrintIp)
- p_printf(" %x\n",getIP());
+ p_printf(" %x\n",getIP());
else p_printf("\n");
r_inw++;
while (count--) {
- *dst = inw(port);
- dst += inc;
+ *dst = inw(port);
+ dst += inc;
}
return (dst-base);
}
@@ -78,17 +78,17 @@ port_rep_inl(CARD16 port, CARD32 *base, int d_f, CARD32 count)
{
register int inc = d_f ? -1 : 1;
CARD32 *dst = base;
-
+
p_printf(" rep_insl(%#x) %d bytes at %p %s",
- port, count, base, d_f?"up":"down");
+ port, count, base, d_f?"up":"down");
if (Config.PrintIp)
- p_printf(" %x\n",getIP());
+ p_printf(" %x\n",getIP());
else p_printf("\n");
r_inl++;
while (count--) {
- *dst = inl(port);
- dst += inc;
+ *dst = inl(port);
+ dst += inc;
}
return (dst-base);
}
@@ -98,17 +98,17 @@ port_rep_outb(CARD16 port, CARD8 *base, int d_f, CARD32 count)
{
register int inc = d_f ? -1 : 1;
CARD8 *dst = base;
-
+
p_printf(" rep_outb(%#x) %d bytes at %p %s",
- port, count, base, d_f?"up":"down");
+ port, count, base, d_f?"up":"down");
if (Config.PrintIp)
- p_printf(" %x\n",getIP());
+ p_printf(" %x\n",getIP());
else p_printf("\n");
r_outb++;
while (count--) {
- outb(port,*dst);
- dst += inc;
+ outb(port,*dst);
+ dst += inc;
}
return (dst-base);
}
@@ -118,17 +118,17 @@ port_rep_outw(CARD16 port, CARD16 *base, int d_f, CARD32 count)
{
register int inc = d_f ? -1 : 1;
CARD16 *dst = base;
-
+
p_printf(" rep_outw(%#x) %d bytes at %p %s",
- port, count, base, d_f?"up":"down");
+ port, count, base, d_f?"up":"down");
if (Config.PrintIp)
- p_printf(" %x\n",getIP());
+ p_printf(" %x\n",getIP());
else p_printf("\n");
r_outw++;
while (count--) {
- outw(port,*dst);
- dst += inc;
+ outw(port,*dst);
+ dst += inc;
}
return (dst-base);
}
@@ -138,17 +138,17 @@ port_rep_outl(CARD16 port, CARD32 *base, int d_f, CARD32 count)
{
register int inc = d_f ? -1 : 1;
CARD32 *dst = base;
-
+
p_printf(" rep_outl(%#x) %d bytes at %p %s",
- port, count, base, d_f?"up":"down");
+ port, count, base, d_f?"up":"down");
if (Config.PrintIp)
- p_printf(" %x\n",getIP());
+ p_printf(" %x\n",getIP());
else p_printf("\n");
r_outl++;
while (count--) {
- outl(port,*dst);
- dst += inc;
+ outl(port,*dst);
+ dst += inc;
}
return (dst-base);
}
@@ -161,7 +161,7 @@ p_inb(CARD16 port)
val = inb(port);
p_printf(" inb(%#x) = %2.2x",port,val);
if (Config.PrintIp)
- p_printf(" %x\n",getIP());
+ p_printf(" %x\n",getIP());
else p_printf("\n");
return val;
@@ -175,7 +175,7 @@ p_inw(CARD16 port)
val = inw(port);
p_printf(" inw(%#x) = %4.4x",port,val);
if (Config.PrintIp)
- p_printf(" %x\n",getIP());
+ p_printf(" %x\n",getIP());
else p_printf("\n");
return val;
@@ -188,13 +188,13 @@ p_inl(CARD16 port)
in_l++;
#ifdef NEED_PCI_IO
if (cfg1in(port,&val))
- return val;
+ return val;
else
#endif
val = inl(port);
p_printf(" inl(%#x) = %8.8x",port,val);
if (Config.PrintIp)
- p_printf(" %x\n",getIP());
+ p_printf(" %x\n",getIP());
else p_printf("\n");
return val;
@@ -206,7 +206,7 @@ p_outb(CARD16 port, CARD8 val)
out_b++;
p_printf(" outb(%#x, %2.2x)",port,val);
if (Config.PrintIp)
- p_printf(" %x\n",getIP());
+ p_printf(" %x\n",getIP());
else p_printf("\n");
outb(port,val);
@@ -218,7 +218,7 @@ p_outw(CARD16 port, CARD16 val)
out_w++;
p_printf(" outw(%#x, %4.4x)",port,val);
if (Config.PrintIp)
- p_printf(" %x\n",getIP());
+ p_printf(" %x\n",getIP());
else p_printf("\n");
outw(port,val);
@@ -230,12 +230,12 @@ p_outl(CARD16 port, CARD32 val)
out_l++;
p_printf(" outl(%#x, %8.8x)",port,val);
if (Config.PrintIp)
- p_printf(" %x\n",getIP());
+ p_printf(" %x\n",getIP());
else p_printf("\n");
#ifdef NEED_PCI_IO
if (cfg1out(port,val))
- return;
+ return;
#endif
outl(port,val);
}
@@ -244,9 +244,9 @@ void
io_statistics(void)
{
p_printf("rep: inb: %i, inw: %i, inl: %i, outb: %i, outw: %i, outl: %i\n",
- r_inb,r_inw,r_inl,r_outb,r_outw,r_outl);
+ r_inb,r_inw,r_inl,r_outb,r_outw,r_outl);
p_printf("inb: %i, inw: %i, inl: %i, outb: %i, outw: %i, outl: %i\n",
- in_b,in_w,in_l,out_b,out_w,out_l);
+ in_b,in_w,in_l,out_b,out_w,out_l);
}
void
diff --git a/board/MAI/bios_emulator/scitech/src/v86bios/main.c b/board/MAI/bios_emulator/scitech/src/v86bios/main.c
index b73d05776e..15f91150f8 100644
--- a/board/MAI/bios_emulator/scitech/src/v86bios/main.c
+++ b/board/MAI/bios_emulator/scitech/src/v86bios/main.c
@@ -45,12 +45,12 @@
#define V_BIOS_SIZE 0x1FFFF
#define BIOS_START 0x7C00 /* default BIOS entry */
-//CARD8 code[] = { 0xb8 , 0xf0 , 0xf0, 0xf4 };
+/*CARD8 code[] = { 0xb8 , 0xf0 , 0xf0, 0xf4 }; */
#define VB_X(x) (V_BIOS >> x) & 0xFF
CARD8 code[] = { 0x9a, 0x03, 0x00, 0x00, VB_X(12), 0xf4 };
-//CARD8 code[] = { 0x9a, 0x03, 0x00, 0x00, VB_X(12), 0xb8, 0x03, 0x00,
-//0xcd, 0x10, 0xf4 };
-//CARD8 code[] = { 0xb8 , 0xf0 , 0xf0 ,0xf4 };
+/*CARD8 code[] = { 0x9a, 0x03, 0x00, 0x00, VB_X(12), 0xb8, 0x03, 0x00, */
+/*0xcd, 0x10, 0xf4 }; */
+/*CARD8 code[] = { 0xb8 , 0xf0 , 0xf0 ,0xf4 }; */
static void sig_handler(int);
static int map(void);
@@ -87,154 +87,154 @@ main(void)
Config.IoStatistics = IO_STATISTICS;
Config.PrintIrq = PRINT_IRQ;
Config.PrintPci = PRINT_PCI;
- Config.ShowAllDev = SHOW_ALL_DEV;
- Config.PrintIp = PRINT_IP;
- Config.SaveBios = SAVE_BIOS;
- Config.Trace = TRACE;
- Config.ConfigActiveOnly = CONFIG_ACTIVE_ONLY;
+ Config.ShowAllDev = SHOW_ALL_DEV;
+ Config.PrintIp = PRINT_IP;
+ Config.SaveBios = SAVE_BIOS;
+ Config.Trace = TRACE;
+ Config.ConfigActiveOnly = CONFIG_ACTIVE_ONLY;
Config.ConfigActiveDevice = CONFIG_ACTIVE_DEVICE;
- Config.MapSysBios = MAP_SYS_BIOS;
- Config.Resort = RESORT;
- Config.FixRom = FIX_ROM;
- Config.NoConsole = NO_CONSOLE;
+ Config.MapSysBios = MAP_SYS_BIOS;
+ Config.Resort = RESORT;
+ Config.FixRom = FIX_ROM;
+ Config.NoConsole = NO_CONSOLE;
Config.Verbose = VERBOSE;
if (!map())
- exit(1);
-
+ exit(1);
+
if (!setup_system_bios())
- exit(1);
-
+ exit(1);
+
iopl(3);
setup_io();
-
+
scan_pci();
if (!CurrentPci && !Config.ConfigActiveDevice && !Config.ConfigActiveOnly)
- exit (1);
+ exit (1);
#endif
Console = open_console();
if (Config.ConfigActiveOnly) {
- CARD16 ax;
- int activePci = 0;
- int error = 0;
-
- while (CurrentPci) {
- if (CurrentPci->active) {
- activePci = 1;
- if (!(mapPciRom(NULL) && chksum((CARD8*)V_BIOS)))
- error = 1;
- break;
- }
- CurrentPci = CurrentPci->next;
- }
- ax = ((CARD16)(CurrentPci->bus) << 8)
- | (CurrentPci->dev << 3) | (CurrentPci->func & 0x7);
- P_printf("ax: 0x%x\n",ax);
- setup_int_vect();
- if (!error && (activePci || copy_vbios())) {
-
- if (Config.SaveBios) save_bios_to_file();
- if (map_vram()) {
- printf("initializing ISA\n");
- bootBIOS(0);
- }
- }
- unmap_vram();
- sleep(1);
+ CARD16 ax;
+ int activePci = 0;
+ int error = 0;
+
+ while (CurrentPci) {
+ if (CurrentPci->active) {
+ activePci = 1;
+ if (!(mapPciRom(NULL) && chksum((CARD8*)V_BIOS)))
+ error = 1;
+ break;
+ }
+ CurrentPci = CurrentPci->next;
+ }
+ ax = ((CARD16)(CurrentPci->bus) << 8)
+ | (CurrentPci->dev << 3) | (CurrentPci->func & 0x7);
+ P_printf("ax: 0x%x\n",ax);
+ setup_int_vect();
+ if (!error && (activePci || copy_vbios())) {
+
+ if (Config.SaveBios) save_bios_to_file();
+ if (map_vram()) {
+ printf("initializing ISA\n");
+ bootBIOS(0);
+ }
+ }
+ unmap_vram();
+ sleep(1);
} else {
- /* disable primary card */
- save_msr = inb(0x3CC);
- save_vse = inb(0x3C3);
- save_46e8 = inb(0x46e8);
- save_pos102 = inb(0x102);
-
- signal(2,sig_handler);
- signal(11,sig_handler);
-
- outb(0x3C2,~(CARD8)0x03 & save_msr);
- outb(0x3C3,~(CARD8)0x01 & save_vse);
- outb(0x46e8, ~(CARD8)0x08 & save_46e8);
- outb(0x102, ~(CARD8)0x01 & save_pos102);
-
- pciVideoDisable();
-
- while (CurrentPci) {
- CARD16 ax;
-
- if (CurrentPci->active) {
- Active_is_Pci = 1;
- if (!Config.ConfigActiveDevice) {
- CurrentPci = CurrentPci->next;
- continue;
- }
- }
-
- EnableCurrent();
-
- if (CurrentPci->active) {
- outb(0x102, save_pos102);
- outb(0x46e8, save_46e8);
- outb(0x3C3, save_vse);
- outb(0x3C2, save_msr);
- }
-
- /* clear interrupt vectors */
- setup_int_vect();
-
- ax = ((CARD16)(CurrentPci->bus) << 8)
- | (CurrentPci->dev << 3) | (CurrentPci->func & 0x7);
- P_printf("ax: 0x%x\n",ax);
-
- if (!((mapPciRom(NULL) && chksum((CARD8*)V_BIOS))
- || (CurrentPci->active && copy_vbios()))) {
- CurrentPci = CurrentPci->next;
- continue;
- }
- if (!map_vram()) {
- CurrentPci = CurrentPci->next;
- continue;
- }
- if (Config.SaveBios) save_bios_to_file();
- printf("initializing PCI bus: %i dev: %i func: %i\n",CurrentPci->bus,
- CurrentPci->dev,CurrentPci->func);
- bootBIOS(ax);
- unmap_vram();
-
- CurrentPci = CurrentPci->next;
- }
-
- /* We have an ISA device - configure if requested */
- if (!Active_is_Pci && Config.ConfigActiveDevice) {
- pciVideoDisable();
-
- outb(0x102, save_pos102);
- outb(0x46e8, save_46e8);
- outb(0x3C3, save_vse);
- outb(0x3C2, save_msr);
-
- setup_int_vect();
- if (copy_vbios()) {
-
- if (Config.SaveBios) save_bios_to_file();
- if (map_vram()) {
- printf("initializing ISA\n");
- bootBIOS(0);
- }
- }
-
- unmap_vram();
- sleep(1);
- }
-
- pciVideoRestore();
-
- outb(0x102, save_pos102);
- outb(0x46e8, save_46e8);
- outb(0x3C3, save_vse);
- outb(0x3C2, save_msr);
+ /* disable primary card */
+ save_msr = inb(0x3CC);
+ save_vse = inb(0x3C3);
+ save_46e8 = inb(0x46e8);
+ save_pos102 = inb(0x102);
+
+ signal(2,sig_handler);
+ signal(11,sig_handler);
+
+ outb(0x3C2,~(CARD8)0x03 & save_msr);
+ outb(0x3C3,~(CARD8)0x01 & save_vse);
+ outb(0x46e8, ~(CARD8)0x08 & save_46e8);
+ outb(0x102, ~(CARD8)0x01 & save_pos102);
+
+ pciVideoDisable();
+
+ while (CurrentPci) {
+ CARD16 ax;
+
+ if (CurrentPci->active) {
+ Active_is_Pci = 1;
+ if (!Config.ConfigActiveDevice) {
+ CurrentPci = CurrentPci->next;
+ continue;
+ }
+ }
+
+ EnableCurrent();
+
+ if (CurrentPci->active) {
+ outb(0x102, save_pos102);
+ outb(0x46e8, save_46e8);
+ outb(0x3C3, save_vse);
+ outb(0x3C2, save_msr);
+ }
+
+ /* clear interrupt vectors */
+ setup_int_vect();
+
+ ax = ((CARD16)(CurrentPci->bus) << 8)
+ | (CurrentPci->dev << 3) | (CurrentPci->func & 0x7);
+ P_printf("ax: 0x%x\n",ax);
+
+ if (!((mapPciRom(NULL) && chksum((CARD8*)V_BIOS))
+ || (CurrentPci->active && copy_vbios()))) {
+ CurrentPci = CurrentPci->next;
+ continue;
+ }
+ if (!map_vram()) {
+ CurrentPci = CurrentPci->next;
+ continue;
+ }
+ if (Config.SaveBios) save_bios_to_file();
+ printf("initializing PCI bus: %i dev: %i func: %i\n",CurrentPci->bus,
+ CurrentPci->dev,CurrentPci->func);
+ bootBIOS(ax);
+ unmap_vram();
+
+ CurrentPci = CurrentPci->next;
+ }
+
+ /* We have an ISA device - configure if requested */
+ if (!Active_is_Pci && Config.ConfigActiveDevice) {
+ pciVideoDisable();
+
+ outb(0x102, save_pos102);
+ outb(0x46e8, save_46e8);
+ outb(0x3C3, save_vse);
+ outb(0x3C2, save_msr);
+
+ setup_int_vect();
+ if (copy_vbios()) {
+
+ if (Config.SaveBios) save_bios_to_file();
+ if (map_vram()) {
+ printf("initializing ISA\n");
+ bootBIOS(0);
+ }
+ }
+
+ unmap_vram();
+ sleep(1);
+ }
+
+ pciVideoRestore();
+
+ outb(0x102, save_pos102);
+ outb(0x46e8, save_46e8);
+ outb(0x3C3, save_vse);
+ outb(0x3C2, save_msr);
}
-
+
close_console(Console);
#ifdef DELETE
iopl(0);
@@ -243,24 +243,24 @@ main(void)
printf("done !\n");
#endif
if (Config.IoStatistics)
- io_statistics();
+ io_statistics();
#ifdef DELETE
exit(0);
#endif
}
-int
+int
map(void)
{
void* mem;
mem = mmap(0, (size_t)SIZE,
- PROT_EXEC | PROT_READ | PROT_WRITE,
- MAP_FIXED | MAP_PRIVATE | MAP_ANON,
- -1, 0 );
+ PROT_EXEC | PROT_READ | PROT_WRITE,
+ MAP_FIXED | MAP_PRIVATE | MAP_ANON,
+ -1, 0 );
if (mem != 0) {
- perror("anonymous map");
- return (0);
+ perror("anonymous map");
+ return (0);
}
memset(mem,0,SIZE);
@@ -294,33 +294,33 @@ map_vram(void)
int mem_fd;
#ifdef __ia64__
- if ((mem_fd = open(MEM_FILE,O_RDWR | O_SYNC))<0)
+ if ((mem_fd = open(MEM_FILE,O_RDWR | O_SYNC))<0)
#else
- if ((mem_fd = open(MEM_FILE,O_RDWR))<0)
+ if ((mem_fd = open(MEM_FILE,O_RDWR))<0)
#endif
{
- perror("opening memory");
- return 0;
+ perror("opening memory");
+ return 0;
}
#ifndef __alpha__
if (mmap((void *) VRAM_START, (size_t) VRAM_SIZE,
- PROT_EXEC | PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED,
- mem_fd, VRAM_START) == (void *) -1)
+ PROT_EXEC | PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED,
+ mem_fd, VRAM_START) == (void *) -1)
#else
- if (!_bus_base()) sparse_shift = 7; /* Uh, oh, JENSEN... */
- if (!_bus_base_sparse()) sparse_shift = 0;
- if ((vram_map = mmap(0,(size_t) (VRAM_SIZE << sparse_shift),
- PROT_READ | PROT_WRITE,
- MAP_SHARED,
- mem_fd, (VRAM_START << sparse_shift)
- | _bus_base_sparse())) == (void *) -1)
+ if (!_bus_base()) sparse_shift = 7; /* Uh, oh, JENSEN... */
+ if (!_bus_base_sparse()) sparse_shift = 0;
+ if ((vram_map = mmap(0,(size_t) (VRAM_SIZE << sparse_shift),
+ PROT_READ | PROT_WRITE,
+ MAP_SHARED,
+ mem_fd, (VRAM_START << sparse_shift)
+ | _bus_base_sparse())) == (void *) -1)
#endif
{
- perror("mmap error in map_hardware_ram");
- close(mem_fd);
- return (0);
- }
+ perror("mmap error in map_hardware_ram");
+ close(mem_fd);
+ return (0);
+ }
vram_mapped = 1;
close(mem_fd);
return (1);
@@ -330,7 +330,7 @@ static void
unmap_vram(void)
{
if (!vram_mapped) return;
-
+
munmap((void*)VRAM_START,VRAM_SIZE);
vram_mapped = 0;
}
@@ -343,39 +343,39 @@ copy_vbios(void)
int size;
if ((mem_fd = open(MEM_FILE,O_RDONLY))<0) {
- perror("opening memory");
- return (0);
+ perror("opening memory");
+ return (0);
}
- if (lseek(mem_fd,(off_t) V_BIOS, SEEK_SET) != (off_t) V_BIOS) {
- fprintf(stderr,"Cannot lseek\n");
- goto Error;
+ if (lseek(mem_fd,(off_t) V_BIOS, SEEK_SET) != (off_t) V_BIOS) {
+ fprintf(stderr,"Cannot lseek\n");
+ goto Error;
}
tmp = (unsigned char *)malloc(3);
if (read(mem_fd, (char *)tmp, (size_t) 3) != (size_t) 3) {
- fprintf(stderr,"Cannot read\n");
- goto Error;
+ fprintf(stderr,"Cannot read\n");
+ goto Error;
}
- if (lseek(mem_fd,(off_t) V_BIOS,SEEK_SET) != (off_t) V_BIOS)
- goto Error;
+ if (lseek(mem_fd,(off_t) V_BIOS,SEEK_SET) != (off_t) V_BIOS)
+ goto Error;
if (*tmp != 0x55 || *(tmp+1) != 0xAA ) {
#ifdef DEBUG
- dprint((unsigned long)tmp,0x100);
+ dprint((unsigned long)tmp,0x100);
#endif
- fprintf(stderr,"No bios found at: 0x%x\n",V_BIOS);
- goto Error;
+ fprintf(stderr,"No bios found at: 0x%x\n",V_BIOS);
+ goto Error;
}
size = *(tmp+2) * 512;
if (read(mem_fd, (char *)V_BIOS, (size_t) size) != (size_t) size) {
- fprintf(stderr,"Cannot read\n");
- goto Error;
+ fprintf(stderr,"Cannot read\n");
+ goto Error;
}
free(tmp);
close(mem_fd);
if (!chksum((CARD8)V_BIOS))
- return (0);
+ return (0);
return (1);
@@ -392,14 +392,14 @@ copy_sys_bios(void)
int mem_fd;
if ((mem_fd = open(MEM_FILE,O_RDONLY))<0) {
- perror("opening memory");
- return (0);
+ perror("opening memory");
+ return (0);
}
-
- if (lseek(mem_fd,(off_t) SYS_BIOS,SEEK_SET) != (off_t) SYS_BIOS)
- goto Error;
- if (read(mem_fd, (char *)SYS_BIOS, (size_t) 0xFFFF) != (size_t) 0xFFFF)
- goto Error;
+
+ if (lseek(mem_fd,(off_t) SYS_BIOS,SEEK_SET) != (off_t) SYS_BIOS)
+ goto Error;
+ if (read(mem_fd, (char *)SYS_BIOS, (size_t) 0xFFFF) != (size_t) 0xFFFF)
+ goto Error;
close(mem_fd);
return (1);
@@ -415,16 +415,16 @@ loadCodeToMem(unsigned char *ptr, CARD8 code[])
{
int i;
CARD8 val;
-
+
for ( i=0;;i++) {
- val = code[i];
- *ptr++ = val;
- if (val == 0xf4) break;
+ val = code[i];
+ *ptr++ = val;
+ if (val == 0xf4) break;
}
return;
}
-
-void
+
+void
dprint(unsigned long start, unsigned long size)
{
int i,j;
@@ -433,13 +433,13 @@ dprint(unsigned long start, unsigned long size)
for (j = 0; j < (size >> 4); j++) {
char *d = c;
printf("\n0x%lx: ",(unsigned long)c);
- for (i = 0; i<16; i++)
- printf("%2.2x ",(unsigned char) (*(c++)));
+ for (i = 0; i<16; i++)
+ printf("%2.2x ",(unsigned char) (*(c++)));
c = d;
for (i = 0; i<16; i++) {
- printf("%c",((((CARD8)(*c)) > 32) && (((CARD8)(*c)) < 128)) ?
- (unsigned char) (*(c)): '.');
- c++;
+ printf("%c",((((CARD8)(*c)) > 32) && (((CARD8)(*c)) < 128)) ?
+ (unsigned char) (*(c)): '.');
+ c++;
}
}
printf("\n");
@@ -452,16 +452,16 @@ save_bios_to_file(void)
int size, count;
char file_name[256];
int fd;
-
+
sprintf(file_name,"bios_%i.fil",num);
if ((fd = open(file_name,O_WRONLY | O_CREAT | O_TRUNC,00644)) == -1)
- return;
+ return;
size = (*(unsigned char*)(V_BIOS + 2)) * 512;
#ifdef V86BIOS_DEBUG
dprint(V_BIOS,20);
#endif
if ((count = write(fd,(void *)(V_BIOS),size)) != size)
- fprintf(stderr,"only saved %i of %i bytes\n",size,count);
+ fprintf(stderr,"only saved %i of %i bytes\n",size,count);
num++;
}
@@ -511,11 +511,11 @@ setup_int_vect(void)
const CARD16 cs = 0x0000;
const CARD16 ip = 0x0;
int i;
-
+
/* let the int vects point to the SYS_BIOS seg */
for (i=0; i<0x80; i++) {
- ((CARD16*)0)[i<<1] = ip;
- ((CARD16*)0)[(i<<1)+1] = cs;
+ ((CARD16*)0)[i<<1] = ip;
+ ((CARD16*)0)[(i<<1)+1] = cs;
}
/* video interrupts default location */
((CARD16*)0)[(0x42<<1)+1] = 0xf000;
@@ -566,13 +566,13 @@ setup_system_bios(void)
{
char *date = "06/01/99";
char *eisa_ident = "PCI/ISA";
-
+
#if MAP_SYS_BIOS
if (!copy_sys_bios()) return 0;
return 1;
#endif
-// memset((void *)0xF0000,0xf4,0xfff7);
-
+/* memset((void *)0xF0000,0xf4,0xfff7); */
+
/*
* we trap the "industry standard entry points" to the BIOS
* and all other locations by filling them with "hlt"
@@ -586,7 +586,7 @@ setup_system_bios(void)
* and the font tables (0xfa6e-0xfe6d)
* from the original bios here
*/
-
+
/* set bios date */
strcpy((char *)0xFFFF5,date);
/* set up eisa ident string */
@@ -604,10 +604,10 @@ chksum(CARD8 *start)
CARD8 val = 0;
int i;
- size = *(start+2) * 512;
+ size = *(start+2) * 512;
for (i = 0; i<size; i++)
val += *(start + i);
-
+
if (!val)
return 1;
diff --git a/board/MAI/bios_emulator/scitech/src/v86bios/mem.c b/board/MAI/bios_emulator/scitech/src/v86bios/mem.c
index 50dc55fdf5..24c1aef8e5 100644
--- a/board/MAI/bios_emulator/scitech/src/v86bios/mem.c
+++ b/board/MAI/bios_emulator/scitech/src/v86bios/mem.c
@@ -43,7 +43,7 @@ mem_rb(CARD32 addr)
result = *(vuip) ((unsigned long)vram_map + (addr << sparse_shift));
result >>= shift;
return 0xffUL & result;
- } else
+ } else
#endif
return rdb(addr);
}
@@ -52,15 +52,15 @@ CARD16
mem_rw(CARD32 addr)
{
unsigned long result, shift;
-#if 1
+#if 1
if (addr >= 0xA0000 && addr <= 0xBFFFF) {
addr -= 0xA0000;
shift = (addr & 0x2) * 8;
result = *(vuip)((unsigned long)vram_map+(addr<<sparse_shift)
- +(1<<(sparse_shift-2)));
+ +(1<<(sparse_shift-2)));
result >>= shift;
return 0xffffUL & result;
- } else
+ } else
#endif
return rdw(addr);
}
@@ -69,12 +69,12 @@ CARD32
mem_rl(CARD32 addr)
{
unsigned long result;
-#if 1
+#if 1
if (addr >= 0xA0000 && addr <= 0xBFFFF) {
addr -= 0xA0000;
result = *(vuip)((unsigned long)vram_map+(addr<<sparse_shift)+(3<<(sparse_shift-2)));
return result;
- } else
+ } else
#endif
return rdl(addr);
}
@@ -83,12 +83,12 @@ void
mem_wb(CARD32 addr, CARD8 val)
{
unsigned int b = val & 0xffU;
-#if 1
+#if 1
if (addr >= 0xA0000 && addr <= 0xBFFFF) {
addr -= 0xA0000;
*(vuip) ((unsigned long)vram_map + (addr << sparse_shift)) = b * 0x01010101;
mem_barrier();
- } else
+ } else
#endif
wrb(addr,val);
}
@@ -97,13 +97,13 @@ void
mem_ww(CARD32 addr, CARD16 val)
{
unsigned int w = val & 0xffffU;
-#if 1
+#if 1
if (addr >= 0xA0000 && addr <= 0xBFFFF) {
addr -= 0xA0000;
*(vuip)((unsigned long)vram_map+(addr<<sparse_shift)
- +(1<<(sparse_shift-2))) = w * 0x00010001;
+ +(1<<(sparse_shift-2))) = w * 0x00010001;
mem_barrier();
- } else
+ } else
#endif
wrw(addr,val);
}
@@ -111,16 +111,14 @@ mem_ww(CARD32 addr, CARD16 val)
void
mem_wl(CARD32 addr, CARD32 val)
{
-#if 1
+#if 1
if (addr >= 0xA0000 && addr <= 0xBFFFF) {
addr -= 0xA0000;
*(vuip)((unsigned long)vram_map+(addr<<sparse_shift)
- +(3<<(sparse_shift-2))) = val;
+ +(3<<(sparse_shift-2))) = val;
mem_barrier();
- } else
+ } else
#endif
wrl(addr,val);
}
#endif
-
-
diff --git a/board/MAI/bios_emulator/scitech/src/v86bios/pci.c b/board/MAI/bios_emulator/scitech/src/v86bios/pci.c
index e68c61d5ef..b58a57195f 100644
--- a/board/MAI/bios_emulator/scitech/src/v86bios/pci.c
+++ b/board/MAI/bios_emulator/scitech/src/v86bios/pci.c
@@ -51,12 +51,12 @@ int pciMaxBus = 0;
static CARD32 PciCfg1Addr;
static void readConfigSpaceCfg1(CARD32 bus, CARD32 dev, CARD32 func,
- CARD32 *reg);
+ CARD32 *reg);
static int checkSlotCfg1(CARD32 bus, CARD32 dev, CARD32 func);
static int checkSlotCfg2(CARD32 bus, int dev);
static void readConfigSpaceCfg2(CARD32 bus, int dev, CARD32 *reg);
static CARD8 interpretConfigSpace(CARD32 *reg, int busidx,
- CARD8 dev, CARD8 func);
+ CARD8 dev, CARD8 func);
static CARD32 findBIOSMap(PciStructPtr pciP, CARD32 *biosSize);
static void restoreMem(PciStructPtr pciP);
@@ -72,10 +72,10 @@ axpPciCfgRead(CARD32 tag)
{
int bus, dfn;
CARD32 val = 0xffffffff;
-
+
bus = PCI_BUS_FROM_TAG(tag);
dfn = PCI_DFN_FROM_TAG(tag);
-
+
syscall(__NR_pciconfig_read, bus, dfn, tag & 0xff, 4, &val);
return(val);
}
@@ -84,10 +84,10 @@ void
axpPciCfgWrite(CARD32 tag, CARD32 val)
{
int bus, dfn;
-
+
bus = PCI_BUS_FROM_TAG(tag);
dfn = PCI_DFN_FROM_TAG(tag);
-
+
syscall(__NR_pciconfig_write, bus, dfn, tag & 0xff, 4, &val);
}
@@ -115,22 +115,21 @@ static int hostbridges = 1;
static unsigned long pciMinMemReg = ~0;
-
void
scan_pci(void)
{
unsigned short configtype;
-
+
CARD32 reg[64];
int busidx;
CARD8 cardnum;
CARD8 func;
int idx;
-
+
int i;
PciStructPtr pci1;
PciBusPtr pci_b1,pci_b2;
-
+
#if defined(__alpha__) || defined(__powerpc__) || defined(__sparc__) || defined(__ia64__)
configtype = 1;
#else
@@ -141,111 +140,111 @@ scan_pci(void)
tmp1 = inb(PCI_MODE2_ENABLE_REG);
tmp2 = inb(PCI_MODE2_FORWARD_REG);
if ((tmp1 == 0x00) && (tmp2 == 0x00)) {
- configtype = 2;
- readPci = readPciCfg2;
- writePci = writePciCfg2;
- P_printf("PCI says configuration type 2\n");
+ configtype = 2;
+ readPci = readPciCfg2;
+ writePci = writePciCfg2;
+ P_printf("PCI says configuration type 2\n");
} else {
- tmp32_1 = inl(PCI_MODE1_ADDRESS_REG);
- outl(PCI_MODE1_ADDRESS_REG, PCI_EN);
- tmp32_2 = inl(PCI_MODE1_ADDRESS_REG);
- outl(PCI_MODE1_ADDRESS_REG, tmp32_1);
- if (tmp32_2 == PCI_EN) {
- configtype = 1;
- P_printf("PCI says configuration type 1\n");
- } else {
- P_printf("No PCI !\n");
- return;
- }
+ tmp32_1 = inl(PCI_MODE1_ADDRESS_REG);
+ outl(PCI_MODE1_ADDRESS_REG, PCI_EN);
+ tmp32_2 = inl(PCI_MODE1_ADDRESS_REG);
+ outl(PCI_MODE1_ADDRESS_REG, tmp32_1);
+ if (tmp32_2 == PCI_EN) {
+ configtype = 1;
+ P_printf("PCI says configuration type 1\n");
+ } else {
+ P_printf("No PCI !\n");
+ return;
+ }
}
#endif
-
+
if (configtype == 1) {
- P_printf("PCI probing configuration type 1\n");
- busidx = 0;
- numbus = 1;
- idx = 0;
- do {
- P_printf("\nProbing for devices on PCI bus %d:\n", busidx);
- for (cardnum = 0; cardnum < MAX_DEV_PER_VENDOR_CFG1; cardnum++) {
- func = 0;
- do {
- /* loop over the different functions, if present */
- if (!checkSlotCfg1(busidx,cardnum,func))
- break;
- readConfigSpaceCfg1(busidx,cardnum,func,reg);
-
- func = interpretConfigSpace(reg,busidx,
- cardnum,func);
-
- if (idx++ > MAX_PCI_DEVICES)
- continue;
- } while (func < 8);
- }
- } while (++busidx < PCI_MAXBUS);
+ P_printf("PCI probing configuration type 1\n");
+ busidx = 0;
+ numbus = 1;
+ idx = 0;
+ do {
+ P_printf("\nProbing for devices on PCI bus %d:\n", busidx);
+ for (cardnum = 0; cardnum < MAX_DEV_PER_VENDOR_CFG1; cardnum++) {
+ func = 0;
+ do {
+ /* loop over the different functions, if present */
+ if (!checkSlotCfg1(busidx,cardnum,func))
+ break;
+ readConfigSpaceCfg1(busidx,cardnum,func,reg);
+
+ func = interpretConfigSpace(reg,busidx,
+ cardnum,func);
+
+ if (idx++ > MAX_PCI_DEVICES)
+ continue;
+ } while (func < 8);
+ }
+ } while (++busidx < PCI_MAXBUS);
#if defined(__alpha__) || defined(__powerpc__) || defined(__sparc__) || defined(__ia64__)
- /* don't use outl() ;-) */
+ /* don't use outl() ;-) */
#else
- outl(PCI_MODE1_ADDRESS_REG, 0);
+ outl(PCI_MODE1_ADDRESS_REG, 0);
#endif
} else {
- int slot;
-
- P_printf("PCI probing configuration type 2\n");
- busidx = 0;
- numbus = 1;
- idx = 0;
- do {
- for (slot=0xc0; slot<0xd0; i++) {
- if (!checkSlotCfg2(busidx,slot))
- break;
- readConfigSpaceCfg2(busidx,slot,reg);
-
- interpretConfigSpace(reg,busidx,
- slot,0);
- if (idx++ > MAX_PCI_DEVICES)
- continue;
- }
- } while (++busidx < PCI_MAXBUS);
+ int slot;
+
+ P_printf("PCI probing configuration type 2\n");
+ busidx = 0;
+ numbus = 1;
+ idx = 0;
+ do {
+ for (slot=0xc0; slot<0xd0; i++) {
+ if (!checkSlotCfg2(busidx,slot))
+ break;
+ readConfigSpaceCfg2(busidx,slot,reg);
+
+ interpretConfigSpace(reg,busidx,
+ slot,0);
+ if (idx++ > MAX_PCI_DEVICES)
+ continue;
+ }
+ } while (++busidx < PCI_MAXBUS);
}
-
-
+
+
pciMaxBus = numbus - 1;
P_printf("Number of buses in system: %i\n",pciMaxBus + 1);
P_printf("Min PCI mem address: 0x%lx\n",pciMinMemReg);
-
+
/* link buses */
pci_b1 = PciBuses;
while (pci_b1) {
- pci_b2 = PciBuses;
- pci_b1->pBus = NULL;
- while (pci_b2) {
- if (pci_b1->primary == pci_b2->secondary)
- pci_b1->pBus = pci_b2;
- pci_b2 = pci_b2->next;
- }
- pci_b1 = pci_b1->next;
+ pci_b2 = PciBuses;
+ pci_b1->pBus = NULL;
+ while (pci_b2) {
+ if (pci_b1->primary == pci_b2->secondary)
+ pci_b1->pBus = pci_b2;
+ pci_b2 = pci_b2->next;
+ }
+ pci_b1 = pci_b1->next;
}
pci1 = PciStruct;
while (pci1) {
- pci_b2 = PciBuses;
- pci1->pBus = NULL;
- while (pci_b2) {
- if (pci1->bus == pci_b2->secondary)
- pci1->pBus = pci_b2;
- pci_b2 = pci_b2->next;
- }
- pci1 = pci1->next;
+ pci_b2 = PciBuses;
+ pci1->pBus = NULL;
+ while (pci_b2) {
+ if (pci1->bus == pci_b2->secondary)
+ pci1->pBus = pci_b2;
+ pci_b2 = pci_b2->next;
+ }
+ pci1 = pci1->next;
}
if (RESORT) {
- PciStructPtr tmp = PciStruct, tmp1;
- PciStruct = NULL;
- while (tmp) {
- tmp1 = tmp->next;
- tmp->next = PciStruct;
- PciStruct = tmp;
- tmp = tmp1;
- }
+ PciStructPtr tmp = PciStruct, tmp1;
+ PciStruct = NULL;
+ while (tmp) {
+ tmp1 = tmp->next;
+ tmp->next = PciStruct;
+ PciStruct = tmp;
+ tmp = tmp1;
+ }
}
PciList = CurrentPci = PciStruct;
}
@@ -255,7 +254,7 @@ static CARD32
readPciCfg1(CARD32 reg)
{
CARD32 val;
-
+
outl(PCI_MODE1_ADDRESS_REG, reg);
val = inl(PCI_MODE1_DATA_REG);
outl(PCI_MODE1_ADDRESS_REG, 0);
@@ -279,7 +278,7 @@ readPciCfg2(CARD32 reg)
CARD8 bus = (reg >> 16) & 0xff;
CARD8 dev = (reg >> 11) & 0x1f;
CARD8 num = reg & 0xff;
-
+
outb(PCI_MODE2_ENABLE_REG, 0xF1);
outb(PCI_MODE2_FORWARD_REG, bus);
val = inl((dev << 8) + num);
@@ -309,16 +308,16 @@ pciVideoDisable(void)
/* disable VGA routing on bridges */
PciBusPtr pbp = PciBuses;
PciStructPtr pcp = PciStruct;
-
+
while (pbp) {
- writePci(pbp->Slot.l | 0x3c, pbp->bctl & ~(CARD32)(8<<16));
- pbp = pbp->next;
+ writePci(pbp->Slot.l | 0x3c, pbp->bctl & ~(CARD32)(8<<16));
+ pbp = pbp->next;
}
/* disable display devices */
while (pcp) {
- writePci(pcp->Slot.l | 0x04, pcp->cmd_st & ~(CARD32)3);
- writePci(pcp->Slot.l | 0x30, pcp->RomBase & ~(CARD32)1);
- pcp = pcp->next;
+ writePci(pcp->Slot.l | 0x04, pcp->cmd_st & ~(CARD32)3);
+ writePci(pcp->Slot.l | 0x30, pcp->RomBase & ~(CARD32)1);
+ pcp = pcp->next;
}
}
@@ -328,16 +327,16 @@ pciVideoRestore(void)
/* disable VGA routing on bridges */
PciBusPtr pbp = PciBuses;
PciStructPtr pcp = PciStruct;
-
+
while (pbp) {
- writePci(pbp->Slot.l | 0x3c, pbp->bctl);
- pbp = pbp->next;
+ writePci(pbp->Slot.l | 0x3c, pbp->bctl);
+ pbp = pbp->next;
}
/* disable display devices */
while (pcp) {
- writePci(pcp->Slot.l | 0x04, pcp->cmd_st);
- writePci(pcp->Slot.l | 0x30, pcp->RomBase);
- pcp = pcp->next;
+ writePci(pcp->Slot.l | 0x04, pcp->cmd_st);
+ writePci(pcp->Slot.l | 0x30, pcp->RomBase);
+ pcp = pcp->next;
}
}
@@ -346,13 +345,13 @@ EnableCurrent()
{
PciBusPtr pbp;
PciStructPtr pcp = CurrentPci;
-
+
pciVideoDisable();
-
+
pbp = pcp->pBus;
while (pbp) { /* enable bridges */
- writePci(pbp->Slot.l | 0x3c, pbp->bctl | (CARD32)(8<<16));
- pbp = pbp->pBus;
+ writePci(pbp->Slot.l | 0x3c, pbp->bctl | (CARD32)(8<<16));
+ pbp = pbp->pBus;
}
writePci(pcp->Slot.l | 0x04, pcp->cmd_st | (CARD32)3);
writePci(pcp->Slot.l | 0x30, pcp->RomBase | (CARD32)1);
@@ -427,35 +426,35 @@ mapPciRom(PciStructPtr pciP)
pciP = CurrentPci;
if (FIX_ROM) {
- RomBase = findBIOSMap(pciP, &biosSize);
- if (!RomBase) {
- fprintf(stderr,"Cannot remap BIOS of %i:%i:%i "
- "- trying preset address\n",pciP->bus,pciP->dev,
- pciP->func);
- RomBase = pciP->RomBase & ~(CARD32)0xFF;
- }
+ RomBase = findBIOSMap(pciP, &biosSize);
+ if (!RomBase) {
+ fprintf(stderr,"Cannot remap BIOS of %i:%i:%i "
+ "- trying preset address\n",pciP->bus,pciP->dev,
+ pciP->func);
+ RomBase = pciP->RomBase & ~(CARD32)0xFF;
+ }
} else {
- RomBase = pciP->RomBase & ~(CARD32)0xFF;
- if (~RomBase + 1 < biosSize || !RomBase)
- RomBase = findBIOSMap(pciP, &biosSize);
+ RomBase = pciP->RomBase & ~(CARD32)0xFF;
+ if (~RomBase + 1 < biosSize || !RomBase)
+ RomBase = findBIOSMap(pciP, &biosSize);
}
P_printf("RomBase: 0x%lx\n",RomBase);
-
+
if ((mem_fd = open(MEM_FILE,O_RDONLY))<0) {
- perror("opening memory");
- restoreMem(pciP);
- return (0);
+ perror("opening memory");
+ restoreMem(pciP);
+ return (0);
}
PciWrite32(0x30,RomBase | 1,pciP->Slot.l);
#ifdef __alpha__
mem = ptr = (unsigned char *)mmap(0, biosSize, PROT_READ,
- MAP_SHARED, mem_fd, RomBase | _bus_base());
+ MAP_SHARED, mem_fd, RomBase | _bus_base());
#else
mem = ptr = (unsigned char *)mmap(0, biosSize, PROT_READ,
- MAP_SHARED, mem_fd, RomBase);
+ MAP_SHARED, mem_fd, RomBase);
#endif
if (pciP != CurrentPci) {
enablePci = PciRead32(0x4,pciP->Slot.l);
@@ -466,37 +465,37 @@ mapPciRom(PciStructPtr pciP)
dprint((unsigned long)ptr,0x30);
#endif
while ( *ptr == 0x55 && *(ptr+1) == 0xAA) {
- unsigned short data_off = *(ptr+0x18) | (*(ptr+0x19)<< 8);
- unsigned char *data = ptr + data_off;
- unsigned char type;
- int i;
-
- if (*data!='P' || *(data+1)!='C' || *(data+2)!='I' || *(data+3)!='R') {
- break;
- }
- type = *(data + 0x14);
- P_printf("data segment in BIOS: 0x%x, type: 0x%x ",data_off,type);
-
- if (type != 0) { /* not PC-AT image: find next one */
- unsigned int image_length;
- unsigned char indicator = *(data + 0x15);
- if (indicator & 0x80) /* last image */
- break;
- image_length = (*(data + 0x10)
- | (*(data + 0x11) << 8)) << 9;
- P_printf("data image length: 0x%x, ind: 0x%x\n",
- image_length,indicator);
- ptr = ptr + image_length;
- continue;
- }
- /* OK, we have a PC Image */
- length = (*(ptr + 2) << 9);
- P_printf("BIOS length: 0x%x\n",length);
- scratch = (unsigned char *)malloc(length);
- /* don't use memcpy() here: Reading from bus! */
- for (i=0;i<length;i++)
- *(scratch + i)=*(ptr + i);
- break;
+ unsigned short data_off = *(ptr+0x18) | (*(ptr+0x19)<< 8);
+ unsigned char *data = ptr + data_off;
+ unsigned char type;
+ int i;
+
+ if (*data!='P' || *(data+1)!='C' || *(data+2)!='I' || *(data+3)!='R') {
+ break;
+ }
+ type = *(data + 0x14);
+ P_printf("data segment in BIOS: 0x%x, type: 0x%x ",data_off,type);
+
+ if (type != 0) { /* not PC-AT image: find next one */
+ unsigned int image_length;
+ unsigned char indicator = *(data + 0x15);
+ if (indicator & 0x80) /* last image */
+ break;
+ image_length = (*(data + 0x10)
+ | (*(data + 0x11) << 8)) << 9;
+ P_printf("data image length: 0x%x, ind: 0x%x\n",
+ image_length,indicator);
+ ptr = ptr + image_length;
+ continue;
+ }
+ /* OK, we have a PC Image */
+ length = (*(ptr + 2) << 9);
+ P_printf("BIOS length: 0x%x\n",length);
+ scratch = (unsigned char *)malloc(length);
+ /* don't use memcpy() here: Reading from bus! */
+ for (i=0;i<length;i++)
+ *(scratch + i)=*(ptr + i);
+ break;
}
if (pciP != CurrentPci)
@@ -509,10 +508,10 @@ mapPciRom(PciStructPtr pciP)
writePci(pciP->Slot.l | 0x30, pciP->RomBase & ~(CARD32)1);
if (scratch && length) {
- memcpy((unsigned char *)V_BIOS, scratch, length);
- free(scratch);
+ memcpy((unsigned char *)V_BIOS, scratch, length);
+ free(scratch);
}
-
+
restoreMem(pciP);
return length;
}
@@ -523,24 +522,24 @@ findPci(CARD16 slotBX)
CARD32 slot = slotBX << 8;
if (slot == (CurrentPci->Slot.l & ~PCI_EN))
- return (CurrentPci->Slot.l | PCI_EN);
+ return (CurrentPci->Slot.l | PCI_EN);
else {
#if !SHOW_ALL_DEV
- PciBusPtr pBus = CurrentPci->pBus;
- while (pBus) {
- // fprintf(stderr,"slot: 0x%x bridge: 0x%x\n",slot, pBus->Slot.l);
- if (slot == (pBus->Slot.l & ~PCI_EN))
- return pBus->Slot.l | PCI_EN;
- pBus = pBus->next;
- }
+ PciBusPtr pBus = CurrentPci->pBus;
+ while (pBus) {
+ /* fprintf(stderr,"slot: 0x%x bridge: 0x%x\n",slot, pBus->Slot.l); */
+ if (slot == (pBus->Slot.l & ~PCI_EN))
+ return pBus->Slot.l | PCI_EN;
+ pBus = pBus->next;
+ }
#else
- PciStructPtr pPci = PciStruct;
- while (pPci) {
- //fprintf(stderr,"slot: 0x%x bridge: 0x%x\n",slot, pPci->Slot.l);
- if (slot == (pPci->Slot.l & ~PCI_EN))
- return pPci->Slot.l | PCI_EN;
- pPci = pPci->next;
- }
+ PciStructPtr pPci = PciStruct;
+ while (pPci) {
+ /*fprintf(stderr,"slot: 0x%x bridge: 0x%x\n",slot, pPci->Slot.l); */
+ if (slot == (pPci->Slot.l & ~PCI_EN))
+ return pPci->Slot.l | PCI_EN;
+ pPci = pPci->next;
+ }
#endif
}
return 0;
@@ -559,9 +558,9 @@ findPciDevice(CARD16 vendorID, CARD16 deviceID, char n)
n++;
while (pPci) {
- if ((pPci->VendorID == vendorID) && (pPci->DeviceID == deviceID)) {
- if (!(--n)) break;
- }
+ if ((pPci->VendorID == vendorID) && (pPci->DeviceID == deviceID)) {
+ if (!(--n)) break;
+ }
pPci = pPci->next;
}
return pPci;
@@ -574,10 +573,10 @@ findPciClass(CARD8 intf, CARD8 subClass, CARD16 class, char n)
n++;
while (pPci) {
- if ((pPci->Interface == intf) && (pPci->SubClass == subClass)
- && (pPci->BaseClass == class)) {
- if (!(--n)) break;
- }
+ if ((pPci->Interface == intf) && (pPci->SubClass == subClass)
+ && (pPci->BaseClass == class)) {
+ if (!(--n)) break;
+ }
pPci = pPci->next;
}
return pPci;
@@ -592,14 +591,14 @@ readConfigSpaceCfg1(CARD32 bus, CARD32 dev, CARD32 func, CARD32 *reg)
for (i = 0; i<64;i+=4) {
#ifdef __alpha__
- reg[i] = axpPciCfgRead(config_cmd | i);
+ reg[i] = axpPciCfgRead(config_cmd | i);
#else
- outl(PCI_MODE1_ADDRESS_REG, config_cmd | i);
- reg[i] = inl(PCI_MODE1_DATA_REG);
+ outl(PCI_MODE1_ADDRESS_REG, config_cmd | i);
+ reg[i] = inl(PCI_MODE1_DATA_REG);
#endif
#ifdef V86BIOS_DEBUG
- P_printf("0x%lx\n",reg[i]);
+ P_printf("0x%lx\n",reg[i]);
#endif
}
}
@@ -611,15 +610,15 @@ checkSlotCfg1(CARD32 bus, CARD32 dev, CARD32 func)
(dev<<11) | (func<<8);
CARD32 reg;
#ifdef __alpha__
- reg = axpPciCfgRead(config_cmd);
+ reg = axpPciCfgRead(config_cmd);
#else
- outl(PCI_MODE1_ADDRESS_REG, config_cmd);
- reg = inl(PCI_MODE1_DATA_REG);
+ outl(PCI_MODE1_ADDRESS_REG, config_cmd);
+ reg = inl(PCI_MODE1_DATA_REG);
#endif
if (reg != 0xFFFFFFFF)
- return 1;
+ return 1;
else
- return 0;
+ return 0;
}
static int
@@ -633,9 +632,9 @@ checkSlotCfg2(CARD32 bus, int dev)
outb(PCI_MODE2_FORWARD_REG, 0x00);
outb(PCI_MODE2_ENABLE_REG, 0x00);
if (val == 0xFFFFFFFF)
- return 0;
+ return 0;
if (val == 0xF0F0F0F0)
- return 0;
+ return 0;
return 1;
}
@@ -647,9 +646,9 @@ readConfigSpaceCfg2(CARD32 bus, int dev, CARD32 *reg)
outb(PCI_MODE2_ENABLE_REG, 0xF1);
outb(PCI_MODE2_FORWARD_REG, bus);
for (i = 0; i<64;i+=4) {
- reg[i] = inl((dev << 8) + i);
+ reg[i] = inl((dev << 8) + i);
#ifdef V86BIOS_DEBUG
- P_printf("0x%lx\n",reg[i]);
+ P_printf("0x%lx\n",reg[i]);
#endif
}
outb(PCI_MODE2_ENABLE_REG, 0x00);
@@ -664,22 +663,22 @@ interpretConfigSpace(CARD32 *reg, int busidx, CARD8 dev, CARD8 func)
CARD8 primary, secondary;
CARD8 header, interface;
int i;
-
+
config_cmd = PCI_EN | busidx<<16 |
- (dev<<11) | (func<<8);
+ (dev<<11) | (func<<8);
for (i = 0x10; i < 0x28; i+=4) {
- if (IS_MEM32(reg[i]))
- if ((reg[i] & 0xFFFFFFF0) < pciMinMemReg)
- pciMinMemReg = (reg[i] & 0xFFFFFFF0);
+ if (IS_MEM32(reg[i]))
+ if ((reg[i] & 0xFFFFFFF0) < pciMinMemReg)
+ pciMinMemReg = (reg[i] & 0xFFFFFFF0);
#ifdef __alpha__
- if (IS_MEM64(reg[i])) {
- unsigned long addr = reg[i] |
- (unsigned long)(reg[i+4]) << 32;
- if ((addr & ~0xfL) < pciMinMemReg)
- pciMinMemReg = (addr & ~0xfL);
- i+=4;
- }
+ if (IS_MEM64(reg[i])) {
+ unsigned long addr = reg[i] |
+ (unsigned long)(reg[i+4]) << 32;
+ if ((addr & ~0xfL) < pciMinMemReg)
+ pciMinMemReg = (addr & ~0xfL);
+ i+=4;
+ }
#endif
}
vendor = reg[0] & 0xFFFF;
@@ -691,49 +690,49 @@ interpretConfigSpace(CARD32 *reg, int busidx, CARD8 dev, CARD8 func)
header = (reg[0x0c] >> 16) & 0xff;
P_printf("bc 0x%x, sub 0x%x, if 0x%x, hdr 0x%x\n",
- baseclass,subclass,interface,header);
+ baseclass,subclass,interface,header);
if (BRIDGE_CLASS(baseclass)) {
- if (BRIDGE_PCI_CLASS(subclass)) {
- PciBusPtr pbp = malloc(sizeof(PciBusRec));
- P_printf("Pci-Pci Bridge found; ");
- primary = reg[0x18] & 0xFF;
- secondary = (reg[0x18] >> 8) & 0xFF;
- P_printf("primary: 0x%x secondary: 0x%x\n",
- primary,secondary);
- pbp->bctl = reg[0x3c];
- pbp->primary = primary;
- pbp->secondary = secondary;
- pbp->Slot.l = config_cmd;
- pbp->next = PciBuses;
- PciBuses = pbp;
- numbus++;
- } else if (BRIDGE_HOST_CLASS(subclass)
- && (hostbridges++ > 1)) {
- numbus++;
- }
+ if (BRIDGE_PCI_CLASS(subclass)) {
+ PciBusPtr pbp = malloc(sizeof(PciBusRec));
+ P_printf("Pci-Pci Bridge found; ");
+ primary = reg[0x18] & 0xFF;
+ secondary = (reg[0x18] >> 8) & 0xFF;
+ P_printf("primary: 0x%x secondary: 0x%x\n",
+ primary,secondary);
+ pbp->bctl = reg[0x3c];
+ pbp->primary = primary;
+ pbp->secondary = secondary;
+ pbp->Slot.l = config_cmd;
+ pbp->next = PciBuses;
+ PciBuses = pbp;
+ numbus++;
+ } else if (BRIDGE_HOST_CLASS(subclass)
+ && (hostbridges++ > 1)) {
+ numbus++;
+ }
} else if (VIDEO_CLASS(baseclass,subclass)) {
- PciStructPtr pcp = malloc(sizeof(PciStructRec));
- P_printf("Display adapter found\n");
- pcp->RomBase = reg[0x30];
- pcp->cmd_st = reg[4];
- pcp->active = (reg[4] & 0x03) == 3 ? 1 : 0;
- pcp->VendorID = vendor;
- pcp->DeviceID = device;
- pcp->Interface = interface;
- pcp->BaseClass = baseclass;
- pcp->SubClass = subclass;
- pcp->Slot.l = config_cmd;
- pcp->bus = busidx;
- pcp->dev = dev;
- pcp->func = func;
- pcp->next = PciStruct;
- PciStruct = pcp;
+ PciStructPtr pcp = malloc(sizeof(PciStructRec));
+ P_printf("Display adapter found\n");
+ pcp->RomBase = reg[0x30];
+ pcp->cmd_st = reg[4];
+ pcp->active = (reg[4] & 0x03) == 3 ? 1 : 0;
+ pcp->VendorID = vendor;
+ pcp->DeviceID = device;
+ pcp->Interface = interface;
+ pcp->BaseClass = baseclass;
+ pcp->SubClass = subclass;
+ pcp->Slot.l = config_cmd;
+ pcp->bus = busidx;
+ pcp->dev = dev;
+ pcp->func = func;
+ pcp->next = PciStruct;
+ PciStruct = pcp;
}
if ((func == 0)
- && ((header & PCI_MULTIFUNC_DEV) == 0))
- func = 8;
+ && ((header & PCI_MULTIFUNC_DEV) == 0))
+ func = 8;
else
- func++;
+ func++;
return func;
}
@@ -748,36 +747,36 @@ remapMem(PciStructPtr pciP, int num, CARD32 size)
CARD32 org;
CARD32 val;
CARD32 size_n;
-
+
org = PciRead32(num + 0x10,pciP->Slot.l);
-
+
while (pciPtr) {
- for (i = 0; i < 20; i=i+4) {
-
- val = PciRead32(i + 0x10,pciPtr->Slot.l);
- /* don't map it on itself */
- if ((org & 0xfffffff0) == (val & 0xfffffff0))
- continue;
- if (val && !(val & 1))
- PciWrite32(i + 0x10,0xffffffff,pciPtr->Slot.l);
- else
- continue;
- size_n = PciRead32(i + 0x10,pciPtr->Slot.l);
- PciWrite32(i + 0x10,val,pciPtr->Slot.l);
- size_n = ~(CARD32)(size_n & 0xfffffff0) + 1;
-
- if (size_n >= size) {
- PciWrite32(num + 0x10,val,pciP->Slot.l);
- return 1;
- }
- }
- pciPtr = pciPtr->next;
+ for (i = 0; i < 20; i=i+4) {
+
+ val = PciRead32(i + 0x10,pciPtr->Slot.l);
+ /* don't map it on itself */
+ if ((org & 0xfffffff0) == (val & 0xfffffff0))
+ continue;
+ if (val && !(val & 1))
+ PciWrite32(i + 0x10,0xffffffff,pciPtr->Slot.l);
+ else
+ continue;
+ size_n = PciRead32(i + 0x10,pciPtr->Slot.l);
+ PciWrite32(i + 0x10,val,pciPtr->Slot.l);
+ size_n = ~(CARD32)(size_n & 0xfffffff0) + 1;
+
+ if (size_n >= size) {
+ PciWrite32(num + 0x10,val,pciP->Slot.l);
+ return 1;
+ }
+ }
+ pciPtr = pciPtr->next;
}
/* last resort: try to go below lowest PCI mem address */
val = ((pciMinMemReg & ~(CARD32)(size - 1)) - size);
if (val > 0x7fffffff) {
- PciWrite32(num + 0x10,val, pciP->Slot.l);
- return 1;
+ PciWrite32(num + 0x10,val, pciP->Slot.l);
+ return 1;
}
return 0;
@@ -798,7 +797,7 @@ findBIOSMap(PciStructPtr pciP, CARD32 *biosSize)
int i;
CARD32 val;
CARD32 size;
-
+
PciWrite32(0x30,0xffffffff,pciP->Slot.l);
*biosSize = PciRead32(0x30,pciP->Slot.l);
P_printf("bios size: 0x%x\n",*biosSize);
@@ -810,43 +809,43 @@ findBIOSMap(PciStructPtr pciP, CARD32 *biosSize)
P_printf("fixing broken BIOS size: 0x%x\n",*biosSize);
}
while (pciPtr) {
- if (pciPtr->bus != pciP->bus) {
- pciPtr = pciPtr->next;
- continue;
- }
- for (i = 0; i < 20; i=i+4) {
-
- val = PciRead32(i + 0x10,pciPtr->Slot.l);
- if (!(val & 1))
-
- PciWrite32(i + 0x10,0xffffffff,pciPtr->Slot.l);
- else
- continue;
- size = PciRead32(i + 0x10,pciPtr->Slot.l);
- PciWrite32(i + 0x10,val,pciPtr->Slot.l);
- size = ~(CARD32)(size & 0xFFFFFFF0) + 1;
+ if (pciPtr->bus != pciP->bus) {
+ pciPtr = pciPtr->next;
+ continue;
+ }
+ for (i = 0; i < 20; i=i+4) {
+
+ val = PciRead32(i + 0x10,pciPtr->Slot.l);
+ if (!(val & 1))
+
+ PciWrite32(i + 0x10,0xffffffff,pciPtr->Slot.l);
+ else
+ continue;
+ size = PciRead32(i + 0x10,pciPtr->Slot.l);
+ PciWrite32(i + 0x10,val,pciPtr->Slot.l);
+ size = ~(CARD32)(size & 0xFFFFFFF0) + 1;
#ifdef V86_BIOS_DEBUG
- P_printf("size: 0x%x\n",size);
+ P_printf("size: 0x%x\n",size);
#endif
- if (size >= *biosSize) {
- if (pciP == pciPtr) { /* if same device remap ram*/
- if (!(remapMem(pciP,i,size)))
- continue;
- remapMEM_val = val;
- remapMEM_num = i;
- } else {
- remapMEM_val = 0;
- }
- return val & 0xFFFFFF00;
- }
- }
- pciPtr = pciPtr->next;
+ if (size >= *biosSize) {
+ if (pciP == pciPtr) { /* if same device remap ram*/
+ if (!(remapMem(pciP,i,size)))
+ continue;
+ remapMEM_val = val;
+ remapMEM_num = i;
+ } else {
+ remapMEM_val = 0;
+ }
+ return val & 0xFFFFFF00;
+ }
+ }
+ pciPtr = pciPtr->next;
}
remapMEM_val = 0;
/* very last resort */
- if (pciP->bus == 0 && (pciMinMemReg > *biosSize))
+ if (pciP->bus == 0 && (pciMinMemReg > *biosSize))
return (pciMinMemReg - size) & ~(size - 1);
-
+
return 0;
}
@@ -863,7 +862,7 @@ cfg1out(CARD16 addr, CARD32 val)
return 0;
}
-int
+int
cfg1in(CARD16 addr, CARD32 *val)
{
if (addr == 0xCF8) {
@@ -883,8 +882,8 @@ list_pci(void)
while (pci) {
printf("[0x%x:0x%x:0x%x] vendor: 0x%4.4x dev: 0x%4.4x class: 0x%4.4x"
- " subclass: 0x%4.4x\n",pci->bus,pci->dev,pci->func,
- pci->VendorID,pci->DeviceID,pci->BaseClass,pci->SubClass);
+ " subclass: 0x%4.4x\n",pci->bus,pci->dev,pci->func,
+ pci->VendorID,pci->DeviceID,pci->BaseClass,pci->SubClass);
pci = pci->next;
}
}
@@ -893,7 +892,7 @@ PciStructPtr
findPciByIDs(int bus, int dev, int func)
{
PciStructPtr pciP = PciList;
-
+
while (pciP) {
if (pciP->bus == bus && pciP->dev == dev && pciP->func == func)
return pciP;
diff --git a/board/MAI/bios_emulator/scitech/src/v86bios/pci.h b/board/MAI/bios_emulator/scitech/src/v86bios/pci.h
index 0ab7363df2..58ad52202e 100644
--- a/board/MAI/bios_emulator/scitech/src/v86bios/pci.h
+++ b/board/MAI/bios_emulator/scitech/src/v86bios/pci.h
@@ -26,13 +26,13 @@
typedef union {
struct {
- unsigned int zero:2;
- unsigned int reg:6;
- unsigned int func:3;
- unsigned int dev:5;
- unsigned int bus:8;
- unsigned int reserved:7;
- unsigned int enable:1;
+ unsigned int zero:2;
+ unsigned int reg:6;
+ unsigned int func:3;
+ unsigned int dev:5;
+ unsigned int bus:8;
+ unsigned int reserved:7;
+ unsigned int enable:1;
} pci;
CARD32 l;
} PciSlot;
diff --git a/board/MAI/bios_emulator/scitech/src/v86bios/v86.c b/board/MAI/bios_emulator/scitech/src/v86bios/v86.c
index 3170a9cb55..4deed044cb 100644
--- a/board/MAI/bios_emulator/scitech/src/v86bios/v86.c
+++ b/board/MAI/bios_emulator/scitech/src/v86bios/v86.c
@@ -46,14 +46,14 @@ static int vm86_rep(struct vm86_struct *ptr);
#define CPU_REG_HW(reg) (*((CARD16 *)&CPU_REG(reg) + 1))
#define CPU_REG_LB(reg) (*(CARD8 *)&CPU_REG(e##reg))
#define SEG_ADR(type, seg, reg) type((CPU_REG_LW(seg) << 4) \
- + CPU_REG_LW(e##reg))
+ + CPU_REG_LW(e##reg))
#define DF (1 << 10)
struct pio P;
void
-setup_io(void)
+setup_io(void)
{
if (!Config.PrintPort && !Config.IoStatistics) {
P.inb = (CARD8(*)(CARD16))inb;
@@ -72,13 +72,13 @@ setup_io(void)
}
}
-
+
static void
setup_vm86(unsigned long bios_start, i86biosRegsPtr regs)
{
CARD32 eip;
CARD16 cs;
-
+
vm86s.flags = VM86_SCREEN_BITMAP;
vm86s.flags = 0;
vm86s.screen_bitmap = 0;
@@ -88,7 +88,7 @@ setup_vm86(unsigned long bios_start, i86biosRegsPtr regs)
eip = bios_start & 0xFFFF;
cs = (bios_start & 0xFF0000) >> 4;
-
+
CPU_REG(eax) = regs->ax;
CPU_REG(ebx) = regs->bx;
CPU_REG(ecx) = regs->cx;
@@ -97,7 +97,7 @@ setup_vm86(unsigned long bios_start, i86biosRegsPtr regs)
CPU_REG(edi) = regs->di;
CPU_REG(ebp) = 0;
CPU_REG(eip) = eip;
- CPU_REG(cs) = cs;
+ CPU_REG(cs) = cs;
CPU_REG(esp) = 0x100;
CPU_REG(ss) = 0x30; /* This is the standard pc bios stack */
CPU_REG(es) = regs->es;
@@ -124,44 +124,44 @@ static int
do_vm86(void)
{
int retval;
-
+
#ifdef V86BIOS_DEBUG
dump_registers();
#endif
-// retval = SYS_vm86old(&vm86s);
-// retval = syscall(SYS_vm86old,&vm86s);
+/* retval = SYS_vm86old(&vm86s); */
+/* retval = syscall(SYS_vm86old,&vm86s); */
retval = vm86_rep(&vm86s);
-
+
switch (VM86_TYPE(retval)) {
case VM86_UNKNOWN:
- if (!vm86_GP_fault()) return 0;
- break;
+ if (!vm86_GP_fault()) return 0;
+ break;
case VM86_STI:
- fprintf(stderr,"vm86_sti :-((\n");
- stack_trace();
- dump_code();
- return 0;
+ fprintf(stderr,"vm86_sti :-((\n");
+ stack_trace();
+ dump_code();
+ return 0;
case VM86_INTx:
- if (!vm86_do_int(VM86_ARG(retval))) {
- fprintf(stderr,"\nUnknown vm86_int: %X\n\n",VM86_ARG(retval));
- dump_registers();
- return 0;
- }
- /* I'm not sure yet what to do if we can handle ints */
- break;
+ if (!vm86_do_int(VM86_ARG(retval))) {
+ fprintf(stderr,"\nUnknown vm86_int: %X\n\n",VM86_ARG(retval));
+ dump_registers();
+ return 0;
+ }
+ /* I'm not sure yet what to do if we can handle ints */
+ break;
case VM86_SIGNAL:
- fprintf(stderr,"received signal\n");
- return 0;
+ fprintf(stderr,"received signal\n");
+ return 0;
default:
- fprintf(stderr,"unknown type(0x%x)=0x%x\n",
- VM86_ARG(retval),VM86_TYPE(retval));
- dump_registers();
- dump_code();
- stack_trace();
- return 0;
+ fprintf(stderr,"unknown type(0x%x)=0x%x\n",
+ VM86_ARG(retval),VM86_TYPE(retval));
+ dump_registers();
+ dump_code();
+ stack_trace();
+ return 0;
}
-
+
return 1;
}
@@ -176,17 +176,17 @@ void
do_x86(unsigned long bios_start, i86biosRegsPtr regs)
{
static void (*org_handler)(int);
-
+
setup_vm86(bios_start, regs);
if (setjmp(x86_esc) == 0) {
- org_handler = signal(2,vmexit);
- while(do_vm86()) {};
- signal(2,org_handler);
- collect_bios_regs(regs);
+ org_handler = signal(2,vmexit);
+ while(do_vm86()) {};
+ signal(2,org_handler);
+ collect_bios_regs(regs);
} else {
- signal(2,org_handler);
- printf("interrupted at 0x%x\n",((CARD16)CPU_REG(cs)) << 4
- | (CARD16)CPU_REG(eip));
+ signal(2,org_handler);
+ printf("interrupted at 0x%x\n",((CARD16)CPU_REG(cs)) << 4
+ | (CARD16)CPU_REG(eip));
}
}
@@ -217,19 +217,19 @@ vm86_GP_fault(void)
/* eat up prefixes */
done = 0;
do {
- switch (*(csp++)) {
- case 0x66: /* operand prefix */ prefix66=1; break;
- case 0x67: /* address prefix */ prefix67=1; break;
- case 0x2e: /* CS */ pref_seg=CPU_REG(cs); break;
- case 0x3e: /* DS */ pref_seg=CPU_REG(ds); break;
- case 0x26: /* ES */ pref_seg=CPU_REG(es); break;
- case 0x36: /* SS */ pref_seg=CPU_REG(ss); break;
- case 0x65: /* GS */ pref_seg=CPU_REG(gs); break;
- case 0x64: /* FS */ pref_seg=CPU_REG(fs); break;
- case 0xf2: /* repnz */
- case 0xf3: /* rep */ is_rep=1; break;
- default: done=1;
- }
+ switch (*(csp++)) {
+ case 0x66: /* operand prefix */ prefix66=1; break;
+ case 0x67: /* address prefix */ prefix67=1; break;
+ case 0x2e: /* CS */ pref_seg=CPU_REG(cs); break;
+ case 0x3e: /* DS */ pref_seg=CPU_REG(ds); break;
+ case 0x26: /* ES */ pref_seg=CPU_REG(es); break;
+ case 0x36: /* SS */ pref_seg=CPU_REG(ss); break;
+ case 0x65: /* GS */ pref_seg=CPU_REG(gs); break;
+ case 0x64: /* FS */ pref_seg=CPU_REG(fs); break;
+ case 0xf2: /* repnz */
+ case 0xf3: /* rep */ is_rep=1; break;
+ default: done=1;
+ }
} while (!done);
csp--; /* oops one too many */
org_eip = CPU_REG(eip);
@@ -238,125 +238,125 @@ vm86_GP_fault(void)
switch (*csp) {
case 0x6c: /* insb */
- /* NOTE: ES can't be overwritten; prefixes 66,67 should use esi,edi,ecx
- * but is anyone using extended regs in real mode? */
- /* WARNING: no test for DI wrapping! */
- CPU_REG_LW(edi) += port_rep_inb(CPU_REG_LW(edx),
- SEG_ADR((CARD8 *),es,di),
- CPU_REG_LW(eflags)&DF,
- (is_rep? LWECX:1));
- if (is_rep) LWECX = 0;
- CPU_REG_LW(eip)++;
- break;
+ /* NOTE: ES can't be overwritten; prefixes 66,67 should use esi,edi,ecx
+ * but is anyone using extended regs in real mode? */
+ /* WARNING: no test for DI wrapping! */
+ CPU_REG_LW(edi) += port_rep_inb(CPU_REG_LW(edx),
+ SEG_ADR((CARD8 *),es,di),
+ CPU_REG_LW(eflags)&DF,
+ (is_rep? LWECX:1));
+ if (is_rep) LWECX = 0;
+ CPU_REG_LW(eip)++;
+ break;
case 0x6d: /* (rep) insw / insd */
- /* NOTE: ES can't be overwritten */
- /* WARNING: no test for _DI wrapping! */
- if (prefix66) {
- CPU_REG_LW(edi) += port_rep_inl(CPU_REG_LW(edx),
- SEG_ADR((CARD32 *),es,di),
- CPU_REG_LW(eflags)&DF,
- (is_rep? LWECX:1));
- }
- else {
- CPU_REG_LW(edi) += port_rep_inw(CPU_REG_LW(edx),
- SEG_ADR((CARD16 *),es,di),
- CPU_REG_LW(eflags)&DF,
- (is_rep? LWECX:1));
- }
- if (is_rep) LWECX = 0;
- CPU_REG_LW(eip)++;
- break;
+ /* NOTE: ES can't be overwritten */
+ /* WARNING: no test for _DI wrapping! */
+ if (prefix66) {
+ CPU_REG_LW(edi) += port_rep_inl(CPU_REG_LW(edx),
+ SEG_ADR((CARD32 *),es,di),
+ CPU_REG_LW(eflags)&DF,
+ (is_rep? LWECX:1));
+ }
+ else {
+ CPU_REG_LW(edi) += port_rep_inw(CPU_REG_LW(edx),
+ SEG_ADR((CARD16 *),es,di),
+ CPU_REG_LW(eflags)&DF,
+ (is_rep? LWECX:1));
+ }
+ if (is_rep) LWECX = 0;
+ CPU_REG_LW(eip)++;
+ break;
case 0x6e: /* (rep) outsb */
- if (pref_seg < 0) pref_seg = CPU_REG_LW(ds);
- /* WARNING: no test for _SI wrapping! */
- CPU_REG_LW(esi) += port_rep_outb(CPU_REG_LW(edx),(CARD8*)LIN_PREF_SI,
- CPU_REG_LW(eflags)&DF,
- (is_rep? LWECX:1));
- if (is_rep) LWECX = 0;
- CPU_REG_LW(eip)++;
- break;
+ if (pref_seg < 0) pref_seg = CPU_REG_LW(ds);
+ /* WARNING: no test for _SI wrapping! */
+ CPU_REG_LW(esi) += port_rep_outb(CPU_REG_LW(edx),(CARD8*)LIN_PREF_SI,
+ CPU_REG_LW(eflags)&DF,
+ (is_rep? LWECX:1));
+ if (is_rep) LWECX = 0;
+ CPU_REG_LW(eip)++;
+ break;
case 0x6f: /* (rep) outsw / outsd */
- if (pref_seg < 0) pref_seg = CPU_REG_LW(ds);
- /* WARNING: no test for _SI wrapping! */
- if (prefix66) {
- CPU_REG_LW(esi) += port_rep_outl(CPU_REG_LW(edx),
- (CARD32 *)LIN_PREF_SI,
- CPU_REG_LW(eflags)&DF,
- (is_rep? LWECX:1));
- }
- else {
- CPU_REG_LW(esi) += port_rep_outw(CPU_REG_LW(edx),
- (CARD16 *)LIN_PREF_SI,
- CPU_REG_LW(eflags)&DF,
- (is_rep? LWECX:1));
- }
- if (is_rep) LWECX = 0;
- CPU_REG_LW(eip)++;
- break;
+ if (pref_seg < 0) pref_seg = CPU_REG_LW(ds);
+ /* WARNING: no test for _SI wrapping! */
+ if (prefix66) {
+ CPU_REG_LW(esi) += port_rep_outl(CPU_REG_LW(edx),
+ (CARD32 *)LIN_PREF_SI,
+ CPU_REG_LW(eflags)&DF,
+ (is_rep? LWECX:1));
+ }
+ else {
+ CPU_REG_LW(esi) += port_rep_outw(CPU_REG_LW(edx),
+ (CARD16 *)LIN_PREF_SI,
+ CPU_REG_LW(eflags)&DF,
+ (is_rep? LWECX:1));
+ }
+ if (is_rep) LWECX = 0;
+ CPU_REG_LW(eip)++;
+ break;
case 0xe5: /* inw xx, inl xx */
- if (prefix66) CPU_REG(eax) = P.inl((int) csp[1]);
- else CPU_REG_LW(eax) = P.inw((int) csp[1]);
- CPU_REG_LW(eip) += 2;
- break;
+ if (prefix66) CPU_REG(eax) = P.inl((int) csp[1]);
+ else CPU_REG_LW(eax) = P.inw((int) csp[1]);
+ CPU_REG_LW(eip) += 2;
+ break;
case 0xe4: /* inb xx */
- CPU_REG_LW(eax) &= ~(CARD32)0xff;
- CPU_REG_LB(ax) |= P.inb((int) csp[1]);
- CPU_REG_LW(eip) += 2;
- break;
+ CPU_REG_LW(eax) &= ~(CARD32)0xff;
+ CPU_REG_LB(ax) |= P.inb((int) csp[1]);
+ CPU_REG_LW(eip) += 2;
+ break;
case 0xed: /* inw dx, inl dx */
- if (prefix66) CPU_REG(eax) = P.inl(CPU_REG_LW(edx));
- else CPU_REG_LW(eax) = P.inw(CPU_REG_LW(edx));
- CPU_REG_LW(eip) += 1;
- break;
+ if (prefix66) CPU_REG(eax) = P.inl(CPU_REG_LW(edx));
+ else CPU_REG_LW(eax) = P.inw(CPU_REG_LW(edx));
+ CPU_REG_LW(eip) += 1;
+ break;
case 0xec: /* inb dx */
- CPU_REG_LW(eax) &= ~(CARD32)0xff;
- CPU_REG_LB(ax) |= P.inb(CPU_REG_LW(edx));
- CPU_REG_LW(eip) += 1;
- break;
+ CPU_REG_LW(eax) &= ~(CARD32)0xff;
+ CPU_REG_LB(ax) |= P.inb(CPU_REG_LW(edx));
+ CPU_REG_LW(eip) += 1;
+ break;
case 0xe7: /* outw xx */
- if (prefix66) P.outl((int)csp[1], CPU_REG(eax));
- else P.outw((int)csp[1], CPU_REG_LW(eax));
- CPU_REG_LW(eip) += 2;
- break;
+ if (prefix66) P.outl((int)csp[1], CPU_REG(eax));
+ else P.outw((int)csp[1], CPU_REG_LW(eax));
+ CPU_REG_LW(eip) += 2;
+ break;
case 0xe6: /* outb xx */
- P.outb((int) csp[1], CPU_REG_LB(ax));
- CPU_REG_LW(eip) += 2;
- break;
+ P.outb((int) csp[1], CPU_REG_LB(ax));
+ CPU_REG_LW(eip) += 2;
+ break;
case 0xef: /* outw dx */
- if (prefix66) P.outl(CPU_REG_LW(edx), CPU_REG(eax));
- else P.outw(CPU_REG_LW(edx), CPU_REG_LW(eax));
- CPU_REG_LW(eip) += 1;
- break;
+ if (prefix66) P.outl(CPU_REG_LW(edx), CPU_REG(eax));
+ else P.outw(CPU_REG_LW(edx), CPU_REG_LW(eax));
+ CPU_REG_LW(eip) += 1;
+ break;
case 0xee: /* outb dx */
- P.outb(CPU_REG_LW(edx), CPU_REG_LB(ax));
- CPU_REG_LW(eip) += 1;
- break;
+ P.outb(CPU_REG_LW(edx), CPU_REG_LB(ax));
+ CPU_REG_LW(eip) += 1;
+ break;
case 0xf4:
#ifdef V86BIOS_DEBUG
- printf("hlt at %p\n", lina);
+ printf("hlt at %p\n", lina);
#endif
- return 0;
+ return 0;
- case 0x0f:
- fprintf(stderr,"CPU 0x0f Trap at eip=0x%lx\n",CPU_REG(eip));
- goto op0ferr;
- break;
+ case 0x0f:
+ fprintf(stderr,"CPU 0x0f Trap at eip=0x%lx\n",CPU_REG(eip));
+ goto op0ferr;
+ break;
case 0xf0: /* lock */
default:
- fprintf(stderr,"unknown reason for exception\n");
- dump_registers();
- stack_trace();
+ fprintf(stderr,"unknown reason for exception\n");
+ dump_registers();
+ stack_trace();
op0ferr:
- dump_code();
- fprintf(stderr,"cannot continue\n");
- return 0;
+ dump_code();
+ fprintf(stderr,"cannot continue\n");
+ return 0;
} /* end of switch() */
return 1;
}
@@ -369,16 +369,16 @@ vm86_do_int(int num)
i_printf("int 0x%x received: ax:0x%lx",num,CPU_REG(eax));
if (Config.PrintIp)
- i_printf(" at: 0x%x\n",getIP());
+ i_printf(" at: 0x%x\n",getIP());
else
- i_printf("\n");
+ i_printf("\n");
/* try to run bios interrupt */
-
+
/* if not installed fall back */
#define COPY(x) regs.##x = CPU_REG(x)
#define COPY_R(x) CPU_REG(x) = regs.##x
-
+
COPY(eax);
COPY(ebx);
COPY(ecx);
@@ -397,9 +397,9 @@ vm86_do_int(int num)
COPY(eflags);
if (!(val = int_handler(num,&regs)))
- if (!(val = run_bios_int(num,&regs)))
- return val;
-
+ if (!(val = run_bios_int(num,&regs)))
+ return val;
+
COPY_R(eax);
COPY_R(ebx);
COPY_R(ecx);
@@ -429,11 +429,11 @@ dump_code(void)
unsigned char *lina = SEG_ADR((unsigned char *), cs, ip);
fprintf(stderr,"code at 0x%8.8x: ",(CARD32)lina);
- for (i=0; i<0x10; i++)
- fprintf(stderr,"%2.2x ",*(lina + i));
+ for (i=0; i<0x10; i++)
+ fprintf(stderr,"%2.2x ",*(lina + i));
fprintf(stderr,"\n ");
- for (; i<0x20; i++)
- fprintf(stderr,"%2.2x ",*(lina + i));
+ for (; i<0x20; i++)
+ fprintf(stderr,"%2.2x ",*(lina + i));
fprintf(stderr,"\n");
}
@@ -466,41 +466,41 @@ static void
stack_trace(void)
{
int i;
- unsigned char *stack = SEG_ADR((unsigned char *), ss, sp);
+ unsigned char *stack = SEG_ADR((unsigned char *), ss, sp);
fprintf(stderr,"stack at 0x%8.8lx:\n",(unsigned long)stack);
- for (i=0; i < 0x10; i++)
- fprintf(stderr,"%2.2x ",*(stack + i));
+ for (i=0; i < 0x10; i++)
+ fprintf(stderr,"%2.2x ",*(stack + i));
fprintf(stderr,"\n");
-
+
}
static int
-vm86_rep(struct vm86_struct *ptr)
+vm86_rep(struct vm86_struct *ptr)
{
int __res;
__asm__ __volatile__("int $0x80\n"
- :"=a" (__res):"a" ((int)113),
- "b" ((struct vm86_struct *)ptr));
-
- if ((__res) < 0) {
- errno = -__res;
- __res=-1;
- }
- else errno = 0;
- return __res;
+ :"=a" (__res):"a" ((int)113),
+ "b" ((struct vm86_struct *)ptr));
+
+ if ((__res) < 0) {
+ errno = -__res;
+ __res=-1;
+ }
+ else errno = 0;
+ return __res;
}
#define pushw(base, ptr, val) \
__asm__ __volatile__( \
- "decw %w0\n\t" \
- "movb %h2,(%1,%0)\n\t" \
- "decw %w0\n\t" \
- "movb %b2,(%1,%0)" \
- : "=r" (ptr) \
- : "r" (base), "q" (val), "0" (ptr))
+ "decw %w0\n\t" \
+ "movb %h2,(%1,%0)\n\t" \
+ "decw %w0\n\t" \
+ "movb %b2,(%1,%0)" \
+ : "=r" (ptr) \
+ : "r" (base), "q" (val), "0" (ptr))
int
run_bios_int(int num, struct regs86 *regs)
@@ -515,25 +515,25 @@ run_bios_int(int num, struct regs86 *regs)
/* check if bios vector is initialized */
if (((CARD16*)0)[(num<<1)+1] == 0x0000) { /* SYS_BIOS_SEG ?*/
#ifdef V86BIOS_DEBUG
- i_printf("card BIOS not loaded\n");
+ i_printf("card BIOS not loaded\n");
#endif
- return 0;
+ return 0;
}
-
+
#ifdef V86BIOS_DEBUG
if (firsttime) {
- dprint(0,0x3D0);
- firsttime = 0;
+ dprint(0,0x3D0);
+ firsttime = 0;
}
#endif
-
+
i_printf("calling card BIOS at: ");
ssp = (CARD16*)(CPU_REG(ss)<<4);
sp = (CARD32) CPU_REG_LW(esp);
eflags = regs->eflags;
eflags = ((eflags & VIF_MASK) != 0)
- ? (eflags | IF_MASK) : (eflags & ~(CARD32) IF_MASK);
+ ? (eflags | IF_MASK) : (eflags & ~(CARD32) IF_MASK);
pushw(ssp, sp, eflags);
pushw(ssp, sp, regs->cs);
pushw(ssp, sp, (CARD16)regs->eip);
@@ -545,7 +545,7 @@ run_bios_int(int num, struct regs86 *regs)
dump_code();
#endif
regs->eflags = regs->eflags
- & ~(VIF_MASK | TF_MASK | IF_MASK | NT_MASK);
+ & ~(VIF_MASK | TF_MASK | IF_MASK | NT_MASK);
return 1;
}
diff --git a/board/MAI/bios_emulator/scitech/src/v86bios/v86bios.c b/board/MAI/bios_emulator/scitech/src/v86bios/v86bios.c
index 7a3fb36655..101c1f26e6 100644
--- a/board/MAI/bios_emulator/scitech/src/v86bios/v86bios.c
+++ b/board/MAI/bios_emulator/scitech/src/v86bios/v86bios.c
@@ -48,12 +48,12 @@
#define BIOS_START 0x7C00 /* default BIOS entry */
#define BIOS_MEM 0x600
-//CARD8 code[] = { 0xb8 , 0xf0 , 0xf0, 0xf4 };
+/*CARD8 code[] = { 0xb8 , 0xf0 , 0xf0, 0xf4 }; */
#define VB_X(x) (V_BIOS >> x) & 0xFF
CARD8 code[] = { 6, 0x9a, 0x03, 0x00, 0x00, VB_X(12), 0xf4 };
-//CARD8 code[] = { 0x9a, 0x03, 0x00, 0x00, VB_X(12), 0xb8, 0x03, 0x00,
-//0xcd, 0x10, 0xf4 };
-//CARD8 code[] = { 0xb8 , 0xf0 , 0xf0 ,0xf4 };
+/*CARD8 code[] = { 0x9a, 0x03, 0x00, 0x00, VB_X(12), 0xb8, 0x03, 0x00, */
+/*0xcd, 0x10, 0xf4 }; */
+/*CARD8 code[] = { 0xb8 , 0xf0 , 0xf0 ,0xf4 }; */
int ioperm_list[IOPERM_BITS] = {0,};
@@ -97,87 +97,87 @@ struct config Config;
int main(int argc,char **argv)
{
int c;
-
+
Config.PrintPort = PRINT_PORT;
Config.IoStatistics = IO_STATISTICS;
Config.PrintIrq = PRINT_IRQ;
Config.PrintPci = PRINT_PCI;
- Config.ShowAllDev = SHOW_ALL_DEV;
- Config.PrintIp = PRINT_IP;
- Config.SaveBios = SAVE_BIOS;
- Config.Trace = TRACE;
+ Config.ShowAllDev = SHOW_ALL_DEV;
+ Config.PrintIp = PRINT_IP;
+ Config.SaveBios = SAVE_BIOS;
+ Config.Trace = TRACE;
Config.ConfigActiveOnly = CONFIG_ACTIVE_ONLY; /* boot */
Config.ConfigActiveDevice = CONFIG_ACTIVE_DEVICE; /* boot */
- Config.MapSysBios = MAP_SYS_BIOS;
- Config.Resort = RESORT; /* boot */
- Config.FixRom = FIX_ROM;
+ Config.MapSysBios = MAP_SYS_BIOS;
+ Config.Resort = RESORT; /* boot */
+ Config.FixRom = FIX_ROM;
Config.NoConsole = NO_CONSOLE;
Config.BootOnly = FALSE;
Config.Verbose = VERBOSE;
-
- opterr = 0;
+
+ opterr = 0;
while ((c = getopt(argc,argv,"psicaPStAdbrfnv:?")) != EOF) {
switch(c) {
case 'p':
- Config.PrintPort = TRUE;
- break;
+ Config.PrintPort = TRUE;
+ break;
case 's':
- Config.IoStatistics = TRUE;
- break;
+ Config.IoStatistics = TRUE;
+ break;
case 'i':
- Config.PrintIrq = TRUE;
- break;
+ Config.PrintIrq = TRUE;
+ break;
case 'c':
- Config.PrintPci = TRUE;
- break;
+ Config.PrintPci = TRUE;
+ break;
case 'a':
- Config.ShowAllDev = TRUE;
- break;
+ Config.ShowAllDev = TRUE;
+ break;
case 'P':
- Config.PrintIp = TRUE;
- break;
+ Config.PrintIp = TRUE;
+ break;
case 'S':
- Config.SaveBios = TRUE;
- break;
+ Config.SaveBios = TRUE;
+ break;
case 't':
- Config.Trace = TRUE;
- break;
+ Config.Trace = TRUE;
+ break;
case 'A':
- Config.ConfigActiveOnly = TRUE;
- break;
+ Config.ConfigActiveOnly = TRUE;
+ break;
case 'd':
- Config.ConfigActiveDevice = TRUE;
- break;
+ Config.ConfigActiveDevice = TRUE;
+ break;
case 'b':
- Config.MapSysBios = TRUE;
- break;
+ Config.MapSysBios = TRUE;
+ break;
case 'r':
- Config.Resort = TRUE;
- break;
+ Config.Resort = TRUE;
+ break;
case 'f':
- Config.FixRom = TRUE;
- break;
+ Config.FixRom = TRUE;
+ break;
case 'n':
- Config.NoConsole = TRUE;
- break;
+ Config.NoConsole = TRUE;
+ break;
case 'v':
- Config.Verbose = strtol(optarg,NULL,0);
- break;
+ Config.Verbose = strtol(optarg,NULL,0);
+ break;
case '?':
- print_usage();
- break;
+ print_usage();
+ break;
default:
- break;
+ break;
}
}
-
-
+
+
if (!map())
exit(1);
-
+
if (!setup_system_bios())
exit(1);
-
+
iopl(3);
scan_pci();
@@ -188,23 +188,23 @@ int main(int argc,char **argv)
save_pos102 = inb(0x102);
if (Config.BootOnly) {
-
+
if (!CurrentPci && !Config.ConfigActiveDevice
- && !Config.ConfigActiveOnly) {
- iopl(0);
- unmap();
- exit (1);
+ && !Config.ConfigActiveOnly) {
+ iopl(0);
+ unmap();
+ exit (1);
}
call_boot(NULL);
} else {
using_history();
yyparse();
}
-
+
unmap();
pciVideoRestore();
-
+
outb(0x102, save_pos102);
outb(0x46e8, save_46e8);
outb(0x3C3, save_vse);
@@ -223,139 +223,139 @@ call_boot(struct device *dev)
{
int Active_is_Pci = 0;
CARD32 vbios_base;
-
+
CurrentPci = PciList;
Console = open_console();
-
+
set_ioperm();
-
+
signal(2,sig_handler);
signal(11,sig_handler);
-
+
/* disable primary card */
pciVideoRestore(); /* reset PCI state to see primary card */
outb(0x3C2,~(CARD8)0x03 & save_msr);
outb(0x3C3,~(CARD8)0x01 & save_vse);
outb(0x46e8, ~(CARD8)0x08 & save_46e8);
outb(0x102, ~(CARD8)0x01 & save_pos102);
-
+
pciVideoDisable();
-
+
while (CurrentPci) {
CARD16 ax;
-
+
if (CurrentPci->active) {
- Active_is_Pci = 1;
- if (!Config.ConfigActiveDevice && !dev) {
- CurrentPci = CurrentPci->next;
- continue;
- }
+ Active_is_Pci = 1;
+ if (!Config.ConfigActiveDevice && !dev) {
+ CurrentPci = CurrentPci->next;
+ continue;
+ }
} else if (Config.ConfigActiveOnly && !dev) {
- CurrentPci = CurrentPci->next;
- continue;
+ CurrentPci = CurrentPci->next;
+ continue;
}
if (dev && ((dev->type != PCI)
- || (dev->type == PCI
- && (dev->loc.pci.dev != CurrentPci->dev
- || dev->loc.pci.bus != CurrentPci->bus
- || dev->loc.pci.func != CurrentPci->func)))) {
- CurrentPci = CurrentPci->next;
- continue;
- }
-
+ || (dev->type == PCI
+ && (dev->loc.pci.dev != CurrentPci->dev
+ || dev->loc.pci.bus != CurrentPci->bus
+ || dev->loc.pci.func != CurrentPci->func)))) {
+ CurrentPci = CurrentPci->next;
+ continue;
+ }
+
EnableCurrent();
-
+
if (CurrentPci->active) {
- outb(0x102, save_pos102);
- outb(0x46e8, save_46e8);
- outb(0x3C3, save_vse);
- outb(0x3C2, save_msr);
+ outb(0x102, save_pos102);
+ outb(0x46e8, save_46e8);
+ outb(0x3C3, save_vse);
+ outb(0x3C2, save_msr);
}
-
+
/* clear interrupt vectors */
#ifdef __ia32__
vbios_base = CurrentPci->active ? setup_primary_int_vect()
- : setup_int_vect();
+ : setup_int_vect();
#else
vbios_base = setup_int_vect();
#endif
ax = ((CARD16)(CurrentPci->bus) << 8)
- | (CurrentPci->dev << 3) | (CurrentPci->func & 0x7);
+ | (CurrentPci->dev << 3) | (CurrentPci->func & 0x7);
if (Config.Verbose > 1) P_printf("ax: 0x%x\n",ax);
-
+
BootBios = findPciByIDs(CurrentPci->bus,CurrentPci->dev,
- CurrentPci->func);
+ CurrentPci->func);
if (!((mapPciRom(BootBios) && chksum((CARD8*)V_BIOS))
- || (CurrentPci->active && copy_vbios(vbios_base)))) {
- CurrentPci = CurrentPci->next;
- continue;
+ || (CurrentPci->active && copy_vbios(vbios_base)))) {
+ CurrentPci = CurrentPci->next;
+ continue;
}
if (!map_vram()) {
- CurrentPci = CurrentPci->next;
- continue;
+ CurrentPci = CurrentPci->next;
+ continue;
}
if (Config.SaveBios) save_bios_to_file();
printf("initializing PCI bus: %i dev: %i func: %i\n",CurrentPci->bus,
- CurrentPci->dev,CurrentPci->func);
+ CurrentPci->dev,CurrentPci->func);
bootBIOS(ax);
unmap_vram();
if (CurrentPci->active)
- close_console(Console);
+ close_console(Console);
if (dev) return;
-
+
CurrentPci = CurrentPci->next;
}
-
+
/* We have an ISA device - configure if requested */
if (!Active_is_Pci /* no isa card in system! */
&& ((!dev && (Config.ConfigActiveDevice || Config.ConfigActiveOnly))
- || (dev && dev->type == ISA))) {
+ || (dev && dev->type == ISA))) {
pciVideoDisable();
if (!dev || dev->type == ISA) {
- outb(0x102, save_pos102);
- outb(0x46e8, save_46e8);
- outb(0x3C3, save_vse);
- outb(0x3C2, save_msr);
-
+ outb(0x102, save_pos102);
+ outb(0x46e8, save_46e8);
+ outb(0x3C3, save_vse);
+ outb(0x3C2, save_msr);
+
#ifdef __ia32__
- vbios_base = setup_primary_int_vect();
+ vbios_base = setup_primary_int_vect();
#else
- vbios_base = setup_int_vect();
+ vbios_base = setup_int_vect();
#endif
- if (copy_vbios(vbios_base)) {
-
- if (Config.SaveBios) save_bios_to_file();
- if (map_vram()) {
- printf("initializing ISA bus\n");
- bootBIOS(0);
- }
- }
-
- unmap_vram();
- sleep(1);
- close_console(Console);
- }
- }
-
-
+ if (copy_vbios(vbios_base)) {
+
+ if (Config.SaveBios) save_bios_to_file();
+ if (map_vram()) {
+ printf("initializing ISA bus\n");
+ bootBIOS(0);
+ }
+ }
+
+ unmap_vram();
+ sleep(1);
+ close_console(Console);
+ }
+ }
+
+
}
-int
+int
map(void)
{
void* mem;
mem = mmap(0, (size_t)SIZE,
- PROT_EXEC | PROT_READ | PROT_WRITE,
- MAP_FIXED | MAP_PRIVATE | MAP_ANON,
- -1, 0 );
+ PROT_EXEC | PROT_READ | PROT_WRITE,
+ MAP_FIXED | MAP_PRIVATE | MAP_ANON,
+ -1, 0 );
if (mem != 0) {
- perror("anonymous map");
- return (0);
+ perror("anonymous map");
+ return (0);
}
memset(mem,0,SIZE);
@@ -390,33 +390,33 @@ map_vram(void)
int mem_fd;
#ifdef __ia64__
- if ((mem_fd = open(MEM_FILE,O_RDWR | O_SYNC))<0)
+ if ((mem_fd = open(MEM_FILE,O_RDWR | O_SYNC))<0)
#else
- if ((mem_fd = open(MEM_FILE,O_RDWR))<0)
+ if ((mem_fd = open(MEM_FILE,O_RDWR))<0)
#endif
- {
- perror("opening memory");
- return 0;
+ {
+ perror("opening memory");
+ return 0;
}
#ifdef __alpha__
if (!_bus_base()) sparse_shift = 7; /* Uh, oh, JENSEN... */
- if (!_bus_base_sparse()) sparse_shift = 0;
- if ((vram_map = mmap(0,(size_t) (VRAM_SIZE << sparse_shift),
- PROT_READ | PROT_WRITE,
- MAP_SHARED,
- mem_fd, (VRAM_START << sparse_shift)
- | _bus_base_sparse())) == (void *) -1)
+ if (!_bus_base_sparse()) sparse_shift = 0;
+ if ((vram_map = mmap(0,(size_t) (VRAM_SIZE << sparse_shift),
+ PROT_READ | PROT_WRITE,
+ MAP_SHARED,
+ mem_fd, (VRAM_START << sparse_shift)
+ | _bus_base_sparse())) == (void *) -1)
#else
if (mmap((void *) VRAM_START, (size_t) VRAM_SIZE,
- PROT_EXEC | PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED,
- mem_fd, VRAM_START) == (void *) -1)
+ PROT_EXEC | PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED,
+ mem_fd, VRAM_START) == (void *) -1)
#endif
{
- perror("mmap error in map_hardware_ram (1)");
- close(mem_fd);
- return (0);
- }
+ perror("mmap error in map_hardware_ram (1)");
+ close(mem_fd);
+ return (0);
+ }
vram_mapped = 1;
close(mem_fd);
return (1);
@@ -426,7 +426,7 @@ static void
unmap_vram(void)
{
if (!vram_mapped) return;
-
+
munmap((void*)VRAM_START,VRAM_SIZE);
vram_mapped = 0;
}
@@ -439,39 +439,39 @@ copy_vbios(memType v_base)
int size;
if ((mem_fd = open(MEM_FILE,O_RDONLY))<0) {
- perror("opening memory");
- return (0);
+ perror("opening memory");
+ return (0);
}
- if (lseek(mem_fd,(off_t) v_base, SEEK_SET) != (off_t) v_base) {
- fprintf(stderr,"Cannot lseek\n");
- goto Error;
+ if (lseek(mem_fd,(off_t) v_base, SEEK_SET) != (off_t) v_base) {
+ fprintf(stderr,"Cannot lseek\n");
+ goto Error;
}
tmp = (unsigned char *)malloc(3);
if (read(mem_fd, (char *)tmp, (size_t) 3) != (size_t) 3) {
- fprintf(stderr,"Cannot read\n");
- goto Error;
+ fprintf(stderr,"Cannot read\n");
+ goto Error;
}
- if (lseek(mem_fd,(off_t) v_base,SEEK_SET) != (off_t) v_base)
- goto Error;
+ if (lseek(mem_fd,(off_t) v_base,SEEK_SET) != (off_t) v_base)
+ goto Error;
if (*tmp != 0x55 || *(tmp+1) != 0xAA ) {
- fprintf(stderr,"No bios found at: 0x%lx\n",v_base);
- goto Error;
+ fprintf(stderr,"No bios found at: 0x%lx\n",v_base);
+ goto Error;
}
#ifdef DEBUG
- dprint((unsigned long)tmp,0x100);
+ dprint((unsigned long)tmp,0x100);
#endif
size = *(tmp+2) * 512;
if (read(mem_fd, (char *)v_base, (size_t) size) != (size_t) size) {
- fprintf(stderr,"Cannot read\n");
- goto Error;
+ fprintf(stderr,"Cannot read\n");
+ goto Error;
}
free(tmp);
close(mem_fd);
if (!chksum((CARD8*)v_base))
- return (0);
+ return (0);
return (1);
@@ -488,14 +488,14 @@ copy_sys_bios(void)
int mem_fd;
if ((mem_fd = open(MEM_FILE,O_RDONLY))<0) {
- perror("opening memory");
- return (0);
+ perror("opening memory");
+ return (0);
}
-
- if (lseek(mem_fd,(off_t) SYS_BIOS,SEEK_SET) != (off_t) SYS_BIOS)
- goto Error;
- if (read(mem_fd, (char *)SYS_BIOS, (size_t) 0xFFFF) != (size_t) 0xFFFF)
- goto Error;
+
+ if (lseek(mem_fd,(off_t) SYS_BIOS,SEEK_SET) != (off_t) SYS_BIOS)
+ goto Error;
+ if (read(mem_fd, (char *)SYS_BIOS, (size_t) 0xFFFF) != (size_t) 0xFFFF)
+ goto Error;
close(mem_fd);
return (1);
@@ -512,15 +512,15 @@ loadCodeToMem(unsigned char *ptr, CARD8 code[])
int i;
CARD8 val;
int size = code[0];
-
+
for ( i=1;i<=size;i++) {
- val = code[i];
- *ptr++ = val;
+ val = code[i];
+ *ptr++ = val;
}
return;
}
-
-void
+
+void
dprint(unsigned long start, unsigned long size)
{
int i,j;
@@ -529,13 +529,13 @@ dprint(unsigned long start, unsigned long size)
for (j = 0; j < (size >> 4); j++) {
char *d = c;
printf("\n0x%lx: ",(unsigned long)c);
- for (i = 0; i<16; i++)
- printf("%2.2x ",(unsigned char) (*(c++)));
+ for (i = 0; i<16; i++)
+ printf("%2.2x ",(unsigned char) (*(c++)));
c = d;
for (i = 0; i<16; i++) {
- printf("%c",((((CARD8)(*c)) > 32) && (((CARD8)(*c)) < 128)) ?
- (unsigned char) (*(c)): '.');
- c++;
+ printf("%c",((((CARD8)(*c)) > 32) && (((CARD8)(*c)) < 128)) ?
+ (unsigned char) (*(c)): '.');
+ c++;
}
}
printf("\n");
@@ -548,16 +548,16 @@ save_bios_to_file(void)
int size, count;
char file_name[256];
int fd;
-
+
sprintf(file_name,"bios_%i.fil",num);
if ((fd = open(file_name,O_WRONLY | O_CREAT | O_TRUNC,00644)) == -1)
- return;
+ return;
size = (*(unsigned char*)(V_BIOS + 2)) * 512;
#ifdef V86BIOS_DEBUG
dprint(V_BIOS,20);
#endif
if ((count = write(fd,(void *)(V_BIOS),size)) != size)
- fprintf(stderr,"only saved %i of %i bytes\n",size,count);
+ fprintf(stderr,"only saved %i of %i bytes\n",size,count);
num++;
}
@@ -612,15 +612,15 @@ setup_primary_int_vect(void)
CARD32 vbase;
void *map;
- if ((mem_fd = open(MEM_FILE,O_RDWR))<0)
- {
+ if ((mem_fd = open(MEM_FILE,O_RDWR))<0)
+ {
perror("opening memory");
return (0);
}
-
+
if ((map = mmap((void *) 0, (size_t) 0x2000,
- PROT_EXEC | PROT_READ | PROT_WRITE, MAP_SHARED,
- mem_fd, 0)) == (void *)-1) {
+ PROT_EXEC | PROT_READ | PROT_WRITE, MAP_SHARED,
+ mem_fd, 0)) == (void *)-1) {
perror("mmap error in map_hardware_ram (2)");
close(mem_fd);
return (0);
@@ -636,7 +636,7 @@ setup_primary_int_vect(void)
if (!bios_var)
bios_var = (char *)malloc(BIOS_MEM);
memcpy(bios_var,0,BIOS_MEM);
-
+
vbase = (*((CARD16*)(0x10 << 2) + 1)) << 4;
if (Config.Verbose > 0) printf("vbase: 0x%x\n",vbase);
return vbase;
@@ -649,11 +649,11 @@ setup_int_vect(void)
const CARD16 cs = 0x0;
const CARD16 ip = 0x0;
int i;
-
+
/* let the int vects point to the SYS_BIOS seg */
for (i=0; i<0x80; i++) {
- ((CARD16*)0)[i<<1] = ip;
- ((CARD16*)0)[(i<<1)+1] = cs;
+ ((CARD16*)0)[i<<1] = ip;
+ ((CARD16*)0)[(i<<1)+1] = cs;
}
/* video interrupts default location */
((CARD16*)0)[(0x42<<1)+1] = 0xf000;
@@ -705,40 +705,40 @@ setup_system_bios(void)
{
char *date = "06/01/99";
char *eisa_ident = "PCI/ISA";
-
+
if (Config.MapSysBios) {
- if (!copy_sys_bios()) return 0;
- return 1;
+ if (!copy_sys_bios()) return 0;
+ return 1;
} else {
-// memset((void *)0xF0000,0xf4,0xfff7);
-
- /*
- * we trap the "industry standard entry points" to the BIOS
- * and all other locations by filling them with "hlt"
- * TODO: implement hlt-handler for these
- */
- memset((void *)0xF0000,0xf4,0x10000);
-
- /*
- * TODO: we should copy the fdd table (0xfec59-0xfec5b)
- * the video parameter table (0xf0ac-0xf0fb)
- * and the font tables (0xfa6e-0xfe6d)
- * from the original bios here
- */
-
- /* set bios date */
- strcpy((char *)0xFFFF5,date);
- /* set up eisa ident string */
- strcpy((char *)0xFFFD9,eisa_ident);
- /* write system model id for IBM-AT */
- ((char *)0)[0xFFFFE] = 0xfc;
-
- return 1;
- }
-
+/* memset((void *)0xF0000,0xf4,0xfff7); */
+
+ /*
+ * we trap the "industry standard entry points" to the BIOS
+ * and all other locations by filling them with "hlt"
+ * TODO: implement hlt-handler for these
+ */
+ memset((void *)0xF0000,0xf4,0x10000);
+
+ /*
+ * TODO: we should copy the fdd table (0xfec59-0xfec5b)
+ * the video parameter table (0xf0ac-0xf0fb)
+ * and the font tables (0xfa6e-0xfe6d)
+ * from the original bios here
+ */
+
+ /* set bios date */
+ strcpy((char *)0xFFFF5,date);
+ /* set up eisa ident string */
+ strcpy((char *)0xFFFD9,eisa_ident);
+ /* write system model id for IBM-AT */
+ ((char *)0)[0xFFFFE] = 0xfc;
+
+ return 1;
+ }
+
}
static void
@@ -747,28 +747,28 @@ update_bios_vars(void)
int mem_fd;
void *map;
memType i;
-
+
#ifdef __ia64__
- if ((mem_fd = open(MEM_FILE,O_RDWR | O_SYNC))<0)
+ if ((mem_fd = open(MEM_FILE,O_RDWR | O_SYNC))<0)
#else
- if ((mem_fd = open(MEM_FILE,O_RDWR))<0)
+ if ((mem_fd = open(MEM_FILE,O_RDWR))<0)
#endif
- {
+ {
perror("opening memory");
return;
}
-
+
if ((map = mmap((void *) 0, (size_t) 0x2000,
- PROT_EXEC | PROT_READ | PROT_WRITE, MAP_SHARED,
- mem_fd, 0)) == (void *)-1) {
+ PROT_EXEC | PROT_READ | PROT_WRITE, MAP_SHARED,
+ mem_fd, 0)) == (void *)-1) {
perror("mmap error in map_hardware_ram (3)");
close(mem_fd);
return;
}
for (i = 0; i < BIOS_MEM; i++) {
- if (bios_var[i] != *(CARD8*)i)
- *((CARD8*)map + i) = *(CARD8*)i;
+ if (bios_var[i] != *(CARD8*)i)
+ *((CARD8*)map + i) = *(CARD8*)i;
}
munmap(map,0x2000);
@@ -782,10 +782,10 @@ chksum(CARD8 *start)
CARD8 val = 0;
int i;
- size = *(start+2) * 512;
+ size = *(start+2) * 512;
for (i = 0; i<size; i++)
val += *(start + i);
-
+
if (!val)
return 1;
@@ -800,10 +800,10 @@ runINT(int num, i86biosRegsPtr Regs)
CARD8 code_int[] = { 3, 0xcd, 0x00, 0xf4 };
code_int[2] = (CARD8) num;
-
+
if (num == 0x10)
isVideo = TRUE;
-
+
if (!setup_system_bios())
return;
@@ -815,16 +815,16 @@ runINT(int num, i86biosRegsPtr Regs)
#else
if (!(vbios_base = setup_int_vect()))
#endif
- return;
+ return;
if (!copy_vbios(vbios_base))
- return;
+ return;
}
-
+
if (!map_vram())
return;
-
+
#ifdef V86BIOS_DEBUG
- printf("starting BIOS\n");
+ printf("starting BIOS\n");
#endif
loadCodeToMem((unsigned char *) BIOS_START, code_int);
setup_io();
@@ -834,12 +834,12 @@ runINT(int num, i86biosRegsPtr Regs)
do_x86(BIOS_START,Regs);
set_hlt(FALSE);
print_regs(Regs);
-
+
#ifdef V86BIOS_DEBUG
printf("done\n");
#endif
- if ((isVideo && (!CurrentPci || CurrentPci->active)) || !isVideo)
+ if ((isVideo && (!CurrentPci || CurrentPci->active)) || !isVideo)
update_bios_vars();
}
@@ -867,11 +867,11 @@ add_hlt(unsigned long val)
printf("address out of range\n");
return;
}
-
+
for (i=0; i<20; i++) {
if (hltp[i].address == 0) {
- hltp[i].address = (void*)val;
- break;
+ hltp[i].address = (void*)val;
+ break;
}
}
if (i == 20) printf("no more hltpoints available\n");
@@ -884,7 +884,7 @@ del_hlt(int val)
int i;
printf("clearing all hltpoints\n");
for (i=0; i <20; i++)
- hltp[i].address = NULL;
+ hltp[i].address = NULL;
} else if (val >= 0 && val <20)
hltp[val].address = NULL;
else printf("hltpoint %i out of range: valid range 0-19\n",val);
@@ -894,22 +894,22 @@ void
list_hlt()
{
int i;
- for (i=0; i<20; i++)
+ for (i=0; i<20; i++)
if (hltp[i].address)
- printf("hltpoint[%i]: 0x%lx\n",i,(unsigned long)hltp[i].address);
+ printf("hltpoint[%i]: 0x%lx\n",i,(unsigned long)hltp[i].address);
}
static void
set_hlt(Bool set)
{
int i;
- for (i=0; i<20; i++)
+ for (i=0; i<20; i++)
if (hltp[i].address) {
- if (set) {
- hltp[i].orgval = *(CARD8*)hltp[i].address;
- *(CARD8*)hltp[i].address = 0xf4;
- } else
- *(CARD8*)hltp[i].address = hltp[i].orgval;
+ if (set) {
+ hltp[i].orgval = *(CARD8*)hltp[i].address;
+ *(CARD8*)hltp[i].address = 0xf4;
+ } else
+ *(CARD8*)hltp[i].address = hltp[i].orgval;
}
}
@@ -922,12 +922,12 @@ set_ioperm(void)
for (i = 0; i < IOPERM_BITS;i++)
if (ioperm_list[i]) {
- start = i;
- for (;i < IOPERM_BITS; i++) {
- if (!ioperm_list[i]) {
- ioperm(start,i - start, 1);
- break;
- }
- }
+ start = i;
+ for (;i < IOPERM_BITS; i++) {
+ if (!ioperm_list[i]) {
+ ioperm(start,i - start, 1);
+ break;
+ }
+ }
}
}
diff --git a/board/MAI/bios_emulator/scitech/src/v86bios/v86bios.h b/board/MAI/bios_emulator/scitech/src/v86bios/v86bios.h
index 06d0f9ff52..a8f3f8e649 100644
--- a/board/MAI/bios_emulator/scitech/src/v86bios/v86bios.h
+++ b/board/MAI/bios_emulator/scitech/src/v86bios/v86bios.h
@@ -31,11 +31,11 @@
#include <stdio.h>
#define p_printf(f,a...) do {if (Config.PrintPort) lprintf(f,##a);} \
- while(0)
+ while(0)
#define i_printf(f,a...) do {if (Config.PrintIrq) lprintf(f,##a);} \
- while(0)
+ while(0)
#define P_printf(f,a...) do {if (Config.PrintPci) lprintf(f,##a);} \
- while(0)
+ while(0)
typedef unsigned char CARD8;
typedef unsigned short CARD16;
@@ -65,7 +65,7 @@ struct config {
Bool MapSysBios;
Bool Resort;
Bool FixRom;
- Bool NoConsole;
+ Bool NoConsole;
Bool BootOnly;
int Verbose;
};
@@ -80,21 +80,21 @@ struct pio {
};
struct regs86 {
- long ebx;
- long ecx;
- long edx;
- long esi;
- long edi;
- long ebp;
- long eax;
- long eip;
- long esp;
- unsigned short cs;
- unsigned short ss;
- unsigned short es;
- unsigned short ds;
- unsigned short fs;
- unsigned short gs;
+ long ebx;
+ long ecx;
+ long edx;
+ long esi;
+ long edi;
+ long ebp;
+ long eax;
+ long eip;
+ long esp;
+ unsigned short cs;
+ unsigned short ss;
+ unsigned short es;
+ unsigned short ds;
+ unsigned short fs;
+ unsigned short gs;
long eflags;
};
@@ -127,9 +127,9 @@ struct device {
union {
int none;
struct pci {
- int bus;
- int dev;
- int func;
+ int bus;
+ int dev;
+ int func;
} pci;
} loc;
};
@@ -212,4 +212,3 @@ extern void lprintf(const char *f, ...);
#endif
#endif
-
diff --git a/board/MAI/bios_emulator/scitech/src/v86bios/x86emu.c b/board/MAI/bios_emulator/scitech/src/v86bios/x86emu.c
index 2cc72df995..b5c99d7a7f 100644
--- a/board/MAI/bios_emulator/scitech/src/v86bios/x86emu.c
+++ b/board/MAI/bios_emulator/scitech/src/v86bios/x86emu.c
@@ -28,7 +28,7 @@
#include </usr/include/unistd.h>
#include <errno.h>
#include <asm/unistd.h>
-//#include <syscall-list.h>
+/*#include <syscall-list.h> */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -50,10 +50,10 @@
struct pio P;
void
-setup_io(void)
+setup_io(void)
{
if (!Config.PrintPort && !Config.IoStatistics) {
-
+
#if defined (__i386__)
P.inb = (u8(*)(u16))inb;
P.inw = (u16(*)(u16))inw;
@@ -86,19 +86,19 @@ void
x86emu_do_int(int num)
{
struct regs86 regs;
-
+
i_printf("int 0x%x received: ax:0x%x",num,CPU_REG(AX));
if (Config.PrintIp)
- i_printf(" at: 0x%x\n",getIP());
+ i_printf(" at: 0x%x\n",getIP());
else
- i_printf("\n");
-
+ i_printf("\n");
+
/* try to run bios interrupt */
-
+
/* if not installed fall back */
#define COPY(x,y) regs.y = M.x86.x
#define COPY_R(x,y) M.x86.x = regs.y
-
+
COPY(R_EAX,eax);
COPY(R_EBX,ebx);
COPY(R_ECX,ecx);
@@ -117,12 +117,12 @@ x86emu_do_int(int num)
COPY(R_EFLG,eflags);
if (!(int_handler(num,&regs))) {
- if (!run_bios_int(num,&regs))
- goto unknown_int;
- else
- return;
+ if (!run_bios_int(num,&regs))
+ goto unknown_int;
+ else
+ return;
}
-
+
COPY_R(R_EAX,eax);
COPY_R(R_EBX,ebx);
COPY_R(R_ECX,ecx);
@@ -145,7 +145,7 @@ x86emu_do_int(int num)
fprintf(stderr,"\nUnknown vm86_int: %X\n\n",num);
X86EMU_halt_sys();
return;
-
+
#undef COPY
#undef COPY_R
}
@@ -159,12 +159,12 @@ setup_x86emu(unsigned long bios_start, i86biosRegsPtr regs)
X86EMU_intrFuncs intFuncs[256];
X86EMU_pioFuncs pioFuncs = {
- (u8(*)(u16))P.inb,
- (u16(*)(u16))P.inw,
- (u32(*)(u16))P.inl,
- (void(*)(u16,u8))P.outb,
- (void(*)(u16,u16))P.outw,
- (void(*)(u16,u32))P.outl
+ (u8(*)(u16))P.inb,
+ (u16(*)(u16))P.inw,
+ (u32(*)(u16))P.inl,
+ (void(*)(u16,u8))P.outb,
+ (void(*)(u16,u16))P.outw,
+ (void(*)(u16,u32))P.outl
};
#ifdef __alpha__
X86EMU_memFuncs memFuncs = {
@@ -178,29 +178,29 @@ setup_x86emu(unsigned long bios_start, i86biosRegsPtr regs)
#endif
M.mem_base = 0;
M.mem_size = 1024*1024 + 1024;
- // M.x86.debug = DEBUG_DISASSEMBLE_F | DEBUG_TRACE_F | DEBUG_DECODE_F;
- // M.x86.debug |= DEBUG_DECODE_F | DEBUG_TRACE_F;
+ /* M.x86.debug = DEBUG_DISASSEMBLE_F | DEBUG_TRACE_F | DEBUG_DECODE_F; */
+ /* M.x86.debug |= DEBUG_DECODE_F | DEBUG_TRACE_F; */
/*
* For single step tracing compile x86emu with option -DDEBUG
*/
M.x86.debug = 0;
if (Config.PrintIp)
- M.x86.debug = DEBUG_SAVE_CS_IP;
+ M.x86.debug = DEBUG_SAVE_CS_IP;
if (Config.Trace)
- X86EMU_trace_on();
+ X86EMU_trace_on();
X86EMU_setupPioFuncs(&pioFuncs);
#ifdef __alpha__
X86EMU_setupMemFuncs(&memFuncs);
#endif
for (i=0;i<256;i++)
- intFuncs[i] = x86emu_do_int;
+ intFuncs[i] = x86emu_do_int;
X86EMU_setupIntrFuncs(intFuncs);
eip = bios_start & 0xFFFF;
cs = (bios_start & 0xFF0000) >> 4;
-
+
CPU_REG(EAX) = regs->ax;
CPU_REG(EBX) = regs->bx;
CPU_REG(ECX) = regs->cx;
@@ -209,7 +209,7 @@ setup_x86emu(unsigned long bios_start, i86biosRegsPtr regs)
CPU_REG(EDI) = regs->di;
CPU_REG(EBP) = 0;
CPU_REG(EIP) = eip;
- CPU_REG(CS) = cs;
+ CPU_REG(CS) = cs;
CPU_REG(SP) = 0x100;
CPU_REG(SS) = 0x30; /* This is the standard pc bios stack */
CPU_REG(ES) = regs->es;
@@ -252,14 +252,14 @@ do_x86(unsigned long bios_start, i86biosRegsPtr regs)
setup_x86emu(bios_start,regs);
if (setjmp(x86_esc) == 0) {
- org_handler = signal(2,vmexit);
- do_x86emu();
- signal(2,org_handler);
- collect_bios_regs(regs);
+ org_handler = signal(2,vmexit);
+ do_x86emu();
+ signal(2,org_handler);
+ collect_bios_regs(regs);
} else {
- signal(2,org_handler);
- printf("interrupted at 0x%x\n",((CARD16)CPU_REG(CS)) << 4
- | (CARD16)CPU_REG(EIP));
+ signal(2,org_handler);
+ printf("interrupted at 0x%x\n",((CARD16)CPU_REG(CS)) << 4
+ | (CARD16)CPU_REG(EIP));
}
}
@@ -272,23 +272,23 @@ run_bios_int(int num, struct regs86 *regs)
/* check if bios vector is initialized */
if (((CARD16*)0)[(num<<1)+1] == 0x0000) { /* SYS_BIOS_SEG ?*/
#ifdef V86BIOS_DEBUG
- i_printf("card BIOS not loaded\n");
+ i_printf("card BIOS not loaded\n");
#endif
- return 0;
+ return 0;
}
-
+
#ifdef V86BIOS_DEBUG
if (firsttime) {
- dprint(0,0x3D0);
- firsttime = 0;
+ dprint(0,0x3D0);
+ firsttime = 0;
}
#endif
-
+
i_printf("calling card BIOS at: ");
i_printf("0x%x:%x\n",((CARD16 *) 0)[(num << 1) + 1],
- (CARD32)((CARD16 *) 0)[num << 1]);
+ (CARD32)((CARD16 *) 0)[num << 1]);
X86EMU_prepareForInt(num);
-
+
return 1;
}
diff --git a/board/MAI/bios_emulator/scitech/src/x86emu/debug.c b/board/MAI/bios_emulator/scitech/src/x86emu/debug.c
index 050008c930..235e6ac146 100644
--- a/board/MAI/bios_emulator/scitech/src/x86emu/debug.c
+++ b/board/MAI/bios_emulator/scitech/src/x86emu/debug.c
@@ -48,7 +48,7 @@
static void print_encoded_bytes (u16 s, u16 o);
static void print_decoded_instruction (void);
static int parse_line (char *s, int *ps, int *n);
-
+
/* should look something like debug's output. */
void X86EMU_trace_regs (void)
{
@@ -94,11 +94,11 @@ static void disassemble_forward (u16 seg, u16 off, int n)
* SINGLE_STEP(r,m); which disappear if DEBUG is not defined to
* the preprocessor. The TRACE_REGS macro expands to:
*
- * if (debug&DEBUG_DISASSEMBLE)
+ * if (debug&DEBUG_DISASSEMBLE)
* {just_disassemble(); goto EndOfInstruction;}
* if (debug&DEBUG_TRACE) trace_regs(r,m);
*
- * ...... and at the last line of the routine.
+ * ...... and at the last line of the routine.
*
* EndOfInstruction: end_instr();
*
@@ -112,14 +112,14 @@ static void disassemble_forward (u16 seg, u16 off, int n)
tregs = M;
tregs.x86.R_IP = off;
tregs.x86.R_CS = seg;
-
+
/* reset the decoding buffers */
tregs.x86.enc_str_pos = 0;
tregs.x86.enc_pos = 0;
-
+
/* turn on the "disassemble only, no execute" flag */
tregs.x86.debug |= DEBUG_DISASSEMBLE_F;
-
+
/* DUMP NEXT n instructions to screen in straight_line fashion */
/*
* This looks like the regular instruction fetch stream, except
@@ -210,7 +210,7 @@ void X86EMU_dump_memory (u16 seg, u16 off, u32 amt)
u32 end = (off+16) & 0xfffffff0;
u32 i;
u32 current;
-
+
current = start;
while (end <= off + amt) {
printk("%04x:%04x ", seg, start);
@@ -235,7 +235,7 @@ void x86emu_single_step (void)
int offset;
static int breakpoint;
static int noDecode = 1;
-
+
char *p;
if (DEBUG_BREAK()) {
@@ -249,19 +249,19 @@ void x86emu_single_step (void)
X86EMU_trace_regs();
}
}
-
+
done=0;
offset = M.x86.saved_ip;
while (!done) {
- printk("-");
- //p = fgets(s, 1023, stdin);
+ printk("-");
+ /*p = fgets(s, 1023, stdin); */
cons_gets(s);
- cmd = parse_line(s, ps, &ntok);
- switch(cmd) {
+ cmd = parse_line(s, ps, &ntok);
+ switch(cmd) {
case 'u':
disassemble_forward(M.x86.saved_cs,(u16)offset,10);
- break;
- case 'd':
+ break;
+ case 'd':
if (ntok == 2) {
segment = M.x86.saved_cs;
offset = ps[1];
@@ -277,22 +277,22 @@ void x86emu_single_step (void)
X86EMU_dump_memory(segment,(u16)offset,16);
offset += 16;
}
- break;
+ break;
case 'c':
M.x86.debug ^= DEBUG_TRACECALL_F;
- break;
+ break;
case 's':
M.x86.debug ^= DEBUG_SVC_F | DEBUG_SYS_F | DEBUG_SYSINT_F;
- break;
+ break;
case 'r':
X86EMU_trace_regs();
- break;
+ break;
case 'x':
X86EMU_trace_xregs();
- break;
+ break;
case 'g':
- if (ntok == 2) {
- breakpoint = ps[1];
+ if (ntok == 2) {
+ breakpoint = ps[1];
printk("breakpoint set to 0x%X\n", breakpoint);
if (noDecode) {
M.x86.debug |= DEBUG_DECODE_NOPRINT_F;
@@ -302,8 +302,8 @@ void x86emu_single_step (void)
M.x86.debug &= ~DEBUG_TRACE_F;
M.x86.debug |= DEBUG_BREAK_F;
done = 1;
- }
- break;
+ }
+ break;
case 'q':
M.x86.debug |= DEBUG_EXIT;
return;
@@ -313,9 +313,9 @@ void x86emu_single_step (void)
break;
case 't':
case 0:
- done = 1;
- break;
- }
+ done = 1;
+ break;
+ }
}
}
@@ -338,23 +338,23 @@ static int parse_line (char *s, int *ps, int *n)
ps[*n] = *s;
switch (*s) {
case '\n':
- *n += 1;
- return 0;
+ *n += 1;
+ return 0;
default:
- cmd = *s;
- *n += 1;
+ cmd = *s;
+ *n += 1;
}
while (1) {
while (*s != ' ' && *s != '\t' && *s != '\n') s++;
-
+
if (*s == '\n')
return cmd;
-
+
while(*s == ' ' || *s == '\t') s++;
-
+
ps[*n]=atoi(s);
- //sscanf(s,"%x",&ps[*n]);
+ /*sscanf(s,"%x",&ps[*n]); */
*n += 1;
}
}
@@ -405,7 +405,7 @@ void x86emu_dump_regs (void)
if (ACCESS_FLAG(F_CF)) printk("CY ");
else printk("NC ");
printk("\n");
- //x86emu_dump_stack();
+ /*x86emu_dump_stack(); */
}
void x86emu_dump_xregs (void)
diff --git a/board/MAI/bios_emulator/scitech/src/x86emu/decode.c b/board/MAI/bios_emulator/scitech/src/x86emu/decode.c
index bb204e6001..832b1f5f2e 100644
--- a/board/MAI/bios_emulator/scitech/src/x86emu/decode.c
+++ b/board/MAI/bios_emulator/scitech/src/x86emu/decode.c
@@ -93,7 +93,7 @@ void X86EMU_exec(void)
M.x86.intr = 0;
DB(x86emu_end_instr();)
-
+
for (;;) {
DB(if (CHECK_IP_FETCH()) x86emu_check_ip_access();)
/* If debugging, save the IP and CS values. */
@@ -745,11 +745,11 @@ unsigned decode_rm00_address(
return M.x86.R_ECX;
case 2:
DECODE_PRINTF("[EDX]");
-// M.x86.mode |= SYSMODE_SEG_DS_SS;
+/* M.x86.mode |= SYSMODE_SEG_DS_SS; */
return M.x86.R_EDX;
case 3:
DECODE_PRINTF("[EBX]");
-// M.x86.mode |= SYSMODE_SEG_DS_SS;
+/* M.x86.mode |= SYSMODE_SEG_DS_SS; */
return M.x86.R_EBX;
case 4:
printk("Unsupported SIB encoding\n");
@@ -933,7 +933,7 @@ unsigned decode_rm10_address(
}
else
{
- int displacement = (s16)fetch_word_imm();
+ int displacement = (s16)fetch_word_imm();
switch (rm) {
case 0:
DECODE_PRINTF2("%d[BX+SI]", displacement);
diff --git a/board/MAI/bios_emulator/scitech/src/x86emu/fpu.c b/board/MAI/bios_emulator/scitech/src/x86emu/fpu.c
index 08aea42292..7f7c345b34 100644
--- a/board/MAI/bios_emulator/scitech/src/x86emu/fpu.c
+++ b/board/MAI/bios_emulator/scitech/src/x86emu/fpu.c
@@ -102,24 +102,24 @@ void x86emuOp_esc_coprocess_d9(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
#ifdef DEBUG
if (mod != 3) {
- DECODE_PRINTINSTR32(x86emu_fpu_op_d9_tab, mod, rh, rl);
+ DECODE_PRINTINSTR32(x86emu_fpu_op_d9_tab, mod, rh, rl);
} else {
- DECODE_PRINTF(x86emu_fpu_op_d9_tab1[(rh << 3) + rl]);
+ DECODE_PRINTF(x86emu_fpu_op_d9_tab1[(rh << 3) + rl]);
}
#endif
switch (mod) {
case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- break;
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ break;
case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- break;
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ break;
case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- break;
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ break;
case 3: /* register to register */
stkelem = (u8)rl;
if (rh < 4) {
@@ -127,167 +127,167 @@ void x86emuOp_esc_coprocess_d9(u8 X86EMU_UNUSED(op1))
} else {
DECODE_PRINTF("\n");
}
- break;
+ break;
}
#ifdef X86EMU_FPU_PRESENT
/* execute */
switch (mod) {
case 3:
- switch (rh) {
- case 0:
- x86emu_fpu_R_fld(X86EMU_FPU_STKTOP, stkelem);
- break;
- case 1:
- x86emu_fpu_R_fxch(X86EMU_FPU_STKTOP, stkelem);
- break;
- case 2:
- switch (rl) {
- case 0:
- x86emu_fpu_R_nop();
- break;
- default:
- x86emu_fpu_illegal();
- break;
- }
- case 3:
- x86emu_fpu_R_fstp(X86EMU_FPU_STKTOP, stkelem);
- break;
- case 4:
- switch (rl) {
- case 0:
- x86emu_fpu_R_fchs(X86EMU_FPU_STKTOP);
- break;
- case 1:
- x86emu_fpu_R_fabs(X86EMU_FPU_STKTOP);
- break;
- case 4:
- x86emu_fpu_R_ftst(X86EMU_FPU_STKTOP);
- break;
- case 5:
- x86emu_fpu_R_fxam(X86EMU_FPU_STKTOP);
- break;
- default:
- /* 2,3,6,7 */
- x86emu_fpu_illegal();
- break;
- }
- break;
-
- case 5:
- switch (rl) {
- case 0:
- x86emu_fpu_R_fld1(X86EMU_FPU_STKTOP);
- break;
- case 1:
- x86emu_fpu_R_fldl2t(X86EMU_FPU_STKTOP);
- break;
- case 2:
- x86emu_fpu_R_fldl2e(X86EMU_FPU_STKTOP);
- break;
- case 3:
- x86emu_fpu_R_fldpi(X86EMU_FPU_STKTOP);
- break;
- case 4:
- x86emu_fpu_R_fldlg2(X86EMU_FPU_STKTOP);
- break;
- case 5:
- x86emu_fpu_R_fldln2(X86EMU_FPU_STKTOP);
- break;
- case 6:
- x86emu_fpu_R_fldz(X86EMU_FPU_STKTOP);
- break;
- default:
- /* 7 */
- x86emu_fpu_illegal();
- break;
- }
- break;
-
- case 6:
- switch (rl) {
- case 0:
- x86emu_fpu_R_f2xm1(X86EMU_FPU_STKTOP);
- break;
- case 1:
- x86emu_fpu_R_fyl2x(X86EMU_FPU_STKTOP);
- break;
- case 2:
- x86emu_fpu_R_fptan(X86EMU_FPU_STKTOP);
- break;
- case 3:
- x86emu_fpu_R_fpatan(X86EMU_FPU_STKTOP);
- break;
- case 4:
- x86emu_fpu_R_fxtract(X86EMU_FPU_STKTOP);
- break;
- case 5:
- x86emu_fpu_illegal();
- break;
- case 6:
- x86emu_fpu_R_decstp();
- break;
- case 7:
- x86emu_fpu_R_incstp();
- break;
- }
- break;
-
- case 7:
- switch (rl) {
- case 0:
- x86emu_fpu_R_fprem(X86EMU_FPU_STKTOP);
- break;
- case 1:
- x86emu_fpu_R_fyl2xp1(X86EMU_FPU_STKTOP);
- break;
- case 2:
- x86emu_fpu_R_fsqrt(X86EMU_FPU_STKTOP);
- break;
- case 3:
- x86emu_fpu_illegal();
- break;
- case 4:
- x86emu_fpu_R_frndint(X86EMU_FPU_STKTOP);
- break;
- case 5:
- x86emu_fpu_R_fscale(X86EMU_FPU_STKTOP);
- break;
- case 6:
- case 7:
- default:
- x86emu_fpu_illegal();
- break;
- }
- break;
-
- default:
- switch (rh) {
- case 0:
- x86emu_fpu_M_fld(X86EMU_FPU_FLOAT, destoffset);
- break;
- case 1:
- x86emu_fpu_illegal();
- break;
- case 2:
- x86emu_fpu_M_fst(X86EMU_FPU_FLOAT, destoffset);
- break;
- case 3:
- x86emu_fpu_M_fstp(X86EMU_FPU_FLOAT, destoffset);
- break;
- case 4:
- x86emu_fpu_M_fldenv(X86EMU_FPU_WORD, destoffset);
- break;
- case 5:
- x86emu_fpu_M_fldcw(X86EMU_FPU_WORD, destoffset);
- break;
- case 6:
- x86emu_fpu_M_fstenv(X86EMU_FPU_WORD, destoffset);
- break;
- case 7:
- x86emu_fpu_M_fstcw(X86EMU_FPU_WORD, destoffset);
- break;
- }
- }
+ switch (rh) {
+ case 0:
+ x86emu_fpu_R_fld(X86EMU_FPU_STKTOP, stkelem);
+ break;
+ case 1:
+ x86emu_fpu_R_fxch(X86EMU_FPU_STKTOP, stkelem);
+ break;
+ case 2:
+ switch (rl) {
+ case 0:
+ x86emu_fpu_R_nop();
+ break;
+ default:
+ x86emu_fpu_illegal();
+ break;
+ }
+ case 3:
+ x86emu_fpu_R_fstp(X86EMU_FPU_STKTOP, stkelem);
+ break;
+ case 4:
+ switch (rl) {
+ case 0:
+ x86emu_fpu_R_fchs(X86EMU_FPU_STKTOP);
+ break;
+ case 1:
+ x86emu_fpu_R_fabs(X86EMU_FPU_STKTOP);
+ break;
+ case 4:
+ x86emu_fpu_R_ftst(X86EMU_FPU_STKTOP);
+ break;
+ case 5:
+ x86emu_fpu_R_fxam(X86EMU_FPU_STKTOP);
+ break;
+ default:
+ /* 2,3,6,7 */
+ x86emu_fpu_illegal();
+ break;
+ }
+ break;
+
+ case 5:
+ switch (rl) {
+ case 0:
+ x86emu_fpu_R_fld1(X86EMU_FPU_STKTOP);
+ break;
+ case 1:
+ x86emu_fpu_R_fldl2t(X86EMU_FPU_STKTOP);
+ break;
+ case 2:
+ x86emu_fpu_R_fldl2e(X86EMU_FPU_STKTOP);
+ break;
+ case 3:
+ x86emu_fpu_R_fldpi(X86EMU_FPU_STKTOP);
+ break;
+ case 4:
+ x86emu_fpu_R_fldlg2(X86EMU_FPU_STKTOP);
+ break;
+ case 5:
+ x86emu_fpu_R_fldln2(X86EMU_FPU_STKTOP);
+ break;
+ case 6:
+ x86emu_fpu_R_fldz(X86EMU_FPU_STKTOP);
+ break;
+ default:
+ /* 7 */
+ x86emu_fpu_illegal();
+ break;
+ }
+ break;
+
+ case 6:
+ switch (rl) {
+ case 0:
+ x86emu_fpu_R_f2xm1(X86EMU_FPU_STKTOP);
+ break;
+ case 1:
+ x86emu_fpu_R_fyl2x(X86EMU_FPU_STKTOP);
+ break;
+ case 2:
+ x86emu_fpu_R_fptan(X86EMU_FPU_STKTOP);
+ break;
+ case 3:
+ x86emu_fpu_R_fpatan(X86EMU_FPU_STKTOP);
+ break;
+ case 4:
+ x86emu_fpu_R_fxtract(X86EMU_FPU_STKTOP);
+ break;
+ case 5:
+ x86emu_fpu_illegal();
+ break;
+ case 6:
+ x86emu_fpu_R_decstp();
+ break;
+ case 7:
+ x86emu_fpu_R_incstp();
+ break;
+ }
+ break;
+
+ case 7:
+ switch (rl) {
+ case 0:
+ x86emu_fpu_R_fprem(X86EMU_FPU_STKTOP);
+ break;
+ case 1:
+ x86emu_fpu_R_fyl2xp1(X86EMU_FPU_STKTOP);
+ break;
+ case 2:
+ x86emu_fpu_R_fsqrt(X86EMU_FPU_STKTOP);
+ break;
+ case 3:
+ x86emu_fpu_illegal();
+ break;
+ case 4:
+ x86emu_fpu_R_frndint(X86EMU_FPU_STKTOP);
+ break;
+ case 5:
+ x86emu_fpu_R_fscale(X86EMU_FPU_STKTOP);
+ break;
+ case 6:
+ case 7:
+ default:
+ x86emu_fpu_illegal();
+ break;
+ }
+ break;
+
+ default:
+ switch (rh) {
+ case 0:
+ x86emu_fpu_M_fld(X86EMU_FPU_FLOAT, destoffset);
+ break;
+ case 1:
+ x86emu_fpu_illegal();
+ break;
+ case 2:
+ x86emu_fpu_M_fst(X86EMU_FPU_FLOAT, destoffset);
+ break;
+ case 3:
+ x86emu_fpu_M_fstp(X86EMU_FPU_FLOAT, destoffset);
+ break;
+ case 4:
+ x86emu_fpu_M_fldenv(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 5:
+ x86emu_fpu_M_fldcw(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 6:
+ x86emu_fpu_M_fstenv(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 7:
+ x86emu_fpu_M_fstcw(X86EMU_FPU_WORD, destoffset);
+ break;
+ }
+ }
}
#endif /* X86EMU_FPU_PRESENT */
DECODE_CLEAR_SEGOVR();
@@ -306,7 +306,7 @@ char *x86emu_fpu_op_da_tab[] = {
"FICOMP\tDWORD PTR ",
"FISUB\tDWORD PTR ", "FISUBR\tDWORD PTR ", "FIDIV\tDWORD PTR ",
"FIDIVR\tDWORD PTR ",
-
+
"FIADD\tDWORD PTR ", "FIMUL\tDWORD PTR ", "FICOM\tDWORD PTR ",
"FICOMP\tDWORD PTR ",
"FISUB\tDWORD PTR ", "FISUBR\tDWORD PTR ", "FIDIV\tDWORD PTR ",
@@ -330,54 +330,54 @@ void x86emuOp_esc_coprocess_da(u8 X86EMU_UNUSED(op1))
DECODE_PRINTINSTR32(x86emu_fpu_op_da_tab, mod, rh, rl);
switch (mod) {
case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- break;
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ break;
case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- break;
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ break;
case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- break;
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ break;
case 3: /* register to register */
stkelem = (u8)rl;
- DECODE_PRINTF2("\tST(%d),ST\n", stkelem);
- break;
+ DECODE_PRINTF2("\tST(%d),ST\n", stkelem);
+ break;
}
#ifdef X86EMU_FPU_PRESENT
switch (mod) {
case 3:
- x86emu_fpu_illegal();
- break;
+ x86emu_fpu_illegal();
+ break;
default:
- switch (rh) {
- case 0:
- x86emu_fpu_M_iadd(X86EMU_FPU_SHORT, destoffset);
- break;
- case 1:
- x86emu_fpu_M_imul(X86EMU_FPU_SHORT, destoffset);
- break;
- case 2:
- x86emu_fpu_M_icom(X86EMU_FPU_SHORT, destoffset);
- break;
- case 3:
- x86emu_fpu_M_icomp(X86EMU_FPU_SHORT, destoffset);
- break;
- case 4:
- x86emu_fpu_M_isub(X86EMU_FPU_SHORT, destoffset);
- break;
- case 5:
- x86emu_fpu_M_isubr(X86EMU_FPU_SHORT, destoffset);
- break;
- case 6:
- x86emu_fpu_M_idiv(X86EMU_FPU_SHORT, destoffset);
- break;
- case 7:
- x86emu_fpu_M_idivr(X86EMU_FPU_SHORT, destoffset);
- break;
- }
+ switch (rh) {
+ case 0:
+ x86emu_fpu_M_iadd(X86EMU_FPU_SHORT, destoffset);
+ break;
+ case 1:
+ x86emu_fpu_M_imul(X86EMU_FPU_SHORT, destoffset);
+ break;
+ case 2:
+ x86emu_fpu_M_icom(X86EMU_FPU_SHORT, destoffset);
+ break;
+ case 3:
+ x86emu_fpu_M_icomp(X86EMU_FPU_SHORT, destoffset);
+ break;
+ case 4:
+ x86emu_fpu_M_isub(X86EMU_FPU_SHORT, destoffset);
+ break;
+ case 5:
+ x86emu_fpu_M_isubr(X86EMU_FPU_SHORT, destoffset);
+ break;
+ case 6:
+ x86emu_fpu_M_idiv(X86EMU_FPU_SHORT, destoffset);
+ break;
+ case 7:
+ x86emu_fpu_M_idivr(X86EMU_FPU_SHORT, destoffset);
+ break;
+ }
}
#endif
DECODE_CLEAR_SEGOVR();
@@ -409,95 +409,95 @@ void x86emuOp_esc_coprocess_db(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
#ifdef DEBUG
if (mod != 3) {
- DECODE_PRINTINSTR32(x86emu_fpu_op_db_tab, mod, rh, rl);
+ DECODE_PRINTINSTR32(x86emu_fpu_op_db_tab, mod, rh, rl);
} else if (rh == 4) { /* === 11 10 0 nnn */
- switch (rl) {
- case 0:
- DECODE_PRINTF("FENI\n");
- break;
- case 1:
- DECODE_PRINTF("FDISI\n");
- break;
- case 2:
- DECODE_PRINTF("FCLEX\n");
- break;
- case 3:
- DECODE_PRINTF("FINIT\n");
- break;
- }
+ switch (rl) {
+ case 0:
+ DECODE_PRINTF("FENI\n");
+ break;
+ case 1:
+ DECODE_PRINTF("FDISI\n");
+ break;
+ case 2:
+ DECODE_PRINTF("FCLEX\n");
+ break;
+ case 3:
+ DECODE_PRINTF("FINIT\n");
+ break;
+ }
} else {
- DECODE_PRINTF2("ESC_DB %0x\n", (mod << 6) + (rh << 3) + (rl));
+ DECODE_PRINTF2("ESC_DB %0x\n", (mod << 6) + (rh << 3) + (rl));
}
#endif /* DEBUG */
switch (mod) {
case 0:
- destoffset = decode_rm00_address(rl);
- break;
+ destoffset = decode_rm00_address(rl);
+ break;
case 1:
- destoffset = decode_rm01_address(rl);
- break;
+ destoffset = decode_rm01_address(rl);
+ break;
case 2:
- destoffset = decode_rm10_address(rl);
- break;
+ destoffset = decode_rm10_address(rl);
+ break;
case 3: /* register to register */
- break;
+ break;
}
#ifdef X86EMU_FPU_PRESENT
/* execute */
switch (mod) {
case 3:
- switch (rh) {
- case 4:
- switch (rl) {
- case 0:
- x86emu_fpu_R_feni();
- break;
- case 1:
- x86emu_fpu_R_fdisi();
- break;
- case 2:
- x86emu_fpu_R_fclex();
- break;
- case 3:
- x86emu_fpu_R_finit();
- break;
- default:
- x86emu_fpu_illegal();
- break;
- }
- break;
- default:
- x86emu_fpu_illegal();
- break;
- }
- break;
+ switch (rh) {
+ case 4:
+ switch (rl) {
+ case 0:
+ x86emu_fpu_R_feni();
+ break;
+ case 1:
+ x86emu_fpu_R_fdisi();
+ break;
+ case 2:
+ x86emu_fpu_R_fclex();
+ break;
+ case 3:
+ x86emu_fpu_R_finit();
+ break;
+ default:
+ x86emu_fpu_illegal();
+ break;
+ }
+ break;
+ default:
+ x86emu_fpu_illegal();
+ break;
+ }
+ break;
default:
- switch (rh) {
- case 0:
- x86emu_fpu_M_fild(X86EMU_FPU_SHORT, destoffset);
- break;
- case 1:
- x86emu_fpu_illegal();
- break;
- case 2:
- x86emu_fpu_M_fist(X86EMU_FPU_SHORT, destoffset);
- break;
- case 3:
- x86emu_fpu_M_fistp(X86EMU_FPU_SHORT, destoffset);
- break;
- case 4:
- x86emu_fpu_illegal();
- break;
- case 5:
- x86emu_fpu_M_fld(X86EMU_FPU_LDBL, destoffset);
- break;
- case 6:
- x86emu_fpu_illegal();
- break;
- case 7:
- x86emu_fpu_M_fstp(X86EMU_FPU_LDBL, destoffset);
- break;
- }
+ switch (rh) {
+ case 0:
+ x86emu_fpu_M_fild(X86EMU_FPU_SHORT, destoffset);
+ break;
+ case 1:
+ x86emu_fpu_illegal();
+ break;
+ case 2:
+ x86emu_fpu_M_fist(X86EMU_FPU_SHORT, destoffset);
+ break;
+ case 3:
+ x86emu_fpu_M_fistp(X86EMU_FPU_SHORT, destoffset);
+ break;
+ case 4:
+ x86emu_fpu_illegal();
+ break;
+ case 5:
+ x86emu_fpu_M_fld(X86EMU_FPU_LDBL, destoffset);
+ break;
+ case 6:
+ x86emu_fpu_illegal();
+ break;
+ case 7:
+ x86emu_fpu_M_fstp(X86EMU_FPU_LDBL, destoffset);
+ break;
+ }
}
#endif
DECODE_CLEAR_SEGOVR();
@@ -538,80 +538,80 @@ void x86emuOp_esc_coprocess_dc(u8 X86EMU_UNUSED(op1))
DECODE_PRINTINSTR32(x86emu_fpu_op_dc_tab, mod, rh, rl);
switch (mod) {
case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- break;
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ break;
case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- break;
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ break;
case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- break;
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ break;
case 3: /* register to register */
stkelem = (u8)rl;
- DECODE_PRINTF2("\tST(%d),ST\n", stkelem);
- break;
+ DECODE_PRINTF2("\tST(%d),ST\n", stkelem);
+ break;
}
#ifdef X86EMU_FPU_PRESENT
/* execute */
switch (mod) {
case 3:
- switch (rh) {
- case 0:
- x86emu_fpu_R_fadd(stkelem, X86EMU_FPU_STKTOP);
- break;
- case 1:
- x86emu_fpu_R_fmul(stkelem, X86EMU_FPU_STKTOP);
- break;
- case 2:
- x86emu_fpu_R_fcom(stkelem, X86EMU_FPU_STKTOP);
- break;
- case 3:
- x86emu_fpu_R_fcomp(stkelem, X86EMU_FPU_STKTOP);
- break;
- case 4:
- x86emu_fpu_R_fsubr(stkelem, X86EMU_FPU_STKTOP);
- break;
- case 5:
- x86emu_fpu_R_fsub(stkelem, X86EMU_FPU_STKTOP);
- break;
- case 6:
- x86emu_fpu_R_fdivr(stkelem, X86EMU_FPU_STKTOP);
- break;
- case 7:
- x86emu_fpu_R_fdiv(stkelem, X86EMU_FPU_STKTOP);
- break;
- }
- break;
+ switch (rh) {
+ case 0:
+ x86emu_fpu_R_fadd(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ case 1:
+ x86emu_fpu_R_fmul(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ case 2:
+ x86emu_fpu_R_fcom(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ case 3:
+ x86emu_fpu_R_fcomp(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ case 4:
+ x86emu_fpu_R_fsubr(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ case 5:
+ x86emu_fpu_R_fsub(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ case 6:
+ x86emu_fpu_R_fdivr(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ case 7:
+ x86emu_fpu_R_fdiv(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ }
+ break;
default:
- switch (rh) {
- case 0:
- x86emu_fpu_M_fadd(X86EMU_FPU_DOUBLE, destoffset);
- break;
- case 1:
- x86emu_fpu_M_fmul(X86EMU_FPU_DOUBLE, destoffset);
- break;
- case 2:
- x86emu_fpu_M_fcom(X86EMU_FPU_DOUBLE, destoffset);
- break;
- case 3:
- x86emu_fpu_M_fcomp(X86EMU_FPU_DOUBLE, destoffset);
- break;
- case 4:
- x86emu_fpu_M_fsub(X86EMU_FPU_DOUBLE, destoffset);
- break;
- case 5:
- x86emu_fpu_M_fsubr(X86EMU_FPU_DOUBLE, destoffset);
- break;
- case 6:
- x86emu_fpu_M_fdiv(X86EMU_FPU_DOUBLE, destoffset);
- break;
- case 7:
- x86emu_fpu_M_fdivr(X86EMU_FPU_DOUBLE, destoffset);
- break;
- }
+ switch (rh) {
+ case 0:
+ x86emu_fpu_M_fadd(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+ case 1:
+ x86emu_fpu_M_fmul(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+ case 2:
+ x86emu_fpu_M_fcom(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+ case 3:
+ x86emu_fpu_M_fcomp(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+ case 4:
+ x86emu_fpu_M_fsub(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+ case 5:
+ x86emu_fpu_M_fsubr(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+ case 6:
+ x86emu_fpu_M_fdiv(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+ case 7:
+ x86emu_fpu_M_fdivr(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+ }
}
#endif
DECODE_CLEAR_SEGOVR();
@@ -648,70 +648,70 @@ void x86emuOp_esc_coprocess_dd(u8 X86EMU_UNUSED(op1))
DECODE_PRINTINSTR32(x86emu_fpu_op_dd_tab, mod, rh, rl);
switch (mod) {
case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- break;
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ break;
case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- break;
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ break;
case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- break;
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ break;
case 3: /* register to register */
stkelem = (u8)rl;
- DECODE_PRINTF2("\tST(%d),ST\n", stkelem);
- break;
+ DECODE_PRINTF2("\tST(%d),ST\n", stkelem);
+ break;
}
#ifdef X86EMU_FPU_PRESENT
switch (mod) {
case 3:
- switch (rh) {
- case 0:
- x86emu_fpu_R_ffree(stkelem);
- break;
- case 1:
- x86emu_fpu_R_fxch(stkelem);
- break;
- case 2:
- x86emu_fpu_R_fst(stkelem); /* register version */
- break;
- case 3:
- x86emu_fpu_R_fstp(stkelem); /* register version */
- break;
- default:
- x86emu_fpu_illegal();
- break;
- }
- break;
+ switch (rh) {
+ case 0:
+ x86emu_fpu_R_ffree(stkelem);
+ break;
+ case 1:
+ x86emu_fpu_R_fxch(stkelem);
+ break;
+ case 2:
+ x86emu_fpu_R_fst(stkelem); /* register version */
+ break;
+ case 3:
+ x86emu_fpu_R_fstp(stkelem); /* register version */
+ break;
+ default:
+ x86emu_fpu_illegal();
+ break;
+ }
+ break;
default:
- switch (rh) {
- case 0:
- x86emu_fpu_M_fld(X86EMU_FPU_DOUBLE, destoffset);
- break;
- case 1:
- x86emu_fpu_illegal();
- break;
- case 2:
- x86emu_fpu_M_fst(X86EMU_FPU_DOUBLE, destoffset);
- break;
- case 3:
- x86emu_fpu_M_fstp(X86EMU_FPU_DOUBLE, destoffset);
- break;
- case 4:
- x86emu_fpu_M_frstor(X86EMU_FPU_WORD, destoffset);
- break;
- case 5:
- x86emu_fpu_illegal();
- break;
- case 6:
- x86emu_fpu_M_fsave(X86EMU_FPU_WORD, destoffset);
- break;
- case 7:
- x86emu_fpu_M_fstsw(X86EMU_FPU_WORD, destoffset);
- break;
- }
+ switch (rh) {
+ case 0:
+ x86emu_fpu_M_fld(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+ case 1:
+ x86emu_fpu_illegal();
+ break;
+ case 2:
+ x86emu_fpu_M_fst(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+ case 3:
+ x86emu_fpu_M_fstp(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+ case 4:
+ x86emu_fpu_M_frstor(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 5:
+ x86emu_fpu_illegal();
+ break;
+ case 6:
+ x86emu_fpu_M_fsave(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 7:
+ x86emu_fpu_M_fstsw(X86EMU_FPU_WORD, destoffset);
+ break;
+ }
}
#endif
DECODE_CLEAR_SEGOVR();
@@ -755,82 +755,82 @@ void x86emuOp_esc_coprocess_de(u8 X86EMU_UNUSED(op1))
DECODE_PRINTINSTR32(x86emu_fpu_op_de_tab, mod, rh, rl);
switch (mod) {
case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- break;
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ break;
case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- break;
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ break;
case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- break;
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ break;
case 3: /* register to register */
stkelem = (u8)rl;
- DECODE_PRINTF2("\tST(%d),ST\n", stkelem);
- break;
+ DECODE_PRINTF2("\tST(%d),ST\n", stkelem);
+ break;
}
#ifdef X86EMU_FPU_PRESENT
switch (mod) {
case 3:
- switch (rh) {
- case 0:
- x86emu_fpu_R_faddp(stkelem, X86EMU_FPU_STKTOP);
- break;
- case 1:
- x86emu_fpu_R_fmulp(stkelem, X86EMU_FPU_STKTOP);
- break;
- case 2:
- x86emu_fpu_R_fcomp(stkelem, X86EMU_FPU_STKTOP);
- break;
- case 3:
- if (stkelem == 1)
- x86emu_fpu_R_fcompp(stkelem, X86EMU_FPU_STKTOP);
- else
- x86emu_fpu_illegal();
- break;
- case 4:
- x86emu_fpu_R_fsubrp(stkelem, X86EMU_FPU_STKTOP);
- break;
- case 5:
- x86emu_fpu_R_fsubp(stkelem, X86EMU_FPU_STKTOP);
- break;
- case 6:
- x86emu_fpu_R_fdivrp(stkelem, X86EMU_FPU_STKTOP);
- break;
- case 7:
- x86emu_fpu_R_fdivp(stkelem, X86EMU_FPU_STKTOP);
- break;
- }
- break;
+ switch (rh) {
+ case 0:
+ x86emu_fpu_R_faddp(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ case 1:
+ x86emu_fpu_R_fmulp(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ case 2:
+ x86emu_fpu_R_fcomp(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ case 3:
+ if (stkelem == 1)
+ x86emu_fpu_R_fcompp(stkelem, X86EMU_FPU_STKTOP);
+ else
+ x86emu_fpu_illegal();
+ break;
+ case 4:
+ x86emu_fpu_R_fsubrp(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ case 5:
+ x86emu_fpu_R_fsubp(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ case 6:
+ x86emu_fpu_R_fdivrp(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ case 7:
+ x86emu_fpu_R_fdivp(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ }
+ break;
default:
- switch (rh) {
- case 0:
- x86emu_fpu_M_fiadd(X86EMU_FPU_WORD, destoffset);
- break;
- case 1:
- x86emu_fpu_M_fimul(X86EMU_FPU_WORD, destoffset);
- break;
- case 2:
- x86emu_fpu_M_ficom(X86EMU_FPU_WORD, destoffset);
- break;
- case 3:
- x86emu_fpu_M_ficomp(X86EMU_FPU_WORD, destoffset);
- break;
- case 4:
- x86emu_fpu_M_fisub(X86EMU_FPU_WORD, destoffset);
- break;
- case 5:
- x86emu_fpu_M_fisubr(X86EMU_FPU_WORD, destoffset);
- break;
- case 6:
- x86emu_fpu_M_fidiv(X86EMU_FPU_WORD, destoffset);
- break;
- case 7:
- x86emu_fpu_M_fidivr(X86EMU_FPU_WORD, destoffset);
- break;
- }
+ switch (rh) {
+ case 0:
+ x86emu_fpu_M_fiadd(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 1:
+ x86emu_fpu_M_fimul(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 2:
+ x86emu_fpu_M_ficom(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 3:
+ x86emu_fpu_M_ficomp(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 4:
+ x86emu_fpu_M_fisub(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 5:
+ x86emu_fpu_M_fisubr(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 6:
+ x86emu_fpu_M_fidiv(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 7:
+ x86emu_fpu_M_fidivr(X86EMU_FPU_WORD, destoffset);
+ break;
+ }
}
#endif
DECODE_CLEAR_SEGOVR();
@@ -874,70 +874,70 @@ void x86emuOp_esc_coprocess_df(u8 X86EMU_UNUSED(op1))
DECODE_PRINTINSTR32(x86emu_fpu_op_df_tab, mod, rh, rl);
switch (mod) {
case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- break;
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ break;
case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- break;
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ break;
case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- break;
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ break;
case 3: /* register to register */
stkelem = (u8)rl;
- DECODE_PRINTF2("\tST(%d)\n", stkelem);
- break;
+ DECODE_PRINTF2("\tST(%d)\n", stkelem);
+ break;
}
#ifdef X86EMU_FPU_PRESENT
switch (mod) {
case 3:
- switch (rh) {
- case 0:
- x86emu_fpu_R_ffree(stkelem);
- break;
- case 1:
- x86emu_fpu_R_fxch(stkelem);
- break;
- case 2:
- x86emu_fpu_R_fst(stkelem); /* register version */
- break;
- case 3:
- x86emu_fpu_R_fstp(stkelem); /* register version */
- break;
- default:
- x86emu_fpu_illegal();
- break;
- }
- break;
+ switch (rh) {
+ case 0:
+ x86emu_fpu_R_ffree(stkelem);
+ break;
+ case 1:
+ x86emu_fpu_R_fxch(stkelem);
+ break;
+ case 2:
+ x86emu_fpu_R_fst(stkelem); /* register version */
+ break;
+ case 3:
+ x86emu_fpu_R_fstp(stkelem); /* register version */
+ break;
+ default:
+ x86emu_fpu_illegal();
+ break;
+ }
+ break;
default:
- switch (rh) {
- case 0:
- x86emu_fpu_M_fild(X86EMU_FPU_WORD, destoffset);
- break;
- case 1:
- x86emu_fpu_illegal();
- break;
- case 2:
- x86emu_fpu_M_fist(X86EMU_FPU_WORD, destoffset);
- break;
- case 3:
- x86emu_fpu_M_fistp(X86EMU_FPU_WORD, destoffset);
- break;
- case 4:
- x86emu_fpu_M_fbld(X86EMU_FPU_BSD, destoffset);
- break;
- case 5:
- x86emu_fpu_M_fild(X86EMU_FPU_LONG, destoffset);
- break;
- case 6:
- x86emu_fpu_M_fbstp(X86EMU_FPU_BSD, destoffset);
- break;
- case 7:
- x86emu_fpu_M_fistp(X86EMU_FPU_LONG, destoffset);
- break;
- }
+ switch (rh) {
+ case 0:
+ x86emu_fpu_M_fild(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 1:
+ x86emu_fpu_illegal();
+ break;
+ case 2:
+ x86emu_fpu_M_fist(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 3:
+ x86emu_fpu_M_fistp(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 4:
+ x86emu_fpu_M_fbld(X86EMU_FPU_BSD, destoffset);
+ break;
+ case 5:
+ x86emu_fpu_M_fild(X86EMU_FPU_LONG, destoffset);
+ break;
+ case 6:
+ x86emu_fpu_M_fbstp(X86EMU_FPU_BSD, destoffset);
+ break;
+ case 7:
+ x86emu_fpu_M_fistp(X86EMU_FPU_LONG, destoffset);
+ break;
+ }
}
#endif
DECODE_CLEAR_SEGOVR();
diff --git a/board/MAI/bios_emulator/scitech/src/x86emu/ops.c b/board/MAI/bios_emulator/scitech/src/x86emu/ops.c
index 0d797766b0..2d4f93eee4 100644
--- a/board/MAI/bios_emulator/scitech/src/x86emu/ops.c
+++ b/board/MAI/bios_emulator/scitech/src/x86emu/ops.c
@@ -88,7 +88,7 @@ void x86emuOp_illegal_op(
DECODE_PRINTF("ILLEGAL X86 OPCODE\n");
TRACE_REGS();
printk("%04x:%04x: %02X ILLEGAL X86 OPCODE!\n",
- M.x86.R_CS, M.x86.R_IP-1,op1);
+ M.x86.R_CS, M.x86.R_IP-1,op1);
HALT_SYS();
END_OF_INSTR();
}
@@ -109,43 +109,43 @@ void x86emuOp_add_byte_RM_R(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = add_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = add_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = add_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_byte(*destreg, *srcreg);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_byte(*destreg, *srcreg);
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -165,107 +165,107 @@ void x86emuOp_add_word_RM_R(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = add_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = add_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = add_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = add_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = add_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = add_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_word(*destreg, *srcreg);
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_word(*destreg, *srcreg);
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -287,40 +287,40 @@ void x86emuOp_add_byte_R_RM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_byte(*destreg, srcval);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_byte(*destreg, srcval);
+ break;
case 1:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_byte(*destreg, srcval);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_byte(*destreg, srcval);
+ break;
case 2:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_byte(*destreg, srcval);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_byte(*destreg, srcval);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_byte(*destreg, *srcreg);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_byte(*destreg, *srcreg);
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -340,101 +340,101 @@ void x86emuOp_add_word_R_RM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_word(*destreg, srcval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_word(*destreg, srcval);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_word(*destreg, srcval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_word(*destreg, srcval);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_word(*destreg, srcval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_word(*destreg, srcval);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_word(*destreg, *srcreg);
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_word(*destreg, *srcreg);
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -468,18 +468,18 @@ void x86emuOp_add_word_AX_IMM(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("ADD\tEAX,");
- srcval = fetch_long_imm();
+ DECODE_PRINTF("ADD\tEAX,");
+ srcval = fetch_long_imm();
} else {
- DECODE_PRINTF("ADD\tAX,");
- srcval = fetch_word_imm();
+ DECODE_PRINTF("ADD\tAX,");
+ srcval = fetch_word_imm();
}
DECODE_PRINTF2("%x\n", srcval);
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = add_long(M.x86.R_EAX, srcval);
+ M.x86.R_EAX = add_long(M.x86.R_EAX, srcval);
} else {
- M.x86.R_AX = add_word(M.x86.R_AX, (u16)srcval);
+ M.x86.R_AX = add_word(M.x86.R_AX, (u16)srcval);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -529,43 +529,43 @@ void x86emuOp_or_byte_RM_R(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = or_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = or_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = or_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_byte(*destreg, *srcreg);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_byte(*destreg, *srcreg);
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -585,107 +585,107 @@ void x86emuOp_or_word_RM_R(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = or_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = or_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = or_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = or_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = or_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = or_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_word(*destreg, *srcreg);
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_word(*destreg, *srcreg);
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -707,40 +707,40 @@ void x86emuOp_or_byte_R_RM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_byte(*destreg, srcval);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_byte(*destreg, srcval);
+ break;
case 1:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_byte(*destreg, srcval);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_byte(*destreg, srcval);
+ break;
case 2:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_byte(*destreg, srcval);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_byte(*destreg, srcval);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_byte(*destreg, *srcreg);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_byte(*destreg, *srcreg);
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -760,101 +760,101 @@ void x86emuOp_or_word_R_RM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_word(*destreg, srcval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_word(*destreg, srcval);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_word(*destreg, srcval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_word(*destreg, srcval);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_word(*destreg, srcval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_word(*destreg, srcval);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_word(*destreg, *srcreg);
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_word(*destreg, *srcreg);
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -888,18 +888,18 @@ void x86emuOp_or_word_AX_IMM(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("OR\tEAX,");
- srcval = fetch_long_imm();
+ DECODE_PRINTF("OR\tEAX,");
+ srcval = fetch_long_imm();
} else {
- DECODE_PRINTF("OR\tAX,");
- srcval = fetch_word_imm();
+ DECODE_PRINTF("OR\tAX,");
+ srcval = fetch_word_imm();
}
DECODE_PRINTF2("%x\n", srcval);
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = or_long(M.x86.R_EAX, srcval);
+ M.x86.R_EAX = or_long(M.x86.R_EAX, srcval);
} else {
- M.x86.R_AX = or_word(M.x86.R_AX, (u16)srcval);
+ M.x86.R_AX = or_word(M.x86.R_AX, (u16)srcval);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -946,43 +946,43 @@ void x86emuOp_adc_byte_RM_R(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = adc_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = adc_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = adc_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_byte(*destreg, *srcreg);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_byte(*destreg, *srcreg);
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -1002,107 +1002,107 @@ void x86emuOp_adc_word_RM_R(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = adc_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = adc_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = adc_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = adc_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = adc_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = adc_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_word(*destreg, *srcreg);
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_word(*destreg, *srcreg);
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -1124,40 +1124,40 @@ void x86emuOp_adc_byte_R_RM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_byte(*destreg, srcval);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_byte(*destreg, srcval);
+ break;
case 1:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_byte(*destreg, srcval);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_byte(*destreg, srcval);
+ break;
case 2:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_byte(*destreg, srcval);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_byte(*destreg, srcval);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_byte(*destreg, *srcreg);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_byte(*destreg, *srcreg);
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -1177,101 +1177,101 @@ void x86emuOp_adc_word_R_RM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_word(*destreg, srcval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_word(*destreg, srcval);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_word(*destreg, srcval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_word(*destreg, srcval);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_word(*destreg, srcval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_word(*destreg, srcval);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_word(*destreg, *srcreg);
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_word(*destreg, *srcreg);
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -1305,18 +1305,18 @@ void x86emuOp_adc_word_AX_IMM(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("ADC\tEAX,");
- srcval = fetch_long_imm();
+ DECODE_PRINTF("ADC\tEAX,");
+ srcval = fetch_long_imm();
} else {
- DECODE_PRINTF("ADC\tAX,");
- srcval = fetch_word_imm();
+ DECODE_PRINTF("ADC\tAX,");
+ srcval = fetch_word_imm();
}
DECODE_PRINTF2("%x\n", srcval);
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = adc_long(M.x86.R_EAX, srcval);
+ M.x86.R_EAX = adc_long(M.x86.R_EAX, srcval);
} else {
- M.x86.R_AX = adc_word(M.x86.R_AX, (u16)srcval);
+ M.x86.R_AX = adc_word(M.x86.R_AX, (u16)srcval);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -1366,43 +1366,43 @@ void x86emuOp_sbb_byte_RM_R(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sbb_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sbb_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sbb_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_byte(*destreg, *srcreg);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_byte(*destreg, *srcreg);
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -1422,107 +1422,107 @@ void x86emuOp_sbb_word_RM_R(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sbb_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sbb_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sbb_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sbb_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sbb_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sbb_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_word(*destreg, *srcreg);
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_word(*destreg, *srcreg);
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -1544,40 +1544,40 @@ void x86emuOp_sbb_byte_R_RM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_byte(*destreg, srcval);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_byte(*destreg, srcval);
+ break;
case 1:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_byte(*destreg, srcval);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_byte(*destreg, srcval);
+ break;
case 2:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_byte(*destreg, srcval);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_byte(*destreg, srcval);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_byte(*destreg, *srcreg);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_byte(*destreg, *srcreg);
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -1597,101 +1597,101 @@ void x86emuOp_sbb_word_R_RM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_word(*destreg, srcval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_word(*destreg, srcval);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_word(*destreg, srcval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_word(*destreg, srcval);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_word(*destreg, srcval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_word(*destreg, srcval);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_word(*destreg, *srcreg);
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_word(*destreg, *srcreg);
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -1725,18 +1725,18 @@ void x86emuOp_sbb_word_AX_IMM(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("SBB\tEAX,");
- srcval = fetch_long_imm();
+ DECODE_PRINTF("SBB\tEAX,");
+ srcval = fetch_long_imm();
} else {
- DECODE_PRINTF("SBB\tAX,");
- srcval = fetch_word_imm();
+ DECODE_PRINTF("SBB\tAX,");
+ srcval = fetch_word_imm();
}
DECODE_PRINTF2("%x\n", srcval);
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = sbb_long(M.x86.R_EAX, srcval);
+ M.x86.R_EAX = sbb_long(M.x86.R_EAX, srcval);
} else {
- M.x86.R_AX = sbb_word(M.x86.R_AX, (u16)srcval);
+ M.x86.R_AX = sbb_word(M.x86.R_AX, (u16)srcval);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -1787,46 +1787,46 @@ void x86emuOp_and_byte_RM_R(u8 X86EMU_UNUSED(op1))
switch (mod) {
case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = and_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = and_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = and_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_byte(*destreg, *srcreg);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_byte(*destreg, *srcreg);
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -1846,107 +1846,107 @@ void x86emuOp_and_word_RM_R(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = and_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = and_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = and_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = and_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = and_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = and_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_word(*destreg, *srcreg);
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_word(*destreg, *srcreg);
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -1968,40 +1968,40 @@ void x86emuOp_and_byte_R_RM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_byte(*destreg, srcval);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_byte(*destreg, srcval);
+ break;
case 1:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_byte(*destreg, srcval);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_byte(*destreg, srcval);
+ break;
case 2:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_byte(*destreg, srcval);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_byte(*destreg, srcval);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_byte(*destreg, *srcreg);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_byte(*destreg, *srcreg);
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -2021,102 +2021,102 @@ void x86emuOp_and_word_R_RM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_word(*destreg, srcval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_word(*destreg, srcval);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_long(*destreg, srcval);
- break;
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_word(*destreg, srcval);
- break;
- }
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_long(*destreg, srcval);
+ break;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_word(*destreg, srcval);
+ break;
+ }
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_word(*destreg, srcval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_word(*destreg, srcval);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_word(*destreg, *srcreg);
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_word(*destreg, *srcreg);
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -2150,18 +2150,18 @@ void x86emuOp_and_word_AX_IMM(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("AND\tEAX,");
- srcval = fetch_long_imm();
+ DECODE_PRINTF("AND\tEAX,");
+ srcval = fetch_long_imm();
} else {
- DECODE_PRINTF("AND\tAX,");
- srcval = fetch_word_imm();
+ DECODE_PRINTF("AND\tAX,");
+ srcval = fetch_word_imm();
}
DECODE_PRINTF2("%x\n", srcval);
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = and_long(M.x86.R_EAX, srcval);
+ M.x86.R_EAX = and_long(M.x86.R_EAX, srcval);
} else {
- M.x86.R_AX = and_word(M.x86.R_AX, (u16)srcval);
+ M.x86.R_AX = and_word(M.x86.R_AX, (u16)srcval);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -2214,43 +2214,43 @@ void x86emuOp_sub_byte_RM_R(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sub_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sub_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sub_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_byte(*destreg, *srcreg);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_byte(*destreg, *srcreg);
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -2270,107 +2270,107 @@ void x86emuOp_sub_word_RM_R(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sub_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sub_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sub_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sub_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sub_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sub_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_word(*destreg, *srcreg);
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_word(*destreg, *srcreg);
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -2392,40 +2392,40 @@ void x86emuOp_sub_byte_R_RM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_byte(*destreg, srcval);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_byte(*destreg, srcval);
+ break;
case 1:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_byte(*destreg, srcval);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_byte(*destreg, srcval);
+ break;
case 2:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_byte(*destreg, srcval);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_byte(*destreg, srcval);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_byte(*destreg, *srcreg);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_byte(*destreg, *srcreg);
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -2445,101 +2445,101 @@ void x86emuOp_sub_word_R_RM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_word(*destreg, srcval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_word(*destreg, srcval);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_word(*destreg, srcval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_word(*destreg, srcval);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_word(*destreg, srcval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_word(*destreg, srcval);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_word(*destreg, *srcreg);
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_word(*destreg, *srcreg);
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -2573,18 +2573,18 @@ void x86emuOp_sub_word_AX_IMM(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("SUB\tEAX,");
- srcval = fetch_long_imm();
+ DECODE_PRINTF("SUB\tEAX,");
+ srcval = fetch_long_imm();
} else {
- DECODE_PRINTF("SUB\tAX,");
- srcval = fetch_word_imm();
+ DECODE_PRINTF("SUB\tAX,");
+ srcval = fetch_word_imm();
}
DECODE_PRINTF2("%x\n", srcval);
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = sub_long(M.x86.R_EAX, srcval);
+ M.x86.R_EAX = sub_long(M.x86.R_EAX, srcval);
} else {
- M.x86.R_AX = sub_word(M.x86.R_AX, (u16)srcval);
+ M.x86.R_AX = sub_word(M.x86.R_AX, (u16)srcval);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -2634,43 +2634,43 @@ void x86emuOp_xor_byte_RM_R(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = xor_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = xor_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = xor_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_byte(*destreg, *srcreg);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_byte(*destreg, *srcreg);
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -2690,107 +2690,107 @@ void x86emuOp_xor_word_RM_R(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = xor_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = xor_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = xor_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = xor_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = xor_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = xor_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_word(*destreg, *srcreg);
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_word(*destreg, *srcreg);
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -2812,40 +2812,40 @@ void x86emuOp_xor_byte_R_RM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_byte(*destreg, srcval);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_byte(*destreg, srcval);
+ break;
case 1:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_byte(*destreg, srcval);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_byte(*destreg, srcval);
+ break;
case 2:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_byte(*destreg, srcval);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_byte(*destreg, srcval);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_byte(*destreg, *srcreg);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_byte(*destreg, *srcreg);
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -2865,101 +2865,101 @@ void x86emuOp_xor_word_R_RM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_word(*destreg, srcval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_word(*destreg, srcval);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_word(*destreg, srcval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_word(*destreg, srcval);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_word(*destreg, srcval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_word(*destreg, srcval);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_word(*destreg, *srcreg);
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_word(*destreg, *srcreg);
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -2993,18 +2993,18 @@ void x86emuOp_xor_word_AX_IMM(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("XOR\tEAX,");
- srcval = fetch_long_imm();
+ DECODE_PRINTF("XOR\tEAX,");
+ srcval = fetch_long_imm();
} else {
- DECODE_PRINTF("XOR\tAX,");
- srcval = fetch_word_imm();
+ DECODE_PRINTF("XOR\tAX,");
+ srcval = fetch_word_imm();
}
DECODE_PRINTF2("%x\n", srcval);
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = xor_long(M.x86.R_EAX, srcval);
+ M.x86.R_EAX = xor_long(M.x86.R_EAX, srcval);
} else {
- M.x86.R_AX = xor_word(M.x86.R_AX, (u16)srcval);
+ M.x86.R_AX = xor_word(M.x86.R_AX, (u16)srcval);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3054,40 +3054,40 @@ void x86emuOp_cmp_byte_RM_R(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_byte(destval, *srcreg);
- break;
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_byte(destval, *srcreg);
+ break;
case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_byte(destval, *srcreg);
- break;
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_byte(destval, *srcreg);
+ break;
case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_byte(destval, *srcreg);
- break;
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_byte(destval, *srcreg);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_byte(*destreg, *srcreg);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_byte(*destreg, *srcreg);
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3107,101 +3107,101 @@ void x86emuOp_cmp_word_RM_R(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_long(destval, *srcreg);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_word(destval, *srcreg);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(destval, *srcreg);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_word(destval, *srcreg);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_long(destval, *srcreg);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_word(destval, *srcreg);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(destval, *srcreg);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_word(destval, *srcreg);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_long(destval, *srcreg);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_word(destval, *srcreg);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(destval, *srcreg);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_word(destval, *srcreg);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_word(*destreg, *srcreg);
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_word(*destreg, *srcreg);
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3223,40 +3223,40 @@ void x86emuOp_cmp_byte_R_RM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_byte(*destreg, srcval);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_byte(*destreg, srcval);
+ break;
case 1:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_byte(*destreg, srcval);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_byte(*destreg, srcval);
+ break;
case 2:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_byte(*destreg, srcval);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_byte(*destreg, srcval);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_byte(*destreg, *srcreg);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_byte(*destreg, *srcreg);
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3276,101 +3276,101 @@ void x86emuOp_cmp_word_R_RM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_word(*destreg, srcval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_word(*destreg, srcval);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_word(*destreg, srcval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_word(*destreg, srcval);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_word(*destreg, srcval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_word(*destreg, srcval);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_word(*destreg, *srcreg);
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_word(*destreg, *srcreg);
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3404,18 +3404,18 @@ void x86emuOp_cmp_word_AX_IMM(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("CMP\tEAX,");
- srcval = fetch_long_imm();
+ DECODE_PRINTF("CMP\tEAX,");
+ srcval = fetch_long_imm();
} else {
- DECODE_PRINTF("CMP\tAX,");
- srcval = fetch_word_imm();
+ DECODE_PRINTF("CMP\tAX,");
+ srcval = fetch_word_imm();
}
DECODE_PRINTF2("%x\n", srcval);
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- cmp_long(M.x86.R_EAX, srcval);
+ cmp_long(M.x86.R_EAX, srcval);
} else {
- cmp_word(M.x86.R_AX, (u16)srcval);
+ cmp_word(M.x86.R_AX, (u16)srcval);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3457,15 +3457,15 @@ void x86emuOp_inc_AX(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("INC\tEAX\n");
+ DECODE_PRINTF("INC\tEAX\n");
} else {
- DECODE_PRINTF("INC\tAX\n");
+ DECODE_PRINTF("INC\tAX\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = inc_long(M.x86.R_EAX);
+ M.x86.R_EAX = inc_long(M.x86.R_EAX);
} else {
- M.x86.R_AX = inc_word(M.x86.R_AX);
+ M.x86.R_AX = inc_word(M.x86.R_AX);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3479,15 +3479,15 @@ void x86emuOp_inc_CX(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("INC\tECX\n");
+ DECODE_PRINTF("INC\tECX\n");
} else {
- DECODE_PRINTF("INC\tCX\n");
+ DECODE_PRINTF("INC\tCX\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_ECX = inc_long(M.x86.R_ECX);
+ M.x86.R_ECX = inc_long(M.x86.R_ECX);
} else {
- M.x86.R_CX = inc_word(M.x86.R_CX);
+ M.x86.R_CX = inc_word(M.x86.R_CX);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3501,15 +3501,15 @@ void x86emuOp_inc_DX(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("INC\tEDX\n");
+ DECODE_PRINTF("INC\tEDX\n");
} else {
- DECODE_PRINTF("INC\tDX\n");
+ DECODE_PRINTF("INC\tDX\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EDX = inc_long(M.x86.R_EDX);
+ M.x86.R_EDX = inc_long(M.x86.R_EDX);
} else {
- M.x86.R_DX = inc_word(M.x86.R_DX);
+ M.x86.R_DX = inc_word(M.x86.R_DX);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3523,15 +3523,15 @@ void x86emuOp_inc_BX(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("INC\tEBX\n");
+ DECODE_PRINTF("INC\tEBX\n");
} else {
- DECODE_PRINTF("INC\tBX\n");
+ DECODE_PRINTF("INC\tBX\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EBX = inc_long(M.x86.R_EBX);
+ M.x86.R_EBX = inc_long(M.x86.R_EBX);
} else {
- M.x86.R_BX = inc_word(M.x86.R_BX);
+ M.x86.R_BX = inc_word(M.x86.R_BX);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3545,15 +3545,15 @@ void x86emuOp_inc_SP(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("INC\tESP\n");
+ DECODE_PRINTF("INC\tESP\n");
} else {
- DECODE_PRINTF("INC\tSP\n");
+ DECODE_PRINTF("INC\tSP\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_ESP = inc_long(M.x86.R_ESP);
+ M.x86.R_ESP = inc_long(M.x86.R_ESP);
} else {
- M.x86.R_SP = inc_word(M.x86.R_SP);
+ M.x86.R_SP = inc_word(M.x86.R_SP);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3567,15 +3567,15 @@ void x86emuOp_inc_BP(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("INC\tEBP\n");
+ DECODE_PRINTF("INC\tEBP\n");
} else {
- DECODE_PRINTF("INC\tBP\n");
+ DECODE_PRINTF("INC\tBP\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EBP = inc_long(M.x86.R_EBP);
+ M.x86.R_EBP = inc_long(M.x86.R_EBP);
} else {
- M.x86.R_BP = inc_word(M.x86.R_BP);
+ M.x86.R_BP = inc_word(M.x86.R_BP);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3589,15 +3589,15 @@ void x86emuOp_inc_SI(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("INC\tESI\n");
+ DECODE_PRINTF("INC\tESI\n");
} else {
- DECODE_PRINTF("INC\tSI\n");
+ DECODE_PRINTF("INC\tSI\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_ESI = inc_long(M.x86.R_ESI);
+ M.x86.R_ESI = inc_long(M.x86.R_ESI);
} else {
- M.x86.R_SI = inc_word(M.x86.R_SI);
+ M.x86.R_SI = inc_word(M.x86.R_SI);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3611,15 +3611,15 @@ void x86emuOp_inc_DI(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("INC\tEDI\n");
+ DECODE_PRINTF("INC\tEDI\n");
} else {
- DECODE_PRINTF("INC\tDI\n");
+ DECODE_PRINTF("INC\tDI\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EDI = inc_long(M.x86.R_EDI);
+ M.x86.R_EDI = inc_long(M.x86.R_EDI);
} else {
- M.x86.R_DI = inc_word(M.x86.R_DI);
+ M.x86.R_DI = inc_word(M.x86.R_DI);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3633,15 +3633,15 @@ void x86emuOp_dec_AX(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("DEC\tEAX\n");
+ DECODE_PRINTF("DEC\tEAX\n");
} else {
- DECODE_PRINTF("DEC\tAX\n");
+ DECODE_PRINTF("DEC\tAX\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = dec_long(M.x86.R_EAX);
+ M.x86.R_EAX = dec_long(M.x86.R_EAX);
} else {
- M.x86.R_AX = dec_word(M.x86.R_AX);
+ M.x86.R_AX = dec_word(M.x86.R_AX);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3655,15 +3655,15 @@ void x86emuOp_dec_CX(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("DEC\tECX\n");
+ DECODE_PRINTF("DEC\tECX\n");
} else {
- DECODE_PRINTF("DEC\tCX\n");
+ DECODE_PRINTF("DEC\tCX\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_ECX = dec_long(M.x86.R_ECX);
+ M.x86.R_ECX = dec_long(M.x86.R_ECX);
} else {
- M.x86.R_CX = dec_word(M.x86.R_CX);
+ M.x86.R_CX = dec_word(M.x86.R_CX);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3677,15 +3677,15 @@ void x86emuOp_dec_DX(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("DEC\tEDX\n");
+ DECODE_PRINTF("DEC\tEDX\n");
} else {
- DECODE_PRINTF("DEC\tDX\n");
+ DECODE_PRINTF("DEC\tDX\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EDX = dec_long(M.x86.R_EDX);
+ M.x86.R_EDX = dec_long(M.x86.R_EDX);
} else {
- M.x86.R_DX = dec_word(M.x86.R_DX);
+ M.x86.R_DX = dec_word(M.x86.R_DX);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3699,15 +3699,15 @@ void x86emuOp_dec_BX(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("DEC\tEBX\n");
+ DECODE_PRINTF("DEC\tEBX\n");
} else {
- DECODE_PRINTF("DEC\tBX\n");
+ DECODE_PRINTF("DEC\tBX\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EBX = dec_long(M.x86.R_EBX);
+ M.x86.R_EBX = dec_long(M.x86.R_EBX);
} else {
- M.x86.R_BX = dec_word(M.x86.R_BX);
+ M.x86.R_BX = dec_word(M.x86.R_BX);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3721,15 +3721,15 @@ void x86emuOp_dec_SP(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("DEC\tESP\n");
+ DECODE_PRINTF("DEC\tESP\n");
} else {
- DECODE_PRINTF("DEC\tSP\n");
+ DECODE_PRINTF("DEC\tSP\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_ESP = dec_long(M.x86.R_ESP);
+ M.x86.R_ESP = dec_long(M.x86.R_ESP);
} else {
- M.x86.R_SP = dec_word(M.x86.R_SP);
+ M.x86.R_SP = dec_word(M.x86.R_SP);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3743,15 +3743,15 @@ void x86emuOp_dec_BP(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("DEC\tEBP\n");
+ DECODE_PRINTF("DEC\tEBP\n");
} else {
- DECODE_PRINTF("DEC\tBP\n");
+ DECODE_PRINTF("DEC\tBP\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EBP = dec_long(M.x86.R_EBP);
+ M.x86.R_EBP = dec_long(M.x86.R_EBP);
} else {
- M.x86.R_BP = dec_word(M.x86.R_BP);
+ M.x86.R_BP = dec_word(M.x86.R_BP);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3765,15 +3765,15 @@ void x86emuOp_dec_SI(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("DEC\tESI\n");
+ DECODE_PRINTF("DEC\tESI\n");
} else {
- DECODE_PRINTF("DEC\tSI\n");
+ DECODE_PRINTF("DEC\tSI\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_ESI = dec_long(M.x86.R_ESI);
+ M.x86.R_ESI = dec_long(M.x86.R_ESI);
} else {
- M.x86.R_SI = dec_word(M.x86.R_SI);
+ M.x86.R_SI = dec_word(M.x86.R_SI);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3787,15 +3787,15 @@ void x86emuOp_dec_DI(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("DEC\tEDI\n");
+ DECODE_PRINTF("DEC\tEDI\n");
} else {
- DECODE_PRINTF("DEC\tDI\n");
+ DECODE_PRINTF("DEC\tDI\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EDI = dec_long(M.x86.R_EDI);
+ M.x86.R_EDI = dec_long(M.x86.R_EDI);
} else {
- M.x86.R_DI = dec_word(M.x86.R_DI);
+ M.x86.R_DI = dec_word(M.x86.R_DI);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3809,15 +3809,15 @@ void x86emuOp_push_AX(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("PUSH\tEAX\n");
+ DECODE_PRINTF("PUSH\tEAX\n");
} else {
- DECODE_PRINTF("PUSH\tAX\n");
+ DECODE_PRINTF("PUSH\tAX\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- push_long(M.x86.R_EAX);
+ push_long(M.x86.R_EAX);
} else {
- push_word(M.x86.R_AX);
+ push_word(M.x86.R_AX);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3831,15 +3831,15 @@ void x86emuOp_push_CX(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("PUSH\tECX\n");
+ DECODE_PRINTF("PUSH\tECX\n");
} else {
- DECODE_PRINTF("PUSH\tCX\n");
+ DECODE_PRINTF("PUSH\tCX\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- push_long(M.x86.R_ECX);
+ push_long(M.x86.R_ECX);
} else {
- push_word(M.x86.R_CX);
+ push_word(M.x86.R_CX);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3853,15 +3853,15 @@ void x86emuOp_push_DX(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("PUSH\tEDX\n");
+ DECODE_PRINTF("PUSH\tEDX\n");
} else {
- DECODE_PRINTF("PUSH\tDX\n");
+ DECODE_PRINTF("PUSH\tDX\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- push_long(M.x86.R_EDX);
+ push_long(M.x86.R_EDX);
} else {
- push_word(M.x86.R_DX);
+ push_word(M.x86.R_DX);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3875,15 +3875,15 @@ void x86emuOp_push_BX(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("PUSH\tEBX\n");
+ DECODE_PRINTF("PUSH\tEBX\n");
} else {
- DECODE_PRINTF("PUSH\tBX\n");
+ DECODE_PRINTF("PUSH\tBX\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- push_long(M.x86.R_EBX);
+ push_long(M.x86.R_EBX);
} else {
- push_word(M.x86.R_BX);
+ push_word(M.x86.R_BX);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3897,9 +3897,9 @@ void x86emuOp_push_SP(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("PUSH\tESP\n");
+ DECODE_PRINTF("PUSH\tESP\n");
} else {
- DECODE_PRINTF("PUSH\tSP\n");
+ DECODE_PRINTF("PUSH\tSP\n");
}
TRACE_AND_STEP();
/* Always push (E)SP, since we are emulating an i386 and above
@@ -3923,15 +3923,15 @@ void x86emuOp_push_BP(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("PUSH\tEBP\n");
+ DECODE_PRINTF("PUSH\tEBP\n");
} else {
- DECODE_PRINTF("PUSH\tBP\n");
+ DECODE_PRINTF("PUSH\tBP\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- push_long(M.x86.R_EBP);
+ push_long(M.x86.R_EBP);
} else {
- push_word(M.x86.R_BP);
+ push_word(M.x86.R_BP);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3945,15 +3945,15 @@ void x86emuOp_push_SI(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("PUSH\tESI\n");
+ DECODE_PRINTF("PUSH\tESI\n");
} else {
- DECODE_PRINTF("PUSH\tSI\n");
+ DECODE_PRINTF("PUSH\tSI\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- push_long(M.x86.R_ESI);
+ push_long(M.x86.R_ESI);
} else {
- push_word(M.x86.R_SI);
+ push_word(M.x86.R_SI);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3967,15 +3967,15 @@ void x86emuOp_push_DI(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("PUSH\tEDI\n");
+ DECODE_PRINTF("PUSH\tEDI\n");
} else {
- DECODE_PRINTF("PUSH\tDI\n");
+ DECODE_PRINTF("PUSH\tDI\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- push_long(M.x86.R_EDI);
+ push_long(M.x86.R_EDI);
} else {
- push_word(M.x86.R_DI);
+ push_word(M.x86.R_DI);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -3989,15 +3989,15 @@ void x86emuOp_pop_AX(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("POP\tEAX\n");
+ DECODE_PRINTF("POP\tEAX\n");
} else {
- DECODE_PRINTF("POP\tAX\n");
+ DECODE_PRINTF("POP\tAX\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = pop_long();
+ M.x86.R_EAX = pop_long();
} else {
- M.x86.R_AX = pop_word();
+ M.x86.R_AX = pop_word();
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -4011,15 +4011,15 @@ void x86emuOp_pop_CX(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("POP\tECX\n");
+ DECODE_PRINTF("POP\tECX\n");
} else {
- DECODE_PRINTF("POP\tCX\n");
+ DECODE_PRINTF("POP\tCX\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_ECX = pop_long();
+ M.x86.R_ECX = pop_long();
} else {
- M.x86.R_CX = pop_word();
+ M.x86.R_CX = pop_word();
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -4033,15 +4033,15 @@ void x86emuOp_pop_DX(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("POP\tEDX\n");
+ DECODE_PRINTF("POP\tEDX\n");
} else {
- DECODE_PRINTF("POP\tDX\n");
+ DECODE_PRINTF("POP\tDX\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EDX = pop_long();
+ M.x86.R_EDX = pop_long();
} else {
- M.x86.R_DX = pop_word();
+ M.x86.R_DX = pop_word();
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -4055,15 +4055,15 @@ void x86emuOp_pop_BX(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("POP\tEBX\n");
+ DECODE_PRINTF("POP\tEBX\n");
} else {
- DECODE_PRINTF("POP\tBX\n");
+ DECODE_PRINTF("POP\tBX\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EBX = pop_long();
+ M.x86.R_EBX = pop_long();
} else {
- M.x86.R_BX = pop_word();
+ M.x86.R_BX = pop_word();
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -4077,15 +4077,15 @@ void x86emuOp_pop_SP(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("POP\tESP\n");
+ DECODE_PRINTF("POP\tESP\n");
} else {
- DECODE_PRINTF("POP\tSP\n");
+ DECODE_PRINTF("POP\tSP\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_ESP = pop_long();
+ M.x86.R_ESP = pop_long();
} else {
- M.x86.R_SP = pop_word();
+ M.x86.R_SP = pop_word();
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -4099,15 +4099,15 @@ void x86emuOp_pop_BP(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("POP\tEBP\n");
+ DECODE_PRINTF("POP\tEBP\n");
} else {
- DECODE_PRINTF("POP\tBP\n");
+ DECODE_PRINTF("POP\tBP\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EBP = pop_long();
+ M.x86.R_EBP = pop_long();
} else {
- M.x86.R_BP = pop_word();
+ M.x86.R_BP = pop_word();
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -4121,15 +4121,15 @@ void x86emuOp_pop_SI(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("POP\tESI\n");
+ DECODE_PRINTF("POP\tESI\n");
} else {
- DECODE_PRINTF("POP\tSI\n");
+ DECODE_PRINTF("POP\tSI\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_ESI = pop_long();
+ M.x86.R_ESI = pop_long();
} else {
- M.x86.R_SI = pop_word();
+ M.x86.R_SI = pop_word();
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -4143,15 +4143,15 @@ void x86emuOp_pop_DI(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("POP\tEDI\n");
+ DECODE_PRINTF("POP\tEDI\n");
} else {
- DECODE_PRINTF("POP\tDI\n");
+ DECODE_PRINTF("POP\tDI\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EDI = pop_long();
+ M.x86.R_EDI = pop_long();
} else {
- M.x86.R_DI = pop_word();
+ M.x86.R_DI = pop_word();
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -4165,33 +4165,33 @@ void x86emuOp_push_all(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("PUSHAD\n");
+ DECODE_PRINTF("PUSHAD\n");
} else {
- DECODE_PRINTF("PUSHA\n");
+ DECODE_PRINTF("PUSHA\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 old_sp = M.x86.R_ESP;
+ u32 old_sp = M.x86.R_ESP;
- push_long(M.x86.R_EAX);
- push_long(M.x86.R_ECX);
- push_long(M.x86.R_EDX);
- push_long(M.x86.R_EBX);
- push_long(old_sp);
- push_long(M.x86.R_EBP);
- push_long(M.x86.R_ESI);
- push_long(M.x86.R_EDI);
+ push_long(M.x86.R_EAX);
+ push_long(M.x86.R_ECX);
+ push_long(M.x86.R_EDX);
+ push_long(M.x86.R_EBX);
+ push_long(old_sp);
+ push_long(M.x86.R_EBP);
+ push_long(M.x86.R_ESI);
+ push_long(M.x86.R_EDI);
} else {
- u16 old_sp = M.x86.R_SP;
+ u16 old_sp = M.x86.R_SP;
- push_word(M.x86.R_AX);
- push_word(M.x86.R_CX);
- push_word(M.x86.R_DX);
- push_word(M.x86.R_BX);
- push_word(old_sp);
- push_word(M.x86.R_BP);
- push_word(M.x86.R_SI);
- push_word(M.x86.R_DI);
+ push_word(M.x86.R_AX);
+ push_word(M.x86.R_CX);
+ push_word(M.x86.R_DX);
+ push_word(M.x86.R_BX);
+ push_word(old_sp);
+ push_word(M.x86.R_BP);
+ push_word(M.x86.R_SI);
+ push_word(M.x86.R_DI);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -4205,29 +4205,29 @@ void x86emuOp_pop_all(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("POPAD\n");
+ DECODE_PRINTF("POPAD\n");
} else {
- DECODE_PRINTF("POPA\n");
+ DECODE_PRINTF("POPA\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EDI = pop_long();
- M.x86.R_ESI = pop_long();
- M.x86.R_EBP = pop_long();
- M.x86.R_ESP += 4; /* skip ESP */
- M.x86.R_EBX = pop_long();
- M.x86.R_EDX = pop_long();
- M.x86.R_ECX = pop_long();
- M.x86.R_EAX = pop_long();
+ M.x86.R_EDI = pop_long();
+ M.x86.R_ESI = pop_long();
+ M.x86.R_EBP = pop_long();
+ M.x86.R_ESP += 4; /* skip ESP */
+ M.x86.R_EBX = pop_long();
+ M.x86.R_EDX = pop_long();
+ M.x86.R_ECX = pop_long();
+ M.x86.R_EAX = pop_long();
} else {
- M.x86.R_DI = pop_word();
- M.x86.R_SI = pop_word();
- M.x86.R_BP = pop_word();
- M.x86.R_SP += 2; /* skip SP */
- M.x86.R_BX = pop_word();
- M.x86.R_DX = pop_word();
- M.x86.R_CX = pop_word();
- M.x86.R_AX = pop_word();
+ M.x86.R_DI = pop_word();
+ M.x86.R_SI = pop_word();
+ M.x86.R_BP = pop_word();
+ M.x86.R_SP += 2; /* skip SP */
+ M.x86.R_BX = pop_word();
+ M.x86.R_DX = pop_word();
+ M.x86.R_CX = pop_word();
+ M.x86.R_AX = pop_word();
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -4308,16 +4308,16 @@ void x86emuOp_push_word_IMM(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- imm = fetch_long_imm();
+ imm = fetch_long_imm();
} else {
- imm = fetch_word_imm();
+ imm = fetch_word_imm();
}
DECODE_PRINTF2("PUSH\t%x\n", imm);
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- push_long(imm);
+ push_long(imm);
} else {
- push_word((u16)imm);
+ push_word((u16)imm);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -4337,188 +4337,188 @@ void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
- u32 res_lo,res_hi;
- s32 imm;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_long(srcoffset);
- imm = fetch_long_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
- if (res_hi != 0) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u32)res_lo;
- } else {
- u16 *destreg;
- u16 srcval;
- u32 res;
- s16 imm;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_word(srcoffset);
- imm = fetch_word_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- res = (s16)srcval * (s16)imm;
- if (res > 0xFFFF) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u16)res;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+ u32 res_lo,res_hi;
+ s32 imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32)res_lo;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+ s16 imm;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ res = (s16)srcval * (s16)imm;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16)res;
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
- u32 res_lo,res_hi;
- s32 imm;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_long(srcoffset);
- imm = fetch_long_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
- if (res_hi != 0) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u32)res_lo;
- } else {
- u16 *destreg;
- u16 srcval;
- u32 res;
- s16 imm;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_word(srcoffset);
- imm = fetch_word_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- res = (s16)srcval * (s16)imm;
- if (res > 0xFFFF) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u16)res;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+ u32 res_lo,res_hi;
+ s32 imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32)res_lo;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+ s16 imm;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ res = (s16)srcval * (s16)imm;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16)res;
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
- u32 res_lo,res_hi;
- s32 imm;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_long(srcoffset);
- imm = fetch_long_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
- if (res_hi != 0) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u32)res_lo;
- } else {
- u16 *destreg;
- u16 srcval;
- u32 res;
- s16 imm;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_word(srcoffset);
- imm = fetch_word_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- res = (s16)srcval * (s16)imm;
- if (res > 0xFFFF) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u16)res;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+ u32 res_lo,res_hi;
+ s32 imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32)res_lo;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+ s16 imm;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ res = (s16)srcval * (s16)imm;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16)res;
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
- u32 res_lo,res_hi;
- s32 imm;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- imm = fetch_long_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- imul_long_direct(&res_lo,&res_hi,(s32)*srcreg,(s32)imm);
- if (res_hi != 0) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u32)res_lo;
- } else {
- u16 *destreg,*srcreg;
- u32 res;
- s16 imm;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- imm = fetch_word_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- res = (s16)*srcreg * (s16)imm;
- if (res > 0xFFFF) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u16)res;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+ u32 res_lo,res_hi;
+ s32 imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo,&res_hi,(s32)*srcreg,(s32)imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32)res_lo;
+ } else {
+ u16 *destreg,*srcreg;
+ u32 res;
+ s16 imm;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ res = (s16)*srcreg * (s16)imm;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16)res;
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -4556,180 +4556,180 @@ void x86emuOp_imul_byte_IMM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
- u32 res_lo,res_hi;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_long(srcoffset);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
- if (res_hi != 0) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u32)res_lo;
- } else {
- u16 *destreg;
- u16 srcval;
- u32 res;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_word(srcoffset);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- res = (s16)srcval * (s16)imm;
- if (res > 0xFFFF) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u16)res;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+ u32 res_lo,res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32)res_lo;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ res = (s16)srcval * (s16)imm;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16)res;
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
- u32 res_lo,res_hi;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_long(srcoffset);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
- if (res_hi != 0) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u32)res_lo;
- } else {
- u16 *destreg;
- u16 srcval;
- u32 res;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_word(srcoffset);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- res = (s16)srcval * (s16)imm;
- if (res > 0xFFFF) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u16)res;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+ u32 res_lo,res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32)res_lo;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ res = (s16)srcval * (s16)imm;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16)res;
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
- u32 res_lo,res_hi;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_long(srcoffset);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
- if (res_hi != 0) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u32)res_lo;
- } else {
- u16 *destreg;
- u16 srcval;
- u32 res;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_word(srcoffset);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- res = (s16)srcval * (s16)imm;
- if (res > 0xFFFF) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u16)res;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+ u32 res_lo,res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32)res_lo;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ res = (s16)srcval * (s16)imm;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16)res;
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
- u32 res_lo,res_hi;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- imul_long_direct(&res_lo,&res_hi,(s32)*srcreg,(s32)imm);
- if (res_hi != 0) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u32)res_lo;
- } else {
- u16 *destreg,*srcreg;
- u32 res;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- res = (s16)*srcreg * (s16)imm;
- if (res > 0xFFFF) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u16)res;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+ u32 res_lo,res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo,&res_hi,(s32)*srcreg,(s32)imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32)res_lo;
+ } else {
+ u16 *destreg,*srcreg;
+ u32 res;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ res = (s16)*srcreg * (s16)imm;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16)res;
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -4757,11 +4757,11 @@ void x86emuOp_ins_word(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("INSD\n");
- ins(4);
+ DECODE_PRINTF("INSD\n");
+ ins(4);
} else {
- DECODE_PRINTF("INSW\n");
- ins(2);
+ DECODE_PRINTF("INSW\n");
+ ins(2);
}
TRACE_AND_STEP();
DECODE_CLEAR_SEGOVR();
@@ -4790,11 +4790,11 @@ void x86emuOp_outs_word(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("OUTSD\n");
- outs(4);
+ DECODE_PRINTF("OUTSD\n");
+ outs(4);
} else {
- DECODE_PRINTF("OUTSW\n");
- outs(2);
+ DECODE_PRINTF("OUTSW\n");
+ outs(2);
}
TRACE_AND_STEP();
DECODE_CLEAR_SEGOVR();
@@ -4818,7 +4818,7 @@ void x86emuOp_jump_near_O(u8 X86EMU_UNUSED(op1))
DECODE_PRINTF2("%x\n", target);
TRACE_AND_STEP();
if (ACCESS_FLAG(F_OF))
- M.x86.R_IP = target;
+ M.x86.R_IP = target;
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
}
@@ -4840,7 +4840,7 @@ void x86emuOp_jump_near_NO(u8 X86EMU_UNUSED(op1))
DECODE_PRINTF2("%x\n", target);
TRACE_AND_STEP();
if (!ACCESS_FLAG(F_OF))
- M.x86.R_IP = target;
+ M.x86.R_IP = target;
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
}
@@ -4862,7 +4862,7 @@ void x86emuOp_jump_near_B(u8 X86EMU_UNUSED(op1))
DECODE_PRINTF2("%x\n", target);
TRACE_AND_STEP();
if (ACCESS_FLAG(F_CF))
- M.x86.R_IP = target;
+ M.x86.R_IP = target;
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
}
@@ -4884,7 +4884,7 @@ void x86emuOp_jump_near_NB(u8 X86EMU_UNUSED(op1))
DECODE_PRINTF2("%x\n", target);
TRACE_AND_STEP();
if (!ACCESS_FLAG(F_CF))
- M.x86.R_IP = target;
+ M.x86.R_IP = target;
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
}
@@ -4906,7 +4906,7 @@ void x86emuOp_jump_near_Z(u8 X86EMU_UNUSED(op1))
DECODE_PRINTF2("%x\n", target);
TRACE_AND_STEP();
if (ACCESS_FLAG(F_ZF))
- M.x86.R_IP = target;
+ M.x86.R_IP = target;
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
}
@@ -4928,7 +4928,7 @@ void x86emuOp_jump_near_NZ(u8 X86EMU_UNUSED(op1))
DECODE_PRINTF2("%x\n", target);
TRACE_AND_STEP();
if (!ACCESS_FLAG(F_ZF))
- M.x86.R_IP = target;
+ M.x86.R_IP = target;
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
}
@@ -4951,7 +4951,7 @@ void x86emuOp_jump_near_BE(u8 X86EMU_UNUSED(op1))
DECODE_PRINTF2("%x\n", target);
TRACE_AND_STEP();
if (ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF))
- M.x86.R_IP = target;
+ M.x86.R_IP = target;
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
}
@@ -4974,7 +4974,7 @@ void x86emuOp_jump_near_NBE(u8 X86EMU_UNUSED(op1))
DECODE_PRINTF2("%x\n", target);
TRACE_AND_STEP();
if (!(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF)))
- M.x86.R_IP = target;
+ M.x86.R_IP = target;
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
}
@@ -4996,7 +4996,7 @@ void x86emuOp_jump_near_S(u8 X86EMU_UNUSED(op1))
DECODE_PRINTF2("%x\n", target);
TRACE_AND_STEP();
if (ACCESS_FLAG(F_SF))
- M.x86.R_IP = target;
+ M.x86.R_IP = target;
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
}
@@ -5018,7 +5018,7 @@ void x86emuOp_jump_near_NS(u8 X86EMU_UNUSED(op1))
DECODE_PRINTF2("%x\n", target);
TRACE_AND_STEP();
if (!ACCESS_FLAG(F_SF))
- M.x86.R_IP = target;
+ M.x86.R_IP = target;
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
}
@@ -5040,7 +5040,7 @@ void x86emuOp_jump_near_P(u8 X86EMU_UNUSED(op1))
DECODE_PRINTF2("%x\n", target);
TRACE_AND_STEP();
if (ACCESS_FLAG(F_PF))
- M.x86.R_IP = target;
+ M.x86.R_IP = target;
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
}
@@ -5062,7 +5062,7 @@ void x86emuOp_jump_near_NP(u8 X86EMU_UNUSED(op1))
DECODE_PRINTF2("%x\n", target);
TRACE_AND_STEP();
if (!ACCESS_FLAG(F_PF))
- M.x86.R_IP = target;
+ M.x86.R_IP = target;
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
}
@@ -5087,7 +5087,7 @@ void x86emuOp_jump_near_L(u8 X86EMU_UNUSED(op1))
sf = ACCESS_FLAG(F_SF) != 0;
of = ACCESS_FLAG(F_OF) != 0;
if (sf ^ of)
- M.x86.R_IP = target;
+ M.x86.R_IP = target;
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
}
@@ -5113,7 +5113,7 @@ void x86emuOp_jump_near_NL(u8 X86EMU_UNUSED(op1))
of = ACCESS_FLAG(F_OF) != 0;
/* note: inverse of above, but using == instead of xor. */
if (sf == of)
- M.x86.R_IP = target;
+ M.x86.R_IP = target;
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
}
@@ -5139,7 +5139,7 @@ void x86emuOp_jump_near_LE(u8 X86EMU_UNUSED(op1))
sf = ACCESS_FLAG(F_SF) != 0;
of = ACCESS_FLAG(F_OF) != 0;
if ((sf ^ of) || ACCESS_FLAG(F_ZF))
- M.x86.R_IP = target;
+ M.x86.R_IP = target;
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
}
@@ -5165,7 +5165,7 @@ void x86emuOp_jump_near_NLE(u8 X86EMU_UNUSED(op1))
sf = ACCESS_FLAG(F_SF) != 0;
of = ACCESS_FLAG(F_OF) != 0;
if ((sf == of) && !ACCESS_FLAG(F_ZF))
- M.x86.R_IP = target;
+ M.x86.R_IP = target;
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
}
@@ -5203,88 +5203,88 @@ void x86emuOp_opc80_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
#ifdef DEBUG
if (DEBUG_DECODE()) {
- /* XXX DECODE_PRINTF may be changed to something more
- general, so that it is important to leave the strings
- in the same format, even though the result is that the
- above test is done twice. */
-
- switch (rh) {
- case 0:
- DECODE_PRINTF("ADD\t");
- break;
- case 1:
- DECODE_PRINTF("OR\t");
- break;
- case 2:
- DECODE_PRINTF("ADC\t");
- break;
- case 3:
- DECODE_PRINTF("SBB\t");
- break;
- case 4:
- DECODE_PRINTF("AND\t");
- break;
- case 5:
- DECODE_PRINTF("SUB\t");
- break;
- case 6:
- DECODE_PRINTF("XOR\t");
- break;
- case 7:
- DECODE_PRINTF("CMP\t");
- break;
- }
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ADD\t");
+ break;
+ case 1:
+ DECODE_PRINTF("OR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("ADC\t");
+ break;
+ case 3:
+ DECODE_PRINTF("SBB\t");
+ break;
+ case 4:
+ DECODE_PRINTF("AND\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SUB\t");
+ break;
+ case 6:
+ DECODE_PRINTF("XOR\t");
+ break;
+ case 7:
+ DECODE_PRINTF("CMP\t");
+ break;
+ }
}
#endif
/* know operation, decode the mod byte to find the addressing
mode. */
switch (mod) {
case 0:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- imm = fetch_byte_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc80_byte_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_byte(destoffset, destval);
- break;
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc80_byte_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_byte(destoffset, destval);
+ break;
case 1:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- imm = fetch_byte_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc80_byte_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_byte(destoffset, destval);
- break;
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc80_byte_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_byte(destoffset, destval);
+ break;
case 2:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- imm = fetch_byte_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc80_byte_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_byte(destoffset, destval);
- break;
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc80_byte_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_byte(destoffset, destval);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",");
- imm = fetch_byte_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc80_byte_operation[rh]) (*destreg, imm);
- if (rh != 7)
- *destreg = destval;
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc80_byte_operation[rh]) (*destreg, imm);
+ if (rh != 7)
+ *destreg = destval;
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -5332,158 +5332,158 @@ void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
#ifdef DEBUG
if (DEBUG_DECODE()) {
- /* XXX DECODE_PRINTF may be changed to something more
- general, so that it is important to leave the strings
- in the same format, even though the result is that the
- above test is done twice. */
-
- switch (rh) {
- case 0:
- DECODE_PRINTF("ADD\t");
- break;
- case 1:
- DECODE_PRINTF("OR\t");
- break;
- case 2:
- DECODE_PRINTF("ADC\t");
- break;
- case 3:
- DECODE_PRINTF("SBB\t");
- break;
- case 4:
- DECODE_PRINTF("AND\t");
- break;
- case 5:
- DECODE_PRINTF("SUB\t");
- break;
- case 6:
- DECODE_PRINTF("XOR\t");
- break;
- case 7:
- DECODE_PRINTF("CMP\t");
- break;
- }
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ADD\t");
+ break;
+ case 1:
+ DECODE_PRINTF("OR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("ADC\t");
+ break;
+ case 3:
+ DECODE_PRINTF("SBB\t");
+ break;
+ case 4:
+ DECODE_PRINTF("AND\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SUB\t");
+ break;
+ case 6:
+ DECODE_PRINTF("XOR\t");
+ break;
+ case 7:
+ DECODE_PRINTF("CMP\t");
+ break;
+ }
}
#endif
/*
- * Know operation, decode the mod byte to find the addressing
+ * Know operation, decode the mod byte to find the addressing
* mode.
*/
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval,imm;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- imm = fetch_long_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc81_long_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_long(destoffset, destval);
- } else {
- u16 destval,imm;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- imm = fetch_word_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc81_word_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval,imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc81_long_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval,imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc81_word_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_word(destoffset, destval);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval,imm;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- imm = fetch_long_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc81_long_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_long(destoffset, destval);
- } else {
- u16 destval,imm;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- imm = fetch_word_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc81_word_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval,imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc81_long_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval,imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc81_word_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_word(destoffset, destval);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval,imm;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- imm = fetch_long_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc81_long_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_long(destoffset, destval);
- } else {
- u16 destval,imm;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- imm = fetch_word_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc81_word_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval,imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc81_long_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval,imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc81_word_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_word(destoffset, destval);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 destval,imm;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- imm = fetch_long_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc81_long_operation[rh]) (*destreg, imm);
- if (rh != 7)
- *destreg = destval;
- } else {
- u16 *destreg;
- u16 destval,imm;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 destval,imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ imm = fetch_long_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc81_long_operation[rh]) (*destreg, imm);
+ if (rh != 7)
+ *destreg = destval;
+ } else {
+ u16 *destreg;
+ u16 destval,imm;
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- imm = fetch_word_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc81_word_operation[rh]) (*destreg, imm);
- if (rh != 7)
- *destreg = destval;
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ imm = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc81_word_operation[rh]) (*destreg, imm);
+ if (rh != 7)
+ *destreg = destval;
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -5492,12 +5492,12 @@ void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
static u8 (*opc82_byte_operation[])(u8 s, u8 d) =
{
add_byte, /*00 */
- or_byte, /*01 *//*YYY UNUSED ???? */
+ or_byte, /*01 */ /*YYY UNUSED ???? */
adc_byte, /*02 */
sbb_byte, /*03 */
- and_byte, /*04 *//*YYY UNUSED ???? */
+ and_byte, /*04 */ /*YYY UNUSED ???? */
sub_byte, /*05 */
- xor_byte, /*06 *//*YYY UNUSED ???? */
+ xor_byte, /*06 */ /*YYY UNUSED ???? */
cmp_byte, /*07 */
};
@@ -5523,83 +5523,83 @@ void x86emuOp_opc82_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
#ifdef DEBUG
if (DEBUG_DECODE()) {
- /* XXX DECODE_PRINTF may be changed to something more
- general, so that it is important to leave the strings
- in the same format, even though the result is that the
- above test is done twice. */
- switch (rh) {
- case 0:
- DECODE_PRINTF("ADD\t");
- break;
- case 1:
- DECODE_PRINTF("OR\t");
- break;
- case 2:
- DECODE_PRINTF("ADC\t");
- break;
- case 3:
- DECODE_PRINTF("SBB\t");
- break;
- case 4:
- DECODE_PRINTF("AND\t");
- break;
- case 5:
- DECODE_PRINTF("SUB\t");
- break;
- case 6:
- DECODE_PRINTF("XOR\t");
- break;
- case 7:
- DECODE_PRINTF("CMP\t");
- break;
- }
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ADD\t");
+ break;
+ case 1:
+ DECODE_PRINTF("OR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("ADC\t");
+ break;
+ case 3:
+ DECODE_PRINTF("SBB\t");
+ break;
+ case 4:
+ DECODE_PRINTF("AND\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SUB\t");
+ break;
+ case 6:
+ DECODE_PRINTF("XOR\t");
+ break;
+ case 7:
+ DECODE_PRINTF("CMP\t");
+ break;
+ }
}
#endif
/* know operation, decode the mod byte to find the addressing
mode. */
switch (mod) {
case 0:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm00_address(rl);
- destval = fetch_data_byte(destoffset);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc82_byte_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_byte(destoffset, destval);
- break;
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ destval = fetch_data_byte(destoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc82_byte_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_byte(destoffset, destval);
+ break;
case 1:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm01_address(rl);
- destval = fetch_data_byte(destoffset);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc82_byte_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_byte(destoffset, destval);
- break;
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ destval = fetch_data_byte(destoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc82_byte_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_byte(destoffset, destval);
+ break;
case 2:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm10_address(rl);
- destval = fetch_data_byte(destoffset);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc82_byte_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_byte(destoffset, destval);
- break;
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ destval = fetch_data_byte(destoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc82_byte_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_byte(destoffset, destval);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc82_byte_operation[rh]) (*destreg, imm);
- if (rh != 7)
- *destreg = destval;
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc82_byte_operation[rh]) (*destreg, imm);
+ if (rh != 7)
+ *destreg = destval;
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -5608,24 +5608,24 @@ void x86emuOp_opc82_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
static u16 (*opc83_word_operation[])(u16 s, u16 d) =
{
add_word, /*00 */
- or_word, /*01 *//*YYY UNUSED ???? */
+ or_word, /*01 */ /*YYY UNUSED ???? */
adc_word, /*02 */
sbb_word, /*03 */
- and_word, /*04 *//*YYY UNUSED ???? */
+ and_word, /*04 */ /*YYY UNUSED ???? */
sub_word, /*05 */
- xor_word, /*06 *//*YYY UNUSED ???? */
+ xor_word, /*06 */ /*YYY UNUSED ???? */
cmp_word, /*07 */
};
static u32 (*opc83_long_operation[])(u32 s, u32 d) =
{
add_long, /*00 */
- or_long, /*01 *//*YYY UNUSED ???? */
+ or_long, /*01 */ /*YYY UNUSED ???? */
adc_long, /*02 */
sbb_long, /*03 */
- and_long, /*04 *//*YYY UNUSED ???? */
+ and_long, /*04 */ /*YYY UNUSED ???? */
sub_long, /*05 */
- xor_long, /*06 *//*YYY UNUSED ???? */
+ xor_long, /*06 */ /*YYY UNUSED ???? */
cmp_long, /*07 */
};
@@ -5648,147 +5648,147 @@ void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
#ifdef DEBUG
if (DEBUG_DECODE()) {
- /* XXX DECODE_PRINTF may be changed to something more
- general, so that it is important to leave the strings
- in the same format, even though the result is that the
- above test is done twice. */
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
switch (rh) {
- case 0:
- DECODE_PRINTF("ADD\t");
- break;
- case 1:
- DECODE_PRINTF("OR\t");
- break;
- case 2:
- DECODE_PRINTF("ADC\t");
- break;
- case 3:
- DECODE_PRINTF("SBB\t");
- break;
- case 4:
- DECODE_PRINTF("AND\t");
- break;
- case 5:
- DECODE_PRINTF("SUB\t");
- break;
- case 6:
- DECODE_PRINTF("XOR\t");
- break;
- case 7:
- DECODE_PRINTF("CMP\t");
- break;
- }
+ case 0:
+ DECODE_PRINTF("ADD\t");
+ break;
+ case 1:
+ DECODE_PRINTF("OR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("ADC\t");
+ break;
+ case 3:
+ DECODE_PRINTF("SBB\t");
+ break;
+ case 4:
+ DECODE_PRINTF("AND\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SUB\t");
+ break;
+ case 6:
+ DECODE_PRINTF("XOR\t");
+ break;
+ case 7:
+ DECODE_PRINTF("CMP\t");
+ break;
+ }
}
#endif
/* know operation, decode the mod byte to find the addressing
mode. */
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval,imm;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm00_address(rl);
- destval = fetch_data_long(destoffset);
- imm = (s8) fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc83_long_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_long(destoffset, destval);
- } else {
- u16 destval,imm;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm00_address(rl);
- destval = fetch_data_word(destoffset);
- imm = (s8) fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc83_word_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval,imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ destval = fetch_data_long(destoffset);
+ imm = (s8) fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc83_long_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval,imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ destval = fetch_data_word(destoffset);
+ imm = (s8) fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc83_word_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_word(destoffset, destval);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval,imm;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm01_address(rl);
- destval = fetch_data_long(destoffset);
- imm = (s8) fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc83_long_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_long(destoffset, destval);
- } else {
- u16 destval,imm;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm01_address(rl);
- destval = fetch_data_word(destoffset);
- imm = (s8) fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc83_word_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval,imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ destval = fetch_data_long(destoffset);
+ imm = (s8) fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc83_long_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval,imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ destval = fetch_data_word(destoffset);
+ imm = (s8) fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc83_word_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_word(destoffset, destval);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval,imm;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm10_address(rl);
- destval = fetch_data_long(destoffset);
- imm = (s8) fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc83_long_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_long(destoffset, destval);
- } else {
- u16 destval,imm;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm10_address(rl);
- destval = fetch_data_word(destoffset);
- imm = (s8) fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc83_word_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval,imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ destval = fetch_data_long(destoffset);
+ imm = (s8) fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc83_long_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval,imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ destval = fetch_data_word(destoffset);
+ imm = (s8) fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc83_word_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_word(destoffset, destval);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 destval,imm;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- imm = (s8) fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc83_long_operation[rh]) (*destreg, imm);
- if (rh != 7)
- *destreg = destval;
- } else {
- u16 *destreg;
- u16 destval,imm;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 destval,imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ imm = (s8) fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc83_long_operation[rh]) (*destreg, imm);
+ if (rh != 7)
+ *destreg = destval;
+ } else {
+ u16 *destreg;
+ u16 destval,imm;
- destreg = DECODE_RM_WORD_REGISTER(rl);
- imm = (s8) fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc83_word_operation[rh]) (*destreg, imm);
- if (rh != 7)
- *destreg = destval;
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ imm = (s8) fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc83_word_operation[rh]) (*destreg, imm);
+ if (rh != 7)
+ *destreg = destval;
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -5810,40 +5810,40 @@ void x86emuOp_test_byte_RM_R(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- test_byte(destval, *srcreg);
- break;
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_byte(destval, *srcreg);
+ break;
case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- test_byte(destval, *srcreg);
- break;
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_byte(destval, *srcreg);
+ break;
case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- test_byte(destval, *srcreg);
- break;
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_byte(destval, *srcreg);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- test_byte(*destreg, *srcreg);
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_byte(*destreg, *srcreg);
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -5863,101 +5863,101 @@ void x86emuOp_test_word_RM_R(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- test_long(destval, *srcreg);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- test_word(destval, *srcreg);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_long(destval, *srcreg);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_word(destval, *srcreg);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- test_long(destval, *srcreg);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- test_word(destval, *srcreg);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_long(destval, *srcreg);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_word(destval, *srcreg);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- test_long(destval, *srcreg);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- test_word(destval, *srcreg);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_long(destval, *srcreg);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_word(destval, *srcreg);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- test_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- test_word(*destreg, *srcreg);
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_word(*destreg, *srcreg);
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -5980,51 +5980,51 @@ void x86emuOp_xchg_byte_RM_R(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- tmp = *srcreg;
- *srcreg = destval;
- destval = tmp;
- store_data_byte(destoffset, destval);
- break;
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_byte(destoffset, destval);
+ break;
case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- tmp = *srcreg;
- *srcreg = destval;
- destval = tmp;
- store_data_byte(destoffset, destval);
- break;
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_byte(destoffset, destval);
+ break;
case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- tmp = *srcreg;
- *srcreg = destval;
- destval = tmp;
- store_data_byte(destoffset, destval);
- break;
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_byte(destoffset, destval);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- tmp = *srcreg;
- *srcreg = *destreg;
- *destreg = tmp;
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = *destreg;
+ *destreg = tmp;
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -6044,125 +6044,125 @@ void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *srcreg;
- u32 destval,tmp;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- tmp = *srcreg;
- *srcreg = destval;
- destval = tmp;
- store_data_long(destoffset, destval);
- } else {
- u16 *srcreg;
- u16 destval,tmp;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- tmp = *srcreg;
- *srcreg = destval;
- destval = tmp;
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg;
+ u32 destval,tmp;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_long(destoffset, destval);
+ } else {
+ u16 *srcreg;
+ u16 destval,tmp;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_word(destoffset, destval);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *srcreg;
- u32 destval,tmp;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- tmp = *srcreg;
- *srcreg = destval;
- destval = tmp;
- store_data_long(destoffset, destval);
- } else {
- u16 *srcreg;
- u16 destval,tmp;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- tmp = *srcreg;
- *srcreg = destval;
- destval = tmp;
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg;
+ u32 destval,tmp;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_long(destoffset, destval);
+ } else {
+ u16 *srcreg;
+ u16 destval,tmp;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_word(destoffset, destval);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *srcreg;
- u32 destval,tmp;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- tmp = *srcreg;
- *srcreg = destval;
- destval = tmp;
- store_data_long(destoffset, destval);
- } else {
- u16 *srcreg;
- u16 destval,tmp;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- tmp = *srcreg;
- *srcreg = destval;
- destval = tmp;
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg;
+ u32 destval,tmp;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_long(destoffset, destval);
+ } else {
+ u16 *srcreg;
+ u16 destval,tmp;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_word(destoffset, destval);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
- u32 tmp;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- tmp = *srcreg;
- *srcreg = *destreg;
- *destreg = tmp;
- } else {
- u16 *destreg,*srcreg;
- u16 tmp;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+ u32 tmp;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = *destreg;
+ *destreg = tmp;
+ } else {
+ u16 *destreg,*srcreg;
+ u16 tmp;
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- tmp = *srcreg;
- *srcreg = *destreg;
- *destreg = tmp;
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = *destreg;
+ *destreg = tmp;
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -6183,37 +6183,37 @@ void x86emuOp_mov_byte_RM_R(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- store_data_byte(destoffset, *srcreg);
- break;
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, *srcreg);
+ break;
case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- store_data_byte(destoffset, *srcreg);
- break;
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, *srcreg);
+ break;
case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- store_data_byte(destoffset, *srcreg);
- break;
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, *srcreg);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = *srcreg;
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -6233,89 +6233,89 @@ void x86emuOp_mov_word_RM_R(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- store_data_long(destoffset, *srcreg);
- } else {
- u16 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- store_data_word(destoffset, *srcreg);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_long(destoffset, *srcreg);
+ } else {
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_word(destoffset, *srcreg);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- store_data_long(destoffset, *srcreg);
- } else {
- u16 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- store_data_word(destoffset, *srcreg);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_long(destoffset, *srcreg);
+ } else {
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_word(destoffset, *srcreg);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- store_data_long(destoffset, *srcreg);
- } else {
- u16 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- store_data_word(destoffset, *srcreg);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_long(destoffset, *srcreg);
+ } else {
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_word(destoffset, *srcreg);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = *srcreg;
- } else {
- u16 *destreg,*srcreg;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ } else {
+ u16 *destreg,*srcreg;
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = *srcreg;
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -6337,40 +6337,40 @@ void x86emuOp_mov_byte_R_RM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
case 1:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
case 2:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = *srcreg;
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -6390,101 +6390,101 @@ void x86emuOp_mov_word_R_RM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg, *srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = *srcreg;
- } else {
- u16 *destreg, *srcreg;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ } else {
+ u16 *destreg, *srcreg;
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = *srcreg;
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -6506,40 +6506,40 @@ void x86emuOp_mov_word_RM_SR(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- srcreg = decode_rm_seg_register(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = *srcreg;
- store_data_word(destoffset, destval);
- break;
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = decode_rm_seg_register(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = *srcreg;
+ store_data_word(destoffset, destval);
+ break;
case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- srcreg = decode_rm_seg_register(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = *srcreg;
- store_data_word(destoffset, destval);
- break;
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = decode_rm_seg_register(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = *srcreg;
+ store_data_word(destoffset, destval);
+ break;
case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- srcreg = decode_rm_seg_register(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = *srcreg;
- store_data_word(destoffset, destval);
- break;
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = decode_rm_seg_register(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = *srcreg;
+ store_data_word(destoffset, destval);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = decode_rm_seg_register(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = *srcreg;
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = decode_rm_seg_register(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -6560,38 +6560,38 @@ void x86emuOp_lea_word_R_M(u8 X86EMU_UNUSED(op1))
*
* lea eax,[eax+ebx*2] ??
*/
-
+
START_OF_INSTR();
DECODE_PRINTF("LEA\t");
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *srcreg = (u16)destoffset;
- break;
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *srcreg = (u16)destoffset;
+ break;
case 1:
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *srcreg = (u16)destoffset;
- break;
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *srcreg = (u16)destoffset;
+ break;
case 2:
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *srcreg = (u16)destoffset;
- break;
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *srcreg = (u16)destoffset;
+ break;
case 3: /* register to register */
- /* undefined. Do nothing. */
- break;
+ /* undefined. Do nothing. */
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -6613,40 +6613,40 @@ void x86emuOp_mov_word_SR_RM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- destreg = decode_rm_seg_register(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- break;
+ destreg = decode_rm_seg_register(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
case 1:
- destreg = decode_rm_seg_register(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- break;
+ destreg = decode_rm_seg_register(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
case 2:
- destreg = decode_rm_seg_register(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- break;
+ destreg = decode_rm_seg_register(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
case 3: /* register to register */
- destreg = decode_rm_seg_register(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = *srcreg;
- break;
+ destreg = decode_rm_seg_register(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ break;
}
/*
* Clean up, and reset all the R_xSP pointers to the correct
@@ -6671,84 +6671,84 @@ void x86emuOp_pop_RM(u8 X86EMU_UNUSED(op1))
DECODE_PRINTF("POP\t");
FETCH_DECODE_MODRM(mod, rh, rl);
if (rh != 0) {
- DECODE_PRINTF("ILLEGAL DECODE OF OPCODE 8F\n");
- HALT_SYS();
+ DECODE_PRINTF("ILLEGAL DECODE OF OPCODE 8F\n");
+ HALT_SYS();
}
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = pop_long();
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = pop_word();
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = pop_long();
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = pop_word();
+ store_data_word(destoffset, destval);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = pop_long();
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = pop_word();
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = pop_long();
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = pop_word();
+ store_data_word(destoffset, destval);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = pop_long();
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = pop_word();
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = pop_long();
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = pop_word();
+ store_data_word(destoffset, destval);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = pop_long();
- } else {
- u16 *destreg;
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = pop_long();
+ } else {
+ u16 *destreg;
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = pop_word();
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = pop_word();
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -6777,19 +6777,19 @@ void x86emuOp_xchg_word_AX_CX(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("XCHG\tEAX,ECX\n");
+ DECODE_PRINTF("XCHG\tEAX,ECX\n");
} else {
- DECODE_PRINTF("XCHG\tAX,CX\n");
+ DECODE_PRINTF("XCHG\tAX,CX\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- tmp = M.x86.R_EAX;
- M.x86.R_EAX = M.x86.R_ECX;
- M.x86.R_ECX = tmp;
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_ECX;
+ M.x86.R_ECX = tmp;
} else {
- tmp = M.x86.R_AX;
- M.x86.R_AX = M.x86.R_CX;
- M.x86.R_CX = (u16)tmp;
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_CX;
+ M.x86.R_CX = (u16)tmp;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -6805,19 +6805,19 @@ void x86emuOp_xchg_word_AX_DX(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("XCHG\tEAX,EDX\n");
+ DECODE_PRINTF("XCHG\tEAX,EDX\n");
} else {
- DECODE_PRINTF("XCHG\tAX,DX\n");
+ DECODE_PRINTF("XCHG\tAX,DX\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- tmp = M.x86.R_EAX;
- M.x86.R_EAX = M.x86.R_EDX;
- M.x86.R_EDX = tmp;
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_EDX;
+ M.x86.R_EDX = tmp;
} else {
- tmp = M.x86.R_AX;
- M.x86.R_AX = M.x86.R_DX;
- M.x86.R_DX = (u16)tmp;
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_DX;
+ M.x86.R_DX = (u16)tmp;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -6833,19 +6833,19 @@ void x86emuOp_xchg_word_AX_BX(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("XCHG\tEAX,EBX\n");
+ DECODE_PRINTF("XCHG\tEAX,EBX\n");
} else {
- DECODE_PRINTF("XCHG\tAX,BX\n");
+ DECODE_PRINTF("XCHG\tAX,BX\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- tmp = M.x86.R_EAX;
- M.x86.R_EAX = M.x86.R_EBX;
- M.x86.R_EBX = tmp;
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_EBX;
+ M.x86.R_EBX = tmp;
} else {
- tmp = M.x86.R_AX;
- M.x86.R_AX = M.x86.R_BX;
- M.x86.R_BX = (u16)tmp;
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_BX;
+ M.x86.R_BX = (u16)tmp;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -6861,19 +6861,19 @@ void x86emuOp_xchg_word_AX_SP(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("XCHG\tEAX,ESP\n");
+ DECODE_PRINTF("XCHG\tEAX,ESP\n");
} else {
- DECODE_PRINTF("XCHG\tAX,SP\n");
+ DECODE_PRINTF("XCHG\tAX,SP\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- tmp = M.x86.R_EAX;
- M.x86.R_EAX = M.x86.R_ESP;
- M.x86.R_ESP = tmp;
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_ESP;
+ M.x86.R_ESP = tmp;
} else {
- tmp = M.x86.R_AX;
- M.x86.R_AX = M.x86.R_SP;
- M.x86.R_SP = (u16)tmp;
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_SP;
+ M.x86.R_SP = (u16)tmp;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -6889,19 +6889,19 @@ void x86emuOp_xchg_word_AX_BP(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("XCHG\tEAX,EBP\n");
+ DECODE_PRINTF("XCHG\tEAX,EBP\n");
} else {
- DECODE_PRINTF("XCHG\tAX,BP\n");
+ DECODE_PRINTF("XCHG\tAX,BP\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- tmp = M.x86.R_EAX;
- M.x86.R_EAX = M.x86.R_EBP;
- M.x86.R_EBP = tmp;
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_EBP;
+ M.x86.R_EBP = tmp;
} else {
- tmp = M.x86.R_AX;
- M.x86.R_AX = M.x86.R_BP;
- M.x86.R_BP = (u16)tmp;
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_BP;
+ M.x86.R_BP = (u16)tmp;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -6917,19 +6917,19 @@ void x86emuOp_xchg_word_AX_SI(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("XCHG\tEAX,ESI\n");
+ DECODE_PRINTF("XCHG\tEAX,ESI\n");
} else {
- DECODE_PRINTF("XCHG\tAX,SI\n");
+ DECODE_PRINTF("XCHG\tAX,SI\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- tmp = M.x86.R_EAX;
- M.x86.R_EAX = M.x86.R_ESI;
- M.x86.R_ESI = tmp;
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_ESI;
+ M.x86.R_ESI = tmp;
} else {
- tmp = M.x86.R_AX;
- M.x86.R_AX = M.x86.R_SI;
- M.x86.R_SI = (u16)tmp;
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_SI;
+ M.x86.R_SI = (u16)tmp;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -6945,19 +6945,19 @@ void x86emuOp_xchg_word_AX_DI(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("XCHG\tEAX,EDI\n");
+ DECODE_PRINTF("XCHG\tEAX,EDI\n");
} else {
- DECODE_PRINTF("XCHG\tAX,DI\n");
+ DECODE_PRINTF("XCHG\tAX,DI\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- tmp = M.x86.R_EAX;
- M.x86.R_EAX = M.x86.R_EDI;
- M.x86.R_EDI = tmp;
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_EDI;
+ M.x86.R_EDI = tmp;
} else {
- tmp = M.x86.R_AX;
- M.x86.R_AX = M.x86.R_DI;
- M.x86.R_DI = (u16)tmp;
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_DI;
+ M.x86.R_DI = (u16)tmp;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -6971,23 +6971,23 @@ void x86emuOp_cbw(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("CWDE\n");
+ DECODE_PRINTF("CWDE\n");
} else {
- DECODE_PRINTF("CBW\n");
+ DECODE_PRINTF("CBW\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- if (M.x86.R_AX & 0x8000) {
- M.x86.R_EAX |= 0xffff0000;
- } else {
- M.x86.R_EAX &= 0x0000ffff;
- }
+ if (M.x86.R_AX & 0x8000) {
+ M.x86.R_EAX |= 0xffff0000;
+ } else {
+ M.x86.R_EAX &= 0x0000ffff;
+ }
} else {
- if (M.x86.R_AL & 0x80) {
- M.x86.R_AH = 0xff;
- } else {
- M.x86.R_AH = 0x0;
- }
+ if (M.x86.R_AL & 0x80) {
+ M.x86.R_AH = 0xff;
+ } else {
+ M.x86.R_AH = 0x0;
+ }
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -7001,24 +7001,24 @@ void x86emuOp_cwd(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("CDQ\n");
+ DECODE_PRINTF("CDQ\n");
} else {
- DECODE_PRINTF("CWD\n");
+ DECODE_PRINTF("CWD\n");
}
DECODE_PRINTF("CWD\n");
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- if (M.x86.R_EAX & 0x80000000) {
- M.x86.R_EDX = 0xffffffff;
- } else {
- M.x86.R_EDX = 0x0;
- }
+ if (M.x86.R_EAX & 0x80000000) {
+ M.x86.R_EDX = 0xffffffff;
+ } else {
+ M.x86.R_EDX = 0x0;
+ }
} else {
- if (M.x86.R_AX & 0x8000) {
- M.x86.R_DX = 0xffff;
- } else {
- M.x86.R_DX = 0x0;
- }
+ if (M.x86.R_AX & 0x8000) {
+ M.x86.R_DX = 0xffff;
+ } else {
+ M.x86.R_DX = 0x0;
+ }
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -7041,7 +7041,7 @@ void x86emuOp_call_far_IMM(u8 X86EMU_UNUSED(op1))
CALL_TRACE(M.x86.saved_cs, M.x86.saved_ip, farseg, faroff, "FAR ");
/* XXX
- *
+ *
* Hooked interrupt vectors calling into our "BIOS" will cause
* problems unless all intersegment stuff is checked for BIOS
* access. Check needed here. For moment, let it alone.
@@ -7079,18 +7079,18 @@ void x86emuOp_pushf_word(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("PUSHFD\n");
+ DECODE_PRINTF("PUSHFD\n");
} else {
- DECODE_PRINTF("PUSHF\n");
+ DECODE_PRINTF("PUSHF\n");
}
TRACE_AND_STEP();
/* clear out *all* bits not representing flags, and turn on real bits */
flags = (M.x86.R_EFLG & F_MSK) | F_ALWAYS_ON;
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- push_long(flags);
+ push_long(flags);
} else {
- push_word((u16)flags);
+ push_word((u16)flags);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -7104,15 +7104,15 @@ void x86emuOp_popf_word(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("POPFD\n");
+ DECODE_PRINTF("POPFD\n");
} else {
- DECODE_PRINTF("POPF\n");
+ DECODE_PRINTF("POPF\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EFLG = pop_long();
+ M.x86.R_EFLG = pop_long();
} else {
- M.x86.R_FLG = pop_word();
+ M.x86.R_FLG = pop_word();
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -7181,15 +7181,15 @@ void x86emuOp_mov_AX_M_IMM(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
offset = fetch_word_imm();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF2("MOV\tEAX,[%04x]\n", offset);
+ DECODE_PRINTF2("MOV\tEAX,[%04x]\n", offset);
} else {
- DECODE_PRINTF2("MOV\tAX,[%04x]\n", offset);
+ DECODE_PRINTF2("MOV\tAX,[%04x]\n", offset);
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = fetch_data_long(offset);
+ M.x86.R_EAX = fetch_data_long(offset);
} else {
- M.x86.R_AX = fetch_data_word(offset);
+ M.x86.R_AX = fetch_data_word(offset);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -7224,15 +7224,15 @@ void x86emuOp_mov_M_AX_IMM(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
offset = fetch_word_imm();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF2("MOV\t[%04x],EAX\n", offset);
+ DECODE_PRINTF2("MOV\t[%04x],EAX\n", offset);
} else {
- DECODE_PRINTF2("MOV\t[%04x],AX\n", offset);
+ DECODE_PRINTF2("MOV\t[%04x],AX\n", offset);
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- store_data_long(offset, M.x86.R_EAX);
+ store_data_long(offset, M.x86.R_EAX);
} else {
- store_data_word(offset, M.x86.R_AX);
+ store_data_word(offset, M.x86.R_AX);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -7251,23 +7251,23 @@ void x86emuOp_movs_byte(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
DECODE_PRINTF("MOVS\tBYTE\n");
if (ACCESS_FLAG(F_DF)) /* down */
- inc = -1;
+ inc = -1;
else
- inc = 1;
+ inc = 1;
TRACE_AND_STEP();
count = 1;
if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
- /* dont care whether REPE or REPNE */
- /* move them until CX is ZERO. */
- count = M.x86.R_CX;
- M.x86.R_CX = 0;
- M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
+ /* dont care whether REPE or REPNE */
+ /* move them until CX is ZERO. */
+ count = M.x86.R_CX;
+ M.x86.R_CX = 0;
+ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
}
while (count--) {
- val = fetch_data_byte(M.x86.R_SI);
- store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, val);
- M.x86.R_SI += inc;
- M.x86.R_DI += inc;
+ val = fetch_data_byte(M.x86.R_SI);
+ store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, val);
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -7285,37 +7285,37 @@ void x86emuOp_movs_word(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("MOVS\tDWORD\n");
- if (ACCESS_FLAG(F_DF)) /* down */
- inc = -4;
- else
- inc = 4;
+ DECODE_PRINTF("MOVS\tDWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -4;
+ else
+ inc = 4;
} else {
- DECODE_PRINTF("MOVS\tWORD\n");
- if (ACCESS_FLAG(F_DF)) /* down */
- inc = -2;
- else
- inc = 2;
+ DECODE_PRINTF("MOVS\tWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -2;
+ else
+ inc = 2;
}
TRACE_AND_STEP();
count = 1;
if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
- /* dont care whether REPE or REPNE */
- /* move them until CX is ZERO. */
- count = M.x86.R_CX;
- M.x86.R_CX = 0;
- M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
+ /* dont care whether REPE or REPNE */
+ /* move them until CX is ZERO. */
+ count = M.x86.R_CX;
+ M.x86.R_CX = 0;
+ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
}
while (count--) {
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- val = fetch_data_long(M.x86.R_SI);
- store_data_long_abs(M.x86.R_ES, M.x86.R_DI, val);
- } else {
- val = fetch_data_word(M.x86.R_SI);
- store_data_word_abs(M.x86.R_ES, M.x86.R_DI, (u16)val);
- }
- M.x86.R_SI += inc;
- M.x86.R_DI += inc;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ val = fetch_data_long(M.x86.R_SI);
+ store_data_long_abs(M.x86.R_ES, M.x86.R_DI, val);
+ } else {
+ val = fetch_data_word(M.x86.R_SI);
+ store_data_word_abs(M.x86.R_ES, M.x86.R_DI, (u16)val);
+ }
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -7334,44 +7334,44 @@ void x86emuOp_cmps_byte(u8 X86EMU_UNUSED(op1))
DECODE_PRINTF("CMPS\tBYTE\n");
TRACE_AND_STEP();
if (ACCESS_FLAG(F_DF)) /* down */
- inc = -1;
+ inc = -1;
else
- inc = 1;
+ inc = 1;
if (M.x86.mode & SYSMODE_PREFIX_REPE) {
- /* REPE */
- /* move them until CX is ZERO. */
- while (M.x86.R_CX != 0) {
- val1 = fetch_data_byte(M.x86.R_SI);
- val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_byte(val1, val2);
- M.x86.R_CX -= 1;
- M.x86.R_SI += inc;
- M.x86.R_DI += inc;
- if (ACCESS_FLAG(F_ZF) == 0)
- break;
- }
- M.x86.mode &= ~SYSMODE_PREFIX_REPE;
+ /* REPE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ val1 = fetch_data_byte(M.x86.R_SI);
+ val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_byte(val1, val2);
+ M.x86.R_CX -= 1;
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
+ if (ACCESS_FLAG(F_ZF) == 0)
+ break;
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPE;
} else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
- /* REPNE */
- /* move them until CX is ZERO. */
- while (M.x86.R_CX != 0) {
- val1 = fetch_data_byte(M.x86.R_SI);
- val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_byte(val1, val2);
- M.x86.R_CX -= 1;
- M.x86.R_SI += inc;
- M.x86.R_DI += inc;
- if (ACCESS_FLAG(F_ZF))
- break; /* zero flag set means equal */
- }
- M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
+ /* REPNE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ val1 = fetch_data_byte(M.x86.R_SI);
+ val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_byte(val1, val2);
+ M.x86.R_CX -= 1;
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
+ if (ACCESS_FLAG(F_ZF))
+ break; /* zero flag set means equal */
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
} else {
- val1 = fetch_data_byte(M.x86.R_SI);
- val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_byte(val1, val2);
- M.x86.R_SI += inc;
- M.x86.R_DI += inc;
+ val1 = fetch_data_byte(M.x86.R_SI);
+ val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_byte(val1, val2);
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -7388,71 +7388,71 @@ void x86emuOp_cmps_word(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("CMPS\tDWORD\n");
- if (ACCESS_FLAG(F_DF)) /* down */
- inc = -4;
- else
- inc = 4;
+ DECODE_PRINTF("CMPS\tDWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -4;
+ else
+ inc = 4;
} else {
- DECODE_PRINTF("CMPS\tWORD\n");
- if (ACCESS_FLAG(F_DF)) /* down */
- inc = -2;
- else
- inc = 2;
+ DECODE_PRINTF("CMPS\tWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -2;
+ else
+ inc = 2;
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_REPE) {
- /* REPE */
- /* move them until CX is ZERO. */
- while (M.x86.R_CX != 0) {
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- val1 = fetch_data_long(M.x86.R_SI);
- val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_long(val1, val2);
- } else {
- val1 = fetch_data_word(M.x86.R_SI);
- val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_word((u16)val1, (u16)val2);
- }
- M.x86.R_CX -= 1;
- M.x86.R_SI += inc;
- M.x86.R_DI += inc;
- if (ACCESS_FLAG(F_ZF) == 0)
- break;
- }
- M.x86.mode &= ~SYSMODE_PREFIX_REPE;
+ /* REPE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ val1 = fetch_data_long(M.x86.R_SI);
+ val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_long(val1, val2);
+ } else {
+ val1 = fetch_data_word(M.x86.R_SI);
+ val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_word((u16)val1, (u16)val2);
+ }
+ M.x86.R_CX -= 1;
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
+ if (ACCESS_FLAG(F_ZF) == 0)
+ break;
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPE;
} else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
- /* REPNE */
- /* move them until CX is ZERO. */
- while (M.x86.R_CX != 0) {
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- val1 = fetch_data_long(M.x86.R_SI);
- val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_long(val1, val2);
- } else {
- val1 = fetch_data_word(M.x86.R_SI);
- val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_word((u16)val1, (u16)val2);
- }
- M.x86.R_CX -= 1;
- M.x86.R_SI += inc;
- M.x86.R_DI += inc;
- if (ACCESS_FLAG(F_ZF))
- break; /* zero flag set means equal */
- }
- M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
- } else {
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- val1 = fetch_data_long(M.x86.R_SI);
- val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_long(val1, val2);
- } else {
- val1 = fetch_data_word(M.x86.R_SI);
- val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_word((u16)val1, (u16)val2);
- }
- M.x86.R_SI += inc;
- M.x86.R_DI += inc;
+ /* REPNE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ val1 = fetch_data_long(M.x86.R_SI);
+ val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_long(val1, val2);
+ } else {
+ val1 = fetch_data_word(M.x86.R_SI);
+ val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_word((u16)val1, (u16)val2);
+ }
+ M.x86.R_CX -= 1;
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
+ if (ACCESS_FLAG(F_ZF))
+ break; /* zero flag set means equal */
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
+ } else {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ val1 = fetch_data_long(M.x86.R_SI);
+ val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_long(val1, val2);
+ } else {
+ val1 = fetch_data_word(M.x86.R_SI);
+ val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_word((u16)val1, (u16)val2);
+ }
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -7486,18 +7486,18 @@ void x86emuOp_test_AX_IMM(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("TEST\tEAX,");
- srcval = fetch_long_imm();
+ DECODE_PRINTF("TEST\tEAX,");
+ srcval = fetch_long_imm();
} else {
- DECODE_PRINTF("TEST\tAX,");
- srcval = fetch_word_imm();
+ DECODE_PRINTF("TEST\tAX,");
+ srcval = fetch_word_imm();
}
DECODE_PRINTF2("%x\n", srcval);
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- test_long(M.x86.R_EAX, srcval);
+ test_long(M.x86.R_EAX, srcval);
} else {
- test_word(M.x86.R_AX, (u16)srcval);
+ test_word(M.x86.R_AX, (u16)srcval);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -7514,22 +7514,22 @@ void x86emuOp_stos_byte(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
DECODE_PRINTF("STOS\tBYTE\n");
if (ACCESS_FLAG(F_DF)) /* down */
- inc = -1;
+ inc = -1;
else
- inc = 1;
+ inc = 1;
TRACE_AND_STEP();
if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
- /* dont care whether REPE or REPNE */
- /* move them until CX is ZERO. */
- while (M.x86.R_CX != 0) {
- store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_AL);
- M.x86.R_CX -= 1;
- M.x86.R_DI += inc;
- }
- M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
+ /* dont care whether REPE or REPNE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_AL);
+ M.x86.R_CX -= 1;
+ M.x86.R_DI += inc;
+ }
+ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
} else {
- store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_AL);
- M.x86.R_DI += inc;
+ store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_AL);
+ M.x86.R_DI += inc;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -7546,34 +7546,34 @@ void x86emuOp_stos_word(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("STOS\tDWORD\n");
- if (ACCESS_FLAG(F_DF)) /* down */
- inc = -4;
- else
- inc = 4;
+ DECODE_PRINTF("STOS\tDWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -4;
+ else
+ inc = 4;
} else {
- DECODE_PRINTF("STOS\tWORD\n");
- if (ACCESS_FLAG(F_DF)) /* down */
- inc = -2;
- else
- inc = 2;
+ DECODE_PRINTF("STOS\tWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -2;
+ else
+ inc = 2;
}
TRACE_AND_STEP();
count = 1;
if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
- /* dont care whether REPE or REPNE */
- /* move them until CX is ZERO. */
- count = M.x86.R_CX;
- M.x86.R_CX = 0;
- M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
+ /* dont care whether REPE or REPNE */
+ /* move them until CX is ZERO. */
+ count = M.x86.R_CX;
+ M.x86.R_CX = 0;
+ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
}
while (count--) {
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- store_data_long_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_EAX);
- } else {
- store_data_word_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_AX);
- }
- M.x86.R_DI += inc;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ store_data_long_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_EAX);
+ } else {
+ store_data_word_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_AX);
+ }
+ M.x86.R_DI += inc;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -7591,21 +7591,21 @@ void x86emuOp_lods_byte(u8 X86EMU_UNUSED(op1))
DECODE_PRINTF("LODS\tBYTE\n");
TRACE_AND_STEP();
if (ACCESS_FLAG(F_DF)) /* down */
- inc = -1;
+ inc = -1;
else
- inc = 1;
+ inc = 1;
if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
- /* dont care whether REPE or REPNE */
- /* move them until CX is ZERO. */
- while (M.x86.R_CX != 0) {
- M.x86.R_AL = fetch_data_byte(M.x86.R_SI);
- M.x86.R_CX -= 1;
- M.x86.R_SI += inc;
- }
- M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
+ /* dont care whether REPE or REPNE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ M.x86.R_AL = fetch_data_byte(M.x86.R_SI);
+ M.x86.R_CX -= 1;
+ M.x86.R_SI += inc;
+ }
+ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
} else {
- M.x86.R_AL = fetch_data_byte(M.x86.R_SI);
- M.x86.R_SI += inc;
+ M.x86.R_AL = fetch_data_byte(M.x86.R_SI);
+ M.x86.R_SI += inc;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -7622,34 +7622,34 @@ void x86emuOp_lods_word(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("LODS\tDWORD\n");
- if (ACCESS_FLAG(F_DF)) /* down */
- inc = -4;
- else
- inc = 4;
+ DECODE_PRINTF("LODS\tDWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -4;
+ else
+ inc = 4;
} else {
- DECODE_PRINTF("LODS\tWORD\n");
- if (ACCESS_FLAG(F_DF)) /* down */
- inc = -2;
- else
- inc = 2;
+ DECODE_PRINTF("LODS\tWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -2;
+ else
+ inc = 2;
}
TRACE_AND_STEP();
count = 1;
if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
- /* dont care whether REPE or REPNE */
- /* move them until CX is ZERO. */
- count = M.x86.R_CX;
- M.x86.R_CX = 0;
- M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
+ /* dont care whether REPE or REPNE */
+ /* move them until CX is ZERO. */
+ count = M.x86.R_CX;
+ M.x86.R_CX = 0;
+ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
}
while (count--) {
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = fetch_data_long(M.x86.R_SI);
- } else {
- M.x86.R_AX = fetch_data_word(M.x86.R_SI);
- }
- M.x86.R_SI += inc;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = fetch_data_long(M.x86.R_SI);
+ } else {
+ M.x86.R_AX = fetch_data_word(M.x86.R_SI);
+ }
+ M.x86.R_SI += inc;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -7668,37 +7668,37 @@ void x86emuOp_scas_byte(u8 X86EMU_UNUSED(op1))
DECODE_PRINTF("SCAS\tBYTE\n");
TRACE_AND_STEP();
if (ACCESS_FLAG(F_DF)) /* down */
- inc = -1;
+ inc = -1;
else
- inc = 1;
+ inc = 1;
if (M.x86.mode & SYSMODE_PREFIX_REPE) {
- /* REPE */
- /* move them until CX is ZERO. */
- while (M.x86.R_CX != 0) {
- val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_byte(M.x86.R_AL, val2);
- M.x86.R_CX -= 1;
- M.x86.R_DI += inc;
- if (ACCESS_FLAG(F_ZF) == 0)
- break;
- }
- M.x86.mode &= ~SYSMODE_PREFIX_REPE;
+ /* REPE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_byte(M.x86.R_AL, val2);
+ M.x86.R_CX -= 1;
+ M.x86.R_DI += inc;
+ if (ACCESS_FLAG(F_ZF) == 0)
+ break;
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPE;
} else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
- /* REPNE */
- /* move them until CX is ZERO. */
- while (M.x86.R_CX != 0) {
- val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_byte(M.x86.R_AL, val2);
- M.x86.R_CX -= 1;
- M.x86.R_DI += inc;
- if (ACCESS_FLAG(F_ZF))
- break; /* zero flag set means equal */
- }
- M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
+ /* REPNE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_byte(M.x86.R_AL, val2);
+ M.x86.R_CX -= 1;
+ M.x86.R_DI += inc;
+ if (ACCESS_FLAG(F_ZF))
+ break; /* zero flag set means equal */
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
} else {
- val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_byte(M.x86.R_AL, val2);
- M.x86.R_DI += inc;
+ val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_byte(M.x86.R_AL, val2);
+ M.x86.R_DI += inc;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -7715,62 +7715,62 @@ void x86emuOp_scas_word(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("SCAS\tDWORD\n");
- if (ACCESS_FLAG(F_DF)) /* down */
- inc = -4;
- else
- inc = 4;
+ DECODE_PRINTF("SCAS\tDWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -4;
+ else
+ inc = 4;
} else {
- DECODE_PRINTF("SCAS\tWORD\n");
- if (ACCESS_FLAG(F_DF)) /* down */
- inc = -2;
- else
- inc = 2;
+ DECODE_PRINTF("SCAS\tWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -2;
+ else
+ inc = 2;
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_REPE) {
- /* REPE */
- /* move them until CX is ZERO. */
- while (M.x86.R_CX != 0) {
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_long(M.x86.R_EAX, val);
- } else {
- val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_word(M.x86.R_AX, (u16)val);
- }
- M.x86.R_CX -= 1;
- M.x86.R_DI += inc;
- if (ACCESS_FLAG(F_ZF) == 0)
- break;
- }
- M.x86.mode &= ~SYSMODE_PREFIX_REPE;
+ /* REPE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_long(M.x86.R_EAX, val);
+ } else {
+ val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_word(M.x86.R_AX, (u16)val);
+ }
+ M.x86.R_CX -= 1;
+ M.x86.R_DI += inc;
+ if (ACCESS_FLAG(F_ZF) == 0)
+ break;
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPE;
} else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
- /* REPNE */
- /* move them until CX is ZERO. */
- while (M.x86.R_CX != 0) {
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_long(M.x86.R_EAX, val);
- } else {
- val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_word(M.x86.R_AX, (u16)val);
- }
- M.x86.R_CX -= 1;
- M.x86.R_DI += inc;
- if (ACCESS_FLAG(F_ZF))
- break; /* zero flag set means equal */
- }
- M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
+ /* REPNE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_long(M.x86.R_EAX, val);
+ } else {
+ val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_word(M.x86.R_AX, (u16)val);
+ }
+ M.x86.R_CX -= 1;
+ M.x86.R_DI += inc;
+ if (ACCESS_FLAG(F_ZF))
+ break; /* zero flag set means equal */
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
} else {
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_long(M.x86.R_EAX, val);
- } else {
- val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_word(M.x86.R_AX, (u16)val);
- }
- M.x86.R_DI += inc;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_long(M.x86.R_EAX, val);
+ } else {
+ val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_word(M.x86.R_AX, (u16)val);
+ }
+ M.x86.R_DI += inc;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -7930,18 +7930,18 @@ void x86emuOp_mov_word_AX_IMM(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("MOV\tEAX,");
- srcval = fetch_long_imm();
+ DECODE_PRINTF("MOV\tEAX,");
+ srcval = fetch_long_imm();
} else {
- DECODE_PRINTF("MOV\tAX,");
- srcval = fetch_word_imm();
+ DECODE_PRINTF("MOV\tAX,");
+ srcval = fetch_word_imm();
}
DECODE_PRINTF2("%x\n", srcval);
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = srcval;
+ M.x86.R_EAX = srcval;
} else {
- M.x86.R_AX = (u16)srcval;
+ M.x86.R_AX = (u16)srcval;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -7957,18 +7957,18 @@ void x86emuOp_mov_word_CX_IMM(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("MOV\tECX,");
- srcval = fetch_long_imm();
+ DECODE_PRINTF("MOV\tECX,");
+ srcval = fetch_long_imm();
} else {
- DECODE_PRINTF("MOV\tCX,");
- srcval = fetch_word_imm();
+ DECODE_PRINTF("MOV\tCX,");
+ srcval = fetch_word_imm();
}
DECODE_PRINTF2("%x\n", srcval);
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_ECX = srcval;
+ M.x86.R_ECX = srcval;
} else {
- M.x86.R_CX = (u16)srcval;
+ M.x86.R_CX = (u16)srcval;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -7984,18 +7984,18 @@ void x86emuOp_mov_word_DX_IMM(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("MOV\tEDX,");
- srcval = fetch_long_imm();
+ DECODE_PRINTF("MOV\tEDX,");
+ srcval = fetch_long_imm();
} else {
- DECODE_PRINTF("MOV\tDX,");
- srcval = fetch_word_imm();
+ DECODE_PRINTF("MOV\tDX,");
+ srcval = fetch_word_imm();
}
DECODE_PRINTF2("%x\n", srcval);
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EDX = srcval;
+ M.x86.R_EDX = srcval;
} else {
- M.x86.R_DX = (u16)srcval;
+ M.x86.R_DX = (u16)srcval;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -8011,18 +8011,18 @@ void x86emuOp_mov_word_BX_IMM(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("MOV\tEBX,");
- srcval = fetch_long_imm();
+ DECODE_PRINTF("MOV\tEBX,");
+ srcval = fetch_long_imm();
} else {
- DECODE_PRINTF("MOV\tBX,");
- srcval = fetch_word_imm();
+ DECODE_PRINTF("MOV\tBX,");
+ srcval = fetch_word_imm();
}
DECODE_PRINTF2("%x\n", srcval);
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EBX = srcval;
+ M.x86.R_EBX = srcval;
} else {
- M.x86.R_BX = (u16)srcval;
+ M.x86.R_BX = (u16)srcval;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -8038,18 +8038,18 @@ void x86emuOp_mov_word_SP_IMM(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("MOV\tESP,");
- srcval = fetch_long_imm();
+ DECODE_PRINTF("MOV\tESP,");
+ srcval = fetch_long_imm();
} else {
- DECODE_PRINTF("MOV\tSP,");
- srcval = fetch_word_imm();
+ DECODE_PRINTF("MOV\tSP,");
+ srcval = fetch_word_imm();
}
DECODE_PRINTF2("%x\n", srcval);
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_ESP = srcval;
+ M.x86.R_ESP = srcval;
} else {
- M.x86.R_SP = (u16)srcval;
+ M.x86.R_SP = (u16)srcval;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -8065,18 +8065,18 @@ void x86emuOp_mov_word_BP_IMM(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("MOV\tEBP,");
- srcval = fetch_long_imm();
+ DECODE_PRINTF("MOV\tEBP,");
+ srcval = fetch_long_imm();
} else {
- DECODE_PRINTF("MOV\tBP,");
- srcval = fetch_word_imm();
+ DECODE_PRINTF("MOV\tBP,");
+ srcval = fetch_word_imm();
}
DECODE_PRINTF2("%x\n", srcval);
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EBP = srcval;
+ M.x86.R_EBP = srcval;
} else {
- M.x86.R_BP = (u16)srcval;
+ M.x86.R_BP = (u16)srcval;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -8092,18 +8092,18 @@ void x86emuOp_mov_word_SI_IMM(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("MOV\tESI,");
- srcval = fetch_long_imm();
+ DECODE_PRINTF("MOV\tESI,");
+ srcval = fetch_long_imm();
} else {
- DECODE_PRINTF("MOV\tSI,");
- srcval = fetch_word_imm();
+ DECODE_PRINTF("MOV\tSI,");
+ srcval = fetch_word_imm();
}
DECODE_PRINTF2("%x\n", srcval);
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_ESI = srcval;
+ M.x86.R_ESI = srcval;
} else {
- M.x86.R_SI = (u16)srcval;
+ M.x86.R_SI = (u16)srcval;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -8119,18 +8119,18 @@ void x86emuOp_mov_word_DI_IMM(u8 X86EMU_UNUSED(op1))
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("MOV\tEDI,");
- srcval = fetch_long_imm();
+ DECODE_PRINTF("MOV\tEDI,");
+ srcval = fetch_long_imm();
} else {
- DECODE_PRINTF("MOV\tDI,");
- srcval = fetch_word_imm();
+ DECODE_PRINTF("MOV\tDI,");
+ srcval = fetch_word_imm();
}
DECODE_PRINTF2("%x\n", srcval);
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EDI = srcval;
+ M.x86.R_EDI = srcval;
} else {
- M.x86.R_DI = (u16)srcval;
+ M.x86.R_DI = (u16)srcval;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -8170,80 +8170,80 @@ void x86emuOp_opcC0_byte_RM_MEM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
#ifdef DEBUG
if (DEBUG_DECODE()) {
- /* XXX DECODE_PRINTF may be changed to something more
- general, so that it is important to leave the strings
- in the same format, even though the result is that the
- above test is done twice. */
-
- switch (rh) {
- case 0:
- DECODE_PRINTF("ROL\t");
- break;
- case 1:
- DECODE_PRINTF("ROR\t");
- break;
- case 2:
- DECODE_PRINTF("RCL\t");
- break;
- case 3:
- DECODE_PRINTF("RCR\t");
- break;
- case 4:
- DECODE_PRINTF("SHL\t");
- break;
- case 5:
- DECODE_PRINTF("SHR\t");
- break;
- case 6:
- DECODE_PRINTF("SAL\t");
- break;
- case 7:
- DECODE_PRINTF("SAR\t");
- break;
- }
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ROL\t");
+ break;
+ case 1:
+ DECODE_PRINTF("ROR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("RCL\t");
+ break;
+ case 3:
+ DECODE_PRINTF("RCR\t");
+ break;
+ case 4:
+ DECODE_PRINTF("SHL\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SHR\t");
+ break;
+ case 6:
+ DECODE_PRINTF("SAL\t");
+ break;
+ case 7:
+ DECODE_PRINTF("SAR\t");
+ break;
+ }
}
#endif
/* know operation, decode the mod byte to find the addressing
mode. */
switch (mod) {
case 0:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm00_address(rl);
- amt = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", amt);
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD0_byte_operation[rh]) (destval, amt);
- store_data_byte(destoffset, destval);
- break;
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, amt);
+ store_data_byte(destoffset, destval);
+ break;
case 1:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm01_address(rl);
- amt = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", amt);
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD0_byte_operation[rh]) (destval, amt);
- store_data_byte(destoffset, destval);
- break;
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, amt);
+ store_data_byte(destoffset, destval);
+ break;
case 2:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm10_address(rl);
- amt = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", amt);
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD0_byte_operation[rh]) (destval, amt);
- store_data_byte(destoffset, destval);
- break;
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, amt);
+ store_data_byte(destoffset, destval);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- amt = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", amt);
- TRACE_AND_STEP();
- destval = (*opcD0_byte_operation[rh]) (*destreg, amt);
- *destreg = destval;
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (*destreg, amt);
+ *destreg = destval;
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -8294,136 +8294,136 @@ void x86emuOp_opcC1_word_RM_MEM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
#ifdef DEBUG
if (DEBUG_DECODE()) {
- /* XXX DECODE_PRINTF may be changed to something more
- general, so that it is important to leave the strings
- in the same format, even though the result is that the
- above test is done twice. */
-
- switch (rh) {
- case 0:
- DECODE_PRINTF("ROL\t");
- break;
- case 1:
- DECODE_PRINTF("ROR\t");
- break;
- case 2:
- DECODE_PRINTF("RCL\t");
- break;
- case 3:
- DECODE_PRINTF("RCR\t");
- break;
- case 4:
- DECODE_PRINTF("SHL\t");
- break;
- case 5:
- DECODE_PRINTF("SHR\t");
- break;
- case 6:
- DECODE_PRINTF("SAL\t");
- break;
- case 7:
- DECODE_PRINTF("SAR\t");
- break;
- }
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ROL\t");
+ break;
+ case 1:
+ DECODE_PRINTF("ROR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("RCL\t");
+ break;
+ case 3:
+ DECODE_PRINTF("RCR\t");
+ break;
+ case 4:
+ DECODE_PRINTF("SHL\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SHR\t");
+ break;
+ case 6:
+ DECODE_PRINTF("SAL\t");
+ break;
+ case 7:
+ DECODE_PRINTF("SAR\t");
+ break;
+ }
}
#endif
/* know operation, decode the mod byte to find the addressing
mode. */
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm00_address(rl);
- amt = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", amt);
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_long_operation[rh]) (destval, amt);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm00_address(rl);
- amt = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", amt);
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_word_operation[rh]) (destval, amt);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, amt);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, amt);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm01_address(rl);
- amt = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", amt);
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_long_operation[rh]) (destval, amt);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm01_address(rl);
- amt = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", amt);
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_word_operation[rh]) (destval, amt);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, amt);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, amt);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm10_address(rl);
- amt = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", amt);
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_long_operation[rh]) (destval, amt);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm10_address(rl);
- amt = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", amt);
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_word_operation[rh]) (destval, amt);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, amt);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, amt);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
- destreg = DECODE_RM_LONG_REGISTER(rl);
- amt = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", amt);
- TRACE_AND_STEP();
- *destreg = (*opcD1_long_operation[rh]) (*destreg, amt);
- } else {
- u16 *destreg;
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ TRACE_AND_STEP();
+ *destreg = (*opcD1_long_operation[rh]) (*destreg, amt);
+ } else {
+ u16 *destreg;
- destreg = DECODE_RM_WORD_REGISTER(rl);
- amt = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", amt);
- TRACE_AND_STEP();
- *destreg = (*opcD1_word_operation[rh]) (*destreg, amt);
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ TRACE_AND_STEP();
+ *destreg = (*opcD1_word_operation[rh]) (*destreg, amt);
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -8479,35 +8479,35 @@ void x86emuOp_les_R_IMM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *dstreg = fetch_data_word(srcoffset);
- M.x86.R_ES = fetch_data_word(srcoffset + 2);
- break;
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_ES = fetch_data_word(srcoffset + 2);
+ break;
case 1:
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *dstreg = fetch_data_word(srcoffset);
- M.x86.R_ES = fetch_data_word(srcoffset + 2);
- break;
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_ES = fetch_data_word(srcoffset + 2);
+ break;
case 2:
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *dstreg = fetch_data_word(srcoffset);
- M.x86.R_ES = fetch_data_word(srcoffset + 2);
- break;
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_ES = fetch_data_word(srcoffset + 2);
+ break;
case 3: /* register to register */
- /* UNDEFINED! */
- TRACE_AND_STEP();
+ /* UNDEFINED! */
+ TRACE_AND_STEP();
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -8528,35 +8528,35 @@ void x86emuOp_lds_R_IMM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *dstreg = fetch_data_word(srcoffset);
- M.x86.R_DS = fetch_data_word(srcoffset + 2);
- break;
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_DS = fetch_data_word(srcoffset + 2);
+ break;
case 1:
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *dstreg = fetch_data_word(srcoffset);
- M.x86.R_DS = fetch_data_word(srcoffset + 2);
- break;
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_DS = fetch_data_word(srcoffset + 2);
+ break;
case 2:
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *dstreg = fetch_data_word(srcoffset);
- M.x86.R_DS = fetch_data_word(srcoffset + 2);
- break;
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_DS = fetch_data_word(srcoffset + 2);
+ break;
case 3: /* register to register */
- /* UNDEFINED! */
- TRACE_AND_STEP();
+ /* UNDEFINED! */
+ TRACE_AND_STEP();
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -8577,41 +8577,41 @@ void x86emuOp_mov_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
DECODE_PRINTF("MOV\t");
FETCH_DECODE_MODRM(mod, rh, rl);
if (rh != 0) {
- DECODE_PRINTF("ILLEGAL DECODE OF OPCODE c6\n");
- HALT_SYS();
+ DECODE_PRINTF("ILLEGAL DECODE OF OPCODE c6\n");
+ HALT_SYS();
}
switch (mod) {
case 0:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm00_address(rl);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%2x\n", imm);
- TRACE_AND_STEP();
- store_data_byte(destoffset, imm);
- break;
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%2x\n", imm);
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, imm);
+ break;
case 1:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm01_address(rl);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%2x\n", imm);
- TRACE_AND_STEP();
- store_data_byte(destoffset, imm);
- break;
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%2x\n", imm);
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, imm);
+ break;
case 2:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm10_address(rl);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%2x\n", imm);
- TRACE_AND_STEP();
- store_data_byte(destoffset, imm);
- break;
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%2x\n", imm);
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, imm);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%2x\n", imm);
- TRACE_AND_STEP();
- *destreg = imm;
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%2x\n", imm);
+ TRACE_AND_STEP();
+ *destreg = imm;
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -8630,94 +8630,94 @@ void x86emuOp_mov_word_RM_IMM(u8 X86EMU_UNUSED(op1))
DECODE_PRINTF("MOV\t");
FETCH_DECODE_MODRM(mod, rh, rl);
if (rh != 0) {
- DECODE_PRINTF("ILLEGAL DECODE OF OPCODE 8F\n");
- HALT_SYS();
+ DECODE_PRINTF("ILLEGAL DECODE OF OPCODE 8F\n");
+ HALT_SYS();
}
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 imm;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm00_address(rl);
- imm = fetch_long_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- store_data_long(destoffset, imm);
- } else {
- u16 imm;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm00_address(rl);
- imm = fetch_word_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- store_data_word(destoffset, imm);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ store_data_long(destoffset, imm);
+ } else {
+ u16 imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ store_data_word(destoffset, imm);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 imm;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm01_address(rl);
- imm = fetch_long_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- store_data_long(destoffset, imm);
- } else {
- u16 imm;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm01_address(rl);
- imm = fetch_word_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- store_data_word(destoffset, imm);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ store_data_long(destoffset, imm);
+ } else {
+ u16 imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ store_data_word(destoffset, imm);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 imm;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm10_address(rl);
- imm = fetch_long_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- store_data_long(destoffset, imm);
- } else {
- u16 imm;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm10_address(rl);
- imm = fetch_word_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- store_data_word(destoffset, imm);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ store_data_long(destoffset, imm);
+ } else {
+ u16 imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ store_data_word(destoffset, imm);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
u32 *destreg;
u32 imm;
- destreg = DECODE_RM_LONG_REGISTER(rl);
- imm = fetch_long_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- *destreg = imm;
- } else {
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ *destreg = imm;
+ } else {
u16 *destreg;
u16 imm;
- destreg = DECODE_RM_WORD_REGISTER(rl);
- imm = fetch_word_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- *destreg = imm;
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ *destreg = imm;
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -8742,12 +8742,12 @@ void x86emuOp_enter(u8 X86EMU_UNUSED(op1))
push_word(M.x86.R_BP);
frame_pointer = M.x86.R_SP;
if (nesting > 0) {
- for (i = 1; i < nesting; i++) {
- M.x86.R_BP -= 2;
- push_word(fetch_data_word_abs(M.x86.R_SS, M.x86.R_BP));
- }
- push_word(frame_pointer);
- }
+ for (i = 1; i < nesting; i++) {
+ M.x86.R_BP -= 2;
+ push_word(fetch_data_word_abs(M.x86.R_SS, M.x86.R_BP));
+ }
+ push_word(frame_pointer);
+ }
M.x86.R_BP = frame_pointer;
M.x86.R_SP = (u16)(M.x86.R_SP - local);
DECODE_CLEAR_SEGOVR();
@@ -8822,13 +8822,13 @@ void x86emuOp_int3(u8 X86EMU_UNUSED(op1))
if (_X86EMU_intrTab[3]) {
(*_X86EMU_intrTab[3])(3);
} else {
- push_word((u16)M.x86.R_FLG);
- CLEAR_FLAG(F_IF);
- CLEAR_FLAG(F_TF);
- push_word(M.x86.R_CS);
- M.x86.R_CS = mem_access_word(3 * 4 + 2);
- push_word(M.x86.R_IP);
- M.x86.R_IP = mem_access_word(3 * 4);
+ push_word((u16)M.x86.R_FLG);
+ CLEAR_FLAG(F_IF);
+ CLEAR_FLAG(F_TF);
+ push_word(M.x86.R_CS);
+ M.x86.R_CS = mem_access_word(3 * 4 + 2);
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = mem_access_word(3 * 4);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -8852,13 +8852,13 @@ void x86emuOp_int_IMM(u8 X86EMU_UNUSED(op1))
if (_X86EMU_intrTab[intnum]) {
(*_X86EMU_intrTab[intnum])(intnum);
} else {
- push_word((u16)M.x86.R_FLG);
- CLEAR_FLAG(F_IF);
- CLEAR_FLAG(F_TF);
- push_word(M.x86.R_CS);
- M.x86.R_CS = mem_access_word(intnum * 4 + 2);
- push_word(M.x86.R_IP);
- M.x86.R_IP = mem_access_word(intnum * 4);
+ push_word((u16)M.x86.R_FLG);
+ CLEAR_FLAG(F_IF);
+ CLEAR_FLAG(F_TF);
+ push_word(M.x86.R_CS);
+ M.x86.R_CS = mem_access_word(intnum * 4 + 2);
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = mem_access_word(intnum * 4);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -8876,18 +8876,18 @@ void x86emuOp_into(u8 X86EMU_UNUSED(op1))
DECODE_PRINTF("INTO\n");
TRACE_AND_STEP();
if (ACCESS_FLAG(F_OF)) {
- tmp = mem_access_word(4 * 4 + 2);
+ tmp = mem_access_word(4 * 4 + 2);
if (_X86EMU_intrTab[4]) {
(*_X86EMU_intrTab[4])(4);
- } else {
- push_word((u16)M.x86.R_FLG);
- CLEAR_FLAG(F_IF);
- CLEAR_FLAG(F_TF);
- push_word(M.x86.R_CS);
- M.x86.R_CS = mem_access_word(4 * 4 + 2);
- push_word(M.x86.R_IP);
- M.x86.R_IP = mem_access_word(4 * 4);
- }
+ } else {
+ push_word((u16)M.x86.R_FLG);
+ CLEAR_FLAG(F_IF);
+ CLEAR_FLAG(F_TF);
+ push_word(M.x86.R_CS);
+ M.x86.R_CS = mem_access_word(4 * 4 + 2);
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = mem_access_word(4 * 4);
+ }
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -8931,75 +8931,75 @@ void x86emuOp_opcD0_byte_RM_1(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
#ifdef DEBUG
if (DEBUG_DECODE()) {
- /* XXX DECODE_PRINTF may be changed to something more
- general, so that it is important to leave the strings
- in the same format, even though the result is that the
- above test is done twice. */
- switch (rh) {
- case 0:
- DECODE_PRINTF("ROL\t");
- break;
- case 1:
- DECODE_PRINTF("ROR\t");
- break;
- case 2:
- DECODE_PRINTF("RCL\t");
- break;
- case 3:
- DECODE_PRINTF("RCR\t");
- break;
- case 4:
- DECODE_PRINTF("SHL\t");
- break;
- case 5:
- DECODE_PRINTF("SHR\t");
- break;
- case 6:
- DECODE_PRINTF("SAL\t");
- break;
- case 7:
- DECODE_PRINTF("SAR\t");
- break;
- }
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ROL\t");
+ break;
+ case 1:
+ DECODE_PRINTF("ROR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("RCL\t");
+ break;
+ case 3:
+ DECODE_PRINTF("RCR\t");
+ break;
+ case 4:
+ DECODE_PRINTF("SHL\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SHR\t");
+ break;
+ case 6:
+ DECODE_PRINTF("SAL\t");
+ break;
+ case 7:
+ DECODE_PRINTF("SAR\t");
+ break;
+ }
}
#endif
/* know operation, decode the mod byte to find the addressing
mode. */
switch (mod) {
case 0:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",1\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD0_byte_operation[rh]) (destval, 1);
- store_data_byte(destoffset, destval);
- break;
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, 1);
+ store_data_byte(destoffset, destval);
+ break;
case 1:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",1\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD0_byte_operation[rh]) (destval, 1);
- store_data_byte(destoffset, destval);
- break;
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, 1);
+ store_data_byte(destoffset, destval);
+ break;
case 2:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",1\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD0_byte_operation[rh]) (destval, 1);
- store_data_byte(destoffset, destval);
- break;
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, 1);
+ store_data_byte(destoffset, destval);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",1\n");
- TRACE_AND_STEP();
- destval = (*opcD0_byte_operation[rh]) (*destreg, 1);
- *destreg = destval;
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",1\n");
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (*destreg, 1);
+ *destreg = destval;
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -9023,131 +9023,131 @@ void x86emuOp_opcD1_word_RM_1(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
#ifdef DEBUG
if (DEBUG_DECODE()) {
- /* XXX DECODE_PRINTF may be changed to something more
- general, so that it is important to leave the strings
- in the same format, even though the result is that the
- above test is done twice. */
- switch (rh) {
- case 0:
- DECODE_PRINTF("ROL\t");
- break;
- case 1:
- DECODE_PRINTF("ROR\t");
- break;
- case 2:
- DECODE_PRINTF("RCL\t");
- break;
- case 3:
- DECODE_PRINTF("RCR\t");
- break;
- case 4:
- DECODE_PRINTF("SHL\t");
- break;
- case 5:
- DECODE_PRINTF("SHR\t");
- break;
- case 6:
- DECODE_PRINTF("SAL\t");
- break;
- case 7:
- DECODE_PRINTF("SAR\t");
- break;
- }
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ROL\t");
+ break;
+ case 1:
+ DECODE_PRINTF("ROR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("RCL\t");
+ break;
+ case 3:
+ DECODE_PRINTF("RCR\t");
+ break;
+ case 4:
+ DECODE_PRINTF("SHL\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SHR\t");
+ break;
+ case 6:
+ DECODE_PRINTF("SAL\t");
+ break;
+ case 7:
+ DECODE_PRINTF("SAR\t");
+ break;
+ }
}
#endif
/* know operation, decode the mod byte to find the addressing
mode. */
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",1\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_long_operation[rh]) (destval, 1);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",1\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_word_operation[rh]) (destval, 1);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, 1);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, 1);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",1\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_long_operation[rh]) (destval, 1);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",1\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_word_operation[rh]) (destval, 1);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, 1);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, 1);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",1\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_long_operation[rh]) (destval, 1);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",1\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_word_operation[rh]) (destval, 1);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, 1);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, 1);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
u32 destval;
u32 *destreg;
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",1\n");
- TRACE_AND_STEP();
- destval = (*opcD1_long_operation[rh]) (*destreg, 1);
- *destreg = destval;
- } else {
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",1\n");
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (*destreg, 1);
+ *destreg = destval;
+ } else {
u16 destval;
u16 *destreg;
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",1\n");
- TRACE_AND_STEP();
- destval = (*opcD1_word_operation[rh]) (*destreg, 1);
- *destreg = destval;
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",1\n");
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (*destreg, 1);
+ *destreg = destval;
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -9174,36 +9174,36 @@ void x86emuOp_opcD2_byte_RM_CL(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
#ifdef DEBUG
if (DEBUG_DECODE()) {
- /* XXX DECODE_PRINTF may be changed to something more
- general, so that it is important to leave the strings
- in the same format, even though the result is that the
- above test is done twice. */
- switch (rh) {
- case 0:
- DECODE_PRINTF("ROL\t");
- break;
- case 1:
- DECODE_PRINTF("ROR\t");
- break;
- case 2:
- DECODE_PRINTF("RCL\t");
- break;
- case 3:
- DECODE_PRINTF("RCR\t");
- break;
- case 4:
- DECODE_PRINTF("SHL\t");
- break;
- case 5:
- DECODE_PRINTF("SHR\t");
- break;
- case 6:
- DECODE_PRINTF("SAL\t");
- break;
- case 7:
- DECODE_PRINTF("SAR\t");
- break;
- }
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ROL\t");
+ break;
+ case 1:
+ DECODE_PRINTF("ROR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("RCL\t");
+ break;
+ case 3:
+ DECODE_PRINTF("RCR\t");
+ break;
+ case 4:
+ DECODE_PRINTF("SHL\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SHR\t");
+ break;
+ case 6:
+ DECODE_PRINTF("SAL\t");
+ break;
+ case 7:
+ DECODE_PRINTF("SAR\t");
+ break;
+ }
}
#endif
/* know operation, decode the mod byte to find the addressing
@@ -9211,39 +9211,39 @@ void x86emuOp_opcD2_byte_RM_CL(u8 X86EMU_UNUSED(op1))
amt = M.x86.R_CL;
switch (mod) {
case 0:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",CL\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD0_byte_operation[rh]) (destval, amt);
- store_data_byte(destoffset, destval);
- break;
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, amt);
+ store_data_byte(destoffset, destval);
+ break;
case 1:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",CL\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD0_byte_operation[rh]) (destval, amt);
- store_data_byte(destoffset, destval);
- break;
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, amt);
+ store_data_byte(destoffset, destval);
+ break;
case 2:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",CL\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD0_byte_operation[rh]) (destval, amt);
- store_data_byte(destoffset, destval);
- break;
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, amt);
+ store_data_byte(destoffset, destval);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",CL\n");
- TRACE_AND_STEP();
- destval = (*opcD0_byte_operation[rh]) (*destreg, amt);
- *destreg = destval;
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (*destreg, amt);
+ *destreg = destval;
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -9268,36 +9268,36 @@ void x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
#ifdef DEBUG
if (DEBUG_DECODE()) {
- /* XXX DECODE_PRINTF may be changed to something more
- general, so that it is important to leave the strings
- in the same format, even though the result is that the
- above test is done twice. */
- switch (rh) {
- case 0:
- DECODE_PRINTF("ROL\t");
- break;
- case 1:
- DECODE_PRINTF("ROR\t");
- break;
- case 2:
- DECODE_PRINTF("RCL\t");
- break;
- case 3:
- DECODE_PRINTF("RCR\t");
- break;
- case 4:
- DECODE_PRINTF("SHL\t");
- break;
- case 5:
- DECODE_PRINTF("SHR\t");
- break;
- case 6:
- DECODE_PRINTF("SAL\t");
- break;
- case 7:
- DECODE_PRINTF("SAR\t");
- break;
- }
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ROL\t");
+ break;
+ case 1:
+ DECODE_PRINTF("ROR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("RCL\t");
+ break;
+ case 3:
+ DECODE_PRINTF("RCR\t");
+ break;
+ case 4:
+ DECODE_PRINTF("SHL\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SHR\t");
+ break;
+ case 6:
+ DECODE_PRINTF("SAL\t");
+ break;
+ case 7:
+ DECODE_PRINTF("SAR\t");
+ break;
+ }
}
#endif
/* know operation, decode the mod byte to find the addressing
@@ -9305,91 +9305,91 @@ void x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1))
amt = M.x86.R_CL;
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",CL\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_long_operation[rh]) (destval, amt);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",CL\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_word_operation[rh]) (destval, amt);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, amt);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, amt);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",CL\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_long_operation[rh]) (destval, amt);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",CL\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_word_operation[rh]) (destval, amt);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, amt);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, amt);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",CL\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_long_operation[rh]) (destval, amt);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",CL\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_word_operation[rh]) (destval, amt);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, amt);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, amt);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",CL\n");
- TRACE_AND_STEP();
- *destreg = (*opcD1_long_operation[rh]) (*destreg, amt);
- } else {
- u16 *destreg;
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ *destreg = (*opcD1_long_operation[rh]) (*destreg, amt);
+ } else {
+ u16 *destreg;
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",CL\n");
- TRACE_AND_STEP();
- *destreg = (*opcD1_word_operation[rh]) (*destreg, amt);
- }
- break;
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ *destreg = (*opcD1_word_operation[rh]) (*destreg, amt);
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -9407,9 +9407,9 @@ void x86emuOp_aam(u8 X86EMU_UNUSED(op1))
DECODE_PRINTF("AAM\n");
a = fetch_byte_imm(); /* this is a stupid encoding. */
if (a != 10) {
- DECODE_PRINTF("ERROR DECODING AAM\n");
- TRACE_REGS();
- HALT_SYS();
+ DECODE_PRINTF("ERROR DECODING AAM\n");
+ TRACE_REGS();
+ HALT_SYS();
}
TRACE_AND_STEP();
/* note the type change here --- returning AL and AH in AX. */
@@ -9472,7 +9472,7 @@ void x86emuOp_loopne(u8 X86EMU_UNUSED(op1))
TRACE_AND_STEP();
M.x86.R_CX -= 1;
if (M.x86.R_CX != 0 && !ACCESS_FLAG(F_ZF)) /* CX != 0 and !ZF */
- M.x86.R_IP = ip;
+ M.x86.R_IP = ip;
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
}
@@ -9493,7 +9493,7 @@ void x86emuOp_loope(u8 X86EMU_UNUSED(op1))
TRACE_AND_STEP();
M.x86.R_CX -= 1;
if (M.x86.R_CX != 0 && ACCESS_FLAG(F_ZF)) /* CX != 0 and ZF */
- M.x86.R_IP = ip;
+ M.x86.R_IP = ip;
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
}
@@ -9514,7 +9514,7 @@ void x86emuOp_loop(u8 X86EMU_UNUSED(op1))
TRACE_AND_STEP();
M.x86.R_CX -= 1;
if (M.x86.R_CX != 0)
- M.x86.R_IP = ip;
+ M.x86.R_IP = ip;
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
}
@@ -9536,7 +9536,7 @@ void x86emuOp_jcxz(u8 X86EMU_UNUSED(op1))
DECODE_PRINTF2("%x\n", target);
TRACE_AND_STEP();
if (M.x86.R_CX == 0)
- M.x86.R_IP = target;
+ M.x86.R_IP = target;
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
}
@@ -9571,15 +9571,15 @@ void x86emuOp_in_word_AX_IMM(u8 X86EMU_UNUSED(op1))
DECODE_PRINTF("IN\t");
port = (u8) fetch_byte_imm();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF2("EAX,%x\n", port);
+ DECODE_PRINTF2("EAX,%x\n", port);
} else {
- DECODE_PRINTF2("AX,%x\n", port);
+ DECODE_PRINTF2("AX,%x\n", port);
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = (*sys_inl)(port);
+ M.x86.R_EAX = (*sys_inl)(port);
} else {
- M.x86.R_AX = (*sys_inw)(port);
+ M.x86.R_AX = (*sys_inw)(port);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -9615,15 +9615,15 @@ void x86emuOp_out_word_IMM_AX(u8 X86EMU_UNUSED(op1))
DECODE_PRINTF("OUT\t");
port = (u8) fetch_byte_imm();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF2("%x,EAX\n", port);
+ DECODE_PRINTF2("%x,EAX\n", port);
} else {
- DECODE_PRINTF2("%x,AX\n", port);
+ DECODE_PRINTF2("%x,AX\n", port);
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- (*sys_outl)(port, M.x86.R_EAX);
+ (*sys_outl)(port, M.x86.R_EAX);
} else {
- (*sys_outw)(port, M.x86.R_AX);
+ (*sys_outw)(port, M.x86.R_AX);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -9732,15 +9732,15 @@ void x86emuOp_in_word_AX_DX(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("IN\tEAX,DX\n");
+ DECODE_PRINTF("IN\tEAX,DX\n");
} else {
- DECODE_PRINTF("IN\tAX,DX\n");
+ DECODE_PRINTF("IN\tAX,DX\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = (*sys_inl)(M.x86.R_DX);
+ M.x86.R_EAX = (*sys_inl)(M.x86.R_DX);
} else {
- M.x86.R_AX = (*sys_inw)(M.x86.R_DX);
+ M.x86.R_AX = (*sys_inw)(M.x86.R_DX);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -9768,15 +9768,15 @@ void x86emuOp_out_word_DX_AX(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("OUT\tDX,EAX\n");
+ DECODE_PRINTF("OUT\tDX,EAX\n");
} else {
- DECODE_PRINTF("OUT\tDX,AX\n");
+ DECODE_PRINTF("OUT\tDX,AX\n");
}
TRACE_AND_STEP();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- (*sys_outl)(M.x86.R_DX, M.x86.R_EAX);
+ (*sys_outl)(M.x86.R_DX, M.x86.R_EAX);
} else {
- (*sys_outw)(M.x86.R_DX, M.x86.R_AX);
+ (*sys_outw)(M.x86.R_DX, M.x86.R_AX);
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -9871,268 +9871,268 @@ void x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0: /* mod=00 */
- switch (rh) {
- case 0: /* test byte imm */
- DECODE_PRINTF("TEST\tBYTE PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- srcval = fetch_byte_imm();
- DECODE_PRINTF2("%02x\n", srcval);
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- test_byte(destval, srcval);
- break;
- case 1:
- DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F6\n");
- HALT_SYS();
- break;
- case 2:
- DECODE_PRINTF("NOT\tBYTE PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = not_byte(destval);
- store_data_byte(destoffset, destval);
- break;
- case 3:
- DECODE_PRINTF("NEG\tBYTE PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = neg_byte(destval);
- store_data_byte(destoffset, destval);
- break;
- case 4:
- DECODE_PRINTF("MUL\tBYTE PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- mul_byte(destval);
- break;
- case 5:
- DECODE_PRINTF("IMUL\tBYTE PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- imul_byte(destval);
- break;
- case 6:
- DECODE_PRINTF("DIV\tBYTE PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- div_byte(destval);
- break;
- case 7:
- DECODE_PRINTF("IDIV\tBYTE PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- idiv_byte(destval);
- break;
- }
- break; /* end mod==00 */
+ switch (rh) {
+ case 0: /* test byte imm */
+ DECODE_PRINTF("TEST\tBYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%02x\n", srcval);
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ test_byte(destval, srcval);
+ break;
+ case 1:
+ DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F6\n");
+ HALT_SYS();
+ break;
+ case 2:
+ DECODE_PRINTF("NOT\tBYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = not_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3:
+ DECODE_PRINTF("NEG\tBYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 4:
+ DECODE_PRINTF("MUL\tBYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ mul_byte(destval);
+ break;
+ case 5:
+ DECODE_PRINTF("IMUL\tBYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ imul_byte(destval);
+ break;
+ case 6:
+ DECODE_PRINTF("DIV\tBYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ div_byte(destval);
+ break;
+ case 7:
+ DECODE_PRINTF("IDIV\tBYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ idiv_byte(destval);
+ break;
+ }
+ break; /* end mod==00 */
case 1: /* mod=01 */
- switch (rh) {
- case 0: /* test byte imm */
- DECODE_PRINTF("TEST\tBYTE PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- srcval = fetch_byte_imm();
- DECODE_PRINTF2("%02x\n", srcval);
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- test_byte(destval, srcval);
- break;
- case 1:
- DECODE_PRINTF("ILLEGAL OP MOD=01 RH=01 OP=F6\n");
- HALT_SYS();
- break;
- case 2:
- DECODE_PRINTF("NOT\tBYTE PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = not_byte(destval);
- store_data_byte(destoffset, destval);
- break;
- case 3:
- DECODE_PRINTF("NEG\tBYTE PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = neg_byte(destval);
- store_data_byte(destoffset, destval);
- break;
- case 4:
- DECODE_PRINTF("MUL\tBYTE PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- mul_byte(destval);
- break;
- case 5:
- DECODE_PRINTF("IMUL\tBYTE PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- imul_byte(destval);
- break;
- case 6:
- DECODE_PRINTF("DIV\tBYTE PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- div_byte(destval);
- break;
- case 7:
- DECODE_PRINTF("IDIV\tBYTE PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- idiv_byte(destval);
- break;
- }
- break; /* end mod==01 */
+ switch (rh) {
+ case 0: /* test byte imm */
+ DECODE_PRINTF("TEST\tBYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%02x\n", srcval);
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ test_byte(destval, srcval);
+ break;
+ case 1:
+ DECODE_PRINTF("ILLEGAL OP MOD=01 RH=01 OP=F6\n");
+ HALT_SYS();
+ break;
+ case 2:
+ DECODE_PRINTF("NOT\tBYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = not_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3:
+ DECODE_PRINTF("NEG\tBYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 4:
+ DECODE_PRINTF("MUL\tBYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ mul_byte(destval);
+ break;
+ case 5:
+ DECODE_PRINTF("IMUL\tBYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ imul_byte(destval);
+ break;
+ case 6:
+ DECODE_PRINTF("DIV\tBYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ div_byte(destval);
+ break;
+ case 7:
+ DECODE_PRINTF("IDIV\tBYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ idiv_byte(destval);
+ break;
+ }
+ break; /* end mod==01 */
case 2: /* mod=10 */
- switch (rh) {
- case 0: /* test byte imm */
- DECODE_PRINTF("TEST\tBYTE PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- srcval = fetch_byte_imm();
- DECODE_PRINTF2("%02x\n", srcval);
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- test_byte(destval, srcval);
- break;
- case 1:
- DECODE_PRINTF("ILLEGAL OP MOD=10 RH=01 OP=F6\n");
- HALT_SYS();
- break;
- case 2:
- DECODE_PRINTF("NOT\tBYTE PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = not_byte(destval);
- store_data_byte(destoffset, destval);
- break;
- case 3:
- DECODE_PRINTF("NEG\tBYTE PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = neg_byte(destval);
- store_data_byte(destoffset, destval);
- break;
- case 4:
- DECODE_PRINTF("MUL\tBYTE PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- mul_byte(destval);
- break;
- case 5:
- DECODE_PRINTF("IMUL\tBYTE PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- imul_byte(destval);
- break;
- case 6:
- DECODE_PRINTF("DIV\tBYTE PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- div_byte(destval);
- break;
- case 7:
- DECODE_PRINTF("IDIV\tBYTE PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- idiv_byte(destval);
- break;
- }
- break; /* end mod==10 */
+ switch (rh) {
+ case 0: /* test byte imm */
+ DECODE_PRINTF("TEST\tBYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%02x\n", srcval);
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ test_byte(destval, srcval);
+ break;
+ case 1:
+ DECODE_PRINTF("ILLEGAL OP MOD=10 RH=01 OP=F6\n");
+ HALT_SYS();
+ break;
+ case 2:
+ DECODE_PRINTF("NOT\tBYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = not_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3:
+ DECODE_PRINTF("NEG\tBYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 4:
+ DECODE_PRINTF("MUL\tBYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ mul_byte(destval);
+ break;
+ case 5:
+ DECODE_PRINTF("IMUL\tBYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ imul_byte(destval);
+ break;
+ case 6:
+ DECODE_PRINTF("DIV\tBYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ div_byte(destval);
+ break;
+ case 7:
+ DECODE_PRINTF("IDIV\tBYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ idiv_byte(destval);
+ break;
+ }
+ break; /* end mod==10 */
case 3: /* mod=11 */
- switch (rh) {
- case 0: /* test byte imm */
- DECODE_PRINTF("TEST\t");
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",");
- srcval = fetch_byte_imm();
- DECODE_PRINTF2("%02x\n", srcval);
- TRACE_AND_STEP();
- test_byte(*destreg, srcval);
- break;
- case 1:
- DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F6\n");
- HALT_SYS();
- break;
- case 2:
- DECODE_PRINTF("NOT\t");
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = not_byte(*destreg);
- break;
- case 3:
- DECODE_PRINTF("NEG\t");
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = neg_byte(*destreg);
- break;
- case 4:
- DECODE_PRINTF("MUL\t");
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- mul_byte(*destreg); /*!!! */
- break;
- case 5:
- DECODE_PRINTF("IMUL\t");
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- imul_byte(*destreg);
- break;
- case 6:
- DECODE_PRINTF("DIV\t");
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- div_byte(*destreg);
- break;
- case 7:
- DECODE_PRINTF("IDIV\t");
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- idiv_byte(*destreg);
- break;
- }
- break; /* end mod==11 */
+ switch (rh) {
+ case 0: /* test byte imm */
+ DECODE_PRINTF("TEST\t");
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%02x\n", srcval);
+ TRACE_AND_STEP();
+ test_byte(*destreg, srcval);
+ break;
+ case 1:
+ DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F6\n");
+ HALT_SYS();
+ break;
+ case 2:
+ DECODE_PRINTF("NOT\t");
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = not_byte(*destreg);
+ break;
+ case 3:
+ DECODE_PRINTF("NEG\t");
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = neg_byte(*destreg);
+ break;
+ case 4:
+ DECODE_PRINTF("MUL\t");
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ mul_byte(*destreg); /*!!! */
+ break;
+ case 5:
+ DECODE_PRINTF("IMUL\t");
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ imul_byte(*destreg);
+ break;
+ case 6:
+ DECODE_PRINTF("DIV\t");
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ div_byte(*destreg);
+ break;
+ case 7:
+ DECODE_PRINTF("IDIV\t");
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ idiv_byte(*destreg);
+ break;
+ }
+ break; /* end mod==11 */
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -10153,641 +10153,641 @@ void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0: /* mod=00 */
- switch (rh) {
- case 0: /* test word imm */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval,srcval;
-
- DECODE_PRINTF("TEST\tDWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- srcval = fetch_long_imm();
- DECODE_PRINTF2("%x\n", srcval);
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- test_long(destval, srcval);
- } else {
- u16 destval,srcval;
-
- DECODE_PRINTF("TEST\tWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- srcval = fetch_word_imm();
- DECODE_PRINTF2("%x\n", srcval);
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- test_word(destval, srcval);
- }
- break;
- case 1:
- DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F7\n");
- HALT_SYS();
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("NOT\tDWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = not_long(destval);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("NOT\tWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = not_word(destval);
- store_data_word(destoffset, destval);
- }
- break;
- case 3:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("NEG\tDWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = neg_long(destval);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("NEG\tWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = neg_word(destval);
- store_data_word(destoffset, destval);
- }
- break;
- case 4:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("MUL\tDWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- mul_long(destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("MUL\tWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- mul_word(destval);
- }
- break;
- case 5:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("IMUL\tDWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- imul_long(destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("IMUL\tWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- imul_word(destval);
- }
- break;
- case 6:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("DIV\tDWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- div_long(destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("DIV\tWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- div_word(destval);
- }
- break;
- case 7:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("IDIV\tDWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- idiv_long(destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("IDIV\tWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- idiv_word(destval);
- }
- break;
- }
- break; /* end mod==00 */
+ switch (rh) {
+ case 0: /* test word imm */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval,srcval;
+
+ DECODE_PRINTF("TEST\tDWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_long_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ test_long(destval, srcval);
+ } else {
+ u16 destval,srcval;
+
+ DECODE_PRINTF("TEST\tWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ test_word(destval, srcval);
+ }
+ break;
+ case 1:
+ DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F7\n");
+ HALT_SYS();
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("NOT\tDWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = not_long(destval);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("NOT\tWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = not_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("NEG\tDWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_long(destval);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("NEG\tWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 4:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("MUL\tDWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ mul_long(destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("MUL\tWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ mul_word(destval);
+ }
+ break;
+ case 5:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("IMUL\tDWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ imul_long(destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("IMUL\tWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ imul_word(destval);
+ }
+ break;
+ case 6:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DIV\tDWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ div_long(destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("DIV\tWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ div_word(destval);
+ }
+ break;
+ case 7:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("IDIV\tDWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ idiv_long(destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("IDIV\tWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ idiv_word(destval);
+ }
+ break;
+ }
+ break; /* end mod==00 */
case 1: /* mod=01 */
- switch (rh) {
- case 0: /* test word imm */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval,srcval;
-
- DECODE_PRINTF("TEST\tDWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- srcval = fetch_long_imm();
- DECODE_PRINTF2("%x\n", srcval);
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- test_long(destval, srcval);
- } else {
- u16 destval,srcval;
-
- DECODE_PRINTF("TEST\tWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- srcval = fetch_word_imm();
- DECODE_PRINTF2("%x\n", srcval);
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- test_word(destval, srcval);
- }
- break;
- case 1:
- DECODE_PRINTF("ILLEGAL OP MOD=01 RH=01 OP=F6\n");
- HALT_SYS();
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("NOT\tDWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = not_long(destval);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("NOT\tWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = not_word(destval);
- store_data_word(destoffset, destval);
- }
- break;
- case 3:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("NEG\tDWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = neg_long(destval);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("NEG\tWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = neg_word(destval);
- store_data_word(destoffset, destval);
- }
- break;
- case 4:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("MUL\tDWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- mul_long(destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("MUL\tWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- mul_word(destval);
- }
- break;
- case 5:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("IMUL\tDWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- imul_long(destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("IMUL\tWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- imul_word(destval);
- }
- break;
- case 6:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("DIV\tDWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- div_long(destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("DIV\tWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- div_word(destval);
- }
- break;
- case 7:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("IDIV\tDWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- idiv_long(destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("IDIV\tWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- idiv_word(destval);
- }
- break;
- }
- break; /* end mod==01 */
+ switch (rh) {
+ case 0: /* test word imm */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval,srcval;
+
+ DECODE_PRINTF("TEST\tDWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_long_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ test_long(destval, srcval);
+ } else {
+ u16 destval,srcval;
+
+ DECODE_PRINTF("TEST\tWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ test_word(destval, srcval);
+ }
+ break;
+ case 1:
+ DECODE_PRINTF("ILLEGAL OP MOD=01 RH=01 OP=F6\n");
+ HALT_SYS();
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("NOT\tDWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = not_long(destval);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("NOT\tWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = not_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("NEG\tDWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_long(destval);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("NEG\tWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 4:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("MUL\tDWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ mul_long(destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("MUL\tWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ mul_word(destval);
+ }
+ break;
+ case 5:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("IMUL\tDWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ imul_long(destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("IMUL\tWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ imul_word(destval);
+ }
+ break;
+ case 6:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DIV\tDWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ div_long(destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("DIV\tWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ div_word(destval);
+ }
+ break;
+ case 7:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("IDIV\tDWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ idiv_long(destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("IDIV\tWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ idiv_word(destval);
+ }
+ break;
+ }
+ break; /* end mod==01 */
case 2: /* mod=10 */
- switch (rh) {
- case 0: /* test word imm */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval,srcval;
-
- DECODE_PRINTF("TEST\tDWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- srcval = fetch_long_imm();
- DECODE_PRINTF2("%x\n", srcval);
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- test_long(destval, srcval);
- } else {
- u16 destval,srcval;
-
- DECODE_PRINTF("TEST\tWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- srcval = fetch_word_imm();
- DECODE_PRINTF2("%x\n", srcval);
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- test_word(destval, srcval);
- }
- break;
- case 1:
- DECODE_PRINTF("ILLEGAL OP MOD=10 RH=01 OP=F6\n");
- HALT_SYS();
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("NOT\tDWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = not_long(destval);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("NOT\tWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = not_word(destval);
- store_data_word(destoffset, destval);
- }
- break;
- case 3:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("NEG\tDWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = neg_long(destval);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("NEG\tWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = neg_word(destval);
- store_data_word(destoffset, destval);
- }
- break;
- case 4:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("MUL\tDWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- mul_long(destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("MUL\tWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- mul_word(destval);
- }
- break;
- case 5:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("IMUL\tDWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- imul_long(destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("IMUL\tWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- imul_word(destval);
- }
- break;
- case 6:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("DIV\tDWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- div_long(destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("DIV\tWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- div_word(destval);
- }
- break;
- case 7:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("IDIV\tDWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- idiv_long(destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("IDIV\tWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- idiv_word(destval);
- }
- break;
- }
- break; /* end mod==10 */
+ switch (rh) {
+ case 0: /* test word imm */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval,srcval;
+
+ DECODE_PRINTF("TEST\tDWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_long_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ test_long(destval, srcval);
+ } else {
+ u16 destval,srcval;
+
+ DECODE_PRINTF("TEST\tWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ test_word(destval, srcval);
+ }
+ break;
+ case 1:
+ DECODE_PRINTF("ILLEGAL OP MOD=10 RH=01 OP=F6\n");
+ HALT_SYS();
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("NOT\tDWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = not_long(destval);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("NOT\tWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = not_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("NEG\tDWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_long(destval);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("NEG\tWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 4:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("MUL\tDWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ mul_long(destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("MUL\tWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ mul_word(destval);
+ }
+ break;
+ case 5:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("IMUL\tDWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ imul_long(destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("IMUL\tWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ imul_word(destval);
+ }
+ break;
+ case 6:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DIV\tDWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ div_long(destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("DIV\tWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ div_word(destval);
+ }
+ break;
+ case 7:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("IDIV\tDWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ idiv_long(destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("IDIV\tWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ idiv_word(destval);
+ }
+ break;
+ }
+ break; /* end mod==10 */
case 3: /* mod=11 */
- switch (rh) {
- case 0: /* test word imm */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- DECODE_PRINTF("TEST\t");
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- srcval = fetch_long_imm();
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- test_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- DECODE_PRINTF("TEST\t");
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- srcval = fetch_word_imm();
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- test_word(*destreg, srcval);
- }
- break;
- case 1:
- DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F6\n");
- HALT_SYS();
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
-
- DECODE_PRINTF("NOT\t");
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = not_long(*destreg);
- } else {
- u16 *destreg;
-
- DECODE_PRINTF("NOT\t");
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = not_word(*destreg);
- }
- break;
- case 3:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
-
- DECODE_PRINTF("NEG\t");
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = neg_long(*destreg);
- } else {
- u16 *destreg;
-
- DECODE_PRINTF("NEG\t");
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = neg_word(*destreg);
- }
- break;
- case 4:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
-
- DECODE_PRINTF("MUL\t");
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- mul_long(*destreg); /*!!! */
- } else {
- u16 *destreg;
-
- DECODE_PRINTF("MUL\t");
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- mul_word(*destreg); /*!!! */
- }
- break;
- case 5:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
-
- DECODE_PRINTF("IMUL\t");
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- imul_long(*destreg);
- } else {
- u16 *destreg;
-
- DECODE_PRINTF("IMUL\t");
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- imul_word(*destreg);
- }
- break;
- case 6:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
-
- DECODE_PRINTF("DIV\t");
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- div_long(*destreg);
- } else {
- u16 *destreg;
-
- DECODE_PRINTF("DIV\t");
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- div_word(*destreg);
- }
- break;
- case 7:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
-
- DECODE_PRINTF("IDIV\t");
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- idiv_long(*destreg);
- } else {
- u16 *destreg;
-
- DECODE_PRINTF("IDIV\t");
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- idiv_word(*destreg);
- }
- break;
- }
- break; /* end mod==11 */
+ switch (rh) {
+ case 0: /* test word imm */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ DECODE_PRINTF("TEST\t");
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_long_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ test_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ DECODE_PRINTF("TEST\t");
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ test_word(*destreg, srcval);
+ }
+ break;
+ case 1:
+ DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F6\n");
+ HALT_SYS();
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ DECODE_PRINTF("NOT\t");
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = not_long(*destreg);
+ } else {
+ u16 *destreg;
+
+ DECODE_PRINTF("NOT\t");
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = not_word(*destreg);
+ }
+ break;
+ case 3:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ DECODE_PRINTF("NEG\t");
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = neg_long(*destreg);
+ } else {
+ u16 *destreg;
+
+ DECODE_PRINTF("NEG\t");
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = neg_word(*destreg);
+ }
+ break;
+ case 4:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ DECODE_PRINTF("MUL\t");
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ mul_long(*destreg); /*!!! */
+ } else {
+ u16 *destreg;
+
+ DECODE_PRINTF("MUL\t");
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ mul_word(*destreg); /*!!! */
+ }
+ break;
+ case 5:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ DECODE_PRINTF("IMUL\t");
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ imul_long(*destreg);
+ } else {
+ u16 *destreg;
+
+ DECODE_PRINTF("IMUL\t");
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ imul_word(*destreg);
+ }
+ break;
+ case 6:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ DECODE_PRINTF("DIV\t");
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ div_long(*destreg);
+ } else {
+ u16 *destreg;
+
+ DECODE_PRINTF("DIV\t");
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ div_word(*destreg);
+ }
+ break;
+ case 7:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ DECODE_PRINTF("IDIV\t");
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ idiv_long(*destreg);
+ } else {
+ u16 *destreg;
+
+ DECODE_PRINTF("IDIV\t");
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ idiv_word(*destreg);
+ }
+ break;
+ }
+ break; /* end mod==11 */
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -10899,102 +10899,102 @@ void x86emuOp_opcFE_byte_RM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
#ifdef DEBUG
if (DEBUG_DECODE()) {
- /* XXX DECODE_PRINTF may be changed to something more
- general, so that it is important to leave the strings
- in the same format, even though the result is that the
- above test is done twice. */
-
- switch (rh) {
- case 0:
- DECODE_PRINTF("INC\t");
- break;
- case 1:
- DECODE_PRINTF("DEC\t");
- break;
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- DECODE_PRINTF2("ILLEGAL OP MAJOR OP 0xFE MINOR OP %x \n", mod);
- HALT_SYS();
- break;
- }
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("INC\t");
+ break;
+ case 1:
+ DECODE_PRINTF("DEC\t");
+ break;
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ DECODE_PRINTF2("ILLEGAL OP MAJOR OP 0xFE MINOR OP %x \n", mod);
+ HALT_SYS();
+ break;
+ }
}
#endif
switch (mod) {
case 0:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- switch (rh) {
- case 0: /* inc word ptr ... */
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = inc_byte(destval);
- store_data_byte(destoffset, destval);
- break;
- case 1: /* dec word ptr ... */
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = dec_byte(destval);
- store_data_byte(destoffset, destval);
- break;
- }
- break;
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ switch (rh) {
+ case 0: /* inc word ptr ... */
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1: /* dec word ptr ... */
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ }
+ break;
case 1:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- switch (rh) {
- case 0:
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = inc_byte(destval);
- store_data_byte(destoffset, destval);
- break;
- case 1:
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = dec_byte(destval);
- store_data_byte(destoffset, destval);
- break;
- }
- break;
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ switch (rh) {
+ case 0:
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ }
+ break;
case 2:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- switch (rh) {
- case 0:
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = inc_byte(destval);
- store_data_byte(destoffset, destval);
- break;
- case 1:
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = dec_byte(destval);
- store_data_byte(destoffset, destval);
- break;
- }
- break;
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ switch (rh) {
+ case 0:
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ }
+ break;
case 3:
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- switch (rh) {
- case 0:
- TRACE_AND_STEP();
- *destreg = inc_byte(*destreg);
- break;
- case 1:
- TRACE_AND_STEP();
- *destreg = dec_byte(*destreg);
- break;
- }
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ switch (rh) {
+ case 0:
+ TRACE_AND_STEP();
+ *destreg = inc_byte(*destreg);
+ break;
+ case 1:
+ TRACE_AND_STEP();
+ *destreg = dec_byte(*destreg);
+ break;
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -11016,374 +11016,374 @@ void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
#ifdef DEBUG
if (DEBUG_DECODE()) {
- /* XXX DECODE_PRINTF may be changed to something more
- general, so that it is important to leave the strings
- in the same format, even though the result is that the
- above test is done twice. */
-
- switch (rh) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("INC\tDWORD PTR ");
- } else {
- DECODE_PRINTF("INC\tWORD PTR ");
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("DEC\tDWORD PTR ");
- } else {
- DECODE_PRINTF("DEC\tWORD PTR ");
- }
- break;
- case 2:
- DECODE_PRINTF("CALL\t ");
- break;
- case 3:
- DECODE_PRINTF("CALL\tFAR ");
- break;
- case 4:
- DECODE_PRINTF("JMP\t");
- break;
- case 5:
- DECODE_PRINTF("JMP\tFAR ");
- break;
- case 6:
- DECODE_PRINTF("PUSH\t");
- break;
- case 7:
- DECODE_PRINTF("ILLEGAL DECODING OF OPCODE FF\t");
- HALT_SYS();
- break;
- }
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+
+ switch (rh) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tDWORD PTR ");
+ } else {
+ DECODE_PRINTF("INC\tWORD PTR ");
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tDWORD PTR ");
+ } else {
+ DECODE_PRINTF("DEC\tWORD PTR ");
+ }
+ break;
+ case 2:
+ DECODE_PRINTF("CALL\t ");
+ break;
+ case 3:
+ DECODE_PRINTF("CALL\tFAR ");
+ break;
+ case 4:
+ DECODE_PRINTF("JMP\t");
+ break;
+ case 5:
+ DECODE_PRINTF("JMP\tFAR ");
+ break;
+ case 6:
+ DECODE_PRINTF("PUSH\t");
+ break;
+ case 7:
+ DECODE_PRINTF("ILLEGAL DECODING OF OPCODE FF\t");
+ HALT_SYS();
+ break;
+ }
}
#endif
switch (mod) {
case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- switch (rh) {
- case 0: /* inc word ptr ... */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = inc_long(destval);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = inc_word(destval);
- store_data_word(destoffset, destval);
- }
- break;
- case 1: /* dec word ptr ... */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = dec_long(destval);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = dec_word(destval);
- store_data_word(destoffset, destval);
- }
- break;
- case 2: /* call word ptr ... */
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- push_word(M.x86.R_IP);
- M.x86.R_IP = destval;
- break;
- case 3: /* call far ptr ... */
- destval = fetch_data_word(destoffset);
- destval2 = fetch_data_word(destoffset + 2);
- TRACE_AND_STEP();
- push_word(M.x86.R_CS);
- M.x86.R_CS = destval2;
- push_word(M.x86.R_IP);
- M.x86.R_IP = destval;
- break;
- case 4: /* jmp word ptr ... */
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- M.x86.R_IP = destval;
- break;
- case 5: /* jmp far ptr ... */
- destval = fetch_data_word(destoffset);
- destval2 = fetch_data_word(destoffset + 2);
- TRACE_AND_STEP();
- M.x86.R_IP = destval;
- M.x86.R_CS = destval2;
- break;
- case 6: /* push word ptr ... */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- push_long(destval);
- } else {
- u16 destval;
-
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- push_word(destval);
- }
- break;
- }
- break;
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ switch (rh) {
+ case 0: /* inc word ptr ... */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_long(destval);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1: /* dec word ptr ... */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_long(destval);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2: /* call word ptr ... */
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = destval;
+ break;
+ case 3: /* call far ptr ... */
+ destval = fetch_data_word(destoffset);
+ destval2 = fetch_data_word(destoffset + 2);
+ TRACE_AND_STEP();
+ push_word(M.x86.R_CS);
+ M.x86.R_CS = destval2;
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = destval;
+ break;
+ case 4: /* jmp word ptr ... */
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ M.x86.R_IP = destval;
+ break;
+ case 5: /* jmp far ptr ... */
+ destval = fetch_data_word(destoffset);
+ destval2 = fetch_data_word(destoffset + 2);
+ TRACE_AND_STEP();
+ M.x86.R_IP = destval;
+ M.x86.R_CS = destval2;
+ break;
+ case 6: /* push word ptr ... */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ push_long(destval);
+ } else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ push_word(destval);
+ }
+ break;
+ }
+ break;
case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- switch (rh) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = inc_long(destval);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = inc_word(destval);
- store_data_word(destoffset, destval);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = dec_long(destval);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = dec_word(destval);
- store_data_word(destoffset, destval);
- }
- break;
- case 2: /* call word ptr ... */
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- push_word(M.x86.R_IP);
- M.x86.R_IP = destval;
- break;
- case 3: /* call far ptr ... */
- destval = fetch_data_word(destoffset);
- destval2 = fetch_data_word(destoffset + 2);
- TRACE_AND_STEP();
- push_word(M.x86.R_CS);
- M.x86.R_CS = destval2;
- push_word(M.x86.R_IP);
- M.x86.R_IP = destval;
- break;
- case 4: /* jmp word ptr ... */
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- M.x86.R_IP = destval;
- break;
- case 5: /* jmp far ptr ... */
- destval = fetch_data_word(destoffset);
- destval2 = fetch_data_word(destoffset + 2);
- TRACE_AND_STEP();
- M.x86.R_IP = destval;
- M.x86.R_CS = destval2;
- break;
- case 6: /* push word ptr ... */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- push_long(destval);
- } else {
- u16 destval;
-
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- push_word(destval);
- }
- break;
- }
- break;
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ switch (rh) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_long(destval);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_long(destval);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2: /* call word ptr ... */
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = destval;
+ break;
+ case 3: /* call far ptr ... */
+ destval = fetch_data_word(destoffset);
+ destval2 = fetch_data_word(destoffset + 2);
+ TRACE_AND_STEP();
+ push_word(M.x86.R_CS);
+ M.x86.R_CS = destval2;
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = destval;
+ break;
+ case 4: /* jmp word ptr ... */
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ M.x86.R_IP = destval;
+ break;
+ case 5: /* jmp far ptr ... */
+ destval = fetch_data_word(destoffset);
+ destval2 = fetch_data_word(destoffset + 2);
+ TRACE_AND_STEP();
+ M.x86.R_IP = destval;
+ M.x86.R_CS = destval2;
+ break;
+ case 6: /* push word ptr ... */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ push_long(destval);
+ } else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ push_word(destval);
+ }
+ break;
+ }
+ break;
case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- switch (rh) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = inc_long(destval);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = inc_word(destval);
- store_data_word(destoffset, destval);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = dec_long(destval);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = dec_word(destval);
- store_data_word(destoffset, destval);
- }
- break;
- case 2: /* call word ptr ... */
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- push_word(M.x86.R_IP);
- M.x86.R_IP = destval;
- break;
- case 3: /* call far ptr ... */
- destval = fetch_data_word(destoffset);
- destval2 = fetch_data_word(destoffset + 2);
- TRACE_AND_STEP();
- push_word(M.x86.R_CS);
- M.x86.R_CS = destval2;
- push_word(M.x86.R_IP);
- M.x86.R_IP = destval;
- break;
- case 4: /* jmp word ptr ... */
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- M.x86.R_IP = destval;
- break;
- case 5: /* jmp far ptr ... */
- destval = fetch_data_word(destoffset);
- destval2 = fetch_data_word(destoffset + 2);
- TRACE_AND_STEP();
- M.x86.R_IP = destval;
- M.x86.R_CS = destval2;
- break;
- case 6: /* push word ptr ... */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- push_long(destval);
- } else {
- u16 destval;
-
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- push_word(destval);
- }
- break;
- }
- break;
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ switch (rh) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_long(destval);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_long(destval);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2: /* call word ptr ... */
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = destval;
+ break;
+ case 3: /* call far ptr ... */
+ destval = fetch_data_word(destoffset);
+ destval2 = fetch_data_word(destoffset + 2);
+ TRACE_AND_STEP();
+ push_word(M.x86.R_CS);
+ M.x86.R_CS = destval2;
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = destval;
+ break;
+ case 4: /* jmp word ptr ... */
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ M.x86.R_IP = destval;
+ break;
+ case 5: /* jmp far ptr ... */
+ destval = fetch_data_word(destoffset);
+ destval2 = fetch_data_word(destoffset + 2);
+ TRACE_AND_STEP();
+ M.x86.R_IP = destval;
+ M.x86.R_CS = destval2;
+ break;
+ case 6: /* push word ptr ... */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ push_long(destval);
+ } else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ push_word(destval);
+ }
+ break;
+ }
+ break;
case 3:
- switch (rh) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = inc_long(*destreg);
- } else {
- u16 *destreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = inc_word(*destreg);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = dec_long(*destreg);
- } else {
- u16 *destreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = dec_word(*destreg);
- }
- break;
- case 2: /* call word ptr ... */
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- push_word(M.x86.R_IP);
- M.x86.R_IP = *destreg;
- break;
- case 3: /* jmp far ptr ... */
- DECODE_PRINTF("OPERATION UNDEFINED 0XFF \n");
- TRACE_AND_STEP();
- HALT_SYS();
- break;
-
- case 4: /* jmp ... */
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- M.x86.R_IP = (u16) (*destreg);
- break;
- case 5: /* jmp far ptr ... */
- DECODE_PRINTF("OPERATION UNDEFINED 0XFF \n");
- TRACE_AND_STEP();
- HALT_SYS();
- break;
- case 6:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- push_long(*destreg);
- } else {
- u16 *destreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- push_word(*destreg);
- }
- break;
- }
- break;
+ switch (rh) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = inc_long(*destreg);
+ } else {
+ u16 *destreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = inc_word(*destreg);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = dec_long(*destreg);
+ } else {
+ u16 *destreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = dec_word(*destreg);
+ }
+ break;
+ case 2: /* call word ptr ... */
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = *destreg;
+ break;
+ case 3: /* jmp far ptr ... */
+ DECODE_PRINTF("OPERATION UNDEFINED 0XFF \n");
+ TRACE_AND_STEP();
+ HALT_SYS();
+ break;
+
+ case 4: /* jmp ... */
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ M.x86.R_IP = (u16) (*destreg);
+ break;
+ case 5: /* jmp far ptr ... */
+ DECODE_PRINTF("OPERATION UNDEFINED 0XFF \n");
+ TRACE_AND_STEP();
+ HALT_SYS();
+ break;
+ case 6:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ push_long(*destreg);
+ } else {
+ u16 *destreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ push_word(*destreg);
+ }
+ break;
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
diff --git a/board/MAI/bios_emulator/scitech/src/x86emu/ops2.c b/board/MAI/bios_emulator/scitech/src/x86emu/ops2.c
index 2ada44ee21..d381307fae 100644
--- a/board/MAI/bios_emulator/scitech/src/x86emu/ops2.c
+++ b/board/MAI/bios_emulator/scitech/src/x86emu/ops2.c
@@ -77,71 +77,71 @@ void x86emuOp2_long_jump(u8 op2)
START_OF_INSTR();
switch (op2) {
case 0x80:
- name = "JO\t";
- cond = ACCESS_FLAG(F_OF);
- break;
+ name = "JO\t";
+ cond = ACCESS_FLAG(F_OF);
+ break;
case 0x81:
- name = "JNO\t";
- cond = !ACCESS_FLAG(F_OF);
- break;
+ name = "JNO\t";
+ cond = !ACCESS_FLAG(F_OF);
+ break;
case 0x82:
- name = "JB\t";
- cond = ACCESS_FLAG(F_CF);
- break;
+ name = "JB\t";
+ cond = ACCESS_FLAG(F_CF);
+ break;
case 0x83:
- name = "JNB\t";
- cond = !ACCESS_FLAG(F_CF);
- break;
+ name = "JNB\t";
+ cond = !ACCESS_FLAG(F_CF);
+ break;
case 0x84:
- name = "JZ\t";
- cond = ACCESS_FLAG(F_ZF);
- break;
+ name = "JZ\t";
+ cond = ACCESS_FLAG(F_ZF);
+ break;
case 0x85:
- name = "JNZ\t";
- cond = !ACCESS_FLAG(F_ZF);
- break;
+ name = "JNZ\t";
+ cond = !ACCESS_FLAG(F_ZF);
+ break;
case 0x86:
- name = "JBE\t";
- cond = ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF);
- break;
+ name = "JBE\t";
+ cond = ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF);
+ break;
case 0x87:
- name = "JNBE\t";
- cond = !(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF));
- break;
+ name = "JNBE\t";
+ cond = !(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF));
+ break;
case 0x88:
- name = "JS\t";
- cond = ACCESS_FLAG(F_SF);
- break;
+ name = "JS\t";
+ cond = ACCESS_FLAG(F_SF);
+ break;
case 0x89:
- name = "JNS\t";
- cond = !ACCESS_FLAG(F_SF);
- break;
+ name = "JNS\t";
+ cond = !ACCESS_FLAG(F_SF);
+ break;
case 0x8a:
- name = "JP\t";
- cond = ACCESS_FLAG(F_PF);
- break;
+ name = "JP\t";
+ cond = ACCESS_FLAG(F_PF);
+ break;
case 0x8b:
- name = "JNP\t";
- cond = !ACCESS_FLAG(F_PF);
- break;
+ name = "JNP\t";
+ cond = !ACCESS_FLAG(F_PF);
+ break;
case 0x8c:
- name = "JL\t";
- cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
- break;
+ name = "JL\t";
+ cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
+ break;
case 0x8d:
- name = "JNL\t";
- cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
- break;
+ name = "JNL\t";
+ cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
+ break;
case 0x8e:
- name = "JLE\t";
- cond = (xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
- ACCESS_FLAG(F_ZF));
- break;
+ name = "JLE\t";
+ cond = (xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
+ ACCESS_FLAG(F_ZF));
+ break;
case 0x8f:
- name = "JNLE\t";
- cond = !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
- ACCESS_FLAG(F_ZF));
- break;
+ name = "JNLE\t";
+ cond = !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
+ ACCESS_FLAG(F_ZF));
+ break;
}
DECODE_PRINTF(name);
target = (s16) fetch_word_imm();
@@ -149,7 +149,7 @@ void x86emuOp2_long_jump(u8 op2)
DECODE_PRINTF2("%04x\n", target);
TRACE_AND_STEP();
if (cond)
- M.x86.R_IP = (u16)target;
+ M.x86.R_IP = (u16)target;
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
}
@@ -169,95 +169,95 @@ void x86emuOp2_set_byte(u8 op2)
START_OF_INSTR();
switch (op2) {
case 0x90:
- name = "SETO\t";
- cond = ACCESS_FLAG(F_OF);
- break;
+ name = "SETO\t";
+ cond = ACCESS_FLAG(F_OF);
+ break;
case 0x91:
- name = "SETNO\t";
- cond = !ACCESS_FLAG(F_OF);
- break;
+ name = "SETNO\t";
+ cond = !ACCESS_FLAG(F_OF);
+ break;
case 0x92:
- name = "SETB\t";
- cond = ACCESS_FLAG(F_CF);
- break;
+ name = "SETB\t";
+ cond = ACCESS_FLAG(F_CF);
+ break;
case 0x93:
- name = "SETNB\t";
- cond = !ACCESS_FLAG(F_CF);
- break;
+ name = "SETNB\t";
+ cond = !ACCESS_FLAG(F_CF);
+ break;
case 0x94:
- name = "SETZ\t";
- cond = ACCESS_FLAG(F_ZF);
- break;
+ name = "SETZ\t";
+ cond = ACCESS_FLAG(F_ZF);
+ break;
case 0x95:
- name = "SETNZ\t";
- cond = !ACCESS_FLAG(F_ZF);
- break;
+ name = "SETNZ\t";
+ cond = !ACCESS_FLAG(F_ZF);
+ break;
case 0x96:
- name = "SETBE\t";
- cond = ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF);
- break;
+ name = "SETBE\t";
+ cond = ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF);
+ break;
case 0x97:
- name = "SETNBE\t";
- cond = !(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF));
- break;
+ name = "SETNBE\t";
+ cond = !(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF));
+ break;
case 0x98:
- name = "SETS\t";
- cond = ACCESS_FLAG(F_SF);
- break;
+ name = "SETS\t";
+ cond = ACCESS_FLAG(F_SF);
+ break;
case 0x99:
- name = "SETNS\t";
- cond = !ACCESS_FLAG(F_SF);
- break;
+ name = "SETNS\t";
+ cond = !ACCESS_FLAG(F_SF);
+ break;
case 0x9a:
- name = "SETP\t";
- cond = ACCESS_FLAG(F_PF);
- break;
+ name = "SETP\t";
+ cond = ACCESS_FLAG(F_PF);
+ break;
case 0x9b:
- name = "SETNP\t";
- cond = !ACCESS_FLAG(F_PF);
- break;
+ name = "SETNP\t";
+ cond = !ACCESS_FLAG(F_PF);
+ break;
case 0x9c:
- name = "SETL\t";
- cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
- break;
+ name = "SETL\t";
+ cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
+ break;
case 0x9d:
- name = "SETNL\t";
- cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
- break;
+ name = "SETNL\t";
+ cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
+ break;
case 0x9e:
- name = "SETLE\t";
- cond = (xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
- ACCESS_FLAG(F_ZF));
- break;
+ name = "SETLE\t";
+ cond = (xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
+ ACCESS_FLAG(F_ZF));
+ break;
case 0x9f:
- name = "SETNLE\t";
- cond = !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
- ACCESS_FLAG(F_ZF));
- break;
+ name = "SETNLE\t";
+ cond = !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
+ ACCESS_FLAG(F_ZF));
+ break;
}
DECODE_PRINTF(name);
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- destoffset = decode_rm00_address(rl);
- TRACE_AND_STEP();
- store_data_byte(destoffset, cond ? 0x01 : 0x00);
- break;
+ destoffset = decode_rm00_address(rl);
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, cond ? 0x01 : 0x00);
+ break;
case 1:
- destoffset = decode_rm01_address(rl);
- TRACE_AND_STEP();
- store_data_byte(destoffset, cond ? 0x01 : 0x00);
- break;
+ destoffset = decode_rm01_address(rl);
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, cond ? 0x01 : 0x00);
+ break;
case 2:
- destoffset = decode_rm10_address(rl);
- TRACE_AND_STEP();
- store_data_byte(destoffset, cond ? 0x01 : 0x00);
- break;
+ destoffset = decode_rm10_address(rl);
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, cond ? 0x01 : 0x00);
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- TRACE_AND_STEP();
- *destreg = cond ? 0x01 : 0x00;
- break;
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ TRACE_AND_STEP();
+ *destreg = cond ? 0x01 : 0x00;
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -306,107 +306,107 @@ void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval;
- u32 *shiftreg;
-
- srcoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0x1F;
- disp = (s16)*shiftreg >> 5;
- srcval = fetch_data_long(srcoffset+disp);
- CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
- } else {
- u16 srcval;
- u16 *shiftreg;
-
- srcoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0xF;
- disp = (s16)*shiftreg >> 4;
- srcval = fetch_data_word(srcoffset+disp);
- CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ disp = (s16)*shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset+disp);
+ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
+ } else {
+ u16 srcval;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ disp = (s16)*shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset+disp);
+ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval;
- u32 *shiftreg;
-
- srcoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0x1F;
- disp = (s16)*shiftreg >> 5;
- srcval = fetch_data_long(srcoffset+disp);
- CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
- } else {
- u16 srcval;
- u16 *shiftreg;
-
- srcoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0xF;
- disp = (s16)*shiftreg >> 4;
- srcval = fetch_data_word(srcoffset+disp);
- CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ disp = (s16)*shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset+disp);
+ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
+ } else {
+ u16 srcval;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ disp = (s16)*shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset+disp);
+ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval;
- u32 *shiftreg;
-
- srcoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0x1F;
- disp = (s16)*shiftreg >> 5;
- srcval = fetch_data_long(srcoffset+disp);
- CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
- } else {
- u16 srcval;
- u16 *shiftreg;
-
- srcoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0xF;
- disp = (s16)*shiftreg >> 4;
- srcval = fetch_data_word(srcoffset+disp);
- CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ disp = (s16)*shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset+disp);
+ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
+ } else {
+ u16 srcval;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ disp = (s16)*shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset+disp);
+ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *srcreg,*shiftreg;
-
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0x1F;
- CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit),F_CF);
- } else {
- u16 *srcreg,*shiftreg;
-
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0xF;
- CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit),F_CF);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg,*shiftreg;
+
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit),F_CF);
+ } else {
+ u16 *srcreg,*shiftreg;
+
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit),F_CF);
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -427,123 +427,123 @@ void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *shiftreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- shift = fetch_byte_imm();
- DECODE_PRINTF2("%d\n", shift);
- TRACE_AND_STEP();
- destval = fetch_data_long(destoffset);
- destval = shld_long(destval,*shiftreg,shift);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *shiftreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- shift = fetch_byte_imm();
- DECODE_PRINTF2("%d\n", shift);
- TRACE_AND_STEP();
- destval = fetch_data_word(destoffset);
- destval = shld_word(destval,*shiftreg,shift);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *shiftreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+ destval = shld_long(destval,*shiftreg,shift);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *shiftreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+ destval = shld_word(destval,*shiftreg,shift);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *shiftreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- shift = fetch_byte_imm();
- DECODE_PRINTF2("%d\n", shift);
- TRACE_AND_STEP();
- destval = fetch_data_long(destoffset);
- destval = shld_long(destval,*shiftreg,shift);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *shiftreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- shift = fetch_byte_imm();
- DECODE_PRINTF2("%d\n", shift);
- TRACE_AND_STEP();
- destval = fetch_data_word(destoffset);
- destval = shld_word(destval,*shiftreg,shift);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *shiftreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+ destval = shld_long(destval,*shiftreg,shift);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *shiftreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+ destval = shld_word(destval,*shiftreg,shift);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *shiftreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- shift = fetch_byte_imm();
- DECODE_PRINTF2("%d\n", shift);
- TRACE_AND_STEP();
- destval = fetch_data_long(destoffset);
- destval = shld_long(destval,*shiftreg,shift);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *shiftreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- shift = fetch_byte_imm();
- DECODE_PRINTF2("%d\n", shift);
- TRACE_AND_STEP();
- destval = fetch_data_word(destoffset);
- destval = shld_word(destval,*shiftreg,shift);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *shiftreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+ destval = shld_long(destval,*shiftreg,shift);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *shiftreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+ destval = shld_word(destval,*shiftreg,shift);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*shiftreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- shift = fetch_byte_imm();
- DECODE_PRINTF2("%d\n", shift);
- TRACE_AND_STEP();
- *destreg = shld_long(*destreg,*shiftreg,shift);
- } else {
- u16 *destreg,*shiftreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- shift = fetch_byte_imm();
- DECODE_PRINTF2("%d\n", shift);
- TRACE_AND_STEP();
- *destreg = shld_word(*destreg,*shiftreg,shift);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*shiftreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ *destreg = shld_long(*destreg,*shiftreg,shift);
+ } else {
+ u16 *destreg,*shiftreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ *destreg = shld_word(*destreg,*shiftreg,shift);
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -563,107 +563,107 @@ void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *shiftreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",CL\n");
- TRACE_AND_STEP();
- destval = fetch_data_long(destoffset);
- destval = shld_long(destval,*shiftreg,M.x86.R_CL);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *shiftreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",CL\n");
- TRACE_AND_STEP();
- destval = fetch_data_word(destoffset);
- destval = shld_word(destval,*shiftreg,M.x86.R_CL);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *shiftreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+ destval = shld_long(destval,*shiftreg,M.x86.R_CL);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *shiftreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+ destval = shld_word(destval,*shiftreg,M.x86.R_CL);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *shiftreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",CL\n");
- TRACE_AND_STEP();
- destval = fetch_data_long(destoffset);
- destval = shld_long(destval,*shiftreg,M.x86.R_CL);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *shiftreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",CL\n");
- TRACE_AND_STEP();
- destval = fetch_data_word(destoffset);
- destval = shld_word(destval,*shiftreg,M.x86.R_CL);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *shiftreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+ destval = shld_long(destval,*shiftreg,M.x86.R_CL);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *shiftreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+ destval = shld_word(destval,*shiftreg,M.x86.R_CL);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *shiftreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",CL\n");
- TRACE_AND_STEP();
- destval = fetch_data_long(destoffset);
- destval = shld_long(destval,*shiftreg,M.x86.R_CL);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *shiftreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",CL\n");
- TRACE_AND_STEP();
- destval = fetch_data_word(destoffset);
- destval = shld_word(destval,*shiftreg,M.x86.R_CL);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *shiftreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+ destval = shld_long(destval,*shiftreg,M.x86.R_CL);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *shiftreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+ destval = shld_word(destval,*shiftreg,M.x86.R_CL);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*shiftreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",CL\n");
- TRACE_AND_STEP();
- *destreg = shld_long(*destreg,*shiftreg,M.x86.R_CL);
- } else {
- u16 *destreg,*shiftreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",CL\n");
- TRACE_AND_STEP();
- *destreg = shld_word(*destreg,*shiftreg,M.x86.R_CL);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*shiftreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ *destreg = shld_long(*destreg,*shiftreg,M.x86.R_CL);
+ } else {
+ u16 *destreg,*shiftreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ *destreg = shld_word(*destreg,*shiftreg,M.x86.R_CL);
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -712,85 +712,85 @@ void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval,mask;
- u32 *shiftreg;
-
- srcoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0x1F;
- disp = (s16)*shiftreg >> 5;
- srcval = fetch_data_long(srcoffset+disp);
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- store_data_long(srcoffset+disp, srcval | mask);
- } else {
- u16 srcval,mask;
- u16 *shiftreg;
-
- srcoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0xF;
- disp = (s16)*shiftreg >> 4;
- srcval = fetch_data_word(srcoffset+disp);
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval,mask;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ disp = (s16)*shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset+disp);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ store_data_long(srcoffset+disp, srcval | mask);
+ } else {
+ u16 srcval,mask;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ disp = (s16)*shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset+disp);
mask = (u16)(0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- store_data_word(srcoffset+disp, srcval | mask);
- }
- break;
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ store_data_word(srcoffset+disp, srcval | mask);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval,mask;
- u32 *shiftreg;
-
- srcoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0x1F;
- disp = (s16)*shiftreg >> 5;
- srcval = fetch_data_long(srcoffset+disp);
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- store_data_long(srcoffset+disp, srcval | mask);
- } else {
- u16 srcval,mask;
- u16 *shiftreg;
-
- srcoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0xF;
- disp = (s16)*shiftreg >> 4;
- srcval = fetch_data_word(srcoffset+disp);
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval,mask;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ disp = (s16)*shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset+disp);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ store_data_long(srcoffset+disp, srcval | mask);
+ } else {
+ u16 srcval,mask;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ disp = (s16)*shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset+disp);
mask = (u16)(0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- store_data_word(srcoffset+disp, srcval | mask);
- }
- break;
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ store_data_word(srcoffset+disp, srcval | mask);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval,mask;
- u32 *shiftreg;
-
- srcoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0x1F;
- disp = (s16)*shiftreg >> 5;
- srcval = fetch_data_long(srcoffset+disp);
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- store_data_long(srcoffset+disp, srcval | mask);
- } else {
- u16 srcval,mask;
- u16 *shiftreg;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval,mask;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ disp = (s16)*shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset+disp);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ store_data_long(srcoffset+disp, srcval | mask);
+ } else {
+ u16 srcval,mask;
+ u16 *shiftreg;
srcoffset = decode_rm10_address(rl);
DECODE_PRINTF(",");
@@ -827,10 +827,10 @@ void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
TRACE_AND_STEP();
bit = *shiftreg & 0xF;
mask = (u16)(0x1 << bit);
- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
- *srcreg |= mask;
- }
- break;
+ CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
+ *srcreg |= mask;
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -851,123 +851,123 @@ void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *shiftreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- shift = fetch_byte_imm();
- DECODE_PRINTF2("%d\n", shift);
- TRACE_AND_STEP();
- destval = fetch_data_long(destoffset);
- destval = shrd_long(destval,*shiftreg,shift);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *shiftreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- shift = fetch_byte_imm();
- DECODE_PRINTF2("%d\n", shift);
- TRACE_AND_STEP();
- destval = fetch_data_word(destoffset);
- destval = shrd_word(destval,*shiftreg,shift);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *shiftreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+ destval = shrd_long(destval,*shiftreg,shift);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *shiftreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+ destval = shrd_word(destval,*shiftreg,shift);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *shiftreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- shift = fetch_byte_imm();
- DECODE_PRINTF2("%d\n", shift);
- TRACE_AND_STEP();
- destval = fetch_data_long(destoffset);
- destval = shrd_long(destval,*shiftreg,shift);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *shiftreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- shift = fetch_byte_imm();
- DECODE_PRINTF2("%d\n", shift);
- TRACE_AND_STEP();
- destval = fetch_data_word(destoffset);
- destval = shrd_word(destval,*shiftreg,shift);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *shiftreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+ destval = shrd_long(destval,*shiftreg,shift);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *shiftreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+ destval = shrd_word(destval,*shiftreg,shift);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *shiftreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- shift = fetch_byte_imm();
- DECODE_PRINTF2("%d\n", shift);
- TRACE_AND_STEP();
- destval = fetch_data_long(destoffset);
- destval = shrd_long(destval,*shiftreg,shift);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *shiftreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- shift = fetch_byte_imm();
- DECODE_PRINTF2("%d\n", shift);
- TRACE_AND_STEP();
- destval = fetch_data_word(destoffset);
- destval = shrd_word(destval,*shiftreg,shift);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *shiftreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+ destval = shrd_long(destval,*shiftreg,shift);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *shiftreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+ destval = shrd_word(destval,*shiftreg,shift);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*shiftreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- shift = fetch_byte_imm();
- DECODE_PRINTF2("%d\n", shift);
- TRACE_AND_STEP();
- *destreg = shrd_long(*destreg,*shiftreg,shift);
- } else {
- u16 *destreg,*shiftreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- shift = fetch_byte_imm();
- DECODE_PRINTF2("%d\n", shift);
- TRACE_AND_STEP();
- *destreg = shrd_word(*destreg,*shiftreg,shift);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*shiftreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ *destreg = shrd_long(*destreg,*shiftreg,shift);
+ } else {
+ u16 *destreg,*shiftreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ *destreg = shrd_word(*destreg,*shiftreg,shift);
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -987,107 +987,107 @@ void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *shiftreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",CL\n");
- TRACE_AND_STEP();
- destval = fetch_data_long(destoffset);
- destval = shrd_long(destval,*shiftreg,M.x86.R_CL);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *shiftreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",CL\n");
- TRACE_AND_STEP();
- destval = fetch_data_word(destoffset);
- destval = shrd_word(destval,*shiftreg,M.x86.R_CL);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *shiftreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+ destval = shrd_long(destval,*shiftreg,M.x86.R_CL);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *shiftreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+ destval = shrd_word(destval,*shiftreg,M.x86.R_CL);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *shiftreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",CL\n");
- TRACE_AND_STEP();
- destval = fetch_data_long(destoffset);
- destval = shrd_long(destval,*shiftreg,M.x86.R_CL);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *shiftreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",CL\n");
- TRACE_AND_STEP();
- destval = fetch_data_word(destoffset);
- destval = shrd_word(destval,*shiftreg,M.x86.R_CL);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *shiftreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+ destval = shrd_long(destval,*shiftreg,M.x86.R_CL);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *shiftreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+ destval = shrd_word(destval,*shiftreg,M.x86.R_CL);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *shiftreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",CL\n");
- TRACE_AND_STEP();
- destval = fetch_data_long(destoffset);
- destval = shrd_long(destval,*shiftreg,M.x86.R_CL);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *shiftreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",CL\n");
- TRACE_AND_STEP();
- destval = fetch_data_word(destoffset);
- destval = shrd_word(destval,*shiftreg,M.x86.R_CL);
- store_data_word(destoffset, destval);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *shiftreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+ destval = shrd_long(destval,*shiftreg,M.x86.R_CL);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *shiftreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+ destval = shrd_word(destval,*shiftreg,M.x86.R_CL);
+ store_data_word(destoffset, destval);
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*shiftreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",CL\n");
- TRACE_AND_STEP();
- *destreg = shrd_long(*destreg,*shiftreg,M.x86.R_CL);
- } else {
- u16 *destreg,*shiftreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",CL\n");
- TRACE_AND_STEP();
- *destreg = shrd_word(*destreg,*shiftreg,M.x86.R_CL);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*shiftreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ *destreg = shrd_long(*destreg,*shiftreg,M.x86.R_CL);
+ } else {
+ u16 *destreg,*shiftreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ *destreg = shrd_word(*destreg,*shiftreg,M.x86.R_CL);
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -1107,164 +1107,164 @@ void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
- u32 res_lo,res_hi;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_long(srcoffset);
- TRACE_AND_STEP();
- imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)srcval);
- if (res_hi != 0) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u32)res_lo;
- } else {
- u16 *destreg;
- u16 srcval;
- u32 res;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_word(srcoffset);
- TRACE_AND_STEP();
- res = (s16)*destreg * (s16)srcval;
- if (res > 0xFFFF) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u16)res;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+ u32 res_lo,res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)srcval);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32)res_lo;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ TRACE_AND_STEP();
+ res = (s16)*destreg * (s16)srcval;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16)res;
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
- u32 res_lo,res_hi;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_long(srcoffset);
- TRACE_AND_STEP();
- imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)srcval);
- if (res_hi != 0) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u32)res_lo;
- } else {
- u16 *destreg;
- u16 srcval;
- u32 res;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_word(srcoffset);
- TRACE_AND_STEP();
- res = (s16)*destreg * (s16)srcval;
- if (res > 0xFFFF) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u16)res;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+ u32 res_lo,res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)srcval);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32)res_lo;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ TRACE_AND_STEP();
+ res = (s16)*destreg * (s16)srcval;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16)res;
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
- u32 res_lo,res_hi;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_long(srcoffset);
- TRACE_AND_STEP();
- imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)srcval);
- if (res_hi != 0) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u32)res_lo;
- } else {
- u16 *destreg;
- u16 srcval;
- u32 res;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_word(srcoffset);
- TRACE_AND_STEP();
- res = (s16)*destreg * (s16)srcval;
- if (res > 0xFFFF) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u16)res;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+ u32 res_lo,res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)srcval);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32)res_lo;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ TRACE_AND_STEP();
+ res = (s16)*destreg * (s16)srcval;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16)res;
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
- u32 res_lo,res_hi;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- TRACE_AND_STEP();
- imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)*srcreg);
- if (res_hi != 0) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u32)res_lo;
- } else {
- u16 *destreg,*srcreg;
- u32 res;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- res = (s16)*destreg * (s16)*srcreg;
- if (res > 0xFFFF) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u16)res;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+ u32 res_lo,res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)*srcreg);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32)res_lo;
+ } else {
+ u16 *destreg,*srcreg;
+ u32 res;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ res = (s16)*destreg * (s16)*srcreg;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16)res;
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -1285,35 +1285,35 @@ void x86emuOp2_lss_R_IMM(u8 X86EMU_UNUSED(op2))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *dstreg = fetch_data_word(srcoffset);
- M.x86.R_SS = fetch_data_word(srcoffset + 2);
- break;
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_SS = fetch_data_word(srcoffset + 2);
+ break;
case 1:
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *dstreg = fetch_data_word(srcoffset);
- M.x86.R_SS = fetch_data_word(srcoffset + 2);
- break;
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_SS = fetch_data_word(srcoffset + 2);
+ break;
case 2:
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *dstreg = fetch_data_word(srcoffset);
- M.x86.R_SS = fetch_data_word(srcoffset + 2);
- break;
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_SS = fetch_data_word(srcoffset + 2);
+ break;
case 3: /* register to register */
- /* UNDEFINED! */
- TRACE_AND_STEP();
+ /* UNDEFINED! */
+ TRACE_AND_STEP();
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -1473,35 +1473,35 @@ void x86emuOp2_lfs_R_IMM(u8 X86EMU_UNUSED(op2))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *dstreg = fetch_data_word(srcoffset);
- M.x86.R_FS = fetch_data_word(srcoffset + 2);
- break;
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_FS = fetch_data_word(srcoffset + 2);
+ break;
case 1:
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *dstreg = fetch_data_word(srcoffset);
- M.x86.R_FS = fetch_data_word(srcoffset + 2);
- break;
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_FS = fetch_data_word(srcoffset + 2);
+ break;
case 2:
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *dstreg = fetch_data_word(srcoffset);
- M.x86.R_FS = fetch_data_word(srcoffset + 2);
- break;
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_FS = fetch_data_word(srcoffset + 2);
+ break;
case 3: /* register to register */
- /* UNDEFINED! */
- TRACE_AND_STEP();
+ /* UNDEFINED! */
+ TRACE_AND_STEP();
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -1522,35 +1522,35 @@ void x86emuOp2_lgs_R_IMM(u8 X86EMU_UNUSED(op2))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *dstreg = fetch_data_word(srcoffset);
- M.x86.R_GS = fetch_data_word(srcoffset + 2);
- break;
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_GS = fetch_data_word(srcoffset + 2);
+ break;
case 1:
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *dstreg = fetch_data_word(srcoffset);
- M.x86.R_GS = fetch_data_word(srcoffset + 2);
- break;
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_GS = fetch_data_word(srcoffset + 2);
+ break;
case 2:
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *dstreg = fetch_data_word(srcoffset);
- M.x86.R_GS = fetch_data_word(srcoffset + 2);
- break;
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_GS = fetch_data_word(srcoffset + 2);
+ break;
case 3: /* register to register */
- /* UNDEFINED! */
- TRACE_AND_STEP();
+ /* UNDEFINED! */
+ TRACE_AND_STEP();
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -1570,103 +1570,103 @@ void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u8 *srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = *srcreg;
- } else {
- u16 *destreg;
- u8 *srcreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = *srcreg;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u8 *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ } else {
+ u16 *destreg;
+ u8 *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -1689,40 +1689,40 @@ void x86emuOp2_movzx_word_R_RM(u8 X86EMU_UNUSED(op2))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- break;
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
case 1:
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- break;
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
case 2:
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- break;
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = *srcreg;
- break;
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -1742,237 +1742,237 @@ void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (rh) {
case 3:
- DECODE_PRINTF("BT\t");
- break;
+ DECODE_PRINTF("BT\t");
+ break;
case 4:
- DECODE_PRINTF("BTS\t");
- break;
+ DECODE_PRINTF("BTS\t");
+ break;
case 5:
- DECODE_PRINTF("BTR\t");
- break;
+ DECODE_PRINTF("BTR\t");
+ break;
case 6:
- DECODE_PRINTF("BTC\t");
- break;
+ DECODE_PRINTF("BTC\t");
+ break;
default:
- DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
- TRACE_REGS();
- printk("%04x:%04x: %02X%02X ILLEGAL EXTENDED X86 OPCODE EXTENSION!\n",
- M.x86.R_CS, M.x86.R_IP-3,op2, (mod<<6)|(rh<<3)|rl);
- HALT_SYS();
+ DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
+ TRACE_REGS();
+ printk("%04x:%04x: %02X%02X ILLEGAL EXTENDED X86 OPCODE EXTENSION!\n",
+ M.x86.R_CS, M.x86.R_IP-3,op2, (mod<<6)|(rh<<3)|rl);
+ HALT_SYS();
}
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval, mask;
- u8 shift;
-
- srcoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- shift = fetch_byte_imm();
- TRACE_AND_STEP();
- bit = shift & 0x1F;
- srcval = fetch_data_long(srcoffset);
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- switch (rh) {
- case 4:
- store_data_long(srcoffset, srcval | mask);
- break;
- case 5:
- store_data_long(srcoffset, srcval & ~mask);
- break;
- case 6:
- store_data_long(srcoffset, srcval ^ mask);
- break;
- default:
- break;
- }
- } else {
- u16 srcval, mask;
- u8 shift;
-
- srcoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- shift = fetch_byte_imm();
- TRACE_AND_STEP();
- bit = shift & 0xF;
- srcval = fetch_data_word(srcoffset);
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- switch (rh) {
- case 4:
- store_data_word(srcoffset, srcval | mask);
- break;
- case 5:
- store_data_word(srcoffset, srcval & ~mask);
- break;
- case 6:
- store_data_word(srcoffset, srcval ^ mask);
- break;
- default:
- break;
- }
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval, mask;
+ u8 shift;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ TRACE_AND_STEP();
+ bit = shift & 0x1F;
+ srcval = fetch_data_long(srcoffset);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ switch (rh) {
+ case 4:
+ store_data_long(srcoffset, srcval | mask);
+ break;
+ case 5:
+ store_data_long(srcoffset, srcval & ~mask);
+ break;
+ case 6:
+ store_data_long(srcoffset, srcval ^ mask);
+ break;
+ default:
+ break;
+ }
+ } else {
+ u16 srcval, mask;
+ u8 shift;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ TRACE_AND_STEP();
+ bit = shift & 0xF;
+ srcval = fetch_data_word(srcoffset);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ switch (rh) {
+ case 4:
+ store_data_word(srcoffset, srcval | mask);
+ break;
+ case 5:
+ store_data_word(srcoffset, srcval & ~mask);
+ break;
+ case 6:
+ store_data_word(srcoffset, srcval ^ mask);
+ break;
+ default:
+ break;
+ }
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval, mask;
- u8 shift;
-
- srcoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- shift = fetch_byte_imm();
- TRACE_AND_STEP();
- bit = shift & 0x1F;
- srcval = fetch_data_long(srcoffset);
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- switch (rh) {
- case 4:
- store_data_long(srcoffset, srcval | mask);
- break;
- case 5:
- store_data_long(srcoffset, srcval & ~mask);
- break;
- case 6:
- store_data_long(srcoffset, srcval ^ mask);
- break;
- default:
- break;
- }
- } else {
- u16 srcval, mask;
- u8 shift;
-
- srcoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- shift = fetch_byte_imm();
- TRACE_AND_STEP();
- bit = shift & 0xF;
- srcval = fetch_data_word(srcoffset);
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- switch (rh) {
- case 4:
- store_data_word(srcoffset, srcval | mask);
- break;
- case 5:
- store_data_word(srcoffset, srcval & ~mask);
- break;
- case 6:
- store_data_word(srcoffset, srcval ^ mask);
- break;
- default:
- break;
- }
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval, mask;
+ u8 shift;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ TRACE_AND_STEP();
+ bit = shift & 0x1F;
+ srcval = fetch_data_long(srcoffset);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ switch (rh) {
+ case 4:
+ store_data_long(srcoffset, srcval | mask);
+ break;
+ case 5:
+ store_data_long(srcoffset, srcval & ~mask);
+ break;
+ case 6:
+ store_data_long(srcoffset, srcval ^ mask);
+ break;
+ default:
+ break;
+ }
+ } else {
+ u16 srcval, mask;
+ u8 shift;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ TRACE_AND_STEP();
+ bit = shift & 0xF;
+ srcval = fetch_data_word(srcoffset);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ switch (rh) {
+ case 4:
+ store_data_word(srcoffset, srcval | mask);
+ break;
+ case 5:
+ store_data_word(srcoffset, srcval & ~mask);
+ break;
+ case 6:
+ store_data_word(srcoffset, srcval ^ mask);
+ break;
+ default:
+ break;
+ }
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval, mask;
- u8 shift;
-
- srcoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- shift = fetch_byte_imm();
- TRACE_AND_STEP();
- bit = shift & 0x1F;
- srcval = fetch_data_long(srcoffset);
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- switch (rh) {
- case 4:
- store_data_long(srcoffset, srcval | mask);
- break;
- case 5:
- store_data_long(srcoffset, srcval & ~mask);
- break;
- case 6:
- store_data_long(srcoffset, srcval ^ mask);
- break;
- default:
- break;
- }
- } else {
- u16 srcval, mask;
- u8 shift;
-
- srcoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- shift = fetch_byte_imm();
- TRACE_AND_STEP();
- bit = shift & 0xF;
- srcval = fetch_data_word(srcoffset);
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- switch (rh) {
- case 4:
- store_data_word(srcoffset, srcval | mask);
- break;
- case 5:
- store_data_word(srcoffset, srcval & ~mask);
- break;
- case 6:
- store_data_word(srcoffset, srcval ^ mask);
- break;
- default:
- break;
- }
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval, mask;
+ u8 shift;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ TRACE_AND_STEP();
+ bit = shift & 0x1F;
+ srcval = fetch_data_long(srcoffset);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ switch (rh) {
+ case 4:
+ store_data_long(srcoffset, srcval | mask);
+ break;
+ case 5:
+ store_data_long(srcoffset, srcval & ~mask);
+ break;
+ case 6:
+ store_data_long(srcoffset, srcval ^ mask);
+ break;
+ default:
+ break;
+ }
+ } else {
+ u16 srcval, mask;
+ u8 shift;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ TRACE_AND_STEP();
+ bit = shift & 0xF;
+ srcval = fetch_data_word(srcoffset);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ switch (rh) {
+ case 4:
+ store_data_word(srcoffset, srcval | mask);
+ break;
+ case 5:
+ store_data_word(srcoffset, srcval & ~mask);
+ break;
+ case 6:
+ store_data_word(srcoffset, srcval ^ mask);
+ break;
+ default:
+ break;
+ }
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *srcreg;
- u32 mask;
- u8 shift;
-
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- shift = fetch_byte_imm();
- TRACE_AND_STEP();
- bit = shift & 0x1F;
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
- switch (rh) {
- case 4:
- *srcreg |= mask;
- break;
- case 5:
- *srcreg &= ~mask;
- break;
- case 6:
- *srcreg ^= mask;
- break;
- default:
- break;
- }
- } else {
- u16 *srcreg;
- u16 mask;
- u8 shift;
-
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- shift = fetch_byte_imm();
- TRACE_AND_STEP();
- bit = shift & 0xF;
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
- switch (rh) {
- case 4:
- *srcreg |= mask;
- break;
- case 5:
- *srcreg &= ~mask;
- break;
- case 6:
- *srcreg ^= mask;
- break;
- default:
- break;
- }
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg;
+ u32 mask;
+ u8 shift;
+
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ TRACE_AND_STEP();
+ bit = shift & 0x1F;
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
+ switch (rh) {
+ case 4:
+ *srcreg |= mask;
+ break;
+ case 5:
+ *srcreg &= ~mask;
+ break;
+ case 6:
+ *srcreg ^= mask;
+ break;
+ default:
+ break;
+ }
+ } else {
+ u16 *srcreg;
+ u16 mask;
+ u8 shift;
+
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ TRACE_AND_STEP();
+ bit = shift & 0xF;
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
+ switch (rh) {
+ case 4:
+ *srcreg |= mask;
+ break;
+ case 5:
+ *srcreg &= ~mask;
+ break;
+ case 6:
+ *srcreg ^= mask;
+ break;
+ default:
+ break;
+ }
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -1993,109 +1993,109 @@ void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval,mask;
- u32 *shiftreg;
-
- srcoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0x1F;
- disp = (s16)*shiftreg >> 5;
- srcval = fetch_data_long(srcoffset+disp);
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- store_data_long(srcoffset+disp, srcval ^ mask);
- } else {
- u16 srcval,mask;
- u16 *shiftreg;
-
- srcoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0xF;
- disp = (s16)*shiftreg >> 4;
- srcval = fetch_data_word(srcoffset+disp);
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval,mask;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ disp = (s16)*shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset+disp);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ store_data_long(srcoffset+disp, srcval ^ mask);
+ } else {
+ u16 srcval,mask;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ disp = (s16)*shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset+disp);
mask = (u16)(0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
store_data_word(srcoffset+disp, (u16)(srcval ^ mask));
- }
- break;
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval,mask;
- u32 *shiftreg;
-
- srcoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0x1F;
- disp = (s16)*shiftreg >> 5;
- srcval = fetch_data_long(srcoffset+disp);
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- store_data_long(srcoffset+disp, srcval ^ mask);
- } else {
- u16 srcval,mask;
- u16 *shiftreg;
-
- srcoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0xF;
- disp = (s16)*shiftreg >> 4;
- srcval = fetch_data_word(srcoffset+disp);
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval,mask;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ disp = (s16)*shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset+disp);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ store_data_long(srcoffset+disp, srcval ^ mask);
+ } else {
+ u16 srcval,mask;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ disp = (s16)*shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset+disp);
mask = (u16)(0x1 << bit);
CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
store_data_word(srcoffset+disp, (u16)(srcval ^ mask));
- }
- break;
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval,mask;
- u32 *shiftreg;
-
- srcoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0x1F;
- disp = (s16)*shiftreg >> 5;
- srcval = fetch_data_long(srcoffset+disp);
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- store_data_long(srcoffset+disp, srcval ^ mask);
- } else {
- u16 srcval,mask;
- u16 *shiftreg;
-
- srcoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0xF;
- disp = (s16)*shiftreg >> 4;
- srcval = fetch_data_word(srcoffset+disp);
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval,mask;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ disp = (s16)*shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset+disp);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ store_data_long(srcoffset+disp, srcval ^ mask);
+ } else {
+ u16 srcval,mask;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ disp = (s16)*shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset+disp);
mask = (u16)(0x1 << bit);
CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
store_data_word(srcoffset+disp, (u16)(srcval ^ mask));
- }
- break;
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
u32 *srcreg,*shiftreg;
- u32 mask;
-
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0x1F;
- mask = (0x1 << bit);
+ u32 mask;
+
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ mask = (0x1 << bit);
CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
*srcreg ^= mask;
} else {
@@ -2108,10 +2108,10 @@ void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
TRACE_AND_STEP();
bit = *shiftreg & 0xF;
mask = (u16)(0x1 << bit);
- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
- *srcreg ^= mask;
- }
- break;
+ CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
+ *srcreg ^= mask;
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -2363,103 +2363,103 @@ void x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = (s32)((s8)fetch_data_byte(srcoffset));
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = (s16)((s8)fetch_data_byte(srcoffset));
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = (s32)((s8)fetch_data_byte(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = (s16)((s8)fetch_data_byte(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = (s32)((s8)fetch_data_byte(srcoffset));
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = (s16)((s8)fetch_data_byte(srcoffset));
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = (s32)((s8)fetch_data_byte(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = (s16)((s8)fetch_data_byte(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = (s32)((s8)fetch_data_byte(srcoffset));
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = (s16)((s8)fetch_data_byte(srcoffset));
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = (s32)((s8)fetch_data_byte(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = (s16)((s8)fetch_data_byte(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ }
+ break;
case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u8 *srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = (s32)((s8)*srcreg);
- } else {
- u16 *destreg;
- u8 *srcreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = (s16)((s8)*srcreg);
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u8 *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = (s32)((s8)*srcreg);
+ } else {
+ u16 *destreg;
+ u8 *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = (s16)((s8)*srcreg);
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -2482,40 +2482,40 @@ void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = (s32)((s16)fetch_data_word(srcoffset));
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- break;
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = (s32)((s16)fetch_data_word(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
case 1:
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = (s32)((s16)fetch_data_word(srcoffset));
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- break;
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = (s32)((s16)fetch_data_word(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
case 2:
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = (s32)((s16)fetch_data_word(srcoffset));
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- break;
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = (s32)((s16)fetch_data_word(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
case 3: /* register to register */
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = (s32)((s16)*srcreg);
- break;
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = (s32)((s16)*srcreg);
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
diff --git a/board/MAI/bios_emulator/scitech/src/x86emu/prim_ops.c b/board/MAI/bios_emulator/scitech/src/x86emu/prim_ops.c
index ba4ffdeda3..72b1bf2879 100644
--- a/board/MAI/bios_emulator/scitech/src/x86emu/prim_ops.c
+++ b/board/MAI/bios_emulator/scitech/src/x86emu/prim_ops.c
@@ -843,9 +843,9 @@ u8 rcl_byte(u8 d, u8 s)
/* s is the rotate distance. It varies from 0 - 8. */
/* have
- CF B_7 B_6 B_5 B_4 B_3 B_2 B_1 B_0
+ CF B_7 B_6 B_5 B_4 B_3 B_2 B_1 B_0
- want to rotate through the carry by "s" bits. We could
+ want to rotate through the carry by "s" bits. We could
loop, but that's inefficient. So the width is 9,
and we split into three parts:
@@ -855,12 +855,12 @@ u8 rcl_byte(u8 d, u8 s)
The new rotate is done mod 9, and given this,
for a rotation of n bits (mod 9) the new carry flag is
- then located n bits from the MSB. The low part is
+ then located n bits from the MSB. The low part is
then shifted up cnt bits, and the high part is or'd
- in. Using CAPS for new values, and lowercase for the
+ in. Using CAPS for new values, and lowercase for the
original values, this can be expressed as:
- IF n > 0
+ IF n > 0
1) CF <- b_(8-n)
2) B_(7) .. B_(n) <- b_(8-(n+1)) .. b_0
3) B_(n-1) <- cf
@@ -868,37 +868,37 @@ u8 rcl_byte(u8 d, u8 s)
*/
res = d;
if ((cnt = s % 9) != 0) {
- /* extract the new CARRY FLAG. */
- /* CF <- b_(8-n) */
- cf = (d >> (8 - cnt)) & 0x1;
-
- /* get the low stuff which rotated
- into the range B_7 .. B_cnt */
- /* B_(7) .. B_(n) <- b_(8-(n+1)) .. b_0 */
- /* note that the right hand side done by the mask */
+ /* extract the new CARRY FLAG. */
+ /* CF <- b_(8-n) */
+ cf = (d >> (8 - cnt)) & 0x1;
+
+ /* get the low stuff which rotated
+ into the range B_7 .. B_cnt */
+ /* B_(7) .. B_(n) <- b_(8-(n+1)) .. b_0 */
+ /* note that the right hand side done by the mask */
res = (d << cnt) & 0xff;
- /* now the high stuff which rotated around
- into the positions B_cnt-2 .. B_0 */
- /* B_(n-2) .. B_0 <- b_7 .. b_(8-(n-1)) */
- /* shift it downward, 7-(n-2) = 9-n positions.
- and mask off the result before or'ing in.
- */
- mask = (1 << (cnt - 1)) - 1;
- res |= (d >> (9 - cnt)) & mask;
+ /* now the high stuff which rotated around
+ into the positions B_cnt-2 .. B_0 */
+ /* B_(n-2) .. B_0 <- b_7 .. b_(8-(n-1)) */
+ /* shift it downward, 7-(n-2) = 9-n positions.
+ and mask off the result before or'ing in.
+ */
+ mask = (1 << (cnt - 1)) - 1;
+ res |= (d >> (9 - cnt)) & mask;
- /* if the carry flag was set, or it in. */
+ /* if the carry flag was set, or it in. */
if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
- /* B_(n-1) <- cf */
- res |= 1 << (cnt - 1);
- }
- /* set the new carry flag, based on the variable "cf" */
+ /* B_(n-1) <- cf */
+ res |= 1 << (cnt - 1);
+ }
+ /* set the new carry flag, based on the variable "cf" */
CONDITIONAL_SET_FLAG(cf, F_CF);
- /* OVERFLOW is set *IFF* cnt==1, then it is the
- xor of CF and the most significant bit. Blecck. */
- /* parenthesized this expression since it appears to
- be causing OF to be misset */
- CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 6) & 0x2)),
+ /* OVERFLOW is set *IFF* cnt==1, then it is the
+ xor of CF and the most significant bit. Blecck. */
+ /* parenthesized this expression since it appears to
+ be causing OF to be misset */
+ CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 6) & 0x2)),
F_OF);
}
@@ -963,22 +963,22 @@ u8 rcr_byte(u8 d, u8 s)
u32 mask, cf, ocf = 0;
/* rotate right through carry */
- /*
+ /*
s is the rotate distance. It varies from 0 - 8.
- d is the byte object rotated.
+ d is the byte object rotated.
- have
+ have
- CF B_7 B_6 B_5 B_4 B_3 B_2 B_1 B_0
+ CF B_7 B_6 B_5 B_4 B_3 B_2 B_1 B_0
The new rotate is done mod 9, and given this,
for a rotation of n bits (mod 9) the new carry flag is
- then located n bits from the LSB. The low part is
+ then located n bits from the LSB. The low part is
then shifted up cnt bits, and the high part is or'd
- in. Using CAPS for new values, and lowercase for the
+ in. Using CAPS for new values, and lowercase for the
original values, this can be expressed as:
- IF n > 0
+ IF n > 0
1) CF <- b_(n-1)
2) B_(8-(n+1)) .. B_(0) <- b_(7) .. b_(n)
3) B_(8-n) <- cf
@@ -986,49 +986,49 @@ u8 rcr_byte(u8 d, u8 s)
*/
res = d;
if ((cnt = s % 9) != 0) {
- /* extract the new CARRY FLAG. */
- /* CF <- b_(n-1) */
- if (cnt == 1) {
- cf = d & 0x1;
- /* note hackery here. Access_flag(..) evaluates to either
- 0 if flag not set
- non-zero if flag is set.
- doing access_flag(..) != 0 casts that into either
+ /* extract the new CARRY FLAG. */
+ /* CF <- b_(n-1) */
+ if (cnt == 1) {
+ cf = d & 0x1;
+ /* note hackery here. Access_flag(..) evaluates to either
+ 0 if flag not set
+ non-zero if flag is set.
+ doing access_flag(..) != 0 casts that into either
0..1 in any representation of the flags register
- (i.e. packed bit array or unpacked.)
- */
+ (i.e. packed bit array or unpacked.)
+ */
ocf = ACCESS_FLAG(F_CF) != 0;
- } else
- cf = (d >> (cnt - 1)) & 0x1;
-
- /* B_(8-(n+1)) .. B_(0) <- b_(7) .. b_n */
- /* note that the right hand side done by the mask
- This is effectively done by shifting the
- object to the right. The result must be masked,
- in case the object came in and was treated
- as a negative number. Needed??? */
-
- mask = (1 << (8 - cnt)) - 1;
- res = (d >> cnt) & mask;
-
- /* now the high stuff which rotated around
- into the positions B_cnt-2 .. B_0 */
- /* B_(7) .. B_(8-(n-1)) <- b_(n-2) .. b_(0) */
- /* shift it downward, 7-(n-2) = 9-n positions.
- and mask off the result before or'ing in.
- */
- res |= (d << (9 - cnt));
-
- /* if the carry flag was set, or it in. */
+ } else
+ cf = (d >> (cnt - 1)) & 0x1;
+
+ /* B_(8-(n+1)) .. B_(0) <- b_(7) .. b_n */
+ /* note that the right hand side done by the mask
+ This is effectively done by shifting the
+ object to the right. The result must be masked,
+ in case the object came in and was treated
+ as a negative number. Needed??? */
+
+ mask = (1 << (8 - cnt)) - 1;
+ res = (d >> cnt) & mask;
+
+ /* now the high stuff which rotated around
+ into the positions B_cnt-2 .. B_0 */
+ /* B_(7) .. B_(8-(n-1)) <- b_(n-2) .. b_(0) */
+ /* shift it downward, 7-(n-2) = 9-n positions.
+ and mask off the result before or'ing in.
+ */
+ res |= (d << (9 - cnt));
+
+ /* if the carry flag was set, or it in. */
if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
- /* B_(8-n) <- cf */
- res |= 1 << (8 - cnt);
- }
- /* set the new carry flag, based on the variable "cf" */
+ /* B_(8-n) <- cf */
+ res |= 1 << (8 - cnt);
+ }
+ /* set the new carry flag, based on the variable "cf" */
CONDITIONAL_SET_FLAG(cf, F_CF);
- /* OVERFLOW is set *IFF* cnt==1, then it is the
- xor of CF and the most significant bit. Blecck. */
- /* parenthesized... */
+ /* OVERFLOW is set *IFF* cnt==1, then it is the
+ xor of CF and the most significant bit. Blecck. */
+ /* parenthesized... */
if (cnt == 1) {
CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 6) & 0x2)),
F_OF);
@@ -1111,18 +1111,18 @@ u8 rol_byte(u8 d, u8 s)
register unsigned int res, cnt, mask;
/* rotate left */
- /*
+ /*
s is the rotate distance. It varies from 0 - 8.
- d is the byte object rotated.
+ d is the byte object rotated.
- have
+ have
- CF B_7 ... B_0
+ CF B_7 ... B_0
The new rotate is done mod 8.
Much simpler than the "rcl" or "rcr" operations.
- IF n > 0
+ IF n > 0
1) B_(7) .. B_(n) <- b_(8-(n+1)) .. b_(0)
2) B_(n-1) .. B_(0) <- b_(7) .. b_(8-n)
*/
@@ -1210,34 +1210,34 @@ u8 ror_byte(u8 d, u8 s)
register unsigned int res, cnt, mask;
/* rotate right */
- /*
+ /*
s is the rotate distance. It varies from 0 - 8.
- d is the byte object rotated.
+ d is the byte object rotated.
- have
+ have
- B_7 ... B_0
+ B_7 ... B_0
The rotate is done mod 8.
- IF n > 0
+ IF n > 0
1) B_(8-(n+1)) .. B_(0) <- b_(7) .. b_(n)
2) B_(7) .. B_(8-n) <- b_(n-1) .. b_(0)
*/
res = d;
if ((cnt = s % 8) != 0) { /* not a typo, do nada if cnt==0 */
- /* B_(7) .. B_(8-n) <- b_(n-1) .. b_(0) */
- res = (d << (8 - cnt));
+ /* B_(7) .. B_(8-n) <- b_(n-1) .. b_(0) */
+ res = (d << (8 - cnt));
- /* B_(8-(n+1)) .. B_(0) <- b_(7) .. b_(n) */
- mask = (1 << (8 - cnt)) - 1;
- res |= (d >> (cnt)) & mask;
+ /* B_(8-(n+1)) .. B_(0) <- b_(7) .. b_(n) */
+ mask = (1 << (8 - cnt)) - 1;
+ res |= (d >> (cnt)) & mask;
- /* set the new carry flag, Note that it is the low order
- bit of the result!!! */
+ /* set the new carry flag, Note that it is the low order
+ bit of the result!!! */
CONDITIONAL_SET_FLAG(res & 0x80, F_CF);
/* OVERFLOW is set *IFF* s==1, then it is the
- xor of the two most significant bits. Blecck. */
+ xor of the two most significant bits. Blecck. */
CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 6), F_OF);
} else if (s != 0) {
/* set the new carry flag, Note that it is the low order
@@ -1363,9 +1363,9 @@ u16 shl_word(u16 d, u8 s)
(((res & 0x8000) == 0x8000) ^
(ACCESS_FLAG(F_CF) != 0)),
F_OF);
- } else {
+ } else {
CLEAR_FLAG(F_OF);
- }
+ }
} else {
res = 0;
CONDITIONAL_SET_FLAG((d << (s-1)) & 0x8000, F_CF);
@@ -1474,9 +1474,9 @@ u16 shr_word(u16 d, u8 s)
if (cnt == 1) {
CONDITIONAL_SET_FLAG(XOR2(res >> 14), F_OF);
- } else {
+ } else {
CLEAR_FLAG(F_OF);
- }
+ }
} else {
res = 0;
CLEAR_FLAG(F_CF);
@@ -1505,16 +1505,16 @@ u32 shr_long(u32 d, u8 s)
CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- } else {
- res = d;
- }
- if (cnt == 1) {
+ } else {
+ res = d;
+ }
+ if (cnt == 1) {
CONDITIONAL_SET_FLAG(XOR2(res >> 30), F_OF);
- } else {
+ } else {
CLEAR_FLAG(F_OF);
- }
+ }
} else {
- res = 0;
+ res = 0;
CLEAR_FLAG(F_CF);
CLEAR_FLAG(F_OF);
SET_FLAG(F_ZF);
@@ -1547,8 +1547,8 @@ u8 sar_byte(u8 d, u8 s)
CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
} else if (cnt >= 8) {
- if (sf) {
- res = 0xff;
+ if (sf) {
+ res = 0xff;
SET_FLAG(F_CF);
CLEAR_FLAG(F_ZF);
SET_FLAG(F_SF);
@@ -1576,30 +1576,30 @@ u16 sar_word(u16 d, u8 s)
cnt = s % 16;
res = d;
if (cnt > 0 && cnt < 16) {
- mask = (1 << (16 - cnt)) - 1;
- cf = d & (1 << (cnt - 1));
- res = (d >> cnt) & mask;
+ mask = (1 << (16 - cnt)) - 1;
+ cf = d & (1 << (cnt - 1));
+ res = (d >> cnt) & mask;
CONDITIONAL_SET_FLAG(cf, F_CF);
- if (sf) {
- res |= ~mask;
- }
+ if (sf) {
+ res |= ~mask;
+ }
CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
} else if (cnt >= 16) {
- if (sf) {
- res = 0xffff;
+ if (sf) {
+ res = 0xffff;
SET_FLAG(F_CF);
CLEAR_FLAG(F_ZF);
SET_FLAG(F_SF);
SET_FLAG(F_PF);
- } else {
- res = 0;
+ } else {
+ res = 0;
CLEAR_FLAG(F_CF);
SET_FLAG(F_ZF);
CLEAR_FLAG(F_SF);
CLEAR_FLAG(F_PF);
- }
+ }
}
return (u16)res;
}
@@ -1616,19 +1616,19 @@ u32 sar_long(u32 d, u8 s)
cnt = s % 32;
res = d;
if (cnt > 0 && cnt < 32) {
- mask = (1 << (32 - cnt)) - 1;
+ mask = (1 << (32 - cnt)) - 1;
cf = d & (1 << (cnt - 1));
- res = (d >> cnt) & mask;
+ res = (d >> cnt) & mask;
CONDITIONAL_SET_FLAG(cf, F_CF);
- if (sf) {
- res |= ~mask;
- }
+ if (sf) {
+ res |= ~mask;
+ }
CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
} else if (cnt >= 32) {
- if (sf) {
- res = 0xffffffff;
+ if (sf) {
+ res = 0xffffffff;
SET_FLAG(F_CF);
CLEAR_FLAG(F_ZF);
SET_FLAG(F_SF);
@@ -1741,9 +1741,9 @@ u16 shrd_word (u16 d, u16 fill, u8 s)
if (cnt == 1) {
CONDITIONAL_SET_FLAG(XOR2(res >> 14), F_OF);
- } else {
+ } else {
CLEAR_FLAG(F_OF);
- }
+ }
} else {
res = 0;
CLEAR_FLAG(F_CF);
@@ -1777,9 +1777,9 @@ u32 shrd_long (u32 d, u32 fill, u8 s)
}
if (cnt == 1) {
CONDITIONAL_SET_FLAG(XOR2(res >> 30), F_OF);
- } else {
+ } else {
CLEAR_FLAG(F_OF);
- }
+ }
} else {
res = 0;
CLEAR_FLAG(F_CF);
@@ -1826,9 +1826,9 @@ u16 sbb_word(u16 d, u16 s)
register u32 bc;
if (ACCESS_FLAG(F_CF))
- res = d - s - 1;
+ res = d - s - 1;
else
- res = d - s;
+ res = d - s;
CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
@@ -1851,9 +1851,9 @@ u32 sbb_long(u32 d, u32 s)
register u32 bc;
if (ACCESS_FLAG(F_CF))
- res = d - s - 1;
+ res = d - s - 1;
else
- res = d - s;
+ res = d - s;
CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
@@ -2219,7 +2219,7 @@ void idiv_byte(u8 s)
dvd = (s16)M.x86.R_AX;
if (s == 0) {
x86emu_intr_raise(0);
- return;
+ return;
}
div = dvd / (s8)s;
mod = dvd % (s8)s;
@@ -2297,7 +2297,7 @@ void idiv_long(u32 s)
do {
div <<= 1;
carry = (l_dvd >= l_s) ? 0 : 1;
-
+
if (abs_h_dvd < (h_s + carry)) {
h_s >>= 1;
l_s = abs_s << (--counter);
@@ -2311,7 +2311,7 @@ void idiv_long(u32 s)
div |= 1;
continue;
}
-
+
} while (counter > -1);
/* overflow */
if (abs_h_dvd || (l_dvd > abs_s)) {
@@ -2344,13 +2344,13 @@ void div_byte(u8 s)
dvd = M.x86.R_AX;
if (s == 0) {
x86emu_intr_raise(0);
- return;
+ return;
}
div = dvd / (u8)s;
mod = dvd % (u8)s;
if (abs(div) > 0xff) {
x86emu_intr_raise(0);
- return;
+ return;
}
M.x86.R_AL = (u8)div;
M.x86.R_AH = (u8)mod;
@@ -2367,7 +2367,7 @@ void div_word(u16 s)
dvd = (((u32)M.x86.R_DX) << 16) | M.x86.R_AX;
if (s == 0) {
x86emu_intr_raise(0);
- return;
+ return;
}
div = dvd / (u16)s;
mod = dvd % (u16)s;
@@ -2413,7 +2413,7 @@ void div_long(u32 s)
u32 l_s = 0;
int counter = 32;
int carry;
-
+
if (s == 0) {
x86emu_intr_raise(0);
return;
@@ -2421,7 +2421,7 @@ void div_long(u32 s)
do {
div <<= 1;
carry = (l_dvd >= l_s) ? 0 : 1;
-
+
if (h_dvd < (h_s + carry)) {
h_s >>= 1;
l_s = s << (--counter);
@@ -2435,7 +2435,7 @@ void div_long(u32 s)
div |= 1;
continue;
}
-
+
} while (counter > -1);
/* overflow */
if (h_dvd || (l_dvd > s)) {
@@ -2468,54 +2468,54 @@ void ins(int size)
inc = -size;
}
if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
- /* dont care whether REPE or REPNE */
- /* in until CX is ZERO. */
+ /* dont care whether REPE or REPNE */
+ /* in until CX is ZERO. */
u32 count = ((M.x86.mode & SYSMODE_PREFIX_DATA) ?
M.x86.R_ECX : M.x86.R_CX);
- switch (size) {
- case 1:
- while (count--) {
+ switch (size) {
+ case 1:
+ while (count--) {
store_data_byte_abs(M.x86.R_ES, M.x86.R_DI,
(*sys_inb)(M.x86.R_DX));
M.x86.R_DI += inc;
- }
- break;
+ }
+ break;
- case 2:
- while (count--) {
+ case 2:
+ while (count--) {
store_data_word_abs(M.x86.R_ES, M.x86.R_DI,
(*sys_inw)(M.x86.R_DX));
M.x86.R_DI += inc;
- }
- break;
- case 4:
- while (count--) {
+ }
+ break;
+ case 4:
+ while (count--) {
store_data_long_abs(M.x86.R_ES, M.x86.R_DI,
(*sys_inl)(M.x86.R_DX));
M.x86.R_DI += inc;
- break;
- }
- }
+ break;
+ }
+ }
M.x86.R_CX = 0;
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
M.x86.R_ECX = 0;
- }
+ }
M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
} else {
- switch (size) {
- case 1:
+ switch (size) {
+ case 1:
store_data_byte_abs(M.x86.R_ES, M.x86.R_DI,
(*sys_inb)(M.x86.R_DX));
- break;
- case 2:
+ break;
+ case 2:
store_data_word_abs(M.x86.R_ES, M.x86.R_DI,
(*sys_inw)(M.x86.R_DX));
- break;
- case 4:
+ break;
+ case 4:
store_data_long_abs(M.x86.R_ES, M.x86.R_DI,
(*sys_inl)(M.x86.R_DX));
- break;
- }
+ break;
+ }
M.x86.R_DI += inc;
}
}
@@ -2529,57 +2529,57 @@ void outs(int size)
int inc = size;
if (ACCESS_FLAG(F_DF)) {
- inc = -size;
+ inc = -size;
}
if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
- /* dont care whether REPE or REPNE */
- /* out until CX is ZERO. */
+ /* dont care whether REPE or REPNE */
+ /* out until CX is ZERO. */
u32 count = ((M.x86.mode & SYSMODE_PREFIX_DATA) ?
M.x86.R_ECX : M.x86.R_CX);
- switch (size) {
- case 1:
- while (count--) {
+ switch (size) {
+ case 1:
+ while (count--) {
(*sys_outb)(M.x86.R_DX,
fetch_data_byte_abs(M.x86.R_ES, M.x86.R_SI));
M.x86.R_SI += inc;
- }
- break;
+ }
+ break;
- case 2:
- while (count--) {
+ case 2:
+ while (count--) {
(*sys_outw)(M.x86.R_DX,
fetch_data_word_abs(M.x86.R_ES, M.x86.R_SI));
M.x86.R_SI += inc;
- }
- break;
- case 4:
- while (count--) {
+ }
+ break;
+ case 4:
+ while (count--) {
(*sys_outl)(M.x86.R_DX,
fetch_data_long_abs(M.x86.R_ES, M.x86.R_SI));
M.x86.R_SI += inc;
- break;
- }
- }
+ break;
+ }
+ }
M.x86.R_CX = 0;
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
M.x86.R_ECX = 0;
- }
+ }
M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
} else {
- switch (size) {
- case 1:
+ switch (size) {
+ case 1:
(*sys_outb)(M.x86.R_DX,
fetch_data_byte_abs(M.x86.R_ES, M.x86.R_SI));
- break;
- case 2:
+ break;
+ case 2:
(*sys_outw)(M.x86.R_DX,
fetch_data_word_abs(M.x86.R_ES, M.x86.R_SI));
- break;
- case 4:
+ break;
+ case 4:
(*sys_outl)(M.x86.R_DX,
fetch_data_long_abs(M.x86.R_ES, M.x86.R_SI));
- break;
- }
+ break;
+ }
M.x86.R_SI += inc;
}
}
diff --git a/board/MAI/bios_emulator/scitech/src/x86emu/sys.c b/board/MAI/bios_emulator/scitech/src/x86emu/sys.c
index d54ca79c0a..afe58f8647 100644
--- a/board/MAI/bios_emulator/scitech/src/x86emu/sys.c
+++ b/board/MAI/bios_emulator/scitech/src/x86emu/sys.c
@@ -129,7 +129,7 @@ static __inline__ unsigned long ldw_u(unsigned short * r11)
}
/*
- * Elemental unaligned stores
+ * Elemental unaligned stores
*/
static __inline__ void stq_u(unsigned long r5, unsigned long * r11)
@@ -268,7 +268,7 @@ RETURNS:
Byte value read from emulator memory.
REMARKS:
-Reads a byte value from the emulator memory.
+Reads a byte value from the emulator memory.
****************************************************************************/
u8 X86API rdb(
u32 addr)
@@ -330,7 +330,7 @@ addr - Emulator memory address to read
RETURNS:
Long value read from emulator memory.
REMARKS:
-Reads a long value from the emulator memory.
+Reads a long value from the emulator memory.
****************************************************************************/
u32 X86API rdl(
u32 addr)
@@ -423,7 +423,7 @@ addr - Emulator memory address to read
val - Value to store
REMARKS:
-Writes a long value to emulator memory.
+Writes a long value to emulator memory.
****************************************************************************/
void X86API wrl(
u32 addr,
@@ -623,7 +623,7 @@ void X86EMU_setupIntrFuncs(
X86EMU_intrFuncs funcs[])
{
int i;
-
+
for (i=0; i < 256; i++)
_X86EMU_intrTab[i] = NULL;
if (funcs) {
diff --git a/board/MAI/bios_emulator/scitech/src/x86emu/validate.c b/board/MAI/bios_emulator/scitech/src/x86emu/validate.c
index 239f6c1f34..c951301f96 100644
--- a/board/MAI/bios_emulator/scitech/src/x86emu/validate.c
+++ b/board/MAI/bios_emulator/scitech/src/x86emu/validate.c
@@ -63,63 +63,63 @@
int f,failed = false; \
char buf1[80],buf2[80]; \
for (d = 0; d < dmax; d += dincr) { \
- for (s = 0; s < smax; s += sincr) { \
- M.x86.R_EFLG = inflags = flags = def_flags; \
- for (f = 0; f < 2; f++) {
+ for (s = 0; s < smax; s += sincr) { \
+ M.x86.R_EFLG = inflags = flags = def_flags; \
+ for (f = 0; f < 2; f++) {
#define VAL_TEST_BINARY(name) \
- r_asm = name##_asm(&flags,d,s); \
- r = name(d,s); \
- if (r != r_asm || M.x86.R_EFLG != flags) \
- failed = true; \
- if (failed || trace) {
+ r_asm = name##_asm(&flags,d,s); \
+ r = name(d,s); \
+ if (r != r_asm || M.x86.R_EFLG != flags) \
+ failed = true; \
+ if (failed || trace) {
#define VAL_TEST_BINARY_VOID(name) \
- name##_asm(&flags,d,s); \
- name(d,s); \
- r = r_asm = 0; \
- if (M.x86.R_EFLG != flags) \
- failed = true; \
- if (failed || trace) {
+ name##_asm(&flags,d,s); \
+ name(d,s); \
+ r = r_asm = 0; \
+ if (M.x86.R_EFLG != flags) \
+ failed = true; \
+ if (failed || trace) {
#define VAL_FAIL_BYTE_BYTE_BINARY(name) \
- if (failed) \
- printk("fail\n"); \
- printk("0x%02X = %-15s(0x%02X,0x%02X), flags = %s -> %s\n", \
- r, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
- printk("0x%02X = %-15s(0x%02X,0x%02X), flags = %s -> %s\n", \
- r_asm, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags));
+ if (failed) \
+ printk("fail\n"); \
+ printk("0x%02X = %-15s(0x%02X,0x%02X), flags = %s -> %s\n", \
+ r, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%02X = %-15s(0x%02X,0x%02X), flags = %s -> %s\n", \
+ r_asm, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags));
#define VAL_FAIL_WORD_WORD_BINARY(name) \
- if (failed) \
- printk("fail\n"); \
- printk("0x%04X = %-15s(0x%04X,0x%04X), flags = %s -> %s\n", \
- r, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
- printk("0x%04X = %-15s(0x%04X,0x%04X), flags = %s -> %s\n", \
- r_asm, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags));
+ if (failed) \
+ printk("fail\n"); \
+ printk("0x%04X = %-15s(0x%04X,0x%04X), flags = %s -> %s\n", \
+ r, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%04X = %-15s(0x%04X,0x%04X), flags = %s -> %s\n", \
+ r_asm, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags));
#define VAL_FAIL_LONG_LONG_BINARY(name) \
- if (failed) \
- printk("fail\n"); \
- printk("0x%08X = %-15s(0x%08X,0x%08X), flags = %s -> %s\n", \
- r, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
- printk("0x%08X = %-15s(0x%08X,0x%08X), flags = %s -> %s\n", \
- r_asm, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags));
+ if (failed) \
+ printk("fail\n"); \
+ printk("0x%08X = %-15s(0x%08X,0x%08X), flags = %s -> %s\n", \
+ r, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%08X = %-15s(0x%08X,0x%08X), flags = %s -> %s\n", \
+ r_asm, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags));
#define VAL_END_BINARY() \
- } \
- M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \
- if (failed) \
- break; \
- } \
- if (failed) \
- break; \
- } \
- if (failed) \
- break; \
- } \
+ } \
+ M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
if (!failed) \
- printk("passed\n"); \
+ printk("passed\n"); \
}
#define VAL_BYTE_BYTE_BINARY(name) \
@@ -194,51 +194,51 @@
int f,failed = false; \
char buf1[80],buf2[80]; \
for (d = 0; d < dmax; d += dincr) { \
- for (s = 0; s < smax; s += sincr) { \
- for (shift = 0; shift < maxshift; shift += 1) { \
- M.x86.R_EFLG = inflags = flags = def_flags; \
- for (f = 0; f < 2; f++) {
+ for (s = 0; s < smax; s += sincr) { \
+ for (shift = 0; shift < maxshift; shift += 1) { \
+ M.x86.R_EFLG = inflags = flags = def_flags; \
+ for (f = 0; f < 2; f++) {
#define VAL_TEST_TERNARY(name) \
- r_asm = name##_asm(&flags,d,s,shift); \
- r = name(d,s,shift); \
- if (r != r_asm || M.x86.R_EFLG != flags) \
- failed = true; \
- if (failed || trace) {
+ r_asm = name##_asm(&flags,d,s,shift); \
+ r = name(d,s,shift); \
+ if (r != r_asm || M.x86.R_EFLG != flags) \
+ failed = true; \
+ if (failed || trace) {
#define VAL_FAIL_WORD_WORD_TERNARY(name) \
- if (failed) \
- printk("fail\n"); \
- printk("0x%04X = %-15s(0x%04X,0x%04X,%d), flags = %s -> %s\n", \
- r, #name, d, s, shift, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
- printk("0x%04X = %-15s(0x%04X,0x%04X,%d), flags = %s -> %s\n", \
- r_asm, #name"_asm", d, s, shift, print_flags(buf1,inflags), print_flags(buf2,flags));
+ if (failed) \
+ printk("fail\n"); \
+ printk("0x%04X = %-15s(0x%04X,0x%04X,%d), flags = %s -> %s\n", \
+ r, #name, d, s, shift, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%04X = %-15s(0x%04X,0x%04X,%d), flags = %s -> %s\n", \
+ r_asm, #name"_asm", d, s, shift, print_flags(buf1,inflags), print_flags(buf2,flags));
#define VAL_FAIL_LONG_LONG_TERNARY(name) \
- if (failed) \
- printk("fail\n"); \
- printk("0x%08X = %-15s(0x%08X,0x%08X,%d), flags = %s -> %s\n", \
- r, #name, d, s, shift, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
- printk("0x%08X = %-15s(0x%08X,0x%08X,%d), flags = %s -> %s\n", \
- r_asm, #name"_asm", d, s, shift, print_flags(buf1,inflags), print_flags(buf2,flags));
+ if (failed) \
+ printk("fail\n"); \
+ printk("0x%08X = %-15s(0x%08X,0x%08X,%d), flags = %s -> %s\n", \
+ r, #name, d, s, shift, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%08X = %-15s(0x%08X,0x%08X,%d), flags = %s -> %s\n", \
+ r_asm, #name"_asm", d, s, shift, print_flags(buf1,inflags), print_flags(buf2,flags));
#define VAL_END_TERNARY() \
- } \
- M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \
- if (failed) \
- break; \
- } \
- if (failed) \
- break; \
- } \
- if (failed) \
- break; \
- } \
- if (failed) \
- break; \
- } \
+ } \
+ M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
if (!failed) \
- printk("passed\n"); \
+ printk("passed\n"); \
}
#define VAL_WORD_ROTATE_DBL(name) \
@@ -262,47 +262,47 @@
int f,failed = false; \
char buf1[80],buf2[80]; \
for (d = 0; d < max; d += incr) { \
- M.x86.R_EFLG = inflags = flags = def_flags; \
- for (f = 0; f < 2; f++) {
+ M.x86.R_EFLG = inflags = flags = def_flags; \
+ for (f = 0; f < 2; f++) {
#define VAL_TEST_UNARY(name) \
- r_asm = name##_asm(&flags,d); \
- r = name(d); \
- if (r != r_asm || M.x86.R_EFLG != flags) { \
- failed = true;
+ r_asm = name##_asm(&flags,d); \
+ r = name(d); \
+ if (r != r_asm || M.x86.R_EFLG != flags) { \
+ failed = true;
#define VAL_FAIL_BYTE_UNARY(name) \
- printk("fail\n"); \
- printk("0x%02X = %-15s(0x%02X), flags = %s -> %s\n", \
- r, #name, d, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
- printk("0x%02X = %-15s(0x%02X), flags = %s -> %s\n", \
- r_asm, #name"_asm", d, print_flags(buf1,inflags), print_flags(buf2,flags));
+ printk("fail\n"); \
+ printk("0x%02X = %-15s(0x%02X), flags = %s -> %s\n", \
+ r, #name, d, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%02X = %-15s(0x%02X), flags = %s -> %s\n", \
+ r_asm, #name"_asm", d, print_flags(buf1,inflags), print_flags(buf2,flags));
#define VAL_FAIL_WORD_UNARY(name) \
- printk("fail\n"); \
- printk("0x%04X = %-15s(0x%04X), flags = %s -> %s\n", \
- r, #name, d, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
- printk("0x%04X = %-15s(0x%04X), flags = %s -> %s\n", \
- r_asm, #name"_asm", d, print_flags(buf1,inflags), print_flags(buf2,flags));
+ printk("fail\n"); \
+ printk("0x%04X = %-15s(0x%04X), flags = %s -> %s\n", \
+ r, #name, d, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%04X = %-15s(0x%04X), flags = %s -> %s\n", \
+ r_asm, #name"_asm", d, print_flags(buf1,inflags), print_flags(buf2,flags));
#define VAL_FAIL_LONG_UNARY(name) \
- printk("fail\n"); \
- printk("0x%08X = %-15s(0x%08X), flags = %s -> %s\n", \
- r, #name, d, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
- printk("0x%08X = %-15s(0x%08X), flags = %s -> %s\n", \
- r_asm, #name"_asm", d, print_flags(buf1,inflags), print_flags(buf2,flags));
+ printk("fail\n"); \
+ printk("0x%08X = %-15s(0x%08X), flags = %s -> %s\n", \
+ r, #name, d, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%08X = %-15s(0x%08X), flags = %s -> %s\n", \
+ r_asm, #name"_asm", d, print_flags(buf1,inflags), print_flags(buf2,flags));
#define VAL_END_UNARY() \
- } \
- M.x86.R_EFLG = inflags = flags = def_flags | ALL_FLAGS; \
- if (failed) \
- break; \
- } \
- if (failed) \
- break; \
- } \
+ } \
+ M.x86.R_EFLG = inflags = flags = def_flags | ALL_FLAGS; \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
if (!failed) \
- printk("passed\n"); \
+ printk("passed\n"); \
}
#define VAL_BYTE_UNARY(name) \
@@ -342,35 +342,35 @@
int f,failed = false; \
char buf1[80],buf2[80]; \
for (d = 0; d < 0xFF; d += 1) { \
- for (s = 0; s < 0xFF; s += 1) { \
- M.x86.R_EFLG = inflags = flags = def_flags; \
- for (f = 0; f < 2; f++) { \
- name##_asm(&flags,&r_asm,d,s); \
- M.x86.R_AL = d; \
- name(s); \
- r = M.x86.R_AX; \
- if (r != r_asm || M.x86.R_EFLG != flags) \
- failed = true; \
- if (failed || trace) { \
- if (failed) \
- printk("fail\n"); \
- printk("0x%04X = %-15s(0x%02X,0x%02X), flags = %s -> %s\n", \
- r, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
- printk("0x%04X = %-15s(0x%02X,0x%02X), flags = %s -> %s\n", \
- r_asm, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \
- } \
- M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \
- if (failed) \
- break; \
- } \
- if (failed) \
- break; \
- } \
- if (failed) \
- break; \
- } \
+ for (s = 0; s < 0xFF; s += 1) { \
+ M.x86.R_EFLG = inflags = flags = def_flags; \
+ for (f = 0; f < 2; f++) { \
+ name##_asm(&flags,&r_asm,d,s); \
+ M.x86.R_AL = d; \
+ name(s); \
+ r = M.x86.R_AX; \
+ if (r != r_asm || M.x86.R_EFLG != flags) \
+ failed = true; \
+ if (failed || trace) { \
+ if (failed) \
+ printk("fail\n"); \
+ printk("0x%04X = %-15s(0x%02X,0x%02X), flags = %s -> %s\n", \
+ r, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%04X = %-15s(0x%02X,0x%02X), flags = %s -> %s\n", \
+ r_asm, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \
+ } \
+ M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
if (!failed) \
- printk("passed\n"); \
+ printk("passed\n"); \
}
#define VAL_WORD_MUL(name) \
@@ -383,36 +383,36 @@
int f,failed = false; \
char buf1[80],buf2[80]; \
for (d = 0; d < 0xFF00; d += 0x100) { \
- for (s = 0; s < 0xFF00; s += 0x100) { \
- M.x86.R_EFLG = inflags = flags = def_flags; \
- for (f = 0; f < 2; f++) { \
- name##_asm(&flags,&r_asm_lo,&r_asm_hi,d,s); \
- M.x86.R_AX = d; \
- name(s); \
- r_lo = M.x86.R_AX; \
- r_hi = M.x86.R_DX; \
- if (r_lo != r_asm_lo || r_hi != r_asm_hi || M.x86.R_EFLG != flags)\
- failed = true; \
- if (failed || trace) { \
- if (failed) \
- printk("fail\n"); \
- printk("0x%04X:0x%04X = %-15s(0x%04X,0x%04X), flags = %s -> %s\n", \
- r_hi,r_lo, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
- printk("0x%04X:0x%04X = %-15s(0x%04X,0x%04X), flags = %s -> %s\n", \
- r_asm_hi,r_asm_lo, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \
- } \
- M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \
- if (failed) \
- break; \
- } \
- if (failed) \
- break; \
- } \
- if (failed) \
- break; \
- } \
+ for (s = 0; s < 0xFF00; s += 0x100) { \
+ M.x86.R_EFLG = inflags = flags = def_flags; \
+ for (f = 0; f < 2; f++) { \
+ name##_asm(&flags,&r_asm_lo,&r_asm_hi,d,s); \
+ M.x86.R_AX = d; \
+ name(s); \
+ r_lo = M.x86.R_AX; \
+ r_hi = M.x86.R_DX; \
+ if (r_lo != r_asm_lo || r_hi != r_asm_hi || M.x86.R_EFLG != flags)\
+ failed = true; \
+ if (failed || trace) { \
+ if (failed) \
+ printk("fail\n"); \
+ printk("0x%04X:0x%04X = %-15s(0x%04X,0x%04X), flags = %s -> %s\n", \
+ r_hi,r_lo, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%04X:0x%04X = %-15s(0x%04X,0x%04X), flags = %s -> %s\n", \
+ r_asm_hi,r_asm_lo, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \
+ } \
+ M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
if (!failed) \
- printk("passed\n"); \
+ printk("passed\n"); \
}
#define VAL_LONG_MUL(name) \
@@ -425,36 +425,36 @@
int f,failed = false; \
char buf1[80],buf2[80]; \
for (d = 0; d < 0xFF000000; d += 0x1000000) { \
- for (s = 0; s < 0xFF000000; s += 0x1000000) { \
- M.x86.R_EFLG = inflags = flags = def_flags; \
- for (f = 0; f < 2; f++) { \
- name##_asm(&flags,&r_asm_lo,&r_asm_hi,d,s); \
- M.x86.R_EAX = d; \
- name(s); \
- r_lo = M.x86.R_EAX; \
- r_hi = M.x86.R_EDX; \
- if (r_lo != r_asm_lo || r_hi != r_asm_hi || M.x86.R_EFLG != flags)\
- failed = true; \
- if (failed || trace) { \
- if (failed) \
- printk("fail\n"); \
- printk("0x%08X:0x%08X = %-15s(0x%08X,0x%08X), flags = %s -> %s\n", \
- r_hi,r_lo, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
- printk("0x%08X:0x%08X = %-15s(0x%08X,0x%08X), flags = %s -> %s\n", \
- r_asm_hi,r_asm_lo, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \
- } \
- M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \
- if (failed) \
- break; \
- } \
- if (failed) \
- break; \
- } \
- if (failed) \
- break; \
- } \
+ for (s = 0; s < 0xFF000000; s += 0x1000000) { \
+ M.x86.R_EFLG = inflags = flags = def_flags; \
+ for (f = 0; f < 2; f++) { \
+ name##_asm(&flags,&r_asm_lo,&r_asm_hi,d,s); \
+ M.x86.R_EAX = d; \
+ name(s); \
+ r_lo = M.x86.R_EAX; \
+ r_hi = M.x86.R_EDX; \
+ if (r_lo != r_asm_lo || r_hi != r_asm_hi || M.x86.R_EFLG != flags)\
+ failed = true; \
+ if (failed || trace) { \
+ if (failed) \
+ printk("fail\n"); \
+ printk("0x%08X:0x%08X = %-15s(0x%08X,0x%08X), flags = %s -> %s\n", \
+ r_hi,r_lo, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%08X:0x%08X = %-15s(0x%08X,0x%08X), flags = %s -> %s\n", \
+ r_asm_hi,r_asm_lo, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \
+ } \
+ M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
if (!failed) \
- printk("passed\n"); \
+ printk("passed\n"); \
}
#define VAL_BYTE_DIV(name) \
@@ -466,39 +466,39 @@
int f,failed = false; \
char buf1[80],buf2[80]; \
for (d = 0; d < 0xFF00; d += 0x100) { \
- for (s = 1; s < 0xFF; s += 1) { \
- M.x86.R_EFLG = inflags = flags = def_flags; \
- for (f = 0; f < 2; f++) { \
- M.x86.intr = 0; \
- M.x86.R_AX = d; \
- name(s); \
- r_quot = M.x86.R_AL; \
- r_rem = M.x86.R_AH; \
- if (M.x86.intr & INTR_SYNCH) \
- continue; \
- name##_asm(&flags,&r_asm_quot,&r_asm_rem,d,s); \
- if (r_quot != r_asm_quot || r_rem != r_asm_rem || M.x86.R_EFLG != flags) \
- failed = true; \
- if (failed || trace) { \
- if (failed) \
- printk("fail\n"); \
- printk("0x%02X:0x%02X = %-15s(0x%04X,0x%02X), flags = %s -> %s\n", \
- r_quot, r_rem, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
- printk("0x%02X:0x%02X = %-15s(0x%04X,0x%02X), flags = %s -> %s\n", \
- r_asm_quot, r_asm_rem, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \
- } \
- M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \
- if (failed) \
- break; \
- } \
- if (failed) \
- break; \
- } \
- if (failed) \
- break; \
- } \
+ for (s = 1; s < 0xFF; s += 1) { \
+ M.x86.R_EFLG = inflags = flags = def_flags; \
+ for (f = 0; f < 2; f++) { \
+ M.x86.intr = 0; \
+ M.x86.R_AX = d; \
+ name(s); \
+ r_quot = M.x86.R_AL; \
+ r_rem = M.x86.R_AH; \
+ if (M.x86.intr & INTR_SYNCH) \
+ continue; \
+ name##_asm(&flags,&r_asm_quot,&r_asm_rem,d,s); \
+ if (r_quot != r_asm_quot || r_rem != r_asm_rem || M.x86.R_EFLG != flags) \
+ failed = true; \
+ if (failed || trace) { \
+ if (failed) \
+ printk("fail\n"); \
+ printk("0x%02X:0x%02X = %-15s(0x%04X,0x%02X), flags = %s -> %s\n", \
+ r_quot, r_rem, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%02X:0x%02X = %-15s(0x%04X,0x%02X), flags = %s -> %s\n", \
+ r_asm_quot, r_asm_rem, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \
+ } \
+ M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
if (!failed) \
- printk("passed\n"); \
+ printk("passed\n"); \
}
#define VAL_WORD_DIV(name) \
@@ -510,40 +510,40 @@
int f,failed = false; \
char buf1[80],buf2[80]; \
for (d = 0; d < 0xFF000000; d += 0x1000000) { \
- for (s = 0x100; s < 0xFF00; s += 0x100) { \
- M.x86.R_EFLG = inflags = flags = def_flags; \
- for (f = 0; f < 2; f++) { \
- M.x86.intr = 0; \
- M.x86.R_AX = d & 0xFFFF; \
- M.x86.R_DX = d >> 16; \
- name(s); \
- r_quot = M.x86.R_AX; \
- r_rem = M.x86.R_DX; \
- if (M.x86.intr & INTR_SYNCH) \
- continue; \
- name##_asm(&flags,&r_asm_quot,&r_asm_rem,d & 0xFFFF,d >> 16,s);\
- if (r_quot != r_asm_quot || r_rem != r_asm_rem || M.x86.R_EFLG != flags) \
- failed = true; \
- if (failed || trace) { \
- if (failed) \
- printk("fail\n"); \
- printk("0x%04X:0x%04X = %-15s(0x%08X,0x%04X), flags = %s -> %s\n", \
- r_quot, r_rem, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
- printk("0x%04X:0x%04X = %-15s(0x%08X,0x%04X), flags = %s -> %s\n", \
- r_asm_quot, r_asm_rem, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \
- } \
- M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \
- if (failed) \
- break; \
- } \
- if (failed) \
- break; \
- } \
- if (failed) \
- break; \
- } \
+ for (s = 0x100; s < 0xFF00; s += 0x100) { \
+ M.x86.R_EFLG = inflags = flags = def_flags; \
+ for (f = 0; f < 2; f++) { \
+ M.x86.intr = 0; \
+ M.x86.R_AX = d & 0xFFFF; \
+ M.x86.R_DX = d >> 16; \
+ name(s); \
+ r_quot = M.x86.R_AX; \
+ r_rem = M.x86.R_DX; \
+ if (M.x86.intr & INTR_SYNCH) \
+ continue; \
+ name##_asm(&flags,&r_asm_quot,&r_asm_rem,d & 0xFFFF,d >> 16,s);\
+ if (r_quot != r_asm_quot || r_rem != r_asm_rem || M.x86.R_EFLG != flags) \
+ failed = true; \
+ if (failed || trace) { \
+ if (failed) \
+ printk("fail\n"); \
+ printk("0x%04X:0x%04X = %-15s(0x%08X,0x%04X), flags = %s -> %s\n", \
+ r_quot, r_rem, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%04X:0x%04X = %-15s(0x%08X,0x%04X), flags = %s -> %s\n", \
+ r_asm_quot, r_asm_rem, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \
+ } \
+ M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
if (!failed) \
- printk("passed\n"); \
+ printk("passed\n"); \
}
#define VAL_LONG_DIV(name) \
@@ -555,40 +555,40 @@
int f,failed = false; \
char buf1[80],buf2[80]; \
for (d = 0; d < 0xFF000000; d += 0x1000000) { \
- for (s = 0x100; s < 0xFF00; s += 0x100) { \
- M.x86.R_EFLG = inflags = flags = def_flags; \
- for (f = 0; f < 2; f++) { \
- M.x86.intr = 0; \
- M.x86.R_EAX = d; \
- M.x86.R_EDX = 0; \
- name(s); \
- r_quot = M.x86.R_EAX; \
- r_rem = M.x86.R_EDX; \
- if (M.x86.intr & INTR_SYNCH) \
- continue; \
- name##_asm(&flags,&r_asm_quot,&r_asm_rem,d,0,s); \
- if (r_quot != r_asm_quot || r_rem != r_asm_rem || M.x86.R_EFLG != flags) \
- failed = true; \
- if (failed || trace) { \
- if (failed) \
- printk("fail\n"); \
- printk("0x%08X:0x%08X = %-15s(0x%08X:0x%08X,0x%08X), flags = %s -> %s\n", \
- r_quot, r_rem, #name, 0, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
- printk("0x%08X:0x%08X = %-15s(0x%08X:0x%08X,0x%08X), flags = %s -> %s\n", \
- r_asm_quot, r_asm_rem, #name"_asm", 0, d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \
- } \
- M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \
- if (failed) \
- break; \
- } \
- if (failed) \
- break; \
- } \
- if (failed) \
- break; \
- } \
+ for (s = 0x100; s < 0xFF00; s += 0x100) { \
+ M.x86.R_EFLG = inflags = flags = def_flags; \
+ for (f = 0; f < 2; f++) { \
+ M.x86.intr = 0; \
+ M.x86.R_EAX = d; \
+ M.x86.R_EDX = 0; \
+ name(s); \
+ r_quot = M.x86.R_EAX; \
+ r_rem = M.x86.R_EDX; \
+ if (M.x86.intr & INTR_SYNCH) \
+ continue; \
+ name##_asm(&flags,&r_asm_quot,&r_asm_rem,d,0,s); \
+ if (r_quot != r_asm_quot || r_rem != r_asm_rem || M.x86.R_EFLG != flags) \
+ failed = true; \
+ if (failed || trace) { \
+ if (failed) \
+ printk("fail\n"); \
+ printk("0x%08X:0x%08X = %-15s(0x%08X:0x%08X,0x%08X), flags = %s -> %s\n", \
+ r_quot, r_rem, #name, 0, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%08X:0x%08X = %-15s(0x%08X:0x%08X,0x%08X), flags = %s -> %s\n", \
+ r_asm_quot, r_asm_rem, #name"_asm", 0, d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \
+ } \
+ M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
if (!failed) \
- printk("passed\n"); \
+ printk("passed\n"); \
}
void printk(const char *fmt, ...)
@@ -606,37 +606,37 @@ char * print_flags(char *buf,ulong flags)
buf[0] = 0;
if (flags & F_CF) {
- strcat(buf,separator);
- strcat(buf,"CF");
- separator = ",";
- }
+ strcat(buf,separator);
+ strcat(buf,"CF");
+ separator = ",";
+ }
if (flags & F_PF) {
- strcat(buf,separator);
- strcat(buf,"PF");
- separator = ",";
- }
+ strcat(buf,separator);
+ strcat(buf,"PF");
+ separator = ",";
+ }
if (flags & F_AF) {
- strcat(buf,separator);
- strcat(buf,"AF");
- separator = ",";
- }
+ strcat(buf,separator);
+ strcat(buf,"AF");
+ separator = ",";
+ }
if (flags & F_ZF) {
- strcat(buf,separator);
- strcat(buf,"ZF");
- separator = ",";
- }
+ strcat(buf,separator);
+ strcat(buf,"ZF");
+ separator = ",";
+ }
if (flags & F_SF) {
- strcat(buf,separator);
- strcat(buf,"SF");
- separator = ",";
- }
+ strcat(buf,separator);
+ strcat(buf,"SF");
+ separator = ",";
+ }
if (flags & F_OF) {
- strcat(buf,separator);
- strcat(buf,"OF");
- separator = ",";
- }
+ strcat(buf,separator);
+ strcat(buf,"OF");
+ separator = ",";
+ }
if (separator[0] == 0)
- strcpy(buf,"None");
+ strcpy(buf,"None");
return buf;
}
@@ -646,7 +646,7 @@ int main(int argc)
int trace = false;
if (argc > 1)
- trace = true;
+ trace = true;
memset(&M, 0, sizeof(M));
def_flags = get_flags_asm() & ~ALL_FLAGS;
@@ -673,7 +673,7 @@ int main(int argc)
VAL_LONG_LONG_BINARY(cmp_long);
VAL_BYTE_UNARY(daa_byte);
- VAL_BYTE_UNARY(das_byte); // Fails for 0x9A (out of range anyway)
+ VAL_BYTE_UNARY(das_byte); /* Fails for 0x9A (out of range anyway) */
VAL_BYTE_UNARY(dec_byte);
VAL_WORD_UNARY(dec_word);
diff --git a/board/MAI/bios_emulator/scitech/src/x86emu/x86emu/debug.h b/board/MAI/bios_emulator/scitech/src/x86emu/x86emu/debug.h
index b4a3ed5000..9a4a096c65 100644
--- a/board/MAI/bios_emulator/scitech/src/x86emu/x86emu/debug.h
+++ b/board/MAI/bios_emulator/scitech/src/x86emu/x86emu/debug.h
@@ -118,7 +118,7 @@
#define SAVE_IP_CS(x,y) \
if (DEBUG_DECODE() | DEBUG_TRACECALL() | DEBUG_BREAK() \
- | DEBUG_IO_TRACE() | DEBUG_SAVE_IP_CS()) { \
+ | DEBUG_IO_TRACE() | DEBUG_SAVE_IP_CS()) { \
M.x86.saved_cs = x; \
M.x86.saved_ip = y; \
}
diff --git a/board/MAI/bios_emulator/x86interface.c b/board/MAI/bios_emulator/x86interface.c
index e90ec5a672..909cb3cf94 100644
--- a/board/MAI/bios_emulator/x86interface.c
+++ b/board/MAI/bios_emulator/x86interface.c
@@ -5,7 +5,7 @@
/*
* This isn't nice, but there are a lot of incompatibilities in the U-Boot and scitech include
* files that this is the only really workable solution.
- * Might be cleaned out later.
+ * Might be cleaned out later.
*/
#ifdef DEBUG
@@ -45,7 +45,7 @@ typedef long LONG;
#define EMULATOR_BIOS_OFFSET 0xC0000
#define EMULATOR_STRAP_OFFSET 0x30000
#define EMULATOR_STACK_OFFSET 0x20000
-#define EMULATOR_LOGO_OFFSET 0x40000 // If you change this, change the strap code, too
+#define EMULATOR_LOGO_OFFSET 0x40000 /* If you change this, change the strap code, too */
#define VIDEO_BASE (void *)0xFD0B8000
extern char *getenv(char *);
@@ -72,7 +72,7 @@ void cons_gets(char *buffer)
char c = 0;
buffer[0] = 0;
- if (getenv("x86_runthru")) return; //FIXME:
+ if (getenv("x86_runthru")) return; /*FIXME: */
while (c != 0x0D && c != 0x0A)
{
while (!tstc());
@@ -167,7 +167,7 @@ static int log_low = 0;
int dolog(int port)
{
- if (log_init && log_do)
+ if (log_init && log_do)
{
if (log_low && port > 0x400) return 0;
return 1;
@@ -178,7 +178,7 @@ int dolog(int port)
log_init = 1;
log_do = (getenv("x86_logio") != (char *)0);
log_low = (getenv("x86_loglow") != (char *)0);
- if (log_do)
+ if (log_do)
{
if (log_low && port > 0x400) return 0;
return 1;
@@ -187,12 +187,12 @@ int dolog(int port)
return 0;
}
-// Converts an emulator address to a physical address.
-// Handles all special cases (bios date, model etc), and might need work
+/* Converts an emulator address to a physical address. */
+/* Handles all special cases (bios date, model etc), and might need work */
u32 memaddr(u32 addr)
{
-// if (addr >= 0xF0000 && addr < 0xFFFFF) printf("WARNING: Segment F access (0x%x)\n", addr);
-// printf("MemAddr=%p\n", addr);
+/* if (addr >= 0xF0000 && addr < 0xFFFFF) printf("WARNING: Segment F access (0x%x)\n", addr); */
+/* printf("MemAddr=%p\n", addr); */
if (addr >= 0xA0000 && addr < 0xC0000)
return 0xFD000000 + addr;
else if (addr >= 0xFFFF5 && addr < 0xFFFFE)
@@ -205,7 +205,7 @@ u32 memaddr(u32 addr)
return (u32)&submodel;
else if (addr >= 0x80000000)
{
- //printf("Warning: High memory access at 0x%x\n", addr);
+ /*printf("Warning: High memory access at 0x%x\n", addr); */
return addr;
}
else
@@ -251,7 +251,7 @@ void A1_wrl(u32 addr, u32 val)
write_long_little((ULONG *)memaddr(addr), val);
}
-X86EMU_memFuncs _A1_mem =
+X86EMU_memFuncs _A1_mem =
{
A1_rdb,
A1_rdw,
@@ -282,7 +282,7 @@ u32 port_to_mem(int port)
u8 A1_inb(int port)
{
u8 a;
- //if (port == 0x3BA) return 0;
+ /*if (port == 0x3BA) return 0; */
a = in_byte(port);
LOGIO(port, "inb: %Xh -> %d (%Xh)\n", port, a, a);
return a;
@@ -324,7 +324,7 @@ void A1_outl(int port, u32 val)
out_long(port, val);
}
-X86EMU_pioFuncs _A1_pio =
+X86EMU_pioFuncs _A1_pio =
{
A1_inb,
A1_inw,
@@ -353,7 +353,7 @@ void reloc_ops(void *reloc_addr)
x86emu_optab[i] -= delta;
x86emu_optab2[i] -= delta;
}
-
+
_A1_mem.rdb = A1_rdb;
_A1_mem.rdw = A1_rdw;
_A1_mem.rdl = A1_rdl;
@@ -367,7 +367,7 @@ void reloc_ops(void *reloc_addr)
_A1_pio.outb = A1_outb;
_A1_pio.outw = A1_outw;
_A1_pio.outl = A1_outl;
-
+
tables_relocate(delta);
}
@@ -379,9 +379,9 @@ void reloc_ops(void *reloc_addr)
unsigned char more_strap[] = {
- 0xb4, 0x0, 0xb0, 0x2, 0xcd, 0x10,
+ 0xb4, 0x0, 0xb0, 0x2, 0xcd, 0x10,
};
-#define MORE_STRAP_BYTES 6 // Additional bytes of strap code
+#define MORE_STRAP_BYTES 6 /* Additional bytes of strap code */
unsigned char *done_msg="VGA Initialized\0";
@@ -415,12 +415,12 @@ int execute_bios(pci_dev_t gr_dev, void *reloc_addr)
PRINTF("Attempting to run emulator on %02x:%02x:%02x\n",
PCI_BUS(gr_dev), PCI_DEV(gr_dev), PCI_FUNC(gr_dev));
- // Enable compatibility hole for emulator access to frame buffer
+ /* Enable compatibility hole for emulator access to frame buffer */
PRINTF("Enabling compatibility hole\n");
enable_compatibility_hole();
- // Allocate memory
- // FIXME: We shouldn't use this much memory really.
+ /* Allocate memory */
+ /* FIXME: We shouldn't use this much memory really. */
memset(&M, 0, sizeof(X86EMU_sysEnv));
M.mem_base = malloc(EMULATOR_MEM_SIZE);
M.mem_size = EMULATOR_MEM_SIZE;
@@ -470,10 +470,10 @@ int execute_bios(pci_dev_t gr_dev, void *reloc_addr)
{
easteregg_active = 1;
}
-
+
if (easteregg_active)
{
- // Yay!
+ /* Yay! */
setenv("x86_mode", "1");
setenv("vga_fg_color", "11");
setenv("vga_bg_color", "1");
@@ -493,9 +493,9 @@ int execute_bios(pci_dev_t gr_dev, void *reloc_addr)
}
}
- /*
+ /*
* Poke the strap routine. This might need a bit of extending
- * if there is a mode switch involved, i.e. we want to int10
+ * if there is a mode switch involved, i.e. we want to int10
* afterwards to set a different graphics mode, or alternatively
* there might be a different start address requirement if the
* ROM doesn't have an x86 image in its first image.
@@ -503,19 +503,19 @@ int execute_bios(pci_dev_t gr_dev, void *reloc_addr)
PRINTF("Poking strap...\n");
- // FAR CALL c000:0003
+ /* FAR CALL c000:0003 */
*strap++ = 0x9A; *strap++ = 0x03; *strap++ = 0x00;
- *strap++ = 0x00; *strap++ = 0xC0;
+ *strap++ = 0x00; *strap++ = 0xC0;
#if 1
- // insert additional strap code
+ /* insert additional strap code */
for (i=0; i < MORE_STRAP_BYTES; i++)
{
*strap++ = more_strap[i];
}
#endif
- // HALT
- *strap++ = 0xF4;
+ /* HALT */
+ *strap++ = 0xF4;
PRINTF("Setting up logo data\n");
logo = (unsigned char *)M.mem_base + EMULATOR_LOGO_OFFSET;
@@ -530,28 +530,28 @@ int execute_bios(pci_dev_t gr_dev, void *reloc_addr)
* must contain the devfn, encoded as (dev<<3)|fn
*/
- // Execution starts here
- M.x86.R_CS = SEG(EMULATOR_STRAP_OFFSET);
- M.x86.R_IP = OFF(EMULATOR_STRAP_OFFSET);
+ /* Execution starts here */
+ M.x86.R_CS = SEG(EMULATOR_STRAP_OFFSET);
+ M.x86.R_IP = OFF(EMULATOR_STRAP_OFFSET);
- // Stack at top of ram
+ /* Stack at top of ram */
M.x86.R_SS = SEG(EMULATOR_STACK_OFFSET);
M.x86.R_SP = OFF(EMULATOR_STACK_OFFSET);
- // Input parameters
+ /* Input parameters */
M.x86.R_AH = PCI_BUS(gr_dev);
M.x86.R_AL = (PCI_DEV(gr_dev)<<3) | PCI_FUNC(gr_dev);
- // Set the I/O and memory access functions
+ /* Set the I/O and memory access functions */
X86EMU_setupMemFuncs(&_A1_mem);
X86EMU_setupPioFuncs(&_A1_pio);
- // Enable timer 2
- cfg = in_byte(0x61); // Get Misc control
- cfg |= 0x01; // Enable timer 2
- out_byte(0x61, cfg); // output again
+ /* Enable timer 2 */
+ cfg = in_byte(0x61); /* Get Misc control */
+ cfg |= 0x01; /* Enable timer 2 */
+ out_byte(0x61, cfg); /* output again */
- // Set up the timers
+ /* Set up the timers */
out_byte(0x43, 0x54);
out_byte(0x41, 0x18);
@@ -563,10 +563,10 @@ int execute_bios(pci_dev_t gr_dev, void *reloc_addr)
out_byte(0x42, 0x31);
out_byte(0x42, 0x13);
- // Init the "BIOS".
+ /* Init the "BIOS". */
bios_init();
- // Video Card Reset
+ /* Video Card Reset */
out_byte(0x3D8, 0);
out_byte(0x3B8, 1);
(void)in_byte(0x3BA);
@@ -583,7 +583,7 @@ int execute_bios(pci_dev_t gr_dev, void *reloc_addr)
}
#endif
- // Ready set go...
+ /* Ready set go... */
PRINTF("Running emulator\n");
X86EMU_exec();
PRINTF("Done running emulator\n");
@@ -593,8 +593,8 @@ int execute_bios(pci_dev_t gr_dev, void *reloc_addr)
if (pal_reset && strcmp(pal_reset, "on") == 0)
{
PRINTF("Palette reset\n");
- //(void)in_byte(0x3da);
- //out_byte(0x3c0, 0);
+ /*(void)in_byte(0x3da); */
+ /*out_byte(0x3c0, 0); */
out_byte(0x3C8, 0);
out_byte(0x3C9, 0);
@@ -645,15 +645,15 @@ int execute_bios(pci_dev_t gr_dev, void *reloc_addr)
if (getenv("x86_do_inout")) do_inout();
#endif
-//FIXME: dcache_disable();
+/*FIXME: dcache_disable(); */
return 1;
}
-// Clean up the x86 mess
+/* Clean up the x86 mess */
void shutdown_bios(void)
{
-// disable_compatibility_hole();
- // Free the memory associated
+/* disable_compatibility_hole(); */
+ /* Free the memory associated */
free(M.mem_base);
}
@@ -663,7 +663,7 @@ int to_int(char *buffer)
int base = 0;
int res = 0;
- if (*buffer == '$')
+ if (*buffer == '$')
{
base = 16;
buffer++;
@@ -687,27 +687,27 @@ int to_int(char *buffer)
case 'b':
res *= base;
res += 11;
- break;
+ break;
case 'C':
case 'c':
res *= base;
res += 12;
- break;
+ break;
case 'D':
case 'd':
res *= base;
res += 13;
- break;
+ break;
case 'E':
case 'e':
res *= base;
res += 14;
- break;
+ break;
case 'F':
case 'f':
res *= base;
res += 15;
- break;
+ break;
default:
return res;
}
diff --git a/board/MAI/menu/cmd_menu.c b/board/MAI/menu/cmd_menu.c
index 178817374b..4c17c6acf7 100644
--- a/board/MAI/menu/cmd_menu.c
+++ b/board/MAI/menu/cmd_menu.c
@@ -1,9 +1,16 @@
#include <common.h>
#include <command.h>
-#include <cmd_menu.h>
int do_menu( cmd_tbl_t *cmdtp, /*bd_t *bd,*/ int flag, int argc, char *argv[] )
{
-// printf("<NOT YET IMPLEMENTED>\n");
- return 0;
+/* printf("<NOT YET IMPLEMENTED>\n"); */
+ return 0;
}
+
+#if defined(CONFIG_AMIGAONEG3SE) && (CONFIG_COMMANDS & CFG_CMD_BSP)
+cmd_tbl_t U_BOOT_CMD(MENU) = MK_CMD_ENTRY(
+ "menu", 1, 1, do_menu,
+ "menu - display BIOS setup menu\n",
+ ""
+);
+#endif
diff --git a/board/MAI/menu/menu.c b/board/MAI/menu/menu.c
index 3130142647..c0c63a89dd 100644
--- a/board/MAI/menu/menu.c
+++ b/board/MAI/menu/menu.c
@@ -41,9 +41,9 @@ int menu_init (menu_t *root)
s = getenv("menu_disabled");
if (s) disabled_attr = atoi(s);
-
+
for (i=0; i<MAX_MENU_OPTIONS; i++) odata[i].used = 0;
-
+
root_menu = root;
}
diff --git a/board/MAI/menu/menu.h b/board/MAI/menu/menu.h
index e5886b83b3..8aebb7de53 100644
--- a/board/MAI/menu/menu.h
+++ b/board/MAI/menu/menu.h
@@ -48,7 +48,7 @@ typedef struct menu_s
* Text:
* A single line/limited number of characters text entry box. Text can be restricted
* to a certain charset (digits/hex digits/all/custom). Result is also available as an
- * int if numeric.
+ * int if numeric.
*
* Selection:
* One-of-many type of selection entry. User may choose on of a set of strings, which
@@ -122,7 +122,7 @@ typedef struct menu_select_s
int num_options; /* Number of mappings */
menu_select_option_t **options;
- /* Option list array */
+ /* Option list array */
} menu_select_t;
@@ -133,10 +133,10 @@ typedef struct menu_routine_s
{
OPTION_PREAMBLE
menu_routine_callback callback;
- /* routine to be called */
+ /* routine to be called */
void *user_data; /* User data, don't care for system */
} menu_routine_t;
-
+
#define MENU_CUSTOM_TYPE 5
typedef void (*menu_custom_draw)(struct menu_custom_s *);