CeDOS - Commit 054a0e0e

Major Repo structure overhaul - move ./src/* to ./* - add folder ./common for shared code - move contents of ./include to ./kernel and ./common - merge all makefiles into one - merge different string.c implementations in ./common
Celina Sophie Kalus
Tue, 28 Nov 2023 23:38:32 +0100
101 files changed, 232 insertions(+), 352 deletions(-)

jump to
M include/assert.hcommon/assert.h

@@ -1,7 +1,7 @@

#ifndef ASSERT_H #define ASSERT_H -#include "cedos/core.h" +#include "core.h" #include <stdint.h>
M include/cedos/core.hkernel/core.h

@@ -6,8 +6,8 @@ #define KERNEL_H

#include <stdarg.h> -#include "cedos/drivers/console.h" -#include "cedos/interrupts.h" +#include "drivers/console.h" +#include "interrupts.h" int core_init(void); void printk(const char* string, ...);
M include/cedos/drivers/tty.hkernel/drivers/tty.h

@@ -1,9 +1,9 @@

#ifndef TTY_H #define TTY_H -#include "cedos/file.h" -#include "cedos/drivers/keyboard.h" -#include "cedos/drivers/console.h" +#include "file.h" +#include "drivers/keyboard.h" +#include "drivers/console.h" int tty_open(const char *pathname, int flags); int tty_openat(int fd, const char *fname, int flags);
M include/cedos/elf.hkernel/elf.h

@@ -1,8 +1,8 @@

#ifndef ELF_H #define ELF_H -#include "cedos/sched/sched.h" -#include "cedos/sched/process.h" +#include "sched/sched.h" +#include "sched/process.h" /*! * Executes an elf file from memory
M include/cedos/fat.hkernel/fat.h

@@ -3,7 +3,7 @@ #define FAT_H

#include <stdint.h> -#include "cedos/file.h" +#include "file.h" void FAT_init(); int FAT_dir_next(file_t *file, int index, char *fname_buffer);
M include/cedos/file.hkernel/file.h

@@ -3,7 +3,7 @@ #define FILE_H

#include <stdint.h> -#include "cedos/mm/paging.h" +#include "mm/paging.h" typedef uint32_t fpos_t; typedef int32_t off_t;
M include/cedos/pipe.hkernel/pipe.h

@@ -1,7 +1,7 @@

#ifndef PIPE_H #define PIPE_H -#include "cedos/file.h" +#include "file.h" int pipe_read(int fd, char *buffer, uint32_t size); int pipe_write(int fd, char *buffer, uint32_t size);
M include/cedos/sched/process.hkernel/sched/process.h

@@ -4,8 +4,8 @@ */

#ifndef PROCESS_H #define PROCESS_H -#include "cedos/mm/paging.h" -#include "cedos/sched/stack_check.h" +#include "mm/paging.h" +#include "sched/stack_check.h" /*! * Defines all possible states for processes.
M include/cedos/sched/sched.hkernel/sched/sched.h

@@ -6,12 +6,12 @@ #define SCHEDULER_H

#include <stdint.h> -#include "cedos/sched/process.h" +#include "sched/process.h" -#include "cedos/mm/paging.h" +#include "mm/paging.h" // 11928 ~ 10ms per interval -#define SCHED_INTERVAL (11928) +#define SCHED_INTERVAL (1193) /*! * Structure of the process stack when the scheduler is executed.
A kernel/drivers/console.c

@@ -0,0 +1,3 @@

+#include "drivers/console.h" + +CON_DRIVER *std_con = &vga_con;
A kernel/drivers/keyboard.c

@@ -0,0 +1,3 @@

+#include "drivers/keyboard.h" + +KB_DRIVER *std_kb = &ps2_kb;
M makefilemakefile

@@ -5,7 +5,7 @@ export CURRENT_DIR := $(shell pwd)

export ROOT_DIR := $(CURRENT_DIR) export SOURCE_DIR := $(CURRENT_DIR)/src export INCLUDE_DIR := $(CURRENT_DIR)/include -export LOG_DIR := $(CURRENT_DIR)/log +export BUILD_LOGS := $(CURRENT_DIR)/log # path to cross compiler export CROSS_COMP := $(HOME)/opt/cross/bin/i686-elf-

