A Error, i cant figuere out.

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
kmtdk
Member
Member
Posts: 263
Joined: Sat May 17, 2008 4:05 am
Location: Cyperspace, Denmark
Contact:

A Error, i cant figuere out.

Post 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
Attachments
attachment.zip
(6.21 KiB) Downloaded 86 times
well, what to say, to much to do in too little space.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: A Error, i cant figuere out.

Post 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?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
kmtdk
Member
Member
Posts: 263
Joined: Sat May 17, 2008 4:05 am
Location: Cyperspace, Denmark
Contact:

Re: A Error, i cant figuere out.

Post 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
well, what to say, to much to do in too little space.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

Re: A Error, i cant figuere out.

Post 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.
Post Reply