PERFORCE change 98502 for review
Kip Macy
kmacy at FreeBSD.org
Sun Jun 4 20:50:05 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=98502
Change 98502 by kmacy at kmacy_storage:sun4v_work on 2006/06/04 20:48:09
force pcpu to be 64-byte aligned
Affected files ...
.. //depot/projects/kmacy_sun4v/src/sys/sun4v/include/pcpu.h#14 edit
.. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/machdep.c#24 edit
Differences ...
==== //depot/projects/kmacy_sun4v/src/sys/sun4v/include/pcpu.h#14 (text+ko) ====
@@ -78,7 +78,8 @@
u_int pc_kwbuf_full; \
struct rwindow pc_tsbwbuf[2]; \
u_int pc_node; \
- uint16_t pc_cpulist[MAXCPU]
+ uint16_t pc_cpulist[MAXCPU]; \
+ uint64_t pad[6];
/* XXX SUN4V_FIXME - as we access the *_ra and *_size fields in quick
* succession we _really_ want them to be L1 cache line size aligned
==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/machdep.c#24 (text+ko) ====
@@ -181,6 +181,7 @@
CTASSERT(sizeof(struct pcb) <= ((KSTACK_PAGES * PAGE_SIZE) / 8));
CTASSERT(sizeof(struct pcpu) <= ((PCPU_PAGES * PAGE_SIZE) / 2));
+CTASSERT((sizeof(struct pcpu) & ((1<<6)-1)) == 0);
static void
cpu_startup(void *arg)
@@ -377,7 +378,9 @@
proc0.p_md.md_utrap = NULL;
frame0.tf_tstate = TSTATE_IE | TSTATE_PEF | TSTATE_PRIV;
thread0.td_frame = &frame0;
-
+ if ((u_long)thread0.td_frame & 0x3f) {
+ panic("unaligned frame0");
+ }
/*
* Prime our per-cpu data page for use. Note, we are using it for our
* stack, so don't pass the real size (PAGE_SIZE) to pcpu_init or
@@ -412,6 +415,11 @@
thread0.td_pcb = (struct pcb *)TLB_PHYS_TO_DIRECT(vtophys((vm_offset_t)thread0.td_pcb));
pc->pc_curpcb = thread0.td_pcb;
+ if (((thread0.td_pcb->pcb_kstack + SPOFF) & 0x3f) != 0) {
+ printf("unaligned stack pcb_kstack & 0x3f == 0x%lx\n",
+ ((thread0.td_pcb->pcb_kstack + SPOFF) & 0x3f));
+ }
+
/*
* Update PCPU_REG to point to direct address
* to support easy phys <-> virt translation in trap handler
@@ -697,10 +705,7 @@
#ifdef SMP
cpu_mp_shutdown();
#endif
-#ifdef notyet
-/* XXX SUN4V_FIXME */
- openfirmware_exit(args);
-#endif
+ OF_exit();
}
/* Get current clock frequency for the given cpu id. */
More information about the p4-projects
mailing list