@@ -34,6 +34,9 @@ CCFLAGS := $(CCFLAGS) -nostdlib -nostartfiles -ffreestanding

CCFLAGS := $(CCFLAGS) -mgeneral-regs-only -mno-red-zone CCFLAGS := $(CCFLAGS) --prefix=$(CROSS_COMP) +GIT_VERSION := "$(shell git describe --abbrev=4 --dirty --always --tags)" +CCFLAGS := $(CCFLAGS) -DVERSION=\"$(GIT_VERSION)\" + # debug target .PHONY: debug

@@ -49,64 +52,137 @@ CCFLAGS := $(CCFLAGS) -O1

GLOBAL_BUILD := $(GLOBAL_BUILD)/release endif -LOCAL_BUILD := $(GLOBAL_BUILD)/components +BUILD_OBJECTS := $(GLOBAL_BUILD)/obj +BUILD_ARTIFACTS := $(GLOBAL_BUILD)/artifacts +BUILD_LOGS := $(GLOBAL_BUILD)/logs +BUILD_MOUNT := $(GLOBAL_BUILD)/mnt export CCFLAGS export GLOBAL_BUILD -MODULES := boot kernel libcedos shell -OBJECTS := $(patsubst %,$(LOCAL_BUILD)/%.o,$(MODULES)) $(LOCAL_BUILD)/apps_raw.o -DIRS := $(LOCAL_BUILD) $(LOG_DIR) +SRC_ALL := $(shell find common/ boot/ kernel/ libcedos/ shell/ -name '*.c') +ASM_ALL := $(shell find common/ boot/ kernel/ libcedos/ shell/ -name '*.s') + +OBJECTS := $(patsubst %,$(BUILD_OBJECTS)/%.o,$(SRC_ALL) $(ASM_ALL)) + + +DIRS := $(dir $(OBJECTS)) $(BUILD_ARTIFACTS) $(BUILD_LOGS) +DIRS := $(sort $(DIRS)) -$(MODULES): | $(DIRS) $(DIRS): > $(MKDIR) $@ .PHONY: build -build: $(GLOBAL_BUILD)/cedos.img +build: $(BUILD_ARTIFACTS)/cedos.img +$(OBJECTS): $(DIRS) + +$(BUILD_OBJECTS)/%.s.o: %.s +> $(AS) -o $@ $< + +# common +OBJ_COMMON := $(filter $(BUILD_OBJECTS)/common/%,$(OBJECTS)) +$(BUILD_OBJECTS)/common/%.c.o: common/%.c +> $(CC) -c -Icommon $(CCFLAGS) -o $@ $< + + +# boot +OBJ_BOOT := $(filter $(BUILD_OBJECTS)/boot/%,$(OBJECTS)) +OUT_BOOT := $(BUILD_ARTIFACTS)/boot.elf $(BUILD_ARTIFACTS)/boot.bin + +$(BUILD_OBJECTS)/boot/%.c.o: boot/%.c +> $(CC) -c -Iboot -Icommon $(CCFLAGS) -o $@ $< + +$(BUILD_ARTIFACTS)/boot.elf: $(OBJ_BOOT) $(OBJ_COMMON) +> $(LD) $^ -T boot/link.txt -Map=$(BUILD_LOGS)/boot_mapfile.txt --oformat elf32-i386 -o $@ + +$(BUILD_ARTIFACTS)/boot.bin: $(OBJ_BOOT) $(OBJ_COMMON) +> $(LD) $^ -T boot/link.txt -Map=$(BUILD_LOGS)/boot_mapfile.txt --oformat binary -o $@ + +.PHONY: boot +boot: $(OUT_BOOT) + + +# kernel +OBJ_KERNEL := $(filter $(BUILD_OBJECTS)/kernel/%,$(OBJECTS)) +OUT_KERNEL := $(BUILD_ARTIFACTS)/kernel.elf $(BUILD_ARTIFACTS)/kernel.bin -$(GLOBAL_BUILD)/fat.img: $(MODULES) -# > $(LD) $(OBJECTS) -r -T link.txt -Map=$(LOG_DIR)/elf_mapfile.txt --oformat elf32-i386 -o $@ +$(BUILD_OBJECTS)/kernel/%.c.o: kernel/%.c +> $(CC) -c -Ikernel -Icommon $(CCFLAGS) -o $@ $< + +$(BUILD_ARTIFACTS)/kernel.elf: $(OBJ_KERNEL) $(OBJ_COMMON) +> $(LD) $^ -T kernel/link.txt -Map=$(BUILD_LOGS)/kernel_mapfile.txt --oformat elf32-i386 -o $@ + +$(BUILD_ARTIFACTS)/kernel.bin: $(OBJ_KERNEL) $(OBJ_COMMON) +> $(LD) $^ -T kernel/link.txt -Map=$(BUILD_LOGS)/kernel_mapfile.txt --oformat binary -o $@ + +.PHONY: kernel +kernel: $(OUT_KERNEL) + + +# libcedos +OBJ_LIBCEDOS := $(filter $(BUILD_OBJECTS)/libcedos/%,$(OBJECTS)) +OUT_LIBCEDOS := $(BUILD_ARTIFACTS)/libcedos.a + +$(BUILD_OBJECTS)/libcedos/%.c.o: libcedos/%.c +> $(CC) -c -Ilibcedos -Icommon $(CCFLAGS) -o $@ $< + +$(BUILD_ARTIFACTS)/libcedos.a: $(OBJ_LIBCEDOS) $(OBJ_COMMON) +> $(AR) rcs $@ $^ + +.PHONY: libcedos +libcedos: $(OUT_LIBCEDOS) + + +# shell +OBJ_SHELL := $(filter $(BUILD_OBJECTS)/shell/%,$(OBJECTS)) +OUT_SHELL := $(patsubst $(BUILD_OBJECTS)/shell/%.c.o,$(BUILD_ARTIFACTS)/%,$(OBJ_SHELL)) + +SHELL_CCFLAGS += -I../libcedos/include +SHELL_LDFLAGS += -L$(BUILD_ARTIFACTS) +SHELL_LDFLAGS += -lcedos + +SHELL_LDFLAGS += -T shell/link.txt +SHELL_LDFLAGS += -Map=$(BUILD_LOGS)/$(notdir $@)_mapfile.txt +SHELL_LDFLAGS += -N + +$(BUILD_OBJECTS)/shell/%.c.o: shell/%.c +> $(CC) -c -Ishell -Ilibcedos -Icommon $(CCFLAGS) $(SHELL_CCFLAGS) -o $@ $< + +$(BUILD_ARTIFACTS)/%: $(BUILD_OBJECTS)/shell/%.c.o | $(BUILD_ARTIFACTS)/libcedos.a +> $(LD) $^ $(LDFLAGS) $(SHELL_LDFLAGS) -o $@ + +.PHONY: shell +shell: $(OUT_SHELL) + + +# disk image +$(BUILD_ARTIFACTS)/fat.img: $(filter %.bin,$(OUT_KERNEL)) $(OUT_SHELL) | $(BUILD_ARTIFACTS)/boot.bin +# > $(LD) $(OBJECTS) -r -T link.txt -Map=$(BUILD_LOGS)/elf_mapfile.txt --oformat elf32-i386 -o $@ > dd if=/dev/zero of=$@ count=896 > mkfs.fat -n "cedos" -S 512 -s 8 -r 32 $@ -> mkdir -p ./mnt -> sudo mount $@ ./mnt -> sudo cp $(LOCAL_BUILD)/kernel.bin ./mnt -> sudo cp $(LOCAL_BUILD)/bin/* ./mnt -> sudo cp ./img-contents/* ./mnt || echo "No img-contents folder; Skipping." -> du -csh ./mnt/* -> sudo umount ./mnt +> mkdir -p $(BUILD_MOUNT) +> sudo mount $@ $(BUILD_MOUNT) +> sudo cp $^ $(BUILD_MOUNT) +> sudo cp ./img-contents/* $(BUILD_MOUNT) || echo "No img-contents folder; Skipping." +> du -csh $(BUILD_MOUNT)/* +> sudo umount $(BUILD_MOUNT) +> rm -r $(BUILD_MOUNT) -$(GLOBAL_BUILD)/cedos.img: $(GLOBAL_BUILD)/fat.img | $(MODULES) +$(BUILD_ARTIFACTS)/cedos.img: $(BUILD_ARTIFACTS)/fat.img | $(MODULES) > dd if=/dev/zero of=$@ count=904 > parted $@ mklabel msdos > parted $@ mkpart primary FAT32 8s 896s -s > parted $@ set 1 boot on > dd if=$< of=$@ seek=8 conv=notrunc -> dd bs=1 if=$(LOCAL_BUILD)/boot.bin of=$@ count=446 conv=notrunc -> dd if=$(LOCAL_BUILD)/boot.bin of=$@ skip=1 seek=1 count=7 conv=notrunc -> python3 binimg.py -w 256 -i $(GLOBAL_BUILD)/cedos.img -o $(GLOBAL_BUILD)/cedos.png +> dd bs=1 if=$(BUILD_ARTIFACTS)/boot.bin of=$@ count=446 conv=notrunc +> dd if=$(BUILD_ARTIFACTS)/boot.bin of=$@ skip=1 seek=1 count=7 conv=notrunc +> python3 binimg.py -w 256 -i $(BUILD_ARTIFACTS)/cedos.img -o $(BUILD_ARTIFACTS)/cedos.png > parted $@ print list all -# > $(LD) $(OBJECTS) -T link.txt -Map=$(LOG_DIR)/bin_mapfile.txt --oformat binary --nostdlib -o $@ - -.PHONY: logs -logs: $(LOG_DIR)/base.sym $(LOG_DIR)/objdump.txt +# > $(LD) $(OBJECTS) -T link.txt -Map=$(BUILD_LOGS)/bin_mapfile.txt --oformat binary --nostdlib -o $@ -.PHONY: boot -boot: -> $(MAKE) GLOBAL_BUILD=$(LOCAL_BUILD) -C src/boot $(LOCAL_BUILD)/boot.bin -.PHONY: kernel -kernel: -> $(MAKE) GLOBAL_BUILD=$(LOCAL_BUILD) -C src/kernel $(LOCAL_BUILD)/kernel.bin - -.PHONY: libcedos -libcedos: -> $(MAKE) GLOBAL_BUILD=$(LOCAL_BUILD) -C src/libcedos build - -.PHONY: shell -shell: -> $(MAKE) GLOBAL_BUILD=$(LOCAL_BUILD) -C src/shell build +.PHONY: logs +logs: $(BUILD_LOGS)/base.sym $(BUILD_LOGS)/objdump.txt .PHONY: clean clean:

