sti and exception

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
lukasz1235
Posts: 12
Joined: Fri Mar 06, 2009 12:18 pm
Location: Poland
Contact:

sti and exception

Post by lukasz1235 »

Hi
I have a little problem. After I enable hardware interrupts on Bochs, I get once exception no. 13. On Qemu and VirtualBox is OK. My code: http://los.svn.sourceforge.net/viewvc/los/trunk/
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: sti and exception

Post by egos »

Mask all unused interrupts and set dummy handlers for them.
If you have seen bad English in my words, tell me what's wrong, please.
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: sti and exception

Post by Combuster »

How on earth do you get an exception?

Code: Select all

console.cpp:21:18: error: cstdio: No such file or directory
console.cpp: In function 'void Console::kprintf(const char*, ...)':
console.cpp:134: error: 'va_list' was not declared in this scope
console.cpp:134: error: expected ';' before 'args'
console.cpp:137: error: 'args' was not declared in this scope
console.cpp:137: error: 'va_start' was not declared in this scope
console.cpp:138: error: 'vsnprintf' was not declared in this scope
console.cpp:139: error: 'va_end' was not declared in this scope
:shock:
"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 ]
lukasz1235
Posts: 12
Joined: Fri Mar 06, 2009 12:18 pm
Location: Poland
Contact:

Re: sti and exception

Post by lukasz1235 »

You mean the IMR? But it is register of PIC, and I use APIC.

@Combuster: Now is OK.
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: sti and exception

Post by Combuster »

Next tip: read error messages

Code: Select all

00123347958e[CPU0 ] read_virtual_dqword_aligned_64(): #GP misaligned access
00123347958e[CPU0 ] interrupt(long mode): IDT entry extended attributes DWORD4 TYPE != 0
(...)
00123347958i[CPU0 ] 0x0000008000001187>> movdqa xmm0, dqword ptr ds:[rdx] : 660F6F02
"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 ]
lukasz1235
Posts: 12
Joined: Fri Mar 06, 2009 12:18 pm
Location: Poland
Contact:

Re: sti and exception

Post by lukasz1235 »

I change movdqa to movdqu and it not solve the problem.
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: sti and exception

Post by Combuster »

Of course not. Bochs said there were at least two problems. (Actually, there's a third: your build system drags in glibc by default)
"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 ]
lukasz1235
Posts: 12
Joined: Fri Mar 06, 2009 12:18 pm
Location: Poland
Contact:

Re: sti and exception

Post by lukasz1235 »

From Bochs source:

Code: Select all

  if (desctmp2 & BX_CONST64(0x00001F0000000000)) {
    BX_ERROR(("interrupt(long mode): IDT entry extended attributes DWORD4 TYPE != 0"));
    exception(BX_GP_EXCEPTION, vector*8 + 2);
  }
. Example IDT descriptor:
7B 1E 08 00 00 8E 00 00 80 00 00 00 00 00 00 00

desctmp2 = 0x8000000000000000

0x8000000000000000 & 0x00001F0000000000 = 0

So I don't understand where is the bug.

As regards the third: Where?
Post Reply