PERFORCE change 136055 for review
Marcel Moolenaar
marcel at FreeBSD.org
Sun Feb 24 01:21:18 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=136055
Change 136055 by marcel at marcel_xcllnt on 2008/02/24 01:20:18
Unify <machine/pcb.h>
o Move the FAULTBUF_* defines to booke/trap.c.
That's the only place they're used.
o Make the faultbuf 25 registers big for all CPUs.
o Put CPU-specific fields in a union, like what
is from for <machine/frame.h>
o Remove pcb_pmreal for AIM. It's not used. As such,
the PCB doesn't change size due to the union.
Affected files ...
.. //depot/projects/e500/sys/powerpc/aim/swtch.S#4 edit
.. //depot/projects/e500/sys/powerpc/aim/vm_machdep.c#8 edit
.. //depot/projects/e500/sys/powerpc/booke/swtch.S#2 edit
.. //depot/projects/e500/sys/powerpc/booke/trap.c#5 edit
.. //depot/projects/e500/sys/powerpc/include/pcb.h#4 edit
.. //depot/projects/e500/sys/powerpc/powerpc/genassym.c#5 edit
Differences ...
==== //depot/projects/e500/sys/powerpc/aim/swtch.S#4 (text+ko) ====
@@ -88,7 +88,7 @@
stw %r16,PCB_LR(%r5)
mfsr %r16,USER_SR /* Save USER_SR for copyin/out */
isync
- stw %r16,PCB_USR(%r5)
+ stw %r16,PCB_AIM_USR(%r5)
stw %r1,PCB_SP(%r5) /* Save the stack pointer */
mr %r14,%r3 /* Copy the old thread ptr... */
@@ -125,7 +125,7 @@
mtcr %r5
lwz %r5,PCB_LR(%r3) /* Load the link register */
mtlr %r5
- lwz %r5,PCB_USR(%r3) /* Load the USER_SR segment reg */
+ lwz %r5,PCB_AIM_USR(%r3) /* Load the USER_SR segment reg */
mtsr USER_SR,%r5
isync
lwz %r1,PCB_SP(%r3) /* Load the stack pointer */
==== //depot/projects/e500/sys/powerpc/aim/vm_machdep.c#8 (text+ko) ====
@@ -152,7 +152,7 @@
pcb->pcb_sp = (register_t)cf;
pcb->pcb_lr = (register_t)fork_trampoline;
- pcb->pcb_usr = kernel_pmap->pm_sr[USER_SR];
+ pcb->pcb_cpu.aim.usr = kernel_pmap->pm_sr[USER_SR];
/* Setup to release spin count in fork_exit(). */
td2->td_md.md_spinlock_count = 1;
@@ -330,7 +330,7 @@
pcb2->pcb_sp = (register_t)cf;
pcb2->pcb_lr = (register_t)fork_trampoline;
- pcb2->pcb_usr = kernel_pmap->pm_sr[USER_SR];
+ pcb2->pcb_cpu.aim.usr = kernel_pmap->pm_sr[USER_SR];
/* Setup to release spin count in fork_exit(). */
td->td_md.md_spinlock_count = 1;
==== //depot/projects/e500/sys/powerpc/booke/swtch.S#2 (text+ko) ====
@@ -82,9 +82,9 @@
mflr %r16 /* Save the link register */
stw %r16, PCB_LR(%r5)
mfctr %r16
- stw %r16, PCB_CTR(%r5)
+ stw %r16, PCB_BOOKE_CTR(%r5)
mfxer %r16
- stw %r16, PCB_XER(%r5)
+ stw %r16, PCB_BOOKE_XER(%r5)
stw %r1, PCB_SP(%r5) /* Save the stack pointer */
@@ -108,9 +108,9 @@
mtcr %r5
lwz %r5, PCB_LR(%r3) /* Load the link register */
mtlr %r5
- lwz %r5, PCB_CTR(%r3)
+ lwz %r5, PCB_BOOKE_CTR(%r3)
mtctr %r5
- lwz %r5, PCB_XER(%r3)
+ lwz %r5, PCB_BOOKE_XER(%r3)
mtxer %r5
lwz %r1, PCB_SP(%r3) /* Load the stack pointer */
==== //depot/projects/e500/sys/powerpc/booke/trap.c#5 (text+ko) ====
@@ -79,6 +79,14 @@
#include <powerpc/fpu/fpu_extern.h>
#endif
+#define FAULTBUF_LR 0
+#define FAULTBUF_R1 1
+#define FAULTBUF_R2 2
+#define FAULTBUF_CR 3
+#define FAULTBUF_CTR 4
+#define FAULTBUF_XER 5
+#define FAULTBUF_R13 6
+
void trap(struct trapframe *);
static void trap_fatal(struct trapframe *frame);
==== //depot/projects/e500/sys/powerpc/include/pcb.h#4 (text+ko) ====
@@ -35,38 +35,14 @@
#ifndef _MACHINE_PCB_H_
#define _MACHINE_PCB_H_
-#if defined(AIM)
-
-typedef int faultbuf[23];
-
-#else
-
-#define FAULTBUF_LR 0
-#define FAULTBUF_R1 1
-#define FAULTBUF_R2 2
-#define FAULTBUF_CR 3
-#define FAULTBUF_CTR 4
-#define FAULTBUF_XER 5
-#define FAULTBUF_R13 6
typedef int faultbuf[25];
-#endif
-
struct pcb {
register_t pcb_context[20]; /* non-volatile r14-r31 */
register_t pcb_cr; /* Condition register */
register_t pcb_sp; /* stack pointer */
register_t pcb_lr; /* link register */
-#if defined(AIM)
- register_t pcb_usr; /* USER_SR segment register */
-#else
- register_t pcb_ctr;
- register_t pcb_xer;
-#endif
struct pmap *pcb_pm; /* pmap of our vmspace */
-#if defined(AIM)
- struct pmap *pcb_pmreal; /* real address of above */
-#endif
faultbuf *pcb_onfault; /* For use during
copyin/copyout */
int pcb_flags;
@@ -77,6 +53,16 @@
} pcb_fpu; /* Floating point processor */
unsigned int pcb_fpcpu; /* which CPU had our FPU
stuff. */
+
+ union {
+ struct {
+ register_t usr; /* USER_SR segment */
+ } aim;
+ struct {
+ register_t ctr;
+ register_t xer;
+ } booke;
+ } pcb_cpu;
};
#ifdef _KERNEL
==== //depot/projects/e500/sys/powerpc/powerpc/genassym.c#5 (text+ko) ====
@@ -173,23 +173,15 @@
ASSYM(PCB_CONTEXT, offsetof(struct pcb, pcb_context));
ASSYM(PCB_CR, offsetof(struct pcb, pcb_cr));
-#if defined(E500)
-ASSYM(PCB_CTR, offsetof(struct pcb, pcb_ctr));
-ASSYM(PCB_XER, offsetof(struct pcb, pcb_xer));
-#endif
-#if defined(AIM)
-ASSYM(PCB_PMR, offsetof(struct pcb, pcb_pmreal));
-#endif
ASSYM(PCB_SP, offsetof(struct pcb, pcb_sp));
ASSYM(PCB_LR, offsetof(struct pcb, pcb_lr));
-#if defined(AIM)
-ASSYM(PCB_USR, offsetof(struct pcb, pcb_usr));
-#endif
ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault));
ASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags));
-#if defined(AIM)
ASSYM(PCB_FPU, PCB_FPU);
-#endif
+
+ASSYM(PCB_AIM_USR, offsetof(struct pcb, pcb_cpu.aim.usr));
+ASSYM(PCB_BOOKE_CTR, offsetof(struct pcb, pcb_cpu.booke.ctr));
+ASSYM(PCB_BOOKE_XER, offsetof(struct pcb, pcb_cpu.booke.xer));
ASSYM(TD_LOCK, offsetof(struct thread, td_lock));
ASSYM(TD_PROC, offsetof(struct thread, td_proc));
More information about the p4-projects
mailing list