9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "André Günther" <Andre.G@gmx.de>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] porting p9p to Google's NaCl
Date: Sat, 13 Jun 2009 17:13:01 +0200	[thread overview]
Message-ID: <EB79EE29-2B41-45EC-B4D2-3855BEA8E8D7@gmx.de> (raw)
In-Reply-To: <3e1162e60906130736t7685b7a6u961dacc0dad89121@mail.gmail.com>


> Having looked into this a bit, it appears to be more like 9vx than  
> QEMU  (uses segmenting capabilities), that is, unless I've forgotten  
> how 9vx is set up.
>
> I believe some X11 stuff also uses segment registers, as well as TLS  
> on Linux.
>


TLS and the kind of segmentation 9vx and NaCl are using are two pairs  
of shoes.

For every memory related operation in 32bit x86 there's a specific  
register responsible for being part of the address translation. (eg.  
%ds for various mov instructions and %ss for stack operations...)
However there are two "free" segment registers, namely: %fs and %gs.
So how can we possible use them? The x86 has the ability to prefix  
operations in a way that it uses another segment register instead of  
the usual one for translation.
This is how TLS is done. Either %gs or %fs are setup so that a  
prefixed instruction will use the TLS address range.

However the way segmentation is used in 9vx and NaCl is a whole other  
story. (What I am now saying me be specific to 9vx and differ on NaCl,  
but the general principle should be the same)
Here the segment registers like %cs, %ds, %es and %ss are directly  
altered (and given another segment description) so most of the memory  
instructions can just be used without further host->guest code  
translation (as long as the guest code doesn't use special  
segmentation stuff himself).

The basic idea is: when segment translation is done anyway, let's  
exploit it and get guest code memory translation/access restriction  
for free)

Hope that clears it a bit and i wasn't too much of a noise for the list,
best regards,
André








  reply	other threads:[~2009-06-13 15:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-12 20:04 Skip Tavakkolian
2009-06-13  1:04 ` Roman V Shaposhnik
2009-06-13  4:07   ` Skip Tavakkolian
2009-06-13 11:08     ` André Günther
2009-06-13 14:36   ` David Leimbach
2009-06-13 15:13     ` André Günther [this message]
2009-06-13 15:53 erik quanstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=EB79EE29-2B41-45EC-B4D2-3855BEA8E8D7@gmx.de \
    --to=andre.g@gmx.de \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).