@@ -114,7 +190,7 @@ > $(RM) -r $(CURRENT_DIR)/build/* 2> /dev/null; true

.PHONY: run run: -> ./run.sh $(GLOBAL_BUILD)/cedos.img +> ./run.sh $(BUILD_ARTIFACTS)/cedos.img .PHONY: docs docs:
D src/boot/makefile

@@ -1,30 +0,0 @@

-.RECIPEPREFIX = > - -LOCAL_BUILD := $(GLOBAL_BUILD)/boot - -SRC_DIR := $(shell pwd) - -C_SOURCES := $(wildcard *.c) -S_SOURCES := $(wildcard *.s) - -C_OBJECTS := $(patsubst %.c,$(LOCAL_BUILD)/%.c.o,$(C_SOURCES)) -S_OBJECTS := $(patsubst %.s,$(LOCAL_BUILD)/%.s.o,$(S_SOURCES)) -OBJECTS = $(S_OBJECTS) $(C_OBJECTS) - -DIRS := $(sort $(dir $(OBJECTS))) - -$(OBJECTS): | $(DIRS) -$(DIRS): -> $(MKDIR) $(DIRS) - -.PHONY: build -build: $(GLOBAL_BUILD)/boot.bin -$(GLOBAL_BUILD)/boot.bin: $(OBJECTS) -> $(LD) $^ -T link.txt -Map=$(LOG_DIR)/boot_mapfile.txt -o $@ -> $(LD) $^ -T link.txt -Map=$(LOG_DIR)/boot_mapfile.txt --oformat elf32-i386 -o boot.o - -$(LOCAL_BUILD)/%.s.o: %.s -> $(AS) -o $@ $< - -$(LOCAL_BUILD)/%.c.o: %.c $(wildcard *.h) -> $(CC) -c $(CCFLAGS) -o $@ $<
D src/boot/string.c

@@ -1,37 +0,0 @@

-#include "string.h" - -#include <stdint.h> - -void *memset(void *ptr, uint8_t value, uint32_t num) { - for (uint32_t i = 0; i < num; i++) { - ((uint8_t*)ptr)[i] = value; - } - return ptr; -} - -int strcmp(const char *str1, const char *str2) { - int i = 0; - - while (1) { - if (str1[i] != str2[i]) { - return str1[i] - str2[i]; - } - - if (str1[i] == 0) { - return 0; - } - - i++; - } -} - -void *memcpy(void *_dest, const void *_src, uint32_t n) { - uint8_t *src = (uint8_t*)(_src); - uint8_t *dest = (uint8_t*)(_dest); - - for (uint32_t i = 0; i < n; i++) { - dest[i] = src[i]; - } - - return _dest; -}
M src/kernel/core.ckernel/core.c

@@ -1,5 +1,5 @@

-#include "cedos/core.h" -#include "cedos/drivers/console.h" +#include "core.h" +#include "drivers/console.h" #include "assembly.h" CON_DRIVER *core_con;
M src/kernel/drivers/bios_speaker.ckernel/drivers/bios_speaker.c

@@ -1,5 +1,5 @@

-#include "cedos/drivers/speaker.h" -#include "cedos/pit.h" +#include "drivers/speaker.h" +#include "pit.h" #include "assembly.h" #include <stdint.h>
D src/kernel/drivers/console.c

@@ -1,3 +0,0 @@

-#include "cedos/drivers/console.h" - -CON_DRIVER *std_con = &vga_con;
M src/kernel/drivers/graphics.ckernel/drivers/graphics.c

@@ -1,5 +1,5 @@

-#include "cedos/drivers/graphics.h" -#include "cedos/mm/paging.h" +#include "drivers/graphics.h" +#include "mm/paging.h" #include "string.h" #include "linker.h"
D src/kernel/drivers/keyboard.c

@@ -1,3 +0,0 @@

-#include "cedos/drivers/keyboard.h" - -KB_DRIVER *std_kb = &ps2_kb;
M src/kernel/drivers/ps2_keyboard.ckernel/drivers/ps2_keyboard.c

@@ -1,9 +1,9 @@

-#include "cedos/drivers/keyboard.h" -#include "cedos/interrupts.h" -#include "cedos/pic.h" -#include "cedos/core.h" -#include "cedos/sched/sched.h" -#include "cedos/mm/memory.h" +#include "drivers/keyboard.h" +#include "interrupts.h" +#include "pic.h" +#include "core.h" +#include "sched/sched.h" +#include "mm/memory.h" #include "assembly.h" #define PS2_DATA 0x60
M src/kernel/drivers/tty.ckernel/drivers/tty.c

@@ -1,8 +1,8 @@

-#include "cedos/file.h" -#include "cedos/drivers/tty.h" +#include "file.h" +#include "drivers/tty.h" -#include "cedos/drivers/console.h" -#include "cedos/drivers/keyboard.h" +#include "drivers/console.h" +#include "drivers/keyboard.h" file_operations_t tty_fops = { tty_open, /* open */
M src/kernel/drivers/vga_console.ckernel/drivers/vga_console.c

