svn commit: r211302 - in stable/8/sys: amd64/ia32 compat/freebsd32
ia64/ia32
Konstantin Belousov
kib at FreeBSD.org
Sat Aug 14 14:14:00 UTC 2010
Author: kib
Date: Sat Aug 14 14:13:58 2010
New Revision: 211302
URL: http://svn.freebsd.org/changeset/base/211302
Log:
MFC r211006:
Prefer struct sysentvec sv_psstrings to hardcoding FREEBSD32_PS_STRINGS
in the compat32 code. Use sv_usrstack instead of FREEBSD32_USRSTACK as well.
Modified:
stable/8/sys/amd64/ia32/ia32_signal.c
stable/8/sys/compat/freebsd32/freebsd32_misc.c
stable/8/sys/ia64/ia32/ia32_signal.c
Directory Properties:
stable/8/sys/ (props changed)
stable/8/sys/amd64/include/xen/ (props changed)
stable/8/sys/cam/ (props changed)
stable/8/sys/cddl/contrib/opensolaris/ (props changed)
stable/8/sys/contrib/dev/acpica/ (props changed)
stable/8/sys/contrib/pf/ (props changed)
stable/8/sys/dev/e1000/ (props changed)
stable/8/sys/dev/xen/xenpci/ (props changed)
Modified: stable/8/sys/amd64/ia32/ia32_signal.c
==============================================================================
--- stable/8/sys/amd64/ia32/ia32_signal.c Sat Aug 14 14:13:44 2010 (r211301)
+++ stable/8/sys/amd64/ia32/ia32_signal.c Sat Aug 14 14:13:58 2010 (r211302)
@@ -387,7 +387,7 @@ freebsd4_ia32_sendsig(sig_t catcher, ksi
}
regs->tf_rsp = (uintptr_t)sfp;
- regs->tf_rip = FREEBSD32_PS_STRINGS - sz_freebsd4_ia32_sigcode;
+ regs->tf_rip = p->p_sysent->sv_psstrings - sz_freebsd4_ia32_sigcode;
regs->tf_rflags &= ~(PSL_T | PSL_D);
regs->tf_cs = _ucode32sel;
regs->tf_ss = _udatasel;
@@ -508,7 +508,7 @@ ia32_sendsig(sig_t catcher, ksiginfo_t *
}
regs->tf_rsp = (uintptr_t)sfp;
- regs->tf_rip = FREEBSD32_PS_STRINGS - *(p->p_sysent->sv_szsigcode);
+ regs->tf_rip = p->p_sysent->sv_psstrings - *(p->p_sysent->sv_szsigcode);
regs->tf_rflags &= ~(PSL_T | PSL_D);
regs->tf_cs = _ucode32sel;
regs->tf_ss = _udatasel;
Modified: stable/8/sys/compat/freebsd32/freebsd32_misc.c
==============================================================================
--- stable/8/sys/compat/freebsd32/freebsd32_misc.c Sat Aug 14 14:13:44 2010 (r211301)
+++ stable/8/sys/compat/freebsd32/freebsd32_misc.c Sat Aug 14 14:13:58 2010 (r211302)
@@ -2544,7 +2544,8 @@ freebsd32_copyout_strings(struct image_p
execpath_len = strlen(imgp->execpath) + 1;
else
execpath_len = 0;
- arginfo = (struct freebsd32_ps_strings *)FREEBSD32_PS_STRINGS;
+ arginfo = (struct freebsd32_ps_strings *)curproc->p_sysent->
+ sv_psstrings;
szsigcode = *(imgp->proc->p_sysent->sv_szsigcode);
destp = (caddr_t)arginfo - szsigcode - SPARE_USRSPACE -
roundup(execpath_len, sizeof(char *)) -
Modified: stable/8/sys/ia64/ia32/ia32_signal.c
==============================================================================
--- stable/8/sys/ia64/ia32/ia32_signal.c Sat Aug 14 14:13:44 2010 (r211301)
+++ stable/8/sys/ia64/ia32/ia32_signal.c Sat Aug 14 14:13:58 2010 (r211302)
@@ -128,7 +128,9 @@ ia32_setregs(struct thread *td, u_long e
u_int64_t codeseg, dataseg, gdtseg, ldtseg;
struct segment_descriptor desc;
struct vmspace *vmspace = td->td_proc->p_vmspace;
+ struct sysentvec *sv;
+ sv = td->td_proc->p_sysent;
exec_setregs(td, entry, stack, ps_strings);
/* Non-syscall frames are cleared by exec_setregs() */
@@ -142,7 +144,7 @@ ia32_setregs(struct thread *td, u_long e
tf->tf_special.sp = stack;
/* Point the RSE backstore to something harmless. */
- tf->tf_special.bspstore = (FREEBSD32_PS_STRINGS - sz_ia32_sigcode -
+ tf->tf_special.bspstore = (sv->sv_psstrings - sz_ia32_sigcode -
SPARE_USRSPACE + 15) & ~15;
codesel = LSEL(LUCODE_SEL, SEL_UPL);
@@ -157,7 +159,7 @@ ia32_setregs(struct thread *td, u_long e
/*
* Build the GDT and LDT.
*/
- gdt = FREEBSD32_USRSTACK;
+ gdt = sv->sv_usrstack;
vm_map_find(&vmspace->vm_map, 0, 0, &gdt, IA32_PAGE_SIZE << 1, 0,
VM_PROT_ALL, VM_PROT_ALL, 0);
ldt = gdt + IA32_PAGE_SIZE;
@@ -173,12 +175,12 @@ ia32_setregs(struct thread *td, u_long e
desc.sd_hibase = ldt >> 24;
copyout(&desc, (caddr_t) gdt + 8*GLDT_SEL, sizeof(desc));
- desc.sd_lolimit = ((FREEBSD32_USRSTACK >> 12) - 1) & 0xffff;
+ desc.sd_lolimit = ((sv->sv_usrstack >> 12) - 1) & 0xffff;
desc.sd_lobase = 0;
desc.sd_type = SDT_MEMERA;
desc.sd_dpl = SEL_UPL;
desc.sd_p = 1;
- desc.sd_hilimit = ((FREEBSD32_USRSTACK >> 12) - 1) >> 16;
+ desc.sd_hilimit = ((sv->sv_usrstack >> 12) - 1) >> 16;
desc.sd_def32 = 1;
desc.sd_gran = 1;
desc.sd_hibase = 0;
@@ -187,14 +189,14 @@ ia32_setregs(struct thread *td, u_long e
copyout(&desc, (caddr_t) ldt + 8*LUDATA_SEL, sizeof(desc));
codeseg = 0 /* base */
- + (((FREEBSD32_USRSTACK >> 12) - 1) << 32) /* limit */
+ + (((sv->sv_usrstack >> 12) - 1) << 32) /* limit */
+ ((long)SDT_MEMERA << 52)
+ ((long)SEL_UPL << 57)
+ (1L << 59) /* present */
+ (1L << 62) /* 32 bits */
+ (1L << 63); /* page granularity */
dataseg = 0 /* base */
- + (((FREEBSD32_USRSTACK >> 12) - 1) << 32) /* limit */
+ + (((sv->sv_usrstack >> 12) - 1) << 32) /* limit */
+ ((long)SDT_MEMRWA << 52)
+ ((long)SEL_UPL << 57)
+ (1L << 59) /* present */
@@ -231,7 +233,7 @@ ia32_setregs(struct thread *td, u_long e
ia64_set_eflag(PSL_USER);
/* PS_STRINGS value for BSD/OS binaries. It is 0 for non-BSD/OS. */
- tf->tf_scratch.gr11 = FREEBSD32_PS_STRINGS;
+ tf->tf_scratch.gr11 = td->td_proc->p_sysent->sv_psstrings;
/*
* XXX - Linux emulator
More information about the svn-src-stable-8
mailing list