BarryServer : Git

All the code for all my projects
// BarryServer : Git / Orion / commit / d41a53cbc7d055b1c00cf0a339dbed6925f4f02c / task / process.S

// Related

Orion

Barry Importing existing Orion kernel d41a53c (2 years, 4 months ago)
diff --git a/task/process.S b/task/process.S
new file mode 100644
index 0000000..131481f
--- /dev/null
+++ b/task/process.S
@@ -0,0 +1,23 @@
+; This file contains a few assembly routines related to tasking.  These routines
+; should be minimal, and get called from within various functions from the
+; tasking system.  See the relevant C source for a better description of how the
+; functions work.
+
+; Get the return address
+[global read_eip]
+read_eip:
+	mov eax, [esp]
+	ret
+
+; Switch to a task's context
+[global context_switch]
+context_switch:
+	cli
+	mov ecx, [esp + 4]
+	mov eax, [esp + 8]
+	mov ebp, [esp + 12]
+	mov esp, [esp + 16]
+	mov cr3, eax
+	mov eax, 0x10032004 ; Magic number
+	sti
+	jmp ecx