summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2001-08-10 04:36:00 +0000
committerjake <jake@FreeBSD.org>2001-08-10 04:36:00 +0000
commit557d27322d077e80c52c8d3664ea683529aae756 (patch)
treeef15d269bd0d5d6a64b16fbbd3d01c7be19271ca
parente2dd4bc23256d00b7915afd4ac08fe46d7038d95 (diff)
downloadFreeBSD-src-557d27322d077e80c52c8d3664ea683529aae756.zip
FreeBSD-src-557d27322d077e80c52c8d3664ea683529aae756.tar.gz
1. Start the clock running early for testing.
2. Use the upcoming "tick" interface. 3. Save a call frame as well as a trap frame on proc0's initial stack. 4. Setup a pointer to the per-cpu interrupt queue. 5. Install the per-cpu pointer in interrupt and alternate globals as well. 6. Flush out setregs so exec works. Submitted by: tmm (3, 5, 6)
-rw-r--r--sys/sparc64/sparc64/machdep.c50
1 files changed, 43 insertions, 7 deletions
diff --git a/sys/sparc64/sparc64/machdep.c b/sys/sparc64/sparc64/machdep.c
index b0f1f3e..744999b 100644
--- a/sys/sparc64/sparc64/machdep.c
+++ b/sys/sparc64/sparc64/machdep.c
@@ -59,11 +59,14 @@
#include <ddb/ddb.h>
#include <machine/bootinfo.h>
+#include <machine/clock.h>
#include <machine/frame.h>
+#include <machine/intr_machdep.h>
#include <machine/md_var.h>
#include <machine/pmap.h>
#include <machine/pstate.h>
#include <machine/reg.h>
+#include <machine/tick.h>
typedef int ofw_vec_t(void *);
@@ -245,6 +248,7 @@ again:
globaldata_register(globaldata);
+ tick_start(clock, tick_hardclock);
}
unsigned
@@ -257,6 +261,7 @@ void
sparc64_init(struct bootinfo *bi, ofw_vec_t *vec)
{
struct trapframe *tf;
+ u_long ps;
/*
* Initialize openfirmware (needed for console).
@@ -277,6 +282,9 @@ sparc64_init(struct bootinfo *bi, ofw_vec_t *vec)
panic("sparc64_init: no loader metadata");
preload_metadata = (caddr_t)bi->bi_metadata;
+ /*
+ * Initialize tunables.
+ */
init_param();
#ifdef DDB
@@ -289,10 +297,9 @@ sparc64_init(struct bootinfo *bi, ofw_vec_t *vec)
pmap_bootstrap(bi->bi_kpa, bi->bi_end);
/*
- * XXX Clear tick and disable the comparator.
+ * Disable tick for now.
*/
- wrpr(tick, 0, 0);
- wr(asr23, 1L << 63, 0);
+ tick_stop();
/*
* Force trap level 1 and take over the trap table.
@@ -306,7 +313,9 @@ sparc64_init(struct bootinfo *bi, ofw_vec_t *vec)
LIST_INIT(&proc0.p_contested);
proc0paddr = (struct user *)user0;
proc0.p_addr = (struct user *)user0;
- tf = (struct trapframe *)(user0 + UPAGES * PAGE_SIZE - sizeof(*tf));
+ proc0.p_stats = &proc0.p_addr->u_stats;
+ tf = (struct trapframe *)(user0 + UPAGES * PAGE_SIZE -
+ sizeof(struct frame) - sizeof(*tf));
proc0.p_frame = tf;
tf->tf_tstate = 0;
@@ -316,6 +325,24 @@ sparc64_init(struct bootinfo *bi, ofw_vec_t *vec)
globaldata = &__globaldata;
/*
+ * Setup pointers to interrupt data tables.
+ */
+ globaldata->gd_iq = &intr_queues[0]; /* XXX cpuno */
+ globaldata->gd_ivt = intr_vectors;
+
+ /*
+ * Put the globaldata pointer in the alternate and interrupt %g7 also.
+ * globaldata is tied to %g7. We could therefore also use assignments to
+ * globaldata here.
+ */
+ ps = rdpr(pstate);
+ wrpr(pstate, ps, PSTATE_AG);
+ __asm __volatile("mov %0, %%g7" : : "r" (&__globaldata));
+ wrpr(pstate, ps, PSTATE_IG);
+ __asm __volatile("mov %0, %%g7" : : "r" (&__globaldata));
+ wrpr(pstate, ps, 0);
+
+ /*
* Initialize curproc so that mutexes work.
*/
PCPU_SET(curproc, &proc0);
@@ -381,15 +408,24 @@ ptrace_single_step(struct proc *p)
void
setregs(struct proc *p, u_long entry, u_long stack, u_long ps_strings)
{
+ struct frame *fp;
struct pcb *pcb;
pcb = &p->p_addr->u_pcb;
+ /* The inital window for the process. */
+ fp = (struct frame *)((caddr_t)p->p_addr + UPAGES * PAGE_SIZE) - 1;
+ /* Make sure the frames that are frobbed are actually flushed. */
+ __asm __volatile("flushw");
mtx_lock_spin(&sched_lock);
+ fp = (struct frame *)((caddr_t)p->p_addr + UPAGES * PAGE_SIZE) - 1;
fp_init_pcb(pcb);
- /* XXX */
- p->p_frame->tf_tstate &= ~TSTATE_PEF;
+ /* Setup state in the trap frame. */
+ p->p_frame->tf_tstate = 0;
+ p->p_frame->tf_tpc = entry;
+ p->p_frame->tf_tnpc = entry + 4;
+ /* Set up user stack. */
+ fp->f_fp = stack - SPOFF;
mtx_unlock_spin(&sched_lock);
- TODO;
}
void
OpenPOWER on IntegriCloud