yeah
This commit is contained in:
+3
-3
@@ -7,7 +7,7 @@
|
||||
|
||||
static struct clock* active_clock = nullptr;
|
||||
static uint64_t counter_base = 0;
|
||||
static struct spinlock lock = {};
|
||||
static spinlock_t lock = {};
|
||||
|
||||
bool clock_available() {
|
||||
return active_clock != nullptr;
|
||||
@@ -31,7 +31,7 @@ bool clock_switch(struct clock* clock) {
|
||||
}
|
||||
}
|
||||
|
||||
printf("Switching to clock source \"%s\"\n", clock->name);
|
||||
kprintf("Switching to clock source \"%s\"\n", clock->name);
|
||||
|
||||
uint64_t elapsed = clock_get_elapsed_ns();
|
||||
counter_base += elapsed;
|
||||
@@ -43,7 +43,7 @@ bool clock_switch(struct clock* clock) {
|
||||
|
||||
void clock_spin_ns(uint64_t ns) {
|
||||
if (active_clock == nullptr) {
|
||||
printf("Unable to sleep for %lu ns, no clock available!\n", ns);
|
||||
kprintf("Unable to sleep for %lu ns, no clock available!\n", ns);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -38,6 +38,6 @@ void console_init() {
|
||||
if (active->init(active) == false)
|
||||
active = nullptr;
|
||||
else
|
||||
printf("Logging on console \"%s\"\n", active->name);
|
||||
kprintf("Logging on console \"%s\"\n", active->name);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
#include <zinnia/alloc.h>
|
||||
#include <zinnia/elf.h>
|
||||
#include <zinnia/errno.h>
|
||||
#include <zinnia/mem/alloc.h>
|
||||
#include <zinnia/percpu.h>
|
||||
#include <zinnia/pmap.h>
|
||||
#include <zinnia/print.h>
|
||||
@@ -42,7 +42,7 @@ errno_t elf_load(struct exec_info* info, struct task** out) {
|
||||
if (phdr.p_type == PT_LOAD) {
|
||||
enum zn_vm_flags prot = 0;
|
||||
if (phdr.p_flags & PF_R)
|
||||
prot |= ZN_VM_MAP_READ;
|
||||
prot |= PROT_READ;
|
||||
if (phdr.p_flags & PF_W)
|
||||
prot |= ZN_VM_MAP_WRITE;
|
||||
if (phdr.p_flags & PF_X)
|
||||
@@ -181,7 +181,7 @@ errno_t elf_load(struct exec_info* info, struct task** out) {
|
||||
uintptr_t argc = num_argv;
|
||||
vmo_write(&stack->object, stack_off, &argc, sizeof(argc), nullptr);
|
||||
|
||||
status = vma_map_vmo(info->space, &stack->object, stack_start, stack_size, ZN_VM_MAP_READ | ZN_VM_MAP_WRITE, 0);
|
||||
status = vma_map_vmo(info->space, &stack->object, stack_start, stack_size, PROT_READ | ZN_VM_MAP_WRITE, 0);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
|
||||
+2
-2
@@ -15,10 +15,10 @@ struct futex_bucket {
|
||||
#define FUTEX_BUCKET_COUNT 64
|
||||
|
||||
static struct futex_bucket futex_table[FUTEX_BUCKET_COUNT];
|
||||
static struct spinlock futex_table_lock;
|
||||
static spinlock_t futex_table_lock;
|
||||
|
||||
void futex_init(void) {
|
||||
futex_table_lock = (struct spinlock){0};
|
||||
futex_table_lock = (spinlock_t){0};
|
||||
for (size_t i = 0; i < FUTEX_BUCKET_COUNT; i++) {
|
||||
wait_queue_init(&futex_table[i].wq);
|
||||
futex_table[i].key = 0;
|
||||
|
||||
+1
-4
@@ -8,9 +8,6 @@ kernel_sources += files(
|
||||
'percpu.c',
|
||||
'print.c',
|
||||
'spin.c',
|
||||
'uacpi_glue.c',
|
||||
)
|
||||
|
||||
if get_option('sched') == 'simple'
|
||||
kernel_sources += files('sched_simple.c')
|
||||
endif
|
||||
kernel_sources += files('sched_dumb.c')
|
||||
|
||||
+2
-2
@@ -11,7 +11,7 @@ void panic(const char* msg, ...) {
|
||||
|
||||
struct percpu* cpu = percpu_get();
|
||||
struct task* current = cpu->sched.current;
|
||||
printf(
|
||||
kprintf(
|
||||
"----[ Kernel panic ]----\n"
|
||||
"In task \"%s\" (TID %zu) on CPU %zu!\n",
|
||||
current ? current->name : nullptr,
|
||||
@@ -24,7 +24,7 @@ void panic(const char* msg, ...) {
|
||||
kvprintf(msg, args);
|
||||
va_end(args);
|
||||
|
||||
printf("----[ End of panic ]----\n");
|
||||
kprintf("----[ End of panic ]----\n");
|
||||
|
||||
while (1) {
|
||||
arch_irq_wait();
|
||||
|
||||
+1
-1
@@ -387,7 +387,7 @@ static void printf_console(void*, const char* msg, size_t len) {
|
||||
console_write(msg, len);
|
||||
}
|
||||
|
||||
void printf(const char* message, ...) {
|
||||
void kprintf(const char* message, ...) {
|
||||
va_list args;
|
||||
va_start(args, message);
|
||||
do_print(printf_console, nullptr, message, args);
|
||||
|
||||
@@ -43,7 +43,7 @@ void sched_init(struct sched_percpu* sched) {
|
||||
|
||||
tailq_init(&sched->run_queue);
|
||||
|
||||
printf("Scheduler initialized\n");
|
||||
kprintf("Scheduler initialized\n");
|
||||
}
|
||||
|
||||
void sched_add_task(struct sched_percpu* sched, struct task* task) {
|
||||
@@ -143,7 +143,7 @@ void task_entry(task_fn_t entry, uintptr_t arg0) {
|
||||
|
||||
void wait_queue_init(struct wait_queue* wq) {
|
||||
tailq_init(&wq->waiters);
|
||||
wq->lock = (struct spinlock){0};
|
||||
wq->lock = (spinlock_t){0};
|
||||
}
|
||||
|
||||
void sched_block(struct sched_percpu* sched, struct wait_queue* wq) {
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
#include <zinnia/spin.h>
|
||||
#include <stdatomic.h>
|
||||
|
||||
void spin_lock(struct spinlock* spin) {
|
||||
void spin_lock(spinlock_t* spin) {
|
||||
uint32_t my = atomic_fetch_add_explicit(&spin->next, 1, memory_order_relaxed);
|
||||
|
||||
while (atomic_load_explicit(&spin->owner, memory_order_acquire) != my) {
|
||||
@@ -9,7 +9,7 @@ void spin_lock(struct spinlock* spin) {
|
||||
}
|
||||
}
|
||||
|
||||
void spin_unlock(struct spinlock* spin) {
|
||||
void spin_unlock(spinlock_t* spin) {
|
||||
uint32_t val = atomic_load_explicit(&spin->owner, memory_order_relaxed);
|
||||
atomic_store_explicit(&spin->owner, val + 1, memory_order_release);
|
||||
}
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
#include <stdarg.h>
|
||||
#include <uacpi/kernel_api.h>
|
||||
#include <uacpi/status.h>
|
||||
#include <uacpi/types.h>
|
||||
#include <zinnia/init.h>
|
||||
#include <zinnia/mmio.h>
|
||||
#include <zinnia/print.h>
|
||||
#include <zinnia/utils.h>
|
||||
|
||||
uacpi_status uacpi_kernel_get_rsdp(uacpi_phys_addr* out_rsdp_address) {
|
||||
*out_rsdp_address = (uacpi_phys_addr)rsdp_addr;
|
||||
return UACPI_STATUS_OK;
|
||||
}
|
||||
|
||||
void* uacpi_kernel_map(uacpi_phys_addr addr, uacpi_size len) {
|
||||
return mmio_new(addr, len);
|
||||
}
|
||||
|
||||
void uacpi_kernel_unmap(void* addr, uacpi_size len) {
|
||||
mmio_free(addr, len);
|
||||
}
|
||||
|
||||
void uacpi_kernel_log(uacpi_log_level lvl, const uacpi_char* msg, ...) {
|
||||
va_list args;
|
||||
va_start(args, msg);
|
||||
|
||||
kvprintf(msg, args);
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void uacpi_kernel_vlog(uacpi_log_level lvl, const uacpi_char* msg, uacpi_va_list args) {
|
||||
kvprintf(msg, args);
|
||||
}
|
||||
Reference in New Issue
Block a user