Page MenuHomeFreeBSD

D24930.id72033.diff
No OneTemporary

D24930.id72033.diff

Index: sys/mips/mips/freebsd32_machdep.c
===================================================================
--- sys/mips/mips/freebsd32_machdep.c
+++ sys/mips/mips/freebsd32_machdep.c
@@ -68,8 +68,6 @@
#include <compat/freebsd32/freebsd32_util.h>
#include <compat/freebsd32/freebsd32_proto.h>
-static void freebsd32_exec_setregs(struct thread *, struct image_params *,
- uintptr_t);
static int get_mcontext32(struct thread *, mcontext32_t *, int);
static int set_mcontext32(struct thread *, mcontext32_t *);
static void freebsd32_sendsig(sig_t, ksiginfo_t *, sigset_t *);
@@ -97,7 +95,7 @@
.sv_stackprot = VM_PROT_ALL,
.sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs),
.sv_copyout_strings = freebsd32_copyout_strings,
- .sv_setregs = freebsd32_exec_setregs,
+ .sv_setregs = exec_setregs,
.sv_fixlimit = NULL,
.sv_maxssiz = NULL,
.sv_flags = SV_ABI_FREEBSD | SV_ILP32,
@@ -126,26 +124,6 @@
(sysinit_cfunc_t) elf32_insert_brand_entry,
&freebsd_brand_info);
-static void
-freebsd32_exec_setregs(struct thread *td, struct image_params *imgp,
- uintptr_t stack)
-{
- exec_setregs(td, imgp, stack);
-
- /*
- * See comment in exec_setregs about running 32-bit binaries with 64-bit
- * registers.
- */
- td->td_frame->sp -= 65536;
-
- /*
- * Clear extended address space bit for userland.
- */
- td->td_frame->sr &= ~MIPS_SR_UX;
-
- td->td_md.md_tls_tcb_offset = TLS_TP_OFFSET + TLS_TCB_SIZE32;
-}
-
int
set_regs32(struct thread *td, struct reg32 *regs)
{
Index: sys/mips/mips/pm_machdep.c
===================================================================
--- sys/mips/mips/pm_machdep.c
+++ sys/mips/mips/pm_machdep.c
@@ -441,10 +441,13 @@
td->td_frame->t9 = imgp->entry_addr & ~3; /* abicall req */
td->td_frame->sr = MIPS_SR_KSU_USER | MIPS_SR_EXL | MIPS_SR_INT_IE |
(mips_rd_status() & MIPS_SR_INT_MASK);
-#if defined(__mips_n32)
+#if defined(__mips_n32) || defined(__mips_n64)
td->td_frame->sr |= MIPS_SR_PX;
-#elif defined(__mips_n64)
- td->td_frame->sr |= MIPS_SR_PX | MIPS_SR_UX | MIPS_SR_KX;
+#endif
+#if defined(__mips_n64)
+ if (SV_PROC_FLAG(td->td_proc, SV_LP64))
+ td->td_frame->sr |= MIPS_SR_UX;
+ td->td_frame->sr |= MIPS_SR_KX;
#endif
/*
* FREEBSD_DEVELOPERS_FIXME:
@@ -470,7 +473,12 @@
PCPU_SET(fpcurthread, (struct thread *)0);
td->td_md.md_ss_addr = 0;
- td->td_md.md_tls_tcb_offset = TLS_TP_OFFSET + TLS_TCB_SIZE;
+#ifdef COMPAT_FREEBSD32
+ if (!SV_PROC_FLAG(td->td_proc, SV_LP64))
+ td->td_md.md_tls_tcb_offset = TLS_TP_OFFSET + TLS_TCB_SIZE32;
+ else
+#endif
+ td->td_md.md_tls_tcb_offset = TLS_TP_OFFSET + TLS_TCB_SIZE;
}
int

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 28, 12:30 PM (2 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26283909
Default Alt Text
D24930.id72033.diff (2 KB)

Event Timeline