[TUHS] Any UNIX With No C In Userland?
Greg A. Woods
woods at robohack.ca
Wed Mar 5 13:52:41 AEST 2025
At Wed, 5 Mar 2025 10:54:01 +1100, Rob Pike <robpike at gmail.com> wrote:
Subject: [TUHS] Re: Any UNIX With No C In Userland?
>
> The notion that the struct layout must correspond to the hardware device's
> layout
Not "must" -- "can".
Of course that's just effectively using the compiler to do the
marshalling -- at compile time.
There are caveats of course -- one can lay out bit flags for a register
in a struct, but one must not make a pointer to such a struct and point
it at the register and expect bit manipulations to work -- even with -O0
you'll probably mess up any attempts to change bits predictably in that
register in ways that the hardware expects.
Of course the same problems occur if you try to point a word-sized
integer, even one with a "volatile" qualifier, at a register and
manipulate its bits with C bitwise expressions.
--
Greg A. Woods <gwoods at acm.org>
Kelowna, BC +1 250 762-7675 RoboHack <woods at robohack.ca>
Planix, Inc. <woods at planix.com> Avoncote Farms <woods at avoncote.ca>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: OpenPGP Digital Signature
URL: <http://www.tuhs.org/pipermail/tuhs/attachments/20250304/9714266c/attachment.sig>
More information about the TUHS
mailing list