svn commit: r199309 - in projects/ppc64/sys/powerpc: aim powerpc
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Mon Nov 16 04:14:23 UTC 2009
Author: nwhitehorn
Date: Mon Nov 16 04:14:22 2009
New Revision: 199309
URL: http://svn.freebsd.org/changeset/base/199309
Log:
Some missing bits from the compat layer, in particular an implementation of
fuword32 for 64-bit systems. With this change, sysinstall will now ask me
what kind of terminal I wish to use in the Cell system simulator.
Modified:
projects/ppc64/sys/powerpc/aim/copyinout.c
projects/ppc64/sys/powerpc/aim/trap.c
projects/ppc64/sys/powerpc/powerpc/elf32_machdep.c
projects/ppc64/sys/powerpc/powerpc/exec_machdep.c
Modified: projects/ppc64/sys/powerpc/aim/copyinout.c
==============================================================================
--- projects/ppc64/sys/powerpc/aim/copyinout.c Mon Nov 16 04:09:11 2009 (r199308)
+++ projects/ppc64/sys/powerpc/aim/copyinout.c Mon Nov 16 04:14:22 2009 (r199309)
@@ -353,6 +353,33 @@ fubyte(const void *addr)
return (val);
}
+#ifdef __powerpc64__
+int32_t
+fuword32(const void *addr)
+{
+ struct thread *td;
+ pmap_t pm;
+ faultbuf env;
+ int32_t *p, val;
+
+ td = PCPU_GET(curthread);
+ pm = &td->td_proc->p_vmspace->vm_pmap;
+ p = (int32_t *)((uintptr_t)USER_ADDR + ((uintptr_t)addr & ~SEGMENT_MASK));
+
+ if (setfault(env)) {
+ td->td_pcb->pcb_onfault = NULL;
+ return (-1);
+ }
+
+ set_user_sr(pm,addr);
+
+ val = *p;
+
+ td->td_pcb->pcb_onfault = NULL;
+ return (val);
+}
+#endif
+
long
fuword(const void *addr)
{
@@ -378,11 +405,13 @@ fuword(const void *addr)
return (val);
}
+#ifndef __powerpc64__
int32_t
fuword32(const void *addr)
{
return ((int32_t)fuword(addr));
}
+#endif
uint32_t
casuword32(volatile uint32_t *addr, uint32_t old, uint32_t new)
Modified: projects/ppc64/sys/powerpc/aim/trap.c
==============================================================================
--- projects/ppc64/sys/powerpc/aim/trap.c Mon Nov 16 04:09:11 2009 (r199308)
+++ projects/ppc64/sys/powerpc/aim/trap.c Mon Nov 16 04:14:22 2009 (r199309)
@@ -93,6 +93,9 @@ int badaddr(void *, size_t);
int badaddr_read(void *, size_t, int *);
extern char *syscallnames[];
+#ifdef COMPAT_FREEBSD32
+extern char *freebsd32_syscallnames[];
+#endif
struct powerpc_exception {
u_int vector;
@@ -361,6 +364,7 @@ syscall(struct trapframe *frame)
size_t narg, argsz;
u_register_t args[10];
u_int code;
+ char **scall_names;
td = PCPU_GET(curthread);
p = td->td_proc;
@@ -371,11 +375,6 @@ syscall(struct trapframe *frame)
params = (caddr_t)(frame->fixreg + FIRSTARG);
n = NARGREG;
- if (p->p_sysent->sv_flags & SV_ILP32)
- argsz = sizeof(uint32_t);
- else
- argsz = sizeof(uint64_t);
-
if (p->p_sysent->sv_prepsyscall) {
/*
* The prep code is MP aware.
@@ -419,9 +418,19 @@ syscall(struct trapframe *frame)
narg = callp->sy_narg;
if (p->p_sysent->sv_flags & SV_ILP32) {
+ argsz = sizeof(uint32_t);
+ #ifdef COMPAT_FREEBSD32
+ scall_names = freebsd32_syscallnames;
+ #else
+ scall_names = syscallnames;
+ #endif
+
for (i = 0; i < n; i++)
args[i] = ((u_register_t *)(params))[i] & 0xffffffff;
} else {
+ argsz = sizeof(uint64_t);
+ scall_names = syscallnames;
+
for (i = 0; i < n; i++)
args[i] = ((u_register_t *)(params))[i];
}
@@ -433,7 +442,7 @@ syscall(struct trapframe *frame)
error = 0;
CTR5(KTR_SYSC, "syscall: p=%s %s(%x %x %x)", td->td_name,
- syscallnames[code],
+ scall_names[code],
args[0], args[1], args[2]);
#ifdef KTRACE
@@ -456,7 +465,7 @@ syscall(struct trapframe *frame)
AUDIT_SYSCALL_EXIT(error, td);
CTR3(KTR_SYSC, "syscall: p=%s %s ret=%x", td->td_name,
- syscallnames[code], td->td_retval[0]);
+ scall_names[code], td->td_retval[0]);
}
switch (error) {
case 0:
@@ -500,13 +509,13 @@ syscall(struct trapframe *frame)
* Check for misbehavior.
*/
WITNESS_WARN(WARN_PANIC, NULL, "System call %s returning",
- (code >= 0 && code < SYS_MAXSYSCALL) ? syscallnames[code] : "???");
+ (code >= 0 && code < SYS_MAXSYSCALL) ? scall_names[code] : "???");
KASSERT(td->td_critnest == 0,
("System call %s returning in a critical section",
- (code >= 0 && code < SYS_MAXSYSCALL) ? syscallnames[code] : "???"));
+ (code >= 0 && code < SYS_MAXSYSCALL) ? scall_names[code] : "???"));
KASSERT(td->td_locks == 0,
("System call %s returning with %d locks held",
- (code >= 0 && code < SYS_MAXSYSCALL) ? syscallnames[code] : "???",
+ (code >= 0 && code < SYS_MAXSYSCALL) ? scall_names[code] : "???",
td->td_locks));
#ifdef KTRACE
Modified: projects/ppc64/sys/powerpc/powerpc/elf32_machdep.c
==============================================================================
--- projects/ppc64/sys/powerpc/powerpc/elf32_machdep.c Mon Nov 16 04:09:11 2009 (r199308)
+++ projects/ppc64/sys/powerpc/powerpc/elf32_machdep.c Mon Nov 16 04:14:22 2009 (r199309)
@@ -81,14 +81,17 @@ struct sysentvec elf32_freebsd_sysvec =
.sv_minsigstksz = MINSIGSTKSZ,
.sv_pagesize = PAGE_SIZE,
.sv_minuser = VM_MIN_ADDRESS,
- .sv_maxuser = VM_MAXUSER_ADDRESS,
- .sv_usrstack = USRSTACK,
- .sv_psstrings = PS_STRINGS,
.sv_stackprot = VM_PROT_ALL,
#ifdef __powerpc64__
+ .sv_maxuser = VM_MAXUSER_ADDRESS,
+ .sv_usrstack = FREEBSD32_USRSTACK,
+ .sv_psstrings = FREEBSD32_PS_STRINGS,
.sv_copyout_strings = freebsd32_copyout_strings,
.sv_setregs = ppc32_setregs,
#else
+ .sv_maxuser = VM_MAXUSER_ADDRESS,
+ .sv_usrstack = USRSTACK,
+ .sv_psstrings = PS_STRINGS,
.sv_copyout_strings = exec_copyout_strings,
.sv_setregs = exec_setregs,
#endif
Modified: projects/ppc64/sys/powerpc/powerpc/exec_machdep.c
==============================================================================
--- projects/ppc64/sys/powerpc/powerpc/exec_machdep.c Mon Nov 16 04:09:11 2009 (r199308)
+++ projects/ppc64/sys/powerpc/powerpc/exec_machdep.c Mon Nov 16 04:14:22 2009 (r199309)
@@ -490,7 +490,7 @@ ppc32_setregs(struct thread *td, u_long
tf->fixreg[5] = (register_t)arginfo.ps_envstr;
tf->fixreg[6] = 0; /* auxillary vector */
tf->fixreg[7] = 0; /* termination vector */
- tf->fixreg[8] = (register_t)PS_STRINGS; /* NetBSD extension */
+ tf->fixreg[8] = (register_t)FREEBSD32_PS_STRINGS; /* NetBSD extension */
tf->srr0 = entry;
tf->srr1 = PSL_MBO | PSL_USERSET | PSL_FE_DFLT;
More information about the svn-src-projects
mailing list