Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Dec 1999 01:49:05 -0500
From:      "Vladimir N. Silyaev" <vsilyaev@mindspring.com>
To:        Luoqi Chen <luoqi@watermarkgroup.com>
Cc:        hackers@FreeBSD.ORG, vsilyaev@mindspring.com
Subject:   Re: FreeBSD-i386 and GS selector register
Message-ID:  <19991208014905.A7546@jupiter.delta.ny.us>
In-Reply-To: <199912080553.AAA03932@lor.watermarkgroup.com>; from luoqi@watermarkgroup.com on Wed, Dec 08, 1999 at 12:53:51AM -0500
References:  <199912080553.AAA03932@lor.watermarkgroup.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Dec 08, 1999 at 12:53:51AM -0500, Luoqi Chen wrote:
> > I have the next question.
> > The FreeBSD on i386 don't use GS register, even kernel DDB don't show
> > it. And at the time when kernel loaded and operational GS didn't 
> > initialized yet and have some garbage value (something like 0x1f, i.e.
> > pointed to the LDT). But because no one don't touch that all working fine.
> > 
> 0x1f is not garbage, it's (FreeBSD) standard user data segment.
Small mistake not 0x1f, but 0x2f, at any case it doesn't mean.
About standard registers, I think you are mean user space?
I wrote simple kld, and obtain the next results:
ldt = 0x0028 gs = 0x0000002f, ds = 0x00000010 

And also others selectors such as fs, cs, ss and es pointed to GTD. Only gs
has a different case (doesn't change its value when a context switched).

> > Question.
> > The some driver had code like this:
> > 	push	%gs <--- OK 0x1f  saved on the stack
> > 	...  
> > 	call    do_big_deal
> > 	...
> > 	pop	%gs <--- Restore 0x1f and have a fault, probably Double Fault
> > 
> It could only be that the driver code changed the LDT descriptor and didn't
> restore it upon return.
Oh, Exactly, you are right. Thanks!
That code clear ldt, other selectors restored ok, but not gs.  Before I think, 
that in the kernel ldt has a null value, and never tried to test it. 

-- 
Vladimir Silyaev


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991208014905.A7546>