From 7d3884b5cfc282dbdfe5d9a22d8b2b343280b8af Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Tue, 1 Feb 2022 20:36:30 -0700 Subject: Thread yield control to any other threads --- include/cpu.h | 5 +++-- include/sys/schedule.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/cpu.h b/include/cpu.h index c15c086..bac80e8 100644 --- a/include/cpu.h +++ b/include/cpu.h @@ -91,11 +91,12 @@ __attribute__((always_inline)) static inline unsigned long long get_sys_time(voi }s; unsigned long long llv; }t; - asm volatile("svc #1\nmov %0, r0\nmov %0, r1" : "=r"(t.s.lo), "=r"(t.s.hi)); + asm volatile("svc #1\nmov %0, r1\nmov %1, r0" : "=r"(t.s.lo), "=r"(t.s.hi)); return t.llv; } -#define SYS_SCHED 2 +#define SYS_YIELD 0 #define SYS_TIME 1 +#define SYS_SCHED 2 #endif diff --git a/include/sys/schedule.h b/include/sys/schedule.h index 4d331a6..cb784c5 100644 --- a/include/sys/schedule.h +++ b/include/sys/schedule.h @@ -64,6 +64,6 @@ struct Thread* next_thread(void); /// to user mode then calls the SVC call extern void schedule(void); extern void cleanup(void); -// void yield(void); +void yield(void); #endif -- cgit v1.2.1