entering pmode ???
entering pmode ???
I have created a bootsector that will load my second-stage loader. I want to enter protected mode on that second-stage loader.
How would I go about doing this?
How would I go about doing this?
Re:entering pmode ???
still...can't post but...
FritzOS pk0.7.1 has a second stage loader. just take out the pmode stuff in the bootsector, paste it into the 2nd stage loader, and change the "jmp CodeSel:0x9000" to "jmp 9000h:0000". that's it I think.
have to go
FritzOS pk0.7.1 has a second stage loader. just take out the pmode stuff in the bootsector, paste it into the 2nd stage loader, and change the "jmp CodeSel:0x9000" to "jmp 9000h:0000". that's it I think.
have to go
Re:entering pmode ???
Thats not what I meant. I already have a second-stage loader. What I need to find out is how do I enter pmode from the second-stage loader. If you enter pmode in a normal bootsector, you don't have to worry about the offsets. But since I have jumped from my bootsector, I have to add the offsets to set my gdt up right and for the far jump to protected mode.
How would I go about doing this?
An example would be appreciated. By the way If you don't know what Im trying to do, Then just say so and I will elaborate on the next post.
How would I go about doing this?
An example would be appreciated. By the way If you don't know what Im trying to do, Then just say so and I will elaborate on the next post.
Re:entering pmode ???
Mine should work without mods...like I said...I've done this before...
Re:entering pmode ???
Hi,
I have had trouble doing this myself. What I done was load my second stage loader directly after the boot loader (ie: 0:7e00 ), this way I can do everything exactly the same as in my boot loader I use segment 0 and ORG 0x7c00, so I just changing the ORG to 0x7e00 and everything runs the same, you dont even need to change DS or other segment regs initialized in the boot loader.
For an example:
I do this im my boot loader
then in my 2nd stage loader
you don't need to change anything if you do things this way. Sorry if I misunderstood what you are trying to do.
hope this helps.
I have had trouble doing this myself. What I done was load my second stage loader directly after the boot loader (ie: 0:7e00 ), this way I can do everything exactly the same as in my boot loader I use segment 0 and ORG 0x7c00, so I just changing the ORG to 0x7e00 and everything runs the same, you dont even need to change DS or other segment regs initialized in the boot loader.
For an example:
I do this im my boot loader
Code: Select all
[BITS 16]
[ORG 0x7c00]
jmp 0x0000:start_boot ; just to initialize cs to seg 0
start_boot:
mov ax, 0x0000 ; you could do mov ax, cs
mov ds, ax
mov es, ax
.....
..... ; load you 2nd stage loader to 0x00:0x7e00
jmp 0x0000:0x7e00
Code: Select all
[BITS 16]
[ORG 0x7e00]
; cs, ds, es all ok from the boot loader
.....
.....
hope this helps.
Re:entering pmode ???
Thanks for the help PlayOS. That worked like a charm. I have one problem to still work out and it has to do with running it on bochs.
By the way, my code actually works on real hardware and bochs. The problem I'm having is this:
I can't figure out what this is. I looking in to it. If anybody knows what this is, I would appreciate the help.
By the way, my code actually works on real hardware and bochs. The problem I'm having is this:
Code: Select all
WARNING: Encountered an unknown instruction (signalling illegal instruction):
BxError: instruction with op1=0xfe
Re:entering pmode ???
I have found out that the problem is with my stack. So now its time to get out the Bochs debugger. Wish me luck.
Re:entering pmode ???
I need your help playOS.
Code: Select all
I don't need your help anymore. I figured out what my problem was. It was the pmode stack. Now all I have to do is reprogram the PIC, set up a IDT and transfer control to my c kernel.
Thanks for the help. ;)