mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
The recent bump of MAXDSIZ made 32-bit binary execution on 64-bit powerpc fail.
The data segement was too big. Add a fix-up function like on ia32 for MAXDSIZ. While here, bring also the MAXSSIZ closer to amd64 and add an equal fix-up function for MAXSSIZ. Reviewed by: jhibbits@ Obtained from: jhibbits@ Differential Revision: https://reviews.freebsd.org/D13753
This commit is contained in:
parent
b081d0e406
commit
7e792cb8f5
2 changed files with 44 additions and 1 deletions
|
|
@ -60,8 +60,12 @@
|
|||
#endif
|
||||
|
||||
#ifndef MAXSSIZ
|
||||
#ifdef __powerpc64__
|
||||
#define MAXSSIZ (512*1024*1024) /* max stack size */
|
||||
#else
|
||||
#define MAXSSIZ (64*1024*1024) /* max stack size */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef AIM
|
||||
#define VM_MAXUSER_ADDRESS32 ((vm_offset_t)0xfffff000)
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
#include <sys/sysent.h>
|
||||
#include <sys/imgact_elf.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/linker.h>
|
||||
|
|
@ -60,6 +61,18 @@
|
|||
#include <compat/freebsd32/freebsd32_util.h>
|
||||
|
||||
extern const char *freebsd32_syscallnames[];
|
||||
static void ppc32_fixlimit(struct rlimit *rl, int which);
|
||||
|
||||
static SYSCTL_NODE(_compat, OID_AUTO, ppc32, CTLFLAG_RW, 0, "32-bit mode");
|
||||
|
||||
#define PPC32_MAXDSIZ (1024*1024*1024)
|
||||
static u_long ppc32_maxdsiz = PPC32_MAXDSIZ;
|
||||
SYSCTL_ULONG(_compat_ppc32, OID_AUTO, maxdsiz, CTLFLAG_RWTUN, &ppc32_maxdsiz,
|
||||
0, "");
|
||||
#define PPC32_MAXSSIZ (64*1024*1024)
|
||||
u_long ppc32_maxssiz = PPC32_MAXSSIZ;
|
||||
SYSCTL_ULONG(_compat_ppc32, OID_AUTO, maxssiz, CTLFLAG_RWTUN, &ppc32_maxssiz,
|
||||
0, "");
|
||||
#endif
|
||||
|
||||
struct sysentvec elf32_freebsd_sysvec = {
|
||||
|
|
@ -91,6 +104,7 @@ struct sysentvec elf32_freebsd_sysvec = {
|
|||
.sv_copyout_strings = freebsd32_copyout_strings,
|
||||
.sv_setregs = ppc32_setregs,
|
||||
.sv_syscallnames = freebsd32_syscallnames,
|
||||
.sv_fixlimit = ppc32_fixlimit,
|
||||
#else
|
||||
.sv_maxuser = VM_MAXUSER_ADDRESS,
|
||||
.sv_usrstack = USRSTACK,
|
||||
|
|
@ -98,8 +112,8 @@ struct sysentvec elf32_freebsd_sysvec = {
|
|||
.sv_copyout_strings = exec_copyout_strings,
|
||||
.sv_setregs = exec_setregs,
|
||||
.sv_syscallnames = syscallnames,
|
||||
#endif
|
||||
.sv_fixlimit = NULL,
|
||||
#endif
|
||||
.sv_maxssiz = NULL,
|
||||
.sv_flags = SV_ABI_FREEBSD | SV_ILP32 | SV_SHP,
|
||||
.sv_set_syscall_retval = cpu_set_syscall_retval,
|
||||
|
|
@ -321,3 +335,28 @@ elf_cpu_unload_file(linker_file_t lf __unused)
|
|||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __powerpc64__
|
||||
static void
|
||||
ppc32_fixlimit(struct rlimit *rl, int which)
|
||||
{
|
||||
switch (which) {
|
||||
case RLIMIT_DATA:
|
||||
if (ppc32_maxdsiz != 0) {
|
||||
if (rl->rlim_cur > ppc32_maxdsiz)
|
||||
rl->rlim_cur = ppc32_maxdsiz;
|
||||
if (rl->rlim_max > ppc32_maxdsiz)
|
||||
rl->rlim_max = ppc32_maxdsiz;
|
||||
}
|
||||
break;
|
||||
case RLIMIT_STACK:
|
||||
if (ppc32_maxssiz != 0) {
|
||||
if (rl->rlim_cur > ppc32_maxssiz)
|
||||
rl->rlim_cur = ppc32_maxssiz;
|
||||
if (rl->rlim_max > ppc32_maxssiz)
|
||||
rl->rlim_max = ppc32_maxssiz;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue