tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: RFC: New userspace fetch/store API



> On Feb 24, 2019, at 8:42 AM, David Holland <dholland-tech%netbsd.org@localhost> wrote:
> 
> Given that the alignment check _is_ free on some architectures, and
> that dealing with alignment in machine-independent C is problematic,
> that doesn't seem like the right way…

If we’re concerned about portability of the things using this API, then we simply specify the alignment to be sizeof(type).  That check is straight-forward in MI C.

The alignment check is not necessary “free” in MD code — a mis-aligned address would likely trigger an alignment fault (SIGBUS code path) rather than a page fault (SIGSEGV code path) in the trap handler.  Certainly, it didn’t seem like the alpha trap handler handled a misaligned address in this case at all.  This isn’t the end of the world, but it means putting “onfault” logic in more than one code path in the trap handler.

-- thorpej



Home | Main Index | Thread Index | Old Index