I have the following code. It is called from my 3rd stage protected mode bootloader program. It is supposed to switch into real mode and display a character (for a test) :
Code: Select all
bits 32
SystemReset:
call rmode_enable
jmp 0:.reset16
bits 16
.reset16:
mov ax, 0x0 ; Reset segment registers to 0
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
mov sp, 0x9000
lidt [idt_real]
;; test--- print char using bios
mov ah, 0xe
mov al, '9',
xor bx, bx
int 0x10
cli
hlt
idt_real:
dw 0x3ff ; 256 entries, 4b each = 1K
dd 0 ; Real mode IVT at 0x0000
This routine works fine (displays the test characters and strings just fine) when running it from Virtual PC. However, I tested it on 2 versions of Bochs, both which fail.
Bochs 2.0.2 gets to the cli+hlt instructions with nothing at all displayed on screen;
Bochs 2.3.7 gives lot of 00010269272i[CPU0 ] LOCK prefix unallowed (op1=0xff, attr=0x0, mod=0xc0, nnn=7) warnings. When I shut it down it ends like this:
Code: Select all
00010269270i[CPU0 ]*snip* -- tons of the same lock prefix warning --
00010269271i[CPU0 ] LOCK prefix unallowed (op1=0xff, attr=0x0, mod=0xc0, nnn=7)
00010269272i[CPU0 ] LOCK prefix unallowed (op1=0xff, attr=0x0, mod=0xc0, nnn=7)
00013600000p[WGUI ] >>PANIC<< POWER button turned off.
00013600000i[CPU0 ] CPU is in real mode (active)
00013600000i[CPU0 ] CS.d_b = 32 bit
00013600000i[CPU0 ] SS.d_b = 32 bit
00013600000i[CPU0 ] EFER = 0x00000000
00013600000i[CPU0 ] | RAX=00000000000007e4 RBX=00000000001fa000
00013600000i[CPU0 ] | RCX=0000000000000206 RDX=0000000000000007
00013600000i[CPU0 ] | RSP=00000000010f5b1c RBP=00000000010f9078
00013600000i[CPU0 ] | RSI=00000000001000cd RDI=0000000000000852
00013600000i[CPU0 ] | R8=0000000000000000 R9=0000000000000000
00013600000i[CPU0 ] | R10=0000000000000000 R11=0000000000000000
00013600000i[CPU0 ] | R12=0000000000000000 R13=0000000000000000
00013600000i[CPU0 ] | R14=0000000000000000 R15=0000000000000000
00013600000i[CPU0 ] | IOPL=0 id vip vif ac vm rf nt OF df if tf sf zf af pf CF
00013600000i[CPU0 ] | SEG selector base limit G D
00013600000i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D
00013600000i[CPU0 ] | CS:0000( 0001| 0| 0) 00000000 000fffff 1 1
00013600000i[CPU0 ] | DS:0000( 0002| 0| 0) 00000000 000fffff 1 1
00013600000i[CPU0 ] | SS:0000( 0002| 0| 0) 00000000 000fffff 1 1
00013600000i[CPU0 ] | ES:0000( 0002| 0| 0) 00000000 000fffff 1 1
00013600000i[CPU0 ] | FS:0000( 0002| 0| 0) 00000000 000fffff 1 1
00013600000i[CPU0 ] | GS:0000( 0002| 0| 0) 00000000 000fffff 1 1
00013600000i[CPU0 ] | MSR_FS_BASE:0000000000000000
00013600000i[CPU0 ] | MSR_GS_BASE:0000000000000000
00013600000i[CPU0 ] | RIP=00000000000076ce (00000000000076ce)
00013600000i[CPU0 ] | CR0=0x60000010 CR1=0x0 CR2=0x0000000000000000
00013600000i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
00013600000i[CPU0 ] >> add byte ptr ds:[eax], al : 0000
In the above, RIP contains an odd value however it makes no sense as they both fail at the bios INT 0x10 call :/ ie, they both work fine until we get further into the int 0x10 call when running it from the debugger...it never returns from the int 0x10 before crashing.
Does anyone have any suggestions that may help? If there is additional information you need, please let me know and I would be glad to share it.
Thanks for any suggestions of any kind