meta: rename
This commit is contained in:
121
Makefile
121
Makefile
@@ -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)
|
|
||||||
@@ -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))
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <socks/machine/cpu.h>
|
#include <mango/machine/cpu.h>
|
||||||
|
|
||||||
int ml_init_bootcpu(void)
|
int ml_init_bootcpu(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#include <socks/machine/hwlock.h>
|
#include <mango/machine/hwlock.h>
|
||||||
#include <socks/compiler.h>
|
#include <mango/compiler.h>
|
||||||
|
|
||||||
void ml_hwlock_lock(ml_hwlock_t *lck)
|
void ml_hwlock_lock(ml_hwlock_t *lck)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SOCKS_USER_CPU_H_
|
#ifndef MANGO_USER_CPU_H_
|
||||||
#define SOCKS_USER_CPU_H_
|
#define MANGO_USER_CPU_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SOCKS_USER_HWLOCK_H_
|
#ifndef MANGO_USER_HWLOCK_H_
|
||||||
#define SOCKS_USER_HWLOCK_H_
|
#define MANGO_USER_HWLOCK_H_
|
||||||
|
|
||||||
#define ML_HWLOCK_INIT (0)
|
#define ML_HWLOCK_INIT (0)
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SOCKS_X86_64_INIT_H_
|
#ifndef MANGO_X86_64_INIT_H_
|
||||||
#define SOCKS_X86_64_INIT_H_
|
#define MANGO_X86_64_INIT_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
5
arch/user/include/mango/machine/irq.h
Normal file
5
arch/user/include/mango/machine/irq.h
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#ifndef MANGO_X86_64_IRQ_H_
|
||||||
|
#define MANGO_X86_64_IRQ_H_
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SOCKS_USER_PMAP_H_
|
#ifndef MANGO_USER_PMAP_H_
|
||||||
#define SOCKS_USER_PMAP_H_
|
#define MANGO_USER_PMAP_H_
|
||||||
|
|
||||||
typedef uintptr_t ml_pmap_t;
|
typedef uintptr_t ml_pmap_t;
|
||||||
typedef uint64_t ml_pfn_t;
|
typedef uint64_t ml_pfn_t;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SOCKS_USER_VM_H_
|
#ifndef MANGO_USER_VM_H_
|
||||||
#define SOCKS_USER_VM_H_
|
#define MANGO_USER_VM_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#ifndef SOCKS_X86_64_IRQ_H_
|
|
||||||
#define SOCKS_X86_64_IRQ_H_
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <socks/init.h>
|
#include <mango/init.h>
|
||||||
#include <socks/memblock.h>
|
#include <mango/memblock.h>
|
||||||
#include <socks/vm.h>
|
#include <mango/vm.h>
|
||||||
#include <socks/object.h>
|
#include <mango/object.h>
|
||||||
#include <socks/printk.h>
|
#include <mango/printk.h>
|
||||||
#include <arch/stdcon.h>
|
#include <arch/stdcon.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include <socks/init.h>
|
#include <mango/init.h>
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
extern char __start_initcall0[] __asm("section$start$__DATA$__initcall0.init");
|
extern char __start_initcall0[] __asm("section$start$__DATA$__initcall0.init");
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#include <socks/libc/string.h>
|
#include <mango/libc/string.h>
|
||||||
#include <socks/libc/ctype.h>
|
#include <mango/libc/ctype.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <socks/console.h>
|
#include <mango/console.h>
|
||||||
#include <socks/vm.h>
|
#include <mango/vm.h>
|
||||||
#include <socks/printk.h>
|
#include <mango/printk.h>
|
||||||
|
|
||||||
static void stdcon_write(struct console *con, const char *s, unsigned int len)
|
static void stdcon_write(struct console *con, const char *s, unsigned int len)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include <socks/sched.h>
|
#include <mango/sched.h>
|
||||||
#include <socks/compiler.h>
|
#include <mango/compiler.h>
|
||||||
|
|
||||||
//size_t THREAD_sp = offsetof(struct thread, tr_sp);
|
//size_t THREAD_sp = offsetof(struct thread, tr_sp);
|
||||||
|
|
||||||
|
|||||||
@@ -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))
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include <socks/machine/cpu.h>
|
#include <mango/machine/cpu.h>
|
||||||
#include <arch/msr.h>
|
#include <arch/msr.h>
|
||||||
|
|
||||||
int ml_cpu_block_init(ml_cpu_block *p)
|
int ml_cpu_block_init(ml_cpu_block *p)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "socks/types.h"
|
#include "mango/types.h"
|
||||||
#include <socks/memblock.h>
|
#include <mango/memblock.h>
|
||||||
#include <socks/printk.h>
|
#include <mango/printk.h>
|
||||||
#include <socks/util.h>
|
#include <mango/util.h>
|
||||||
#include <arch/e820.h>
|
#include <arch/e820.h>
|
||||||
|
|
||||||
void e820_scan(multiboot_memory_map_t *mmap, size_t len)
|
void e820_scan(multiboot_memory_map_t *mmap, size_t len)
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include <socks/libc/string.h>
|
#include <mango/libc/string.h>
|
||||||
#include <arch/gdt.h>
|
#include <arch/gdt.h>
|
||||||
|
|
||||||
static void init_entry(struct gdt_entry *entry, int access, int flags)
|
static void init_entry(struct gdt_entry *entry, int access, int flags)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef ARCH_GDT_H_
|
#ifndef ARCH_GDT_H_
|
||||||
#define ARCH_GDT_H_
|
#define ARCH_GDT_H_
|
||||||
|
|
||||||
#include <socks/compiler.h>
|
#include <mango/compiler.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#ifndef ARCH_IRQ_H_
|
#ifndef ARCH_IRQ_H_
|
||||||
#define ARCH_IRQ_H_
|
#define ARCH_IRQ_H_
|
||||||
|
|
||||||
#include <socks/compiler.h>
|
#include <mango/compiler.h>
|
||||||
#include <socks/queue.h>
|
#include <mango/queue.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#ifndef ARCH_PAGING_H_
|
#ifndef ARCH_PAGING_H_
|
||||||
#define ARCH_PAGING_H_
|
#define ARCH_PAGING_H_
|
||||||
|
|
||||||
#include <socks/types.h>
|
#include <mango/types.h>
|
||||||
#include <socks/compiler.h>
|
#include <mango/compiler.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SOCKS_X86_64_CPU_H_
|
#ifndef MANGO_X86_64_CPU_H_
|
||||||
#define SOCKS_X86_64_CPU_H_
|
#define MANGO_X86_64_CPU_H_
|
||||||
|
|
||||||
#include <arch/gdt.h>
|
#include <arch/gdt.h>
|
||||||
#include <arch/irq.h>
|
#include <arch/irq.h>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SOCKS_X86_64_HWLOCK_H_
|
#ifndef MANGO_X86_64_HWLOCK_H_
|
||||||
#define SOCKS_X86_64_HWLOCK_H_
|
#define MANGO_X86_64_HWLOCK_H_
|
||||||
|
|
||||||
#define ML_HWLOCK_INIT (0)
|
#define ML_HWLOCK_INIT (0)
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SOCKS_X86_64_INIT_H_
|
#ifndef MANGO_X86_64_INIT_H_
|
||||||
#define SOCKS_X86_64_INIT_H_
|
#define MANGO_X86_64_INIT_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
5
arch/x86_64/include/mango/machine/irq.h
Normal file
5
arch/x86_64/include/mango/machine/irq.h
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#ifndef MANGO_X86_64_IRQ_H_
|
||||||
|
#define MANGO_X86_64_IRQ_H_
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SOCKS_X86_64_PANIC_H_
|
#ifndef MANGO_X86_64_PANIC_H_
|
||||||
#define SOCKS_X86_64_PANIC_H_
|
#define MANGO_X86_64_PANIC_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SOCKS_X86_64_PMAP_H_
|
#ifndef MANGO_X86_64_PMAP_H_
|
||||||
#define SOCKS_X86_64_PMAP_H_
|
#define MANGO_X86_64_PMAP_H_
|
||||||
|
|
||||||
#include <arch/paging.h>
|
#include <arch/paging.h>
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef SOCKS_X86_64_THREAD_H_
|
#ifndef MANGO_X86_64_THREAD_H_
|
||||||
#define SOCKS_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 switch_to(struct thread *from, struct thread *to);
|
||||||
extern void prepare_stack(uintptr_t ip, uintptr_t *sp);
|
extern void prepare_stack(uintptr_t ip, uintptr_t *sp);
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SOCKS_X86_64_VM_H_
|
#ifndef MANGO_X86_64_VM_H_
|
||||||
#define SOCKS_X86_64_VM_H_
|
#define MANGO_X86_64_VM_H_
|
||||||
|
|
||||||
/* kernel higher-half base virtual address. */
|
/* kernel higher-half base virtual address. */
|
||||||
#define VM_KERNEL_VOFFSET 0xFFFFFFFF80000000
|
#define VM_KERNEL_VOFFSET 0xFFFFFFFF80000000
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#ifndef SOCKS_X86_64_IRQ_H_
|
|
||||||
#define SOCKS_X86_64_IRQ_H_
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -2,20 +2,20 @@
|
|||||||
|
|
||||||
#include <arch/e820.h>
|
#include <arch/e820.h>
|
||||||
#include <arch/pit.h>
|
#include <arch/pit.h>
|
||||||
#include <socks/arg.h>
|
#include <mango/arg.h>
|
||||||
#include <socks/clock.h>
|
#include <mango/clock.h>
|
||||||
#include <socks/console.h>
|
#include <mango/console.h>
|
||||||
#include <socks/cpu.h>
|
#include <mango/cpu.h>
|
||||||
#include <socks/init.h>
|
#include <mango/init.h>
|
||||||
#include <socks/libc/stdio.h>
|
#include <mango/libc/stdio.h>
|
||||||
#include <socks/machine/cpu.h>
|
#include <mango/machine/cpu.h>
|
||||||
#include <socks/memblock.h>
|
#include <mango/memblock.h>
|
||||||
#include <socks/object.h>
|
#include <mango/object.h>
|
||||||
#include <socks/percpu.h>
|
#include <mango/percpu.h>
|
||||||
#include <socks/pmap.h>
|
#include <mango/pmap.h>
|
||||||
#include <socks/printk.h>
|
#include <mango/printk.h>
|
||||||
#include <socks/types.h>
|
#include <mango/types.h>
|
||||||
#include <socks/vm.h>
|
#include <mango/vm.h>
|
||||||
|
|
||||||
#define PTR32(x) ((void *)((uintptr_t)(x)))
|
#define PTR32(x) ((void *)((uintptr_t)(x)))
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include <socks/init.h>
|
#include <mango/init.h>
|
||||||
|
|
||||||
extern char __initcall0_start[];
|
extern char __initcall0_start[];
|
||||||
extern char __initcall1_start[];
|
extern char __initcall1_start[];
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#include <arch/irq.h>
|
#include <arch/irq.h>
|
||||||
#include <arch/ports.h>
|
#include <arch/ports.h>
|
||||||
#include <socks/cpu.h>
|
#include <mango/cpu.h>
|
||||||
#include <socks/libc/string.h>
|
#include <mango/libc/string.h>
|
||||||
#include <socks/machine/cpu.h>
|
#include <mango/machine/cpu.h>
|
||||||
#include <socks/machine/irq.h>
|
#include <mango/machine/irq.h>
|
||||||
#include <socks/panic.h>
|
#include <mango/panic.h>
|
||||||
#include <socks/sched.h>
|
#include <mango/sched.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#define MAX_ISR_HANDLERS 16
|
#define MAX_ISR_HANDLERS 16
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "socks/machine/panic.h"
|
#include "mango/machine/panic.h"
|
||||||
#include "socks/vm.h"
|
#include "mango/vm.h"
|
||||||
#include <socks/printk.h>
|
#include <mango/printk.h>
|
||||||
#include <socks/libc/stdio.h>
|
#include <mango/libc/stdio.h>
|
||||||
#include <arch/irq.h>
|
#include <arch/irq.h>
|
||||||
|
|
||||||
#define R_CF 0
|
#define R_CF 0
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#include <arch/irq.h>
|
#include <arch/irq.h>
|
||||||
#include <arch/ports.h>
|
#include <arch/ports.h>
|
||||||
#include <socks/clock.h>
|
#include <mango/clock.h>
|
||||||
#include <socks/cpu.h>
|
#include <mango/cpu.h>
|
||||||
#include <socks/printk.h>
|
#include <mango/printk.h>
|
||||||
|
|
||||||
#define PIT_COUNTER0 0x40
|
#define PIT_COUNTER0 0x40
|
||||||
#define PIT_CMD 0x43
|
#define PIT_CMD 0x43
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#include <socks/types.h>
|
#include <mango/types.h>
|
||||||
#include <socks/memblock.h>
|
#include <mango/memblock.h>
|
||||||
#include <socks/vm.h>
|
#include <mango/vm.h>
|
||||||
#include <socks/printk.h>
|
#include <mango/printk.h>
|
||||||
#include <socks/status.h>
|
#include <mango/status.h>
|
||||||
#include <socks/compiler.h>
|
#include <mango/compiler.h>
|
||||||
#include <socks/pmap.h>
|
#include <mango/pmap.h>
|
||||||
|
|
||||||
/* some helpful datasize constants */
|
/* some helpful datasize constants */
|
||||||
#define C_1GiB 0x40000000ULL
|
#define C_1GiB 0x40000000ULL
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#include <arch/irq.h>
|
#include <arch/irq.h>
|
||||||
#include <arch/ports.h>
|
#include <arch/ports.h>
|
||||||
#include <arch/serial.h>
|
#include <arch/serial.h>
|
||||||
#include <socks/device.h>
|
#include <mango/device.h>
|
||||||
#include <socks/kext.h>
|
#include <mango/kext.h>
|
||||||
#include <socks/libc/stdio.h>
|
#include <mango/libc/stdio.h>
|
||||||
#include <socks/printk.h>
|
#include <mango/printk.h>
|
||||||
#include <socks/tty.h>
|
#include <mango/tty.h>
|
||||||
|
|
||||||
#define COM1 0x3F8
|
#define COM1 0x3F8
|
||||||
#define COM2 0x2F8
|
#define COM2 0x2F8
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include <socks/machine/thread.h>
|
#include <mango/machine/thread.h>
|
||||||
|
|
||||||
struct thread_ctx {
|
struct thread_ctx {
|
||||||
uint64_t r15, r14, r13, r12, r11, r10, r9, r8;
|
uint64_t r15, r14, r13, r12, r11, r10, r9, r8;
|
||||||
|
|||||||
109
doc/objects.rst
109
doc/objects.rst
@@ -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
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#include <socks/libc/string.h>
|
#include <mango/libc/string.h>
|
||||||
#include <socks/bitmap.h>
|
#include <mango/bitmap.h>
|
||||||
|
|
||||||
void bitmap_zero(unsigned long *map, unsigned long nbits)
|
void bitmap_zero(unsigned long *map, unsigned long nbits)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
provide a comparator function.
|
provide a comparator function.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <socks/btree.h>
|
#include <mango/btree.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include <socks/queue.h>
|
#include <mango/queue.h>
|
||||||
|
|
||||||
size_t queue_length(struct queue *q)
|
size_t queue_length(struct queue *q)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include <socks/ringbuffer.h>
|
#include <mango/ringbuffer.h>
|
||||||
#include <socks/sched.h>
|
#include <mango/sched.h>
|
||||||
|
|
||||||
size_t ringbuffer_unread(struct ringbuffer *ring_buffer)
|
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) {
|
if (!ring_buffer) {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -86,7 +86,7 @@ size_t ringbuffer_read(struct ringbuffer *ring_buffer, size_t size, void *p, soc
|
|||||||
return collected;
|
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) {
|
if (!ring_buffer || !size) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#ifndef SOCKS_ARG_H_
|
#ifndef MANGO_ARG_H_
|
||||||
#define SOCKS_ARG_H_
|
#define MANGO_ARG_H_
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <socks/status.h>
|
#include <mango/status.h>
|
||||||
|
|
||||||
#define CMDLINE_MAX 4096
|
#define CMDLINE_MAX 4096
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SOCKS_BITMAP_H_
|
#ifndef MANGO_BITMAP_H_
|
||||||
#define SOCKS_BITMAP_H_
|
#define MANGO_BITMAP_H_
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
#ifndef SOCKS_BLOCK_H_
|
#ifndef MANGO_BLOCK_H_
|
||||||
#define SOCKS_BLOCK_H_
|
#define MANGO_BLOCK_H_
|
||||||
|
|
||||||
#include <socks/types.h>
|
#include <mango/types.h>
|
||||||
#include <socks/btree.h>
|
#include <mango/btree.h>
|
||||||
#include <socks/locks.h>
|
#include <mango/locks.h>
|
||||||
#include <socks/status.h>
|
#include <mango/status.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
enum block_device_flags {
|
enum block_device_flags {
|
||||||
@@ -20,8 +20,8 @@
|
|||||||
software without specific prior written permission.
|
software without specific prior written permission.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SOCKS_BTREE_H_
|
#ifndef MANGO_BTREE_H_
|
||||||
#define SOCKS_BTREE_H_
|
#define MANGO_BTREE_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SOCKS_CLOCK_H_
|
#ifndef MANGO_CLOCK_H_
|
||||||
#define SOCKS_CLOCK_H_
|
#define MANGO_CLOCK_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SOCKS_COMPILER_H_
|
#ifndef MANGO_COMPILER_H_
|
||||||
#define SOCKS_COMPILER_H_
|
#define MANGO_COMPILER_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SOCKS_CONSOLE_H_
|
#ifndef MANGO_CONSOLE_H_
|
||||||
#define SOCKS_CONSOLE_H_
|
#define MANGO_CONSOLE_H_
|
||||||
|
|
||||||
/* The console system
|
/* The console system
|
||||||
|
|
||||||
@@ -14,9 +14,9 @@
|
|||||||
representing a serial port may allow both sending AND receiving over the
|
representing a serial port may allow both sending AND receiving over the
|
||||||
port.
|
port.
|
||||||
*/
|
*/
|
||||||
#include <socks/queue.h>
|
#include <mango/queue.h>
|
||||||
#include <socks/locks.h>
|
#include <mango/locks.h>
|
||||||
#include <socks/status.h>
|
#include <mango/status.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
#ifndef SOCKS_CPU_H_
|
#ifndef MANGO_CPU_H_
|
||||||
#define SOCKS_CPU_H_
|
#define MANGO_CPU_H_
|
||||||
|
|
||||||
#include <socks/types.h>
|
#include <mango/types.h>
|
||||||
#include <socks/machine/cpu.h>
|
#include <mango/machine/cpu.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <socks/sched.h>
|
#include <mango/sched.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
#ifndef SOCKS_DEVICE_H_
|
#ifndef MANGO_DEVICE_H_
|
||||||
#define SOCKS_DEVICE_H_
|
#define MANGO_DEVICE_H_
|
||||||
|
|
||||||
#include <socks/queue.h>
|
#include <mango/queue.h>
|
||||||
#include <socks/btree.h>
|
#include <mango/btree.h>
|
||||||
#include <socks/status.h>
|
#include <mango/status.h>
|
||||||
#include <socks/bitmap.h>
|
#include <mango/bitmap.h>
|
||||||
#include <socks/object.h>
|
#include <mango/object.h>
|
||||||
#include <socks/block.h>
|
#include <mango/block.h>
|
||||||
#include <socks/fb.h>
|
#include <mango/fb.h>
|
||||||
#include <socks/ringbuffer.h>
|
#include <mango/ringbuffer.h>
|
||||||
|
|
||||||
struct device;
|
struct device;
|
||||||
struct input_event;
|
struct input_event;
|
||||||
@@ -50,14 +50,14 @@ struct iovec {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct device_type_ops {
|
struct device_type_ops {
|
||||||
kern_status_t(*read)(struct device *, 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 *, socks_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 *);
|
kern_status_t(*register_device)(struct device *);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct block_device_ops {
|
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(*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, socks_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 *);
|
kern_status_t(*ioctl)(struct device *, unsigned int, void *);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -69,8 +69,8 @@ struct net_device_ops {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct char_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(*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 *, socks_flags_t);
|
kern_status_t(*write)(struct device *, const void *, size_t, size_t, size_t *, mango_flags_t);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct input_device_ops {
|
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);
|
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_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, 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, mango_flags_t flags);
|
||||||
|
|
||||||
extern struct device *cast_to_device(struct object *obj);
|
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_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,
|
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_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);
|
extern kern_status_t input_device_remove_hook(struct device *dev, struct input_event_hook *hook);
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SOCKS_FB_H_
|
#ifndef MANGO_FB_H_
|
||||||
#define SOCKS_FB_H_
|
#define MANGO_FB_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
#ifndef SOCKS_FLAGS_H_
|
#ifndef MANGO_FLAGS_H_
|
||||||
#define SOCKS_FLAGS_H_
|
#define MANGO_FLAGS_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
S_NORMAL = 0x00u,
|
S_NORMAL = 0x00u,
|
||||||
S_NOBLOCK = 0x01u,
|
S_NOBLOCK = 0x01u,
|
||||||
} socks_flags_t;
|
} mango_flags_t;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
#ifndef SOCKS_INIT_H_
|
#ifndef MANGO_INIT_H_
|
||||||
#define SOCKS_INIT_H_
|
#define MANGO_INIT_H_
|
||||||
|
|
||||||
#include <socks/compiler.h>
|
#include <mango/compiler.h>
|
||||||
#include <socks/machine/init.h>
|
#include <mango/machine/init.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
#ifndef SOCKS_INPUT_H_
|
#ifndef MANGO_INPUT_H_
|
||||||
#define SOCKS_INPUT_H_
|
#define MANGO_INPUT_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <socks/queue.h>
|
#include <mango/queue.h>
|
||||||
#include <socks/status.h>
|
#include <mango/status.h>
|
||||||
|
|
||||||
enum input_event_hook_flags {
|
enum input_event_hook_flags {
|
||||||
INPUT_HOOK_SQUASH_EVENT = 0x01u,
|
INPUT_HOOK_SQUASH_EVENT = 0x01u,
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
#ifndef SOCKS_KEXT_H_
|
#ifndef MANGO_KEXT_H_
|
||||||
#define SOCKS_KEXT_H_
|
#define MANGO_KEXT_H_
|
||||||
|
|
||||||
#include <socks/status.h>
|
#include <mango/status.h>
|
||||||
#include <socks/object.h>
|
#include <mango/object.h>
|
||||||
#include <socks/compiler.h>
|
#include <mango/compiler.h>
|
||||||
#include <socks/btree.h>
|
#include <mango/btree.h>
|
||||||
|
|
||||||
#define KERNEL_KEXT_ID "net.doorstuck.socks-kernel"
|
#define KERNEL_KEXT_ID "net.doorstuck.mango-kernel"
|
||||||
#define KEXT_IDENT_MAX 80
|
#define KEXT_IDENT_MAX 80
|
||||||
#define KEXT_NO_DEPENDENCIES NULL
|
#define KEXT_NO_DEPENDENCIES NULL
|
||||||
|
|
||||||
#define __KEXT_INFO_VARNAME_2(a, b) a ## b
|
#define __KEXT_INFO_VARNAME_2(a, b) a ## b
|
||||||
#define __KEXT_INFO_VARNAME_1(a, b) __KEXT_INFO_VARNAME_2(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_LINKAGE static
|
||||||
#define __KEXT_INFO_VARNAME() __KEXT_INFO_VARNAME_1(__kext_info, __LINE__)
|
#define __KEXT_INFO_VARNAME() __KEXT_INFO_VARNAME_1(__kext_info, __LINE__)
|
||||||
#define __KEXT_INFO_DEPNAME() __KEXT_INFO_VARNAME_1(__kext_deps, __LINE__)
|
#define __KEXT_INFO_DEPNAME() __KEXT_INFO_VARNAME_1(__kext_deps, __LINE__)
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
#ifndef SOCKS_LOCKS_H_
|
#ifndef MANGO_LOCKS_H_
|
||||||
#define SOCKS_LOCKS_H_
|
#define MANGO_LOCKS_H_
|
||||||
|
|
||||||
#include <socks/compiler.h>
|
#include <mango/compiler.h>
|
||||||
#include <socks/machine/hwlock.h>
|
#include <mango/machine/hwlock.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -19,12 +19,12 @@
|
|||||||
contributors may be used to endorse or promote products derived from this
|
contributors may be used to endorse or promote products derived from this
|
||||||
software without specific prior written permission.
|
software without specific prior written permission.
|
||||||
*/
|
*/
|
||||||
#ifndef SOCKS_MEMBLOCK_H_
|
#ifndef MANGO_MEMBLOCK_H_
|
||||||
#define SOCKS_MEMBLOCK_H_
|
#define MANGO_MEMBLOCK_H_
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <socks/types.h>
|
#include <mango/types.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
#ifndef SOCKS_OBJECT_H_
|
#ifndef MANGO_OBJECT_H_
|
||||||
#define SOCKS_OBJECT_H_
|
#define MANGO_OBJECT_H_
|
||||||
|
|
||||||
#include <socks/locks.h>
|
#include <mango/locks.h>
|
||||||
#include <socks/status.h>
|
#include <mango/status.h>
|
||||||
#include <socks/flags.h>
|
#include <mango/flags.h>
|
||||||
#include <socks/vm.h>
|
#include <mango/vm.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -32,8 +32,8 @@ enum object_type_flags {
|
|||||||
struct object_ops {
|
struct object_ops {
|
||||||
kern_status_t(*open)(struct object *obj);
|
kern_status_t(*open)(struct object *obj);
|
||||||
kern_status_t(*close)(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(*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, socks_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(*destroy)(struct object *obj);
|
||||||
kern_status_t(*query_name)(struct object *obj, char out[OBJECT_NAME_MAX]);
|
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);
|
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);
|
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_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, 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, 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_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_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]);
|
extern kern_status_t object_query_name(struct object *obj, char name[OBJECT_NAME_MAX]);
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef SOCKS_PANIC_H_
|
#ifndef MANGO_PANIC_H_
|
||||||
#define SOCKS_PANIC_H_
|
#define MANGO_PANIC_H_
|
||||||
|
|
||||||
#include <socks/compiler.h>
|
#include <mango/compiler.h>
|
||||||
|
|
||||||
struct cpu_context;
|
struct cpu_context;
|
||||||
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
#ifndef SOCKS_PERCPU_H_
|
#ifndef MANGO_PERCPU_H_
|
||||||
#define SOCKS_PERCPU_H_
|
#define MANGO_PERCPU_H_
|
||||||
|
|
||||||
#include <socks/status.h>
|
#include <mango/status.h>
|
||||||
#include <socks/compiler.h>
|
#include <mango/compiler.h>
|
||||||
#include <socks/sched.h>
|
#include <mango/sched.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
#ifndef SOCKS_PMAP_H_
|
#ifndef MANGO_PMAP_H_
|
||||||
#define SOCKS_PMAP_H_
|
#define MANGO_PMAP_H_
|
||||||
|
|
||||||
/* all the functions declared in this file are defined in arch/xyz/pmap.c */
|
/* all the functions declared in this file are defined in arch/xyz/pmap.c */
|
||||||
|
|
||||||
#include <socks/vm.h>
|
#include <mango/vm.h>
|
||||||
#include <socks/status.h>
|
#include <mango/status.h>
|
||||||
#include <socks/machine/pmap.h>
|
#include <mango/machine/pmap.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#define PFN(x) ((x) >> VM_PAGE_SHIFT)
|
#define PFN(x) ((x) >> VM_PAGE_SHIFT)
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef SOCKS_PRINTK_H_
|
#ifndef MANGO_PRINTK_H_
|
||||||
#define SOCKS_PRINTK_H_
|
#define MANGO_PRINTK_H_
|
||||||
|
|
||||||
#include <socks/console.h>
|
#include <mango/console.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef SOCKS_QUEUE_H_
|
#ifndef MANGO_QUEUE_H_
|
||||||
#define SOCKS_QUEUE_H_
|
#define MANGO_QUEUE_H_
|
||||||
|
|
||||||
#include <socks/libc/string.h>
|
#include <mango/libc/string.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
#ifndef SOCKS_RINGBUFFER_H_
|
#ifndef MANGO_RINGBUFFER_H_
|
||||||
#define SOCKS_RINGBUFFER_H_
|
#define MANGO_RINGBUFFER_H_
|
||||||
|
|
||||||
#include <socks/locks.h>
|
#include <mango/locks.h>
|
||||||
#include <socks/sched.h>
|
#include <mango/sched.h>
|
||||||
|
|
||||||
struct ringbuffer {
|
struct ringbuffer {
|
||||||
unsigned char *r_buffer;
|
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_unread(struct ringbuffer *buf);
|
||||||
extern size_t ringbuffer_avail(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_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, socks_flags_t flags);
|
extern size_t ringbuffer_write(struct ringbuffer *buf, size_t size, const void *buffer, mango_flags_t flags);
|
||||||
|
|
||||||
/* TODO */
|
/* TODO */
|
||||||
//extern size_t ringbuffer_peek(struct ringbuffer *buf, size_t at, size_t size, void *buffer);
|
//extern size_t ringbuffer_peek(struct ringbuffer *buf, size_t at, size_t size, void *buffer);
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
#ifndef SOCKS_SCHED_H_
|
#ifndef MANGO_SCHED_H_
|
||||||
#define SOCKS_SCHED_H_
|
#define MANGO_SCHED_H_
|
||||||
|
|
||||||
#include <socks/btree.h>
|
#include <mango/btree.h>
|
||||||
#include <socks/locks.h>
|
#include <mango/locks.h>
|
||||||
#include <socks/object.h>
|
#include <mango/object.h>
|
||||||
#include <socks/pmap.h>
|
#include <mango/pmap.h>
|
||||||
#include <socks/queue.h>
|
#include <mango/queue.h>
|
||||||
#include <socks/status.h>
|
#include <mango/status.h>
|
||||||
|
|
||||||
#define TASK_NAME_MAX 64
|
#define TASK_NAME_MAX 64
|
||||||
#define PRIO_MAX 32
|
#define PRIO_MAX 32
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SOCKS_STATUS_H_
|
#ifndef MANGO_STATUS_H_
|
||||||
#define SOCKS_STATUS_H_
|
#define MANGO_STATUS_H_
|
||||||
|
|
||||||
typedef unsigned int kern_status_t;
|
typedef unsigned int kern_status_t;
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SOCKS_TERMIOS_H_
|
#ifndef MANGO_TERMIOS_H_
|
||||||
#define SOCKS_TERMIOS_H_
|
#define MANGO_TERMIOS_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SOCKS_TEST_H_
|
#ifndef MANGO_TEST_H_
|
||||||
#define SOCKS_TEST_H_
|
#define MANGO_TEST_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
#ifndef SOCKS_TTY_H_
|
#ifndef MANGO_TTY_H_
|
||||||
#define SOCKS_TTY_H_
|
#define MANGO_TTY_H_
|
||||||
|
|
||||||
#include <socks/status.h>
|
#include <mango/status.h>
|
||||||
#include <socks/device.h>
|
#include <mango/device.h>
|
||||||
#include <socks/queue.h>
|
#include <mango/queue.h>
|
||||||
#include <socks/object.h>
|
#include <mango/object.h>
|
||||||
#include <socks/termios.h>
|
#include <mango/termios.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#define TTY_DEVICE(dev) ((dev)->dev_type == DEV_TYPE_CHAR ? (dev)->chr.c_tty : NULL)
|
#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 {
|
struct tty_ldisc {
|
||||||
char name[OBJECT_NAME_MAX];
|
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 *);
|
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;
|
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_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, 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, mango_flags_t flags);
|
||||||
extern kern_status_t tty_report_event(struct device *tty, const struct input_event *ev);
|
extern kern_status_t tty_report_event(struct device *tty, const struct input_event *ev);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SOCKS_TYPES_H_
|
#ifndef MANGO_TYPES_H_
|
||||||
#define SOCKS_TYPES_H_
|
#define MANGO_TYPES_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SOCKS_UTIL_H_
|
#ifndef MANGO_UTIL_H_
|
||||||
#define SOCKS_UTIL_H_
|
#define MANGO_UTIL_H_
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
#ifndef SOCKS_VM_H_
|
#ifndef MANGO_VM_H_
|
||||||
#define SOCKS_VM_H_
|
#define MANGO_VM_H_
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <socks/types.h>
|
#include <mango/types.h>
|
||||||
#include <socks/status.h>
|
#include <mango/status.h>
|
||||||
#include <socks/queue.h>
|
#include <mango/queue.h>
|
||||||
#include <socks/btree.h>
|
#include <mango/btree.h>
|
||||||
#include <socks/bitmap.h>
|
#include <mango/bitmap.h>
|
||||||
#include <socks/locks.h>
|
#include <mango/locks.h>
|
||||||
#include <socks/machine/vm.h>
|
#include <mango/machine/vm.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include <socks/init.h>
|
#include <mango/init.h>
|
||||||
|
|
||||||
|
|
||||||
int do_initcalls(void)
|
int do_initcalls(void)
|
||||||
|
|||||||
32
init/main.c
32
init/main.c
@@ -1,18 +1,18 @@
|
|||||||
#include <socks/arg.h>
|
#include <mango/arg.h>
|
||||||
#include <socks/clock.h>
|
#include <mango/clock.h>
|
||||||
#include <socks/cpu.h>
|
#include <mango/cpu.h>
|
||||||
#include <socks/device.h>
|
#include <mango/device.h>
|
||||||
#include <socks/init.h>
|
#include <mango/init.h>
|
||||||
#include <socks/input.h>
|
#include <mango/input.h>
|
||||||
#include <socks/kext.h>
|
#include <mango/kext.h>
|
||||||
#include <socks/libc/stdio.h>
|
#include <mango/libc/stdio.h>
|
||||||
#include <socks/machine/init.h>
|
#include <mango/machine/init.h>
|
||||||
#include <socks/object.h>
|
#include <mango/object.h>
|
||||||
#include <socks/panic.h>
|
#include <mango/panic.h>
|
||||||
#include <socks/printk.h>
|
#include <mango/printk.h>
|
||||||
#include <socks/sched.h>
|
#include <mango/sched.h>
|
||||||
#include <socks/test.h>
|
#include <mango/test.h>
|
||||||
#include <socks/tty.h>
|
#include <mango/tty.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
extern unsigned long get_rflags(void);
|
extern unsigned long get_rflags(void);
|
||||||
@@ -21,7 +21,7 @@ extern char __pstart[], __pend[];
|
|||||||
|
|
||||||
void print_kernel_banner(void)
|
void print_kernel_banner(void)
|
||||||
{
|
{
|
||||||
printk("Socks kernel version " BUILD_ID);
|
printk("Mango kernel version " BUILD_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hang(void)
|
static void hang(void)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include <socks/arg.h>
|
#include <mango/arg.h>
|
||||||
#include <socks/libc/string.h>
|
#include <mango/libc/string.h>
|
||||||
#include <socks/libc/ctype.h>
|
#include <mango/libc/ctype.h>
|
||||||
|
|
||||||
static char g_cmdline[CMDLINE_MAX + 1] = {0};
|
static char g_cmdline[CMDLINE_MAX + 1] = {0};
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include <socks/clock.h>
|
#include <mango/clock.h>
|
||||||
#include <socks/printk.h>
|
#include <mango/printk.h>
|
||||||
#include <socks/compiler.h>
|
#include <mango/compiler.h>
|
||||||
|
|
||||||
static clock_ticks_t ticks_per_sec = 0;
|
static clock_ticks_t ticks_per_sec = 0;
|
||||||
volatile clock_ticks_t clock_ticks = 0;
|
volatile clock_ticks_t clock_ticks = 0;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include <socks/console.h>
|
#include <mango/console.h>
|
||||||
#include <socks/queue.h>
|
#include <mango/queue.h>
|
||||||
#include <socks/locks.h>
|
#include <mango/locks.h>
|
||||||
#include <socks/libc/string.h>
|
#include <mango/libc/string.h>
|
||||||
|
|
||||||
static struct queue consoles;
|
static struct queue consoles;
|
||||||
static spin_lock_t consoles_lock = SPIN_LOCK_INIT;
|
static spin_lock_t consoles_lock = SPIN_LOCK_INIT;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include <socks/cpu.h>
|
#include <mango/cpu.h>
|
||||||
#include <socks/percpu.h>
|
#include <mango/percpu.h>
|
||||||
#include <socks/bitmap.h>
|
#include <mango/bitmap.h>
|
||||||
|
|
||||||
DECLARE_BITMAP(cpu_available, CPU_MAX);
|
DECLARE_BITMAP(cpu_available, CPU_MAX);
|
||||||
DECLARE_BITMAP(cpu_online, CPU_MAX);
|
DECLARE_BITMAP(cpu_online, CPU_MAX);
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <socks/machine/panic.h>
|
#include <mango/machine/panic.h>
|
||||||
#include <socks/libc/stdio.h>
|
#include <mango/libc/stdio.h>
|
||||||
#include <socks/printk.h>
|
#include <mango/printk.h>
|
||||||
#include <socks/sched.h>
|
#include <mango/sched.h>
|
||||||
#include <socks/cpu.h>
|
#include <mango/cpu.h>
|
||||||
|
|
||||||
static int has_panicked = 0;
|
static int has_panicked = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include <socks/percpu.h>
|
#include <mango/percpu.h>
|
||||||
#include <socks/cpu.h>
|
#include <mango/cpu.h>
|
||||||
#include <socks/vm.h>
|
#include <mango/vm.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include <socks/printk.h>
|
#include <mango/printk.h>
|
||||||
#include <socks/locks.h>
|
#include <mango/locks.h>
|
||||||
#include <socks/console.h>
|
#include <mango/console.h>
|
||||||
#include <socks/libc/stdio.h>
|
#include <mango/libc/stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#define LOG_BUFFER_SIZE 0x40000
|
#define LOG_BUFFER_SIZE 0x40000
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include <socks/status.h>
|
#include <mango/status.h>
|
||||||
|
|
||||||
#define ERROR_STRING_CASE(code) \
|
#define ERROR_STRING_CASE(code) \
|
||||||
case code: \
|
case code: \
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SOCKS_LIBC_TYPES_H_
|
#ifndef MANGO_LIBC_TYPES_H_
|
||||||
#define SOCKS_LIBC_TYPES_H_
|
#define MANGO_LIBC_TYPES_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SOCKS_STDIO_H_
|
#ifndef MANGO_STDIO_H_
|
||||||
#define SOCKS_STDIO_H_
|
#define MANGO_STDIO_H_
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SOCKS_LIBC_STRING_H_
|
#ifndef MANGO_LIBC_STRING_H_
|
||||||
#define SOCKS_LIBC_STRING_H_
|
#define MANGO_LIBC_STRING_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
//
|
//
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <socks/console.h>
|
#include <mango/console.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <socks/libc/string.h>
|
#include <mango/libc/string.h>
|
||||||
|
|
||||||
static void *memcpy_r(void *dest, const void *src, size_t sz)
|
static void *memcpy_r(void *dest, const void *src, size_t sz)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include <socks/libc/string.h>
|
#include <mango/libc/string.h>
|
||||||
|
|
||||||
char *strcat(char *dest, const char *src) {
|
char *strcat(char *dest, const char *src) {
|
||||||
size_t start = strlen(dest), i = 0;
|
size_t start = strlen(dest), i = 0;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include <socks/libc/string.h>
|
#include <mango/libc/string.h>
|
||||||
|
|
||||||
char *strcpy(char *output, const char *input)
|
char *strcpy(char *output, const char *input)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include <socks/libc/string.h>
|
#include <mango/libc/string.h>
|
||||||
|
|
||||||
size_t strlen(const char *str) {
|
size_t strlen(const char *str) {
|
||||||
size_t res = 0;
|
size_t res = 0;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include <socks/libc/string.h>
|
#include <mango/libc/string.h>
|
||||||
|
|
||||||
char *strrchr(const char *str, int c) {
|
char *strrchr(const char *str, int c) {
|
||||||
size_t len = strlen(str);
|
size_t len = strlen(str);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <socks/libc/string.h>
|
#include <mango/libc/string.h>
|
||||||
|
|
||||||
#define ALIGN (sizeof(size_t))
|
#define ALIGN (sizeof(size_t))
|
||||||
#define ONES ((size_t)-1 / UCHAR_MAX)
|
#define ONES ((size_t)-1 / UCHAR_MAX)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include <socks/object.h>
|
#include <mango/object.h>
|
||||||
|
|
||||||
#define LINK_CAST(p) OBJECT_C_CAST(struct link, l_base, &link_type, p)
|
#define LINK_CAST(p) OBJECT_C_CAST(struct link, l_base, &link_type, p)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include <socks/object.h>
|
#include <mango/object.h>
|
||||||
|
|
||||||
#define NAMESPACE_CAST(p) OBJECT_C_CAST(struct object_namespace, ns_base, &ns_type, p)
|
#define NAMESPACE_CAST(p) OBJECT_C_CAST(struct object_namespace, ns_base, &ns_type, p)
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user