@@ -1,4 +1,4 @@

-#include "cedos/drivers/console.h" +#include "drivers/console.h" #include "linker.h" #include "assembly.h" #include "string.h"
M src/kernel/elf.ckernel/elf.c

@@ -1,11 +1,11 @@

#include <stdint.h> -#include "cedos/elf.h" -#include "cedos/core.h" +#include "elf.h" +#include "core.h" -#include "cedos/file.h" -#include "cedos/sched/process.h" +#include "file.h" +#include "sched/process.h" -#include "cedos/mm/memory.h" +#include "mm/memory.h" #include "assert.h"
M src/kernel/entry.skernel/entry.s

@@ -1,6 +1,6 @@

.section .text -.global __KERNEL_START -__KERNEL_START: +.global start +start: # move stack to kernel space mov $__KERNEL_STACK_ADDR, %eax mov %eax, %esp
M src/kernel/fat.ckernel/fat.c

@@ -1,9 +1,9 @@

-#include "cedos/file.h" -#include "cedos/fat.h" +#include "file.h" +#include "fat.h" #include "string.h" #include "assert.h" -#include "cedos/mm/memory.h" +#include "mm/memory.h" #include <stdint.h>
M src/kernel/file.ckernel/file.c

@@ -1,14 +1,14 @@

