flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
cod3b453 10 Jun 2012, 21:59
The pusha/popa around the lgdt isn't needed. You probably just need to rebase the selectors:
Code: ; ... jmp (codeSeg - gdt):Pmode ; ... mov ax,(dataSeg - gdt) ; ... |
|||
![]() |
|
xleelz 11 Jun 2012, 01:02
thanks for the quick response but it still reboots... I did some debugging and it seems to make it into protected mode, fs and gs aren't set to the data segment but ds, ss, and esp are..
|
|||
![]() |
|
revolution 11 Jun 2012, 02:03
xleelz wrote:
Perhaps this instead: Code: xor sp,sp ;sp=0 to give a 64k stack aligned to 0 mod 4 |
|||
![]() |
|
BAiC 11 Jun 2012, 07:12
"codeSeg" is a label just as much as Pmode (Pmode is the label you want)...
codeSeg needs to be a selector.. from your code it looks like it needs to be 8.. Code: jmp 8:Pmode I agree with cod3b453; get rid of the pusha/popa. I also agree with revolution; align your stack... furthermore; your "hlt" loop at the end is terminal unless you enable interrupts.. since you don't have an IDT that won't actually matter. |
|||
![]() |
|
sinsi 11 Jun 2012, 07:22
"org 500" - how do you load it there? That's part of the interrupt table.
Possibly at the top of 640K there is the EBDA, maybe your stack is causing some problem? |
|||
![]() |
|
xleelz 11 Jun 2012, 15:07
Quote:
maybe, but it does seem to work past that point. Debugging says it reboots when it loads the gdt, apparently it's invalid. Thanks for all the replies and I made the respective changes. |
|||
![]() |
|
cod3b453 11 Jun 2012, 17:37
The IVT is at 0x00000-0x00400 (256 * (2+2)). The BDA is 0x00400-0x00500 so org 0x500 should be fine. (The EBDA is usually at 0xE0000). Also might be worth trying:
Code: jmp pword (codeSeg - gdt):Pmode ; ... align 4 Pmode: |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.