From 62ec4c93ab4f150e5a2325aa5d5fb2f3a1626d22 Mon Sep 17 00:00:00 2001 From: Max Wash Date: Sat, 2 Nov 2024 11:31:51 +0000 Subject: [PATCH] meta: rename --- Makefile | 121 ------------------ README | 2 +- arch/user/config.mk | 18 --- arch/user/cpu.c | 2 +- arch/user/extra.mk | 13 -- arch/user/hwlock.c | 4 +- .../include/{socks => mango}/machine/cpu.h | 4 +- .../include/{socks => mango}/machine/hwlock.h | 4 +- .../include/{socks => mango}/machine/init.h | 4 +- arch/user/include/mango/machine/irq.h | 5 + .../include/{socks => mango}/machine/pmap.h | 4 +- .../include/{socks => mango}/machine/vm.h | 4 +- arch/user/include/socks/machine/irq.h | 5 - arch/user/init.c | 10 +- arch/user/initcall.c | 2 +- arch/user/stdcon.c | 10 +- arch/x86_64/asm-offset.c | 4 +- arch/x86_64/config.mk | 21 --- arch/x86_64/cpu.c | 2 +- arch/x86_64/e820.c | 8 +- arch/x86_64/extra.mk | 64 --------- arch/x86_64/gdt.c | 2 +- arch/x86_64/include/arch/gdt.h | 2 +- arch/x86_64/include/arch/irq.h | 4 +- arch/x86_64/include/arch/paging.h | 4 +- .../include/{socks => mango}/machine/cpu.h | 4 +- .../include/{socks => mango}/machine/hwlock.h | 4 +- .../include/{socks => mango}/machine/init.h | 4 +- arch/x86_64/include/mango/machine/irq.h | 5 + .../include/{socks => mango}/machine/panic.h | 4 +- .../include/{socks => mango}/machine/pmap.h | 4 +- .../include/{socks => mango}/machine/thread.h | 6 +- .../include/{socks => mango}/machine/vm.h | 4 +- arch/x86_64/include/socks/machine/irq.h | 5 - arch/x86_64/init.c | 28 ++-- arch/x86_64/initcall.c | 2 +- arch/x86_64/irq.c | 12 +- arch/x86_64/panic.c | 8 +- arch/x86_64/pit.c | 6 +- arch/x86_64/pmap.c | 14 +- arch/x86_64/serial.c | 10 +- arch/x86_64/thread.c | 2 +- doc/objects.rst | 109 ---------------- ds/bitmap.c | 4 +- ds/btree.c | 2 +- ds/queue.c | 2 +- ds/ringbuffer.c | 8 +- include/{socks => mango}/arg.h | 6 +- include/{socks => mango}/bitmap.h | 4 +- include/{socks => mango}/block.h | 12 +- include/{socks => mango}/btree.h | 4 +- include/{socks => mango}/clock.h | 4 +- include/{socks => mango}/compiler.h | 4 +- include/{socks => mango}/console.h | 10 +- include/{socks => mango}/cpu.h | 10 +- include/{socks => mango}/device.h | 38 +++--- include/{socks => mango}/fb.h | 4 +- include/{socks => mango}/flags.h | 6 +- include/{socks => mango}/init.h | 8 +- include/{socks => mango}/input.h | 8 +- include/{socks => mango}/kext.h | 16 +-- include/{socks => mango}/locks.h | 8 +- include/{socks => mango}/memblock.h | 6 +- include/{socks => mango}/object.h | 20 +-- include/{socks => mango}/panic.h | 6 +- include/{socks => mango}/percpu.h | 10 +- include/{socks => mango}/pmap.h | 10 +- include/{socks => mango}/printk.h | 6 +- include/{socks => mango}/queue.h | 6 +- include/{socks => mango}/ringbuffer.h | 12 +- include/{socks => mango}/sched.h | 16 +-- include/{socks => mango}/status.h | 4 +- include/{socks => mango}/termios.h | 4 +- include/{socks => mango}/test.h | 4 +- include/{socks => mango}/tty.h | 20 +-- include/{socks => mango}/types.h | 4 +- include/{socks => mango}/util.h | 4 +- include/{socks => mango}/vm.h | 18 +-- init/init.c | 2 +- init/main.c | 32 ++--- kernel/arg.c | 6 +- kernel/clock.c | 6 +- kernel/console.c | 8 +- kernel/cpu.c | 6 +- kernel/panic.c | 10 +- kernel/percpu.c | 6 +- kernel/printk.c | 8 +- kernel/status.c | 2 +- libc/include/{socks => mango}/libc/ctype.h | 4 +- libc/include/{socks => mango}/libc/stdio.h | 4 +- libc/include/{socks => mango}/libc/string.h | 4 +- libc/stdio/printf.c | 2 +- libc/string/memmove.c | 2 +- libc/string/strcat.c | 2 +- libc/string/strcpy.c | 2 +- libc/string/strlen.c | 2 +- libc/string/strrchr.c | 2 +- libc/string/strtok.c | 2 +- obj/link.c | 2 +- obj/namespace.c | 2 +- obj/object.c | 10 +- obj/set.c | 2 +- sched/core.c | 12 +- sched/runqueue.c | 6 +- sched/task.c | 14 +- sched/thread.c | 10 +- sched/timer.c | 8 +- sched/wait.c | 4 +- sched/workqueue.c | 8 +- test/obj.c | 8 +- test/test.c | 4 +- tools/Makefile | 13 -- tools/bochsrc.bxrc | 2 +- tools/boot-image/grub.cfg | 4 +- tools/e64patch/Makefile | 4 - tools/kernel-debug/debug_session.sh | 4 +- tools/kernel-debug/gdb_session_init | 2 +- tools/kernel-debug/lldb_session_init | 2 +- tools/make/clang-generic.mk | 5 - tools/make/gcc-cross-compile.mk | 0 tools/make/gcc-host.mk | 9 -- tools/{socks.buildid => mango.buildid} | 0 tools/{socks.compiledb => mango.compiledb} | 0 tools/{socks.install-cd => mango.install-cd} | 4 +- tools/{socks.mkrescue => mango.mkrescue} | 14 +- tools/{socks.sync => mango.sync} | 4 +- tools/socks.kexttool | 26 ---- tools/tool-config.mk | 10 -- tools/tool-template.mk | 22 ---- util/data_size.c | 2 +- util/endian.c | 2 +- vm/bootstrap.c | 10 +- vm/cache.c | 10 +- vm/flat.c | 6 +- vm/kmalloc.c | 10 +- vm/memblock.c | 6 +- vm/model.c | 2 +- vm/page.c | 10 +- vm/sparse.c | 14 +- vm/zone.c | 18 +-- 140 files changed, 422 insertions(+), 857 deletions(-) delete mode 100644 Makefile delete mode 100644 arch/user/config.mk delete mode 100644 arch/user/extra.mk rename arch/user/include/{socks => mango}/machine/cpu.h (85%) rename arch/user/include/{socks => mango}/machine/hwlock.h (86%) rename arch/user/include/{socks => mango}/machine/init.h (89%) create mode 100644 arch/user/include/mango/machine/irq.h rename arch/user/include/{socks => mango}/machine/pmap.h (54%) rename arch/user/include/{socks => mango}/machine/vm.h (93%) delete mode 100644 arch/user/include/socks/machine/irq.h delete mode 100644 arch/x86_64/config.mk delete mode 100644 arch/x86_64/extra.mk rename arch/x86_64/include/{socks => mango}/machine/cpu.h (94%) rename arch/x86_64/include/{socks => mango}/machine/hwlock.h (86%) rename arch/x86_64/include/{socks => mango}/machine/init.h (88%) create mode 100644 arch/x86_64/include/mango/machine/irq.h rename arch/x86_64/include/{socks => mango}/machine/panic.h (78%) rename arch/x86_64/include/{socks => mango}/machine/pmap.h (61%) rename arch/x86_64/include/{socks => mango}/machine/thread.h (67%) rename arch/x86_64/include/{socks => mango}/machine/vm.h (91%) delete mode 100644 arch/x86_64/include/socks/machine/irq.h delete mode 100644 doc/objects.rst rename include/{socks => mango}/arg.h (75%) rename include/{socks => mango}/bitmap.h (96%) rename include/{socks => mango}/block.h (83%) rename include/{socks => mango}/btree.h (99%) rename include/{socks => mango}/clock.h (89%) rename include/{socks => mango}/compiler.h (93%) rename include/{socks => mango}/console.h (92%) rename include/{socks => mango}/cpu.h (91%) rename include/{socks => mango}/device.h (94%) rename include/{socks => mango}/fb.h (94%) rename include/{socks => mango}/flags.h (57%) rename include/{socks => mango}/init.h (91%) rename include/{socks => mango}/input.h (98%) rename include/{socks => mango}/kext.h (91%) rename include/{socks => mango}/locks.h (79%) rename include/{socks => mango}/memblock.h (99%) rename include/{socks => mango}/object.h (92%) rename include/{socks => mango}/panic.h (68%) rename include/{socks => mango}/percpu.h (80%) rename include/{socks => mango}/pmap.h (87%) rename include/{socks => mango}/printk.h (70%) rename include/{socks => mango}/queue.h (96%) rename include/{socks => mango}/ringbuffer.h (83%) rename include/{socks => mango}/sched.h (96%) rename include/{socks => mango}/status.h (91%) rename include/{socks => mango}/termios.h (97%) rename include/{socks => mango}/test.h (71%) rename include/{socks => mango}/tty.h (93%) rename include/{socks => mango}/types.h (79%) rename include/{socks => mango}/util.h (97%) rename include/{socks => mango}/vm.h (97%) rename libc/include/{socks => mango}/libc/ctype.h (89%) rename libc/include/{socks => mango}/libc/stdio.h (88%) rename libc/include/{socks => mango}/libc/string.h (95%) delete mode 100644 tools/Makefile delete mode 100644 tools/e64patch/Makefile delete mode 100644 tools/make/clang-generic.mk delete mode 100644 tools/make/gcc-cross-compile.mk delete mode 100644 tools/make/gcc-host.mk rename tools/{socks.buildid => mango.buildid} (100%) rename tools/{socks.compiledb => mango.compiledb} (100%) rename tools/{socks.install-cd => mango.install-cd} (98%) rename tools/{socks.mkrescue => mango.mkrescue} (64%) rename tools/{socks.sync => mango.sync} (96%) delete mode 100755 tools/socks.kexttool delete mode 100644 tools/tool-config.mk delete mode 100644 tools/tool-template.mk diff --git a/Makefile b/Makefile deleted file mode 100644 index d542772..0000000 --- a/Makefile +++ /dev/null @@ -1,121 +0,0 @@ -KERNEL_EXEC := socks_kernel - -SOCKS_ARCH ?= x86_64 - -MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) -ROOT_DIR := $(patsubst %/,%,$(dir $(MAKEFILE_PATH))) - -include tools/make/gcc-cross-compile.mk - -BUILD_DIR := build -CONFIG_DIR := .config - -#################################### -# If the user has selected some kernel extensions to include -# in the kernel image, include the file that describes the -# extension source files to build -#################################### - --include $(CONFIG_DIR)/extensions.mk - -#################################### -# Architecture-specific source files -#################################### - -include arch/$(SOCKS_ARCH)/config.mk - -#################################### -# Platform-independent kernel source files -#################################### - -KERNEL_SRC_DIRS := init kernel vm ds util obj sched test -KERNEL_C_FILES := $(foreach dir,$(KERNEL_SRC_DIRS),$(shell find $(dir) -type f -name *.c)) -KERNEL_CXX_FILES := $(foreach dir,$(KERNEL_SRC_DIRS),$(shell find $(dir) -type f -name *.cpp)) -KERNEL_OBJ := $(addprefix $(BUILD_DIR)/,$(KERNEL_C_FILES:.c=.o) $(KERNEL_CXX_FILES:.cpp=.o)) - -#################################### -# Kernel libc source files -#################################### - -LIBC_SRC_DIRS := stdio string ctype -LIBC_C_FILES := $(foreach dir,$(LIBC_SRC_DIRS),$(shell find libc/$(dir) -type f -name *.c)) -LIBC_OBJ := $(addprefix $(BUILD_DIR)/,$(LIBC_C_FILES:.c=.o)) - -#################################### -# Userboot source files -#################################### - -USERBOOT_C_FILES := $(shell find userboot -type f -name *.c) -USERBOOT_OBJ := $(addprefix $(BUILD_DIR)/,$(USERBOOT_C_FILES:.c=.o)) - -BUILD_ID := $(shell tools/socks.buildid --arch $(SOCKS_ARCH)) - -CWARNINGS := -Wall -Werror -pedantic -Wno-language-extension-token -Wno-unused-function -Wno-gnu-statement-expression - -OPTIMISATION_LEVEL := -O2 - -CFLAGS := $(CFLAGS) -DBUILD_ID=\"$(BUILD_ID)\" $(OPTIMISATION_LEVEL) -g -fPIC -std=gnu17 \ - -Iinclude -Iarch/$(SOCKS_ARCH)/include -Ilibc/include $(CWARNINGS) - -KERNEL_DEFINES := -DSOCKS_INTERNAL=1 - -CXXFLAGS := $(CXXFLAGS) -DBUILD_ID=\"$(BUILD_ID)\" $(OPTIMISATION_LEVEL) -g -fPIC -std=gnu++17 \ - -Iinclude -Iarch/$(SOCKS_ARCH)/include -Ilibc/include -Wno-language-extension-token $(CWARNINGS) - - -ASMFLAGS := $(ASMFLAGS) -DBUILD_ID=\"$(BUILD_ID)\" -LDFLAGS := $(LDFLAGS) -g -lgcc $(OPTIMISATION_LEVEL) - -ALL_KERNEL_OBJECT_FILES := $(KERNEL_OBJ) $(ARCH_OBJ) $(LIBC_OBJ) -ALL_KERNEL_DEPS := $(ALL_KERNEL_OBJECT_FILES:.o=.d) - -all: $(BUILD_DIR)/$(KERNEL_EXEC) tools - --include $(ALL_KERNEL_DEPS) - -$(BUILD_DIR)/$(KERNEL_EXEC): $(ALL_KERNEL_OBJECT_FILES) - @printf " \033[1;36mLD\033[0m \033[1mbuild/\033[35m$(KERNEL_EXEC)\033[0m\n" - @mkdir -p $(@D) - @$(LD) $^ -o $@ $(LDFLAGS) $(ARCH_LDFLAGS) - @cp $@ $@.dbg - @$(STRIP) $@ - -$(BUILD_DIR)/%.o: %.S - @printf " \033[1;32mAS\033[0m \033[35m$(KERNEL_EXEC)\033[0m/$<\n" - @mkdir -p $(@D) - @$(ASM) $< -o $@ -c $(ASMFLAGS) $(ARCH_ASMFLAGS) -MMD - -$(BUILD_DIR)/%.o: %.c - @printf " \033[1;32mCC\033[0m \033[35m$(KERNEL_EXEC)\033[0m/$<\n" - @mkdir -p $(@D) - @$(CC) $< -o $@ -c $(CFLAGS) $(ARCH_CFLAGS) -MMD $(KERNEL_DEFINES) - -$(BUILD_DIR)/%.o: %.cpp - @printf " \033[1;32mCXX\033[0m \033[35m$(KERNEL_EXEC)\033[0m/$<\n" - @mkdir -p $(@D) - @$(CXX) $< -o $@ -c $(CXXFLAGS) $(ARCH_CFLAGS) -MMD $(KERNEL_DEFINES) - -clean: - @printf " \033[1;93mRM\033[0m Deleting build files.\n" - @rm -rf $(BUILD_DIR) - -$(BUILD_DIR)/compile_commands.json: - @printf " \033[1;93mGEN\033[0m Generating compiler database.\n" - - @./tools/socks.compiledb - -cd: $(BUILD_DIR)/socks-kernel.iso - -install-cd: $(BUILD_DIR)/socks-kernel.iso - @./tools/socks.install-cd - -compile-db: $(BUILD_DIR)/compile_commands.json - -tools: - @$(MAKE) -C tools - -include arch/$(SOCKS_ARCH)/extra.mk - -.PHONY: all tools compile-db $(BUILD_DIR)/compile_commands.json - -.INTERMEDIATE: $(ARCH_TEMP_FILES) diff --git a/README b/README index 20ce3a5..d13b589 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -Socks +Mango ===== It's a kernel! diff --git a/arch/user/config.mk b/arch/user/config.mk deleted file mode 100644 index b44f632..0000000 --- a/arch/user/config.mk +++ /dev/null @@ -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)) diff --git a/arch/user/cpu.c b/arch/user/cpu.c index de3f477..f8ff887 100644 --- a/arch/user/cpu.c +++ b/arch/user/cpu.c @@ -1,5 +1,5 @@ #include -#include +#include int ml_init_bootcpu(void) { diff --git a/arch/user/extra.mk b/arch/user/extra.mk deleted file mode 100644 index c6b4581..0000000 --- a/arch/user/extra.mk +++ /dev/null @@ -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 diff --git a/arch/user/hwlock.c b/arch/user/hwlock.c index 26c0a34..40e57e6 100644 --- a/arch/user/hwlock.c +++ b/arch/user/hwlock.c @@ -1,5 +1,5 @@ -#include -#include +#include +#include void ml_hwlock_lock(ml_hwlock_t *lck) { diff --git a/arch/user/include/socks/machine/cpu.h b/arch/user/include/mango/machine/cpu.h similarity index 85% rename from arch/user/include/socks/machine/cpu.h rename to arch/user/include/mango/machine/cpu.h index 3614ef6..832a005 100644 --- a/arch/user/include/socks/machine/cpu.h +++ b/arch/user/include/mango/machine/cpu.h @@ -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" { diff --git a/arch/user/include/socks/machine/hwlock.h b/arch/user/include/mango/machine/hwlock.h similarity index 86% rename from arch/user/include/socks/machine/hwlock.h rename to arch/user/include/mango/machine/hwlock.h index da285a7..526b238 100644 --- a/arch/user/include/socks/machine/hwlock.h +++ b/arch/user/include/mango/machine/hwlock.h @@ -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) diff --git a/arch/user/include/socks/machine/init.h b/arch/user/include/mango/machine/init.h similarity index 89% rename from arch/user/include/socks/machine/init.h rename to arch/user/include/mango/machine/init.h index ea02a1d..fef3e9e 100644 --- a/arch/user/include/socks/machine/init.h +++ b/arch/user/include/mango/machine/init.h @@ -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 diff --git a/arch/user/include/mango/machine/irq.h b/arch/user/include/mango/machine/irq.h new file mode 100644 index 0000000..0d47448 --- /dev/null +++ b/arch/user/include/mango/machine/irq.h @@ -0,0 +1,5 @@ +#ifndef MANGO_X86_64_IRQ_H_ +#define MANGO_X86_64_IRQ_H_ + + +#endif diff --git a/arch/user/include/socks/machine/pmap.h b/arch/user/include/mango/machine/pmap.h similarity index 54% rename from arch/user/include/socks/machine/pmap.h rename to arch/user/include/mango/machine/pmap.h index 2a21e0c..b973528 100644 --- a/arch/user/include/socks/machine/pmap.h +++ b/arch/user/include/mango/machine/pmap.h @@ -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; diff --git a/arch/user/include/socks/machine/vm.h b/arch/user/include/mango/machine/vm.h similarity index 93% rename from arch/user/include/socks/machine/vm.h rename to arch/user/include/mango/machine/vm.h index d0ce470..0a75894 100644 --- a/arch/user/include/socks/machine/vm.h +++ b/arch/user/include/mango/machine/vm.h @@ -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 diff --git a/arch/user/include/socks/machine/irq.h b/arch/user/include/socks/machine/irq.h deleted file mode 100644 index be06f01..0000000 --- a/arch/user/include/socks/machine/irq.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef SOCKS_X86_64_IRQ_H_ -#define SOCKS_X86_64_IRQ_H_ - - -#endif diff --git a/arch/user/init.c b/arch/user/init.c index cc521c2..f0f884d 100644 --- a/arch/user/init.c +++ b/arch/user/init.c @@ -1,11 +1,11 @@ #include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include diff --git a/arch/user/initcall.c b/arch/user/initcall.c index ef4f5a9..c332f84 100644 --- a/arch/user/initcall.c +++ b/arch/user/initcall.c @@ -1,4 +1,4 @@ -#include +#include #ifdef __APPLE__ extern char __start_initcall0[] __asm("section$start$__DATA$__initcall0.init"); diff --git a/arch/user/stdcon.c b/arch/user/stdcon.c index f548d64..59d2922 100644 --- a/arch/user/stdcon.c +++ b/arch/user/stdcon.c @@ -1,10 +1,10 @@ -#include -#include +#include +#include #include #include -#include -#include -#include +#include +#include +#include static void stdcon_write(struct console *con, const char *s, unsigned int len) { diff --git a/arch/x86_64/asm-offset.c b/arch/x86_64/asm-offset.c index e583f37..012d98a 100644 --- a/arch/x86_64/asm-offset.c +++ b/arch/x86_64/asm-offset.c @@ -1,5 +1,5 @@ -#include -#include +#include +#include //size_t THREAD_sp = offsetof(struct thread, tr_sp); diff --git a/arch/x86_64/config.mk b/arch/x86_64/config.mk deleted file mode 100644 index 707302b..0000000 --- a/arch/x86_64/config.mk +++ /dev/null @@ -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)) diff --git a/arch/x86_64/cpu.c b/arch/x86_64/cpu.c index 98e18b8..baf5a56 100644 --- a/arch/x86_64/cpu.c +++ b/arch/x86_64/cpu.c @@ -1,4 +1,4 @@ -#include +#include #include int ml_cpu_block_init(ml_cpu_block *p) diff --git a/arch/x86_64/e820.c b/arch/x86_64/e820.c index 40a89fa..68a95c5 100644 --- a/arch/x86_64/e820.c +++ b/arch/x86_64/e820.c @@ -1,7 +1,7 @@ -#include "socks/types.h" -#include -#include -#include +#include "mango/types.h" +#include +#include +#include #include void e820_scan(multiboot_memory_map_t *mmap, size_t len) diff --git a/arch/x86_64/extra.mk b/arch/x86_64/extra.mk deleted file mode 100644 index 5eee39f..0000000 --- a/arch/x86_64/extra.mk +++ /dev/null @@ -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 diff --git a/arch/x86_64/gdt.c b/arch/x86_64/gdt.c index 4d41bd6..da091a4 100644 --- a/arch/x86_64/gdt.c +++ b/arch/x86_64/gdt.c @@ -1,4 +1,4 @@ -#include +#include #include static void init_entry(struct gdt_entry *entry, int access, int flags) diff --git a/arch/x86_64/include/arch/gdt.h b/arch/x86_64/include/arch/gdt.h index 21f9add..6c6f4d7 100644 --- a/arch/x86_64/include/arch/gdt.h +++ b/arch/x86_64/include/arch/gdt.h @@ -1,7 +1,7 @@ #ifndef ARCH_GDT_H_ #define ARCH_GDT_H_ -#include +#include #include #ifdef __cplusplus diff --git a/arch/x86_64/include/arch/irq.h b/arch/x86_64/include/arch/irq.h index 5317123..a85ffdc 100644 --- a/arch/x86_64/include/arch/irq.h +++ b/arch/x86_64/include/arch/irq.h @@ -1,8 +1,8 @@ #ifndef ARCH_IRQ_H_ #define ARCH_IRQ_H_ -#include -#include +#include +#include #include #ifdef __cplusplus diff --git a/arch/x86_64/include/arch/paging.h b/arch/x86_64/include/arch/paging.h index d9c1ca7..ff34016 100644 --- a/arch/x86_64/include/arch/paging.h +++ b/arch/x86_64/include/arch/paging.h @@ -1,8 +1,8 @@ #ifndef ARCH_PAGING_H_ #define ARCH_PAGING_H_ -#include -#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/arch/x86_64/include/socks/machine/cpu.h b/arch/x86_64/include/mango/machine/cpu.h similarity index 94% rename from arch/x86_64/include/socks/machine/cpu.h rename to arch/x86_64/include/mango/machine/cpu.h index abeb97b..d1bcfb2 100644 --- a/arch/x86_64/include/socks/machine/cpu.h +++ b/arch/x86_64/include/mango/machine/cpu.h @@ -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 #include diff --git a/arch/x86_64/include/socks/machine/hwlock.h b/arch/x86_64/include/mango/machine/hwlock.h similarity index 86% rename from arch/x86_64/include/socks/machine/hwlock.h rename to arch/x86_64/include/mango/machine/hwlock.h index c85d21c..f1166da 100644 --- a/arch/x86_64/include/socks/machine/hwlock.h +++ b/arch/x86_64/include/mango/machine/hwlock.h @@ -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) diff --git a/arch/x86_64/include/socks/machine/init.h b/arch/x86_64/include/mango/machine/init.h similarity index 88% rename from arch/x86_64/include/socks/machine/init.h rename to arch/x86_64/include/mango/machine/init.h index f1a0d35..2fdd5fd 100644 --- a/arch/x86_64/include/socks/machine/init.h +++ b/arch/x86_64/include/mango/machine/init.h @@ -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 diff --git a/arch/x86_64/include/mango/machine/irq.h b/arch/x86_64/include/mango/machine/irq.h new file mode 100644 index 0000000..0d47448 --- /dev/null +++ b/arch/x86_64/include/mango/machine/irq.h @@ -0,0 +1,5 @@ +#ifndef MANGO_X86_64_IRQ_H_ +#define MANGO_X86_64_IRQ_H_ + + +#endif diff --git a/arch/x86_64/include/socks/machine/panic.h b/arch/x86_64/include/mango/machine/panic.h similarity index 78% rename from arch/x86_64/include/socks/machine/panic.h rename to arch/x86_64/include/mango/machine/panic.h index 4bf1366..39fa4f4 100644 --- a/arch/x86_64/include/socks/machine/panic.h +++ b/arch/x86_64/include/mango/machine/panic.h @@ -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 diff --git a/arch/x86_64/include/socks/machine/pmap.h b/arch/x86_64/include/mango/machine/pmap.h similarity index 61% rename from arch/x86_64/include/socks/machine/pmap.h rename to arch/x86_64/include/mango/machine/pmap.h index 85a1829..f501702 100644 --- a/arch/x86_64/include/socks/machine/pmap.h +++ b/arch/x86_64/include/mango/machine/pmap.h @@ -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 diff --git a/arch/x86_64/include/socks/machine/thread.h b/arch/x86_64/include/mango/machine/thread.h similarity index 67% rename from arch/x86_64/include/socks/machine/thread.h rename to arch/x86_64/include/mango/machine/thread.h index 4d05891..a9b8fb3 100644 --- a/arch/x86_64/include/socks/machine/thread.h +++ b/arch/x86_64/include/mango/machine/thread.h @@ -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 +#include extern void switch_to(struct thread *from, struct thread *to); extern void prepare_stack(uintptr_t ip, uintptr_t *sp); diff --git a/arch/x86_64/include/socks/machine/vm.h b/arch/x86_64/include/mango/machine/vm.h similarity index 91% rename from arch/x86_64/include/socks/machine/vm.h rename to arch/x86_64/include/mango/machine/vm.h index f52734e..b6064b8 100644 --- a/arch/x86_64/include/socks/machine/vm.h +++ b/arch/x86_64/include/mango/machine/vm.h @@ -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 diff --git a/arch/x86_64/include/socks/machine/irq.h b/arch/x86_64/include/socks/machine/irq.h deleted file mode 100644 index be06f01..0000000 --- a/arch/x86_64/include/socks/machine/irq.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef SOCKS_X86_64_IRQ_H_ -#define SOCKS_X86_64_IRQ_H_ - - -#endif diff --git a/arch/x86_64/init.c b/arch/x86_64/init.c index a7ac87f..70de4de 100644 --- a/arch/x86_64/init.c +++ b/arch/x86_64/init.c @@ -2,20 +2,20 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #define PTR32(x) ((void *)((uintptr_t)(x))) diff --git a/arch/x86_64/initcall.c b/arch/x86_64/initcall.c index 9a97bea..53d85c9 100644 --- a/arch/x86_64/initcall.c +++ b/arch/x86_64/initcall.c @@ -1,4 +1,4 @@ -#include +#include extern char __initcall0_start[]; extern char __initcall1_start[]; diff --git a/arch/x86_64/irq.c b/arch/x86_64/irq.c index 4337cf7..063998b 100644 --- a/arch/x86_64/irq.c +++ b/arch/x86_64/irq.c @@ -1,11 +1,11 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #define MAX_ISR_HANDLERS 16 diff --git a/arch/x86_64/panic.c b/arch/x86_64/panic.c index e6c4a1c..ac0da9b 100644 --- a/arch/x86_64/panic.c +++ b/arch/x86_64/panic.c @@ -1,7 +1,7 @@ -#include "socks/machine/panic.h" -#include "socks/vm.h" -#include -#include +#include "mango/machine/panic.h" +#include "mango/vm.h" +#include +#include #include #define R_CF 0 diff --git a/arch/x86_64/pit.c b/arch/x86_64/pit.c index 47555c9..c8d7b28 100644 --- a/arch/x86_64/pit.c +++ b/arch/x86_64/pit.c @@ -1,8 +1,8 @@ #include #include -#include -#include -#include +#include +#include +#include #define PIT_COUNTER0 0x40 #define PIT_CMD 0x43 diff --git a/arch/x86_64/pmap.c b/arch/x86_64/pmap.c index eff2dd5..3a358c7 100644 --- a/arch/x86_64/pmap.c +++ b/arch/x86_64/pmap.c @@ -1,10 +1,10 @@ -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include /* some helpful datasize constants */ #define C_1GiB 0x40000000ULL diff --git a/arch/x86_64/serial.c b/arch/x86_64/serial.c index f8c0f32..69a47bf 100644 --- a/arch/x86_64/serial.c +++ b/arch/x86_64/serial.c @@ -1,11 +1,11 @@ #include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #define COM1 0x3F8 #define COM2 0x2F8 diff --git a/arch/x86_64/thread.c b/arch/x86_64/thread.c index 1bc5d80..59cc3c5 100644 --- a/arch/x86_64/thread.c +++ b/arch/x86_64/thread.c @@ -1,4 +1,4 @@ -#include +#include struct thread_ctx { uint64_t r15, r14, r13, r12, r11, r10, r9, r8; diff --git a/doc/objects.rst b/doc/objects.rst deleted file mode 100644 index fc9d6e0..0000000 --- a/doc/objects.rst +++ /dev/null @@ -1,109 +0,0 @@ -================= -THE OBJECT SYSTEM -================= - -Objects are the primary means of managing and controlling access to -user-facing resources a uniform way. This document provides an -overview of the object system in the Socks kernel, including: - -1. Object Layout and Definition. -2. The Object Lifecycle. -3. Object Operations and Conventions. -4. References and Handles. -5. Attributes. - - -Object Layout and Definition -============================ - -An object is made up of two distinct halves: the **header** and the -**data**. The header contains bookkeeping data used by the object -system, while the data is the programmer-defined part of the object, -and can be used however the object-creator wants. - -Object behaviour is defined by a `struct object_type` instance. -A `struct object_type` provides the object system with all the information -it needs to instantiate and interact with your objects. - - -The Object Header ------------------ - -The object header is defined in `include/socks/object.h` as `struct object`. -It contains information that is used by the object system, and typically -should not be directly accessed outside of the object system. - -The contents of the object header include: - -* `ob_magic`: A magic value used to identify active objects. - Functions that retrieve an object's header from its data (and vice versa) - do not have type checking (i.e. they convert between `struct object *` and `void *` - using simple pointer arithmetic), so checking for this magic number helps - protect against non-objects being passed to functions expecting objects. -* `ob_type`: A pointer to the `struct object_type` that was used to create the - object. Outside of the object system, this can be used as a read-only - way to query type information about an object. -* `ob_lock`: A general-purpose per-object lock. This lock is *not* reserved - for the object system to use, and can be used by the programmer. You - can lock and unlock an object by using `object_lock()` and `object_unlock()` - respectively. -* `ob_refcount` and `ob_handles`: The number of kernel references and open - handles to an object. See :ref:`References and Handles` for more details. -* `ob_attrib`: A list of attributes that are accessible for this object. - See :ref:`Attributes` for more details. -* `ob_list`: A general-purpose queue entry for adding the object to a linked - list. Note that some internal object types (such as `set`) make use of this - queue entry. - - -When defining a C structure for use when creating objects, you should -define a member of type `struct object` somewhere within the structure. -It does not have to be the first member in the struct. The object system -provides a number of macros to simplify converting a `struct object *` -to a pointer of your structure. - -The Object Type ---------------- - -The object type defines the name, size, and behaviour of an object. -It is defined using the `struct object_type` C structure. - -Some notable parts of `struct object_type` include: - -* `ob_name`: Human-readable name of the object type. For example: - "namespace", "set", "task", etc. -* `ob_size`: The length of the data section of the object in bytes. -* `ob_cache`: An instance of `struct vm_cache` from which objects of this - type are allocated. This cache is initialised and managed by the - object system on behalf of the programmer, so this can be ignored - outside of the object system. -* `ob_list`: A queue entry used internally by the object system. -* `ob_attrib`: A list of object attributes defined for objects of - this type. -* `ob_ops`: A set of function pointers that are used by the object - system to interact with the object. See - :ref:`Object Operations and Conventions` for more details. - - -The Object Lifecycle -==================== - -TODO - - -Object Operations and Conventions -================================= - -TODO - - -References and Handles -====================== - -TODO - - -Attributes -========== - -TODO diff --git a/ds/bitmap.c b/ds/bitmap.c index 12d88f8..e1ffe46 100644 --- a/ds/bitmap.c +++ b/ds/bitmap.c @@ -1,5 +1,5 @@ -#include -#include +#include +#include void bitmap_zero(unsigned long *map, unsigned long nbits) { diff --git a/ds/btree.c b/ds/btree.c index f9a048e..311ff89 100644 --- a/ds/btree.c +++ b/ds/btree.c @@ -57,7 +57,7 @@ provide a comparator function. */ -#include +#include #include #define MAX(a, b) ((a) > (b) ? (a) : (b)) diff --git a/ds/queue.c b/ds/queue.c index 7e784f5..31f2765 100644 --- a/ds/queue.c +++ b/ds/queue.c @@ -1,4 +1,4 @@ -#include +#include size_t queue_length(struct queue *q) { diff --git a/ds/ringbuffer.c b/ds/ringbuffer.c index 2a016e8..1dcbc71 100644 --- a/ds/ringbuffer.c +++ b/ds/ringbuffer.c @@ -1,5 +1,5 @@ -#include -#include +#include +#include size_t ringbuffer_unread(struct ringbuffer *ring_buffer) { @@ -45,7 +45,7 @@ static inline void increment_write(struct ringbuffer *ring_buffer) } } -size_t ringbuffer_read(struct ringbuffer *ring_buffer, size_t size, void *p, socks_flags_t flags) +size_t ringbuffer_read(struct ringbuffer *ring_buffer, size_t size, void *p, mango_flags_t flags) { if (!ring_buffer) { return 0; @@ -86,7 +86,7 @@ size_t ringbuffer_read(struct ringbuffer *ring_buffer, size_t size, void *p, soc return collected; } -size_t ringbuffer_write(struct ringbuffer *ring_buffer, size_t size, const void *p, socks_flags_t flags) +size_t ringbuffer_write(struct ringbuffer *ring_buffer, size_t size, const void *p, mango_flags_t flags) { if (!ring_buffer || !size) { return 0; diff --git a/include/socks/arg.h b/include/mango/arg.h similarity index 75% rename from include/socks/arg.h rename to include/mango/arg.h index 609c594..f1b8106 100644 --- a/include/socks/arg.h +++ b/include/mango/arg.h @@ -1,8 +1,8 @@ -#ifndef SOCKS_ARG_H_ -#define SOCKS_ARG_H_ +#ifndef MANGO_ARG_H_ +#define MANGO_ARG_H_ #include -#include +#include #define CMDLINE_MAX 4096 diff --git a/include/socks/bitmap.h b/include/mango/bitmap.h similarity index 96% rename from include/socks/bitmap.h rename to include/mango/bitmap.h index 0210eef..98101e0 100644 --- a/include/socks/bitmap.h +++ b/include/mango/bitmap.h @@ -1,5 +1,5 @@ -#ifndef SOCKS_BITMAP_H_ -#define SOCKS_BITMAP_H_ +#ifndef MANGO_BITMAP_H_ +#define MANGO_BITMAP_H_ #include diff --git a/include/socks/block.h b/include/mango/block.h similarity index 83% rename from include/socks/block.h rename to include/mango/block.h index bd78406..e347d1f 100644 --- a/include/socks/block.h +++ b/include/mango/block.h @@ -1,10 +1,10 @@ -#ifndef SOCKS_BLOCK_H_ -#define SOCKS_BLOCK_H_ +#ifndef MANGO_BLOCK_H_ +#define MANGO_BLOCK_H_ -#include -#include -#include -#include +#include +#include +#include +#include #include enum block_device_flags { diff --git a/include/socks/btree.h b/include/mango/btree.h similarity index 99% rename from include/socks/btree.h rename to include/mango/btree.h index 55e00bf..4cd965e 100644 --- a/include/socks/btree.h +++ b/include/mango/btree.h @@ -20,8 +20,8 @@ software without specific prior written permission. */ -#ifndef SOCKS_BTREE_H_ -#define SOCKS_BTREE_H_ +#ifndef MANGO_BTREE_H_ +#define MANGO_BTREE_H_ #include diff --git a/include/socks/clock.h b/include/mango/clock.h similarity index 89% rename from include/socks/clock.h rename to include/mango/clock.h index b474646..4928e31 100644 --- a/include/socks/clock.h +++ b/include/mango/clock.h @@ -1,5 +1,5 @@ -#ifndef SOCKS_CLOCK_H_ -#define SOCKS_CLOCK_H_ +#ifndef MANGO_CLOCK_H_ +#define MANGO_CLOCK_H_ #include diff --git a/include/socks/compiler.h b/include/mango/compiler.h similarity index 93% rename from include/socks/compiler.h rename to include/mango/compiler.h index 18fb198..8477ead 100644 --- a/include/socks/compiler.h +++ b/include/mango/compiler.h @@ -1,5 +1,5 @@ -#ifndef SOCKS_COMPILER_H_ -#define SOCKS_COMPILER_H_ +#ifndef MANGO_COMPILER_H_ +#define MANGO_COMPILER_H_ #ifdef __cplusplus template diff --git a/include/socks/console.h b/include/mango/console.h similarity index 92% rename from include/socks/console.h rename to include/mango/console.h index 0414719..45bab80 100644 --- a/include/socks/console.h +++ b/include/mango/console.h @@ -1,5 +1,5 @@ -#ifndef SOCKS_CONSOLE_H_ -#define SOCKS_CONSOLE_H_ +#ifndef MANGO_CONSOLE_H_ +#define MANGO_CONSOLE_H_ /* The console system @@ -14,9 +14,9 @@ representing a serial port may allow both sending AND receiving over the port. */ -#include -#include -#include +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/socks/cpu.h b/include/mango/cpu.h similarity index 91% rename from include/socks/cpu.h rename to include/mango/cpu.h index dd36683..bd00ceb 100644 --- a/include/socks/cpu.h +++ b/include/mango/cpu.h @@ -1,10 +1,10 @@ -#ifndef SOCKS_CPU_H_ -#define SOCKS_CPU_H_ +#ifndef MANGO_CPU_H_ +#define MANGO_CPU_H_ -#include -#include +#include +#include #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/socks/device.h b/include/mango/device.h similarity index 94% rename from include/socks/device.h rename to include/mango/device.h index 921fb82..e6ad060 100644 --- a/include/socks/device.h +++ b/include/mango/device.h @@ -1,14 +1,14 @@ -#ifndef SOCKS_DEVICE_H_ -#define SOCKS_DEVICE_H_ +#ifndef MANGO_DEVICE_H_ +#define MANGO_DEVICE_H_ -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include struct device; struct input_event; @@ -50,14 +50,14 @@ struct iovec { }; struct device_type_ops { - kern_status_t(*read)(struct device *, void *, size_t, size_t, size_t *, socks_flags_t); - kern_status_t(*write)(struct device *, const void *, size_t, size_t, size_t *, socks_flags_t); + kern_status_t(*read)(struct device *, void *, size_t, size_t, size_t *, mango_flags_t); + kern_status_t(*write)(struct device *, const void *, size_t, size_t, size_t *, mango_flags_t); kern_status_t(*register_device)(struct device *); }; struct block_device_ops { - kern_status_t(*read_blocks)(struct device *, sectors_t, size_t *, struct iovec *, size_t, socks_flags_t); - kern_status_t(*write_blocks)(struct device *, sectors_t, size_t *, struct iovec *, size_t, socks_flags_t); + kern_status_t(*read_blocks)(struct device *, sectors_t, size_t *, struct iovec *, size_t, mango_flags_t); + kern_status_t(*write_blocks)(struct device *, sectors_t, size_t *, struct iovec *, size_t, mango_flags_t); kern_status_t(*ioctl)(struct device *, unsigned int, void *); }; @@ -69,8 +69,8 @@ struct net_device_ops { }; struct char_device_ops { - kern_status_t(*read)(struct device *, void *, size_t, size_t, size_t *, socks_flags_t); - kern_status_t(*write)(struct device *, const void *, size_t, size_t, size_t *, socks_flags_t); + kern_status_t(*read)(struct device *, void *, size_t, size_t, size_t *, mango_flags_t); + kern_status_t(*write)(struct device *, const void *, size_t, size_t, size_t *, mango_flags_t); }; struct input_device_ops { @@ -198,8 +198,8 @@ static inline void device_unlock_irqrestore(struct device *dev, unsigned long fl object_unlock_irqrestore(&dev->dev_base, flags); } -extern kern_status_t device_read(struct device *dev, void *buf, size_t offset, size_t size, size_t *bytes_read, socks_flags_t flags); -extern kern_status_t device_write(struct device *dev, const void *buf, size_t offset, size_t size, size_t *bytes_written, socks_flags_t flags); +extern kern_status_t device_read(struct device *dev, void *buf, size_t offset, size_t size, size_t *bytes_read, mango_flags_t flags); +extern kern_status_t device_write(struct device *dev, const void *buf, size_t offset, size_t size, size_t *bytes_written, mango_flags_t flags); extern struct device *cast_to_device(struct object *obj); @@ -290,7 +290,7 @@ static inline void device_deref(struct device *dev) extern kern_status_t input_device_report_event(struct input_device *dev, const struct input_event *ev, bool noblock); extern kern_status_t input_device_read(struct device *dev, void *buf, size_t offset, - size_t size, size_t *bytes_read, socks_flags_t flags); + size_t size, size_t *bytes_read, mango_flags_t flags); extern kern_status_t input_device_add_hook(struct device *dev, struct input_event_hook *hook); extern kern_status_t input_device_remove_hook(struct device *dev, struct input_event_hook *hook); diff --git a/include/socks/fb.h b/include/mango/fb.h similarity index 94% rename from include/socks/fb.h rename to include/mango/fb.h index b94cd9f..c718dce 100644 --- a/include/socks/fb.h +++ b/include/mango/fb.h @@ -1,5 +1,5 @@ -#ifndef SOCKS_FB_H_ -#define SOCKS_FB_H_ +#ifndef MANGO_FB_H_ +#define MANGO_FB_H_ #include diff --git a/include/socks/flags.h b/include/mango/flags.h similarity index 57% rename from include/socks/flags.h rename to include/mango/flags.h index 8aa3150..b30a531 100644 --- a/include/socks/flags.h +++ b/include/mango/flags.h @@ -1,11 +1,11 @@ -#ifndef SOCKS_FLAGS_H_ -#define SOCKS_FLAGS_H_ +#ifndef MANGO_FLAGS_H_ +#define MANGO_FLAGS_H_ #include typedef enum { S_NORMAL = 0x00u, S_NOBLOCK = 0x01u, -} socks_flags_t; +} mango_flags_t; #endif diff --git a/include/socks/init.h b/include/mango/init.h similarity index 91% rename from include/socks/init.h rename to include/mango/init.h index f3b1e34..caf515d 100644 --- a/include/socks/init.h +++ b/include/mango/init.h @@ -1,8 +1,8 @@ -#ifndef SOCKS_INIT_H_ -#define SOCKS_INIT_H_ +#ifndef MANGO_INIT_H_ +#define MANGO_INIT_H_ -#include -#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/socks/input.h b/include/mango/input.h similarity index 98% rename from include/socks/input.h rename to include/mango/input.h index fbcc548..707c998 100644 --- a/include/socks/input.h +++ b/include/mango/input.h @@ -1,9 +1,9 @@ -#ifndef SOCKS_INPUT_H_ -#define SOCKS_INPUT_H_ +#ifndef MANGO_INPUT_H_ +#define MANGO_INPUT_H_ #include -#include -#include +#include +#include enum input_event_hook_flags { INPUT_HOOK_SQUASH_EVENT = 0x01u, diff --git a/include/socks/kext.h b/include/mango/kext.h similarity index 91% rename from include/socks/kext.h rename to include/mango/kext.h index 43a0613..275fd0e 100644 --- a/include/socks/kext.h +++ b/include/mango/kext.h @@ -1,19 +1,19 @@ -#ifndef SOCKS_KEXT_H_ -#define SOCKS_KEXT_H_ +#ifndef MANGO_KEXT_H_ +#define MANGO_KEXT_H_ -#include -#include -#include -#include +#include +#include +#include +#include -#define KERNEL_KEXT_ID "net.doorstuck.socks-kernel" +#define KERNEL_KEXT_ID "net.doorstuck.mango-kernel" #define KEXT_IDENT_MAX 80 #define KEXT_NO_DEPENDENCIES NULL #define __KEXT_INFO_VARNAME_2(a, b) a ## b #define __KEXT_INFO_VARNAME_1(a, b) __KEXT_INFO_VARNAME_2(a, b) -#ifdef SOCKS_INTERNAL +#ifdef MANGO_INTERNAL #define __KEXT_INFO_LINKAGE static #define __KEXT_INFO_VARNAME() __KEXT_INFO_VARNAME_1(__kext_info, __LINE__) #define __KEXT_INFO_DEPNAME() __KEXT_INFO_VARNAME_1(__kext_deps, __LINE__) diff --git a/include/socks/locks.h b/include/mango/locks.h similarity index 79% rename from include/socks/locks.h rename to include/mango/locks.h index f09cf6e..9289640 100644 --- a/include/socks/locks.h +++ b/include/mango/locks.h @@ -1,8 +1,8 @@ -#ifndef SOCKS_LOCKS_H_ -#define SOCKS_LOCKS_H_ +#ifndef MANGO_LOCKS_H_ +#define MANGO_LOCKS_H_ -#include -#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/socks/memblock.h b/include/mango/memblock.h similarity index 99% rename from include/socks/memblock.h rename to include/mango/memblock.h index c87e7f1..a840b4b 100644 --- a/include/socks/memblock.h +++ b/include/mango/memblock.h @@ -19,12 +19,12 @@ contributors may be used to endorse or promote products derived from this software without specific prior written permission. */ -#ifndef SOCKS_MEMBLOCK_H_ -#define SOCKS_MEMBLOCK_H_ +#ifndef MANGO_MEMBLOCK_H_ +#define MANGO_MEMBLOCK_H_ #include #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/socks/object.h b/include/mango/object.h similarity index 92% rename from include/socks/object.h rename to include/mango/object.h index 8d711ff..54276c4 100644 --- a/include/socks/object.h +++ b/include/mango/object.h @@ -1,10 +1,10 @@ -#ifndef SOCKS_OBJECT_H_ -#define SOCKS_OBJECT_H_ +#ifndef MANGO_OBJECT_H_ +#define MANGO_OBJECT_H_ -#include -#include -#include -#include +#include +#include +#include +#include #include #ifdef __cplusplus @@ -32,8 +32,8 @@ enum object_type_flags { struct object_ops { kern_status_t(*open)(struct object *obj); kern_status_t(*close)(struct object *obj); - kern_status_t(*read)(struct object *obj, void *p, size_t off, size_t *r, socks_flags_t flags); - kern_status_t(*write)(struct object *obj, const void *p, size_t off, size_t *w, socks_flags_t flags); + kern_status_t(*read)(struct object *obj, void *p, size_t off, size_t *r, mango_flags_t flags); + kern_status_t(*write)(struct object *obj, const void *p, size_t off, size_t *w, mango_flags_t flags); kern_status_t(*destroy)(struct object *obj); kern_status_t(*query_name)(struct object *obj, char out[OBJECT_NAME_MAX]); kern_status_t(*parse)(struct object *obj, const char *path, struct object **out); @@ -92,8 +92,8 @@ static inline kern_status_t object_get(const char *path, struct object **out) { return object_namespace_get_object(global_namespace(), path, out); } -extern kern_status_t object_read(struct object *obj, void *p, size_t offset, size_t max, size_t *nr_read, socks_flags_t flags); -extern kern_status_t object_write(struct object *obj, const void *p, size_t offset, size_t max, size_t *nr_written, socks_flags_t flags); +extern kern_status_t object_read(struct object *obj, void *p, size_t offset, size_t max, size_t *nr_read, mango_flags_t flags); +extern kern_status_t object_write(struct object *obj, const void *p, size_t offset, size_t max, size_t *nr_written, mango_flags_t flags); extern kern_status_t object_get_child_named(struct object *obj, const char *name, struct object **out); extern kern_status_t object_get_child_at(struct object *obj, size_t at, struct object **out); extern kern_status_t object_query_name(struct object *obj, char name[OBJECT_NAME_MAX]); diff --git a/include/socks/panic.h b/include/mango/panic.h similarity index 68% rename from include/socks/panic.h rename to include/mango/panic.h index 521d11a..7019526 100644 --- a/include/socks/panic.h +++ b/include/mango/panic.h @@ -1,7 +1,7 @@ -#ifndef SOCKS_PANIC_H_ -#define SOCKS_PANIC_H_ +#ifndef MANGO_PANIC_H_ +#define MANGO_PANIC_H_ -#include +#include struct cpu_context; diff --git a/include/socks/percpu.h b/include/mango/percpu.h similarity index 80% rename from include/socks/percpu.h rename to include/mango/percpu.h index fb44a5b..04dd3de 100644 --- a/include/socks/percpu.h +++ b/include/mango/percpu.h @@ -1,9 +1,9 @@ -#ifndef SOCKS_PERCPU_H_ -#define SOCKS_PERCPU_H_ +#ifndef MANGO_PERCPU_H_ +#define MANGO_PERCPU_H_ -#include -#include -#include +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/socks/pmap.h b/include/mango/pmap.h similarity index 87% rename from include/socks/pmap.h rename to include/mango/pmap.h index d062387..3bbb4ee 100644 --- a/include/socks/pmap.h +++ b/include/mango/pmap.h @@ -1,11 +1,11 @@ -#ifndef SOCKS_PMAP_H_ -#define SOCKS_PMAP_H_ +#ifndef MANGO_PMAP_H_ +#define MANGO_PMAP_H_ /* all the functions declared in this file are defined in arch/xyz/pmap.c */ -#include -#include -#include +#include +#include +#include #include #define PFN(x) ((x) >> VM_PAGE_SHIFT) diff --git a/include/socks/printk.h b/include/mango/printk.h similarity index 70% rename from include/socks/printk.h rename to include/mango/printk.h index 8e140a3..77b4afe 100644 --- a/include/socks/printk.h +++ b/include/mango/printk.h @@ -1,7 +1,7 @@ -#ifndef SOCKS_PRINTK_H_ -#define SOCKS_PRINTK_H_ +#ifndef MANGO_PRINTK_H_ +#define MANGO_PRINTK_H_ -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/socks/queue.h b/include/mango/queue.h similarity index 96% rename from include/socks/queue.h rename to include/mango/queue.h index 2f25dfa..a78718c 100644 --- a/include/socks/queue.h +++ b/include/mango/queue.h @@ -1,7 +1,7 @@ -#ifndef SOCKS_QUEUE_H_ -#define SOCKS_QUEUE_H_ +#ifndef MANGO_QUEUE_H_ +#define MANGO_QUEUE_H_ -#include +#include #include #ifdef __cplusplus diff --git a/include/socks/ringbuffer.h b/include/mango/ringbuffer.h similarity index 83% rename from include/socks/ringbuffer.h rename to include/mango/ringbuffer.h index fd2c64e..624da7c 100644 --- a/include/socks/ringbuffer.h +++ b/include/mango/ringbuffer.h @@ -1,8 +1,8 @@ -#ifndef SOCKS_RINGBUFFER_H_ -#define SOCKS_RINGBUFFER_H_ +#ifndef MANGO_RINGBUFFER_H_ +#define MANGO_RINGBUFFER_H_ -#include -#include +#include +#include struct ringbuffer { unsigned char *r_buffer; @@ -22,8 +22,8 @@ extern kern_status_t ringbuffer_deinit(struct ringbuffer *buf); extern size_t ringbuffer_unread(struct ringbuffer *buf); extern size_t ringbuffer_avail(struct ringbuffer *buf); -extern size_t ringbuffer_read(struct ringbuffer *buf, size_t size, void *buffer, socks_flags_t flags); -extern size_t ringbuffer_write(struct ringbuffer *buf, size_t size, const void *buffer, socks_flags_t flags); +extern size_t ringbuffer_read(struct ringbuffer *buf, size_t size, void *buffer, mango_flags_t flags); +extern size_t ringbuffer_write(struct ringbuffer *buf, size_t size, const void *buffer, mango_flags_t flags); /* TODO */ //extern size_t ringbuffer_peek(struct ringbuffer *buf, size_t at, size_t size, void *buffer); diff --git a/include/socks/sched.h b/include/mango/sched.h similarity index 96% rename from include/socks/sched.h rename to include/mango/sched.h index 1d89e50..8b83310 100644 --- a/include/socks/sched.h +++ b/include/mango/sched.h @@ -1,12 +1,12 @@ -#ifndef SOCKS_SCHED_H_ -#define SOCKS_SCHED_H_ +#ifndef MANGO_SCHED_H_ +#define MANGO_SCHED_H_ -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #define TASK_NAME_MAX 64 #define PRIO_MAX 32 diff --git a/include/socks/status.h b/include/mango/status.h similarity index 91% rename from include/socks/status.h rename to include/mango/status.h index e910d6a..0634802 100644 --- a/include/socks/status.h +++ b/include/mango/status.h @@ -1,5 +1,5 @@ -#ifndef SOCKS_STATUS_H_ -#define SOCKS_STATUS_H_ +#ifndef MANGO_STATUS_H_ +#define MANGO_STATUS_H_ typedef unsigned int kern_status_t; diff --git a/include/socks/termios.h b/include/mango/termios.h similarity index 97% rename from include/socks/termios.h rename to include/mango/termios.h index 1394659..7d81c61 100644 --- a/include/socks/termios.h +++ b/include/mango/termios.h @@ -1,5 +1,5 @@ -#ifndef SOCKS_TERMIOS_H_ -#define SOCKS_TERMIOS_H_ +#ifndef MANGO_TERMIOS_H_ +#define MANGO_TERMIOS_H_ #include diff --git a/include/socks/test.h b/include/mango/test.h similarity index 71% rename from include/socks/test.h rename to include/mango/test.h index 5b921c1..5271e98 100644 --- a/include/socks/test.h +++ b/include/mango/test.h @@ -1,5 +1,5 @@ -#ifndef SOCKS_TEST_H_ -#define SOCKS_TEST_H_ +#ifndef MANGO_TEST_H_ +#define MANGO_TEST_H_ #ifdef __cplusplus extern "C" { diff --git a/include/socks/tty.h b/include/mango/tty.h similarity index 93% rename from include/socks/tty.h rename to include/mango/tty.h index be46123..e0008fb 100644 --- a/include/socks/tty.h +++ b/include/mango/tty.h @@ -1,11 +1,11 @@ -#ifndef SOCKS_TTY_H_ -#define SOCKS_TTY_H_ +#ifndef MANGO_TTY_H_ +#define MANGO_TTY_H_ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #define TTY_DEVICE(dev) ((dev)->dev_type == DEV_TYPE_CHAR ? (dev)->chr.c_tty : NULL) @@ -94,7 +94,7 @@ struct tty_driver { struct tty_ldisc { char name[OBJECT_NAME_MAX]; - kern_status_t(*read)(struct device *, void *, size_t, size_t *, socks_flags_t); + kern_status_t(*read)(struct device *, void *, size_t, size_t *, mango_flags_t); void(*write)(struct device *, const struct input_event *); }; @@ -134,8 +134,8 @@ static inline struct driver *tty_driver_base(struct tty_driver *drv) return &drv->tty_base; } -extern kern_status_t tty_read(struct device *tty, void *buf, size_t offset, size_t max, size_t *nr_read, socks_flags_t flags); -extern kern_status_t tty_write(struct device *tty, const void *buf, size_t offset, size_t len, size_t *nr_written, socks_flags_t flags); +extern kern_status_t tty_read(struct device *tty, void *buf, size_t offset, size_t max, size_t *nr_read, mango_flags_t flags); +extern kern_status_t tty_write(struct device *tty, const void *buf, size_t offset, size_t len, size_t *nr_written, mango_flags_t flags); extern kern_status_t tty_report_event(struct device *tty, const struct input_event *ev); #ifdef __cplusplus diff --git a/include/socks/types.h b/include/mango/types.h similarity index 79% rename from include/socks/types.h rename to include/mango/types.h index e21ef5c..55c206e 100644 --- a/include/socks/types.h +++ b/include/mango/types.h @@ -1,5 +1,5 @@ -#ifndef SOCKS_TYPES_H_ -#define SOCKS_TYPES_H_ +#ifndef MANGO_TYPES_H_ +#define MANGO_TYPES_H_ #include diff --git a/include/socks/util.h b/include/mango/util.h similarity index 97% rename from include/socks/util.h rename to include/mango/util.h index ee5080d..bf8bd4e 100644 --- a/include/socks/util.h +++ b/include/mango/util.h @@ -1,5 +1,5 @@ -#ifndef SOCKS_UTIL_H_ -#define SOCKS_UTIL_H_ +#ifndef MANGO_UTIL_H_ +#define MANGO_UTIL_H_ #include #include diff --git a/include/socks/vm.h b/include/mango/vm.h similarity index 97% rename from include/socks/vm.h rename to include/mango/vm.h index 8eac77c..35d3972 100644 --- a/include/socks/vm.h +++ b/include/mango/vm.h @@ -1,14 +1,14 @@ -#ifndef SOCKS_VM_H_ -#define SOCKS_VM_H_ +#ifndef MANGO_VM_H_ +#define MANGO_VM_H_ #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/init/init.c b/init/init.c index 2a4a6b4..796cf5b 100644 --- a/init/init.c +++ b/init/init.c @@ -1,4 +1,4 @@ -#include +#include int do_initcalls(void) diff --git a/init/main.c b/init/main.c index 0b1a904..3a38d27 100644 --- a/init/main.c +++ b/init/main.c @@ -1,18 +1,18 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include extern unsigned long get_rflags(void); @@ -21,7 +21,7 @@ extern char __pstart[], __pend[]; void print_kernel_banner(void) { - printk("Socks kernel version " BUILD_ID); + printk("Mango kernel version " BUILD_ID); } static void hang(void) diff --git a/kernel/arg.c b/kernel/arg.c index 48197bc..f7a591e 100644 --- a/kernel/arg.c +++ b/kernel/arg.c @@ -1,6 +1,6 @@ -#include -#include -#include +#include +#include +#include static char g_cmdline[CMDLINE_MAX + 1] = {0}; diff --git a/kernel/clock.c b/kernel/clock.c index e095f83..f5a225f 100644 --- a/kernel/clock.c +++ b/kernel/clock.c @@ -1,6 +1,6 @@ -#include -#include -#include +#include +#include +#include static clock_ticks_t ticks_per_sec = 0; volatile clock_ticks_t clock_ticks = 0; diff --git a/kernel/console.c b/kernel/console.c index e492846..43f6998 100644 --- a/kernel/console.c +++ b/kernel/console.c @@ -1,7 +1,7 @@ -#include -#include -#include -#include +#include +#include +#include +#include static struct queue consoles; static spin_lock_t consoles_lock = SPIN_LOCK_INIT; diff --git a/kernel/cpu.c b/kernel/cpu.c index ecbc4a9..4e62387 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1,6 +1,6 @@ -#include -#include -#include +#include +#include +#include DECLARE_BITMAP(cpu_available, CPU_MAX); DECLARE_BITMAP(cpu_online, CPU_MAX); diff --git a/kernel/panic.c b/kernel/panic.c index 566827b..8c31dbe 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -1,9 +1,9 @@ #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include static int has_panicked = 0; diff --git a/kernel/percpu.c b/kernel/percpu.c index 2ec9ac4..9dddfb6 100644 --- a/kernel/percpu.c +++ b/kernel/percpu.c @@ -1,6 +1,6 @@ -#include -#include -#include +#include +#include +#include #include #include diff --git a/kernel/printk.c b/kernel/printk.c index 12c5a34..f61c1a1 100644 --- a/kernel/printk.c +++ b/kernel/printk.c @@ -1,7 +1,7 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include #define LOG_BUFFER_SIZE 0x40000 diff --git a/kernel/status.c b/kernel/status.c index d2cf6b7..e7ae332 100644 --- a/kernel/status.c +++ b/kernel/status.c @@ -1,4 +1,4 @@ -#include +#include #define ERROR_STRING_CASE(code) \ case code: \ diff --git a/libc/include/socks/libc/ctype.h b/libc/include/mango/libc/ctype.h similarity index 89% rename from libc/include/socks/libc/ctype.h rename to libc/include/mango/libc/ctype.h index 32fb2ed..27b04b9 100644 --- a/libc/include/socks/libc/ctype.h +++ b/libc/include/mango/libc/ctype.h @@ -1,5 +1,5 @@ -#ifndef SOCKS_LIBC_TYPES_H_ -#define SOCKS_LIBC_TYPES_H_ +#ifndef MANGO_LIBC_TYPES_H_ +#define MANGO_LIBC_TYPES_H_ #ifdef __cplusplus extern "C" { diff --git a/libc/include/socks/libc/stdio.h b/libc/include/mango/libc/stdio.h similarity index 88% rename from libc/include/socks/libc/stdio.h rename to libc/include/mango/libc/stdio.h index 5963cd9..f7078ad 100644 --- a/libc/include/socks/libc/stdio.h +++ b/libc/include/mango/libc/stdio.h @@ -1,5 +1,5 @@ -#ifndef SOCKS_STDIO_H_ -#define SOCKS_STDIO_H_ +#ifndef MANGO_STDIO_H_ +#define MANGO_STDIO_H_ #include #include diff --git a/libc/include/socks/libc/string.h b/libc/include/mango/libc/string.h similarity index 95% rename from libc/include/socks/libc/string.h rename to libc/include/mango/libc/string.h index a993d35..10a29ed 100644 --- a/libc/include/socks/libc/string.h +++ b/libc/include/mango/libc/string.h @@ -1,5 +1,5 @@ -#ifndef SOCKS_LIBC_STRING_H_ -#define SOCKS_LIBC_STRING_H_ +#ifndef MANGO_LIBC_STRING_H_ +#define MANGO_LIBC_STRING_H_ #include #include diff --git a/libc/stdio/printf.c b/libc/stdio/printf.c index 5c47162..fb644fc 100644 --- a/libc/stdio/printf.c +++ b/libc/stdio/printf.c @@ -30,7 +30,7 @@ // /////////////////////////////////////////////////////////////////////////////// -#include +#include #include #include #include diff --git a/libc/string/memmove.c b/libc/string/memmove.c index 57be152..652fe5b 100644 --- a/libc/string/memmove.c +++ b/libc/string/memmove.c @@ -1,5 +1,5 @@ #include -#include +#include static void *memcpy_r(void *dest, const void *src, size_t sz) { diff --git a/libc/string/strcat.c b/libc/string/strcat.c index 6ee3c3c..519a8c7 100644 --- a/libc/string/strcat.c +++ b/libc/string/strcat.c @@ -1,4 +1,4 @@ -#include +#include char *strcat(char *dest, const char *src) { size_t start = strlen(dest), i = 0; diff --git a/libc/string/strcpy.c b/libc/string/strcpy.c index 3056e02..793f83b 100644 --- a/libc/string/strcpy.c +++ b/libc/string/strcpy.c @@ -1,4 +1,4 @@ -#include +#include char *strcpy(char *output, const char *input) { diff --git a/libc/string/strlen.c b/libc/string/strlen.c index 49967b6..77b661b 100644 --- a/libc/string/strlen.c +++ b/libc/string/strlen.c @@ -1,4 +1,4 @@ -#include +#include size_t strlen(const char *str) { size_t res = 0; diff --git a/libc/string/strrchr.c b/libc/string/strrchr.c index 9040bb8..459a8fe 100644 --- a/libc/string/strrchr.c +++ b/libc/string/strrchr.c @@ -1,4 +1,4 @@ -#include +#include char *strrchr(const char *str, int c) { size_t len = strlen(str); diff --git a/libc/string/strtok.c b/libc/string/strtok.c index d42faf7..d8da72c 100644 --- a/libc/string/strtok.c +++ b/libc/string/strtok.c @@ -1,5 +1,5 @@ #include -#include +#include #define ALIGN (sizeof(size_t)) #define ONES ((size_t)-1 / UCHAR_MAX) diff --git a/obj/link.c b/obj/link.c index 4f08381..db4087c 100644 --- a/obj/link.c +++ b/obj/link.c @@ -1,4 +1,4 @@ -#include +#include #define LINK_CAST(p) OBJECT_C_CAST(struct link, l_base, &link_type, p) diff --git a/obj/namespace.c b/obj/namespace.c index 0514cac..204e73e 100644 --- a/obj/namespace.c +++ b/obj/namespace.c @@ -1,4 +1,4 @@ -#include +#include #define NAMESPACE_CAST(p) OBJECT_C_CAST(struct object_namespace, ns_base, &ns_type, p) diff --git a/obj/object.c b/obj/object.c index 234dc4e..9921a15 100644 --- a/obj/object.c +++ b/obj/object.c @@ -1,6 +1,6 @@ -#include -#include -#include +#include +#include +#include #define HAS_OP(obj, opname) ((obj)->ob_type->ob_ops.opname) @@ -133,7 +133,7 @@ struct object *object_header(void *p) } kern_status_t object_read(struct object *obj, void *p, size_t offset, - size_t max, size_t *nr_read, socks_flags_t flags) + size_t max, size_t *nr_read, mango_flags_t flags) { kern_status_t status = KERN_UNSUPPORTED; @@ -151,7 +151,7 @@ kern_status_t object_read(struct object *obj, void *p, size_t offset, } kern_status_t object_write(struct object *obj, const void *p, size_t offset, - size_t max, size_t *nr_written, socks_flags_t flags) + size_t max, size_t *nr_written, mango_flags_t flags) { kern_status_t status = KERN_UNSUPPORTED; diff --git a/obj/set.c b/obj/set.c index fc2836e..da75640 100644 --- a/obj/set.c +++ b/obj/set.c @@ -1,4 +1,4 @@ -#include +#include #define SET_CAST(p) OBJECT_C_CAST(struct set, s_base, &set_type, p) diff --git a/sched/core.c b/sched/core.c index 1f3f929..d44d083 100644 --- a/sched/core.c +++ b/sched/core.c @@ -1,9 +1,9 @@ -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include extern kern_status_t setup_kernel_task(void); extern kern_status_t setup_idle_task(void); diff --git a/sched/runqueue.c b/sched/runqueue.c index 8d70569..512df7b 100644 --- a/sched/runqueue.c +++ b/sched/runqueue.c @@ -1,6 +1,6 @@ -#include -#include -#include +#include +#include +#include #define PRIO_MASK(p) (((uint32_t)1) << (p)) #define FIRST_PRIO(m) (m > 0 ? (PRIO_MAX - __builtin_clz(m) - 1) : -1) diff --git a/sched/task.c b/sched/task.c index 0fb9166..211117b 100644 --- a/sched/task.c +++ b/sched/task.c @@ -1,10 +1,10 @@ -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #define TASK_CAST(p) OBJECT_C_CAST(struct task, t_base, &task_type, p) diff --git a/sched/thread.c b/sched/thread.c index f997dd9..accddc7 100644 --- a/sched/thread.c +++ b/sched/thread.c @@ -1,8 +1,8 @@ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #define THREAD_CAST(p) OBJECT_C_CAST(struct thread, thr_base, &thread_type, p) diff --git a/sched/timer.c b/sched/timer.c index 833d8ed..5e93e09 100644 --- a/sched/timer.c +++ b/sched/timer.c @@ -1,7 +1,7 @@ -#include -#include -#include -#include +#include +#include +#include +#include static void timeout_expiry(struct timer *timer) { diff --git a/sched/wait.c b/sched/wait.c index 497e42c..d4b6661 100644 --- a/sched/wait.c +++ b/sched/wait.c @@ -1,5 +1,5 @@ -#include -#include +#include +#include void wait_item_init(struct wait_item *item, struct thread *thr) { diff --git a/sched/workqueue.c b/sched/workqueue.c index bad0db9..f567157 100644 --- a/sched/workqueue.c +++ b/sched/workqueue.c @@ -1,7 +1,7 @@ -#include -#include -#include -#include +#include +#include +#include +#include static struct worker_pool *__global_worker_pool = NULL; diff --git a/test/obj.c b/test/obj.c index f8be774..1e6bb34 100644 --- a/test/obj.c +++ b/test/obj.c @@ -1,7 +1,7 @@ -#include -#include -#include -#include +#include +#include +#include +#include #define TEST_CAST(p) OBJECT_C_CAST(struct test_object, base, &test_type, p) diff --git a/test/test.c b/test/test.c index a42817f..166be5c 100644 --- a/test/test.c +++ b/test/test.c @@ -1,5 +1,5 @@ -#include -#include +#include +#include int run_all_tests(void) { diff --git a/tools/Makefile b/tools/Makefile deleted file mode 100644 index 7598ba4..0000000 --- a/tools/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TOOL_LIST := e64patch - -all: - @for prog in $(TOOL_LIST); do \ - $(MAKE) -s -C $$prog; \ - done - -clean: - @for prog in $(TOOL_LIST); do \ - $(MAKE) -s -C $$prog clean; \ - done - -.PHONY: all clean diff --git a/tools/bochsrc.bxrc b/tools/bochsrc.bxrc index a9caf12..8153a48 100644 --- a/tools/bochsrc.bxrc +++ b/tools/bochsrc.bxrc @@ -10,7 +10,7 @@ floppy_bootsig_check: disabled=0 floppya: type=1_44 # no floppyb ata0: enabled=true, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14 -ata0-master: type=cdrom, path="build/socks-kernel.iso", status=inserted, model="Generic 1234", biosdetect=auto +ata0-master: type=cdrom, path="build/mango-kernel.iso", status=inserted, model="Generic 1234", biosdetect=auto ata0-slave: type=none ata1: enabled=true, ioaddr1=0x170, ioaddr2=0x370, irq=15 ata1-master: type=none diff --git a/tools/boot-image/grub.cfg b/tools/boot-image/grub.cfg index f6e77ae..4e0db98 100644 --- a/tools/boot-image/grub.cfg +++ b/tools/boot-image/grub.cfg @@ -1,4 +1,4 @@ -menuentry "Socks Kernel" { - multiboot /boot/socks_kernel +menuentry "Mango Kernel" { + multiboot /boot/mango_kernel boot } diff --git a/tools/e64patch/Makefile b/tools/e64patch/Makefile deleted file mode 100644 index 6ee7f5a..0000000 --- a/tools/e64patch/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -TOOL_NAME := e64patch - -include ../tool-config.mk -include ../tool-template.mk diff --git a/tools/kernel-debug/debug_session.sh b/tools/kernel-debug/debug_session.sh index 371b2a5..5042b05 100755 --- a/tools/kernel-debug/debug_session.sh +++ b/tools/kernel-debug/debug_session.sh @@ -5,7 +5,7 @@ lldb_cfg=$2 shift 2 if command -v gdb &> /dev/null; then - printf " \033[93;1mGDB\033[0m boot/socks_kernel\n" + printf " \033[93;1mGDB\033[0m boot/mango_kernel\n" tmux \ new-session -d -s hz-debug "sleep 0.3; gdb -tui -x $gdb_cfg" \; \ split-window -h -l 80 \; \ @@ -13,7 +13,7 @@ if command -v gdb &> /dev/null; then select-pane -t 1 \; \ resize-pane -R 20 elif command -v lldb &> /dev/null; then - printf " \033[93;1mLLDB\033[0m boot/socks_kernel\n" + printf " \033[93;1mLLDB\033[0m boot/mango_kernel\n" tmux \ new-session -d -s hz-debug "sleep 0.1; lldb --source $lldb_cfg" \; \ split-window -h -l 160 \; \ diff --git a/tools/kernel-debug/gdb_session_init b/tools/kernel-debug/gdb_session_init index 3a27743..82d254d 100644 --- a/tools/kernel-debug/gdb_session_init +++ b/tools/kernel-debug/gdb_session_init @@ -1,4 +1,4 @@ set confirm off -symbol-file build/socks_kernel.dbg +symbol-file build/mango_kernel.dbg target remote localhost:1234 set confirm on diff --git a/tools/kernel-debug/lldb_session_init b/tools/kernel-debug/lldb_session_init index c49964e..02ba887 100644 --- a/tools/kernel-debug/lldb_session_init +++ b/tools/kernel-debug/lldb_session_init @@ -1,2 +1,2 @@ -file build/socks_kernel.dbg +file build/mango_kernel.dbg gdb-remote localhost:1234 diff --git a/tools/make/clang-generic.mk b/tools/make/clang-generic.mk deleted file mode 100644 index 3d08e57..0000000 --- a/tools/make/clang-generic.mk +++ /dev/null @@ -1,5 +0,0 @@ -LD := ld.lld -CC := clang - -CFLAGS := -fuse-ld=$(LD) -target x86_64-linux-elf -nostdlib -nostdinc -ffreestanding -Wl,-nostdlib -Wno-unused-command-line-argument -LDFLAGS := -nostdlib diff --git a/tools/make/gcc-cross-compile.mk b/tools/make/gcc-cross-compile.mk deleted file mode 100644 index e69de29..0000000 diff --git a/tools/make/gcc-host.mk b/tools/make/gcc-host.mk deleted file mode 100644 index 2057cb6..0000000 --- a/tools/make/gcc-host.mk +++ /dev/null @@ -1,9 +0,0 @@ -LD := gcc -CC := gcc -CXX := g++ -ASM := gcc - -CFLAGS := -Wall -Werror -pedantic -CXXFLAGS := $(CFLAGS) -ASMFLAGS := $(CFLAGS) -LDFLAGS := -O2 diff --git a/tools/socks.buildid b/tools/mango.buildid similarity index 100% rename from tools/socks.buildid rename to tools/mango.buildid diff --git a/tools/socks.compiledb b/tools/mango.compiledb similarity index 100% rename from tools/socks.compiledb rename to tools/mango.compiledb diff --git a/tools/socks.install-cd b/tools/mango.install-cd similarity index 98% rename from tools/socks.install-cd rename to tools/mango.install-cd index 657a40a..ec1f687 100755 --- a/tools/socks.install-cd +++ b/tools/mango.install-cd @@ -116,7 +116,7 @@ def choice_options(num_devices): return '1-{}'.format(num_devices) -if not os.path.isfile('build/socks-kernel.iso'): +if not os.path.isfile('build/mango-kernel.iso'): print('No system ISO image found.') print('Please run \'make cd\' to generate an ISO image') exit(-1) @@ -157,7 +157,7 @@ disk_prewrite(devices[choice][0]) dd_args = [ 'sudo', 'dd', - 'if=build/socks-kernel.iso', + 'if=build/mango-kernel.iso', 'of={}'.format(devices[choice][0]), 'bs=1{}'.format('m' if sys.platform == 'darwin' else 'M') ] diff --git a/tools/socks.mkrescue b/tools/mango.mkrescue similarity index 64% rename from tools/socks.mkrescue rename to tools/mango.mkrescue index c665c36..da91af2 100755 --- a/tools/socks.mkrescue +++ b/tools/mango.mkrescue @@ -7,22 +7,22 @@ import sys import os import shutil -kernel_src_path = os.path.join('build', 'socks_kernel') +kernel_src_path = os.path.join('build', 'mango_kernel') grub_cfg_src_path = os.path.join('tools', 'boot-image', 'grub.cfg') -iso_build_dir = os.path.join('build', 'socks-kernel.iso-build') -iso_path = os.path.join('build', 'socks-kernel.iso') +iso_build_dir = os.path.join('build', 'mango-kernel.iso-build') +iso_path = os.path.join('build', 'mango-kernel.iso') def in_source_tree(): - return os.path.isfile('tools/socks.sync') + return os.path.isfile('tools/mango.sync') if not in_source_tree(): - print('This script must be executed from the root of the Socks source tree') + print('This script must be executed from the root of the Mango source tree') exit(-1) if not os.path.isdir('build'): - print('Please build the Socks kernel before using this tool') + print('Please build the Mango kernel before using this tool') exit(-1) if os.path.isdir(iso_build_dir): @@ -33,7 +33,7 @@ os.mkdir(iso_build_dir) os.mkdir(os.path.join(iso_build_dir, 'boot')) os.mkdir(os.path.join(iso_build_dir, 'boot', 'grub')) -shutil.copyfile(kernel_src_path, os.path.join(iso_build_dir, 'boot', 'socks_kernel')) +shutil.copyfile(kernel_src_path, os.path.join(iso_build_dir, 'boot', 'mango_kernel')) shutil.copyfile(grub_cfg_src_path, os.path.join(iso_build_dir, 'boot', 'grub', 'grub.cfg')) subprocess.run(['grub-mkrescue', '-o', iso_path, iso_build_dir]) diff --git a/tools/socks.sync b/tools/mango.sync similarity index 96% rename from tools/socks.sync rename to tools/mango.sync index f2c5811..04de638 100755 --- a/tools/socks.sync +++ b/tools/mango.sync @@ -16,7 +16,7 @@ rsync_path = os.getenv('RSYNC_PATH', default = 'rsync') def in_source_tree(): - return os.path.isfile('tools/socks.sync') + return os.path.isfile('tools/mango.sync') def create_sample_config(): @@ -78,7 +78,7 @@ def print_available_targets(targets): if not in_source_tree(): - print('This script must be executed from the root of the Socks source tree') + print('This script must be executed from the root of the Mango source tree') exit(-1) config = read_config() diff --git a/tools/socks.kexttool b/tools/socks.kexttool deleted file mode 100755 index 9cf7663..0000000 --- a/tools/socks.kexttool +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python3 -# vim: ft=python -# -*- mode: python -*- - -import glob -import os -import sys -from kexttool import kext, scan, select - - -if len(sys.argv) < 2: - print('usage: {} '.format(sys.argv[0])) - exit(0) - -cmd = sys.argv[1] - -commands = { - 'select': select.select_kexts, - 'list': scan.list_all -} - -if cmd not in commands: - print('E: unknown command \'{}\''.format(cmd)) - exit(-1) - -commands[cmd]() diff --git a/tools/tool-config.mk b/tools/tool-config.mk deleted file mode 100644 index c59728e..0000000 --- a/tools/tool-config.mk +++ /dev/null @@ -1,10 +0,0 @@ -MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) -TOOLS_DIR := $(patsubst %/,%,$(dir $(MAKEFILE_PATH))) - -SOCKS_ARCH ?= x86_64 - -include $(TOOLS_DIR)/make/gcc-host.mk -SOURCE_ROOT := $(TOOLS_DIR)/.. - -TOOLS_BUILD_DIR := $(TOOLS_DIR)/../build/tools -BUILD_DIR := $(TOOLS_BUILD_DIR)/$(TOOL_NAME) diff --git a/tools/tool-template.mk b/tools/tool-template.mk deleted file mode 100644 index bb841bb..0000000 --- a/tools/tool-template.mk +++ /dev/null @@ -1,22 +0,0 @@ -BUILD_DIR := $(TOOLS_BUILD_DIR)/$(TOOL_NAME) - -SRC := $(shell find . -name '*.c') -OBJ := $(addprefix $(BUILD_DIR)/,$(SRC:.c=.o)) - -$(BUILD_DIR)/$(TOOL_NAME): $(OBJ) - @mkdir -p $(@D) - - @printf " \033[1;36mHOSTLD\033[0m \033[1mtools/$(TOOL_NAME)\033[0m\n" - @$(CC) $^ -o $@ $(CFLAGS) $(LDFLAGS) - -$(BUILD_DIR)/%.o: %.c - @printf " \033[1;32mHOSTCC\033[0m $(TOOL_NAME)/$^\n" - @mkdir -p $(@D) - - @$(CC) $< -o $@ -c $(CFLAGS) - -all: $(TOOL_NAME) - -clean: - @printf " \033[1;93mRM\033[0m Deleting sandbox/$(TOOL_NAME)\n" - @rm -rf $(BUILD_DIR) diff --git a/util/data_size.c b/util/data_size.c index 5273265..6d373a6 100644 --- a/util/data_size.c +++ b/util/data_size.c @@ -1,5 +1,5 @@ #include -#include +#include struct magnitude { size_t threshold; diff --git a/util/endian.c b/util/endian.c index c8bf139..9119a27 100644 --- a/util/endian.c +++ b/util/endian.c @@ -1,4 +1,4 @@ -#include +#include #include static uint16_t swap_uint16( uint16_t val ) diff --git a/vm/bootstrap.c b/vm/bootstrap.c index eda1bf2..8851cac 100644 --- a/vm/bootstrap.c +++ b/vm/bootstrap.c @@ -1,9 +1,9 @@ -#include +#include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include diff --git a/vm/cache.c b/vm/cache.c index 6c2ea85..7dee14a 100644 --- a/vm/cache.c +++ b/vm/cache.c @@ -1,8 +1,8 @@ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #define FREELIST_END ((unsigned int)-1) diff --git a/vm/flat.c b/vm/flat.c index afaa114..df33ee9 100644 --- a/vm/flat.c +++ b/vm/flat.c @@ -15,9 +15,9 @@ memory outstripts free memory), the sparse memory model may be a better choice. */ -#include -#include -#include +#include +#include +#include /* array of pages, one for each physical page frame present in RAM */ static struct vm_page *page_array = NULL; diff --git a/vm/kmalloc.c b/vm/kmalloc.c index f534859..afb9219 100644 --- a/vm/kmalloc.c +++ b/vm/kmalloc.c @@ -1,8 +1,8 @@ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #define SIZE_N_CACHE(s) \ { .c_name = "size-" # s, .c_obj_size = s, .c_page_order = VM_PAGE_16K } diff --git a/vm/memblock.c b/vm/memblock.c index 775fa19..929452d 100644 --- a/vm/memblock.c +++ b/vm/memblock.c @@ -21,9 +21,9 @@ */ #include #include -#include -#include -#include +#include +#include +#include #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) ? (a) : (b)) diff --git a/vm/model.c b/vm/model.c index 282d704..63009fc 100644 --- a/vm/model.c +++ b/vm/model.c @@ -1,4 +1,4 @@ -#include +#include static enum vm_model model; diff --git a/vm/page.c b/vm/page.c index 831c1bd..c5eef91 100644 --- a/vm/page.c +++ b/vm/page.c @@ -1,8 +1,8 @@ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include /* Pre-calculated page order -> size conversion table */ static size_t page_order_bytes[] = { diff --git a/vm/sparse.c b/vm/sparse.c index bcd0a45..9c63bf9 100644 --- a/vm/sparse.c +++ b/vm/sparse.c @@ -22,13 +22,13 @@ of the sparse memory model may be outweighed by the extra overhead, and the flat memory model may be a better choice. */ -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include static struct vm_sector *sector_array = NULL; static size_t sector_array_count = 0; diff --git a/vm/zone.c b/vm/zone.c index 96556be..75782a5 100644 --- a/vm/zone.c +++ b/vm/zone.c @@ -1,12 +1,12 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static struct vm_page *group_pages_into_block(struct vm_zone *z, phys_addr_t base, phys_addr_t limit, int order) {