Can't enter protected mode

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
matias_beretta
Member
Member
Posts: 101
Joined: Mon Feb 26, 2007 3:39 pm

Can't enter protected mode

Post by matias_beretta »

Hello, thanks for reading my topic.
This isn't working and can't find the error, can you help me?

Code: Select all

use16

mov ax, 7c0h
mov ds, ax

cli

lgdt [C]
mov ah, 0eh
mov al, 'A'
int 10h

mov eax, cr0
or al, 1
mov cr0, eax

jmp 8h:A

use32

A:
    mov ax, 10h
    mov es, ax
    mov byte [es:0], 'M'
    mov byte [es:1], 31
    jmp $
B:
    db 0h, 0h, 0h, 0h, 0h, 0h, 0h, 0h
    db 0FFh, 0FFh, 0h, 0h, 0h, 10011000b, 11001111b, 0h
    db 0FFh, 0FFh, 0h, 0h, 0h, 10010010b, 11001111b, 0h
C:
    dw C-B-1
    dd B

times 510-($-$$) db 0
db 55h, 0aah
Matías Beretta
User avatar
Dandee Yuyo
Member
Member
Posts: 47
Joined: Fri Nov 09, 2007 6:46 pm
Location: Argentina

Post by Dandee Yuyo »

The '0x10' segment you are loading in ES is zero-based. Thus I'm afraid you are writting the character 'M' at memory location 0000000000 and the value 31 at 0000000001. That is the standard interrupt vector table.

Also I would LGDT right before switching to PM (or right after).
NaN - Not a Nerd
Working on: Physical Memory Management with a 5-lod mipmap XD
User avatar
matias_beretta
Member
Member
Posts: 101
Joined: Mon Feb 26, 2007 3:39 pm

Reply

Post by matias_beretta »

thanks...
Matías Beretta
Post Reply