Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153947037
D27720.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D27720.diff
View Options
diff --git a/sys/arm64/arm64/db_trace.c b/sys/arm64/arm64/db_trace.c
--- a/sys/arm64/arm64/db_trace.c
+++ b/sys/arm64/arm64/db_trace.c
@@ -109,7 +109,7 @@
frame.sp = (uintptr_t)ctx->pcb_sp;
frame.fp = (uintptr_t)ctx->pcb_x[29];
- frame.pc = (uintptr_t)ctx->pcb_x[30];
+ frame.pc = (uintptr_t)ctx->pcb_lr;
db_stack_trace_cmd(thr, &frame);
} else
db_trace_self();
diff --git a/sys/arm64/arm64/exception.S b/sys/arm64/arm64/exception.S
--- a/sys/arm64/arm64/exception.S
+++ b/sys/arm64/arm64/exception.S
@@ -39,7 +39,7 @@
sub sp, sp, #128
.endif
sub sp, sp, #(TF_SIZE + 16)
- stp x29, x30, [sp, #(TF_SIZE)]
+ stp x29, lr, [sp, #(TF_SIZE)]
stp x28, x29, [sp, #(TF_X + 28 * 8)]
stp x26, x27, [sp, #(TF_X + 26 * 8)]
stp x24, x25, [sp, #(TF_X + 24 * 8)]
diff --git a/sys/arm64/arm64/genassym.c b/sys/arm64/arm64/genassym.c
--- a/sys/arm64/arm64/genassym.c
+++ b/sys/arm64/arm64/genassym.c
@@ -60,6 +60,7 @@
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));
diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c
--- a/sys/arm64/arm64/machdep.c
+++ b/sys/arm64/arm64/machdep.c
@@ -732,11 +732,11 @@
{
int i;
- for (i = 0; i < PCB_LR; i++)
+ for (i = 0; i < nitems(pcb->pcb_x); i++)
pcb->pcb_x[i] = tf->tf_x[i];
- pcb->pcb_x[PCB_LR] = tf->tf_lr;
- pcb->pcb_pc = tf->tf_elr;
+ /* NB: pcb_lr is the PC, see PC_REGS() in db_machdep.h */
+ pcb->pcb_lr = tf->tf_elr;
pcb->pcb_sp = tf->tf_sp;
}
diff --git a/sys/arm64/arm64/stack_machdep.c b/sys/arm64/arm64/stack_machdep.c
--- a/sys/arm64/arm64/stack_machdep.c
+++ b/sys/arm64/arm64/stack_machdep.c
@@ -71,7 +71,7 @@
frame.sp = td->td_pcb->pcb_sp;
frame.fp = td->td_pcb->pcb_x[29];
- frame.pc = td->td_pcb->pcb_x[30];
+ frame.pc = td->td_pcb->pcb_lr;
stack_capture(td, st, &frame);
return (0);
diff --git a/sys/arm64/arm64/swtch.S b/sys/arm64/arm64/swtch.S
--- a/sys/arm64/arm64/swtch.S
+++ b/sys/arm64/arm64/swtch.S
@@ -101,7 +101,7 @@
ldp x24, x25, [x4, #PCB_REGS + 24 * 8]
ldp x26, x27, [x4, #PCB_REGS + 26 * 8]
ldp x28, x29, [x4, #PCB_REGS + 28 * 8]
- ldr x30, [x4, #PCB_REGS + 30 * 8]
+ ldr lr, [x4, #PCB_LR]
ret
END(cpu_throw)
@@ -132,7 +132,7 @@
stp x24, x25, [x4, #PCB_REGS + 24 * 8]
stp x26, x27, [x4, #PCB_REGS + 26 * 8]
stp x28, x29, [x4, #PCB_REGS + 28 * 8]
- str x30, [x4, #PCB_REGS + 30 * 8]
+ str lr, [x4, #PCB_LR]
/* And the old stack pointer */
mov x5, sp
mrs x6, tpidrro_el0
@@ -198,7 +198,7 @@
ldp x24, x25, [x4, #PCB_REGS + 24 * 8]
ldp x26, x27, [x4, #PCB_REGS + 26 * 8]
ldp x28, x29, [x4, #PCB_REGS + 28 * 8]
- ldr x30, [x4, #PCB_REGS + 30 * 8]
+ ldr lr, [x4, #PCB_LR]
str xzr, [x4, #PCB_REGS + 18 * 8]
ret
@@ -270,7 +270,7 @@
stp x24, x25, [x0, #PCB_REGS + 24 * 8]
stp x26, x27, [x0, #PCB_REGS + 26 * 8]
stp x28, x29, [x0, #PCB_REGS + 28 * 8]
- str x30, [x0, #PCB_REGS + 30 * 8]
+ str lr, [x0, #PCB_LR]
/* And the old stack pointer */
mov x5, sp
mrs x6, tpidrro_el0
diff --git a/sys/arm64/arm64/vm_machdep.c b/sys/arm64/arm64/vm_machdep.c
--- a/sys/arm64/arm64/vm_machdep.c
+++ b/sys/arm64/arm64/vm_machdep.c
@@ -102,7 +102,7 @@
/* Set the return value registers for fork() */
td2->td_pcb->pcb_x[8] = (uintptr_t)fork_return;
td2->td_pcb->pcb_x[9] = (uintptr_t)td2;
- td2->td_pcb->pcb_x[PCB_LR] = (uintptr_t)fork_trampoline;
+ td2->td_pcb->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;
@@ -173,7 +173,7 @@
td->td_pcb->pcb_x[8] = (uintptr_t)fork_return;
td->td_pcb->pcb_x[9] = (uintptr_t)td;
- td->td_pcb->pcb_x[PCB_LR] = (uintptr_t)fork_trampoline;
+ td->td_pcb->pcb_lr = (uintptr_t)fork_trampoline;
td->td_pcb->pcb_sp = (uintptr_t)td->td_frame;
td->td_pcb->pcb_fpusaved = &td->td_pcb->pcb_fpustate;
td->td_pcb->pcb_vfpcpu = UINT_MAX;
@@ -265,7 +265,7 @@
td->td_pcb->pcb_x[8] = (uintptr_t)func;
td->td_pcb->pcb_x[9] = (uintptr_t)arg;
- td->td_pcb->pcb_x[PCB_LR] = (uintptr_t)fork_trampoline;
+ td->td_pcb->pcb_lr = (uintptr_t)fork_trampoline;
td->td_pcb->pcb_sp = (uintptr_t)td->td_frame;
td->td_pcb->pcb_fpusaved = &td->td_pcb->pcb_fpustate;
td->td_pcb->pcb_vfpcpu = UINT_MAX;
diff --git a/sys/arm64/include/db_machdep.h b/sys/arm64/include/db_machdep.h
--- a/sys/arm64/include/db_machdep.h
+++ b/sys/arm64/include/db_machdep.h
@@ -43,7 +43,7 @@
typedef vm_offset_t db_addr_t;
typedef long db_expr_t;
-#define PC_REGS() ((db_addr_t)kdb_thrctx->pcb_pc)
+#define PC_REGS() ((db_addr_t)kdb_thrctx->pcb_lr)
#define BKPT_INST (0xd4200000)
#define BKPT_SIZE (4)
diff --git a/sys/arm64/include/pcb.h b/sys/arm64/include/pcb.h
--- a/sys/arm64/include/pcb.h
+++ b/sys/arm64/include/pcb.h
@@ -36,10 +36,10 @@
struct trapframe;
-#define PCB_LR 30
struct pcb {
- uint64_t pcb_x[31];
- uint64_t pcb_pc;
+ uint64_t pcb_x[30];
+ uint64_t pcb_lr;
+ uint64_t _reserved; /* Was pcb_pc */
/* These two need to be in order as we access them together */
uint64_t pcb_sp;
uint64_t pcb_tpidr_el0;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 26, 12:36 AM (12 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32150646
Default Alt Text
D27720.diff (5 KB)
Attached To
Mode
D27720: arm64: remove pcb_pc
Attached
Detach File
Event Timeline
Log In to Comment