37 lines
624 B
C
37 lines
624 B
C
//
|
|
// Created by rick on 22-02-21.
|
|
//
|
|
|
|
#include <libk/syscall.h>
|
|
#include <types.h>
|
|
#include <attributes.h>
|
|
|
|
void syscall1(uint32_t arg1) {
|
|
__asm__("int $0x80"
|
|
:
|
|
: "a"(arg1));
|
|
}
|
|
|
|
void syscall2(uint32_t arg1, uint32_t arg2) {
|
|
__asm__("int $0x80"
|
|
:
|
|
: "a"(arg1), "b"(arg2));
|
|
}
|
|
|
|
void noreturn syscall_start_scheduler() {
|
|
syscall1(SYSCALL_START_SCHEDULER);
|
|
while (1) { __asm__("hlt"); };
|
|
}
|
|
|
|
void syscall_yield_job() {
|
|
syscall1(SYSCALL_YIELD_JOB);
|
|
}
|
|
|
|
void syscall_yield_irq(uint16_t irq) {
|
|
syscall2(SYSCALL_YIELD_IRQ, irq );
|
|
}
|
|
|
|
void syscall_job_suspend() {
|
|
syscall1(SYSCALL_SUSPEND);
|
|
}
|