-#include "cedos/file.h" -#include "cedos/fat.h" -#include "cedos/pipe.h" +#include "file.h" +#include "fat.h" +#include "pipe.h" -#include "cedos/drivers/tty.h" -#include "cedos/core.h" +#include "drivers/tty.h" +#include "core.h" -#include "cedos/mm/memory.h" +#include "mm/memory.h" -#include "cedos/sched/sched.h" -#include "cedos/sched/process.h" +#include "sched/sched.h" +#include "sched/process.h" #ifdef DEBUG #define PRINT_DBG(...) printk("[" __FILE__ "] " __VA_ARGS__)
M src/kernel/interrupts.ckernel/interrupts.c

@@ -1,11 +1,11 @@

-#include "cedos/drivers/console.h" +#include "drivers/console.h" -#include "cedos/sched/sched.h" +#include "sched/sched.h" -#include "cedos/interrupts.h" -#include "cedos/pic.h" -#include "cedos/core.h" -#include "cedos/pit.h" +#include "interrupts.h" +#include "pic.h" +#include "core.h" +#include "pit.h" #define array_sizeof(array) (sizeof(array)/sizeof(array[0])) #define NULL ((void*)0)
M src/kernel/link.txtkernel/link.txt

@@ -13,6 +13,7 @@ SECTIONS

