FreeBSD Bugzilla – Attachment 232594 Details for
Bug 262691
[patch] Save only callee-saved registers in pcb
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
swtch.S.diff (text/plain), 5.49 KB, created by
Dapeng Gao
on 2022-03-20 21:04:33 UTC
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Dapeng Gao
Created:
2022-03-20 21:04:33 UTC
Size:
5.49 KB
patch
obsolete
>diff --git a/sys/arm64/arm64/swtch.S b/sys/arm64/arm64/swtch.S >index 081bdfe881..0d1f1bc62d 100644 >--- a/sys/arm64/arm64/swtch.S >+++ b/sys/arm64/arm64/swtch.S >@@ -94,18 +94,12 @@ ENTRY(cpu_throw) > msr tpidr_el0, x6 > ldr x6, [x4, #PCB_TPIDRRO] > msr tpidrro_el0, x6 >- ldp x8, x9, [x4, #PCB_REGS + 8 * 8] >- ldp x10, x11, [x4, #PCB_REGS + 10 * 8] >- ldp x12, x13, [x4, #PCB_REGS + 12 * 8] >- ldp x14, x15, [x4, #PCB_REGS + 14 * 8] >- ldp x16, x17, [x4, #PCB_REGS + 16 * 8] >- ldr x19, [x4, #PCB_REGS + 19 * 8] >- ldp x20, x21, [x4, #PCB_REGS + 20 * 8] >- ldp x22, x23, [x4, #PCB_REGS + 22 * 8] >- 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 lr, [x4, #PCB_LR] >+ 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] > > ret > END(cpu_throw) >@@ -125,18 +119,12 @@ ENTRY(cpu_switch) > ldr x4, [x0, #TD_PCB] > > /* Store the callee-saved registers */ >- stp x8, x9, [x4, #PCB_REGS + 8 * 8] >- stp x10, x11, [x4, #PCB_REGS + 10 * 8] >- stp x12, x13, [x4, #PCB_REGS + 12 * 8] >- stp x14, x15, [x4, #PCB_REGS + 14 * 8] >- stp x16, x17, [x4, #PCB_REGS + 16 * 8] >- stp x18, x19, [x4, #PCB_REGS + 18 * 8] >- stp x20, x21, [x4, #PCB_REGS + 20 * 8] >- stp x22, x23, [x4, #PCB_REGS + 22 * 8] >- 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 lr, [x4, #PCB_LR] >+ 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] > /* And the old stack pointer */ > mov x5, sp > mrs x6, tpidrro_el0 >@@ -195,26 +183,20 @@ ENTRY(cpu_switch) > msr tpidr_el0, x6 > ldr x6, [x4, #PCB_TPIDRRO] > msr tpidrro_el0, x6 >- ldp x8, x9, [x4, #PCB_REGS + 8 * 8] >- ldp x10, x11, [x4, #PCB_REGS + 10 * 8] >- ldp x12, x13, [x4, #PCB_REGS + 12 * 8] >- ldp x14, x15, [x4, #PCB_REGS + 14 * 8] >- ldp x16, x17, [x4, #PCB_REGS + 16 * 8] >- ldr x19, [x4, #PCB_REGS + 19 * 8] >- ldp x20, x21, [x4, #PCB_REGS + 20 * 8] >- ldp x22, x23, [x4, #PCB_REGS + 22 * 8] >- 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 lr, [x4, #PCB_LR] >+ 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] > ret > END(cpu_switch) > > ENTRY(fork_trampoline) >- mov x0, x8 >- mov x1, x9 >+ mov x0, x19 >+ mov x1, x20 > mov x2, sp > mov fp, #0 /* Stack traceback stops here. */ > bl _C_LABEL(fork_exit) >@@ -258,23 +240,17 @@ ENTRY(fork_trampoline) > * will be set to the desired value anyway. > */ > ERET >- >+ > END(fork_trampoline) > > ENTRY(savectx) > /* Store the callee-saved registers */ >- stp x8, x9, [x0, #PCB_REGS + 8 * 8] >- stp x10, x11, [x0, #PCB_REGS + 10 * 8] >- stp x12, x13, [x0, #PCB_REGS + 12 * 8] >- stp x14, x15, [x0, #PCB_REGS + 14 * 8] >- stp x16, x17, [x0, #PCB_REGS + 16 * 8] >- stp x18, x19, [x0, #PCB_REGS + 18 * 8] >- stp x20, x21, [x0, #PCB_REGS + 20 * 8] >- stp x22, x23, [x0, #PCB_REGS + 22 * 8] >- 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 lr, [x0, #PCB_LR] >+ 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] > /* 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 >index c52a7e2fc5..feb439314f 100644 >--- a/sys/arm64/arm64/vm_machdep.c >+++ b/sys/arm64/arm64/vm_machdep.c >@@ -105,8 +105,8 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) > td2->td_frame = tf; > > /* 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[19] = (uintptr_t)fork_return; >+ td2->td_pcb->pcb_x[20] = (uintptr_t)td2; > 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; >@@ -183,8 +183,8 @@ cpu_copy_thread(struct thread *td, struct thread *td0) > bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); > bcopy(td0->td_pcb, td->td_pcb, sizeof(struct pcb)); > >- td->td_pcb->pcb_x[8] = (uintptr_t)fork_return; >- td->td_pcb->pcb_x[9] = (uintptr_t)td; >+ td->td_pcb->pcb_x[19] = (uintptr_t)fork_return; >+ td->td_pcb->pcb_x[20] = (uintptr_t)td; > td->td_pcb->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); >@@ -287,8 +287,8 @@ void > cpu_fork_kthread_handler(struct thread *td, void (*func)(void *), void *arg) > { > >- td->td_pcb->pcb_x[8] = (uintptr_t)func; >- td->td_pcb->pcb_x[9] = (uintptr_t)arg; >+ td->td_pcb->pcb_x[19] = (uintptr_t)func; >+ td->td_pcb->pcb_x[20] = (uintptr_t)arg; > } > > void
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 262691
: 232594 |
232611