summaryrefslogtreecommitdiff
path: root/kc/core/cpu/cpu_task.S
diff options
context:
space:
mode:
authorAda Christine <adachristine18@gmail.com>2022-02-18 01:31:03 +0000
committerAda Christine <adachristine18@gmail.com>2022-02-18 01:31:03 +0000
commit606b7dc226cb51077c016a8ea5fa862ac6ce1db4 (patch)
tree06188c7da4d7ce3ba53aba3ebf8be3a98665aed1 /kc/core/cpu/cpu_task.S
parent67d43fd64099a8ce51ad107e6f27bbdc6a52d852 (diff)
bug fixes
- needed an atomic_load() when getting the count in pic8253_nanoseconds_elapsed() - i was deleting half the bits of the outgoing task's stack in cpu_task.S (oops) - updated .gdbint. TODO: automate laoding section offsets correctly
Diffstat (limited to 'kc/core/cpu/cpu_task.S')
-rw-r--r--kc/core/cpu/cpu_task.S7
1 files changed, 6 insertions, 1 deletions
diff --git a/kc/core/cpu/cpu_task.S b/kc/core/cpu/cpu_task.S
index f2fb473..4f9fd7b 100644
--- a/kc/core/cpu/cpu_task.S
+++ b/kc/core/cpu/cpu_task.S
@@ -17,6 +17,10 @@ cpu_set_thread:
* rsi: pointer to control block of the current thread
* rdx: pointer to this cpu's task state segment esp0 field
*/
+ // test for a NULL origin thread
+ test %rsi,%rsi
+ // skip saving the state for a NULL origin thread
+ jz .Lnull_thread
push %rbx
push %r12
push %r13
@@ -24,7 +28,8 @@ cpu_set_thread:
push %r15
push %rbp
/* the current task will be in rsi */
- mov %esp, 0(%rsi) // save the stack pointer for the current task
+ mov %rsp, 0(%rsi) // save the stack pointer for the current task
+.Lnull_thread:
mov 0(%rdi),%rsp // new stack is the next's task's stack
mov 8(%rdi),%rbx // top of the next task's kernel stack
mov %rbx,0(%rdx) // save the esp0 to the tss