Commit 11d4e57c authored by Anton Blanchard's avatar Anton Blanchard

initial ppc64 compat support from Stephen Rothwell

parent 580f6887
...@@ -33,6 +33,10 @@ config EARLY_PRINTK ...@@ -33,6 +33,10 @@ config EARLY_PRINTK
bool bool
default y default y
config COMPAT
bool
default y
source "init/Kconfig" source "init/Kconfig"
......
...@@ -21,11 +21,7 @@ ...@@ -21,11 +21,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/config.h> #include <linux/config.h>
#include <linux/elfcore.h> #include <linux/elfcore.h>
#include <linux/compat.h>
struct timeval32
{
int tv_sec, tv_usec;
};
#define elf_prstatus elf_prstatus32 #define elf_prstatus elf_prstatus32
struct elf_prstatus32 struct elf_prstatus32
...@@ -38,10 +34,10 @@ struct elf_prstatus32 ...@@ -38,10 +34,10 @@ struct elf_prstatus32
pid_t pr_ppid; pid_t pr_ppid;
pid_t pr_pgrp; pid_t pr_pgrp;
pid_t pr_sid; pid_t pr_sid;
struct timeval32 pr_utime; /* User time */ struct compat_timeval pr_utime; /* User time */
struct timeval32 pr_stime; /* System time */ struct compat_timeval pr_stime; /* System time */
struct timeval32 pr_cutime; /* Cumulative user time */ struct compat_timeval pr_cutime; /* Cumulative user time */
struct timeval32 pr_cstime; /* Cumulative system time */ struct compat_timeval pr_cstime; /* Cumulative system time */
elf_gregset_t pr_reg; /* General purpose registers. */ elf_gregset_t pr_reg; /* General purpose registers. */
int pr_fpvalid; /* True if math co-processor being used. */ int pr_fpvalid; /* True if math co-processor being used. */
}; };
...@@ -64,9 +60,9 @@ struct elf_prpsinfo32 ...@@ -64,9 +60,9 @@ struct elf_prpsinfo32
#include <linux/time.h> #include <linux/time.h>
#define jiffies_to_timeval jiffies_to_timeval32 #define jiffies_to_timeval jiffies_to_compat_timeval
static __inline__ void 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_usec = (jiffies % HZ) * (1000000L / HZ);
value->tv_sec = jiffies / HZ; value->tv_sec = jiffies / HZ;
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/config.h> #include <linux/config.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/compat.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/smp.h> #include <linux/smp.h>
...@@ -397,14 +398,9 @@ static int do_video_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) ...@@ -397,14 +398,9 @@ static int do_video_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
return err; return err;
} }
struct timeval32 {
int tv_sec;
int tv_usec;
};
static int do_siocgstamp(unsigned int fd, unsigned int cmd, unsigned long arg) 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; struct timeval ktv;
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
int err; int err;
...@@ -1424,8 +1420,8 @@ struct ppp_option_data32 { ...@@ -1424,8 +1420,8 @@ struct ppp_option_data32 {
#define PPPIOCSCOMPRESS32 _IOW('t', 77, struct ppp_option_data32) #define PPPIOCSCOMPRESS32 _IOW('t', 77, struct ppp_option_data32)
struct ppp_idle32 { struct ppp_idle32 {
__kernel_time_t32 xmit_idle; compat_time_t xmit_idle;
__kernel_time_t32 recv_idle; compat_time_t recv_idle;
}; };
#define PPPIOCGIDLE32 _IOR('t', 63, struct ppp_idle32) #define PPPIOCGIDLE32 _IOR('t', 63, struct ppp_idle32)
......
...@@ -538,7 +538,7 @@ _GLOBAL(sys_call_table32) ...@@ -538,7 +538,7 @@ _GLOBAL(sys_call_table32)
.llong .sys_alarm .llong .sys_alarm
.llong .sys_ni_syscall /* old fstat syscall */ .llong .sys_ni_syscall /* old fstat syscall */
.llong .sys32_pause .llong .sys32_pause
.llong .sys32_utime /* 30 */ .llong .compat_sys_utime /* 30 */
.llong .sys_ni_syscall /* old stty syscall */ .llong .sys_ni_syscall /* old stty syscall */
.llong .sys_ni_syscall /* old gtty syscall */ .llong .sys_ni_syscall /* old gtty syscall */
.llong .sys32_access .llong .sys32_access
...@@ -612,8 +612,8 @@ _GLOBAL(sys_call_table32) ...@@ -612,8 +612,8 @@ _GLOBAL(sys_call_table32)
.llong .sys_ioperm .llong .sys_ioperm
.llong .sys32_socketcall .llong .sys32_socketcall
.llong .sys32_syslog .llong .sys32_syslog
.llong .sys32_setitimer .llong .compat_sys_setitimer
.llong .sys32_getitimer /* 105 */ .llong .compat_sys_getitimer /* 105 */
.llong .sys32_newstat .llong .sys32_newstat
.llong .sys32_newlstat .llong .sys32_newlstat
.llong .sys32_newfstat .llong .sys32_newfstat
...@@ -670,7 +670,7 @@ _GLOBAL(sys_call_table32) ...@@ -670,7 +670,7 @@ _GLOBAL(sys_call_table32)
.llong .sys32_sched_get_priority_max .llong .sys32_sched_get_priority_max
.llong .sys32_sched_get_priority_min /* 160 */ .llong .sys32_sched_get_priority_min /* 160 */
.llong .sys32_sched_rr_get_interval .llong .sys32_sched_rr_get_interval
.llong .sys32_nanosleep .llong .compat_sys_nanosleep
.llong .sys32_mremap .llong .sys32_mremap
.llong .sys_setresuid .llong .sys_setresuid
.llong .sys_getresuid /* 165 */ .llong .sys_getresuid /* 165 */
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/signal.h> #include <linux/signal.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/elf.h> #include <linux/elf.h>
#include <linux/compat.h>
#include <asm/ppc32.h> #include <asm/ppc32.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/ppcdebug.h> #include <asm/ppcdebug.h>
...@@ -53,11 +54,6 @@ ...@@ -53,11 +54,6 @@
#define MSR_USERCHANGE 0 #define MSR_USERCHANGE 0
#endif #endif
struct timespec32 {
s32 tv_sec;
s32 tv_nsec;
};
struct sigregs32 { struct sigregs32 {
/* /*
* the gp_regs array is 32 bit representation of the pt_regs * the gp_regs array is 32 bit representation of the pt_regs
...@@ -635,8 +631,7 @@ long sys32_rt_sigprocmask(u32 how, sigset32_t *set, ...@@ -635,8 +631,7 @@ long sys32_rt_sigprocmask(u32 how, sigset32_t *set,
extern long sys_rt_sigpending(sigset_t *set, size_t sigsetsize); extern long sys_rt_sigpending(sigset_t *set, size_t sigsetsize);
long sys32_rt_sigpending(sigset32_t *set, long sys32_rt_sigpending(sigset32_t *set, compat_size_t sigsetsize)
__kernel_size_t32 sigsetsize)
{ {
sigset_t s; sigset_t s;
sigset32_t s32; sigset32_t s32;
...@@ -708,7 +703,7 @@ extern long sys_rt_sigtimedwait(const sigset_t *uthese, ...@@ -708,7 +703,7 @@ extern long sys_rt_sigtimedwait(const sigset_t *uthese,
size_t sigsetsize); size_t sigsetsize);
long sys32_rt_sigtimedwait(sigset32_t *uthese, siginfo_t32 *uinfo, long sys32_rt_sigtimedwait(sigset32_t *uthese, siginfo_t32 *uinfo,
struct timespec32 *uts, __kernel_size_t32 sigsetsize) struct compat_timespec *uts, compat_size_t sigsetsize)
{ {
sigset_t s; sigset_t s;
sigset32_t s32; sigset32_t s32;
......
...@@ -134,7 +134,7 @@ _STATIC(do_sys_recv) /* sys_recv(int, void *, size_t, unsigned int) */ ...@@ -134,7 +134,7 @@ _STATIC(do_sys_recv) /* sys_recv(int, void *, size_t, unsigned int) */
lwz r6,12(r10) lwz r6,12(r10)
b .sys_recv b .sys_recv
_STATIC(do_sys_sendto) /* sys32_sendto(int, u32, __kernel_size_t32, unsigned int, u32, int) */ _STATIC(do_sys_sendto) /* sys32_sendto(int, u32, compat_size_t, unsigned int, u32, int) */
mr r10,r4 mr r10,r4
lwa r3,0(r10) lwa r3,0(r10)
lwz r4,4(r10) lwz r4,4(r10)
...@@ -144,7 +144,7 @@ _STATIC(do_sys_sendto) /* sys32_sendto(int, u32, __kernel_size_t32, unsigned int ...@@ -144,7 +144,7 @@ _STATIC(do_sys_sendto) /* sys32_sendto(int, u32, __kernel_size_t32, unsigned int
lwa r8,20(r10) lwa r8,20(r10)
b .sys32_sendto b .sys32_sendto
_STATIC(do_sys_recvfrom) /* sys32_recvfrom(int, u32, __kernel_size_t32, unsigned int, u32, u32) */ _STATIC(do_sys_recvfrom) /* sys32_recvfrom(int, u32, compat_size_t, unsigned int, u32, u32) */
mr r10,r4 mr r10,r4
lwa r3,0(r10) lwa r3,0(r10)
lwz r4,4(r10) lwz r4,4(r10)
......
This diff is collapsed.
#ifndef _ASM_PPC64_COMPAT_H
#define _ASM_PPC64_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_PPC64_COMPAT_H */
#ifndef _PPC64_PPC32_H #ifndef _PPC64_PPC32_H
#define _PPC64_PPC32_H #define _PPC64_PPC32_H
#include <linux/compat.h>
#include <asm/siginfo.h> #include <asm/siginfo.h>
#include <asm/signal.h> #include <asm/signal.h>
...@@ -43,10 +44,7 @@ typedef __kernel_fsid_t __kernel_fsid_t32; ...@@ -43,10 +44,7 @@ typedef __kernel_fsid_t __kernel_fsid_t32;
}) })
/* These are here to support 32-bit syscalls on a 64-bit kernel. */ /* These are here to support 32-bit syscalls on a 64-bit kernel. */
typedef unsigned int __kernel_size_t32;
typedef int __kernel_ssize_t32;
typedef int __kernel_ptrdiff_t32; typedef int __kernel_ptrdiff_t32;
typedef int __kernel_time_t32;
typedef int __kernel_clock_t32; typedef int __kernel_clock_t32;
typedef int __kernel_pid_t32; typedef int __kernel_pid_t32;
typedef unsigned short __kernel_ipc_pid_t32; typedef unsigned short __kernel_ipc_pid_t32;
...@@ -160,7 +158,7 @@ struct sigaction32 { ...@@ -160,7 +158,7 @@ struct sigaction32 {
typedef struct sigaltstack_32 { typedef struct sigaltstack_32 {
unsigned int ss_sp; unsigned int ss_sp;
int ss_flags; int ss_flags;
__kernel_size_t32 ss_size; compat_size_t ss_size;
} stack_32_t; } stack_32_t;
struct flock32 { struct flock32 {
...@@ -183,11 +181,11 @@ struct stat32 { ...@@ -183,11 +181,11 @@ struct stat32 {
__kernel_off_t32 st_size; /* 4 */ __kernel_off_t32 st_size; /* 4 */
__kernel_off_t32 st_blksize; /* 4 */ __kernel_off_t32 st_blksize; /* 4 */
__kernel_off_t32 st_blocks; /* 4 */ __kernel_off_t32 st_blocks; /* 4 */
__kernel_time_t32 st_atime; /* 4 */ compat_time_t st_atime; /* 4 */
unsigned int __unused1; /* 4 */ unsigned int __unused1; /* 4 */
__kernel_time_t32 st_mtime; /* 4 */ compat_time_t st_mtime; /* 4 */
unsigned int __unused2; /* 4 */ unsigned int __unused2; /* 4 */
__kernel_time_t32 st_ctime; /* 4 */ compat_time_t st_ctime; /* 4 */
unsigned int __unused3; /* 4 */ unsigned int __unused3; /* 4 */
unsigned int __unused4[2]; /* 2*4 */ unsigned int __unused4[2]; /* 2*4 */
}; };
......
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