Generic sleep_micro() function

This commit is contained in:
2025-12-22 21:14:58 +01:00
parent 849df9c27d
commit 1fd6f4890d
4 changed files with 22 additions and 3 deletions

View File

@@ -7,6 +7,7 @@
#include <mm/pmm.h>
#include <sys/debug.h>
#include <sys/mm.h>
#include <sys/time.h>
#include <uacpi/uacpi.h>
#define UACPI_MEMORY_BUFFER_MAX 4096
@@ -29,7 +30,7 @@ void bootmain (void) {
for (size_t i = 0; i < 1000; i++) {
DEBUG ("i=%zu\n", i);
amd64_hpet_sleep_micro (1000000);
sleep_micro (1000000);
}
for (;;)

View File

@@ -8,7 +8,8 @@ c += amd64/bootmain.c \
amd64/apic.c \
amd64/msr.c \
amd64/hpet.c \
amd64/mm.c
amd64/mm.c \
amd64/time.c
S += amd64/intr_stub.S \
amd64/spin.S
@@ -25,4 +26,5 @@ o += amd64/bootmain.o \
amd64/apic.o \
amd64/msr.o \
amd64/hpet.o \
amd64/mm.o
amd64/mm.o \
amd64/time.o

7
kernel/amd64/time.c Normal file
View File

@@ -0,0 +1,7 @@
#include <libk/std.h>
#include <sys/time.h>
#include <amd64/hpet.h>
void sleep_micro (size_t us) {
amd64_hpet_sleep_micro (us);
}

9
kernel/sys/time.h Normal file
View File

@@ -0,0 +1,9 @@
#ifndef _KERNEL_SYS_TIME_H
#define _KERNEL_SYS_TIME_H
#include <libk/std.h>
/* May take a timer peripheral lock! */
void sleep_micro (size_t us);
#endif // _KERNEL_SYS_TIME_H