fuword(), suword(), etc.
Pawel Jakub Dawidek
nick at garage.freebsd.pl
Thu Jul 24 01:27:41 PDT 2003
On Wed, Jul 23, 2003 at 02:48:41PM -0700, 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?
Yes, good idea. I'm using for now something like this:
static __inline void *
fuptr(void *uaddr)
{
void *ptr;
if (copyin(uaddr, &ptr, sizeof(void *)) != 0)
return ((void *)-1);
return (ptr);
}
For numbers is always better to use copyin(9)/copyout(9). Functions
like fubyte(9), etc. make no sens for me. -1 is returned on error or
if there is really -1, so one isn't able to find out if there is an
error or not.
--
Pawel Jakub Dawidek pawel at dawidek.net
UNIX Systems Programmer/Administrator http://garage.freebsd.pl
Am I Evil? Yes, I Am! http://cerber.sourceforge.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 305 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20030724/c5e084e3/attachment.bin
More information about the freebsd-current
mailing list