How to setup IDT in Pmode, using asm
Posted: Wed Jul 21, 2004 1:20 am
Hi everyone
Now I am already in Pmode, following code has been move to 0x90000 physical address. When I use bochs to try my code,i find there is a big bug in my code. Attachment is my code and image.
BUG: I cannot use INT 0x0, but there is no problem with my idt setting. In bochs, when i run the INT instruction, the output is " LOCK PUSH EBX "
Pupose of following code : Setup IDT in Pmode, and have a test.
compiler: nasm
Now I am already in Pmode, following code has been move to 0x90000 physical address. When I use bochs to try my code,i find there is a big bug in my code. Attachment is my code and image.
BUG: I cannot use INT 0x0, but there is no problem with my idt setting. In bochs, when i run the INT instruction, the output is " LOCK PUSH EBX "
Pupose of following code : Setup IDT in Pmode, and have a test.
compiler: nasm
Code: Select all
[bits 32]
jmp Begin
; 2 reserved interrupts:
idtr: dw idt_end - idt - 1 ; IDT limit
dd idt ; linear, physical addr
; 32 reserved interrupts:
idt: dw test ; entry point 15:0
dw 0x10 ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0
dw 0 ; entry point 31:16
idt_end:
test: cli
mov ax,0x08
mov gs,ax
mov byte [gs:0xB8000],'#'
jmp $
Begin:
xor eax,eax
mov ax,0x08 ;0x08 is the LINEAR_SEL in GDT
mov ds,ax
mov eax,0x90000 ; I have move this progrom to
; 0x90000 physical address
mov ebx, idt
add ebx, eax
mov dword [ds:idtr + 2 + 0x90000 ], ebx
lidt [ds:idtr + 0x90000]
int 0x0 ; problem happen
hlt