exception when calling an int
Posted: Mon Jan 12, 2015 10:59 am
I was trying to develop an os in nasm but i got stuck in IDT:
The exception:
My Codes:
And:
Can anyone see the problem? Thanks in advance.
The exception:
Code: Select all
Booting from 0000:7c00
00015496180e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x12)
00015496180e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x0d)
00015496180e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x08)
00015496180i[CPU0 ] CPU is in protected mode (active)
00015496180i[CPU0 ] CS.mode = 32 bit
00015496180i[CPU0 ] SS.mode = 32 bit
00015496180i[CPU0 ] EFER = 0x00000000
00015496180i[CPU0 ] | EAX=00008e00 EBX=000003fc ECX=00090000 EDX=00000000
00015496180i[CPU0 ] | ESP=00007bff EBP=00000000 ESI=000e055d EDI=0000ffac
00015496180i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df if tf sf zf af pf cf
00015496180i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D
00015496180i[CPU0 ] | CS:0008( 0001| 0| 0) 00000000 000fffff 0 1
00015496180i[CPU0 ] | DS:0010( 0002| 0| 0) 00000000 000fffff 0 1
00015496180i[CPU0 ] | SS:0010( 0002| 0| 0) 00000000 000fffff 0 1
00015496180i[CPU0 ] | ES:0010( 0002| 0| 0) 00000000 000fffff 0 1
00015496180i[CPU0 ] | FS:0010( 0002| 0| 0) 00000000 000fffff 0 1
00015496180i[CPU0 ] | GS:0010( 0002| 0| 0) 00000000 000fffff 0 1
00015496180i[CPU0 ] | EIP=00007e2f (00007e2f)
00015496180i[CPU0 ] | CR0=0x60000011 CR2=0x00000000
00015496180i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
00015496180i[CPU0 ] 0x0000000000007e2f>> int 0x12 : CD12
00015496180e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting
00015496180i[SYS ] bx_pc_system_c::Reset(HARDWARE) called
00015496180i[CPU0 ] cpu hardware reset
Code: Select all
bits 32
org 0x7e00
%include "preproc.asm"
mov dword[MMNGR_TableBegin],0x7c00
mov dword[MMNGR_MinVal],0x100000
mov dword[MMNGR_MaxEntries],0x100
mov al,0x0c
call SetColor
call ClrScr
call IDT_Init
int 0x12
cli
hlt
%include "print32.asm"
%include "MMNGR.asm"
%include "IDT.asm"
Code: Select all
%ifndef IDT_asm
%define IDT_asm
%include "preproc.asm"
bits 32
struc IDT_interrupt
.baseLow resw 1
.selector resw 1
.reserved resb 1
.flags resb 1
.baseHi resw 1
endstruc
%define IDT_IDTBegin 0x7400
IDT_IDTPTR:
.limit dw 0x800
.base dd IDT_IDTBegin
IDT_InvalidInt:
call ClrScr
ldstr ebx,"Invalid Interrupt Call"
call Puts
jmp $
IDT_SetInt:
push eax
push ebx
push ecx
lea eax,[ebx*8+IDT_IDTBegin]
mov word[eax],cx
inc eax
inc eax
mov word[eax],0x8
inc eax
mov byte[eax],0
inc eax
mov byte[eax],010001110b
inc eax
shr ecx,16
mov word[eax],cx
pop ecx
pop ebx
pop eax
ret
IDT_Init:
push ebx
push ecx
xor ebx,ebx
mov ecx,IDT_InvalidInt
_loop:
call IDT_SetInt
inc ebx
cmp ebx,0x100
jl _loop
lidt [IDT_IDTPTR]
pop ecx
pop ebx
ret
%include "print32.asm"
%endif