summaryrefslogtreecommitdiffstats
path: root/task/stack.c
diff options
context:
space:
mode:
Diffstat (limited to 'task/stack.c')
-rw-r--r--task/stack.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/task/stack.c b/task/stack.c
new file mode 100644
index 0000000..396ab3e
--- /dev/null
+++ b/task/stack.c
@@ -0,0 +1,14 @@
+#include "tasking.h"
+#include "string.h"
+#include "assert.h"
+
+void
+tcb_stack_push(tcb_t *tcb, void *data, size_t len)
+{
+ assert(tcb != NULL);
+ void *spo = (void*)(tcb->ksp - len);
+ assert(spo >= tcb->stack);
+
+ memcpy(spo, data, len);
+ tcb->ksp = (uintptr_t)spo;
+}