Page 2 of 2

Re: problem of SWITCH TO USER MODE

Posted: Tue Aug 12, 2008 9:14 am
by Adek336
try inspecting the value you're feeding LGDT with !

Re: problem of SWITCH TO USER MODE

Posted: Wed Aug 13, 2008 12:26 am
by micro
Adek336 wrote:try inspecting the value you're feeding LGDT with !
i just copy someone's code (i am sorry ,forget who he is :oops: )
but i change the function which load the gdtr.. :oops: ,
any suggestion is expected.... :oops: thank you all !!

Code: Select all

struct gdt_ptr_struct
{
	u16int limit;
	u32int base;
} __attribute__((packed));

Code: Select all

typedef struct gdt_ptr_struct gdt_ptr_t;

Code: Select all

gdt_ptr_t	gdt_ptr;

Code: Select all

#define load_gdtr(n)\
__asm__("lgdt (%%eax)\n\t"\
::"a" (n));

Code: Select all

load_gdtr((u32int)&gdt_ptr);

Re: problem of SWITCH TO USER MODE solved :-)

Posted: Sun Aug 17, 2008 2:59 pm
by Adek336
so how did you eventually make it work?

Re: problem of SWITCH TO USER MODE solved :-)

Posted: Mon Aug 18, 2008 8:07 am
by codemastersnake
I think this topic is worth to be added to WIKI

Re: problem of SWITCH TO USER MODE solved :-)

Posted: Mon Aug 18, 2008 3:56 pm
by Adek336
but we don't know what was the problem :D (or I misunderstand the post flow)

Re: problem of SWITCH TO USER MODE solved :-)

Posted: Tue Aug 19, 2008 6:38 pm
by micro
Adek336 wrote:so how did you eventually make it work?

in fact , the code i had been posted work well,
maybe the problem comes from boot code which i used, :oops: . i think. maybe
i modified the boot code, and the GDT code worked