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 3:48 PM, Mouse <mouse%Rodents-Montreal.ORG@localhost> wrote:
>
> C does not have a `pointer' type; what it has is a `pointer to
> OTHER-TYPE' for each type OTHER-TYPE.
>
> On all NetBSD ports I'm aware of, this is a distinction without a
> difference, since all memory is the same and all pointers are just
> memory addresses. Whether this is something to care about depends on
> how much you are willing to depend on the compiler letting you get away
> with things that C does not, strictly, promise.
There are a lot of places in the NetBSD code base that make the assumption that “void *” is a substitute for a pointer to any other type, and that any pointer type can be converted to any number of integer types, including, but not limited to, “intptr_t”, “uintptr_t”, and “vaddr_t”.
So, when I say “MI”, I’m referring to the NetBSD notion of “MI”, which includes a number of baked-in assumptions about implementation.
> [still thorpej, but another message]
>> 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.
>
> Not really. There is no MI way to check the alignment of a pointer.
> Pointers cannot be arguments to & or %, and there is nothing MI about
> converting a pointer to an integer.
>
> Again, on all NetBSD ports I'm aware of, the situation is nicer; it
> would be reasonable to say that it's straightforward in MI NetBSD code,
> but it's not really MI C.
See above.
-- thorpej
Home |
Main Index |
Thread Index |
Old Index