fuword(), suword(), etc.

Terry Lambert tlambert2 at mindspring.com
Thu Jul 24 01:37:10 PDT 2003

Julian Elischer wrote:
> I'd like to have a "suptr and fuptr" to be able to save and read
> user pointers in a "machine independent" manner..
> at the moment ia need to know the size of a pointer and select the
> appropriate 32 or 64 version.. It would jus tbe another ENTRY files in
> support.[sS] alongside teh appropriate sized entry
> for each architecture so it wouldn't 'cost' anything..
> for i386 it would be an alternate name for fuword32() and suword32()
> I'm not sure what it would be on other architectures....
> comments?

You cannot be certain that specific user space pointers are 64
bits on a 32 bit kernel or 32 bits on on a 64 bit kernel, etc..

The reason for this is that you may wish to operate in a hybrid
or backward compatability mode, or you may wish to operate the
kernel in a smaller virtual address space than user space, or
vice versa, as a developement decision.

For example the PPC 970 ("G5") processor has specific support for
backward binary compatability, as does the AMD "Hammer", the Intel
"Opteron" (IA64), and the SPARC64.

Probably it will be a long time before many commercial 32 bit
applications are ported to 64 bit kernels, and you're going to
want to be able to run the 32 bit applications.

The point is that you will probably end up needing at least 4
macros each, if you have sized types on both ends, and two each,
if you assume that the kernel pointer size is fixed on every

Personally, I would call this a "kernel is aware of the ABI for
each of the applications it is currently running", and make it a
flag in the system call table, if you insist on using a single
name for the thing.

-- Terry

More information about the freebsd-current mailing list