Hi, apparently i find the structure.
Now, i want to know if exists a mp table. For this im looking at mp feature information byte 1. The spec says if the value = 0 the table exists. If the different from zero the number in this field represents the number of the default configuration. This number in the spec is from 1 to 7. The problem is that i didnt find a value in this range...here is the code.
Code: Select all
org 0x07c00
mp1 dw 0
mp2 dw 0
mp3 db 0
mp4 db 0
start:
bits 16
mov ax, word 0x0000
mov ds, ax
mov ax, word [0x40e]
mov ds, ax
mov bx, word 0x0000 ;looking at the ebda
mov cx, word 1024
l:
mov ax, word [bx]
cmp ax, 0x4D5F
je find
add bx, 16 ;16 byte align
loop l
mov ah, 0x0e
mov al, 0x31 ;breakpoint
int 0x10
mov ax, word 0x9fc0 ;looking at tthe top of system memory area
mov ds, ax
mov cx, word 1024
mov bx, 0x0000
l2:
mov ax, word [bx]
cmp ax, 0x4D5F
je find
add bx, 16
loop l2
mov ah, 0x0e
mov al, 0x32 ;breakpoint
int 0x10
mov ax, word 0xf000
mov ds, ax ;looking at bios rom
mov cx, word 65535
mov bx, 0x0000
l3:
mov ax, word [bx]
cmp ax, 0x4D5F
je find
add bx, 16
loop l3
mov ah, 0x0e
mov al, 0x33 ;breakpoint
int 0x10
spin4: jmp spin4
find:
mov ax, word [bx+2] ;check the second part of the structure signature
cmp ax, 0x5F50
je find2
mov ah, 0x0e
mov al, 0x61
int 0x10 ;breakpoint
spin2: jmp spin2
find2:
mov ax, word [bx+4] ;pointer to the mp configuration table
mov [mp1], word ax
mov ax, word [bx+6] ;pointer to the table, second word
mov [mp2], word ax
mov al, byte [bx+11] ;mp feature information byte 1
mov [mp3], al
mov al, byte [bx+12] ;mp feature byte 2
mov [mp4], al
mov cx, word 7
mov bl, byte 0
mov al, byte [mp3]
mov dl, byte 0x30
teste:
cmp al, byte bl ;transform the mp config number in ascii
je numero
inc dl
inc bl
loop teste
numero:
mov ah, 0x0e
mov al, byte dl ;print mp default configuration number on screen
int 0x10
mov ah, 0x0e
mov al, 0x63 ;breakpoint
int 0x10
;******************hereafter is just to set the protected mode
mov ax, word 0x0000
mov ds, ax
cli
lgdt [gdt_addr]
mov eax, cr0
or eax, 0x01
mov cr0, eax
jmp 0x08:codigo
bits 32
codigo:
mov ax, word 0x10
mov ds, word ax
lea eax, [isr]
mov [off1], ax
;mov [of1], ax
shr eax, 16
mov [off2], ax
;mov [of2], ax
lidt [idt_addr]
mov eax, [mp2]
shl eax, 16
mov ax, [mp1]
;sti
spin: jmp spin
isr:
mov [0xb8000], byte 0x61
mov [0xb8001], byte 0x0f
spin1: jmp spin1
bits 16
gdt_addr:
lim dw 31
base dd gdt
idt_addr:
limite dw end_idt - idt - 1
bas dd idt
gdt:
null dd 0
null2 dd 0
c_limite dw 0xffff
c_base dw 0x0000
c_base2 db 0x00
c_type db 0x98
c_limite2 db 0xcf
c_base3 db 0x00
d_limite dw 0xffff
d_base dw 0x0000
d_base2 db 0x00
d_type db 0x92
d_limite2 db 0xcf
d_base3 db 0x00
end_gdt:
idt:
times 66 dd 0
;of1 dw 0
;sel dw 0x08
;res db 0x00
;mis db 0x8e
;of2 dw 0
off1 dw 0
seletor dw 0x08
reserv db 0x00
misc db 0x8e
off2 dw 0
end_idt: