well, I have been trying to get my bootcode into pmode and this DOES not work
the Virtual PC resets when I do the long jump after I have set the pmode bit
mov eax, cr0
or eax, 1
mov cr0, eax
jmp 08bh:FLUSH <- if I comment this line and down to the line before hlt it won't restart else it does before hlt I write a P to the video mem, as in the example/tutorials I have found
[BITS 32]
FLUSH:
; set the stack pointer etc.
...
hlt
pmode error
Re:pmode error
Well 0x8b isn't going to be a descriptor no matter how you've set up your GDT. It actually points to memory some 17.375 entries into the GDT, so it's not hugely surprising the processor doesn't like what it finds there.McZ wrote: jmp 08bh:FLUSH
Re:pmode error
In other words, it should be:Well 0x8b isn't going to be a descriptor no matter how you've set up your GDT. It actually points to memory some 17.375 entries into the GDT, so it's not hugely surprising the processor doesn't like what it finds there.jmp 08bh:FLUSH
Code: Select all
jmp 08h:FLUSH
Re:pmode error
Well, imo, not. It points to the 17th entry (counting from zero and up), and it loads it with a PL=3. Check your books.Curufir wrote:Well 0x8b isn't going to be a descriptor no matter how you've set up your GDT. It actually points to memory some 17.375 entries into the GDT, so it's not hugely surprising the processor doesn't like what it finds there.McZ wrote: jmp 08bh:FLUSH
If it were 0x8c or higher it'd be an LDT entry of 17, with cpl = code - 0x8c. Of course, LDT makes no real sense nowadays, nor does having LDT entries at CPL=0.
When you're jumping to pmode you most certainly want to use cpl0 or you're tying yourself up after locking out all help. Sounds like suicide.
Re:pmode error
thank you finally it doesn't restart...
but I still have some problems, how do I write to screen in pmode using nasm? all I can find in the tutorials I have is this lines:
mov 0b8000h, 'P' ; The letter P
mov 0b8001h, 1bh ; with some attribute
but this generates an error when I compile it.. how should I do it with nasm?
but I still have some problems, how do I write to screen in pmode using nasm? all I can find in the tutorials I have is this lines:
mov 0b8000h, 'P' ; The letter P
mov 0b8001h, 1bh ; with some attribute
but this generates an error when I compile it.. how should I do it with nasm?
Re:pmode error
The error probably is that you don't specify the size. You actually don't.McZ wrote: thank you finally it doesn't restart...
but I still have some problems, how do I write to screen in pmode using nasm? all I can find in the tutorials I have is this lines:
mov 0b8000h, 'P' ; The letter P
mov 0b8001h, 1bh ; with some attribute
but this generates an error when I compile it.. how should I do it with nasm?
Suggestions:
Code: Select all
movb [0b8000h], 'P'
mov [0b8001h], byte 1bh
You probably understand how to extrapolate this to the full screen. There's 8000 of those entries right after another.
[edit] wake up man... [/edit]
Re:pmode error
you probably wantMcZ wrote: thank you :) finally it doesn't restart...
but I still have some problems, how do I write to screen in pmode using nasm? all I can find in the tutorials I have is this lines:
mov 0b8000h, 'P' ; The letter P
mov 0b8001h, 1bh ; with some attribute
but this generates an error when I compile it.. how should I do it with nasm?
mov [0b8000h], 'P' ; The letter P
mov [0b8001h], 1bh ; with some attribute
(square brackets meaning 'memory at this location')