syscalls: getcpu

This commit is contained in:
Matheus
2025-09-12 23:03:30 -03:00
parent ad4f5ff8cf
commit a599c7f95e
4 changed files with 34 additions and 20 deletions
+3 -1
View File
@@ -94,6 +94,7 @@ extern syscall_killthread
extern syscall_shutdown
extern syscall_nice
extern syscall_flock
extern syscall_getcpu
syscalltab:
dq syscall_print
dq syscall_mmap
@@ -190,7 +191,8 @@ dq syscall_killthread
dq syscall_shutdown
dq syscall_nice
dq syscall_flock
syscallcount equ 95
dq syscall_getcpu
syscallcount equ 96
section .text
global arch_syscall_entry
; on entry:
+5 -3
View File
@@ -5,7 +5,7 @@
#ifdef SYSCALL_LOGGING
#define SYSCALL_COUNT 95
#define SYSCALL_COUNT 96
#define LOGSTR(x) arch_e9_puts(x)
static char *name[] = {
@@ -103,7 +103,8 @@ static char *name[] = {
"killthread",
"shutdown",
"nice",
"flock"
"flock",
"getcpu"
};
static char *args[] = {
@@ -201,7 +202,8 @@ static char *args[] = {
"pid %d tid %d signal %d", // killthread
"how %d", // shutdown
"off %d", // nice
"fd %d op %d" // flock
"fd %d op %d", // flock
"N/A" // getcpu
};
#endif
+14
View File
@@ -0,0 +1,14 @@
#include <kernel/syscalls.h>
#include <arch/cpu.h>
syscallret_t syscall_getcpu(context_t *) {
syscallret_t ret = {
.errno = 0
};
uint32_t cpu_id = current_cpu_internal_id();
ret.ret = cpu_id;
return ret;
}