svn commit: r199486 - projects/ppc64/sys/compat/freebsd32
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Wed Nov 18 16:45:28 UTC 2009
Author: nwhitehorn
Date: Wed Nov 18 16:45:27 2009
New Revision: 199486
URL: http://svn.freebsd.org/changeset/base/199486
Log:
Make several more freebsd32 syscalls work on big-endian hardware.
Statically linked 32-bit binaries now seem to work more or less perfectly
on a 64-bit kernel, but dynamically linked ones die in rtld with
EOVERFLOW.
Modified:
projects/ppc64/sys/compat/freebsd32/freebsd32_misc.c
projects/ppc64/sys/compat/freebsd32/freebsd32_proto.h
Modified: projects/ppc64/sys/compat/freebsd32/freebsd32_misc.c
==============================================================================
--- projects/ppc64/sys/compat/freebsd32/freebsd32_misc.c Wed Nov 18 15:48:51 2009 (r199485)
+++ projects/ppc64/sys/compat/freebsd32/freebsd32_misc.c Wed Nov 18 16:45:27 2009 (r199486)
@@ -2100,8 +2100,13 @@ freebsd6_freebsd32_lseek(struct thread *
error = lseek(td, &ap);
/* Expand the quad return into two parts for eax and edx */
pos = *(off_t *)(td->td_retval);
+ #if BYTE_ORDER == BIG_ENDIAN
+ td->td_retval[0] = pos >> 32;
+ td->td_retval[1] = pos & 0xffffffff;
+ #else
td->td_retval[0] = pos & 0xffffffff; /* %eax */
td->td_retval[1] = pos >> 32; /* %edx */
+ #endif
return error;
}
Modified: projects/ppc64/sys/compat/freebsd32/freebsd32_proto.h
==============================================================================
--- projects/ppc64/sys/compat/freebsd32/freebsd32_proto.h Wed Nov 18 15:48:51 2009 (r199485)
+++ projects/ppc64/sys/compat/freebsd32/freebsd32_proto.h Wed Nov 18 16:45:27 2009 (r199486)
@@ -294,8 +294,13 @@ struct freebsd32_nmount_args {
struct freebsd32_sendfile_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];
+ #if BYTE_ORDER == BIG_ENDIAN
+ char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
+ char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
+ #else
char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
+ #endif
char nbytes_l_[PADL_(size_t)]; size_t nbytes; char nbytes_r_[PADR_(size_t)];
char hdtr_l_[PADL_(struct sf_hdtr32 *)]; struct sf_hdtr32 * hdtr; char hdtr_r_[PADR_(struct sf_hdtr32 *)];
char sbytes_l_[PADL_(off_t *)]; off_t * sbytes; char sbytes_r_[PADR_(off_t *)];
@@ -373,13 +378,23 @@ struct freebsd32_mmap_args {
char prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)];
char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ #if BYTE_ORDER == BIG_ENDIAN
+ char poshi_l_[PADL_(u_int32_t)]; u_int32_t poshi; char poshi_r_[PADR_(u_int32_t)];
+ char poslo_l_[PADL_(u_int32_t)]; u_int32_t poslo; char poslo_r_[PADR_(u_int32_t)];
+ #else
char poslo_l_[PADL_(u_int32_t)]; u_int32_t poslo; char poslo_r_[PADR_(u_int32_t)];
char poshi_l_[PADL_(u_int32_t)]; u_int32_t poshi; char poshi_r_[PADR_(u_int32_t)];
+ #endif
};
struct freebsd32_lseek_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ #if BYTE_ORDER == BIG_ENDIAN
+ char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
+ char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
+ #else
char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
+ #endif
char whence_l_[PADL_(int)]; int whence; char whence_r_[PADR_(int)];
};
struct freebsd32_truncate_args {
@@ -394,35 +409,60 @@ struct freebsd32_truncate_args {
};
struct freebsd32_ftruncate_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ #if BYTE_ORDER == BIG_ENDIAN
+ char lengthhi_l_[PADL_(u_int32_t)]; u_int32_t lengthhi; char lengthhi_r_[PADR_(u_int32_t)];
+ char lengthlo_l_[PADL_(u_int32_t)]; u_int32_t lengthlo; char lengthlo_r_[PADR_(u_int32_t)];
+ #else
char lengthlo_l_[PADL_(u_int32_t)]; u_int32_t lengthlo; char lengthlo_r_[PADR_(u_int32_t)];
char lengthhi_l_[PADL_(u_int32_t)]; u_int32_t lengthhi; char lengthhi_r_[PADR_(u_int32_t)];
+ #endif
};
struct freebsd32_cpuset_setid_args {
char which_l_[PADL_(cpuwhich_t)]; cpuwhich_t which; char which_r_[PADR_(cpuwhich_t)];
+ #if BYTE_ORDER == BIG_ENDIAN
+ char idhi_l_[PADL_(uint32_t)]; uint32_t idhi; char idhi_r_[PADR_(uint32_t)];
+ char idlo_l_[PADL_(uint32_t)]; uint32_t idlo; char idlo_r_[PADR_(uint32_t)];
+ #else
char idlo_l_[PADL_(uint32_t)]; uint32_t idlo; char idlo_r_[PADR_(uint32_t)];
char idhi_l_[PADL_(uint32_t)]; uint32_t idhi; char idhi_r_[PADR_(uint32_t)];
+ #endif
char setid_l_[PADL_(cpusetid_t)]; cpusetid_t setid; char setid_r_[PADR_(cpusetid_t)];
};
struct freebsd32_cpuset_getid_args {
char level_l_[PADL_(cpulevel_t)]; cpulevel_t level; char level_r_[PADR_(cpulevel_t)];
char which_l_[PADL_(cpuwhich_t)]; cpuwhich_t which; char which_r_[PADR_(cpuwhich_t)];
+ #if BYTE_ORDER == BIG_ENDIAN
+ char idhi_l_[PADL_(uint32_t)]; uint32_t idhi; char idhi_r_[PADR_(uint32_t)];
+ char idlo_l_[PADL_(uint32_t)]; uint32_t idlo; char idlo_r_[PADR_(uint32_t)];
+ #else
char idlo_l_[PADL_(uint32_t)]; uint32_t idlo; char idlo_r_[PADR_(uint32_t)];
char idhi_l_[PADL_(uint32_t)]; uint32_t idhi; char idhi_r_[PADR_(uint32_t)];
+ #endif
char setid_l_[PADL_(cpusetid_t *)]; cpusetid_t * setid; char setid_r_[PADR_(cpusetid_t *)];
};
struct freebsd32_cpuset_getaffinity_args {
char level_l_[PADL_(cpulevel_t)]; cpulevel_t level; char level_r_[PADR_(cpulevel_t)];
char which_l_[PADL_(cpuwhich_t)]; cpuwhich_t which; char which_r_[PADR_(cpuwhich_t)];
+ #if BYTE_ORDER == BIG_ENDIAN
+ char idhi_l_[PADL_(uint32_t)]; uint32_t idhi; char idhi_r_[PADR_(uint32_t)];
+ char idlo_l_[PADL_(uint32_t)]; uint32_t idlo; char idlo_r_[PADR_(uint32_t)];
+ #else
char idlo_l_[PADL_(uint32_t)]; uint32_t idlo; char idlo_r_[PADR_(uint32_t)];
char idhi_l_[PADL_(uint32_t)]; uint32_t idhi; char idhi_r_[PADR_(uint32_t)];
+ #endif
char cpusetsize_l_[PADL_(size_t)]; size_t cpusetsize; char cpusetsize_r_[PADR_(size_t)];
char mask_l_[PADL_(cpuset_t *)]; cpuset_t * mask; char mask_r_[PADR_(cpuset_t *)];
};
struct freebsd32_cpuset_setaffinity_args {
char level_l_[PADL_(cpulevel_t)]; cpulevel_t level; char level_r_[PADR_(cpulevel_t)];
char which_l_[PADL_(cpuwhich_t)]; cpuwhich_t which; char which_r_[PADR_(cpuwhich_t)];
+ #if BYTE_ORDER == BIG_ENDIAN
+ char idhi_l_[PADL_(uint32_t)]; uint32_t idhi; char idhi_r_[PADR_(uint32_t)];
+ char idlo_l_[PADL_(uint32_t)]; uint32_t idlo; char idlo_r_[PADR_(uint32_t)];
+ #else
char idlo_l_[PADL_(uint32_t)]; uint32_t idlo; char idlo_r_[PADR_(uint32_t)];
char idhi_l_[PADL_(uint32_t)]; uint32_t idhi; char idhi_r_[PADR_(uint32_t)];
+ #endif
char cpusetsize_l_[PADL_(size_t)]; size_t cpusetsize; char cpusetsize_r_[PADR_(size_t)];
char mask_l_[PADL_(const cpuset_t *)]; const cpuset_t * mask; char mask_r_[PADR_(const cpuset_t *)];
};
@@ -625,8 +665,13 @@ struct freebsd4_freebsd32_fhstatfs_args
struct freebsd4_freebsd32_sendfile_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];
+ #if BYTE_ORDER == BIG_ENDIAN
+ char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
+ char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
+ #else
char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
+ #endif
char nbytes_l_[PADL_(size_t)]; size_t nbytes; char nbytes_r_[PADR_(size_t)];
char hdtr_l_[PADL_(struct sf_hdtr32 *)]; struct sf_hdtr32 * hdtr; char hdtr_r_[PADR_(struct sf_hdtr32 *)];
char sbytes_l_[PADL_(off_t *)]; off_t * sbytes; char sbytes_r_[PADR_(off_t *)];
@@ -658,16 +703,26 @@ struct freebsd6_freebsd32_pread_args {
char buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)];
char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];
char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
+ #if BYTE_ORDER == BIG_ENDIAN
+ char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
+ char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
+ #else
char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
+ #endif
};
struct freebsd6_freebsd32_pwrite_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
char buf_l_[PADL_(const void *)]; const void * buf; char buf_r_[PADR_(const void *)];
char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];
char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
+ #if BYTE_ORDER == BIG_ENDIAN
+ char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
+ char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
+ #else
char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
+ #endif
};
struct freebsd6_freebsd32_mmap_args {
char addr_l_[PADL_(caddr_t)]; caddr_t addr; char addr_r_[PADR_(caddr_t)];
@@ -676,8 +731,13 @@ struct freebsd6_freebsd32_mmap_args {
char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
+ #if BYTE_ORDER == BIG_ENDIAN
+ char poshi_l_[PADL_(u_int32_t)]; u_int32_t poshi; char poshi_r_[PADR_(u_int32_t)];
+ char poslo_l_[PADL_(u_int32_t)]; u_int32_t poslo; char poslo_r_[PADR_(u_int32_t)];
+ #else
char poslo_l_[PADL_(u_int32_t)]; u_int32_t poslo; char poslo_r_[PADR_(u_int32_t)];
char poshi_l_[PADL_(u_int32_t)]; u_int32_t poshi; char poshi_r_[PADR_(u_int32_t)];
+ #endif
};
struct freebsd6_freebsd32_lseek_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
@@ -694,14 +754,24 @@ struct freebsd6_freebsd32_lseek_args {
struct freebsd6_freebsd32_truncate_args {
char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
+ #if BYTE_ORDER == BIG_ENDIAN
+ char lengthhi_l_[PADL_(u_int32_t)]; u_int32_t lengthhi; char lengthhi_r_[PADR_(u_int32_t)];
+ char lengthlo_l_[PADL_(u_int32_t)]; u_int32_t lengthlo; char lengthlo_r_[PADR_(u_int32_t)];
+ #else
char lengthlo_l_[PADL_(u_int32_t)]; u_int32_t lengthlo; char lengthlo_r_[PADR_(u_int32_t)];
char lengthhi_l_[PADL_(u_int32_t)]; u_int32_t lengthhi; char lengthhi_r_[PADR_(u_int32_t)];
+ #endif
};
struct freebsd6_freebsd32_ftruncate_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
+ #if BYTE_ORDER == BIG_ENDIAN
+ char lengthhi_l_[PADL_(u_int32_t)]; u_int32_t lengthhi; char lengthhi_r_[PADR_(u_int32_t)];
+ char lengthlo_l_[PADL_(u_int32_t)]; u_int32_t lengthlo; char lengthlo_r_[PADR_(u_int32_t)];
+ #else
char lengthlo_l_[PADL_(u_int32_t)]; u_int32_t lengthlo; char lengthlo_r_[PADR_(u_int32_t)];
char lengthhi_l_[PADL_(u_int32_t)]; u_int32_t lengthhi; char lengthhi_r_[PADR_(u_int32_t)];
+ #endif
};
int freebsd6_freebsd32_pread(struct thread *, struct freebsd6_freebsd32_pread_args *);
int freebsd6_freebsd32_pwrite(struct thread *, struct freebsd6_freebsd32_pwrite_args *);
More information about the svn-src-projects
mailing list