summaryrefslogtreecommitdiff
path: root/stage3/yield.asm
diff options
context:
space:
mode:
authorLizzy Fleckenstein <lizzy@vlhl.dev>2023-12-19 01:54:39 +0100
committerLizzy Fleckenstein <lizzy@vlhl.dev>2023-12-19 02:11:32 +0100
commit6d263c7d4e0f4b1d34694b5d3d159ccb20b3db02 (patch)
tree41578268cf68b2d9ea1737687a0f98af979948d8 /stage3/yield.asm
parent5881b4d5c1040c762599f90e091e4cc4c3abe6b1 (diff)
downloadcuddles-6d263c7d4e0f4b1d34694b5d3d159ccb20b3db02.tar.xz
keyboard driver and threads
* PS/2 keyboard driver * interactive shell * move away from \0 terminated strings to sized slices * coroutine threads and IRQ queues
Diffstat (limited to 'stage3/yield.asm')
-rw-r--r--stage3/yield.asm45
1 files changed, 45 insertions, 0 deletions
diff --git a/stage3/yield.asm b/stage3/yield.asm
new file mode 100644
index 0000000..c078f16
--- /dev/null
+++ b/stage3/yield.asm
@@ -0,0 +1,45 @@
+extern thread_sched, thread_sched_stack
+global yield, resume
+
+extern print_num, halt
+
+yield:
+ ; push rip (done using call)
+ push rbx
+ push rbp
+ push rdi
+ push rsi
+ push r12
+ push r13
+ push r14
+ push r15
+
+ cld
+ ; mov rdi, rdi
+ mov rsi, rsp
+ mov rsp, [thread_sched_stack]
+ jmp thread_sched
+
+; stack in rdi
+; return in rsi
+resume:
+ mov rsp, rdi
+ mov rax, rsi
+
+ pop r15
+ pop r14
+ pop r13
+ pop r12
+ pop rsi
+ pop rdi
+ pop rbp
+ pop rbx
+
+ ;mov rdi, [rsp]
+ ;mov rsi, 16
+ ;mov rdx, 0
+ ;call print_num
+ ;cli
+ ;call halt
+
+ ret ; pop rip