This commit is contained in:
sy2zhao 2018-01-25 04:53:35 -05:00
parent 04ac0338c7
commit 380d6d6bc4
54 changed files with 31 additions and 27 deletions

View File

@ -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")

View File

@ -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);

View File

@ -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);

View File

@ -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"

View File

@ -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);

View File

@ -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

View File

@ -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();

View File

@ -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);

View File

@ -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)

View File

@ -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];

View File

@ -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()

View File

@ -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