This source file includes following definitions.
- svr4_copyargs
- svr4_elf_probe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 #include <sys/param.h>
32 #include <sys/systm.h>
33 #include <sys/kernel.h>
34 #include <sys/proc.h>
35 #include <sys/malloc.h>
36 #include <sys/namei.h>
37 #include <sys/vnode.h>
38 #include <sys/exec.h>
39 #include <sys/exec_elf.h>
40 #include <sys/exec_olf.h>
41
42 #include <sys/mman.h>
43 #include <uvm/uvm_extern.h>
44
45 #include <machine/cpu.h>
46 #include <machine/reg.h>
47 #include <machine/svr4_machdep.h>
48
49 #include <compat/svr4/svr4_util.h>
50 #include <compat/svr4/svr4_syscall.h>
51 #include <compat/svr4/svr4_exec.h>
52 #include <compat/svr4/svr4_errno.h>
53
54 static void *svr4_copyargs(struct exec_package *, struct ps_strings *,
55 void *, void *);
56
57 const char svr4_emul_path[] = "/emul/svr4";
58 extern char svr4_sigcode[], svr4_esigcode[];
59 extern struct sysent svr4_sysent[];
60 #ifdef SYSCALL_DEBUG
61 extern char *svr4_syscallnames[];
62 #endif
63
64 struct emul emul_svr4 = {
65 "svr4",
66 native_to_svr4_errno,
67 svr4_sendsig,
68 SVR4_SYS_syscall,
69 SVR4_SYS_MAXSYSCALL,
70 svr4_sysent,
71 #ifdef SYSCALL_DEBUG
72 svr4_syscallnames,
73 #else
74 NULL,
75 #endif
76 SVR4_AUX_ARGSIZ,
77 svr4_copyargs,
78 setregs,
79 exec_elf32_fixup,
80 svr4_sigcode,
81 svr4_esigcode,
82 };
83
84 static void *
85 svr4_copyargs(pack, arginfo, stack, argp)
86 struct exec_package *pack;
87 struct ps_strings *arginfo;
88 void *stack;
89 void *argp;
90 {
91 AuxInfo *a;
92
93 if (!(a = (AuxInfo *)elf32_copyargs(pack, arginfo, stack, argp)))
94 return (NULL);
95 #ifdef SVR4_COMPAT_SOLARIS2
96 if (pack->ep_emul_arg) {
97 a->au_id = AUX_sun_uid;
98 a->au_v = p->p_ucred->cr_uid;
99 a++;
100
101 a->au_id = AUX_sun_ruid;
102 a->au_v = p->p_cred->ruid;
103 a++;
104
105 a->au_id = AUX_sun_gid;
106 a->au_v = p->p_ucred->cr_gid;
107 a++;
108
109 a->au_id = AUX_sun_rgid;
110 a->au_v = p->p_cred->rgid;
111 a++;
112 }
113 #endif
114 return (a);
115 }
116
117 int
118 svr4_elf_probe(p, epp, itp, pos, os)
119 struct proc *p;
120 struct exec_package *epp;
121 char *itp;
122 u_long *pos;
123 u_int8_t *os;
124 {
125 char *bp;
126 int error;
127 size_t len;
128
129 if (itp) {
130 if ((error = emul_find(p, NULL, svr4_emul_path, itp, &bp, 0)))
131 return (error);
132 if ((error = copystr(bp, itp, MAXPATHLEN, &len)))
133 return (error);
134 free(bp, M_TEMP);
135 }
136 epp->ep_emul = &emul_svr4;
137 *pos = SVR4_INTERP_ADDR;
138 if (*os == OOS_NULL)
139 *os = OOS_SVR4;
140 return (0);
141 }