{ KERNEL : AT(0x0000) { + */entry.s.o(.text) */*(.text) */*(.data) */*(.rodata*)
M src/kernel/main.ckernel/main.c

@@ -1,24 +1,24 @@

-#include "cedos/drivers/console.h" -#include "cedos/drivers/keyboard.h" -#include "cedos/drivers/graphics.h" +#include "drivers/console.h" +#include "drivers/keyboard.h" +#include "drivers/graphics.h" -#include "cedos/sched/sched.h" -#include "cedos/sched/process.h" +#include "sched/sched.h" +#include "sched/process.h" -#include "cedos/mm/paging.h" -#include "cedos/mm/memory.h" +#include "mm/paging.h" +#include "mm/memory.h" -#include "cedos/interrupts.h" -#include "cedos/syscall.h" -#include "cedos/pic.h" -#include "cedos/pit.h" -#include "cedos/core.h" +#include "interrupts.h" +#include "syscall.h" +#include "pic.h" +#include "pit.h" +#include "core.h" -#include "cedos/elf.h" +#include "elf.h" -#include "cedos/file.h" -#include "cedos/fat.h" +#include "file.h" +#include "fat.h" #include "linker.h" #include "assert.h"
D src/kernel/makefile

@@ -1,33 +0,0 @@

-.RECIPEPREFIX = > - -LOCAL_BUILD := $(GLOBAL_BUILD)/kernel - -SRC_DIR := $(shell pwd) - -C_SOURCES := $(wildcard *.c) $(wildcard **/*.c) -S_SOURCES := $(wildcard *.s) $(wildcard **/*.s) - -C_OBJECTS := $(patsubst %.c,$(LOCAL_BUILD)/%.c.o,$(C_SOURCES)) -S_OBJECTS := $(patsubst %.s,$(LOCAL_BUILD)/%.s.o,$(S_SOURCES)) -OBJECTS = $(S_OBJECTS) $(C_OBJECTS) - -DIRS := $(sort $(dir $(OBJECTS))) - -$(OBJECTS): | $(DIRS) -$(DIRS): -> $(MKDIR) $(DIRS) - -.PHONY: build -build: folder -$(GLOBAL_BUILD)/kernel.bin: $(OBJECTS) | folder -> $(LD) $^ -o $@ -T link.txt -Map=$(LOG_DIR)/kernel_mapfile.txt - -.PHONY: folder -folder: -> $(MKDIR) $(LOCAL_BUILD) - -$(LOCAL_BUILD)/%.s.o: %.s -> $(AS) -o $@ $< - -$(LOCAL_BUILD)/%.c.o: %.c $(wildcard *.h) -> $(CC) -c -I$(INCLUDE_DIR) $(CCFLAGS) -o $@ $<
M src/kernel/mm/memory.ckernel/mm/memory.c

@@ -1,4 +1,4 @@

-#include "cedos/mm/memory.h" +#include "mm/memory.h" #include "assert.h"
M src/kernel/mm/page_allocator.ckernel/mm/page_allocator.c

@@ -1,6 +1,6 @@

-#include "cedos/mm/page_allocator.h" -#include "cedos/mm/paging.h" -#include "cedos/core.h" +#include "mm/page_allocator.h" +#include "mm/paging.h" +#include "core.h" uint8_t* first_free = (uint8_t*)0x00500000;
M src/kernel/mm/paging.ckernel/mm/paging.c

@@ -1,9 +1,9 @@

-#include "cedos/mm/paging.h" -#include "cedos/mm/page_allocator.h" +#include "mm/paging.h" +#include "mm/page_allocator.h" #include "linker.h" #include "string.h" -#include "cedos/interrupts.h" -#include "cedos/core.h" +#include "interrupts.h" +#include "core.h" #define MAKE_PAGE_ENTRY(addr, flags) (uint32_t)(((uint32_t)(addr) & 0xFFFFF000) | (flags))
M src/kernel/pic.ckernel/pic.c

@@ -1,4 +1,4 @@

-#include "cedos/pic.h" +#include "pic.h" #include "assembly.h" /*!
M src/kernel/pipe.ckernel/pipe.c

@@ -1,6 +1,6 @@

-#include "cedos/file.h" -#include "cedos/pipe.h" -#include "cedos/sched/sched.h" +#include "file.h" +#include "pipe.h" +#include "sched/sched.h" file_operations_t pipe_fops = { NULL, /* open */
M src/kernel/pit.ckernel/pit.c

@@ -1,6 +1,6 @@

-#include "cedos/pit.h" +#include "pit.h" #include "assembly.h" -#include "cedos/pic.h" +#include "pic.h" #define PIT_ACCESS_MODE_LO_HI (0b11 << 4) #define PIT_COMMAND_PORT ((uint16_t)0x43)
M src/kernel/sched/process.ckernel/sched/process.c

@@ -1,4 +1,4 @@

-#include "cedos/sched/process.h" +#include "sched/process.h" #define NULL ((void*)0)
M src/kernel/sched/sched.ckernel/sched/sched.c

@@ -1,19 +1,19 @@

-#include "cedos/sched/sched.h" -#include "cedos/sched/process.h" -#include "cedos/sched/sched_strats.h" +#include "sched/sched.h" +#include "sched/process.h" +#include "sched/sched_strats.h" -#include "cedos/mm/paging.h" -#include "cedos/mm/memory.h" +#include "mm/paging.h" +#include "mm/memory.h" -#include "cedos/drivers/console.h" -#include "cedos/drivers/speaker.h" +#include "drivers/console.h" +#include "drivers/speaker.h" -#include "cedos/core.h" -#include "cedos/interrupts.h" -#include "cedos/pit.h" -#include "cedos/pic.h" -#include "cedos/elf.h" -#include "cedos/file.h" +#include "core.h" +#include "interrupts.h" +#include "pit.h" +#include "pic.h" +#include "elf.h" +#include "file.h" #include "assembly.h" #include "assert.h"
M src/kernel/sched/sched_strats.ckernel/sched/sched_strats.c

@@ -1,4 +1,4 @@

-#include "cedos/sched/process.h" +#include "sched/process.h" #define NULL ((void*)0)
M src/kernel/sched/stack_check.ckernel/sched/stack_check.c

@@ -1,4 +1,4 @@

-#include "cedos/sched/stack_check.h" +#include "sched/stack_check.h" void stack_compute_checksum(STACK_CHECKSUM* checksum, const void *esp, const void *ebp) { *checksum = 0;
M src/kernel/syscall.ckernel/syscall.c

@@ -1,10 +1,10 @@

-#include "cedos/interrupts.h" -#include "cedos/core.h" -#include "cedos/sched/sched.h" -#include "cedos/file.h" -#include "cedos/drivers/graphics.h" -#include "cedos/time.h" -#include "cedos/mm/page_allocator.h" +#include "interrupts.h" +#include "core.h" +#include "sched/sched.h" +#include "file.h" +#include "drivers/graphics.h" +#include "time.h" +#include "mm/page_allocator.h" void test(uint32_t ebx, uint32_t ecx, uint32_t edx) { printk("SYSCALL 0x01: EBX=%i ECX=%X EDX=%X\n", ebx, ecx, edx);
M src/kernel/time.ckernel/time.c

@@ -1,4 +1,4 @@

-#include "cedos/time.h" +#include "time.h" int ticks = 0;
D src/libcedos/include/string.h

@@ -1,12 +0,0 @@

-#ifndef STRING_H -#define STRING_H - -#include <stdint.h> - -typedef uint32_t size_t; - -void *memset(void *str, int c, size_t n); - -char * strcpy ( char * destination, const char * source ); - -#endif
D src/libcedos/makefile

@@ -1,31 +0,0 @@

-.RECIPEPREFIX = > - -LOCAL_BUILD = $(GLOBAL_BUILD)/libcedos - -SRC_DIR := $(shell pwd) - -C_SOURCES := $(wildcard *.c) -S_SOURCES := $(wildcard *.s) - -C_OBJECTS := $(patsubst %.c,$(LOCAL_BUILD)/%.c.o,$(C_SOURCES)) -S_OBJECTS := $(patsubst %.s,$(LOCAL_BUILD)/%.s.o,$(S_SOURCES)) -OBJECTS = $(S_OBJECTS) $(C_OBJECTS) - -LIBCEDOS := $(GLOBAL_BUILD)/lib/libcedos.a - -DIRS := $(sort $(dir $(OBJECTS) $(LIBCEDOS))) - -$(OBJECTS) $(LIBCEDOS): | $(DIRS) -$(DIRS): -> $(MKDIR) $(DIRS) - -.PHONY: build -build: $(LIBCEDOS) -$(LIBCEDOS): $(OBJECTS) -> $(AR) rcs $@ $^ - -$(LOCAL_BUILD)/%.s.o: %.s -> $(AS) -o $@ $< - -$(LOCAL_BUILD)/%.c.o: %.c $(wildcard *.h) -> $(CC) -c -fPIC -I$(INCLUDE_DIR) -I./include $(CCFLAGS) -o $@ $<
D src/libcedos/string.c

@@ -1,18 +0,0 @@

-#include "string.h" -#include <stdint.h> - -void *memset(void *str, int c, size_t n) { - uint8_t *dest = str; - for (int i = 0; i < n; i++) { - dest[i] = c; - } -} - -char * strcpy ( char * destination, const char * source ) { - int i = 0; - - while (source[i]) { - destination[i] = source[i]; - i++; - } -}
D src/shell/makefile

@@ -1,36 +0,0 @@

-.RECIPEPREFIX = > - -GIT_VERSION := "$(shell git describe --abbrev=4 --dirty --always --tags)" -CCFLAGS += -DVERSION=\"$(GIT_VERSION)\" - -LOCAL_BUILD = $(GLOBAL_BUILD)/shell/build - -SRC_DIR := $(shell pwd) - -CCFLAGS += -I../libcedos/include -LDFLAGS += -L$(GLOBAL_BUILD)/lib -LDFLAGS += -lcedos - -LDFLAGS += -T link.txt -LDFLAGS += -Map=$(LOG_DIR)/$(notdir $@)_mapfile.txt -LDFLAGS += -N - -APP_SOURCES := $(wildcard *.c) -APP_OBJECTS := $(patsubst %.c,$(GLOBAL_BUILD)/bin/%,$(APP_SOURCES)) $(patsubst %.c,$(LOCAL_BUILD)/%.c.o,$(APP_SOURCES)) - -DIRS := $(sort $(dir $(APP_OBJECTS))) - -$(APP_OBJECTS): | $(DIRS) -$(DIRS): -> $(MKDIR) $(DIRS) - -.PHONY: build -build: $(APP_OBJECTS) -$(GLOBAL_BUILD)/bin/%: $(LOCAL_BUILD)/%.c.o | $(LIBCEDOS) -> $(LD) $^ $(LDFLAGS) -o $@ - -$(LOCAL_BUILD)/%.c.o: %.s -> $(AS) -o $@ $< - -$(LOCAL_BUILD)/%.c.o: %.c $(wildcard *.h) -> $(CC) -c -fPIC -I$(INCLUDE_DIR) -I./common $(CCFLAGS) -o $@ $<