From 9f0c4ab393db960408a3a04d87c8b028751642ce Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Fri, 23 May 2003 05:07:33 +0000 Subject: [PATCH] Deal with the user VM space expanding. 32 bit applications do not like having their stack at the 512GB mark. Give 4GB of user VM space for 32 bit apps. Note that this is significantly more than on i386 which gives only about 2.9GB of user VM to a process (1GB for kernel, plus page table pages which eat user VM space). Approved by: re (blanket) --- sys/amd64/ia32/ia32_signal.c | 6 +++--- sys/amd64/ia32/ia32_sysvec.c | 8 ++++---- sys/amd64/ia32/ia32_util.h | 2 +- sys/compat/freebsd32/freebsd32_util.h | 2 +- sys/compat/ia32/ia32_sysvec.c | 8 ++++---- sys/compat/ia32/ia32_util.h | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c index ae966a53656..6cda1fd7394 100644 --- a/sys/amd64/ia32/ia32_signal.c +++ b/sys/amd64/ia32/ia32_signal.c @@ -263,7 +263,7 @@ freebsd4_ia32_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) } regs->tf_rsp = (uintptr_t)sfp; - regs->tf_rip = PS_STRINGS - sz_freebsd4_ia32_sigcode; + regs->tf_rip = IA32_PS_STRINGS - sz_freebsd4_ia32_sigcode; regs->tf_rflags &= ~PSL_T; regs->tf_cs = _ucode32sel; regs->tf_ss = _udatasel; @@ -362,7 +362,7 @@ ia32_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) } else { /* Old FreeBSD-style arguments. */ sf.sf_siginfo = code; - sf.sf_addr = regs->tf_err; + sf.sf_addr = regs->tf_addr; sf.sf_ah = (u_int32_t)(uintptr_t)catcher; } PROC_UNLOCK(p); @@ -379,7 +379,7 @@ ia32_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) } regs->tf_rsp = (uintptr_t)sfp; - regs->tf_rip = PS_STRINGS - *(p->p_sysent->sv_szsigcode); + regs->tf_rip = IA32_PS_STRINGS - *(p->p_sysent->sv_szsigcode); regs->tf_rflags &= ~PSL_T; regs->tf_cs = _ucode32sel; regs->tf_ss = _udatasel; diff --git a/sys/amd64/ia32/ia32_sysvec.c b/sys/amd64/ia32/ia32_sysvec.c index 5ced18ccf2d..f921ff1c96e 100644 --- a/sys/amd64/ia32/ia32_sysvec.c +++ b/sys/amd64/ia32/ia32_sysvec.c @@ -100,9 +100,9 @@ struct sysentvec ia32_freebsd_sysvec = { MINSIGSTKSZ, PAGE_SIZE, 0, - USRSTACK, - USRSTACK, - PS_STRINGS, + IA32_USRSTACK, + IA32_USRSTACK, + IA32_PS_STRINGS, VM_PROT_ALL, ia32_copyout_strings, ia32_setregs @@ -139,7 +139,7 @@ ia32_copyout_strings(struct image_params *imgp) * Calculate string base and vector table pointers. * Also deal with signal trampoline code for this exec type. */ - arginfo = (struct ia32_ps_strings *)PS_STRINGS; + arginfo = (struct ia32_ps_strings *)IA32_PS_STRINGS; szsigcode = *(imgp->proc->p_sysent->sv_szsigcode); destp = (caddr_t)arginfo - szsigcode - SPARE_USRSPACE - roundup((ARG_MAX - imgp->stringspace), sizeof(char *)); diff --git a/sys/amd64/ia32/ia32_util.h b/sys/amd64/ia32/ia32_util.h index 20a5b1e2841..64fa29320ca 100644 --- a/sys/amd64/ia32/ia32_util.h +++ b/sys/amd64/ia32/ia32_util.h @@ -44,7 +44,7 @@ struct ia32_ps_strings { int ps_nenvstr; /* the number of environment strings */ }; -#define IA32_USRSTACK USRSTACK +#define IA32_USRSTACK ((1ul << 32) - PAGE_SIZE) #define IA32_PS_STRINGS (IA32_USRSTACK - sizeof(struct ia32_ps_strings)) static __inline caddr_t stackgap_init(void); diff --git a/sys/compat/freebsd32/freebsd32_util.h b/sys/compat/freebsd32/freebsd32_util.h index 20a5b1e2841..64fa29320ca 100644 --- a/sys/compat/freebsd32/freebsd32_util.h +++ b/sys/compat/freebsd32/freebsd32_util.h @@ -44,7 +44,7 @@ struct ia32_ps_strings { int ps_nenvstr; /* the number of environment strings */ }; -#define IA32_USRSTACK USRSTACK +#define IA32_USRSTACK ((1ul << 32) - PAGE_SIZE) #define IA32_PS_STRINGS (IA32_USRSTACK - sizeof(struct ia32_ps_strings)) static __inline caddr_t stackgap_init(void); diff --git a/sys/compat/ia32/ia32_sysvec.c b/sys/compat/ia32/ia32_sysvec.c index 5ced18ccf2d..f921ff1c96e 100644 --- a/sys/compat/ia32/ia32_sysvec.c +++ b/sys/compat/ia32/ia32_sysvec.c @@ -100,9 +100,9 @@ struct sysentvec ia32_freebsd_sysvec = { MINSIGSTKSZ, PAGE_SIZE, 0, - USRSTACK, - USRSTACK, - PS_STRINGS, + IA32_USRSTACK, + IA32_USRSTACK, + IA32_PS_STRINGS, VM_PROT_ALL, ia32_copyout_strings, ia32_setregs @@ -139,7 +139,7 @@ ia32_copyout_strings(struct image_params *imgp) * Calculate string base and vector table pointers. * Also deal with signal trampoline code for this exec type. */ - arginfo = (struct ia32_ps_strings *)PS_STRINGS; + arginfo = (struct ia32_ps_strings *)IA32_PS_STRINGS; szsigcode = *(imgp->proc->p_sysent->sv_szsigcode); destp = (caddr_t)arginfo - szsigcode - SPARE_USRSPACE - roundup((ARG_MAX - imgp->stringspace), sizeof(char *)); diff --git a/sys/compat/ia32/ia32_util.h b/sys/compat/ia32/ia32_util.h index 20a5b1e2841..64fa29320ca 100644 --- a/sys/compat/ia32/ia32_util.h +++ b/sys/compat/ia32/ia32_util.h @@ -44,7 +44,7 @@ struct ia32_ps_strings { int ps_nenvstr; /* the number of environment strings */ }; -#define IA32_USRSTACK USRSTACK +#define IA32_USRSTACK ((1ul << 32) - PAGE_SIZE) #define IA32_PS_STRINGS (IA32_USRSTACK - sizeof(struct ia32_ps_strings)) static __inline caddr_t stackgap_init(void);