Exception 13 in bochs

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
richi18007
Member
Member
Posts: 35
Joined: Mon Mar 07, 2011 1:41 pm

Exception 13 in bochs

Post by richi18007 »

I'm using the following snippet in order to load the LDT for the file , and i get an error as interrupt 13

Code: Select all

void Switch_To_Address_Space(struct User_Context *userContext)
{
	ushort_t ldtSelector;
	ldtSelector = userContext-> ldtSelector;
	__asm__ __volatile__ ( __asm__ __volatile__ (
	"Lldt% 0"
	: 
	:  "A" (ldtSelector)
	);  
}
Can anybody please tell me what's the error about .The dump of the error is as below
Attachments
Screenshot.png
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: Exception 13 in bochs

Post by Combuster »

Bochs gives you the exact error: the provided selector has TI (bit 3) set, and loading an LDT from an existing LDT is not allowed.

Your inline assembly is suspect here. You tell lldt to use a register of gcc's choice (%0) while you force the argument into EAX:EDX ("A"), which needs not be the same (apart from the fact that using the eax-edx pair is just wrong)
"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 ]
Fanael
Member
Member
Posts: 38
Joined: Fri Oct 16, 2009 9:20 am

Re: Exception 13 in bochs

Post by Fanael »

Combuster wrote:You tell lldt to use a register of gcc's choice (%0) while you force the argument into EAX:EDX ("A"), which needs not be the same
Actually, it has to be the same, because GCC can choose between EDX:EAX, EDX:EAX and EDX:EAX ("A"). If it's not, it's a bug in the compiler.
Post Reply