]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - arch/sparc64/kernel/binfmt_elf32.c
2 * binfmt_elf32.c: Support 32-bit Sparc ELF binaries on Ultra.
4 * Copyright (C) 1995, 1996, 1997, 1998, 2008 David S. Miller (davem@davemloft.net)
5 * Copyright (C) 1995, 1996, 1997, 1998 Jakub Jelinek (jj@ultra.linux.cz)
8 #define ELF_ARCH EM_SPARC
9 #define ELF_CLASS ELFCLASS32
10 #define ELF_DATA ELFDATA2MSB;
17 * PSR, PC, nPC, Y, WIM, TBR
19 typedef unsigned int elf_greg_t
;
21 typedef elf_greg_t elf_gregset_t
[ELF_NGREG
];
25 unsigned int pr_regs
[32];
26 unsigned long pr_dregs
[16];
28 unsigned int __unused
;
30 unsigned char pr_qcnt
;
31 unsigned char pr_q_entrysize
;
33 unsigned int pr_q
[64];
36 /* UltraSparc extensions. Still unused, but will be eventually. */
39 unsigned int pr_align
;
43 unsigned int pr_regs
[32];
44 unsigned long pr_dregs
[16];
45 long double pr_qregs
[8];
50 unsigned int pr_xg
[8];
51 unsigned int pr_xo
[8];
52 unsigned long pr_tstate
;
53 unsigned int pr_filler
[8];
57 #define elf_check_arch(x) (((x)->e_machine == EM_SPARC) || ((x)->e_machine == EM_SPARC32PLUS))
59 #define ELF_ET_DYN_BASE 0x70000000
62 #include <asm/processor.h>
63 #include <linux/module.h>
64 #include <linux/elfcore.h>
65 #include <linux/compat.h>
67 #define elf_prstatus elf_prstatus32
70 struct elf_siginfo pr_info
; /* Info associated with signal */
71 short pr_cursig
; /* Current signal */
72 unsigned int pr_sigpend
; /* Set of pending signals */
73 unsigned int pr_sighold
; /* Set of held signals */
78 struct compat_timeval pr_utime
; /* User time */
79 struct compat_timeval pr_stime
; /* System time */
80 struct compat_timeval pr_cutime
; /* Cumulative user time */
81 struct compat_timeval pr_cstime
; /* Cumulative system time */
82 elf_gregset_t pr_reg
; /* GP registers */
83 int pr_fpvalid
; /* True if math co-processor being used. */
86 #define elf_prpsinfo elf_prpsinfo32
89 char pr_state
; /* numeric process state */
90 char pr_sname
; /* char for pr_state */
91 char pr_zomb
; /* zombie */
92 char pr_nice
; /* nice val */
93 unsigned int pr_flag
; /* flags */
96 pid_t pr_pid
, pr_ppid
, pr_pgrp
, pr_sid
;
98 char pr_fname
[16]; /* filename of executable */
99 char pr_psargs
[ELF_PRARGSZ
]; /* initial part of arg list */
102 #include <linux/highuid.h>
104 #undef NEW_TO_OLD_UID
105 #undef NEW_TO_OLD_GID
106 #define NEW_TO_OLD_UID(uid) ((uid) > 65535) ? (u16)overflowuid : (u16)(uid)
107 #define NEW_TO_OLD_GID(gid) ((gid) > 65535) ? (u16)overflowgid : (u16)(gid)
109 #include <linux/time.h>
111 #undef cputime_to_timeval
112 #define cputime_to_timeval cputime_to_compat_timeval
114 cputime_to_compat_timeval(const cputime_t cputime
, struct compat_timeval
*value
)
116 unsigned long jiffies
= cputime_to_jiffies(cputime
);
117 value
->tv_usec
= (jiffies
% HZ
) * (1000000L / HZ
);
118 value
->tv_sec
= jiffies
/ HZ
;
122 #define start_thread start_thread32
123 #define init_elf_binfmt init_elf32_binfmt
125 MODULE_DESCRIPTION("Binary format loader for compatibility with 32bit SparcLinux binaries on the Ultra");
126 MODULE_AUTHOR("Eric Youngdale, David S. Miller, Jakub Jelinek");
128 #undef MODULE_DESCRIPTION
131 #include <asm/a.out.h>
134 #define TASK_SIZE STACK_TOP32
136 #include "../../../fs/binfmt_elf.c"