[prev in list] [next in list] [prev in thread] [next in thread]
List: bochs-dev
Subject: Re: [Bochs-developers] gcc bochs-bios v0.2.0
From: "Kevin O'Connor" <kevin () koconnor ! net>
Date: 2008-03-31 1:26:18
Message-ID: 20080331012618.GA4749 () ohio ! lan
[Download RAW message or body]
On Mon, Mar 31, 2008 at 12:36:50AM +0100, Michael Brown wrote:
> Tested on a freshly built git tree (on Mandriva 2007.1, AVOIDCOMBINE=1
> required, gcc 4.1.2) with a current gPXE snapshot, and it appears to work.
> Nice job!
Thanks.
> I'm a little wary of the GET_VAR() magic; in particular, the way that
> there's nothing that prevents the compiler from compiling a direct
> dereference of a pointer that cannot legitimately be accessed via the
> current %ds==%ss.
Yes - this concerns me as well.
The 16bit bios callbacks store all variables in two tables - the bios
data area and the extended bios data area. These areas are accessed
via GET/SET_BDA and GET/SET_EBDA macros - there is no global pointer
to these areas that a developer could mistakenly access directly. So,
the code does protect against casual accesses to variables.
>In gPXE, we use some preprocessor magic so that
> out-of-segment variables can be accessed transparently. I can't
> immediately think of a solution that would allow you to do this given
> your constraints, but you could at least have something like:
>
> #define CS_VAR(var) _CS_ ## var
> #define GET_VAR(seg,var) <...dereferencing magic on "_CS_ ## var"...>
> static int CS_VAR(foo) = 5;
The CS segment is only useful for storing constant data (machines
generally mark the 0xf0000 area that holds the bios code as
read-only).
The data that is stored in the CS segment is mostly constant strings
(eg, the "hello world" in a call like printf("hello world")). It's
difficult to protect these types of strings; the protection may be
more pain than the problem.
Oh well - I'm hoping documentation, code auditing, and proper testing
will prevent the issue.
Thanks again,
-Kevin
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
bochs-developers mailing list
bochs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bochs-developers
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic