svn commit: r205368 - in projects/ppc64/sys/powerpc: booke include powerpc

Nathan Whitehorn nwhitehorn at FreeBSD.org
Sat Mar 20 14:24:57 UTC 2010


Author: nwhitehorn
Date: Sat Mar 20 14:24:57 2010
New Revision: 205368
URL: http://svn.freebsd.org/changeset/base/205368

Log:
  Fix the Book-E build. Due to lack of hardware, I have no idea if
  Book-E still works on this branch, but at least make universe now
  completes.

Modified:
  projects/ppc64/sys/powerpc/booke/machdep.c
  projects/ppc64/sys/powerpc/include/psl.h
  projects/ppc64/sys/powerpc/include/pte.h
  projects/ppc64/sys/powerpc/include/vmparam.h
  projects/ppc64/sys/powerpc/powerpc/exec_machdep.c

Modified: projects/ppc64/sys/powerpc/booke/machdep.c
==============================================================================
--- projects/ppc64/sys/powerpc/booke/machdep.c	Sat Mar 20 12:39:28 2010	(r205367)
+++ projects/ppc64/sys/powerpc/booke/machdep.c	Sat Mar 20 14:24:57 2010	(r205368)
@@ -209,7 +209,7 @@ cpu_e500_startup(void *dummy)
 		for (indx = 0; phys_avail[indx + 1] != 0; indx += 2) {
 			size = phys_avail[indx + 1] - phys_avail[indx];
 
-			printf("0x%08x - 0x%08x, %d bytes (%d pages)\n",
+			printf("0x%08x - 0x%08x, %d bytes (%ld pages)\n",
 			    phys_avail[indx], phys_avail[indx + 1] - 1,
 			    size, size / PAGE_SIZE);
 		}
@@ -507,24 +507,6 @@ cpu_pcpu_init(struct pcpu *pcpu, int cpu
 #endif
 }
 
-int
-fill_regs(struct thread *td, struct reg *regs)
-{
-	struct trapframe *tf;
-
-	tf = td->td_frame;
-	memcpy(regs, tf, sizeof(struct reg));
-
-	return (0);
-}
-
-int
-fill_fpregs(struct thread *td, struct fpreg *fpregs)
-{
-
-	return (0);
-}
-
 /*
  * Flush the D-cache for non-DMA I/O so that the I-cache can
  * be made coherent later.
@@ -535,106 +517,6 @@ cpu_flush_dcache(void *ptr, size_t len)
 	/* TBD */
 }
 
-/*
- * Construct a PCB from a trapframe. This is called from kdb_trap() where
- * we want to start a backtrace from the function that caused us to enter
- * the debugger. We have the context in the trapframe, but base the trace
- * on the PCB. The PCB doesn't have to be perfect, as long as it contains
- * enough for a backtrace.
- */
-void
-makectx(struct trapframe *tf, struct pcb *pcb)
-{
-
-	pcb->pcb_lr = tf->srr0;
-	pcb->pcb_sp = tf->fixreg[1];
-}
-
-/*
- * get_mcontext/sendsig helper routine that doesn't touch the
- * proc lock.
- */
-static int
-grab_mcontext(struct thread *td, mcontext_t *mcp, int flags)
-{
-	struct pcb *pcb;
-
-	pcb = td->td_pcb;
-	memset(mcp, 0, sizeof(mcontext_t));
-
-	mcp->mc_vers = _MC_VERSION;
-	mcp->mc_flags = 0;
-	memcpy(&mcp->mc_frame, td->td_frame, sizeof(struct trapframe));
-	if (flags & GET_MC_CLEAR_RET) {
-		mcp->mc_gpr[3] = 0;
-		mcp->mc_gpr[4] = 0;
-	}
-
-	/* XXX Altivec context ? */
-
-	mcp->mc_len = sizeof(*mcp);
-	return (0);
-}
-
-int
-get_mcontext(struct thread *td, mcontext_t *mcp, int flags)
-{
-	int error;
-
-	error = grab_mcontext(td, mcp, flags);
-	if (error == 0) {
-		PROC_LOCK(curthread->td_proc);
-		mcp->mc_onstack = sigonstack(td->td_frame->fixreg[1]);
-		PROC_UNLOCK(curthread->td_proc);
-	}
-
-	return (error);
-}
-
-int
-set_mcontext(struct thread *td, const mcontext_t *mcp)
-{
-	struct pcb *pcb;
-	struct trapframe *tf;
-
-	pcb = td->td_pcb;
-	tf = td->td_frame;
-
-	if (mcp->mc_vers != _MC_VERSION || mcp->mc_len != sizeof(*mcp))
-		return (EINVAL);
-
-	memcpy(tf, mcp->mc_frame, sizeof(mcp->mc_frame));
-
-	/* XXX Altivec context? */
-
-	return (0);
-}
-
-int
-sigreturn(struct thread *td, struct sigreturn_args *uap)
-{
-	ucontext_t uc;
-	int error;
-
-	CTR2(KTR_SIG, "sigreturn: td=%p ucp=%p", td, uap->sigcntxp);
-
-	if (copyin(uap->sigcntxp, &uc, sizeof(uc)) != 0) {
-		CTR1(KTR_SIG, "sigreturn: efault td=%p", td);
-		return (EFAULT);
-	}
-
-	error = set_mcontext(td, &uc.uc_mcontext);
-	if (error != 0)
-		return (error);
-
-	kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0);
-
-	CTR3(KTR_SIG, "sigreturn: return td=%p pc=%#x sp=%#x",
-	    td, uc.uc_mcontext.mc_srr0, uc.uc_mcontext.mc_gpr[1]);
-
-	return (EJUSTRETURN);
-}
-
 #ifdef COMPAT_FREEBSD4
 int
 freebsd4_sigreturn(struct thread *td, struct freebsd4_sigreturn_args *uap)
