git: f7524d8fcbd7 - main - amd64: Inline set_top_of_stack_td into cpu_thread_new_kstack
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 27 May 2026 14:59:25 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=f7524d8fcbd76a432c163200a7c77ce964805beb
commit f7524d8fcbd76a432c163200a7c77ce964805beb
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2026-05-05 14:43:10 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-05-27 13:45:25 +0000
amd64: Inline set_top_of_stack_td into cpu_thread_new_kstack
Reviewed by: kib
Sponsored by: AFRL, DARPA
Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/23
---
sys/amd64/amd64/machdep.c | 2 +-
sys/amd64/amd64/vm_machdep.c | 10 ++--------
sys/amd64/include/md_var.h | 1 -
3 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index 20c4be7880ff..510c6d375a2d 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -1369,6 +1369,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
thread0.td_kstack_pages = kstack_pages;
kstack0_sz = thread0.td_kstack_pages * PAGE_SIZE;
bzero(thread0.td_kstack, kstack0_sz);
+ cpu_thread_new_kstack(&thread0);
physfree += kstack0_sz;
/*
@@ -1521,7 +1522,6 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
* We initialize the PCB pointer early so that exception
* handlers will work.
*/
- set_top_of_stack_td(&thread0);
thread0.td_pcb = get_pcb_td(&thread0);
/*
diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c
index 2df53285d71d..244d82ee8ebb 100644
--- a/sys/amd64/amd64/vm_machdep.c
+++ b/sys/amd64/amd64/vm_machdep.c
@@ -83,13 +83,6 @@
_Static_assert(OFFSETOF_MONITORBUF == offsetof(struct pcpu, pc_monitorbuf),
"OFFSETOF_MONITORBUF does not correspond with offset of pc_monitorbuf.");
-void
-set_top_of_stack_td(struct thread *td)
-{
- td->td_md.md_stack_base = td->td_kstack +
- td->td_kstack_pages * PAGE_SIZE;
-}
-
struct savefpu *
get_pcb_user_save_td(struct thread *td)
{
@@ -384,7 +377,8 @@ cpu_thread_alloc(struct thread *td)
void
cpu_thread_new_kstack(struct thread *td)
{
- set_top_of_stack_td(td);
+ td->td_md.md_stack_base = td->td_kstack +
+ td->td_kstack_pages * PAGE_SIZE;
td->td_frame = (struct trapframe *)td->td_md.md_stack_base - 1;
}
diff --git a/sys/amd64/include/md_var.h b/sys/amd64/include/md_var.h
index 46a30518b212..4b98c5d8c418 100644
--- a/sys/amd64/include/md_var.h
+++ b/sys/amd64/include/md_var.h
@@ -94,7 +94,6 @@ void gsbase_load_fault(void) __asm(__STRING(gsbase_load_fault));
void fpstate_drop(struct thread *td);
void pagezero(void *addr);
void setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int ist);
-void set_top_of_stack_td(struct thread *td);
struct savefpu *get_pcb_user_save_td(struct thread *td);
struct savefpu *get_pcb_user_save_pcb(struct pcb *pcb);
void pci_early_quirks(void);