Cross gcc Mailing List Archive
[Prev][Next][Index][Thread]
Re: i386 and gcc
David Wood wrote:
>
> >> Failing this, anyone got any cute suggestion for far function calls, and far
> >> data pointers.
>
> >You don't need them, or want to use them. Run in protected
> >mode, and enjoy the benefits of a flat 32-bit address space.
> Yes, you do have a flat 32 bit address space but only with in the segment that
> the operating system has given you. Sure if you are writing an embedded system
> you can set yourself up segments for the whole memory range but you may choose
> not to for operation reasons. The i386 does support segments in protected mode.
> Protected mode gives you protection from code in one segment accesses code or
> data in segments of higher privilege.
So your system components run in ring 0 or ring 1? I don't see the
utility
here; the only benefit to be achieved from segmentation then is the
ability
to load without relocation.
> GCC conveniently produces binaries that start from zero (or any other base if you
> configure the linker command file correctly). These can then be loaded into a segment
> without any knowledge of the rest of the system. If a component wants the sevices
> of another , it can ask the OS for an interface pointer for that component - a far
> pointer because its across a segment boundary.
Then your OS microkernel needs to provide simple message-passing
services, and
you need a syscall gate. If you have Linux code lying around, you can
look
at how they do it - most x86 operating systems do it very similarly.
I don't think that passing pointers into someone else's address space is
a very
bright idea (what if they terminate and the segment is reused?). If
you're
already managing memory mappings, why not implement message-passing
using
shared memory? Have a syscall that allocates a block of memory that's
shared with both the caller and the callee.
> So, dear GCC/DeLore (Is that right?) far pointers please, or as my original
> post :-
That's DJ Delorie, and I still think you're doing this the wrong way. 8)
> David
--
Mike Smith *BSD hack Unix hardware collector
The question "why are the fundamental laws of nature mathematical"
invites the trivial response "because we define as fundamental those
laws which are mathematical". Paul Davies, _The_Mind_of_God_
References:
Home |
Subject Index |
Thread Index