Page MenuHomeFreeBSD

D35378.id106532.diff
No OneTemporary

D35378.id106532.diff

Index: sys/arm64/arm64/db_trace.c
===================================================================
--- sys/arm64/arm64/db_trace.c
+++ sys/arm64/arm64/db_trace.c
@@ -145,7 +145,7 @@
ctx = kdb_thr_ctx(thr);
frame.fp = (uintptr_t)ctx->pcb_x[PCB_FP];
- frame.pc = (uintptr_t)ctx->pcb_lr;
+ frame.pc = (uintptr_t)ctx->pcb_x[PCB_LR];
db_stack_trace_cmd(thr, &frame);
} else
db_trace_self();
Index: sys/arm64/arm64/gdb_machdep.c
===================================================================
--- sys/arm64/arm64/gdb_machdep.c
+++ sys/arm64/arm64/gdb_machdep.c
@@ -60,10 +60,10 @@
switch (regnum) {
case GDB_REG_SP: return (&kdb_thrctx->pcb_sp);
case GDB_REG_PC: /* FALLTHROUGH */
- case GDB_REG_LR: return (&kdb_thrctx->pcb_lr);
+ case GDB_REG_LR: return (&kdb_thrctx->pcb_x[PCB_LR]);
default:
- if (regnum >= GDB_REG_X0 && regnum <= GDB_REG_X29)
- return (&kdb_thrctx->pcb_x[regnum]);
+ if (regnum >= GDB_REG_X19 && regnum <= GDB_REG_X29)
+ return (&kdb_thrctx->pcb_x[regnum - GDB_REG_X19]);
break;
}
@@ -89,11 +89,11 @@
}
switch (regnum) {
case GDB_REG_PC: /* FALLTHROUGH */
- case GDB_REG_LR: kdb_thrctx->pcb_lr = regval; break;
+ case GDB_REG_LR: kdb_thrctx->pcb_x[PCB_LR] = regval; break;
case GDB_REG_SP: kdb_thrctx->pcb_sp = regval; break;
default:
- if (regnum >= GDB_REG_X0 && regnum <= GDB_REG_X29) {
- kdb_thrctx->pcb_x[regnum] = regval;
+ if (regnum >= GDB_REG_X19 && regnum <= GDB_REG_X29) {
+ kdb_thrctx->pcb_x[regnum - GDB_REG_X19] = regval;
}
break;
}
Index: sys/arm64/arm64/genassym.c
===================================================================
--- sys/arm64/arm64/genassym.c
+++ sys/arm64/arm64/genassym.c
@@ -60,7 +60,6 @@
ASSYM(PCB_SIZE, roundup2(sizeof(struct pcb), STACKALIGNBYTES + 1));
ASSYM(PCB_SINGLE_STEP_SHIFT, PCB_SINGLE_STEP_SHIFT);
ASSYM(PCB_REGS, offsetof(struct pcb, pcb_x));
-ASSYM(PCB_LR, offsetof(struct pcb, pcb_lr));
ASSYM(PCB_SP, offsetof(struct pcb, pcb_sp));
ASSYM(PCB_TPIDRRO, offsetof(struct pcb, pcb_tpidrro_el0));
ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault));
Index: sys/arm64/arm64/machdep.c
===================================================================
--- sys/arm64/arm64/machdep.c
+++ sys/arm64/arm64/machdep.c
@@ -347,10 +347,10 @@
int i;
for (i = 0; i < nitems(pcb->pcb_x); i++)
- pcb->pcb_x[i] = tf->tf_x[i];
+ pcb->pcb_x[i] = tf->tf_x[i + PCB_X_START];
- /* NB: pcb_lr is the PC, see PC_REGS() in db_machdep.h */
- pcb->pcb_lr = tf->tf_elr;
+ /* NB: pcb_x[PCB_LR] is the PC, see PC_REGS() in db_machdep.h */
+ pcb->pcb_x[PCB_LR] = tf->tf_elr;
pcb->pcb_sp = tf->tf_sp;
}
Index: sys/arm64/arm64/stack_machdep.c
===================================================================
--- sys/arm64/arm64/stack_machdep.c
+++ sys/arm64/arm64/stack_machdep.c
@@ -69,7 +69,7 @@
return (EOPNOTSUPP);
frame.fp = td->td_pcb->pcb_x[PCB_FP];
- frame.pc = ADDR_MAKE_CANONICAL(td->td_pcb->pcb_lr);
+ frame.pc = ADDR_MAKE_CANONICAL(td->td_pcb->pcb_x[PCB_LR]);
stack_capture(td, st, &frame);
return (0);
Index: sys/arm64/arm64/swtch.S
===================================================================
--- sys/arm64/arm64/swtch.S
+++ sys/arm64/arm64/swtch.S
@@ -94,12 +94,12 @@
msr tpidr_el0, x6
ldr x6, [x4, #PCB_TPIDRRO]
msr tpidrro_el0, x6
- ldp x19, x20, [x4, #PCB_REGS + 19 * 8]
- ldp x21, x22, [x4, #PCB_REGS + 21 * 8]
- ldp x23, x24, [x4, #PCB_REGS + 23 * 8]
- ldp x25, x26, [x4, #PCB_REGS + 25 * 8]
- ldp x27, x28, [x4, #PCB_REGS + 27 * 8]
- ldp x29, lr, [x4, #PCB_REGS + 29 * 8]
+ ldp x19, x20, [x4, #PCB_REGS + 0 * 8]
+ ldp x21, x22, [x4, #PCB_REGS + 2 * 8]
+ ldp x23, x24, [x4, #PCB_REGS + 4 * 8]
+ ldp x25, x26, [x4, #PCB_REGS + 6 * 8]
+ ldp x27, x28, [x4, #PCB_REGS + 8 * 8]
+ ldp x29, lr, [x4, #PCB_REGS + 10 * 8]
ret
END(cpu_throw)
@@ -119,12 +119,12 @@
ldr x4, [x0, #TD_PCB]
/* Store the callee-saved registers */
- stp x19, x20, [x4, #PCB_REGS + 19 * 8]
- stp x21, x22, [x4, #PCB_REGS + 21 * 8]
- stp x23, x24, [x4, #PCB_REGS + 23 * 8]
- stp x25, x26, [x4, #PCB_REGS + 25 * 8]
- stp x27, x28, [x4, #PCB_REGS + 27 * 8]
- stp x29, lr, [x4, #PCB_REGS + 29 * 8]
+ stp x19, x20, [x4, #PCB_REGS + 0 * 8]
+ stp x21, x22, [x4, #PCB_REGS + 2 * 8]
+ stp x23, x24, [x4, #PCB_REGS + 4 * 8]
+ stp x25, x26, [x4, #PCB_REGS + 6 * 8]
+ stp x27, x28, [x4, #PCB_REGS + 8 * 8]
+ stp x29, lr, [x4, #PCB_REGS + 10 * 8]
/* And the old stack pointer */
mov x5, sp
mrs x6, tpidrro_el0
@@ -183,14 +183,12 @@
msr tpidr_el0, x6
ldr x6, [x4, #PCB_TPIDRRO]
msr tpidrro_el0, x6
- ldp x19, x20, [x4, #PCB_REGS + 19 * 8]
- ldp x21, x22, [x4, #PCB_REGS + 21 * 8]
- ldp x23, x24, [x4, #PCB_REGS + 23 * 8]
- ldp x25, x26, [x4, #PCB_REGS + 25 * 8]
- ldp x27, x28, [x4, #PCB_REGS + 27 * 8]
- ldp x29, lr, [x4, #PCB_REGS + 29 * 8]
-
- str xzr, [x4, #PCB_REGS + 18 * 8]
+ ldp x19, x20, [x4, #PCB_REGS + 0 * 8]
+ ldp x21, x22, [x4, #PCB_REGS + 2 * 8]
+ ldp x23, x24, [x4, #PCB_REGS + 4 * 8]
+ ldp x25, x26, [x4, #PCB_REGS + 6 * 8]
+ ldp x27, x28, [x4, #PCB_REGS + 8 * 8]
+ ldp x29, lr, [x4, #PCB_REGS + 10 * 8]
ret
END(cpu_switch)
@@ -245,12 +243,12 @@
ENTRY(savectx)
/* Store the callee-saved registers */
- stp x19, x20, [x0, #PCB_REGS + 19 * 8]
- stp x21, x22, [x0, #PCB_REGS + 21 * 8]
- stp x23, x24, [x0, #PCB_REGS + 23 * 8]
- stp x25, x26, [x0, #PCB_REGS + 25 * 8]
- stp x27, x28, [x0, #PCB_REGS + 27 * 8]
- stp x29, lr, [x0, #PCB_REGS + 29 * 8]
+ stp x19, x20, [x0, #PCB_REGS + 0 * 8]
+ stp x21, x22, [x0, #PCB_REGS + 2 * 8]
+ stp x23, x24, [x0, #PCB_REGS + 4 * 8]
+ stp x25, x26, [x0, #PCB_REGS + 6 * 8]
+ stp x27, x28, [x0, #PCB_REGS + 8 * 8]
+ stp x29, lr, [x0, #PCB_REGS + 10 * 8]
/* And the old stack pointer */
mov x5, sp
mrs x6, tpidrro_el0
Index: sys/arm64/arm64/vm_machdep.c
===================================================================
--- sys/arm64/arm64/vm_machdep.c
+++ sys/arm64/arm64/vm_machdep.c
@@ -107,7 +107,7 @@
/* Set the return value registers for fork() */
td2->td_pcb->pcb_x[PCB_X19] = (uintptr_t)fork_return;
td2->td_pcb->pcb_x[PCB_X20] = (uintptr_t)td2;
- td2->td_pcb->pcb_lr = (uintptr_t)fork_trampoline;
+ td2->td_pcb->pcb_x[PCB_LR] = (uintptr_t)fork_trampoline;
td2->td_pcb->pcb_sp = (uintptr_t)td2->td_frame;
td2->td_pcb->pcb_fpusaved = &td2->td_pcb->pcb_fpustate;
td2->td_pcb->pcb_vfpcpu = UINT_MAX;
@@ -185,7 +185,7 @@
td->td_pcb->pcb_x[PCB_X19] = (uintptr_t)fork_return;
td->td_pcb->pcb_x[PCB_X20] = (uintptr_t)td;
- td->td_pcb->pcb_lr = (uintptr_t)fork_trampoline;
+ td->td_pcb->pcb_x[PCB_LR] = (uintptr_t)fork_trampoline;
td->td_pcb->pcb_sp = (uintptr_t)td->td_frame;
td->td_pcb->pcb_fpflags &= ~(PCB_FP_STARTED | PCB_FP_KERN | PCB_FP_NOSAVE);
td->td_pcb->pcb_fpusaved = &td->td_pcb->pcb_fpustate;
Index: sys/arm64/include/db_machdep.h
===================================================================
--- sys/arm64/include/db_machdep.h
+++ sys/arm64/include/db_machdep.h
@@ -44,7 +44,7 @@
typedef vm_offset_t db_addr_t;
typedef long db_expr_t;
-#define PC_REGS() ((db_addr_t)kdb_thrctx->pcb_lr)
+#define PC_REGS() ((db_addr_t)kdb_thrctx->pcb_x[PCB_LR])
#define BKPT_INST (0xd4200000)
#define BKPT_SIZE (4)
@@ -52,7 +52,7 @@
#define BKPT_SKIP do { \
kdb_frame->tf_elr += BKPT_SIZE; \
- kdb_thrctx->pcb_lr += BKPT_SIZE; \
+ kdb_thrctx->pcb_x[PCB_LR] += BKPT_SIZE; \
} while (0)
#define db_clear_single_step kdb_cpu_clear_singlestep
Index: sys/arm64/include/gdb_machdep.h
===================================================================
--- sys/arm64/include/gdb_machdep.h
+++ sys/arm64/include/gdb_machdep.h
@@ -34,6 +34,7 @@
#define GDB_BUFSZ 4096
#define GDB_NREGS 68
#define GDB_REG_X0 0
+#define GDB_REG_X19 19
#define GDB_REG_X29 29
#define GDB_REG_LR 30
#define GDB_REG_SP 31
Index: sys/arm64/include/pcb.h
===================================================================
--- sys/arm64/include/pcb.h
+++ sys/arm64/include/pcb.h
@@ -36,14 +36,16 @@
struct trapframe;
-#define PCB_X19 19
-#define PCB_X20 20
-#define PCB_FP 29
+/* The first register in pcb_x is x19 */
+#define PCB_X_START 19
+
+#define PCB_X19 0
+#define PCB_X20 1
+#define PCB_FP 10
+#define PCB_LR 11
struct pcb {
- uint64_t pcb_x[30];
- uint64_t pcb_lr;
- uint64_t _reserved; /* Was pcb_pc */
+ uint64_t pcb_x[12];
/* These two need to be in order as we access them together */
uint64_t pcb_sp;
uint64_t pcb_tpidr_el0;
Index: sys/sys/param.h
===================================================================
--- sys/sys/param.h
+++ sys/sys/param.h
@@ -76,7 +76,7 @@
* cannot include sys/param.h and should only be updated here.
*/
#undef __FreeBSD_version
-#define __FreeBSD_version 1400059
+#define __FreeBSD_version 1400060
/*
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,

File Metadata

Mime Type
text/plain
Expires
Tue, Feb 17, 12:11 PM (2 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28813248
Default Alt Text
D35378.id106532.diff (8 KB)

Event Timeline