@@ -718,39 +600,6 @@ cpu_halt(void)
 }
 
 int
-set_regs(struct thread *td, struct reg *regs)
-{
-	struct trapframe *tf;
-
-	tf = td->td_frame;
-	memcpy(tf, regs, sizeof(struct reg));
-	return (0);
-}
-
-int
-fill_dbregs(struct thread *td, struct dbreg *dbregs)
-{
-
-	/* No debug registers on PowerPC */
-	return (ENOSYS);
-}
-
-int
-set_dbregs(struct thread *td, struct dbreg *dbregs)
-{
-
-	/* No debug registers on PowerPC */
-	return (ENOSYS);
-}
-
-int
-set_fpregs(struct thread *td, struct fpreg *fpregs)
-{
-
-	return (0);
-}
-
-int
 ptrace_set_pc(struct thread *td, unsigned long addr)
 {
 	struct trapframe *tf;
@@ -804,124 +653,6 @@ kdb_cpu_set_singlestep(void)
 }
 
 void
-sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
-{
-	struct trapframe *tf;
-	struct sigframe *sfp;
-	struct sigacts *psp;
-	struct sigframe sf;
-	struct thread *td;
-	struct proc *p;
-	int oonstack, rndfsize;
-	int sig, code;
-
-	td = curthread;
-	p = td->td_proc;
-	PROC_LOCK_ASSERT(p, MA_OWNED);
-	sig = ksi->ksi_signo;
-	code = ksi->ksi_code;
-	psp = p->p_sigacts;
-	mtx_assert(&psp->ps_mtx, MA_OWNED);
-	tf = td->td_frame;
-	oonstack = sigonstack(tf->fixreg[1]);
-
-	rndfsize = ((sizeof(sf) + 15) / 16) * 16;
-
-	CTR4(KTR_SIG, "sendsig: td=%p (%s) catcher=%p sig=%d", td, p->p_comm,
-	    catcher, sig);
-
-	/*
-	 * Save user context
-	 */
-	memset(&sf, 0, sizeof(sf));
-	grab_mcontext(td, &sf.sf_uc.uc_mcontext, 0);
-	sf.sf_uc.uc_sigmask = *mask;
-	sf.sf_uc.uc_stack = td->td_sigstk;
-	sf.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK)
-		? ((oonstack) ? SS_ONSTACK : 0) : SS_DISABLE;
-
-	sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0;
-
-	/*
-	 * Allocate and validate space for the signal handler context.
-	 */
-	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
-	    SIGISMEMBER(psp->ps_sigonstack, sig)) {
-		sfp = (struct sigframe *)((caddr_t)td->td_sigstk.ss_sp +
-		    td->td_sigstk.ss_size - rndfsize);
-	} else {
-		sfp = (struct sigframe *)(tf->fixreg[1] - rndfsize);
-	}
-
-	/*
-	 * Translate the signal if appropriate (Linux emu ?)
-	 */
-	if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize)
-		sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];
-
-	/*
-	 * Save the floating-point state, if necessary, then copy it.
-	 */
-	/* XXX */
-
-	/*
-	 * Set up the registers to return to sigcode.
-	 *
-	 *   r1/sp - sigframe ptr
-	 *   lr    - sig function, dispatched to by blrl in trampoline
-	 *   r3    - sig number
-	 *   r4    - SIGINFO ? &siginfo : exception code
-	 *   r5    - user context
-	 *   srr0  - trampoline function addr
-	 */
-	tf->lr = (register_t)catcher;
-	tf->fixreg[1] = (register_t)sfp;
-	tf->fixreg[FIRSTARG] = sig;
-	tf->fixreg[FIRSTARG+2] = (register_t)&sfp->sf_uc;
-	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
-		/*
-		 * Signal handler installed with SA_SIGINFO.
-		 */
-		tf->fixreg[FIRSTARG+1] = (register_t)&sfp->sf_si;
-
-		/*
-		 * Fill siginfo structure.
-		 */
-		sf.sf_si = ksi->ksi_info;
-		sf.sf_si.si_signo = sig;
-		sf.sf_si.si_addr = (void *) ((tf->exc == EXC_DSI) ?
-		    tf->cpu.booke.dear : tf->srr0);
-	} else {
-		/* Old FreeBSD-style arguments. */
-		tf->fixreg[FIRSTARG+1] = code;
-		tf->fixreg[FIRSTARG+3] = (tf->exc == EXC_DSI) ?
-		    tf->cpu.booke.dear : tf->srr0;
-	}
-	mtx_unlock(&psp->ps_mtx);
-	PROC_UNLOCK(p);
-
-	tf->srr0 = (register_t)(PS_STRINGS - *(p->p_sysent->sv_szsigcode));
-
-	/*
-	 * copy the frame out to userland.
-	 */
-	if (copyout((caddr_t)&sf, (caddr_t)sfp, sizeof(sf)) != 0) {
-		/*
-		 * Process has trashed its stack. Kill it.
-		 */
-		CTR2(KTR_SIG, "sendsig: sigexit td=%p sfp=%p", td, sfp);
-		PROC_LOCK(p);
-		sigexit(td, SIGILL);
-	}
-
-	CTR3(KTR_SIG, "sendsig: return td=%p pc=%#x sp=%#x", td,
-	    tf->srr0, tf->fixreg[1]);
-
-	PROC_LOCK(p);
-	mtx_lock(&psp->ps_mtx);
-}
-
-void
 bzero(void *buf, size_t len)
 {
 	caddr_t p;

Modified: projects/ppc64/sys/powerpc/include/psl.h
==============================================================================
--- projects/ppc64/sys/powerpc/include/psl.h	Sat Mar 20 12:39:28 2010	(r205367)
+++ projects/ppc64/sys/powerpc/include/psl.h	Sat Mar 20 14:24:57 2010	(r205368)
@@ -60,6 +60,10 @@
 #define PSL_DS		0x00000010	/* Data address space */
 #define PSL_PMM		0x00000004	/* Performance monitor mark */
 
+#define PSL_PMM		0x00000004	/* Performance monitor mark */
+
+#define PSL_FE_DFLT	0x00000000	/* default == none */
+
 /* Initial kernel MSR, use IS=1 ad DS=1. */
 #define PSL_KERNSET_INIT	(PSL_IS | PSL_DS)
 #define PSL_KERNSET		(PSL_CE | PSL_ME | PSL_EE)

Modified: projects/ppc64/sys/powerpc/include/pte.h
==============================================================================
--- projects/ppc64/sys/powerpc/include/pte.h	Sat Mar 20 12:39:28 2010	(r205367)
+++ projects/ppc64/sys/powerpc/include/pte.h	Sat Mar 20 14:24:57 2010	(r205368)
@@ -190,7 +190,7 @@ extern u_int dsisr(void);
  */
 #define PTBL_SHIFT	PAGE_SHIFT
 #define PTBL_SIZE	PAGE_SIZE		/* va range mapped by ptbl entry */
-#define PTBL_MASK	((PDIR_SIZE - 1) & ~PAGE_MASK)
+#define PTBL_MASK	((PDIR_SIZE - 1) & ~((1 << PAGE_SHIFT) - 1))
 #define PTBL_NENTRIES	1024			/* number of pages mapped by ptbl */
 
 /* Returns ptbl entry number for given va */

Modified: projects/ppc64/sys/powerpc/include/vmparam.h
==============================================================================
--- projects/ppc64/sys/powerpc/include/vmparam.h	Sat Mar 20 12:39:28 2010	(r205367)
+++ projects/ppc64/sys/powerpc/include/vmparam.h	Sat Mar 20 14:24:57 2010	(r205368)
@@ -88,6 +88,11 @@
 #define	VM_MAXUSER_ADDRESS	((vm_offset_t)0x7ffff000)
 #define	VM_MAX_ADDRESS		VM_MAXUSER_ADDRESS
 #endif
+#else /* LOCORE */
+#ifndef __powerpc64__
+#define	VM_MIN_ADDRESS		0
+#define	VM_MAXUSER_ADDRESS	0x7ffff000
+#endif
 #endif /* LOCORE */
 
 #define	FREEBSD32_USRSTACK	0x7ffff000

Modified: projects/ppc64/sys/powerpc/powerpc/exec_machdep.c
==============================================================================
--- projects/ppc64/sys/powerpc/powerpc/exec_machdep.c	Sat Mar 20 12:39:28 2010	(r205367)
+++ projects/ppc64/sys/powerpc/powerpc/exec_machdep.c	Sat Mar 20 14:24:57 2010	(r205368)
@@ -283,7 +283,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, 
 		    tf->cpu.aim.dar : tf->srr0;
 		#else
 		tf->fixreg[FIRSTARG+3] = (tf->exc == EXC_DSI) ? 
-		    tf->cpu.booke.dear : tf->srr0);
+		    tf->cpu.booke.dear : tf->srr0;
 		#endif
 	}
 	mtx_unlock(&psp->ps_mtx);
