Page 1 of 1

Non-conforming segment (Another Problem)

Posted: Wed Jul 16, 2008 1:21 pm
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!

Re: Non-conforming segment

Posted: Wed Jul 16, 2008 1:32 pm
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

Re: Non-conforming segment

Posted: Thu Jul 17, 2008 11:00 am
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.

Re: Non-conforming segment (Another Problem)

Posted: Thu Jul 17, 2008 5:19 pm
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!