summaryrefslogtreecommitdiff
path: root/x86_64
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2023-09-25 00:24:25 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-09-25 10:21:29 +0200
commitb3921098e2807d6225d277986bc8063b6a271e88 (patch)
tree93aa20fdb9f5ef3055069dd913afd0ad09d4ca23 /x86_64
parentbe0abe4c2361f2c7db5a52b0900e298083fefe40 (diff)
percpu: active_stack with gs
Message-Id: <20230925002417.467022-1-damien@zamaudio.com>
Diffstat (limited to 'x86_64')
-rw-r--r--x86_64/cswitch.S10
-rw-r--r--x86_64/locore.S2
2 files changed, 5 insertions, 7 deletions
diff --git a/x86_64/cswitch.S b/x86_64/cswitch.S
index 29dae62c..9c4640fd 100644
--- a/x86_64/cswitch.S
+++ b/x86_64/cswitch.S
@@ -40,7 +40,7 @@ ENTRY(Load_context)
lea KERNEL_STACK_SIZE-IKS_SIZE-IEL_SIZE(%rcx),%rdx
/* point to stack top */
CPU_NUMBER(%eax)
- movq %rcx,CX(EXT(active_stacks),%rax) /* store stack address */
+ movq %rcx,MY(ACTIVE_STACK) /* store stack address */
movq %rdx,CX(EXT(kernel_stack),%rax) /* store stack top */
/* XXX complete */
@@ -61,8 +61,7 @@ ENTRY(Load_context)
*/
ENTRY(Switch_context)
- CPU_NUMBER(%eax)
- movq CX(EXT(active_stacks),%rax),%rcx /* get old kernel stack */
+ movq MY(ACTIVE_STACK),%rcx /* get old kernel stack */
movq %r12,KSS_R12(%rcx) /* save registers */
movq %r13,KSS_R13(%rcx)
@@ -86,7 +85,7 @@ ENTRY(Switch_context)
CPU_NUMBER(%eax)
movq %rsi,MY(ACTIVE_THREAD) /* new thread is active */
- movq %rcx,CX(EXT(active_stacks),%rax) /* set current stack */
+ movq %rcx,MY(ACTIVE_STACK) /* set current stack */
movq %rbx,CX(EXT(kernel_stack),%rax) /* set stack top */
movq KSS_ESP(%rcx),%rsp /* switch stacks */
@@ -119,8 +118,7 @@ ENTRY(Thread_continue)
*/
ENTRY(switch_to_shutdown_context)
ud2
- CPU_NUMBER(%eax)
- movq CX(EXT(active_stacks),%rax),%rcx /* get old kernel stack */
+ movq MY(ACTIVE_STACK),%rcx /* get old kernel stack */
movq %r12,KSS_R12(%rcx) /* save registers */
movq %r13,KSS_R13(%rcx)
movq %r14,KSS_R14(%rcx)
diff --git a/x86_64/locore.S b/x86_64/locore.S
index 55dc4d27..7eaeda3b 100644
--- a/x86_64/locore.S
+++ b/x86_64/locore.S
@@ -673,7 +673,7 @@ trap_from_kernel:
cmpq CX(EXT(kernel_stack),%rdx),%rsp
/* already on kernel stack? */
ja 0f
- cmpq CX(EXT(active_stacks),%rdx),%rsp
+ cmpq MY(ACTIVE_STACK),%rsp
ja 1f /* switch if not */
0:
movq CX(EXT(kernel_stack),%rdx),%rsp