mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 20:58:22 +00:00
syscalls: getcpu
This commit is contained in:
@@ -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,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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user