diff --git a/miscellaneous/PlainsOfSnows(JAPI).w3x b/miscellaneous/PlainsOfSnows(JAPI).w3x index 6b0352c..bd1c10a 100755 Binary files a/miscellaneous/PlainsOfSnows(JAPI).w3x and b/miscellaneous/PlainsOfSnows(JAPI).w3x differ diff --git a/x64/CMakeLists.txt b/x64/CMakeLists.txt index 9539046..22db75b 100644 --- a/x64/CMakeLists.txt +++ b/x64/CMakeLists.txt @@ -14,7 +14,7 @@ ENDMACRO() HEADER_DIRECTORIES(header_dirs) -include_directories(${header_dirs}) +include_directories(src/include) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") diff --git a/x64/src/common/abi.h b/x64/src/include/abi.h similarity index 100% rename from x64/src/common/abi.h rename to x64/src/include/abi.h diff --git a/x64/src/hal/amd64/arch.h b/x64/src/include/kernel/hal/arch.h similarity index 89% rename from x64/src/hal/amd64/arch.h rename to x64/src/include/kernel/hal/arch.h index dc1eff9..02771a8 100644 --- a/x64/src/hal/amd64/arch.h +++ b/x64/src/include/kernel/hal/arch.h @@ -1,8 +1,8 @@ #ifndef _HAL_ARCH_H_ #define _HAL_ARCH_H_ -#include "../../common/inc/abi.h" -#include "../../common/inc/type.h" +#include "abi.h" +#include "type.h" #define HAL_CORE_COUNT 1 @@ -49,10 +49,6 @@ extern void KABI hal_write_port_16(uint16_t port, uint16_t data); extern void KABI hal_write_port_32(uint16_t port, uint32_t data); -extern void KABI hal_write_mem_32(void* target, uint32_t data); - -extern void KABI hal_write_mem_64(void* target, uint64_t data); - extern void KABI hal_flush_gdt(hal_gdt_ptr_t *gdt_ptr, uint64_t code_slct, uint64_t data_slct); extern void KABI hal_flush_tlb(void); diff --git a/x64/src/sxkrnl/ke/arch/amd64/atomic.h b/x64/src/include/kernel/hal/atomic.h similarity index 87% rename from x64/src/sxkrnl/ke/arch/amd64/atomic.h rename to x64/src/include/kernel/hal/atomic.h index 7bc412d..a03702f 100644 --- a/x64/src/sxkrnl/ke/arch/amd64/atomic.h +++ b/x64/src/include/kernel/hal/atomic.h @@ -1,7 +1,7 @@ #ifndef _S_ATOMIC_H_ #define _S_ATOMIC_H_ -#include "../../abi.h" -#include "../../type.h" +#include "abi.h" +#include "type.h" extern int32_t KABI hal_interlocked_exchange_32(int32_t *target, int32_t val); diff --git a/x64/src/sxkrnl/ke/arch/amd64/boot.h b/x64/src/include/kernel/hal/boot.h similarity index 100% rename from x64/src/sxkrnl/ke/arch/amd64/boot.h rename to x64/src/include/kernel/hal/boot.h diff --git a/x64/src/sxkrnl/ke/arch/amd64/context.h b/x64/src/include/kernel/hal/context.h similarity index 97% rename from x64/src/sxkrnl/ke/arch/amd64/context.h rename to x64/src/include/kernel/hal/context.h index 17be08f..6b33b12 100644 --- a/x64/src/sxkrnl/ke/arch/amd64/context.h +++ b/x64/src/include/kernel/hal/context.h @@ -1,7 +1,7 @@ #ifndef _S_CONTEXT_H_ #define _S_CONTEXT_H_ -#include "../../abi.h" +#include "abi.h" #include "../../../mm/arch/amd64/mem.h" #include "intr.h" diff --git a/x64/src/sxkrnl/ke/arch/amd64/intr.h b/x64/src/include/kernel/hal/intr.h similarity index 89% rename from x64/src/sxkrnl/ke/arch/amd64/intr.h rename to x64/src/include/kernel/hal/intr.h index ea4edbd..a037561 100644 --- a/x64/src/sxkrnl/ke/arch/amd64/intr.h +++ b/x64/src/include/kernel/hal/intr.h @@ -54,7 +54,7 @@ extern void KABI hal_issue_interrupt(uint32_t core_id, uint32_t vector); // context is a parameter passed by the kernel. HAL must pass back. // intr_stack is a parameter passed by the HAL. Used by some HAL interrupt context functions. // -typedef void ( KABI * k_intr_handler_t)(void *context, void *intr_stack); +typedef void (KABI * k_intr_handler_t)(void *context, void *intr_stack); extern void KABI hal_register_intr_handler(uint32_t index, k_intr_handler_t handler, void *context); @@ -63,7 +63,7 @@ extern k_intr_handler_t KABI hal_deregister_intr_handler(uint32_t index); // // Exception handler registration // -typedef void ( KABI *k_exc_handler_t)(uint64_t exc_addr, uint64_t exc_stack, uint64_t error_code); +typedef void (KABI *k_exc_handler_t)(uint64_t exc_addr, uint64_t exc_stack, uint64_t error_code); extern void KABI ke_register_exc_handler(exc_type_t type, k_exc_handler_t handler); diff --git a/x64/src/hal/amd64/multiboot.h b/x64/src/include/kernel/hal/multiboot.h similarity index 100% rename from x64/src/hal/amd64/multiboot.h rename to x64/src/include/kernel/hal/multiboot.h diff --git a/x64/src/include/kernel/hal/print.h b/x64/src/include/kernel/hal/print.h new file mode 100644 index 0000000..5aa4baf --- /dev/null +++ b/x64/src/include/kernel/hal/print.h @@ -0,0 +1,11 @@ +#ifndef _S_PRINT_H_ +#define _S_PRINT_H_ + +#include "abi.h" +#include "type.h" + +void KABI hal_printf(const char* str, ...); +void KABI hal_clear_screen(); +void KABI hal_print_init(); + +#endif \ No newline at end of file diff --git a/x64/src/sxkrnl/ke/alloc.h b/x64/src/include/kernel/ke/alloc.h similarity index 64% rename from x64/src/sxkrnl/ke/alloc.h rename to x64/src/include/kernel/ke/alloc.h index ed3d0f1..f96ad17 100644 --- a/x64/src/sxkrnl/ke/alloc.h +++ b/x64/src/include/kernel/ke/alloc.h @@ -1,7 +1,7 @@ #ifndef _ALLOC_H_ #define _ALLOC_H_ -#include "../../../common/inc/abi.h" -#include "../../../common/inc/type.h" +#include "abi.h" +#include "type.h" void KABI ke_alloc_init(); diff --git a/x64/src/sxkrnl/ke/assert.h b/x64/src/include/kernel/ke/assert.h similarity index 73% rename from x64/src/sxkrnl/ke/assert.h rename to x64/src/include/kernel/ke/assert.h index ee2466e..dffec86 100644 --- a/x64/src/sxkrnl/ke/assert.h +++ b/x64/src/include/kernel/ke/assert.h @@ -1,8 +1,8 @@ #ifndef _ASSERT_H_ #define _ASSERT_H_ -#include "../../../common/inc/type.h" -#include "../../../common/inc/abi.h" +#include "type.h" +#include "abi.h" void KABI ke_assert_ex(const char* expr_str, const char* file, int32_t line, int32_t expr); diff --git a/x64/src/sxkrnl/ke/atomic.h b/x64/src/include/kernel/ke/atomic.h similarity index 100% rename from x64/src/sxkrnl/ke/atomic.h rename to x64/src/include/kernel/ke/atomic.h diff --git a/x64/src/sxkrnl/ke/bug_check.h b/x64/src/include/kernel/ke/bug_check.h similarity index 100% rename from x64/src/sxkrnl/ke/bug_check.h rename to x64/src/include/kernel/ke/bug_check.h diff --git a/x64/src/sxkrnl/ke/intr.h b/x64/src/include/kernel/ke/intr.h similarity index 100% rename from x64/src/sxkrnl/ke/intr.h rename to x64/src/include/kernel/ke/intr.h diff --git a/x64/src/sxkrnl/ke/rwwlock.h b/x64/src/include/kernel/ke/rwwlock.h similarity index 100% rename from x64/src/sxkrnl/ke/rwwlock.h rename to x64/src/include/kernel/ke/rwwlock.h diff --git a/x64/src/sxkrnl/ke/spin_lock.h b/x64/src/include/kernel/ke/spin_lock.h similarity index 100% rename from x64/src/sxkrnl/ke/spin_lock.h rename to x64/src/include/kernel/ke/spin_lock.h diff --git a/x64/src/sxkrnl/ke/status.h b/x64/src/include/kernel/ke/status.h similarity index 100% rename from x64/src/sxkrnl/ke/status.h rename to x64/src/include/kernel/ke/status.h diff --git a/x64/src/sxkrnl/mm/arch/amd64/mem.h b/x64/src/include/kernel/mm/mem.h similarity index 100% rename from x64/src/sxkrnl/mm/arch/amd64/mem.h rename to x64/src/include/kernel/mm/mem.h index 8c4a83b..185c222 100644 --- a/x64/src/sxkrnl/mm/arch/amd64/mem.h +++ b/x64/src/include/kernel/mm/mem.h @@ -4,9 +4,9 @@ #include "abi.h" #include "type.h" +typedef uintptr_t address_space_t; typedef uintptr_t physical_addr_t; typedef uintptr_t virtual_addr_t; -typedef uintptr_t address_space_t; #define KERNEL_PAGE_SIZE (0x1000ull) diff --git a/x64/src/sxkrnl/mm/pmm.h b/x64/src/include/kernel/mm/pmm.h similarity index 100% rename from x64/src/sxkrnl/mm/pmm.h rename to x64/src/include/kernel/mm/pmm.h diff --git a/x64/src/sxkrnl/mm/vmm.h b/x64/src/include/kernel/mm/vmm.h similarity index 100% rename from x64/src/sxkrnl/mm/vmm.h rename to x64/src/include/kernel/mm/vmm.h diff --git a/x64/src/sxkrnl/rf/ref.h b/x64/src/include/kernel/rf/ref.h similarity index 100% rename from x64/src/sxkrnl/rf/ref.h rename to x64/src/include/kernel/rf/ref.h diff --git a/x64/src/sxkrnl/lb/avl_tree.h b/x64/src/include/lib/avl_tree.h similarity index 100% rename from x64/src/sxkrnl/lb/avl_tree.h rename to x64/src/include/lib/avl_tree.h diff --git a/x64/src/sxkrnl/lb/linked_list.h b/x64/src/include/lib/linked_list.h similarity index 100% rename from x64/src/sxkrnl/lb/linked_list.h rename to x64/src/include/lib/linked_list.h diff --git a/x64/src/sxkrnl/lb/salloc.h b/x64/src/include/lib/salloc.h similarity index 100% rename from x64/src/sxkrnl/lb/salloc.h rename to x64/src/include/lib/salloc.h diff --git a/x64/src/sxkrnl/lb/sxtdlib.h b/x64/src/include/lib/sxtdlib.h similarity index 100% rename from x64/src/sxkrnl/lb/sxtdlib.h rename to x64/src/include/lib/sxtdlib.h diff --git a/x64/src/common/type.h b/x64/src/include/type.h similarity index 100% rename from x64/src/common/type.h rename to x64/src/include/type.h diff --git a/x64/src/hal/amd64/addr.inc b/x64/src/kernel/hal/addr.inc similarity index 100% rename from x64/src/hal/amd64/addr.inc rename to x64/src/kernel/hal/addr.inc diff --git a/x64/src/hal/amd64/arch.asm b/x64/src/kernel/hal/arch.asm similarity index 100% rename from x64/src/hal/amd64/arch.asm rename to x64/src/kernel/hal/arch.asm diff --git a/x64/src/hal/amd64/boot.asm b/x64/src/kernel/hal/boot.asm similarity index 100% rename from x64/src/hal/amd64/boot.asm rename to x64/src/kernel/hal/boot.asm diff --git a/x64/src/hal/amd64/init.c b/x64/src/kernel/hal/init.c similarity index 100% rename from x64/src/hal/amd64/init.c rename to x64/src/kernel/hal/init.c diff --git a/x64/src/hal/amd64/intr.asm b/x64/src/kernel/hal/intr.asm similarity index 100% rename from x64/src/hal/amd64/intr.asm rename to x64/src/kernel/hal/intr.asm diff --git a/x64/src/hal/amd64/intr.c b/x64/src/kernel/hal/intr.c similarity index 99% rename from x64/src/hal/amd64/intr.c rename to x64/src/kernel/hal/intr.c index bd0f80f..502ac2b 100644 --- a/x64/src/hal/amd64/intr.c +++ b/x64/src/kernel/hal/intr.c @@ -4,10 +4,12 @@ */ #include "arch.h" +#include "abi.h" +#include "type.h" #include "intr.h" #include "print.h" #include "mem.h" -#include "sxtdlib.h" +#include "lib/sxtdlib.h" static uint8_t _idts[HAL_CORE_COUNT][IDT_ENTRY_NUM*IDT_ENTRY_SIZE]; hal_idt_ptr_t _idt_ptrs[HAL_CORE_COUNT]; diff --git a/x64/src/hal/amd64/intr.h b/x64/src/kernel/hal/intr.h similarity index 100% rename from x64/src/hal/amd64/intr.h rename to x64/src/kernel/hal/intr.h diff --git a/x64/src/hal/amd64/mem.c b/x64/src/kernel/hal/mem.c similarity index 100% rename from x64/src/hal/amd64/mem.c rename to x64/src/kernel/hal/mem.c diff --git a/x64/src/hal/amd64/mem.h b/x64/src/kernel/hal/mem.h similarity index 100% rename from x64/src/hal/amd64/mem.h rename to x64/src/kernel/hal/mem.h diff --git a/x64/src/hal/amd64/print.c b/x64/src/kernel/hal/print.c similarity index 97% rename from x64/src/hal/amd64/print.c rename to x64/src/kernel/hal/print.c index 1ec6961..3abcb6c 100644 --- a/x64/src/hal/amd64/print.c +++ b/x64/src/kernel/hal/print.c @@ -7,6 +7,10 @@ #include "sxtdlib.h" #include "print.h" +#define get_column(pos) (pos % 80) +#define get_row(pos) (pos / 80) +#define get_pos(row,col) ((row) * 80 + (col)) + static uint64_t text_pos; static void KABI hal_print_init() diff --git a/x64/src/hal/amd64/print.h b/x64/src/kernel/hal/print.h similarity index 100% rename from x64/src/hal/amd64/print.h rename to x64/src/kernel/hal/print.h diff --git a/x64/src/sxkrnl/ke/alloc.c b/x64/src/kernel/ke/alloc.c similarity index 100% rename from x64/src/sxkrnl/ke/alloc.c rename to x64/src/kernel/ke/alloc.c diff --git a/x64/src/sxkrnl/ke/assert.c b/x64/src/kernel/ke/assert.c similarity index 100% rename from x64/src/sxkrnl/ke/assert.c rename to x64/src/kernel/ke/assert.c diff --git a/x64/src/sxkrnl/ke/atomic.c b/x64/src/kernel/ke/atomic.c similarity index 100% rename from x64/src/sxkrnl/ke/atomic.c rename to x64/src/kernel/ke/atomic.c diff --git a/x64/src/sxkrnl/ke/boot.c b/x64/src/kernel/ke/boot.c similarity index 100% rename from x64/src/sxkrnl/ke/boot.c rename to x64/src/kernel/ke/boot.c diff --git a/x64/src/sxkrnl/ke/bug_check.c b/x64/src/kernel/ke/bug_check.c similarity index 100% rename from x64/src/sxkrnl/ke/bug_check.c rename to x64/src/kernel/ke/bug_check.c diff --git a/x64/src/sxkrnl/ke/intr.c b/x64/src/kernel/ke/intr.c similarity index 100% rename from x64/src/sxkrnl/ke/intr.c rename to x64/src/kernel/ke/intr.c diff --git a/x64/src/sxkrnl/ke/rwwlock.c b/x64/src/kernel/ke/rwwlock.c similarity index 100% rename from x64/src/sxkrnl/ke/rwwlock.c rename to x64/src/kernel/ke/rwwlock.c diff --git a/x64/src/sxkrnl/ke/spin_lock.c b/x64/src/kernel/ke/spin_lock.c similarity index 100% rename from x64/src/sxkrnl/ke/spin_lock.c rename to x64/src/kernel/ke/spin_lock.c diff --git a/x64/src/sxkrnl/mm/pmm.c b/x64/src/kernel/mm/pmm.c similarity index 100% rename from x64/src/sxkrnl/mm/pmm.c rename to x64/src/kernel/mm/pmm.c diff --git a/x64/src/sxkrnl/mm/vmm.c b/x64/src/kernel/mm/vmm.c similarity index 100% rename from x64/src/sxkrnl/mm/vmm.c rename to x64/src/kernel/mm/vmm.c diff --git a/x64/src/sxkrnl/rf/ref.c b/x64/src/kernel/rf/ref.c similarity index 100% rename from x64/src/sxkrnl/rf/ref.c rename to x64/src/kernel/rf/ref.c diff --git a/x64/src/sxkrnl/lb/avl_tree.c b/x64/src/lib/avl_tree.c similarity index 100% rename from x64/src/sxkrnl/lb/avl_tree.c rename to x64/src/lib/avl_tree.c diff --git a/x64/src/sxkrnl/lb/linked_list.c b/x64/src/lib/linked_list.c similarity index 100% rename from x64/src/sxkrnl/lb/linked_list.c rename to x64/src/lib/linked_list.c diff --git a/x64/src/sxkrnl/lb/salloc.c b/x64/src/lib/salloc.c similarity index 100% rename from x64/src/sxkrnl/lb/salloc.c rename to x64/src/lib/salloc.c diff --git a/x64/src/sxkrnl/lb/sxtdlib.c b/x64/src/lib/sxtdlib.c similarity index 100% rename from x64/src/sxkrnl/lb/sxtdlib.c rename to x64/src/lib/sxtdlib.c diff --git a/x64/src/sxkrnl/ke/arch/amd64/print.h b/x64/src/sxkrnl/ke/arch/amd64/print.h deleted file mode 100644 index ad4f2b1..0000000 --- a/x64/src/sxkrnl/ke/arch/amd64/print.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _S_PRINT_H_ -#define _S_PRINT_H_ - -#include "abi.h" -#include "type.h" - -extern void hal_printf(const char* str, ...); - -#endif \ No newline at end of file