aboutsummaryrefslogtreecommitdiff
path: root/i386
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2023-09-24 05:29:06 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-09-24 15:21:32 +0200
commit9d78d30a34ae406620b5b25847fc17ed2b08949a (patch)
tree5ed0cb4afd2fc096655c421b676de03e1775dc1e /i386
parent72180cd9ffa02b747d1e11d315b63d5f71436aba (diff)
downloadgnumach-9d78d30a34ae406620b5b25847fc17ed2b08949a.tar.gz
gnumach-9d78d30a34ae406620b5b25847fc17ed2b08949a.tar.bz2
gnumach-9d78d30a34ae406620b5b25847fc17ed2b08949a.zip
percpu active_thread using gs segment
TESTED: As per previous commit Message-Id: <20230924052824.449219-4-damien@zamaudio.com>
Diffstat (limited to 'i386')
-rw-r--r--i386/i386/cswitch.S2
-rw-r--r--i386/i386/i386asm.sym1
-rw-r--r--i386/i386/locore.S2
-rw-r--r--i386/i386/pcb.c2
-rw-r--r--i386/i386/percpu.h2
5 files changed, 5 insertions, 4 deletions
diff --git a/i386/i386/cswitch.S b/i386/i386/cswitch.S
index d97093ff..598e32cf 100644
--- a/i386/i386/cswitch.S
+++ b/i386/i386/cswitch.S
@@ -79,7 +79,7 @@ ENTRY(Switch_context)
lea KERNEL_STACK_SIZE-IKS_SIZE-IEL_SIZE(%ecx),%ebx
/* point to stack top */
- movl %esi,CX(EXT(active_threads),%edx) /* new thread is active */
+ movl %esi,MY(ACTIVE_THREAD) /* new thread is active */
movl %ecx,CX(EXT(active_stacks),%edx) /* set current stack */
movl %ebx,CX(EXT(kernel_stack),%edx) /* set stack top */
diff --git a/i386/i386/i386asm.sym b/i386/i386/i386asm.sym
index 1c4654db..e9a53bd5 100644
--- a/i386/i386/i386asm.sym
+++ b/i386/i386/i386asm.sym
@@ -54,6 +54,7 @@ expr CALL_PMAP_UPDATE
offset ApicLocalUnit lu apic_id APIC_ID
offset percpu pc cpu_id PERCPU_CPU_ID
+offset percpu pc active_thread PERCPU_ACTIVE_THREAD
size percpu pcs
diff --git a/i386/i386/locore.S b/i386/i386/locore.S
index 05b3b13d..8fba7638 100644
--- a/i386/i386/locore.S
+++ b/i386/i386/locore.S
@@ -1082,7 +1082,7 @@ syscall_entry_2:
* Check for MACH or emulated system call
*/
syscall_entry_3:
- movl CX(EXT(active_threads),%edx),%edx
+ movl MY(ACTIVE_THREAD),%edx
/* point to current thread */
movl TH_TASK(%edx),%edx /* point to task */
movl TASK_EMUL(%edx),%edx /* get emulation vector */
diff --git a/i386/i386/pcb.c b/i386/i386/pcb.c
index e0f4f57a..9576c147 100644
--- a/i386/i386/pcb.c
+++ b/i386/i386/pcb.c
@@ -316,7 +316,7 @@ void stack_handoff(
stack = current_stack();
old->kernel_stack = 0;
new->kernel_stack = stack;
- active_threads[mycpu] = new;
+ percpu_assign(active_thread, new);
/*
* Switch exception link to point to new
diff --git a/i386/i386/percpu.h b/i386/i386/percpu.h
index 202504da..ad4836ce 100644
--- a/i386/i386/percpu.h
+++ b/i386/i386/percpu.h
@@ -58,10 +58,10 @@ struct percpu {
int apic_id;
int cpu_id;
struct processor processor;
+ thread_t active_thread;
/*
struct machine_slot machine_slot;
struct mp_desc_table mp_desc_table;
- thread_t active_thread;
vm_offset_t active_stack;
vm_offset_t int_stack_top;
vm_offset_t int_stack_base;