summaryrefslogtreecommitdiffstats
path: root/sys/sparc64
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2002-04-09 00:57:23 +0000
committerjake <jake@FreeBSD.org>2002-04-09 00:57:23 +0000
commita72383027f9b9ad014841ddaa655b3e88a334d64 (patch)
tree31040730963bcedd20d5bacad52b908dd6400403 /sys/sparc64
parentf33b3e275b665030b8d1dea54aa4c68384c4f3bb (diff)
downloadFreeBSD-src-a72383027f9b9ad014841ddaa655b3e88a334d64.zip
FreeBSD-src-a72383027f9b9ad014841ddaa655b3e88a334d64.tar.gz
Rename some fields in struct frame to be compatible with NetBSD/OpenBSD,
and add some compatibility defines. Add fields for ins and locals to struct reg also for the same reason; these aren't filled in yet because getting at those registers sucks and I'd rather not save them in the trapframe just for this. Reorder struct reg to be ABI compatible as well. Add needed include of machine/emul.h. This gets pmdb (poor man's debugger) from OpenBSD mostly compiling but it doesn't work yet :(
Diffstat (limited to 'sys/sparc64')
-rw-r--r--sys/sparc64/include/frame.h14
-rw-r--r--sys/sparc64/include/reg.h6
-rw-r--r--sys/sparc64/sparc64/emul.c5
-rw-r--r--sys/sparc64/sparc64/machdep.c21
-rw-r--r--sys/sparc64/sparc64/vm_machdep.c10
5 files changed, 33 insertions, 23 deletions
diff --git a/sys/sparc64/include/frame.h b/sys/sparc64/include/frame.h
index 13eb625..ca4cfc2 100644
--- a/sys/sparc64/include/frame.h
+++ b/sys/sparc64/include/frame.h
@@ -31,6 +31,7 @@
#define RW_SHIFT 7
#define SPOFF 2047
+#define BIAS SPOFF /* XXX - open/netbsd compat */
struct trapframe {
u_long tf_global[8];
@@ -62,12 +63,15 @@ struct clockframe {
};
struct frame {
- u_long f_local[8];
- u_long f_in[8];
- u_long f_pad[8];
+ u_long fr_local[8];
+ u_long fr_in[8];
+ u_long fr_pad[8];
};
-#define f_fp f_in[6]
-#define f_pc f_in[7]
+#define fr_arg fr_in
+#define fr_fp fr_in[6]
+#define fr_pc fr_in[7]
+
+#define v9next_frame(fp) ((struct frame *)(fp->fr_fp + BIAS))
/*
* Frame used for pcb_wscratch.
diff --git a/sys/sparc64/include/reg.h b/sys/sparc64/include/reg.h
index bc861d8..cb1a7f6 100644
--- a/sys/sparc64/include/reg.h
+++ b/sys/sparc64/include/reg.h
@@ -45,12 +45,14 @@
* Register set accessible via /proc/$pid/regs and PT_{SET,GET}REGS.
*/
struct reg {
- u_long r_global[8];
- u_long r_out[8];
u_long r_tstate;
u_long r_pc;
u_long r_npc;
u_int r_y;
+ u_long r_global[8];
+ u_long r_out[8];
+ u_long r_local[8];
+ u_long r_in[8];
};
/*
diff --git a/sys/sparc64/sparc64/emul.c b/sys/sparc64/sparc64/emul.c
index d77dc9d..5c163f1 100644
--- a/sys/sparc64/sparc64/emul.c
+++ b/sys/sparc64/sparc64/emul.c
@@ -33,6 +33,7 @@
#include <sys/sysctl.h>
#include <sys/systm.h>
+#include <machine/emul.h>
#include <machine/frame.h>
#include <machine/instr.h>
@@ -69,7 +70,7 @@ emul_fetch_reg(struct trapframe *tf, int reg, u_long *val)
* The in registers are immediately after the locals in
* the frame.
*/
- offs = offsetof(struct frame, f_local[reg - IREG_L0]);
+ offs = offsetof(struct frame, fr_local[reg - IREG_L0]);
return (copyin((void *)(tf->tf_sp + SPOFF + offs), val,
sizeof(*val)));
}
@@ -93,7 +94,7 @@ emul_store_reg(struct trapframe *tf, int reg, u_long val)
* The in registers are immediately after the locals in
* the frame.
*/
- offs = offsetof(struct frame, f_local[reg - IREG_L0]);
+ offs = offsetof(struct frame, fr_local[reg - IREG_L0]);
return (copyout(&val, (void *)(tf->tf_sp + SPOFF + offs),
sizeof(val)));
}
diff --git a/sys/sparc64/sparc64/machdep.c b/sys/sparc64/sparc64/machdep.c
index ccb6185..74f7d2f 100644
--- a/sys/sparc64/sparc64/machdep.c
+++ b/sys/sparc64/sparc64/machdep.c
@@ -427,7 +427,7 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
/* Copy the sigframe out to the user's stack. */
if (rwindow_save(td) != 0 || copyout(&sf, sfp, sizeof(*sfp)) != 0 ||
- suword(&fp->f_in[6], tf->tf_out[6]) != 0) {
+ suword(&fp->fr_in[6], tf->tf_out[6]) != 0) {
/*
* Something is wrong with the stack pointer.
* ...Kill the process.
@@ -637,12 +637,15 @@ fill_regs(struct thread *td, struct reg *regs)
struct trapframe *tf;
tf = td->td_frame;
- bcopy(tf->tf_global, regs->r_global, sizeof(tf->tf_global));
- bcopy(tf->tf_out, regs->r_out, sizeof(tf->tf_out));
- regs->r_npc = tf->tf_tnpc;
- regs->r_pc = tf->tf_tpc;
regs->r_tstate = tf->tf_tstate;
+ regs->r_pc = tf->tf_tpc;
+ regs->r_npc = tf->tf_tnpc;
regs->r_y = tf->tf_y;
+ bcopy(tf->tf_global, regs->r_global, sizeof(tf->tf_global));
+ bcopy(tf->tf_out, regs->r_out, sizeof(tf->tf_out));
+ /* XXX - these are a pain to get at */
+ bzero(regs->r_in, sizeof(regs->r_in));
+ bzero(regs->r_local, sizeof(regs->r_local));
return (0);
}
@@ -656,12 +659,12 @@ set_regs(struct thread *td, struct reg *regs)
return (EINVAL);
if (!TSTATE_SECURE(regs->r_tstate))
return (EINVAL);
- bcopy(regs->r_global, tf->tf_global, sizeof(regs->r_global));
- bcopy(regs->r_out, tf->tf_out, sizeof(regs->r_out));
- tf->tf_tnpc = regs->r_npc;
- tf->tf_tpc = regs->r_pc;
tf->tf_tstate = regs->r_tstate;
+ tf->tf_tpc = regs->r_pc;
+ tf->tf_tnpc = regs->r_npc;
tf->tf_y = regs->r_y;
+ bcopy(regs->r_global, tf->tf_global, sizeof(regs->r_global));
+ bcopy(regs->r_out, tf->tf_out, sizeof(regs->r_out));
return (0);
}
diff --git a/sys/sparc64/sparc64/vm_machdep.c b/sys/sparc64/sparc64/vm_machdep.c
index 414fec4..eb49c58 100644
--- a/sys/sparc64/sparc64/vm_machdep.c
+++ b/sys/sparc64/sparc64/vm_machdep.c
@@ -172,9 +172,9 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags)
td2->td_frame = tf;
fp = (struct frame *)tf - 1;
- fp->f_local[0] = (u_long)fork_return;
- fp->f_local[1] = (u_long)td2;
- fp->f_local[2] = (u_long)tf;
+ fp->fr_local[0] = (u_long)fork_return;
+ fp->fr_local[1] = (u_long)td2;
+ fp->fr_local[2] = (u_long)tf;
pcb2->pcb_fp = (u_long)fp - SPOFF;
pcb2->pcb_pc = (u_long)fork_trampoline - 8;
@@ -222,8 +222,8 @@ cpu_set_fork_handler(struct thread *td, void (*func)(void *), void *arg)
pcb = td->td_pcb;
fp = (struct frame *)(pcb->pcb_fp + SPOFF);
- fp->f_local[0] = (u_long)func;
- fp->f_local[1] = (u_long)arg;
+ fp->fr_local[0] = (u_long)func;
+ fp->fr_local[1] = (u_long)arg;
}
void
OpenPOWER on IntegriCloud