1 #ifndef _PPC64_PPC32_H
2 #define _PPC64_PPC32_H
3 
4 #include <linux/compat.h>
5 #include <asm/siginfo.h>
6 #include <asm/signal.h>
7 
8 /*
9  * Data types and macros for providing 32b PowerPC support.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version
14  * 2 of the License, or (at your option) any later version.
15  */
16 
17 /* These are here to support 32-bit syscalls on a 64-bit kernel. */
18 
19 typedef struct compat_siginfo {
20 	int si_signo;
21 	int si_errno;
22 	int si_code;
23 
24 	union {
25 		int _pad[SI_PAD_SIZE32];
26 
27 		/* kill() */
28 		struct {
29 			compat_pid_t _pid;		/* sender's pid */
30 			compat_uid_t _uid;		/* sender's uid */
31 		} _kill;
32 
33 		/* POSIX.1b timers */
34 		struct {
35 			compat_timer_t _tid;			/* timer id */
36 			int _overrun;			/* overrun count */
37 			compat_sigval_t _sigval;		/* same as below */
38 			int _sys_private;		/* not to be passed to user */
39 		} _timer;
40 
41 		/* POSIX.1b signals */
42 		struct {
43 			compat_pid_t _pid;		/* sender's pid */
44 			compat_uid_t _uid;		/* sender's uid */
45 			compat_sigval_t _sigval;
46 		} _rt;
47 
48 		/* SIGCHLD */
49 		struct {
50 			compat_pid_t _pid;		/* which child */
51 			compat_uid_t _uid;		/* sender's uid */
52 			int _status;			/* exit code */
53 			compat_clock_t _utime;
54 			compat_clock_t _stime;
55 		} _sigchld;
56 
57 		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */
58 		struct {
59 			unsigned int _addr; /* faulting insn/memory ref. */
60 		} _sigfault;
61 
62 		/* SIGPOLL */
63 		struct {
64 			int _band;	/* POLL_IN, POLL_OUT, POLL_MSG */
65 			int _fd;
66 		} _sigpoll;
67 	} _sifields;
68 } compat_siginfo_t;
69 
70 #define __old_sigaction32	old_sigaction32
71 
72 struct __old_sigaction32 {
73 	compat_uptr_t		sa_handler;
74 	compat_old_sigset_t  	sa_mask;
75 	unsigned int    	sa_flags;
76 	compat_uptr_t		sa_restorer;     /* not used by Linux/SPARC yet */
77 };
78 
79 
80 
81 struct sigaction32 {
82        compat_uptr_t  sa_handler;	/* Really a pointer, but need to deal with 32 bits */
83        unsigned int sa_flags;
84        compat_uptr_t sa_restorer;	/* Another 32 bit pointer */
85        compat_sigset_t sa_mask;		/* A 32 bit mask */
86 };
87 
88 typedef struct sigaltstack_32 {
89 	unsigned int ss_sp;
90 	int ss_flags;
91 	compat_size_t ss_size;
92 } stack_32_t;
93 
94 struct pt_regs32 {
95 	unsigned int gpr[32];
96 	unsigned int nip;
97 	unsigned int msr;
98 	unsigned int orig_gpr3;		/* Used for restarting system calls */
99 	unsigned int ctr;
100 	unsigned int link;
101 	unsigned int xer;
102 	unsigned int ccr;
103 	unsigned int mq;		/* 601 only (not used at present) */
104 	unsigned int trap;		/* Reason for being here */
105 	unsigned int dar;		/* Fault registers */
106 	unsigned int dsisr;
107 	unsigned int result;		/* Result of a system call */
108 };
109 
110 struct sigcontext32 {
111 	unsigned int	_unused[4];
112 	int		signal;
113 	compat_uptr_t	handler;
114 	unsigned int	oldmask;
115 	compat_uptr_t	regs;  /* 4 byte pointer to the pt_regs32 structure. */
116 };
117 
118 struct mcontext32 {
119 	elf_gregset_t32		mc_gregs;
120 	elf_fpregset_t		mc_fregs;
121 	unsigned int		mc_pad[2];
122 	elf_vrregset_t32	mc_vregs __attribute__((__aligned__(16)));
123 	elf_vsrreghalf_t32      mc_vsregs __attribute__((__aligned__(16)));
124 };
125 
126 struct ucontext32 {
127 	unsigned int	  	uc_flags;
128 	unsigned int 	  	uc_link;
129 	stack_32_t	 	uc_stack;
130 	int		 	uc_pad[7];
131 	compat_uptr_t		uc_regs;	/* points to uc_mcontext field */
132 	compat_sigset_t	 	uc_sigmask;	/* mask last for extensibility */
133 	/* glibc has 1024-bit signal masks, ours are 64-bit */
134 	int		 	uc_maskext[30];
135 	int		 	uc_pad2[3];
136 	struct mcontext32	uc_mcontext;
137 };
138 
139 #endif  /* _PPC64_PPC32_H */
140