@@ -381,6 +381,7 @@ grab_mcontext(struct thread *td, mcontex
 		mcp->mc_gpr[4] = 0;
 	}
 
+#ifdef AIM
 	/*
 	 * This assumes that floating-point context is *not* lazy,
 	 * so if the thread has used FP there would have been a
@@ -413,6 +414,7 @@ grab_mcontext(struct thread *td, mcontex
 		mcp->mc_vrsave =  pcb->pcb_vec.vrsave;
 		memcpy(mcp->mc_avec, pcb->pcb_vec.vr, sizeof(mcp->mc_avec));
 	}
+#endif
 
 	mcp->mc_len = sizeof(*mcp);
 
@@ -457,6 +459,7 @@ set_mcontext(struct thread *td, const mc
 
 	memcpy(tf, mcp->mc_frame, sizeof(mcp->mc_frame));
 
+#ifdef AIM
 	if (mcp->mc_flags & _MC_FP_VALID) {
 		if ((pcb->pcb_flags & PCB_FPU) != PCB_FPU) {
 			critical_enter();
@@ -477,7 +480,7 @@ set_mcontext(struct thread *td, const mc
 		pcb->pcb_vec.vrsave = mcp->mc_vrsave;
 		memcpy(pcb->pcb_vec.vr, mcp->mc_avec, sizeof(mcp->mc_avec));
 	}
-
+#endif
 
 	return (0);
 }
@@ -550,10 +553,10 @@ exec_setregs(struct thread *td, struct i
 	tf->srr0 = entry_desc[0] + imgp->reloc_base;
 	tf->fixreg[2] = entry_desc[1] + imgp->reloc_base;
 	tf->fixreg[11] = entry_desc[2] + imgp->reloc_base;
-	tf->srr1 = PSL_SF | PSL_MBO | PSL_USERSET | PSL_FE_DFLT;
+	tf->srr1 = PSL_SF | PSL_USERSET | PSL_FE_DFLT;
 	#else
 	tf->srr0 = imgp->entry_addr;
-	tf->srr1 = PSL_MBO | PSL_USERSET | PSL_FE_DFLT;
+	tf->srr1 = PSL_USERSET | PSL_FE_DFLT;
 	#endif
 	td->td_pcb->pcb_flags = 0;
 }
@@ -641,12 +644,14 @@ set_dbregs(struct thread *td, struct dbr
 int
 set_fpregs(struct thread *td, struct fpreg *fpregs)
 {
+#ifdef AIM
 	struct pcb *pcb;
 
 	pcb = td->td_pcb;
 	if ((pcb->pcb_flags & PCB_FPU) == 0)
 		enable_fpu(td);
 	memcpy(&pcb->pcb_fpu, fpregs, sizeof(struct fpreg));
+#endif
 
 	return (0);
 }


More information about the svn-src-projects mailing list