summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/aim/vm_machdep.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/powerpc/aim/vm_machdep.c')
-rw-r--r--sys/powerpc/aim/vm_machdep.c112
1 files changed, 15 insertions, 97 deletions
diff --git a/sys/powerpc/aim/vm_machdep.c b/sys/powerpc/aim/vm_machdep.c
index 79209e5..11bdf09 100644
--- a/sys/powerpc/aim/vm_machdep.c
+++ b/sys/powerpc/aim/vm_machdep.c
@@ -84,7 +84,8 @@
#include <machine/cpu.h>
#include <machine/fpu.h>
#include <machine/md_var.h>
-#include <machine/prom.h>
+
+#include <dev/ofw/openfirm.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
@@ -122,99 +123,7 @@ cpu_fork(p1, p2, flags)
register struct proc *p1, *p2;
int flags;
{
- if ((flags & RFPROC) == 0)
- return;
-
- p2->p_md.md_tf = p1->p_md.md_tf;
- p2->p_md.md_flags = p1->p_md.md_flags & (MDP_FPUSED | MDP_UAC_MASK);
-
- /*
- * Cache the physical address of the pcb, so we can
- * swap to it easily.
- */
- p2->p_md.md_pcbpaddr = (void*)vtophys((vm_offset_t)&p2->p_addr->u_pcb);
-
- /*
- * Copy floating point state from the FP chip to the PCB
- * if this process has state stored there.
- */
- alpha_fpstate_save(p1, 0);
-
- /*
- * Copy pcb and stack from proc p1 to p2. We do this as
- * cheaply as possible, copying only the active part of the
- * stack. The stack and pcb need to agree. Make sure that the
- * new process has FEN disabled.
- */
- p2->p_addr->u_pcb = p1->p_addr->u_pcb;
- p2->p_addr->u_pcb.pcb_hw.apcb_usp = alpha_pal_rdusp();
- p2->p_addr->u_pcb.pcb_hw.apcb_flags &= ~ALPHA_PCB_FLAGS_FEN;
-
- /*
- * Set the floating point state.
- */
- if ((p2->p_addr->u_pcb.pcb_fp_control & IEEE_INHERIT) == 0) {
- p2->p_addr->u_pcb.pcb_fp_control = 0;
- p2->p_addr->u_pcb.pcb_fp.fpr_cr = (FPCR_DYN_NORMAL
- | FPCR_INVD | FPCR_DZED
- | FPCR_OVFD | FPCR_INED
- | FPCR_UNFD);
- }
-
- /*
- * Arrange for a non-local goto when the new process
- * is started, to resume here, returning nonzero from setjmp.
- */
-#ifdef DIAGNOSTIC
- alpha_fpstate_check(p1);
-#endif
-
- /*
- * create the child's kernel stack, from scratch.
- */
- {
- struct user *up = p2->p_addr;
- struct trapframe *p2tf;
-
- /*
- * Pick a stack pointer, leaving room for a trapframe;
- * copy trapframe from parent so return to user mode
- * will be to right address, with correct registers.
- */
- p2tf = p2->p_md.md_tf = (struct trapframe *)
- ((char *)p2->p_addr + USPACE - sizeof(struct trapframe));
- bcopy(p1->p_md.md_tf, p2->p_md.md_tf,
- sizeof(struct trapframe));
-
- /*
- * Set up return-value registers as fork() libc stub expects.
- */
- p2tf->tf_regs[FRAME_V0] = 0; /* child's pid (linux) */
- p2tf->tf_regs[FRAME_A3] = 0; /* no error */
- p2tf->tf_regs[FRAME_A4] = 1; /* is child (FreeBSD) */
-
- /*
- * Arrange for continuation at fork_return(), which
- * will return to exception_return(). Note that the child
- * process doesn't stay in the kernel for long!
- *
- * This is an inlined version of cpu_set_kpc.
- */
- up->u_pcb.pcb_hw.apcb_ksp = (u_int64_t)p2tf;
- up->u_pcb.pcb_context[0] =
- (u_int64_t)fork_return; /* s0: a0 */
- up->u_pcb.pcb_context[1] =
- (u_int64_t)exception_return; /* s1: ra */
- up->u_pcb.pcb_context[2] = (u_long) p2; /* s2: a1 */
- up->u_pcb.pcb_context[7] =
- (u_int64_t)fork_trampoline; /* ra: assembly magic */
-#ifdef SMP
- /*
- * We start off at a nesting level of 1 within the kernel.
- */
- p2->p_md.md_kernnest = 1;
-#endif
- }
+ /* XXX: coming soon... */
}
/*
@@ -233,8 +142,10 @@ cpu_set_fork_handler(p, func, arg)
* Note that the trap frame follows the args, so the function
* is really called like this: func(arg, frame);
*/
+#if 0 /* XXX */
p->p_addr->u_pcb.pcb_context[0] = (u_long) func;
p->p_addr->u_pcb.pcb_context[2] = (u_long) arg;
+#endif
}
/*
@@ -248,8 +159,6 @@ void
cpu_exit(p)
register struct proc *p;
{
- alpha_fpstate_drop(p);
-
PROC_LOCK(p);
mtx_lock_spin(&sched_lock);
mtx_unlock_flags(&Giant, MTX_NOSWITCH);
@@ -263,6 +172,7 @@ cpu_exit(p)
*/
p->p_stat = SZOMB;
+ mp_fixme("assumption: p_pptr won't change at this time");
wakeup(p->p_pptr);
PROC_UNLOCK_NOSWITCH(p);
@@ -390,7 +300,7 @@ vunmapbuf(bp)
void
cpu_reset()
{
- prom_halt(0);
+ OF_exit();
}
int
@@ -456,7 +366,13 @@ vm_page_zero_idle()
TAILQ_REMOVE(&vm_page_queues[m->queue].pl, m, pageq);
m->queue = PQ_NONE;
splx(s);
+#if 0
+ rel_mplock();
+#endif
pmap_zero_page(VM_PAGE_TO_PHYS(m));
+#if 0
+ get_mplock();
+#endif
(void)splvm();
vm_page_flag_set(m, PG_ZERO);
m->queue = PQ_FREE + m->pc;
@@ -480,8 +396,10 @@ vm_page_zero_idle()
void
swi_vm(void *dummy)
{
+#if 0 /* XXX: Don't have busdma stuff yet */
if (busdma_swi_pending != 0)
busdma_swi();
+#endif
}
/*
OpenPOWER on IntegriCloud