View | Details | Raw Unified | Return to bug 274705
Collapse All | Expand All

(-)b/sys/arm64/arm64/elf32_machdep.c (-2 / +51 lines)
Lines 61-66 Link Here
61
#define	FREEBSD32_MAXUSER	((1ul << 32) - PAGE_SIZE)
61
#define	FREEBSD32_MAXUSER	((1ul << 32) - PAGE_SIZE)
62
#define	FREEBSD32_SHAREDPAGE	(FREEBSD32_MAXUSER - PAGE_SIZE)
62
#define	FREEBSD32_SHAREDPAGE	(FREEBSD32_MAXUSER - PAGE_SIZE)
63
#define	FREEBSD32_USRSTACK	FREEBSD32_SHAREDPAGE
63
#define	FREEBSD32_USRSTACK	FREEBSD32_SHAREDPAGE
64
#define	AARCH32_MAXDSIZ		(512*1024*1024)
65
#define	AARCH32_MAXSSIZ		(64*1024*1024)
66
#define	AARCH32_MAXVMEM		0
64
67
65
extern const char *freebsd32_syscallnames[];
68
extern const char *freebsd32_syscallnames[];
66
69
Lines 74-85 static void freebsd32_set_syscall_retval(struct thread *, int); Link Here
74
77
75
static bool elf32_arm_abi_supported(struct image_params *, int32_t *,
78
static bool elf32_arm_abi_supported(struct image_params *, int32_t *,
76
    uint32_t *);
79
    uint32_t *);
80
static void elf32_fixlimit(struct rlimit *rl, int which);
77
81
78
extern void freebsd32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask);
82
extern void freebsd32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask);
79
83
80
u_long __read_frequently elf32_hwcap;
84
u_long __read_frequently elf32_hwcap;
81
u_long __read_frequently elf32_hwcap2;
85
u_long __read_frequently elf32_hwcap2;
82
86
87
static SYSCTL_NODE(_compat, OID_AUTO, aarch32, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
88
    "aarch32 mode");
89
90
static u_long aarch32_maxdsiz = AARCH32_MAXDSIZ;
91
SYSCTL_ULONG(_compat_aarch32, OID_AUTO, maxdsiz, CTLFLAG_RWTUN,
92
    &aarch32_maxdsiz, 0, "");
93
u_long aarch32_maxssiz = AARCH32_MAXSSIZ;
94
SYSCTL_ULONG(_compat_aarch32, OID_AUTO, maxssiz, CTLFLAG_RWTUN,
95
    &aarch32_maxssiz, 0, "");
96
static u_long aarch32_maxvmem = AARCH32_MAXVMEM;
97
SYSCTL_ULONG(_compat_aarch32, OID_AUTO, maxvmem, CTLFLAG_RWTUN,
98
    &aarch32_maxvmem, 0, "");
99
83
static struct sysentvec elf32_freebsd_sysvec = {
100
static struct sysentvec elf32_freebsd_sysvec = {
84
	.sv_size	= SYS_MAXSYSCALL,
101
	.sv_size	= SYS_MAXSYSCALL,
85
	.sv_table	= freebsd32_sysent,
102
	.sv_table	= freebsd32_sysent,
Lines 102-109 static struct sysentvec elf32_freebsd_sysvec = { Link Here
102
	.sv_copyout_auxargs = elf32_freebsd_copyout_auxargs,
119
	.sv_copyout_auxargs = elf32_freebsd_copyout_auxargs,
103
	.sv_copyout_strings = freebsd32_copyout_strings,
120
	.sv_copyout_strings = freebsd32_copyout_strings,
104
	.sv_setregs	= freebsd32_setregs,
121
	.sv_setregs	= freebsd32_setregs,
105
	.sv_fixlimit	= NULL, // XXX
122
	.sv_fixlimit	= elf32_fixlimit,
106
	.sv_maxssiz	= NULL,
123
	.sv_maxssiz	= &aarch32_maxssiz,
107
	.sv_flags	= SV_ABI_FREEBSD | SV_ILP32 | SV_SHP | SV_TIMEKEEP |
124
	.sv_flags	= SV_ABI_FREEBSD | SV_ILP32 | SV_SHP | SV_TIMEKEEP |
108
	    SV_RNG_SEED_VER | SV_SIGSYS,
125
	    SV_RNG_SEED_VER | SV_SIGSYS,
109
	.sv_set_syscall_retval = freebsd32_set_syscall_retval,
126
	.sv_set_syscall_retval = freebsd32_set_syscall_retval,
Lines 284-286 void Link Here
284
elf32_dump_thread(struct thread *td, void *dst, size_t *off)
301
elf32_dump_thread(struct thread *td, void *dst, size_t *off)
285
{
302
{
286
}
303
}
304
305
static void
306
elf32_fixlimit(struct rlimit *rl, int which)
307
{
308
309
	switch (which) {
310
	case RLIMIT_DATA:
311
		if (aarch32_maxdsiz != 0) {
312
			if (rl->rlim_cur > aarch32_maxdsiz)
313
				rl->rlim_cur = aarch32_maxdsiz;
314
			if (rl->rlim_max > aarch32_maxdsiz)
315
				rl->rlim_max = aarch32_maxdsiz;
316
		}
317
		break;
318
	case RLIMIT_STACK:
319
		if (aarch32_maxssiz != 0) {
320
			if (rl->rlim_cur > aarch32_maxssiz)
321
				rl->rlim_cur = aarch32_maxssiz;
322
			if (rl->rlim_max > aarch32_maxssiz)
323
				rl->rlim_max = aarch32_maxssiz;
324
		}
325
		break;
326
	case RLIMIT_VMEM:
327
		if (aarch32_maxvmem != 0) {
328
			if (rl->rlim_cur > aarch32_maxvmem)
329
				rl->rlim_cur = aarch32_maxvmem;
330
			if (rl->rlim_max > aarch32_maxvmem)
331
				rl->rlim_max = aarch32_maxvmem;
332
		}
333
		break;
334
	}
335
}

Return to bug 274705