meta: rename

This commit is contained in:
2024-11-02 11:31:51 +00:00
parent 065fdeec65
commit 62ec4c93ab
140 changed files with 422 additions and 857 deletions

View File

@@ -1,18 +0,0 @@
LD := gcc
CC := gcc
ASM := gcc
OBJCOPY := objcopy
STRIP := strip
CFLAGS :=
ASMFLAGS := $(CFLAGS)
LDFLAGS :=
ARCH_CFLAGS := -D_64BIT
ARCH_LDFLAGS :=
ARCH_DIR := arch/$(SOCKS_ARCH)
ARCH_C_FILES := $(wildcard $(ARCH_DIR)/*.c) $(wildcard $(ARCH_DIR)/acpi/*.c)
ARCH_ASM_FILES := $(wildcard $(ARCH_DIR)/*.S) $(wildcard $(ARCH_DIR)/acpi/*.S)
ARCH_OBJ := $(addprefix $(BUILD_DIR)/,$(ARCH_C_FILES:.c=.o) $(ARCH_ASM_FILES:.S=.o))

View File

@@ -1,5 +1,5 @@
#include <unistd.h>
#include <socks/machine/cpu.h>
#include <mango/machine/cpu.h>
int ml_init_bootcpu(void)
{

View File

@@ -1,13 +0,0 @@
run: $(BUILD_DIR)/$(KERNEL_EXEC)
@printf " \033[1;93mEXEC\033[0m $<\n"
@$(BUILD_DIR)/$(KERNEL_EXEC)
debug: $(BUILD_DIR)/$(KERNEL_EXEC) $(BUILD_DIR)/$(KERNEL_EXEC).dbg
@if command -v gdb &> /dev/null; then \
gdb -tui $(BUILD_DIR)/$(KERNEL_EXEC).dbg; \
elif command -v lldb &> /dev/null; then \
lldb -- $(BUILD_DIR)/$(KERNEL_EXEC).dbg; \
else \
printf "No debuggers available.\n"; \
fi

View File

@@ -1,5 +1,5 @@
#include <socks/machine/hwlock.h>
#include <socks/compiler.h>
#include <mango/machine/hwlock.h>
#include <mango/compiler.h>
void ml_hwlock_lock(ml_hwlock_t *lck)
{

View File

@@ -1,5 +1,5 @@
#ifndef SOCKS_USER_CPU_H_
#define SOCKS_USER_CPU_H_
#ifndef MANGO_USER_CPU_H_
#define MANGO_USER_CPU_H_
#ifdef __cplusplus
extern "C" {

View File

@@ -1,5 +1,5 @@
#ifndef SOCKS_USER_HWLOCK_H_
#define SOCKS_USER_HWLOCK_H_
#ifndef MANGO_USER_HWLOCK_H_
#define MANGO_USER_HWLOCK_H_
#define ML_HWLOCK_INIT (0)

View File

@@ -1,5 +1,5 @@
#ifndef SOCKS_X86_64_INIT_H_
#define SOCKS_X86_64_INIT_H_
#ifndef MANGO_X86_64_INIT_H_
#define MANGO_X86_64_INIT_H_
#include <stdint.h>

View File

@@ -0,0 +1,5 @@
#ifndef MANGO_X86_64_IRQ_H_
#define MANGO_X86_64_IRQ_H_
#endif

View File

@@ -1,5 +1,5 @@
#ifndef SOCKS_USER_PMAP_H_
#define SOCKS_USER_PMAP_H_
#ifndef MANGO_USER_PMAP_H_
#define MANGO_USER_PMAP_H_
typedef uintptr_t ml_pmap_t;
typedef uint64_t ml_pfn_t;

View File

@@ -1,5 +1,5 @@
#ifndef SOCKS_USER_VM_H_
#define SOCKS_USER_VM_H_
#ifndef MANGO_USER_VM_H_
#define MANGO_USER_VM_H_
#include <stdint.h>

View File

@@ -1,5 +0,0 @@
#ifndef SOCKS_X86_64_IRQ_H_
#define SOCKS_X86_64_IRQ_H_
#endif

View File

@@ -1,11 +1,11 @@
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <socks/init.h>
#include <socks/memblock.h>
#include <socks/vm.h>
#include <socks/object.h>
#include <socks/printk.h>
#include <mango/init.h>
#include <mango/memblock.h>
#include <mango/vm.h>
#include <mango/object.h>
#include <mango/printk.h>
#include <arch/stdcon.h>
#include <sys/mman.h>

View File

@@ -1,4 +1,4 @@
#include <socks/init.h>
#include <mango/init.h>
#ifdef __APPLE__
extern char __start_initcall0[] __asm("section$start$__DATA$__initcall0.init");

View File

@@ -1,10 +1,10 @@
#include <socks/libc/string.h>
#include <socks/libc/ctype.h>
#include <mango/libc/string.h>
#include <mango/libc/ctype.h>
#include <stdint.h>
#include <stdio.h>
#include <socks/console.h>
#include <socks/vm.h>
#include <socks/printk.h>
#include <mango/console.h>
#include <mango/vm.h>
#include <mango/printk.h>
static void stdcon_write(struct console *con, const char *s, unsigned int len)
{

View File

@@ -1,5 +1,5 @@
#include <socks/sched.h>
#include <socks/compiler.h>
#include <mango/sched.h>
#include <mango/compiler.h>
//size_t THREAD_sp = offsetof(struct thread, tr_sp);

View File

@@ -1,21 +0,0 @@
LD := $(SOCKS_ARCH)-elf-gcc
CC := $(SOCKS_ARCH)-elf-gcc
CXX := $(SOCKS_ARCH)-elf-g++
ASM := $(SOCKS_ARCH)-elf-gcc
OBJCOPY := $(SOCKS_ARCH)-elf-objcopy
STRIP := $(SOCKS_ARCH)-elf-strip
CFLAGS := -ffreestanding -nostdlib
CXXFLAGS := $(CFLAGS)
ASMFLAGS := $(CFLAGS)
LDFLAGS := -nostdlib
ARCH_CFLAGS := -z max-page-size=0x1000 -m64 -mcmodel=large -mno-red-zone -mno-mmx -mno-sse -mno-sse2 -D_64BIT -DBYTE_ORDER=1234
ARCH_LDFLAGS := -z max-page-size=0x1000 -T arch/x86_64/layout.ld
ARCH_DIR := arch/$(SOCKS_ARCH)
ARCH_C_FILES := $(wildcard $(ARCH_DIR)/*.c) $(wildcard $(ARCH_DIR)/acpi/*.c)
ARCH_CXX_FILES := $(wildcard $(ARCH_DIR)/*.cpp) $(wildcard $(ARCH_DIR)/acpi/*.cpp)
ARCH_ASM_FILES := $(wildcard $(ARCH_DIR)/*.S) $(wildcard $(ARCH_DIR)/acpi/*.S)
ARCH_OBJ := $(addprefix $(BUILD_DIR)/,$(ARCH_C_FILES:.c=.o) $(ARCH_CXX_FILES:.cpp=.o) $(ARCH_ASM_FILES:.S=.o))

View File

@@ -1,4 +1,4 @@
#include <socks/machine/cpu.h>
#include <mango/machine/cpu.h>
#include <arch/msr.h>
int ml_cpu_block_init(ml_cpu_block *p)

View File

@@ -1,7 +1,7 @@
#include "socks/types.h"
#include <socks/memblock.h>
#include <socks/printk.h>
#include <socks/util.h>
#include "mango/types.h"
#include <mango/memblock.h>
#include <mango/printk.h>
#include <mango/util.h>
#include <arch/e820.h>
void e820_scan(multiboot_memory_map_t *mmap, size_t len)

View File

@@ -1,64 +0,0 @@
QEMU := qemu-system-x86_64
#QEMU_MONITOR_FLAGS := -serial file:$(BUILD_DIR)socks.log -monitor stdio
QEMU_MONITOR_FLAGS := -serial stdio
QEMU_FLAGS := \
-m 10M \
-display sdl \
-smp 4 -cpu qemu64,pdpe1gb
ARCH_TEMP_FILES := $(BUILD_DIR)/$(KERNEL_EXEC).elf32
# qemu refuses to boot ELF64 binaries. this creates a patched version of the kernel
# binary to trick qemu into thinking its an ELF32.
# this has no effect on the kernel itself; the x86_64 kernel's
# entry point is 32-bit machine code.
$(BUILD_DIR)/$(KERNEL_EXEC).elf32: $(BUILD_DIR)/$(KERNEL_EXEC)
@cp $(BUILD_DIR)/$(KERNEL_EXEC) $(BUILD_DIR)/$(KERNEL_EXEC).elf32
$(BUILD_DIR)/tools/e64patch/e64patch $(BUILD_DIR)/$(KERNEL_EXEC).elf32
$(BUILD_DIR)/socks-kernel.iso: $(BUILD_DIR)/$(KERNEL_EXEC)
@$(BUILD_DIR)/../tools/socks.mkrescue
run: $(BUILD_DIR)/$(KERNEL_EXEC) $(BUILD_DIR)/$(KERNEL_EXEC).elf32
@printf " \033[1;93mQEMU\033[0m $<\n"
@$(QEMU) -kernel $(BUILD_DIR)/$(KERNEL_EXEC).elf32 $(QEMU_FLAGS) $(QEMU_MONITOR_FLAGS)
run-curses: $(BUILD_DIR)/$(KERNEL_EXEC) $(BUILD_DIR)/$(KERNEL_EXEC).elf32
@printf " \033[1;93mQEMU\033[0m $<\n"
@$(QEMU) -kernel $(BUILD_DIR)/$(KERNEL_EXEC).elf32 $(QEMU_FLAGS) $(QEMU_MONITOR_FLAGS)
run-cd-curses: $(BUILD_DIR)/socks-kernel.iso
@printf " \033[1;93mQEMU\033[0m $<\n"
@$(QEMU) -cdrom $(BUILD_DIR)/socks-kernel.iso $(QEMU_FLAGS) -display curses -serial file:$(BUILD_DIR)/socks.log
debug: $(BUILD_DIR)/$(KERNEL_EXEC) $(BUILD_DIR)/$(KERNEL_EXEC).elf32
@./tools/kernel-debug/debug_session.sh \
tools/kernel-debug/gdb_session_init \
tools/kernel-debug/lldb_session_init \
$(QEMU) \
-kernel $(BUILD_DIR)/$(KERNEL_EXEC).elf32 -S -s \
-monitor stdio -serial file:$(BUILD_DIR)/socks.log $(QEMU_FLAGS)
debug-curses: $(BUILD_DIR)/$(KERNEL_EXEC) $(BUILD_DIR)/$(KERNEL_EXEC).elf32
@./tools/kernel-debug/debug_session.sh \
tools/kernel-debug/gdb_session_init \
tools/kernel-debug/lldb_session_init \
$(QEMU) \
-kernel $(BUILD_DIR)/$(KERNEL_EXEC).elf32 -S -s \
-display curses -serial file:$(BUILD_DIR)/socks.log $(QEMU_FLAGS) > build/qemu.log
debug-cd-curses: $(BUILD_DIR)/socks-kernel.iso
@./tools/kernel-debug/debug_session.sh \
tools/kernel-debug/gdb_session_init \
tools/kernel-debug/lldb_session_init \
$(QEMU) \
-cdrom $(BUILD_DIR)/socks-kernel.iso -S -s \
-display curses -serial file:$(BUILD_DIR)/socks.log $(QEMU_FLAGS) > build/qemu.log
run-bochs: $(BUILD_DIR)/socks-kernel.iso
@printf " \033[1;93mBOCHS\033[0m $<\n"
@bochs -f $(BUILD_DIR)/../tools/bochsrc.bxrc

View File

@@ -1,4 +1,4 @@
#include <socks/libc/string.h>
#include <mango/libc/string.h>
#include <arch/gdt.h>
static void init_entry(struct gdt_entry *entry, int access, int flags)

View File

@@ -1,7 +1,7 @@
#ifndef ARCH_GDT_H_
#define ARCH_GDT_H_
#include <socks/compiler.h>
#include <mango/compiler.h>
#include <stdint.h>
#ifdef __cplusplus

View File

@@ -1,8 +1,8 @@
#ifndef ARCH_IRQ_H_
#define ARCH_IRQ_H_
#include <socks/compiler.h>
#include <socks/queue.h>
#include <mango/compiler.h>
#include <mango/queue.h>
#include <stdint.h>
#ifdef __cplusplus

View File

@@ -1,8 +1,8 @@
#ifndef ARCH_PAGING_H_
#define ARCH_PAGING_H_
#include <socks/types.h>
#include <socks/compiler.h>
#include <mango/types.h>
#include <mango/compiler.h>
#ifdef __cplusplus
extern "C" {

View File

@@ -1,5 +1,5 @@
#ifndef SOCKS_X86_64_CPU_H_
#define SOCKS_X86_64_CPU_H_
#ifndef MANGO_X86_64_CPU_H_
#define MANGO_X86_64_CPU_H_
#include <arch/gdt.h>
#include <arch/irq.h>

View File

@@ -1,5 +1,5 @@
#ifndef SOCKS_X86_64_HWLOCK_H_
#define SOCKS_X86_64_HWLOCK_H_
#ifndef MANGO_X86_64_HWLOCK_H_
#define MANGO_X86_64_HWLOCK_H_
#define ML_HWLOCK_INIT (0)

View File

@@ -1,5 +1,5 @@
#ifndef SOCKS_X86_64_INIT_H_
#define SOCKS_X86_64_INIT_H_
#ifndef MANGO_X86_64_INIT_H_
#define MANGO_X86_64_INIT_H_
#include <stdint.h>

View File

@@ -0,0 +1,5 @@
#ifndef MANGO_X86_64_IRQ_H_
#define MANGO_X86_64_IRQ_H_
#endif

View File

@@ -1,5 +1,5 @@
#ifndef SOCKS_X86_64_PANIC_H_
#define SOCKS_X86_64_PANIC_H_
#ifndef MANGO_X86_64_PANIC_H_
#define MANGO_X86_64_PANIC_H_
#include <stdint.h>

View File

@@ -1,5 +1,5 @@
#ifndef SOCKS_X86_64_PMAP_H_
#define SOCKS_X86_64_PMAP_H_
#ifndef MANGO_X86_64_PMAP_H_
#define MANGO_X86_64_PMAP_H_
#include <arch/paging.h>

View File

@@ -1,7 +1,7 @@
#ifndef SOCKS_X86_64_THREAD_H_
#define SOCKS_X86_64_THREAD_H_
#ifndef MANGO_X86_64_THREAD_H_
#define MANGO_X86_64_THREAD_H_
#include <socks/sched.h>
#include <mango/sched.h>
extern void switch_to(struct thread *from, struct thread *to);
extern void prepare_stack(uintptr_t ip, uintptr_t *sp);

View File

@@ -1,5 +1,5 @@
#ifndef SOCKS_X86_64_VM_H_
#define SOCKS_X86_64_VM_H_
#ifndef MANGO_X86_64_VM_H_
#define MANGO_X86_64_VM_H_
/* kernel higher-half base virtual address. */
#define VM_KERNEL_VOFFSET 0xFFFFFFFF80000000

View File

@@ -1,5 +0,0 @@
#ifndef SOCKS_X86_64_IRQ_H_
#define SOCKS_X86_64_IRQ_H_
#endif

View File

@@ -2,20 +2,20 @@
#include <arch/e820.h>
#include <arch/pit.h>
#include <socks/arg.h>
#include <socks/clock.h>
#include <socks/console.h>
#include <socks/cpu.h>
#include <socks/init.h>
#include <socks/libc/stdio.h>
#include <socks/machine/cpu.h>
#include <socks/memblock.h>
#include <socks/object.h>
#include <socks/percpu.h>
#include <socks/pmap.h>
#include <socks/printk.h>
#include <socks/types.h>
#include <socks/vm.h>
#include <mango/arg.h>
#include <mango/clock.h>
#include <mango/console.h>
#include <mango/cpu.h>
#include <mango/init.h>
#include <mango/libc/stdio.h>
#include <mango/machine/cpu.h>
#include <mango/memblock.h>
#include <mango/object.h>
#include <mango/percpu.h>
#include <mango/pmap.h>
#include <mango/printk.h>
#include <mango/types.h>
#include <mango/vm.h>
#define PTR32(x) ((void *)((uintptr_t)(x)))

View File

@@ -1,4 +1,4 @@
#include <socks/init.h>
#include <mango/init.h>
extern char __initcall0_start[];
extern char __initcall1_start[];

View File

@@ -1,11 +1,11 @@
#include <arch/irq.h>
#include <arch/ports.h>
#include <socks/cpu.h>
#include <socks/libc/string.h>
#include <socks/machine/cpu.h>
#include <socks/machine/irq.h>
#include <socks/panic.h>
#include <socks/sched.h>
#include <mango/cpu.h>
#include <mango/libc/string.h>
#include <mango/machine/cpu.h>
#include <mango/machine/irq.h>
#include <mango/panic.h>
#include <mango/sched.h>
#include <stddef.h>
#define MAX_ISR_HANDLERS 16

View File

@@ -1,7 +1,7 @@
#include "socks/machine/panic.h"
#include "socks/vm.h"
#include <socks/printk.h>
#include <socks/libc/stdio.h>
#include "mango/machine/panic.h"
#include "mango/vm.h"
#include <mango/printk.h>
#include <mango/libc/stdio.h>
#include <arch/irq.h>
#define R_CF 0

View File

@@ -1,8 +1,8 @@
#include <arch/irq.h>
#include <arch/ports.h>
#include <socks/clock.h>
#include <socks/cpu.h>
#include <socks/printk.h>
#include <mango/clock.h>
#include <mango/cpu.h>
#include <mango/printk.h>
#define PIT_COUNTER0 0x40
#define PIT_CMD 0x43

View File

@@ -1,10 +1,10 @@
#include <socks/types.h>
#include <socks/memblock.h>
#include <socks/vm.h>
#include <socks/printk.h>
#include <socks/status.h>
#include <socks/compiler.h>
#include <socks/pmap.h>
#include <mango/types.h>
#include <mango/memblock.h>
#include <mango/vm.h>
#include <mango/printk.h>
#include <mango/status.h>
#include <mango/compiler.h>
#include <mango/pmap.h>
/* some helpful datasize constants */
#define C_1GiB 0x40000000ULL

View File

@@ -1,11 +1,11 @@
#include <arch/irq.h>
#include <arch/ports.h>
#include <arch/serial.h>
#include <socks/device.h>
#include <socks/kext.h>
#include <socks/libc/stdio.h>
#include <socks/printk.h>
#include <socks/tty.h>
#include <mango/device.h>
#include <mango/kext.h>
#include <mango/libc/stdio.h>
#include <mango/printk.h>
#include <mango/tty.h>
#define COM1 0x3F8
#define COM2 0x2F8

View File

@@ -1,4 +1,4 @@
#include <socks/machine/thread.h>
#include <mango/machine/thread.h>
struct thread_ctx {
uint64_t r15, r14, r13, r12, r11, r10, r9, r8;