Commit 9e3e77d5 authored by Stephen Rothwell's avatar Stephen Rothwell Committed by David S. Miller

[SPARC64]: Add initial compat layer stuff.

parent 0390cb6c
......@@ -352,6 +352,11 @@ config SPARC32_COMPAT
This allows you to run 32-bit binaries on your Ultra.
Everybody wants this; say Y.
config COMPAT
bool
depends on SPARC32_COMPAT
default y
config BINFMT_ELF32
tristate "Kernel support for 32-bit ELF binaries"
depends on SPARC32_COMPAT
......
......@@ -86,11 +86,7 @@ typedef struct {
#include <linux/module.h>
#include <linux/config.h>
#include <linux/elfcore.h>
struct timeval32
{
int tv_sec, tv_usec;
};
#include <linux/compat.h>
#define elf_prstatus elf_prstatus32
struct elf_prstatus32
......@@ -103,10 +99,10 @@ struct elf_prstatus32
pid_t pr_ppid;
pid_t pr_pgrp;
pid_t pr_sid;
struct timeval32 pr_utime; /* User time */
struct timeval32 pr_stime; /* System time */
struct timeval32 pr_cutime; /* Cumulative user time */
struct timeval32 pr_cstime; /* Cumulative system time */
struct compat_timeval pr_utime; /* User time */
struct compat_timeval pr_stime; /* System time */
struct compat_timeval pr_cutime; /* Cumulative user time */
struct compat_timeval pr_cstime; /* Cumulative system time */
elf_gregset_t pr_reg; /* GP registers */
int pr_fpvalid; /* True if math co-processor being used. */
};
......@@ -136,9 +132,9 @@ struct elf_prpsinfo32
#include <linux/time.h>
#define jiffies_to_timeval jiffies_to_timeval32
#define jiffies_to_timeval jiffies_to_compat_timeval
static __inline__ void
jiffies_to_timeval32(unsigned long jiffies, struct timeval32 *value)
jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value)
{
value->tv_usec = (jiffies % HZ) * (1000000L / HZ);
value->tv_sec = jiffies / HZ;
......
......@@ -10,6 +10,7 @@
#include <linux/config.h>
#include <linux/types.h>
#include <linux/compat.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/smp.h>
......@@ -405,14 +406,9 @@ static int do_video_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
return err;
}
struct timeval32 {
int tv_sec;
int tv_usec;
};
static int do_siocgstamp(unsigned int fd, unsigned int cmd, unsigned long arg)
{
struct timeval32 *up = (struct timeval32 *)arg;
struct compat_timeval *up = (struct compat_timeval *)arg;
struct timeval ktv;
mm_segment_t old_fs = get_fs();
int err;
......@@ -1743,8 +1739,8 @@ struct ppp_option_data32 {
#define PPPIOCSCOMPRESS32 _IOW('t', 77, struct ppp_option_data32)
struct ppp_idle32 {
__kernel_time_t32 xmit_idle;
__kernel_time_t32 recv_idle;
compat_time_t xmit_idle;
compat_time_t recv_idle;
};
#define PPPIOCGIDLE32 _IOR('t', 63, struct ppp_idle32)
......
......@@ -19,6 +19,7 @@
#include <linux/tty.h>
#include <linux/smp_lock.h>
#include <linux/binfmts.h>
#include <linux/compat.h>
#include <asm/uaccess.h>
#include <asm/bitops.h>
......@@ -181,7 +182,7 @@ asmlinkage void do_rt_sigsuspend32(u32 uset, size_t sigsetsize, struct pt_regs *
sigset_t32 set32;
/* XXX: Don't preclude handling different sized sigset_t's. */
if (((__kernel_size_t32)sigsetsize) != sizeof(sigset_t)) {
if (((compat_size_t)sigsetsize) != sizeof(sigset_t)) {
regs->tstate |= TSTATE_ICARRY;
regs->u_regs[UREG_I0] = EINVAL;
return;
......
......@@ -175,7 +175,7 @@ do_sys_recv: /* sys_recv(int, void *, size_t, unsigned int) */
lduwa [%o1 + 0x4] %asi, %o1
nop
nop
do_sys_sendto: /* sys32_sendto(int, u32, __kernel_size_t32, unsigned int, u32, int) */
do_sys_sendto: /* sys32_sendto(int, u32, compat_size_t, unsigned int, u32, int) */
ldswa [%o1 + 0x0] %asi, %o0
sethi %hi(sys32_sendto), %g1
lduwa [%o1 + 0x8] %asi, %o2
......@@ -184,7 +184,7 @@ do_sys_sendto: /* sys32_sendto(int, u32, __kernel_size_t32, unsigned int, u32, i
ldswa [%o1 + 0x14] %asi, %o5
jmpl %g1 + %lo(sys32_sendto), %g0
lduwa [%o1 + 0x4] %asi, %o1
do_sys_recvfrom: /* sys32_recvfrom(int, u32, __kernel_size_t32, unsigned int, u32, u32) */
do_sys_recvfrom: /* sys32_recvfrom(int, u32, compat_size_t, unsigned int, u32, u32) */
ldswa [%o1 + 0x0] %asi, %o0
sethi %hi(sys32_recvfrom), %g1
lduwa [%o1 + 0x8] %asi, %o2
......
This diff is collapsed.
......@@ -12,6 +12,7 @@
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/types.h>
#include <linux/compat.h>
#include <linux/mman.h>
#include <linux/mm.h>
#include <linux/swap.h>
......@@ -528,11 +529,6 @@ asmlinkage int sunos_pathconf(u32 u_path, int name)
extern asmlinkage int
sys32_select(int n, u32 inp, u32 outp, u32 exp, u32 tvp);
struct timeval32
{
int tv_sec, tv_usec;
};
asmlinkage int sunos_select(int width, u32 inp, u32 outp, u32 exp, u32 tvp_x)
{
int ret;
......@@ -540,7 +536,7 @@ asmlinkage int sunos_select(int width, u32 inp, u32 outp, u32 exp, u32 tvp_x)
/* SunOS binaries expect that select won't change the tvp contents */
ret = sys32_select (width, inp, outp, exp, tvp_x);
if (ret == -EINTR && tvp_x) {
struct timeval32 *tvp = (struct timeval32 *)A(tvp_x);
struct compat_timeval *tvp = (struct compat_timeval *)A(tvp_x);
time_t sec, usec;
__get_user(sec, &tvp->tv_sec);
......@@ -948,9 +944,9 @@ struct msqid_ds32
struct ipc_perm32 msg_perm;
u32 msg_first;
u32 msg_last;
__kernel_time_t32 msg_stime;
__kernel_time_t32 msg_rtime;
__kernel_time_t32 msg_ctime;
compat_time_t msg_stime;
compat_time_t msg_rtime;
compat_time_t msg_ctime;
u32 wwait;
u32 rwait;
unsigned short msg_cbytes;
......@@ -1085,9 +1081,9 @@ asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
struct shmid_ds32 {
struct ipc_perm32 shm_perm;
int shm_segsz;
__kernel_time_t32 shm_atime;
__kernel_time_t32 shm_dtime;
__kernel_time_t32 shm_ctime;
compat_time_t shm_atime;
compat_time_t shm_dtime;
compat_time_t shm_ctime;
__kernel_ipc_pid_t32 shm_cpid;
__kernel_ipc_pid_t32 shm_lpid;
unsigned short shm_nattch;
......
......@@ -25,7 +25,7 @@ sys_call_table32:
/*15*/ .word sys32_chmod, sys32_lchown16, sparc_brk, sys_perfctr, sys32_lseek
/*20*/ .word sys_getpid, sys_capget, sys_capset, sys32_setuid16, sys32_getuid16
/*25*/ .word sys_time, sys_ptrace, sys_alarm, sys32_sigaltstack, sys32_pause
/*30*/ .word sys32_utime, sys_lchown, sys_fchown, sys_access, sys_nice
/*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice
.word sys_chown, sys_sync, sys_kill, sys32_newstat, sys32_sendfile
/*40*/ .word sys32_newlstat, sys_dup, sys_pipe, sys32_times, sys_getuid
.word sys_umount, sys32_setgid16, sys32_getgid16, sys_signal, sys32_geteuid16
......@@ -35,8 +35,8 @@ sys_call_table32:
.word sys_msync, sys_vfork, sys32_pread64, sys32_pwrite64, sys_geteuid
/*70*/ .word sys_getegid, sys32_mmap, sys_setreuid, sys_munmap, sys_mprotect
.word sys_madvise, sys_vhangup, sys32_truncate64, sys_mincore, sys32_getgroups16
/*80*/ .word sys32_setgroups16, sys_getpgrp, sys_setgroups, sys32_setitimer, sys32_ftruncate64
.word sys_swapon, sys32_getitimer, sys_setuid, sys_sethostname, sys_setgid
/*80*/ .word sys32_setgroups16, sys_getpgrp, sys_setgroups, compat_sys_setitimer, sys32_ftruncate64
.word sys_swapon, compat_sys_getitimer, sys_setuid, sys_sethostname, sys_setgid
/*90*/ .word sys_dup2, sys_setfsuid, sys32_fcntl, sys32_select, sys_setfsgid
.word sys_fsync, sys_setpriority32, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall
/*100*/ .word sys_getpriority, sys32_rt_sigreturn, sys32_rt_sigaction, sys32_rt_sigprocmask, sys32_rt_sigpending
......@@ -68,7 +68,7 @@ sys_call_table32:
/*230*/ .word sys32_select, sys_time, sys_nis_syscall, sys_stime, sys_alloc_hugepages
.word sys_free_hugepages, sys_llseek, sys_mlock, sys_munlock, sys_mlockall
/*240*/ .word sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler
.word sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, sys32_sched_rr_get_interval, sys32_nanosleep
.word sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, sys32_sched_rr_get_interval, compat_sys_nanosleep
/*250*/ .word sys32_mremap, sys32_sysctl, sys_getsid, sys_fdatasync, sys32_nfsservctl
.word sys_aplib
......@@ -166,8 +166,8 @@ sunos_sys_table:
.word sys_mprotect, sys_madvise, sys_vhangup
.word sunos_nosys, sys_mincore, sys32_getgroups16
.word sys32_setgroups16, sys_getpgrp, sunos_setpgrp
.word sys32_setitimer, sunos_nosys, sys_swapon
.word sys32_getitimer, sys_gethostname, sys_sethostname
.word compat_sys_setitimer, sunos_nosys, sys_swapon
.word compat_sys_getitimer, sys_gethostname, sys_sethostname
.word sunos_getdtablesize, sys_dup2, sunos_nop
.word sys32_fcntl, sunos_select, sunos_nop
.word sys_fsync, sys_setpriority32, sunos_socket
......
......@@ -16,6 +16,7 @@
#include <linux/file.h>
#include <linux/timex.h>
#include <linux/major.h>
#include <linux/compat.h>
#include <asm/uaccess.h>
#include <asm/string.h>
......@@ -597,12 +598,8 @@ asmlinkage int solaris_setrlimit64(unsigned int resource, struct rlimit *rlim)
return ret;
}
struct timeval32 {
int tv_sec, tv_usec;
};
struct sol_ntptimeval {
struct timeval32 time;
struct compat_timeval time;
s32 maxerror;
s32 esterror;
};
......
......@@ -14,6 +14,7 @@
#include <linux/socket.h>
#include <linux/file.h>
#include <linux/net.h>
#include <linux/compat.h>
#include <asm/uaccess.h>
#include <asm/string.h>
......@@ -378,7 +379,7 @@ asmlinkage int solaris_sendmsg(int fd, struct sol_nmsghdr *user_msg, unsigned us
if(kern_msg.msg_controllen) {
struct sol_cmsghdr *ucmsg = (struct sol_cmsghdr *)kern_msg.msg_control;
unsigned long *kcmsg;
__kernel_size_t32 cmlen;
compat_size_t cmlen;
if(kern_msg.msg_controllen > sizeof(ctl) &&
kern_msg.msg_controllen <= 256) {
......@@ -392,7 +393,7 @@ asmlinkage int solaris_sendmsg(int fd, struct sol_nmsghdr *user_msg, unsigned us
*kcmsg++ = (unsigned long)cmlen;
err = -EFAULT;
if(copy_from_user(kcmsg, &ucmsg->cmsg_level,
kern_msg.msg_controllen - sizeof(__kernel_size_t32)))
kern_msg.msg_controllen - sizeof(compat_size_t)))
goto out_freectl;
kern_msg.msg_control = ctl_buf;
}
......
#ifndef _ASM_SPARC64_COMPAT_H
#define _ASM_SPARC64_COMPAT_H
/*
* Architecture specific compatibility types
*/
#include <linux/types.h>
typedef u32 compat_size_t;
typedef s32 compat_ssize_t;
typedef s32 compat_time_t;
struct compat_timespec {
compat_time_t tv_sec;
s32 tv_nsec;
};
struct compat_timeval {
compat_time_t tv_sec;
s32 tv_usec;
};
#endif /* _ASM_SPARC64_COMPAT_H */
......@@ -48,10 +48,7 @@ typedef struct {
} __kernel_fsid_t;
/* Now 32bit compatibility types */
typedef unsigned int __kernel_size_t32;
typedef int __kernel_ssize_t32;
typedef int __kernel_ptrdiff_t32;
typedef int __kernel_time_t32;
typedef int __kernel_clock_t32;
typedef int __kernel_pid_t32;
typedef unsigned short __kernel_ipc_pid_t32;
......
......@@ -8,6 +8,7 @@
#ifndef __ASSEMBLY__
#include <linux/personality.h>
#include <linux/types.h>
#include <linux/compat.h>
#endif
#endif
......@@ -250,7 +251,7 @@ typedef struct sigaltstack {
typedef struct sigaltstack32 {
u32 ss_sp;
int ss_flags;
__kernel_size_t32 ss_size;
compat_size_t ss_size;
} stack_t32;
#define HAVE_ARCH_GET_SIGNAL_TO_DELIVER
......
......@@ -3,6 +3,7 @@
#define _SPARC64_STAT_H
#include <linux/types.h>
#include <linux/compat.h>
#include <linux/time.h>
struct stat32 {
......@@ -14,11 +15,11 @@ struct stat32 {
__kernel_gid_t32 st_gid;
__kernel_dev_t32 st_rdev;
__kernel_off_t32 st_size;
__kernel_time_t32 st_atime;
compat_time_t st_atime;
unsigned int __unused1;
__kernel_time_t32 st_mtime;
compat_time_t st_mtime;
unsigned int __unused2;
__kernel_time_t32 st_ctime;
compat_time_t st_ctime;
unsigned int __unused3;
__kernel_off_t32 st_blksize;
__kernel_off_t32 st_blocks;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment