problem of SWITCH TO USER MODE solved :-)

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.
User avatar
Adek336
Member
Member
Posts: 129
Joined: Thu May 12, 2005 11:00 pm
Location: Kabaty, Warszawa
Contact:

Re: problem of SWITCH TO USER MODE

Post by Adek336 »

try inspecting the value you're feeding LGDT with !
micro
Member
Member
Posts: 27
Joined: Sun May 04, 2008 5:40 pm

Re: problem of SWITCH TO USER MODE

Post 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);
User avatar
Adek336
Member
Member
Posts: 129
Joined: Thu May 12, 2005 11:00 pm
Location: Kabaty, Warszawa
Contact:

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

Post by Adek336 »

so how did you eventually make it work?
User avatar
codemastersnake
Member
Member
Posts: 148
Joined: Sun Nov 07, 2004 12:00 am
Contact:

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

Post by codemastersnake »

I think this topic is worth to be added to WIKI
User avatar
Adek336
Member
Member
Posts: 129
Joined: Thu May 12, 2005 11:00 pm
Location: Kabaty, Warszawa
Contact:

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

Post by Adek336 »

but we don't know what was the problem :D (or I misunderstand the post flow)
micro
Member
Member
Posts: 27
Joined: Sun May 04, 2008 5:40 pm

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

Post 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
Post Reply