diff options
| author | Ada Christine <adachristine18@gmail.com> | 2026-05-24 11:09:31 +0000 |
|---|---|---|
| committer | Ada Christine <adachristine18@gmail.com> | 2026-05-24 11:09:31 +0000 |
| commit | d07bd08dd0446e8c41eccaccbb07e9112200e8ee (patch) | |
| tree | 742a3f9d9d84c8ee55858b2ebc7e0e0f8c714c7c | |
| parent | 9aaf21bf10d00ec12b24499817e3e91dca08c461 (diff) | |
rename and move, function renames in stdio
| -rw-r--r-- | api/lib/kstdio.h | 18 | ||||
| -rw-r--r-- | kc/boot/Makefile | 4 | ||||
| -rw-r--r-- | kc/boot/kc_main.c | 2 | ||||
| -rw-r--r-- | kc/core/Makefile | 6 | ||||
| -rw-r--r-- | kc/core/arch_thread.c | 4 | ||||
| -rw-r--r-- | kc/core/cpu/cpu.c | 4 | ||||
| -rw-r--r-- | kc/core/cpu/exceptions.h | 4 | ||||
| -rw-r--r-- | kc/core/i8042.c | 18 | ||||
| -rw-r--r-- | kc/core/kc_main.c | 4 | ||||
| -rw-r--r-- | kc/core/memory.h | 2 | ||||
| -rw-r--r-- | kc/core/memory/memory.c | 24 | ||||
| -rw-r--r-- | kc/core/memory/page_early.c | 12 | ||||
| -rw-r--r-- | kc/core/panic.c | 6 | ||||
| -rw-r--r-- | kc/core/pic8259.c | 12 | ||||
| -rw-r--r-- | kc/core/pit8253.c | 6 | ||||
| -rw-r--r-- | kc/core/stdio.c (renamed from kc/core/kstdio.c) | 8 | ||||
| -rw-r--r-- | kc/core/task.c | 16 | ||||
| -rw-r--r-- | kc/core/video.c | 6 | ||||
| -rw-r--r-- | kc/core/vm_tree.c | 6 | ||||
| -rw-r--r-- | lib/api/libc/stdio.h | 18 | ||||
| -rw-r--r-- | lib/api/libc/string.h (renamed from api/lib/kstring.h) | 0 | ||||
| -rw-r--r-- | lib/libc/memcmp.c (renamed from lib/memcmp.c) | 0 | ||||
| -rw-r--r-- | lib/libc/memcpy.c (renamed from lib/memcpy.c) | 0 | ||||
| -rw-r--r-- | lib/libc/memmove.c (renamed from lib/memmove.c) | 0 | ||||
| -rw-r--r-- | lib/libc/memset.c (renamed from lib/memset.c) | 0 | ||||
| -rw-r--r-- | lib/libc/printf.c (renamed from lib/kprintf.c) | 20 | ||||
| -rw-r--r-- | lib/libc/string.c (renamed from lib/string.c) | 2 | ||||
| -rw-r--r-- | loader/main_efi.c | 44 |
28 files changed, 124 insertions, 122 deletions
diff --git a/api/lib/kstdio.h b/api/lib/kstdio.h deleted file mode 100644 index 80e47cc..0000000 --- a/api/lib/kstdio.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include <lib/kstring.h> - -#include <stdarg.h> - -typedef struct FILE FILE; - -extern FILE *kstdout; -extern FILE *kstderr; - -extern int kfputc(int c, FILE *f); - -int kvfprintf(FILE *f, const char *restrict format, va_list arguments); -int kfprintf(FILE *f, const char *restrict format, ...); -int kvprintf(const char *restrict format, va_list arguments); -int kprintf(const char *restrict format, ...); - diff --git a/kc/boot/Makefile b/kc/boot/Makefile index b90f183..d0c1d76 100644 --- a/kc/boot/Makefile +++ b/kc/boot/Makefile @@ -2,12 +2,12 @@ include ../../defaults.mk include ../../efi.mk include ../defaults.mk -VPATH := ../../lib ../ +VPATH := ../../lib ../ ../../lib/libc TARGET := efi.os .DEFAULT: $(TARGET) -CPPFLAGS += -I../../api -I ../api -I../../lib +CPPFLAGS += -I../../api -I ../api -I../../lib/api CFLAGS += -fshort-wchar diff --git a/kc/boot/kc_main.c b/kc/boot/kc_main.c index 943c082..e0f1786 100644 --- a/kc/boot/kc_main.c +++ b/kc/boot/kc_main.c @@ -10,7 +10,7 @@ #include <stdbool.h> -#include <lib/kstring.h> +#include <libc/string.h> #include <lib/elf.h> #define KERNEL_IMAGE_BASE 0xffffffff80000000 diff --git a/kc/core/Makefile b/kc/core/Makefile index 56ddf55..9791762 100644 --- a/kc/core/Makefile +++ b/kc/core/Makefile @@ -1,12 +1,12 @@ include ../../defaults.mk include ../defaults.mk -VPATH := ../../lib ../ cpu/ memory/ +VPATH := ../../lib ../../lib/libc ../ cpu/ memory/ TARGET := kernel.os .DEFAULT: $(TARGET) -CPPFLAGS += -I../../api -I../api -I../../lib -I. +CPPFLAGS += -I../../api -I../api -I../../lib/api -I. CFLAGS += -mcmodel=small -Wno-unused-const-variable -Wno-unused-function -fvisibility=hidden -g AOBJS := entry_x86_64.o reloc_x86_64.o dynamic_x86_64.o @@ -14,7 +14,7 @@ COBJS := mmu.o cpu_thread.o irq.o exceptions.o cpu.o msr.o mmu.o port.o arch_thr POBJS := pic8259.o pic8259_isr.o pit8253.o i8042.o GOBJS := serial.o kc_main.o memory.o vm_tree.o panic.o task.o \ kcc_memory.o page_early.o page_stack.o video.o -LOBJS := kprintf.o memset.o memcpy.o memmove.o memcmp.o kstdio.o string.o +LOBJS := printf.o memset.o memcpy.o memmove.o memcmp.o stdio.o string.o OBJS := $(AOBJS) $(COBJS) $(POBJS) $(GOBJS) $(LOBJS) DEPS := $(patsubst %.o,%.d,$(OBJS)) diff --git a/kc/core/arch_thread.c b/kc/core/arch_thread.c index 180923d..c0d707a 100644 --- a/kc/core/arch_thread.c +++ b/kc/core/arch_thread.c @@ -1,8 +1,10 @@ #include <stdint.h> #include <stddef.h> #include <stdnoreturn.h> + +#include <libc/stdio.h> + #include "task.h" -#include <lib/kstdio.h> struct arch_register_context { diff --git a/kc/core/cpu/cpu.c b/kc/core/cpu/cpu.c index f61ed00..0eaccb7 100644 --- a/kc/core/cpu/cpu.c +++ b/kc/core/cpu/cpu.c @@ -10,7 +10,7 @@ #include <stddef.h> #include <stdint.h> -#include <lib/kstdio.h> +#include <libc/stdio.h> #define GDT_ENTRIES 16 #define IDT_ENTRIES 256 @@ -53,7 +53,7 @@ uint64_t *get_tss_rsp0(void) static void syscall_entry(void) { - kprintf("system call\n"); + printf("system call\n"); halt(); } diff --git a/kc/core/cpu/exceptions.h b/kc/core/cpu/exceptions.h index 7babb65..14a2088 100644 --- a/kc/core/cpu/exceptions.h +++ b/kc/core/cpu/exceptions.h @@ -21,7 +21,7 @@ #ifndef __ASSEMBLER__ -#include <lib/kstdio.h> +#include <libc/stdio.h> struct isr_context_param_regs { @@ -53,7 +53,7 @@ struct isr_context static inline void print_exception_context(struct isr_context *context) { - kprintf( + printf( "exception %#hhx:%x context:\n" "interrupt entry state:\n" "rip: %#hx:%p rflags: %#0.16lx\n" diff --git a/kc/core/i8042.c b/kc/core/i8042.c index 0ba12dc..f6b63b0 100644 --- a/kc/core/i8042.c +++ b/kc/core/i8042.c @@ -2,7 +2,7 @@ #include "port.h" #include "i8042.h" #include "pic8259.h" -#include <lib/kstdio.h> +#include <libc/stdio.h> static void i8042_init(void); static void i8042_enable(void) {} @@ -99,21 +99,21 @@ static void i8042_set_config(void) i8042_command(0x20); uint8_t config_byte; i8042_read(&config_byte); - kprintf("i8042: current config: %#0.2x\n", config_byte); + printf("i8042: current config: %#0.2x\n", config_byte); config_byte &= 0xfc; if (config_byte & (0x1 << 5)) { maybe_dual_channel = true; } config_byte |= 0x01; - kprintf("i8042: new config: %#0.2x\n", config_byte); + printf("i8042: new config: %#0.2x\n", config_byte); i8042_command(0x60); i8042_write(config_byte); i8042_command(0xaa); uint8_t bist_result; if (i8042_read(&bist_result) && bist_result != 0x55) { - kprintf("i8042: warning: error self-testing device. aborting.\n"); + printf("i8042: warning: error self-testing device. aborting.\n"); return; } @@ -124,11 +124,11 @@ static void i8042_set_config(void) uint8_t config_byte; if (i8042_read(&config_byte) && config_byte & (0x1 << 5)) { - kprintf("i8042: single-channel controller detected\n"); + printf("i8042: single-channel controller detected\n"); } else { - kprintf("i8042: dual-channel controller detected\n"); + printf("i8042: dual-channel controller detected\n"); is_dual_channel = true; } } @@ -136,7 +136,7 @@ static void i8042_set_config(void) outb(PS2_COMMAND, 0xab); if (inb(PS2_DATA) != 0x00) { - kprintf("i8042: failed testing port a\n"); + printf("i8042: failed testing port a\n"); } else { @@ -147,7 +147,7 @@ static void i8042_set_config(void) outb(PS2_COMMAND, 0xa9); if (inb(PS2_DATA) != 0x00) { - kprintf("i8042: failed testing port b\n"); + printf("i8042: failed testing port b\n"); } else { @@ -162,7 +162,7 @@ static void i8042_set_config(void) i8042_write(0xff); if(inb(PS2_DATA) == 0xfa && inb(PS2_DATA) == 0xaa) { - kprintf("i8042: detected device on channel, type %#0.2x\n", inb(PS2_DATA)); + printf("i8042: detected device on channel, type %#0.2x\n", inb(PS2_DATA)); } } diff --git a/kc/core/kc_main.c b/kc/core/kc_main.c index 9a84727..4f70d00 100644 --- a/kc/core/kc_main.c +++ b/kc/core/kc_main.c @@ -10,7 +10,7 @@ #include "i8042.h" #include <kernel/entry.h> -#include <lib/kstdio.h> +#include <libc/stdio.h> #include <stdbool.h> #include <stddef.h> @@ -27,7 +27,7 @@ unsigned long kc_main(struct kc_boot_data *data) cpu_init(); serial_init(); video_init(); - kprintf("sophia starting, boot data %#lx\n", boot_data); + printf("sophia starting, boot data %#lx\n", boot_data); memory_init(); pic8259_init(); pit8253_timer_source.init(); diff --git a/kc/core/memory.h b/kc/core/memory.h index 6f70e57..425c2cd 100644 --- a/kc/core/memory.h +++ b/kc/core/memory.h @@ -4,7 +4,7 @@ #include <kernel/memory/paging.h> #include <kernel/memory/range.h> -#include <lib/kstring.h> +#include <libc/string.h> #include <core/memory.h> diff --git a/kc/core/memory/memory.c b/kc/core/memory/memory.c index 1c6fabb..82fba3f 100644 --- a/kc/core/memory/memory.c +++ b/kc/core/memory/memory.c @@ -20,7 +20,7 @@ #include <kc.h> #include <core/memory.h> -#include <lib/kstdio.h> +#include <libc/stdio.h> #define align_next(x, a) (x + a - 1) & ~(a - 1) @@ -89,7 +89,7 @@ struct vm_tree *vm_get_tree(void) void page_init(void) { - kprintf("initializing page frame allocator\n"); + printf("initializing page frame allocator\n"); page_early_init(); page_stack_init(); } @@ -98,7 +98,7 @@ void page_init_final(void) { if (current_alloc_func == boot_page_alloc) { - kprintf("finishing page frame allocator initialization\n"); + printf("finishing page frame allocator initialization\n"); page_early_final(); current_alloc_func = page_stack_alloc; } @@ -176,7 +176,7 @@ static void *map_tableset(void *vaddr, uint64_t *tables[TABLESET_COUNT]) } else { - kprintf("error: failed allocating memory for page table\n"); + printf("error: failed allocating memory for page table\n"); PANIC(OUT_OF_MEMORY); } } @@ -380,7 +380,7 @@ static void temp_page_unmap(void *vaddr) static void vm_init(void) { - kprintf("initializing vm state\n"); + printf("initializing vm state\n"); struct kc_boot_data *boot_data = get_boot_data(); struct vm_core_static_state *states = &vm_state.statics[0]; @@ -433,7 +433,7 @@ static void vm_init(void) vm_state.zero_page = page_alloc(PAGE_ALLOC_CONV); if (!vm_state.zero_page) { - kprintf("failed allocating for zero page\n"); + printf("failed allocating for zero page\n"); PANIC(GENERAL_PANIC); } @@ -441,7 +441,7 @@ static void vm_init(void) if (!zero_temp) { - kprintf("failed mapping zero page for initialization\n"); + printf("failed mapping zero page for initialization\n"); PANIC(GENERAL_PANIC); } @@ -492,7 +492,7 @@ void *heap_alloc(size_t size) if ((void *)-1ULL == heap_root) { struct vm_tree_node *heap_node = &vm_state.statics[HEAP_VM_STATE].node; - kprintf("initializing heap at %#lx of %zu bytes\n", + printf("initializing heap at %#lx of %zu bytes\n", heap_node->key.address, heap_node->key.size); heap_root = NULL; header = (struct heap_header *)heap_node->key.address; @@ -631,7 +631,7 @@ int anonymous_page_handler( if (!paddr) { - kprintf("got zero from page_alloc :|\n"); + printf("got zero from page_alloc :|\n"); PANIC(OUT_OF_MEMORY); } page_map_at( @@ -657,14 +657,14 @@ void page_fault_handler(struct isr_context *context) if (!node) { print_exception_context(context); - kprintf("error: page fault in unmanaged address %#lx\n", address); + printf("error: page fault in unmanaged address %#lx\n", address); PANIC(UNHANDLED_FAULT); } if (!node->object->handler) { print_exception_context(context); - kprintf("error: vm object at %p has no fault handler\n"); + printf("error: vm object at %p has no fault handler\n"); PANIC(UNHANDLED_FAULT); } @@ -674,7 +674,7 @@ void page_fault_handler(struct isr_context *context) void general_protection_handler(struct isr_context *context) { //TODO: implement #gp handler - kprintf("general protection violation\n"); + printf("general protection violation\n"); print_exception_context(context); PANIC(UNHANDLED_FAULT); } diff --git a/kc/core/memory/page_early.c b/kc/core/memory/page_early.c index 9ac90d2..989f82a 100644 --- a/kc/core/memory/page_early.c +++ b/kc/core/memory/page_early.c @@ -1,7 +1,7 @@ #include "page_early.h" #include "panic.h" -#include <lib/kstdio.h> +#include <libc/stdio.h> static struct page_early_state { @@ -13,20 +13,20 @@ early_state; void page_early_init(void) { - kprintf("initializing early page frame allocator\n"); + printf("initializing early page frame allocator\n"); struct kc_boot_data *boot_data = get_boot_data(); early_state.first = &boot_data->memory.entries[0]; early_state.last = &boot_data->memory.entries[boot_data->memory.count]; early_state.current = early_state.first; - /*kprintf("memory ranges\n"); + /*printf("memory ranges\n"); struct memory_range *current = early_state.first; do { - kprintf("base %#0.16lx size %#0.16lx type %d\n", current->base, current->size, current->type); + printf("base %#0.16lx size %#0.16lx type %d\n", current->base, current->size, current->type); current++; } while (current != early_state.last); @@ -37,7 +37,7 @@ void page_early_final(void) { if (early_state.first) { - kprintf("finalizing early page allocator\n"); + printf("finalizing early page allocator\n"); for (struct memory_range *current = early_state.first; current < early_state.last; current++) @@ -101,7 +101,7 @@ kc_phys_addr page_early_alloc(enum page_alloc_flags type) early_state.current++; } - kprintf("error: early allocator has run out of memory\n"); + printf("error: early allocator has run out of memory\n"); PANIC(OUT_OF_MEMORY); } diff --git a/kc/core/panic.c b/kc/core/panic.c index 7844487..02c58c7 100644 --- a/kc/core/panic.c +++ b/kc/core/panic.c @@ -1,6 +1,6 @@ #include "panic.h" -#include <lib/kstdio.h> +#include <libc/stdio.h> #include <stdbool.h> @@ -13,12 +13,12 @@ static char const *reason_strings[] = { noreturn void panic(const char *file, int line, enum panic_reason reason) { - // TODO: kprintf() and friends + // TODO: printf() and friends if (reason > sizeof(reason_strings) / sizeof(*reason_strings)) { reason = 0; } - kprintf( + printf( "kernel panic:%s:%u %s\n", file, line, diff --git a/kc/core/pic8259.c b/kc/core/pic8259.c index 4ddd2e1..792d0bd 100644 --- a/kc/core/pic8259.c +++ b/kc/core/pic8259.c @@ -4,7 +4,7 @@ #include <stdbool.h> -#include <lib/kstdio.h> +#include <libc/stdio.h> #define ICW1_ICW4 0x1 #define ICW1_SINGLE 0x2 @@ -28,7 +28,7 @@ void pic8259_irq_install(uint8_t irq, pic8259_handler_func h) { if (irq_handlers[irq]) { - kprintf("attempt to overwrite irq handler for %u\n", irq); + printf("attempt to overwrite irq handler for %u\n", irq); return; } irq_handlers[irq] = h; @@ -43,7 +43,7 @@ static void wait(void) void pic8259_init(void) { - kprintf("initializing legacy pic\n"); + printf("initializing legacy pic\n"); // basic init. not gonna fret with this too much outb(PIC_PRI_CMD, ICW1_INIT|ICW1_ICW4); wait(); @@ -171,7 +171,7 @@ void pic8259_irq_begin(uint8_t irq) // check for spurious activations if (irq_is_spurious(irq)) { - kprintf("spurious activation of irq%hhu\n", irq); + printf("spurious activation of irq%hhu\n", irq); return; } @@ -181,12 +181,12 @@ void pic8259_irq_begin(uint8_t irq) if (result) { - kprintf("error handling irq%hhu: % d\n", irq, result); + printf("error handling irq%hhu: % d\n", irq, result); } } else { - kprintf("unhandled irq%hhu\n", irq); + printf("unhandled irq%hhu\n", irq); } pic8259_irq_end(irq); diff --git a/kc/core/pit8253.c b/kc/core/pit8253.c index 360808f..31cf349 100644 --- a/kc/core/pit8253.c +++ b/kc/core/pit8253.c @@ -5,7 +5,7 @@ #include <stdatomic.h> -#include <lib/kstdio.h> +#include <libc/stdio.h> #define PIT8253_DATA0 0x40 #define PIT8253_CMD 0x43 @@ -82,9 +82,9 @@ void pit8253_set_frequency(uint32_t frequency) if (d > UINT16_MAX) { - kprintf("warning: %uHz is too slow for 8253 pit\n", PIT_HZ/d); + printf("warning: %uHz is too slow for 8253 pit\n", PIT_HZ/d); d = UINT16_MAX; - kprintf("warning: set timer to minimum frequency\n"); + printf("warning: set timer to minimum frequency\n"); } set_divisor(d); diff --git a/kc/core/kstdio.c b/kc/core/stdio.c index 680eb07..66c539f 100644 --- a/kc/core/kstdio.c +++ b/kc/core/stdio.c @@ -4,12 +4,12 @@ #include <stdint.h> #include <stdbool.h> -#include <lib/kstdio.h> -#include <lib/kstring.h> +#include <libc/stdio.h> +#include <libc/string.h> -FILE *kstdout; +FILE *stdout; -int kfputc(int c, FILE *f) +int fputc(int c, FILE *f) { (void)f; video_putchar(c); diff --git a/kc/core/task.c b/kc/core/task.c index 5eaa3fb..a298a05 100644 --- a/kc/core/task.c +++ b/kc/core/task.c @@ -12,7 +12,7 @@ #include <stdbool.h> #include <lib/elf.h> -#include <lib/kstdio.h> +#include <libc/stdio.h> #include "arch_thread.h" @@ -110,7 +110,7 @@ static volatile atomic_bool preempt_switch_flag = false; static void *idle_thread_entry(void *) { - kprintf("idle thread started\n"); + printf("idle thread started\n"); __asm__ ("sti"); @@ -132,7 +132,7 @@ static void *sleepy_thread_entry(void *p) { sleep_thread(sleep_nanoseconds); thread_slept_count++; - kprintf("thread slept %d times\n", thread_slept_count); + printf("thread slept %d times\n", thread_slept_count); } (void)thread_slept_count; @@ -414,19 +414,19 @@ union kc_thread_result kct_wait(struct kc_thread *target) static void *waited_thread_test(void *) { - kprintf("worker thread, sleeping for some time...\n"); + printf("worker thread, sleeping for some time...\n"); sleep_thread(30000000000); return (void *)1; } static void *waiting_thread_test(void *) { - kprintf("waiting thread\n"); + printf("waiting thread\n"); struct kc_thread *t = create_thread(waited_thread_test, nullptr); t->status = READY; thread_queue_push_back(&ready_queue, t); union kc_thread_result r = kct_wait(t); - kprintf("waited thread terminated result: %d\n", r); + printf("waited thread terminated result: %d\n", r); return nullptr; } @@ -439,7 +439,7 @@ noreturn void task_init(void) timesource = &pit8253_timer_source; timesource->append_callback(sleeping_thread_callback); timesource->start(); - kprintf( + printf( "starting task management, timesource delta %luns\n", timesource->nanoseconds_delta()); @@ -454,7 +454,7 @@ noreturn void task_init(void) thread_queue_push(&ready_queue, idle_thread); block_thread(BLOCKED); // shouldn't ever get here - kprintf("the idle thread exited somehow. we're back in the boot thread. this is not good.\n"); + printf("the idle thread exited somehow. we're back in the boot thread. this is not good.\n"); PANIC(DEAD_END); } diff --git a/kc/core/video.c b/kc/core/video.c index 6d89c08..a3bdce2 100644 --- a/kc/core/video.c +++ b/kc/core/video.c @@ -46,8 +46,8 @@ #include <stdbool.h> -#include <lib/kstring.h> -#include <lib/kstdio.h> +#include <libc/string.h> +#include <libc/stdio.h> #include <lib/numeric.h> #include <kernel/entry.h> @@ -227,7 +227,7 @@ int video_init(void) } } - kprintf("video output %ix%i pixels, %i bytes per line, %s 32 bytes per pixel\n", + printf("video output %ix%i pixels, %i bytes per line, %s 32 bytes per pixel\n", boot_data->width, boot_data->height, boot_data->pitch, video_format_name); diff --git a/kc/core/vm_tree.c b/kc/core/vm_tree.c index 9bab154..72affe8 100644 --- a/kc/core/vm_tree.c +++ b/kc/core/vm_tree.c @@ -31,8 +31,8 @@ #include "vm_tree.h" #include "panic.h" -#include <lib/kstdio.h> -#include <lib/kstring.h> +#include <libc/stdio.h> +#include <libc/string.h> #define assert(expr) @@ -102,7 +102,7 @@ void vmt_init_node( } else { - kprintf("fatal: attempt to insert overlapping vm node\n" + printf("fatal: attempt to insert overlapping vm node\n" "node 1: %p: %p @ %zu bytes\n" "node 2: %p: %p @ %zu bytes\n", node->key.address, node->key.size, diff --git a/lib/api/libc/stdio.h b/lib/api/libc/stdio.h new file mode 100644 index 0000000..1edec4a --- /dev/null +++ b/lib/api/libc/stdio.h @@ -0,0 +1,18 @@ +#pragma once + +#include <libc/string.h> + +#include <stdarg.h> + +typedef struct FILE FILE; + +extern FILE *stdout; +extern FILE *stderr; + +extern int fputc(int c, FILE *f); + +int vfprintf(FILE *f, const char *restrict format, va_list arguments); +int fprintf(FILE *f, const char *restrict format, ...); +int vprintf(const char *restrict format, va_list arguments); +int printf(const char *restrict format, ...); + diff --git a/api/lib/kstring.h b/lib/api/libc/string.h index c28e17c..c28e17c 100644 --- a/api/lib/kstring.h +++ b/lib/api/libc/string.h diff --git a/lib/memcmp.c b/lib/libc/memcmp.c index 2348afe..2348afe 100644 --- a/lib/memcmp.c +++ b/lib/libc/memcmp.c diff --git a/lib/memcpy.c b/lib/libc/memcpy.c index 58b1e40..58b1e40 100644 --- a/lib/memcpy.c +++ b/lib/libc/memcpy.c diff --git a/lib/memmove.c b/lib/libc/memmove.c index fd06bb6..fd06bb6 100644 --- a/lib/memmove.c +++ b/lib/libc/memmove.c diff --git a/lib/memset.c b/lib/libc/memset.c index 3e7025e..3e7025e 100644 --- a/lib/memset.c +++ b/lib/libc/memset.c diff --git a/lib/kprintf.c b/lib/libc/printf.c index 3d803f6..ad33cca 100644 --- a/lib/kprintf.c +++ b/lib/libc/printf.c @@ -1,4 +1,4 @@ -#include <lib/kstdio.h> +#include <libc/stdio.h> #include <stddef.h> #include <stdint.h> #include <stdbool.h> @@ -561,14 +561,14 @@ static int printf_internal( static int kfp_write_character(struct method *m, char c) { - kfputc((int)c, (FILE *)m->output); + fputc((int)c, (FILE *)m->output); m->count++; return 0; } static int kfp_write_wcharacter(struct method *m, wchar_t c) { - kfputc((int)c, (FILE *)m->output); + fputc((int)c, (FILE *)m->output); m->count++; return 0; } @@ -591,7 +591,7 @@ static int kfp_write_wstring(struct method *m, const wchar_t *s) return 0; } -int kvfprintf(FILE *f, const char *restrict format, va_list arguments) +int vfprintf(FILE *f, const char *restrict format, va_list arguments) { struct method m = { kfp_write_character, @@ -615,36 +615,36 @@ int kvfprintf(FILE *f, const char *restrict format, va_list arguments) } } -int kfprintf(FILE *f, const char *restrict format, ...) +int fprintf(FILE *f, const char *restrict format, ...) { va_list arguments; va_start(arguments, format); - int count = kvfprintf(f, format, arguments); + int count = vfprintf(f, format, arguments); va_end(arguments); return count; } -int kvprintf(const char *restrict format, va_list arguments) +int vprintf(const char *restrict format, va_list arguments) { va_list acopy; va_copy(acopy, arguments); - int count = kvfprintf(kstdout, format, arguments); + int count = vfprintf(stdout, format, arguments); va_end(acopy); return count; } -int kprintf(const char *restrict format, ...) +int printf(const char *restrict format, ...) { va_list arguments; va_start(arguments, format); - int count = kvprintf(format, arguments); + int count = vprintf(format, arguments); va_end(arguments); diff --git a/lib/string.c b/lib/libc/string.c index f6bc682..9316d98 100644 --- a/lib/string.c +++ b/lib/libc/string.c @@ -1,4 +1,4 @@ -#include <lib/kstring.h> +#include <libc/string.h> #include <stdbool.h> size_t strlen(const char *s) diff --git a/loader/main_efi.c b/loader/main_efi.c index df156e3..b3df593 100644 --- a/loader/main_efi.c +++ b/loader/main_efi.c @@ -6,8 +6,8 @@ #include <efi/error.h> #include <lib/elf.h> -#include <lib/kstdio.h> -#include <lib/kstring.h> +#include <libc/stdio.h> +#include <libc/string.h> FILE *kstdout; FILE *kstderr; @@ -121,7 +121,7 @@ static const CHAR16 *efi_warning_strings[] = }; **/ -int kfputc(int c, FILE *f) +int fputc(int c, FILE *f) { (void)f; EFI_STATUS status = EFI_SUCCESS; @@ -184,7 +184,7 @@ EFI_STATUS efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table) linebuf_ptr = linebuf; } - kprintf("loader interface %p\r\n" + printf("loader interface %p\r\n" "image_handle %p\r\n" "system_table %p\r\n" "page_alloc %p\r\n" @@ -203,25 +203,25 @@ EFI_STATUS efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table) if (EFI_ERROR((status = open_image(&shim_image)))) { - kprintf("error opening shim image: %ls\r\n", + printf("error opening shim image: %ls\r\n", efi_strerror(status)); } if (EFI_ERROR((status = allocate_image(&shim_image)))) { - kprintf("error allocating shim image: %ls\r\n", + printf("error allocating shim image: %ls\r\n", efi_strerror(status)); } if (EFI_ERROR((status = load_image(&shim_image)))) { - kprintf("error loading shim image: %ls\r\n", + printf("error loading shim image: %ls\r\n", efi_strerror(status)); } if (EFI_ERROR((status = enter_shim()))) { - kprintf("error running shim image: %ls\r\n", + printf("error running shim image: %ls\r\n", efi_strerror(status)); } @@ -280,7 +280,7 @@ EFI_STATUS open_image(struct efi_loader_image *image) if (EFI_ERROR(status)) { - kprintf( + printf( "failed locating image protocol: %ls\r\n", efi_strerror(status)); return status; @@ -296,7 +296,7 @@ EFI_STATUS open_image(struct efi_loader_image *image) if (EFI_ERROR(status)) { - kprintf( + printf( "failed locating ESP file system: %ls\r\n", efi_strerror(status)); return status; @@ -306,13 +306,13 @@ EFI_STATUS open_image(struct efi_loader_image *image) if (EFI_ERROR(status)) { - kprintf( + printf( "failed opening root device: %ls\r\n", efi_strerror(status)); return status; } - kprintf("opening image %ls\r\n", image->path); + printf("opening image %ls\r\n", image->path); status = root->Open(root, &image->file, @@ -326,7 +326,7 @@ EFI_STATUS open_image(struct efi_loader_image *image) } else { - kprintf("failed opening image %ls: %r\r\n", image->path, status); + printf("failed opening image %ls: %r\r\n", image->path, status); return status; } @@ -349,13 +349,13 @@ EFI_STATUS open_image(struct efi_loader_image *image) else { FreePool(phdrs); - kprintf("invalid image format detected\r\n"); + printf("invalid image format detected\r\n"); return EFI_INVALID_PARAMETER; } } else { - kprintf("failed reading shim image headers\r\n"); + printf("failed reading shim image headers\r\n"); return status; } @@ -365,11 +365,11 @@ EFI_STATUS open_image(struct efi_loader_image *image) { image->buffer_size = elf_size(&ehdr, phdrs); image->system_table = gST; - kprintf("elf image %d bytes\r\n", image->buffer_size); + printf("elf image %d bytes\r\n", image->buffer_size); } else { - kprintf("failed reading shim image segments\r\n"); + printf("failed reading shim image segments\r\n"); } FreePool(phdrs); @@ -379,7 +379,7 @@ EFI_STATUS open_image(struct efi_loader_image *image) EFI_STATUS allocate_image(struct efi_loader_image *image) { - kprintf("allocating image %ls\r\n", image->path); + printf("allocating image %ls\r\n", image->path); EFI_STATUS status; status = alloc_page(SystemMemoryType, @@ -399,7 +399,7 @@ static EFI_STATUS read_image(struct efi_loader_image *image, UINTN offset, UINTN length) { - kprintf("reading %d bytes from image at %p %ls\r\n", + printf("reading %d bytes from image at %p %ls\r\n", length, offset, image->path); @@ -413,7 +413,7 @@ static EFI_STATUS read_image(struct efi_loader_image *image, } else { - kprintf("failed seeking shim image: %ls\r\n", efi_strerror(status)); + printf("failed seeking shim image: %ls\r\n", efi_strerror(status)); } return status; @@ -449,7 +449,7 @@ EFI_STATUS load_image(struct efi_loader_image *image) if (!EFI_ERROR(status)) { - kprintf("loaded segment %p of %d bytes " + printf("loaded segment %p of %d bytes " "(file size %d bytes)\r\n", placement, phdrs[i].p_memsz, @@ -468,7 +468,7 @@ static EFI_STATUS enter_shim(void) efi_shim_entry_func *entry; entry = (efi_shim_entry_func *)(shim_image.buffer_base + ehdr->e_entry); - kprintf("entering shim @%p\r\n", entry); + printf("entering shim @%p\r\n", entry); status = entry(&loader_interface); |
