Page 1 of 1

A Error, i cant figuere out.

Posted: Mon Jun 23, 2008 2:30 pm
by kmtdk
Well, as the title says.
I have a running code, with a "default" intterupt catcher, so i have intrupts on.
The problem is after the code stops:

The bochs log looks like this:
00001796618i[BIOS ] Booting from 0000:7c00
00002531526e[DEV ] read from port 0x0000 with len 4 returns 0xffffffff
00002531530e[DEV ] read from port 0x0000 with len 4 returns 0xffffffff
00002531535e[CPU0 ] fetch_raw_descriptor: GDT: index (ff57)1fea > limit (17)
00002531657p[CPU0 ] >>PANIC<< fetch_raw_descriptor: LDTR.valid=0
00002531657i[CPU0 ] CPU is in protected mode (active)
00002531657i[CPU0 ] CS.d_b = 32 bit
00002531657i[CPU0 ] SS.d_b = 32 bit
00002531657i[CPU0 ] EFER = 0x00000000
00002531657i[CPU0 ] | RAX=0000000000000000 RBX=0000000000008f00
00002531657i[CPU0 ] | RCX=0000000000000002 RDX=0000000000000000
00002531657i[CPU0 ] | RSP=000000000008fff0 RBP=0000000000000000
00002531657i[CPU0 ] | RSI=0000000000000810 RDI=00000000000c0007
00002531657i[CPU0 ] | R8=0000000000000000 R9=0000000000000000
00002531657i[CPU0 ] | R10=0000000000000000 R11=0000000000000000
00002531657i[CPU0 ] | R12=0000000000000000 R13=0000000000000000
00002531657i[CPU0 ] | R14=0000000000000000 R15=0000000000000000
00002531657i[CPU0 ] | IOPL=0 id vip vif ac vm rf nt of df if tf sf ZF af PF cf
00002531657i[CPU0 ] | SEG selector base limit G D
00002531657i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D
00002531657i[CPU0 ] | CS:0008( 0001| 0| 0) 00000000 000fffff 1 1
00002531657i[CPU0 ] | DS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00002531657i[CPU0 ] | SS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00002531657i[CPU0 ] | ES:0010( 0002| 0| 0) 00000000 000fffff 1 1
00002531657i[CPU0 ] | FS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00002531657i[CPU0 ] | GS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00002531657i[CPU0 ] | MSR_FS_BASE:0000000000000000
00002531657i[CPU0 ] | MSR_GS_BASE:0000000000000000
00002531657i[CPU0 ] | RIP=00000000000010e0 (00000000000010df)
00002531657i[CPU0 ] | CR0=0x00000011 CR1=0x0 CR2=0x0000000000000000
00002531657i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
00002531657i[CPU0 ] >> iretd : CF

The "read from port 0x0000 ..." is not one of mine commands.

if you need my code,, it is attached

I know there is an error in the "menu function" .
The reason why i "cut" that part "off" was because the error happen after "hlt".


KMT

Re: A Error, i cant figuere out.

Posted: Mon Jun 23, 2008 2:38 pm
by Combuster
It looks like you messed up the stack before interrupt return - are you aware of the error code that might or might not be there when an exception is fired?

Re: A Error, i cant figuere out.

Posted: Mon Jun 23, 2008 2:42 pm
by kmtdk
Well
I might have, but the problem is just that i dont change "esp" at any time.
but at the end it is not that it is suposed to be ?

can it be because, a interupt comes with with a error code, and i dont "catch" it , and still pushes and popes .. ?


Kmt

Re: A Error, i cant figuere out.

Posted: Mon Jun 23, 2008 3:15 pm
by jnc100
Some interrupts push an error code before the interrupt handler is executed, some don't. Suggest you read the Intel 3A, chapter 5 (and probably the rest while you're at it). I have a strange feeling of deja vu.

Regards,
John.