svn commit: r196042 - projects/ppc64/sys/powerpc/aim64
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Mon Aug 3 01:54:14 UTC 2009
Author: nwhitehorn
Date: Mon Aug 3 01:54:13 2009
New Revision: 196042
URL: http://svn.freebsd.org/changeset/base/196042
Log:
Step 1: Teach the kernel how to start a PPC64 userland process.
Step 2: Fix a bug in SLB refill that crept in.
Step 3: Observe userland process print "Hello World!" to the console!
Modified:
projects/ppc64/sys/powerpc/aim64/machdep.c
projects/ppc64/sys/powerpc/aim64/trap_subr.S
Modified: projects/ppc64/sys/powerpc/aim64/machdep.c
==============================================================================
--- projects/ppc64/sys/powerpc/aim64/machdep.c Sun Aug 2 22:47:08 2009 (r196041)
+++ projects/ppc64/sys/powerpc/aim64/machdep.c Mon Aug 3 01:54:13 2009 (r196042)
@@ -858,6 +858,7 @@ exec_setregs(struct thread *td, u_long e
{
struct trapframe *tf;
struct ps_strings arginfo;
+ register_t entry_desc[3];
tf = trapframe(td);
bzero(tf, sizeof *tf);
@@ -898,8 +899,24 @@ exec_setregs(struct thread *td, u_long e
tf->fixreg[7] = 0; /* termination vector */
tf->fixreg[8] = (register_t)PS_STRINGS; /* NetBSD extension */
- tf->srr0 = entry;
- tf->srr1 = PSL_MBO | PSL_USERSET | PSL_FE_DFLT;
+ if (1) {
+ /*
+ * For 64-bit, we need to disentangle the function descriptor
+ *
+ * 0. entry point
+ * 1. TOC value (r2)
+ * 2. Environment pointer (r11)
+ */
+
+ (void)copyin((void *)entry, entry_desc, sizeof(entry_desc));
+ tf->srr0 = entry_desc[0];
+ tf->fixreg[2] = entry_desc[1];
+ tf->fixreg[11] = entry_desc[2];
+ tf->srr1 = PSL_SF | PSL_MBO | PSL_USERSET | PSL_FE_DFLT;
+ } else {
+ tf->srr0 = entry;
+ tf->srr1 = PSL_MBO | PSL_USERSET | PSL_FE_DFLT;
+ }
td->td_pcb->pcb_flags = 0;
}
Modified: projects/ppc64/sys/powerpc/aim64/trap_subr.S
==============================================================================
--- projects/ppc64/sys/powerpc/aim64/trap_subr.S Sun Aug 2 22:47:08 2009 (r196041)
+++ projects/ppc64/sys/powerpc/aim64/trap_subr.S Mon Aug 3 01:54:13 2009 (r196042)
@@ -63,7 +63,7 @@ instslb:
slbmte %r30, %r31; /* Install SLB entry */
nslb:
- addi %r28, %r28, 8; /* Advance */
+ addi %r28, %r28, 16; /* Advance */
addi %r29, %r29, 1;
cmpli 0, %r29, 63; /* Repeat if we are not at the end */
blt instslb;
@@ -227,7 +227,16 @@ nslb:
mtcr %r3; \
bf 17,1f; /* branch if PSL_PR is false */ \
/* Restore user SRs */ \
- RESTORE_USER_SRS(); /* uses r27-r31 */ \
+ GET_CPUINFO(%r3); \
+ std %r28,(savearea+CPUSAVE_R28)(%r3); \
+ std %r29,(savearea+CPUSAVE_R29)(%r3); \
+ std %r30,(savearea+CPUSAVE_R30)(%r3); \
+ std %r31,(savearea+CPUSAVE_R31)(%r3); \
+ RESTORE_USER_SRS(); /* uses r28-r31 */ \
+ ld %r31,(savearea+CPUSAVE_R31)(%r3); \
+ ld %r30,(savearea+CPUSAVE_R30)(%r3); \
+ ld %r29,(savearea+CPUSAVE_R29)(%r3); \
+ ld %r28,(savearea+CPUSAVE_R28)(%r3); \
1: mfsprg1 %r2; /* restore cr */ \
mtcr %r2; \
GET_CPUINFO(%r2); \
More information about the svn-src-projects
mailing list