Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

x86 ASM --> entering protected mode.

Name: Anonymous 2008-09-20 22:32

Dear /prog/

Why does this fail?

BITS 16
        cli

        lgdt [cs:pGDT32]

        mov eax, 11h
        mov cr0, eax

        jmp far SEL_CODE:pm_start
SEL_NULL equ 0
SEL_DATA equ 1 << 3
SEL_CODE equ 2 << 3
SEL_LONG equ 3 << 3

pGDT32:
        dw 4*8-1
        dd GDT32
align 4
GDT32: 
        dq 0
        dw 0FFFFh, 0, 9200h, 08Fh
        dw 0FFFFh, 0, 9A00h, 0CFh
        dw 0FFFFh, 0, 9A00h, 0AFh
msg.woohoo:
        db "Win, baybe!", 0
BITS 32
pm_start:
        mov si, msg.woohoo
        call puts

Name: Anonymous 2008-09-21 3:17

>>8
Does your pGDT32 structure have the correct linear address for the GDT? Your address origin might be throwing it off (I presume it's at 0, if this is loaded off the boot sector you might want to fix that).

Are you positive the upper half of si isn't garbage? It probably is.

A20 line shouldn't make a difference at this point since you're not accessing memory above the 1MB mark.

bochs is OK for debugging CPU setup stuff like this. Unfortunately its emulation is more forgiving than it should be.     Maybe qemu has gotten better, but I recall it hanging a lot when the state blows up when transitioning between modes.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List