Non-conforming segment (Another Problem)

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
sngskunk
Member
Member
Posts: 47
Joined: Mon Mar 31, 2008 1:00 pm
Location: Louisville, KY, USA

Non-conforming segment (Another Problem)

Post by sngskunk »

I get an error in bochs during an 64-bit interrupt(long mode), but I get an message close to this:

Code: Select all

non-conforming segment, dpl != cpl, cpl = 0, dpl = 3
does that mean my gdt is wrong?

or is my idt wrong?

Any help would be great, thanks!
Last edited by sngskunk on Thu Jul 17, 2008 5:16 pm, edited 1 time in total.
Currently Working On:
Bootloader (Stage 1) (Complete)
Bootloader (Stage 2) (Inprogress)
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: Non-conforming segment

Post by AJ »

Hi,

Is it a software interrupt? If so, and you call it from ring 3, you need to set DPL in the IDT entry to 3. The DPL is found at bits 45 and 46 of your IDT entry.

Cheers,
Adam
User avatar
sngskunk
Member
Member
Posts: 47
Joined: Mon Mar 31, 2008 1:00 pm
Location: Louisville, KY, USA

Re: Non-conforming segment

Post by sngskunk »

It is the idt table from 0 to 31, which I believe is hardware interrupts like, #GP and #PF. I get that error, that I showed above.

I get a #GP right after I setup my idt and do "sti". then I get an infinite loop of interrupts.
Currently Working On:
Bootloader (Stage 1) (Complete)
Bootloader (Stage 2) (Inprogress)
User avatar
sngskunk
Member
Member
Posts: 47
Joined: Mon Mar 31, 2008 1:00 pm
Location: Louisville, KY, USA

Re: Non-conforming segment (Another Problem)

Post by sngskunk »

Okay I have gotten that error to go away, had something wrong in my structure, but now I cannot find out why I am getting these two errors, after these two errors, I get a triple fault.

I have tryed looking at bochs source code to find a solution, but I cannot find out why.

Here is the error:

Code: Select all

00009368140e[CPU0 ] interrupt(long mode): gate descriptor is not valid sys seg
00009368140e[CPU0 ] interrupt(long mode): IDT entry extended attributes DWORD4 TYPE != 0
And my structure for my 64bit IDT is below:

Code: Select all

/*
 * Interrupt Descriptor Structure
 */
typedef struct {
	u64bit	baseLow		: 16;
	u64bit	selector	: 16;
	u64bit	ist			: 3;
	u64bit	zeroOne		: 5;
	u64bit	type		: 4;
	u64bit	zeroTwo		: 1;
	u64bit	dpl			: 2;
	u64bit	present		: 1;
	u64bit	baseHigh	: 48;
	u64bit	reserved	: 32;
} idtEntry;

/*
 * Interrupt Descriptor Pointer
 */
struct idtPointerStruct {
	u16bit	limit;
	u64bit	base;
} __attribute__((packed));
typedef struct idtPointerStruct idtPointer;
Maybe it is how I put the values in the structures, but I need to know if my structure is correct.

Thanks for any help!
Currently Working On:
Bootloader (Stage 1) (Complete)
Bootloader (Stage 2) (Inprogress)
Post Reply