KABI -> SXAPI

This commit is contained in:
secXsQuared 2018-02-18 02:48:59 -05:00
parent 1a506a754b
commit 0460c68628
45 changed files with 533 additions and 533 deletions

View File

@ -6,7 +6,7 @@
#include "hal/boot.h"
#include "status.h"
static void KABI halp_obtain_cpu_info(boot_info_t *hal_info)
static void SXAPI halp_obtain_cpu_info(boot_info_t *hal_info)
{
if (hal_info == NULL)
{
@ -20,7 +20,7 @@ static void KABI halp_obtain_cpu_info(boot_info_t *hal_info)
hal_info->cpu_vd_str[12] = 0;
}
status_t KABI hal_init(void *m_info)
status_t SXAPI hal_init(void *m_info)
{
if (m_info == NULL || (uint64_t) m_info & lb_bit_field_mask(0, 2))
{

View File

@ -12,21 +12,21 @@ static intr_handler_t _intr_handler_table[HAL_CORE_COUNT][IDT_ENTRY_NUM];
static void *_intr_handler_context_table[HAL_CORE_COUNT][IDT_ENTRY_NUM];
static exc_handler_t _exc_handler_table[HAL_CORE_COUNT][IDT_ENTRY_NUM];
irql_t KABI hal_set_irql(irql_t irql)
irql_t SXAPI hal_set_irql(irql_t irql)
{
UNREFERENCED(irql)
hal_assert(false, "Unimplemented function called.");
return 0;
}
irql_t KABI hal_get_irql(void)
irql_t SXAPI hal_get_irql(void)
{
hal_assert(false, "Unimplemented function called.");
return 0;
}
void KABI hal_write_gate(void *const gate,
void SXAPI hal_write_gate(void *const gate,
uint64_t const offset,
uint32_t const selector,
uint32_t const attr)
@ -50,7 +50,7 @@ void KABI hal_write_gate(void *const gate,
return;
}
void KABI hal_set_interrupt_handler(uint64_t index,
void SXAPI hal_set_interrupt_handler(uint64_t index,
void (*handler)(void))
{
if (index < IDT_ENTRY_NUM)
@ -61,7 +61,7 @@ void KABI hal_set_interrupt_handler(uint64_t index,
return;
}
void KABI hal_issue_interrupt(uint32_t target_core, uint32_t vector)
void SXAPI hal_issue_interrupt(uint32_t target_core, uint32_t vector)
{
UNREFERENCED(target_core);
UNREFERENCED(vector);
@ -69,7 +69,7 @@ void KABI hal_issue_interrupt(uint32_t target_core, uint32_t vector)
return;
}
void KABI hal_register_interrupt_handler(uint32_t coreid, uint32_t index, intr_handler_t handler, void *context)
void SXAPI hal_register_interrupt_handler(uint32_t coreid, uint32_t index, intr_handler_t handler, void *context)
{
if (index < IDT_ENTRY_NUM && coreid < HAL_CORE_COUNT)
{
@ -79,7 +79,7 @@ void KABI hal_register_interrupt_handler(uint32_t coreid, uint32_t index, intr_h
return;
}
void KABI hal_deregister_interrupt_handler(uint32_t coreid, uint32_t index)
void SXAPI hal_deregister_interrupt_handler(uint32_t coreid, uint32_t index)
{
if (index < IDT_ENTRY_NUM && coreid < HAL_CORE_COUNT)
{
@ -88,7 +88,7 @@ void KABI hal_deregister_interrupt_handler(uint32_t coreid, uint32_t index)
return;
}
void KABI hal_register_exception_handler(uint32_t coreid, uint32_t index, exc_handler_t handler)
void SXAPI hal_register_exception_handler(uint32_t coreid, uint32_t index, exc_handler_t handler)
{
if (index < IDT_ENTRY_NUM && coreid < HAL_CORE_COUNT)
{
@ -97,7 +97,7 @@ void KABI hal_register_exception_handler(uint32_t coreid, uint32_t index, exc_ha
return;
}
void KABI hal_deregister_exception_handler(uint32_t coreid, uint32_t index)
void SXAPI hal_deregister_exception_handler(uint32_t coreid, uint32_t index)
{
if (index < IDT_ENTRY_NUM && coreid < HAL_CORE_COUNT)
{
@ -106,7 +106,7 @@ void KABI hal_deregister_exception_handler(uint32_t coreid, uint32_t index)
return;
}
void KABI hal_interrupt_dispatcher(uint64_t int_vec, hal_interrupt_context_t *context)
void SXAPI hal_interrupt_dispatcher(uint64_t int_vec, hal_interrupt_context_t *context)
{
uint32_t coreid = hal_get_core_id();
if (_intr_handler_table[int_vec] == NULL)
@ -120,7 +120,7 @@ void KABI hal_interrupt_dispatcher(uint64_t int_vec, hal_interrupt_context_t *co
return;
}
void KABI hal_exception_dispatcher(uint64_t exc_vec, hal_interrupt_context_t *context, uint64_t errorcode)
void SXAPI hal_exception_dispatcher(uint64_t exc_vec, hal_interrupt_context_t *context, uint64_t errorcode)
{
uint32_t coreid = hal_get_core_id();
if (_exc_handler_table[exc_vec] == NULL)
@ -134,7 +134,7 @@ void KABI hal_exception_dispatcher(uint64_t exc_vec, hal_interrupt_context_t *co
return;
}
static void KABI halp_populate_idt(void)
static void SXAPI halp_populate_idt(void)
{
hal_set_interrupt_handler(0, hal_interrupt_handler_0);
hal_set_interrupt_handler(1, hal_interrupt_handler_1);
@ -395,13 +395,13 @@ static void KABI halp_populate_idt(void)
return;
}
uint32_t KABI hal_get_core_id(void)
uint32_t SXAPI hal_get_core_id(void)
{
// TODO
return 0;
}
int32_t KABI hal_interrupt_init(void)
int32_t SXAPI hal_interrupt_init(void)
{
uint32_t coreid = hal_get_core_id();
uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0;

View File

@ -21,7 +21,7 @@ char kernel_heap[KERNEL_HEAP_SIZE];
* @param pt_base page table base paddr
* @param pt_end page table entry paddr
*/
status_t KABI hal_write_initial_page_table(void *multiboot_info)
status_t SXAPI hal_write_initial_page_table(void *multiboot_info)
{
UNREFERENCED(multiboot_info);
@ -64,7 +64,7 @@ status_t KABI hal_write_initial_page_table(void *multiboot_info)
}
void KABI hal_write_pt(void *const base, uintptr_t const p_addr, uint64_t const attr)
void SXAPI hal_write_pt(void *const base, uintptr_t const p_addr, uint64_t const attr)
{
if (base == NULL)
{
@ -82,7 +82,7 @@ void KABI hal_write_pt(void *const base, uintptr_t const p_addr, uint64_t const
return;
}
void KABI hal_write_pd(void *const base, uintptr_t const pt_addr, uint64_t const attr)
void SXAPI hal_write_pd(void *const base, uintptr_t const pt_addr, uint64_t const attr)
{
if (base == NULL)
{
@ -100,7 +100,7 @@ void KABI hal_write_pd(void *const base, uintptr_t const pt_addr, uint64_t const
return;
}
void KABI hal_write_pdpt(void *const base, uintptr_t const pd_addr, uint64_t const attr)
void SXAPI hal_write_pdpt(void *const base, uintptr_t const pd_addr, uint64_t const attr)
{
if (base == NULL)
{
@ -118,7 +118,7 @@ void KABI hal_write_pdpt(void *const base, uintptr_t const pd_addr, uint64_t con
return;
}
void KABI hal_write_pml4(void *const base, uintptr_t const pdpt_addr, uint64_t const attr)
void SXAPI hal_write_pml4(void *const base, uintptr_t const pdpt_addr, uint64_t const attr)
{
if (base == NULL)
{
@ -136,7 +136,7 @@ void KABI hal_write_pml4(void *const base, uintptr_t const pdpt_addr, uint64_t c
return;
}
void KABI hal_write_segment_descriptor(void *const gdt, uint32_t const base, uint32_t const limit,
void SXAPI hal_write_segment_descriptor(void *const gdt, uint32_t const base, uint32_t const limit,
uint64_t const attr)
{
if (gdt == NULL)
@ -157,18 +157,18 @@ void KABI hal_write_segment_descriptor(void *const gdt, uint32_t const base, uin
return;
}
void *KABI halloc(uint32_t size)
void *SXAPI halloc(uint32_t size)
{
return lb_salloc(kernel_heap, size);
}
void KABI hfree(void *ptr)
void SXAPI hfree(void *ptr)
{
lb_sfree(kernel_heap, ptr);
return;
}
static void KABI _hal_init_gdt(void)
static void SXAPI _hal_init_gdt(void)
{
uint32_t coreid = hal_get_core_id();
// get gdt ready
@ -199,7 +199,7 @@ static void KABI _hal_init_gdt(void)
hal_flush_gdt(&_gdt_ptrs[coreid], seg_selector(1, 0), seg_selector(2, 0));
}
void KABI hal_mem_init()
void SXAPI hal_mem_init()
{
_hal_init_gdt();
lb_salloc_init(kernel_heap, KERNEL_HEAP_SIZE);

View File

@ -9,18 +9,18 @@
static uint64_t text_pos;
void KABI hal_print_init(void)
void SXAPI hal_print_init(void)
{
text_pos = 0;
}
static void KABI halp_print_scroll(void)
static void SXAPI halp_print_scroll(void)
{
lb_mem_move((void *) (0xb8000 + get_pos(1, 0) * 2), (void *) (0xb8000 + get_pos(0, 0) * 2), (80 * 24) * 2);
return;
}
static void KABI halp_print_str(char const *str)
static void SXAPI halp_print_str(char const *str)
{
if (str == NULL)
{
@ -57,7 +57,7 @@ static void KABI halp_print_str(char const *str)
return;
}
static void KABI halp_print_uint(uint64_t number)
static void SXAPI halp_print_uint(uint64_t number)
{
char arr[21]; // do not need to initialize
arr[20] = 0; //zero-terminated
@ -78,7 +78,7 @@ static void KABI halp_print_uint(uint64_t number)
return;
}
static void KABI halp_print_int(int64_t number)
static void SXAPI halp_print_int(int64_t number)
{
char arr[21]; // do not need to initialize
arr[20] = 0; //zero-terminated
@ -109,7 +109,7 @@ static void KABI halp_print_int(int64_t number)
return;
}
static void KABI halp_print_hex(uint64_t number, uint64_t capital)
static void SXAPI halp_print_hex(uint64_t number, uint64_t capital)
{
char const lookup_table_cap[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
char const lookup_table[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
@ -133,14 +133,14 @@ static void KABI halp_print_hex(uint64_t number, uint64_t capital)
return;
}
void KABI hal_clear_screen(void)
void SXAPI hal_clear_screen(void)
{
text_pos = 0; // reset text_pos
lb_mem_set((void *) 0xb8000, 0, 25 * 80 * 2);
return;
}
void KABI hal_vprintf(char const *format, va_list args)
void SXAPI hal_vprintf(char const *format, va_list args)
{
char buf[2] = {0, 0};
int64_t d;
@ -196,7 +196,7 @@ void KABI hal_vprintf(char const *format, va_list args)
}
}
void KABI hal_printf(char const *format, ...)
void SXAPI hal_printf(char const *format, ...)
{
va_list args;
va_start(args, format);
@ -204,7 +204,7 @@ void KABI hal_printf(char const *format, ...)
va_end(args);
}
void KABI hal_assert(uint32_t expression, char *message)
void SXAPI hal_assert(uint32_t expression, char *message)
{
if (!expression)
{

View File

@ -23,60 +23,60 @@ typedef struct
/**
* CPU Instructions
*/
extern void KABI hal_cpuid(uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx);
extern void SXAPI hal_cpuid(uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx);
extern void KABI hal_halt_cpu(void);
extern void SXAPI hal_halt_cpu(void);
extern void KABI hal_enable_interrupt(void);
extern void SXAPI hal_enable_interrupt(void);
extern void KABI hal_disable_interrupt(void);
extern void SXAPI hal_disable_interrupt(void);
/**
* IO Port Operations
*/
extern int8_t KABI hal_read_port_8(uint16_t port);
extern int8_t SXAPI hal_read_port_8(uint16_t port);
extern int16_t KABI hal_read_port_16(uint16_t port);
extern int16_t SXAPI hal_read_port_16(uint16_t port);
extern int32_t KABI hal_read_port_32(uint16_t port);
extern int32_t SXAPI hal_read_port_32(uint16_t port);
extern void KABI hal_write_port_8(uint16_t port, uint8_t data);
extern void SXAPI hal_write_port_8(uint16_t port, uint8_t data);
extern void KABI hal_write_port_16(uint16_t port, uint16_t data);
extern void SXAPI 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 SXAPI hal_write_port_32(uint16_t port, uint32_t data);
/**
* CPU Structure Operations
*/
extern void KABI hal_flush_gdt(hal_gdt_ptr_t *gdt_ptr, uint64_t code_slct, uint64_t data_slct);
extern void SXAPI hal_flush_gdt(hal_gdt_ptr_t *gdt_ptr, uint64_t code_slct, uint64_t data_slct);
extern void KABI hal_flush_tlb(void);
extern void SXAPI hal_flush_tlb(void);
extern void KABI hal_flush_idt(hal_idt_ptr_t *idt_ptr);
extern void SXAPI hal_flush_idt(hal_idt_ptr_t *idt_ptr);
extern void KABI hal_read_idt(hal_idt_ptr_t **idt_ptr);
extern void SXAPI hal_read_idt(hal_idt_ptr_t **idt_ptr);
/**
* Control Register Operations
*/
#define MSR_IA32_APIC_BASE 0x1B
extern void KABI hal_read_msr(uint32_t *ecx, uint32_t *edx, uint32_t *eax);
extern void SXAPI hal_read_msr(uint32_t *ecx, uint32_t *edx, uint32_t *eax);
extern void KABI hal_write_msr(uint32_t *ecx, uint32_t *edx, uint32_t *eax);
extern void SXAPI hal_write_msr(uint32_t *ecx, uint32_t *edx, uint32_t *eax);
extern void KABI hal_write_cr3(uint64_t base);
extern void SXAPI hal_write_cr3(uint64_t base);
extern uint64_t KABI hal_read_cr3(void);
extern uint64_t SXAPI hal_read_cr3(void);
extern void KABI hal_write_cr8(uint64_t pri);
extern void SXAPI hal_write_cr8(uint64_t pri);
extern uint64_t KABI hal_read_cr8(void);
extern uint64_t SXAPI hal_read_cr8(void);
#endif

View File

@ -36,526 +36,526 @@ typedef struct
* intr.h
*/
int32_t KABI hal_interrupt_init(void);
int32_t SXAPI hal_interrupt_init(void);
/**
* System exception Handlers
*/
extern void KABI hal_interrupt_handler_0(void);
extern void SXAPI hal_interrupt_handler_0(void);
extern void KABI hal_interrupt_handler_1(void);
extern void SXAPI hal_interrupt_handler_1(void);
extern void KABI hal_interrupt_handler_2(void);
extern void SXAPI hal_interrupt_handler_2(void);
extern void KABI hal_interrupt_handler_3(void);
extern void SXAPI hal_interrupt_handler_3(void);
extern void KABI hal_interrupt_handler_4(void);
extern void SXAPI hal_interrupt_handler_4(void);
extern void KABI hal_interrupt_handler_5(void);
extern void SXAPI hal_interrupt_handler_5(void);
extern void KABI hal_interrupt_handler_6(void);
extern void SXAPI hal_interrupt_handler_6(void);
extern void KABI hal_interrupt_handler_7(void);
extern void SXAPI hal_interrupt_handler_7(void);
extern void KABI hal_interrupt_handler_8(void);
extern void SXAPI hal_interrupt_handler_8(void);
extern void KABI hal_interrupt_handler_9(void);
extern void SXAPI hal_interrupt_handler_9(void);
extern void KABI hal_interrupt_handler_10(void);
extern void SXAPI hal_interrupt_handler_10(void);
extern void KABI hal_interrupt_handler_11(void);
extern void SXAPI hal_interrupt_handler_11(void);
extern void KABI hal_interrupt_handler_12(void);
extern void SXAPI hal_interrupt_handler_12(void);
extern void KABI hal_interrupt_handler_13(void);
extern void SXAPI hal_interrupt_handler_13(void);
extern void KABI hal_interrupt_handler_14(void);
extern void SXAPI hal_interrupt_handler_14(void);
extern void KABI hal_interrupt_handler_15(void);
extern void SXAPI hal_interrupt_handler_15(void);
extern void KABI hal_interrupt_handler_16(void);
extern void SXAPI hal_interrupt_handler_16(void);
extern void KABI hal_interrupt_handler_17(void);
extern void SXAPI hal_interrupt_handler_17(void);
extern void KABI hal_interrupt_handler_18(void);
extern void SXAPI hal_interrupt_handler_18(void);
extern void KABI hal_interrupt_handler_19(void);
extern void SXAPI hal_interrupt_handler_19(void);
extern void KABI hal_interrupt_handler_20(void);
extern void SXAPI hal_interrupt_handler_20(void);
extern void KABI hal_interrupt_handler_21(void);
extern void SXAPI hal_interrupt_handler_21(void);
extern void KABI hal_interrupt_handler_22(void);
extern void SXAPI hal_interrupt_handler_22(void);
extern void KABI hal_interrupt_handler_23(void);
extern void SXAPI hal_interrupt_handler_23(void);
extern void KABI hal_interrupt_handler_24(void);
extern void SXAPI hal_interrupt_handler_24(void);
extern void KABI hal_interrupt_handler_25(void);
extern void SXAPI hal_interrupt_handler_25(void);
extern void KABI hal_interrupt_handler_26(void);
extern void SXAPI hal_interrupt_handler_26(void);
extern void KABI hal_interrupt_handler_27(void);
extern void SXAPI hal_interrupt_handler_27(void);
extern void KABI hal_interrupt_handler_28(void);
extern void SXAPI hal_interrupt_handler_28(void);
extern void KABI hal_interrupt_handler_29(void);
extern void SXAPI hal_interrupt_handler_29(void);
extern void KABI hal_interrupt_handler_30(void);
extern void SXAPI hal_interrupt_handler_30(void);
extern void KABI hal_interrupt_handler_31(void);
extern void SXAPI hal_interrupt_handler_31(void);
/**
* Kernel defined interrupt handlers
*/
extern void KABI hal_interrupt_handler_32(void);
extern void SXAPI hal_interrupt_handler_32(void);
extern void KABI hal_interrupt_handler_33(void);
extern void SXAPI hal_interrupt_handler_33(void);
extern void KABI hal_interrupt_handler_34(void);
extern void SXAPI hal_interrupt_handler_34(void);
extern void KABI hal_interrupt_handler_35(void);
extern void SXAPI hal_interrupt_handler_35(void);
extern void KABI hal_interrupt_handler_36(void);
extern void SXAPI hal_interrupt_handler_36(void);
extern void KABI hal_interrupt_handler_37(void);
extern void SXAPI hal_interrupt_handler_37(void);
extern void KABI hal_interrupt_handler_38(void);
extern void SXAPI hal_interrupt_handler_38(void);
extern void KABI hal_interrupt_handler_39(void);
extern void SXAPI hal_interrupt_handler_39(void);
extern void KABI hal_interrupt_handler_40(void);
extern void SXAPI hal_interrupt_handler_40(void);
extern void KABI hal_interrupt_handler_41(void);
extern void SXAPI hal_interrupt_handler_41(void);
extern void KABI hal_interrupt_handler_42(void);
extern void SXAPI hal_interrupt_handler_42(void);
extern void KABI hal_interrupt_handler_43(void);
extern void SXAPI hal_interrupt_handler_43(void);
extern void KABI hal_interrupt_handler_44(void);
extern void SXAPI hal_interrupt_handler_44(void);
extern void KABI hal_interrupt_handler_45(void);
extern void SXAPI hal_interrupt_handler_45(void);
extern void KABI hal_interrupt_handler_46(void);
extern void SXAPI hal_interrupt_handler_46(void);
extern void KABI hal_interrupt_handler_47(void);
extern void SXAPI hal_interrupt_handler_47(void);
extern void KABI hal_interrupt_handler_48(void);
extern void SXAPI hal_interrupt_handler_48(void);
extern void KABI hal_interrupt_handler_49(void);
extern void SXAPI hal_interrupt_handler_49(void);
extern void KABI hal_interrupt_handler_50(void);
extern void SXAPI hal_interrupt_handler_50(void);
extern void KABI hal_interrupt_handler_51(void);
extern void SXAPI hal_interrupt_handler_51(void);
extern void KABI hal_interrupt_handler_52(void);
extern void SXAPI hal_interrupt_handler_52(void);
extern void KABI hal_interrupt_handler_53(void);
extern void SXAPI hal_interrupt_handler_53(void);
extern void KABI hal_interrupt_handler_54(void);
extern void SXAPI hal_interrupt_handler_54(void);
extern void KABI hal_interrupt_handler_55(void);
extern void SXAPI hal_interrupt_handler_55(void);
extern void KABI hal_interrupt_handler_56(void);
extern void SXAPI hal_interrupt_handler_56(void);
extern void KABI hal_interrupt_handler_57(void);
extern void SXAPI hal_interrupt_handler_57(void);
extern void KABI hal_interrupt_handler_58(void);
extern void SXAPI hal_interrupt_handler_58(void);
extern void KABI hal_interrupt_handler_59(void);
extern void SXAPI hal_interrupt_handler_59(void);
extern void KABI hal_interrupt_handler_60(void);
extern void SXAPI hal_interrupt_handler_60(void);
extern void KABI hal_interrupt_handler_61(void);
extern void SXAPI hal_interrupt_handler_61(void);
extern void KABI hal_interrupt_handler_62(void);
extern void SXAPI hal_interrupt_handler_62(void);
extern void KABI hal_interrupt_handler_63(void);
extern void SXAPI hal_interrupt_handler_63(void);
extern void KABI hal_interrupt_handler_64(void);
extern void SXAPI hal_interrupt_handler_64(void);
extern void KABI hal_interrupt_handler_65(void);
extern void SXAPI hal_interrupt_handler_65(void);
extern void KABI hal_interrupt_handler_66(void);
extern void SXAPI hal_interrupt_handler_66(void);
extern void KABI hal_interrupt_handler_67(void);
extern void SXAPI hal_interrupt_handler_67(void);
extern void KABI hal_interrupt_handler_68(void);
extern void SXAPI hal_interrupt_handler_68(void);
extern void KABI hal_interrupt_handler_69(void);
extern void SXAPI hal_interrupt_handler_69(void);
extern void KABI hal_interrupt_handler_70(void);
extern void SXAPI hal_interrupt_handler_70(void);
extern void KABI hal_interrupt_handler_71(void);
extern void SXAPI hal_interrupt_handler_71(void);
extern void KABI hal_interrupt_handler_72(void);
extern void SXAPI hal_interrupt_handler_72(void);
extern void KABI hal_interrupt_handler_73(void);
extern void SXAPI hal_interrupt_handler_73(void);
extern void KABI hal_interrupt_handler_74(void);
extern void SXAPI hal_interrupt_handler_74(void);
extern void KABI hal_interrupt_handler_75(void);
extern void SXAPI hal_interrupt_handler_75(void);
extern void KABI hal_interrupt_handler_76(void);
extern void SXAPI hal_interrupt_handler_76(void);
extern void KABI hal_interrupt_handler_77(void);
extern void SXAPI hal_interrupt_handler_77(void);
extern void KABI hal_interrupt_handler_78(void);
extern void SXAPI hal_interrupt_handler_78(void);
extern void KABI hal_interrupt_handler_79(void);
extern void SXAPI hal_interrupt_handler_79(void);
extern void KABI hal_interrupt_handler_80(void);
extern void SXAPI hal_interrupt_handler_80(void);
extern void KABI hal_interrupt_handler_81(void);
extern void SXAPI hal_interrupt_handler_81(void);
extern void KABI hal_interrupt_handler_82(void);
extern void SXAPI hal_interrupt_handler_82(void);
extern void KABI hal_interrupt_handler_83(void);
extern void SXAPI hal_interrupt_handler_83(void);
extern void KABI hal_interrupt_handler_84(void);
extern void SXAPI hal_interrupt_handler_84(void);
extern void KABI hal_interrupt_handler_85(void);
extern void SXAPI hal_interrupt_handler_85(void);
extern void KABI hal_interrupt_handler_86(void);
extern void SXAPI hal_interrupt_handler_86(void);
extern void KABI hal_interrupt_handler_87(void);
extern void SXAPI hal_interrupt_handler_87(void);
extern void KABI hal_interrupt_handler_88(void);
extern void SXAPI hal_interrupt_handler_88(void);
extern void KABI hal_interrupt_handler_89(void);
extern void SXAPI hal_interrupt_handler_89(void);
extern void KABI hal_interrupt_handler_90(void);
extern void SXAPI hal_interrupt_handler_90(void);
extern void KABI hal_interrupt_handler_91(void);
extern void SXAPI hal_interrupt_handler_91(void);
extern void KABI hal_interrupt_handler_92(void);
extern void SXAPI hal_interrupt_handler_92(void);
extern void KABI hal_interrupt_handler_93(void);
extern void SXAPI hal_interrupt_handler_93(void);
extern void KABI hal_interrupt_handler_94(void);
extern void SXAPI hal_interrupt_handler_94(void);
extern void KABI hal_interrupt_handler_95(void);
extern void SXAPI hal_interrupt_handler_95(void);
extern void KABI hal_interrupt_handler_96(void);
extern void SXAPI hal_interrupt_handler_96(void);
extern void KABI hal_interrupt_handler_97(void);
extern void SXAPI hal_interrupt_handler_97(void);
extern void KABI hal_interrupt_handler_98(void);
extern void SXAPI hal_interrupt_handler_98(void);
extern void KABI hal_interrupt_handler_99(void);
extern void SXAPI hal_interrupt_handler_99(void);
extern void KABI hal_interrupt_handler_100(void);
extern void SXAPI hal_interrupt_handler_100(void);
extern void KABI hal_interrupt_handler_101(void);
extern void SXAPI hal_interrupt_handler_101(void);
extern void KABI hal_interrupt_handler_102(void);
extern void SXAPI hal_interrupt_handler_102(void);
extern void KABI hal_interrupt_handler_103(void);
extern void SXAPI hal_interrupt_handler_103(void);
extern void KABI hal_interrupt_handler_104(void);
extern void SXAPI hal_interrupt_handler_104(void);
extern void KABI hal_interrupt_handler_105(void);
extern void SXAPI hal_interrupt_handler_105(void);
extern void KABI hal_interrupt_handler_106(void);
extern void SXAPI hal_interrupt_handler_106(void);
extern void KABI hal_interrupt_handler_107(void);
extern void SXAPI hal_interrupt_handler_107(void);
extern void KABI hal_interrupt_handler_108(void);
extern void SXAPI hal_interrupt_handler_108(void);
extern void KABI hal_interrupt_handler_109(void);
extern void SXAPI hal_interrupt_handler_109(void);
extern void KABI hal_interrupt_handler_110(void);
extern void SXAPI hal_interrupt_handler_110(void);
extern void KABI hal_interrupt_handler_111(void);
extern void SXAPI hal_interrupt_handler_111(void);
extern void KABI hal_interrupt_handler_112(void);
extern void SXAPI hal_interrupt_handler_112(void);
extern void KABI hal_interrupt_handler_113(void);
extern void SXAPI hal_interrupt_handler_113(void);
extern void KABI hal_interrupt_handler_114(void);
extern void SXAPI hal_interrupt_handler_114(void);
extern void KABI hal_interrupt_handler_115(void);
extern void SXAPI hal_interrupt_handler_115(void);
extern void KABI hal_interrupt_handler_116(void);
extern void SXAPI hal_interrupt_handler_116(void);
extern void KABI hal_interrupt_handler_117(void);
extern void SXAPI hal_interrupt_handler_117(void);
extern void KABI hal_interrupt_handler_118(void);
extern void SXAPI hal_interrupt_handler_118(void);
extern void KABI hal_interrupt_handler_119(void);
extern void SXAPI hal_interrupt_handler_119(void);
extern void KABI hal_interrupt_handler_120(void);
extern void SXAPI hal_interrupt_handler_120(void);
extern void KABI hal_interrupt_handler_121(void);
extern void SXAPI hal_interrupt_handler_121(void);
extern void KABI hal_interrupt_handler_122(void);
extern void SXAPI hal_interrupt_handler_122(void);
extern void KABI hal_interrupt_handler_123(void);
extern void SXAPI hal_interrupt_handler_123(void);
extern void KABI hal_interrupt_handler_124(void);
extern void SXAPI hal_interrupt_handler_124(void);
extern void KABI hal_interrupt_handler_125(void);
extern void SXAPI hal_interrupt_handler_125(void);
extern void KABI hal_interrupt_handler_126(void);
extern void SXAPI hal_interrupt_handler_126(void);
extern void KABI hal_interrupt_handler_127(void);
extern void SXAPI hal_interrupt_handler_127(void);
extern void KABI hal_interrupt_handler_128(void);
extern void SXAPI hal_interrupt_handler_128(void);
extern void KABI hal_interrupt_handler_129(void);
extern void SXAPI hal_interrupt_handler_129(void);
extern void KABI hal_interrupt_handler_130(void);
extern void SXAPI hal_interrupt_handler_130(void);
extern void KABI hal_interrupt_handler_131(void);
extern void SXAPI hal_interrupt_handler_131(void);
extern void KABI hal_interrupt_handler_132(void);
extern void SXAPI hal_interrupt_handler_132(void);
extern void KABI hal_interrupt_handler_133(void);
extern void SXAPI hal_interrupt_handler_133(void);
extern void KABI hal_interrupt_handler_134(void);
extern void SXAPI hal_interrupt_handler_134(void);
extern void KABI hal_interrupt_handler_135(void);
extern void SXAPI hal_interrupt_handler_135(void);
extern void KABI hal_interrupt_handler_136(void);
extern void SXAPI hal_interrupt_handler_136(void);
extern void KABI hal_interrupt_handler_137(void);
extern void SXAPI hal_interrupt_handler_137(void);
extern void KABI hal_interrupt_handler_138(void);
extern void SXAPI hal_interrupt_handler_138(void);
extern void KABI hal_interrupt_handler_139(void);
extern void SXAPI hal_interrupt_handler_139(void);
extern void KABI hal_interrupt_handler_140(void);
extern void SXAPI hal_interrupt_handler_140(void);
extern void KABI hal_interrupt_handler_141(void);
extern void SXAPI hal_interrupt_handler_141(void);
extern void KABI hal_interrupt_handler_142(void);
extern void SXAPI hal_interrupt_handler_142(void);
extern void KABI hal_interrupt_handler_143(void);
extern void SXAPI hal_interrupt_handler_143(void);
extern void KABI hal_interrupt_handler_144(void);
extern void SXAPI hal_interrupt_handler_144(void);
extern void KABI hal_interrupt_handler_145(void);
extern void SXAPI hal_interrupt_handler_145(void);
extern void KABI hal_interrupt_handler_146(void);
extern void SXAPI hal_interrupt_handler_146(void);
extern void KABI hal_interrupt_handler_147(void);
extern void SXAPI hal_interrupt_handler_147(void);
extern void KABI hal_interrupt_handler_148(void);
extern void SXAPI hal_interrupt_handler_148(void);
extern void KABI hal_interrupt_handler_149(void);
extern void SXAPI hal_interrupt_handler_149(void);
extern void KABI hal_interrupt_handler_150(void);
extern void SXAPI hal_interrupt_handler_150(void);
extern void KABI hal_interrupt_handler_151(void);
extern void SXAPI hal_interrupt_handler_151(void);
extern void KABI hal_interrupt_handler_152(void);
extern void SXAPI hal_interrupt_handler_152(void);
extern void KABI hal_interrupt_handler_153(void);
extern void SXAPI hal_interrupt_handler_153(void);
extern void KABI hal_interrupt_handler_154(void);
extern void SXAPI hal_interrupt_handler_154(void);
extern void KABI hal_interrupt_handler_155(void);
extern void SXAPI hal_interrupt_handler_155(void);
extern void KABI hal_interrupt_handler_156(void);
extern void SXAPI hal_interrupt_handler_156(void);
extern void KABI hal_interrupt_handler_157(void);
extern void SXAPI hal_interrupt_handler_157(void);
extern void KABI hal_interrupt_handler_158(void);
extern void SXAPI hal_interrupt_handler_158(void);
extern void KABI hal_interrupt_handler_159(void);
extern void SXAPI hal_interrupt_handler_159(void);
extern void KABI hal_interrupt_handler_160(void);
extern void SXAPI hal_interrupt_handler_160(void);
extern void KABI hal_interrupt_handler_161(void);
extern void SXAPI hal_interrupt_handler_161(void);
extern void KABI hal_interrupt_handler_162(void);
extern void SXAPI hal_interrupt_handler_162(void);
extern void KABI hal_interrupt_handler_163(void);
extern void SXAPI hal_interrupt_handler_163(void);
extern void KABI hal_interrupt_handler_164(void);
extern void SXAPI hal_interrupt_handler_164(void);
extern void KABI hal_interrupt_handler_165(void);
extern void SXAPI hal_interrupt_handler_165(void);
extern void KABI hal_interrupt_handler_166(void);
extern void SXAPI hal_interrupt_handler_166(void);
extern void KABI hal_interrupt_handler_167(void);
extern void SXAPI hal_interrupt_handler_167(void);
extern void KABI hal_interrupt_handler_168(void);
extern void SXAPI hal_interrupt_handler_168(void);
extern void KABI hal_interrupt_handler_169(void);
extern void SXAPI hal_interrupt_handler_169(void);
extern void KABI hal_interrupt_handler_170(void);
extern void SXAPI hal_interrupt_handler_170(void);
extern void KABI hal_interrupt_handler_171(void);
extern void SXAPI hal_interrupt_handler_171(void);
extern void KABI hal_interrupt_handler_172(void);
extern void SXAPI hal_interrupt_handler_172(void);
extern void KABI hal_interrupt_handler_173(void);
extern void SXAPI hal_interrupt_handler_173(void);
extern void KABI hal_interrupt_handler_174(void);
extern void SXAPI hal_interrupt_handler_174(void);
extern void KABI hal_interrupt_handler_175(void);
extern void SXAPI hal_interrupt_handler_175(void);
extern void KABI hal_interrupt_handler_176(void);
extern void SXAPI hal_interrupt_handler_176(void);
extern void KABI hal_interrupt_handler_177(void);
extern void SXAPI hal_interrupt_handler_177(void);
extern void KABI hal_interrupt_handler_178(void);
extern void SXAPI hal_interrupt_handler_178(void);
extern void KABI hal_interrupt_handler_179(void);
extern void SXAPI hal_interrupt_handler_179(void);
extern void KABI hal_interrupt_handler_180(void);
extern void SXAPI hal_interrupt_handler_180(void);
extern void KABI hal_interrupt_handler_181(void);
extern void SXAPI hal_interrupt_handler_181(void);
extern void KABI hal_interrupt_handler_182(void);
extern void SXAPI hal_interrupt_handler_182(void);
extern void KABI hal_interrupt_handler_183(void);
extern void SXAPI hal_interrupt_handler_183(void);
extern void KABI hal_interrupt_handler_184(void);
extern void SXAPI hal_interrupt_handler_184(void);
extern void KABI hal_interrupt_handler_185(void);
extern void SXAPI hal_interrupt_handler_185(void);
extern void KABI hal_interrupt_handler_186(void);
extern void SXAPI hal_interrupt_handler_186(void);
extern void KABI hal_interrupt_handler_187(void);
extern void SXAPI hal_interrupt_handler_187(void);
extern void KABI hal_interrupt_handler_188(void);
extern void SXAPI hal_interrupt_handler_188(void);
extern void KABI hal_interrupt_handler_189(void);
extern void SXAPI hal_interrupt_handler_189(void);
extern void KABI hal_interrupt_handler_190(void);
extern void SXAPI hal_interrupt_handler_190(void);
extern void KABI hal_interrupt_handler_191(void);
extern void SXAPI hal_interrupt_handler_191(void);
extern void KABI hal_interrupt_handler_192(void);
extern void SXAPI hal_interrupt_handler_192(void);
extern void KABI hal_interrupt_handler_193(void);
extern void SXAPI hal_interrupt_handler_193(void);
extern void KABI hal_interrupt_handler_194(void);
extern void SXAPI hal_interrupt_handler_194(void);
extern void KABI hal_interrupt_handler_195(void);
extern void SXAPI hal_interrupt_handler_195(void);
extern void KABI hal_interrupt_handler_196(void);
extern void SXAPI hal_interrupt_handler_196(void);
extern void KABI hal_interrupt_handler_197(void);
extern void SXAPI hal_interrupt_handler_197(void);
extern void KABI hal_interrupt_handler_198(void);
extern void SXAPI hal_interrupt_handler_198(void);
extern void KABI hal_interrupt_handler_199(void);
extern void SXAPI hal_interrupt_handler_199(void);
extern void KABI hal_interrupt_handler_200(void);
extern void SXAPI hal_interrupt_handler_200(void);
extern void KABI hal_interrupt_handler_201(void);
extern void SXAPI hal_interrupt_handler_201(void);
extern void KABI hal_interrupt_handler_202(void);
extern void SXAPI hal_interrupt_handler_202(void);
extern void KABI hal_interrupt_handler_203(void);
extern void SXAPI hal_interrupt_handler_203(void);
extern void KABI hal_interrupt_handler_204(void);
extern void SXAPI hal_interrupt_handler_204(void);
extern void KABI hal_interrupt_handler_205(void);
extern void SXAPI hal_interrupt_handler_205(void);
extern void KABI hal_interrupt_handler_206(void);
extern void SXAPI hal_interrupt_handler_206(void);
extern void KABI hal_interrupt_handler_207(void);
extern void SXAPI hal_interrupt_handler_207(void);
extern void KABI hal_interrupt_handler_208(void);
extern void SXAPI hal_interrupt_handler_208(void);
extern void KABI hal_interrupt_handler_209(void);
extern void SXAPI hal_interrupt_handler_209(void);
extern void KABI hal_interrupt_handler_210(void);
extern void SXAPI hal_interrupt_handler_210(void);
extern void KABI hal_interrupt_handler_211(void);
extern void SXAPI hal_interrupt_handler_211(void);
extern void KABI hal_interrupt_handler_212(void);
extern void SXAPI hal_interrupt_handler_212(void);
extern void KABI hal_interrupt_handler_213(void);
extern void SXAPI hal_interrupt_handler_213(void);
extern void KABI hal_interrupt_handler_214(void);
extern void SXAPI hal_interrupt_handler_214(void);
extern void KABI hal_interrupt_handler_215(void);
extern void SXAPI hal_interrupt_handler_215(void);
extern void KABI hal_interrupt_handler_216(void);
extern void SXAPI hal_interrupt_handler_216(void);
extern void KABI hal_interrupt_handler_217(void);
extern void SXAPI hal_interrupt_handler_217(void);
extern void KABI hal_interrupt_handler_218(void);
extern void SXAPI hal_interrupt_handler_218(void);
extern void KABI hal_interrupt_handler_219(void);
extern void SXAPI hal_interrupt_handler_219(void);
extern void KABI hal_interrupt_handler_220(void);
extern void SXAPI hal_interrupt_handler_220(void);
extern void KABI hal_interrupt_handler_221(void);
extern void SXAPI hal_interrupt_handler_221(void);
extern void KABI hal_interrupt_handler_222(void);
extern void SXAPI hal_interrupt_handler_222(void);
extern void KABI hal_interrupt_handler_223(void);
extern void SXAPI hal_interrupt_handler_223(void);
extern void KABI hal_interrupt_handler_224(void);
extern void SXAPI hal_interrupt_handler_224(void);
extern void KABI hal_interrupt_handler_225(void);
extern void SXAPI hal_interrupt_handler_225(void);
extern void KABI hal_interrupt_handler_226(void);
extern void SXAPI hal_interrupt_handler_226(void);
extern void KABI hal_interrupt_handler_227(void);
extern void SXAPI hal_interrupt_handler_227(void);
extern void KABI hal_interrupt_handler_228(void);
extern void SXAPI hal_interrupt_handler_228(void);
extern void KABI hal_interrupt_handler_229(void);
extern void SXAPI hal_interrupt_handler_229(void);
extern void KABI hal_interrupt_handler_230(void);
extern void SXAPI hal_interrupt_handler_230(void);
extern void KABI hal_interrupt_handler_231(void);
extern void SXAPI hal_interrupt_handler_231(void);
extern void KABI hal_interrupt_handler_232(void);
extern void SXAPI hal_interrupt_handler_232(void);
extern void KABI hal_interrupt_handler_233(void);
extern void SXAPI hal_interrupt_handler_233(void);
extern void KABI hal_interrupt_handler_234(void);
extern void SXAPI hal_interrupt_handler_234(void);
extern void KABI hal_interrupt_handler_235(void);
extern void SXAPI hal_interrupt_handler_235(void);
extern void KABI hal_interrupt_handler_236(void);
extern void SXAPI hal_interrupt_handler_236(void);
extern void KABI hal_interrupt_handler_237(void);
extern void SXAPI hal_interrupt_handler_237(void);
extern void KABI hal_interrupt_handler_238(void);
extern void SXAPI hal_interrupt_handler_238(void);
extern void KABI hal_interrupt_handler_239(void);
extern void SXAPI hal_interrupt_handler_239(void);
extern void KABI hal_interrupt_handler_240(void);
extern void SXAPI hal_interrupt_handler_240(void);
extern void KABI hal_interrupt_handler_241(void);
extern void SXAPI hal_interrupt_handler_241(void);
extern void KABI hal_interrupt_handler_242(void);
extern void SXAPI hal_interrupt_handler_242(void);
extern void KABI hal_interrupt_handler_243(void);
extern void SXAPI hal_interrupt_handler_243(void);
extern void KABI hal_interrupt_handler_244(void);
extern void SXAPI hal_interrupt_handler_244(void);
extern void KABI hal_interrupt_handler_245(void);
extern void SXAPI hal_interrupt_handler_245(void);
extern void KABI hal_interrupt_handler_246(void);
extern void SXAPI hal_interrupt_handler_246(void);
extern void KABI hal_interrupt_handler_247(void);
extern void SXAPI hal_interrupt_handler_247(void);
extern void KABI hal_interrupt_handler_248(void);
extern void SXAPI hal_interrupt_handler_248(void);
extern void KABI hal_interrupt_handler_249(void);
extern void SXAPI hal_interrupt_handler_249(void);
extern void KABI hal_interrupt_handler_250(void);
extern void SXAPI hal_interrupt_handler_250(void);
extern void KABI hal_interrupt_handler_251(void);
extern void SXAPI hal_interrupt_handler_251(void);
extern void KABI hal_interrupt_handler_252(void);
extern void SXAPI hal_interrupt_handler_252(void);
extern void KABI hal_interrupt_handler_253(void);
extern void SXAPI hal_interrupt_handler_253(void);
extern void KABI hal_interrupt_handler_254(void);
extern void SXAPI hal_interrupt_handler_254(void);
extern void KABI hal_interrupt_handler_255(void);
extern void SXAPI hal_interrupt_handler_255(void);
#endif

View File

@ -73,30 +73,30 @@
#define PD_ENTRY_NUM(vaddr) (((vaddr) >> 21) & 0x1FF)
#define PT_ENTRY_NUM(vaddr) (((vaddr) >> 12) & 0x1FF)
static inline uint32_t KABI seg_selector(uint32_t index, uint32_t rpl)
static inline uint32_t SXAPI seg_selector(uint32_t index, uint32_t rpl)
{
return (index << 3) + rpl;
}
void KABI hal_write_segment_descriptor(void *const gdt, uint32_t const base, uint32_t const limit, uint64_t const attr);
void SXAPI hal_write_segment_descriptor(void *const gdt, uint32_t const base, uint32_t const limit, uint64_t const attr);
void KABI hal_write_pml4(void *const base, uintptr_t const pdpt_addr, uint64_t const attr);
void SXAPI hal_write_pml4(void *const base, uintptr_t const pdpt_addr, uint64_t const attr);
void KABI hal_write_pdpt(void *const base, uintptr_t const pd_addr, uint64_t const attr);
void SXAPI hal_write_pdpt(void *const base, uintptr_t const pd_addr, uint64_t const attr);
void KABI hal_write_pd(void *const base, uintptr_t const pt_addr, uint64_t const attr);
void SXAPI hal_write_pd(void *const base, uintptr_t const pt_addr, uint64_t const attr);
void KABI hal_write_pt(void *const base, uintptr_t const p_addr, uint64_t const attr);
void SXAPI hal_write_pt(void *const base, uintptr_t const p_addr, uint64_t const attr);
/**
Function Defn
**/
void *KABI halloc(uint32_t size);
void *SXAPI halloc(uint32_t size);
void KABI hfree(void *ptr);
void SXAPI hfree(void *ptr);
void KABI hal_mem_init(void);
void SXAPI hal_mem_init(void);
#endif

View File

@ -4,12 +4,12 @@
#include "type.h"
#include "kernel/hal/print.h"
void KABI hal_assert(uint32_t expression, char *message);
void SXAPI hal_assert(uint32_t expression, char *message);
void KABI hal_printf(const char *str, ...);
void SXAPI hal_printf(const char *str, ...);
void KABI hal_clear_screen(void);
void SXAPI hal_clear_screen(void);
void KABI hal_print_init(void);
void SXAPI hal_print_init(void);
#endif

View File

@ -7,10 +7,10 @@
* Atomic operations
*/
extern int32_t KABI hal_interlocked_exchange_32(int32_t *target, int32_t val);
extern int32_t SXAPI hal_interlocked_exchange_32(int32_t *target, int32_t val);
extern int32_t KABI hal_interlocked_increment_32(int32_t *target, int32_t increment);
extern int32_t SXAPI hal_interlocked_increment_32(int32_t *target, int32_t increment);
extern int32_t KABI hal_interlocked_compare_exchange_32(int32_t *target, int32_t compare, int32_t val);
extern int32_t SXAPI hal_interlocked_compare_exchange_32(int32_t *target, int32_t compare, int32_t val);
#endif

View File

@ -17,6 +17,6 @@ typedef struct
char cpu_vd_str[13];
} boot_info_t;
status_t KABI hal_init(void *m_info);
status_t SXAPI hal_init(void *m_info);
#endif

View File

@ -12,11 +12,11 @@ typedef uint32_t irql_t;
#define IRQL_APC_LEVEL (1 << 1)
#define IRQL_PASSIVE_LEVEL (1 << 0)
irql_t KABI hal_set_irql(irql_t irql);
irql_t SXAPI hal_set_irql(irql_t irql);
irql_t KABI hal_get_irql(void);
irql_t SXAPI hal_get_irql(void);
uint32_t KABI hal_get_core_id(void);
uint32_t SXAPI hal_get_core_id(void);
/**
* Interrupt Handler Registration
@ -28,11 +28,11 @@ typedef struct
uint32_t dpc_intr_vec;
} intr_info_t;
typedef void (KABI *intr_handler_t)(void *context, void *intr_stack);
typedef void (SXAPI *intr_handler_t)(void *context, void *intr_stack);
void KABI hal_register_interrupt_handler(uint32_t coreid, uint32_t index, intr_handler_t handler, void *context);
void SXAPI hal_register_interrupt_handler(uint32_t coreid, uint32_t index, intr_handler_t handler, void *context);
void KABI hal_deregister_interrupt_handler(uint32_t coreid, uint32_t index);
void SXAPI hal_deregister_interrupt_handler(uint32_t coreid, uint32_t index);
/**
* Exception Handler Registration
@ -48,10 +48,10 @@ typedef enum
debug_exc
} exc_type_t;
typedef void (KABI *exc_handler_t)(uint64_t exc_addr, uint64_t exc_stack, uint64_t error_code);
typedef void (SXAPI *exc_handler_t)(uint64_t exc_addr, uint64_t exc_stack, uint64_t error_code);
void KABI hal_register_exception_handler(uint32_t coreid, uint32_t index, exc_handler_t handler);
void SXAPI hal_register_exception_handler(uint32_t coreid, uint32_t index, exc_handler_t handler);
void KABI hal_deregister_exception_handler(uint32_t coreid, uint32_t index);
void SXAPI hal_deregister_exception_handler(uint32_t coreid, uint32_t index);
#endif

View File

@ -3,6 +3,6 @@
#include "type.h"
void KABI hal_vprintf(const char *str, va_list args);
void SXAPI hal_vprintf(const char *str, va_list args);
#endif

View File

@ -3,10 +3,10 @@
#include "type.h"
void KABI ke_alloc_init(void);
void SXAPI ke_alloc_init(void);
void *KABI ke_alloc(uint32_t size);
void *SXAPI ke_alloc(uint32_t size);
void KABI ke_free(void *ptr);
void SXAPI ke_free(void *ptr);
#endif

View File

@ -3,7 +3,7 @@
#include "type.h"
void KABI ke_assert_ex(const char *expr_str, const char *file, int32_t line, int32_t expr);
void SXAPI ke_assert_ex(const char *expr_str, const char *file, int32_t line, int32_t expr);
#define ke_assert(expr) ke_assert_ex(#expr, __FILE__, __LINE__, expr)

View File

@ -4,10 +4,10 @@
#include "type.h"
#include "kernel/hal/atomic.h"
int32_t KABI ke_interlocked_exchange_32(int32_t *target, int32_t val);
int32_t SXAPI ke_interlocked_exchange_32(int32_t *target, int32_t val);
int32_t KABI ke_interlocked_increment_32(int32_t *target, int32_t increment);
int32_t SXAPI ke_interlocked_increment_32(int32_t *target, int32_t increment);
int32_t KABI ke_interlocked_compare_exchange_32(int32_t *target, int32_t compare, int32_t val);
int32_t SXAPI ke_interlocked_compare_exchange_32(int32_t *target, int32_t compare, int32_t val);
#endif

View File

@ -6,8 +6,8 @@
#define BUG_CHECK_IRQL_MISMATCH 0
#define BUG_CHECK_PMM_UNALIGNED 1
void KABI ke_panic(uint64_t reason);
void SXAPI ke_panic(uint64_t reason);
void KABI ke_trap(void);
void SXAPI ke_trap(void);
#endif

View File

@ -4,12 +4,12 @@
#include "kernel/hal/intr.h"
#include "type.h"
irql_t KABI ke_raise_irql(irql_t irql);
irql_t SXAPI ke_raise_irql(irql_t irql);
irql_t KABI ke_lower_irql(irql_t irql);
irql_t SXAPI ke_lower_irql(irql_t irql);
int KABI ke_get_current_core(void);
int SXAPI ke_get_current_core(void);
irql_t KABI ke_get_irql(void);
irql_t SXAPI ke_get_irql(void);
#endif

View File

@ -4,8 +4,8 @@
#include "type.h"
#include "kernel/hal/print.h"
void KABI ke_printf(const char *str, ...);
void SXAPI ke_printf(const char *str, ...);
void KABI ke_vprintf(const char *str, va_list args);
void SXAPI ke_vprintf(const char *str, va_list args);
#endif

View File

@ -14,22 +14,22 @@ typedef struct
uint32_t writer_ct;
} k_rwwlock_t;
void KABI ke_rwwlock_init(k_rwwlock_t *lock);
void SXAPI ke_rwwlock_init(k_rwwlock_t *lock);
void KABI ke_rwwlock_reader_lock(k_rwwlock_t *lock);
void SXAPI ke_rwwlock_reader_lock(k_rwwlock_t *lock);
void KABI ke_rwwlock_reader_unlock(k_rwwlock_t *lock);
void SXAPI ke_rwwlock_reader_unlock(k_rwwlock_t *lock);
void KABI ke_rwwlock_writer_lock(k_rwwlock_t *lock);
void SXAPI ke_rwwlock_writer_lock(k_rwwlock_t *lock);
void KABI ke_rwwlock_writer_unlock(k_rwwlock_t *lock);
void SXAPI ke_rwwlock_writer_unlock(k_rwwlock_t *lock);
irql_t KABI ke_rwwlock_reader_lock_raise_irql(k_rwwlock_t *lock, irql_t irql);
irql_t SXAPI ke_rwwlock_reader_lock_raise_irql(k_rwwlock_t *lock, irql_t irql);
void KABI ke_rwwlock_reader_unlock_lower_irql(k_rwwlock_t *lock, irql_t irql);
void SXAPI ke_rwwlock_reader_unlock_lower_irql(k_rwwlock_t *lock, irql_t irql);
irql_t KABI ke_rwwlock_writer_lock_raise_irql(k_rwwlock_t *lock, irql_t irql);
irql_t SXAPI ke_rwwlock_writer_lock_raise_irql(k_rwwlock_t *lock, irql_t irql);
void KABI ke_rwwlock_writer_unlock_lower_irql(k_rwwlock_t *lock, irql_t irql);
void SXAPI ke_rwwlock_writer_unlock_lower_irql(k_rwwlock_t *lock, irql_t irql);
#endif

View File

@ -9,14 +9,14 @@ typedef struct
int32_t val;
} k_spin_lock_t;
void KABI ke_spin_lock_init(k_spin_lock_t *lock);
void SXAPI ke_spin_lock_init(k_spin_lock_t *lock);
void KABI ke_spin_lock(k_spin_lock_t *lock);
void SXAPI ke_spin_lock(k_spin_lock_t *lock);
void KABI ke_spin_unlock(k_spin_lock_t *lock);
void SXAPI ke_spin_unlock(k_spin_lock_t *lock);
irql_t KABI ke_spin_lock_raise_irql(k_spin_lock_t *lock, irql_t irql);
irql_t SXAPI ke_spin_lock_raise_irql(k_spin_lock_t *lock, irql_t irql);
void KABI ke_spin_unlock_lower_irql(k_spin_lock_t *lock, irql_t irql);
void SXAPI ke_spin_unlock_lower_irql(k_spin_lock_t *lock, irql_t irql);
#endif

View File

@ -17,20 +17,20 @@
//} k_physical_page_attr_t;
status_t KABI sx_pmm_init(pmm_info_t *info);
status_t SXAPI sx_pmm_init(pmm_info_t *info);
status_t KABI mm_alloc_page(uintptr_t *out);
status_t SXAPI mm_alloc_page(uintptr_t *out);
status_t KABI mm_free_page(uintptr_t base);
status_t SXAPI mm_free_page(uintptr_t base);
status_t KABI mm_query_page_attr(uintptr_t base,
status_t SXAPI mm_query_page_attr(uintptr_t base,
int32_t *out);
// TODO: implement these somehow, i might just reserve the first 16MB for these
int32_t KABI mm_alloc_contiguous_pages(uint64_t num_of_page,
int32_t SXAPI mm_alloc_contiguous_pages(uint64_t num_of_page,
uintptr_t highest_p_addr,
uintptr_t *out);
int32_t KABI mm_free_contiguous_pages(uintptr_t base);
int32_t SXAPI mm_free_contiguous_pages(uintptr_t base);
#endif

View File

@ -19,20 +19,20 @@ typedef struct
// specifying where the allocations take place
//
status_t KABI rf_reference_setup(void);
status_t SXAPI rf_reference_setup(void);
status_t KABI rf_reference_create(ref_node_t *ref,
status_t SXAPI rf_reference_create(ref_node_t *ref,
callback_func_t free_func);
status_t KABI rf_reference_obj(ref_node_t *ref);
status_t SXAPI rf_reference_obj(ref_node_t *ref);
status_t KABI rf_dereference_obj(ref_node_t *ref);
status_t SXAPI rf_dereference_obj(ref_node_t *ref);
// HANDLES
status_t KABI sx_open_obj_by_handle(handle_t handle, ref_node_t **out);
status_t SXAPI sx_open_obj_by_handle(handle_t handle, ref_node_t **out);
status_t KABI sx_create_handle(ref_node_t *ref, handle_t *out);
status_t SXAPI sx_create_handle(ref_node_t *ref, handle_t *out);
status_t KABI sx_close_handle(handle_t handle);
status_t SXAPI sx_close_handle(handle_t handle);
#endif

View File

@ -26,24 +26,24 @@ typedef struct _k_avl_tree_t
avl_tree_node_t *root;
} avl_tree_t;
avl_tree_node_t *KABI lb_avl_tree_search(avl_tree_t *tree, avl_tree_node_t *entry);
avl_tree_node_t *SXAPI lb_avl_tree_search(avl_tree_t *tree, avl_tree_node_t *entry);
void KABI lb_avl_tree_insert(avl_tree_t *tree, avl_tree_node_t *entry);
void SXAPI lb_avl_tree_insert(avl_tree_t *tree, avl_tree_node_t *entry);
avl_tree_node_t *KABI lb_avl_tree_delete(avl_tree_t *tree, avl_tree_node_t *entry);
avl_tree_node_t *SXAPI lb_avl_tree_delete(avl_tree_t *tree, avl_tree_node_t *entry);
void KABI lb_avl_tree_init(avl_tree_t *tree, callback_func_t compare);
void SXAPI lb_avl_tree_init(avl_tree_t *tree, callback_func_t compare);
avl_tree_node_t *KABI lb_avl_tree_largest(avl_tree_t *tree);
avl_tree_node_t *SXAPI lb_avl_tree_largest(avl_tree_t *tree);
avl_tree_node_t *KABI lb_avl_tree_smallest(avl_tree_t *tree);
avl_tree_node_t *SXAPI lb_avl_tree_smallest(avl_tree_t *tree);
avl_tree_node_t *KABI lb_avl_tree_larger(avl_tree_node_t *entry);
avl_tree_node_t *SXAPI lb_avl_tree_larger(avl_tree_node_t *entry);
avl_tree_node_t *KABI lb_avl_tree_smaller(avl_tree_node_t *entry);
avl_tree_node_t *SXAPI lb_avl_tree_smaller(avl_tree_node_t *entry);
bool KABI lb_avl_tree_validate(avl_tree_t *tree);
bool SXAPI lb_avl_tree_validate(avl_tree_t *tree);
int32_t KABI lb_avl_tree_size(avl_tree_t *tree);
int32_t SXAPI lb_avl_tree_size(avl_tree_t *tree);
#endif

View File

@ -20,37 +20,37 @@ typedef struct _linked_list_t
* false otherwise
*/
void KABI lb_linked_list_init(linked_list_t *list);
void SXAPI lb_linked_list_init(linked_list_t *list);
int32_t KABI lb_linked_list_size(linked_list_t *list);
int32_t SXAPI lb_linked_list_size(linked_list_t *list);
void KABI lb_linked_list_push_front(linked_list_t *list, linked_list_node_t *node);
void SXAPI lb_linked_list_push_front(linked_list_t *list, linked_list_node_t *node);
void KABI lb_linked_list_push_back(linked_list_t *list, linked_list_node_t *node);
void SXAPI lb_linked_list_push_back(linked_list_t *list, linked_list_node_t *node);
linked_list_node_t *KABI lb_linked_list_pop_front(linked_list_t *list);
linked_list_node_t *SXAPI lb_linked_list_pop_front(linked_list_t *list);
linked_list_node_t *KABI lb_linked_list_pop_back(linked_list_t *list);
linked_list_node_t *SXAPI lb_linked_list_pop_back(linked_list_t *list);
void KABI lb_linked_list_insert(linked_list_t *list, int32_t index, linked_list_node_t *node);
void SXAPI lb_linked_list_insert(linked_list_t *list, int32_t index, linked_list_node_t *node);
void KABI lb_linked_list_insert_ref(linked_list_t *list, linked_list_node_t *prev_node, linked_list_node_t *node);
void SXAPI lb_linked_list_insert_ref(linked_list_t *list, linked_list_node_t *prev_node, linked_list_node_t *node);
linked_list_node_t *KABI lb_linked_list_remove(linked_list_t *list, int32_t index);
linked_list_node_t *SXAPI lb_linked_list_remove(linked_list_t *list, int32_t index);
linked_list_node_t *KABI lb_linked_list_remove_ref(linked_list_t *list, linked_list_node_t *node);
linked_list_node_t *SXAPI lb_linked_list_remove_ref(linked_list_t *list, linked_list_node_t *node);
linked_list_node_t *KABI lb_linked_list_get(linked_list_t *list, int32_t index);
linked_list_node_t *SXAPI lb_linked_list_get(linked_list_t *list, int32_t index);
linked_list_node_t *KABI lb_linked_list_next(linked_list_node_t *node);
linked_list_node_t *SXAPI lb_linked_list_next(linked_list_node_t *node);
linked_list_node_t *KABI lb_linked_list_prev(linked_list_node_t *node);
linked_list_node_t *SXAPI lb_linked_list_prev(linked_list_node_t *node);
linked_list_node_t *KABI lb_linked_list_first(linked_list_t *list);
linked_list_node_t *SXAPI lb_linked_list_first(linked_list_t *list);
linked_list_node_t *KABI lb_linked_list_last(linked_list_t *list);
linked_list_node_t *SXAPI lb_linked_list_last(linked_list_t *list);
int32_t KABI lb_linked_list_search(linked_list_t *list, linked_list_node_t *target,
int32_t SXAPI lb_linked_list_search(linked_list_t *list, linked_list_node_t *target,
callback_func_t equals);
#endif

View File

@ -3,13 +3,13 @@
#include "type.h"
void KABI lb_salloc_init(void *base, uint32_t size);
void SXAPI lb_salloc_init(void *base, uint32_t size);
void *KABI lb_salloc(void *base, uint32_t size);
void *SXAPI lb_salloc(void *base, uint32_t size);
void KABI lb_sfree(void *base, void *ptr);
void SXAPI lb_sfree(void *base, void *ptr);
bool KABI lb_salloc_assert(void *base, uint32_t *blk_size, bool *blk_free, uint32_t size);
bool SXAPI lb_salloc_assert(void *base, uint32_t *blk_size, bool *blk_free, uint32_t size);
#endif

View File

@ -3,55 +3,55 @@
#include "type.h"
uint32_t KABI lb_rand(void);
uint32_t SXAPI lb_rand(void);
void KABI lb_srand(uint32_t _seed);
void SXAPI lb_srand(uint32_t _seed);
void KABI lb_mrand(uint32_t max);
void SXAPI lb_mrand(uint32_t max);
uint64_t KABI lb_str_len(char const *str);
uint64_t SXAPI lb_str_len(char const *str);
uint64_t KABI lb_str_cmp(char const *str1, char const *str2);
uint64_t SXAPI lb_str_cmp(char const *str1, char const *str2);
void KABI lb_mem_copy(void *src, void *dst, uint64_t size);
void SXAPI lb_mem_copy(void *src, void *dst, uint64_t size);
void KABI lb_mem_move(void *src, void *dst, uint64_t size);
void SXAPI lb_mem_move(void *src, void *dst, uint64_t size);
void KABI lb_mem_set(void *src, uint8_t const val, uint64_t size);
void SXAPI lb_mem_set(void *src, uint8_t const val, uint64_t size);
static inline uint64_t KABI lb_align_down(uint64_t val, uint64_t alignment)
static inline uint64_t SXAPI lb_align_down(uint64_t val, uint64_t alignment)
{
return (val / alignment) * alignment;
}
static inline uint64_t KABI lb_align_up(uint64_t val, uint64_t alignment)
static inline uint64_t SXAPI lb_align_up(uint64_t val, uint64_t alignment)
{
return ((((val) % (alignment)) == 0) ? (((val) / (alignment)) * (alignment)) : (
(((val) / (alignment)) * (alignment)) + 1));
}
static inline uint64_t KABI lb_is_overlap(uint64_t x1, uint64_t x2, uint64_t y1, uint64_t y2)
static inline uint64_t SXAPI lb_is_overlap(uint64_t x1, uint64_t x2, uint64_t y1, uint64_t y2)
{
return ((x1 <= y2) && (y1 <= x2)) ? 1 : 0;
}
static inline int64_t KABI lb_max_64(int64_t a, int64_t b)
static inline int64_t SXAPI lb_max_64(int64_t a, int64_t b)
{
return (a) > (b) ? a : b;
}
static inline int64_t KABI lb_min_64(int64_t a, int64_t b)
static inline int64_t SXAPI lb_min_64(int64_t a, int64_t b)
{
return (a) < (b) ? a : b;
}
static inline int32_t KABI lb_max_32(int32_t a, int32_t b)
static inline int32_t SXAPI lb_max_32(int32_t a, int32_t b)
{
return (a) > (b) ? a : b;
}
static inline int32_t KABI lb_min_32(int32_t a, int32_t b)
static inline int32_t SXAPI lb_min_32(int32_t a, int32_t b)
{
return (a) < (b) ? a : b;
}
@ -85,17 +85,17 @@ static inline uint32_t KAPI log_base_2(uint64_t num)
#define OBTAIN_STRUCT_ADDR(member_addr, struct_name, member_name) ((struct_name*)((uintptr_t)(member_addr) - (uintptr_t)(&(((struct_name*)0)->member_name))))
static inline uint64_t KABI lb_bit_mask(uint32_t bit)
static inline uint64_t SXAPI lb_bit_mask(uint32_t bit)
{
return (uint64_t) 1 << bit;
}
static inline uint64_t KABI lb_bit_field_mask(uint32_t low, uint32_t high)
static inline uint64_t SXAPI lb_bit_field_mask(uint32_t low, uint32_t high)
{
return ~(~(uint64_t) 0 << high << 1) << low;
}
static inline void KABI lb_bit_map_set(void *bit_map, uint64_t bit)
static inline void SXAPI lb_bit_map_set(void *bit_map, uint64_t bit)
{
if (bit_map != NULL)
{
@ -106,7 +106,7 @@ static inline void KABI lb_bit_map_set(void *bit_map, uint64_t bit)
}
}
static inline void KABI lb_bit_map_clear(void *bit_map, uint64_t bit)
static inline void SXAPI lb_bit_map_clear(void *bit_map, uint64_t bit)
{
if (bit_map != NULL)
{
@ -117,7 +117,7 @@ static inline void KABI lb_bit_map_clear(void *bit_map, uint64_t bit)
}
}
static inline uint32_t KABI lb_bit_map_read(void *bit_map, uint64_t bit)
static inline uint32_t SXAPI lb_bit_map_read(void *bit_map, uint64_t bit)
{
if (bit_map != NULL)
{

View File

@ -3,12 +3,12 @@
#include "type.h"
void KABI test_begin(char *name);
void SXAPI test_begin(char *name);
void KABI test_end(void);
void SXAPI test_end(void);
void *KABI talloc(uint32_t size);
void *SXAPI talloc(uint32_t size);
void KABI run_case(char *name, bool result);
void SXAPI run_case(char *name, bool result);
#endif

View File

@ -3,10 +3,10 @@
#include "type.h"
void KABI linked_list_test(void);
void SXAPI linked_list_test(void);
void KABI avl_tree_test(void);
void SXAPI avl_tree_test(void);
void KABI salloc_test(void);
void SXAPI salloc_test(void);
#endif

View File

@ -1,7 +1,7 @@
#ifndef _TYPE_H_
#define _TYPE_H_
#define KABI __attribute__((sysv_abi))
#define SXAPI __attribute__((sysv_abi))
#define UAPI __attribute__((sysv_abi))
#include <stdint.h>

View File

@ -7,7 +7,7 @@
static _Bool alloc_initialized;
static uint8_t alloc_heap[K_KERNEL_HEAP_SIZE];
void KABI ke_alloc_init(void)
void SXAPI ke_alloc_init(void)
{
if (!alloc_initialized)
{
@ -16,12 +16,12 @@ void KABI ke_alloc_init(void)
}
}
void *KABI ke_alloc(uint32_t size)
void *SXAPI ke_alloc(uint32_t size)
{
return alloc_initialized ? lb_salloc(alloc_heap, size) : NULL;
}
void KABI ke_free(void *ptr)
void SXAPI ke_free(void *ptr)
{
if (alloc_initialized)
{

View File

@ -1,17 +1,17 @@
#include "type.h"
#include "kernel/ke/atomic.h"
int32_t KABI ke_interlocked_exchange_32(int32_t *target, int32_t val)
int32_t SXAPI ke_interlocked_exchange_32(int32_t *target, int32_t val)
{
return hal_interlocked_exchange_32(target, val);
}
int32_t KABI ke_interlocked_increment_32(int32_t *target, int32_t increment)
int32_t SXAPI ke_interlocked_increment_32(int32_t *target, int32_t increment)
{
return hal_interlocked_increment_32(target, increment);
}
int32_t KABI ke_interlocked_compare_exchange_32(int32_t *target, int32_t compare, int32_t val)
int32_t SXAPI ke_interlocked_compare_exchange_32(int32_t *target, int32_t compare, int32_t val)
{
return hal_interlocked_compare_exchange_32(target, compare, val);
}

View File

@ -5,7 +5,7 @@
* Kernel entry point
* @param boot_info passed by the bootloader
*/
void KABI ke_main(boot_info_t *boot_info)
void SXAPI ke_main(boot_info_t *boot_info)
{
status_t status = STATUS_SUCCESS;
status = hal_init(boot_info);

View File

@ -2,13 +2,13 @@
#include "kernel/ke/print.h"
#include "kernel/ke/bug_check.h"
void KABI ke_trap(void)
void SXAPI ke_trap(void)
{
while (true)
{};
}
void KABI ke_panic(uint64_t reason)
void SXAPI ke_panic(uint64_t reason)
{
ke_printf("BugCheck: Reason - %ul\n", reason);
ke_trap();

View File

@ -1,25 +1,25 @@
#include "kernel/ke/assert.h"
#include "kernel/ke/intr.h"
irql_t KABI ke_raise_irql(irql_t irql)
irql_t SXAPI ke_raise_irql(irql_t irql)
{
ke_assert(ke_get_irql() <= irql);
return hal_set_irql(irql);
}
irql_t KABI ke_lower_irql(irql_t irql)
irql_t SXAPI ke_lower_irql(irql_t irql)
{
irql_t old_irql = ke_get_irql();
ke_assert(old_irql >= irql);
return hal_set_irql(irql);
}
irql_t KABI ke_get_irql(void)
irql_t SXAPI ke_get_irql(void)
{
return hal_get_irql();
}
int KABI ke_get_current_core(void)
int SXAPI ke_get_current_core(void)
{
return hal_get_core_id();
}

View File

@ -1,6 +1,6 @@
#include "kernel/ke/print.h"
void KABI ke_printf(const char *str, ...)
void SXAPI ke_printf(const char *str, ...)
{
va_list args;
va_start(args, str);
@ -9,7 +9,7 @@ void KABI ke_printf(const char *str, ...)
return;
}
void KABI ke_vprintf(const char *str, va_list args)
void SXAPI ke_vprintf(const char *str, va_list args)
{
hal_vprintf(str, args);
return;

View File

@ -1,7 +1,7 @@
#include "kernel/ke/atomic.h"
#include "kernel/ke/spin_lock.h"
void KABI ke_spin_lock_init(k_spin_lock_t *lock)
void SXAPI ke_spin_lock_init(k_spin_lock_t *lock)
{
if (lock != NULL)
{
@ -9,7 +9,7 @@ void KABI ke_spin_lock_init(k_spin_lock_t *lock)
}
}
void KABI ke_spin_lock(k_spin_lock_t *lock)
void SXAPI ke_spin_lock(k_spin_lock_t *lock)
{
if (lock != NULL)
{
@ -19,7 +19,7 @@ void KABI ke_spin_lock(k_spin_lock_t *lock)
return;
}
void KABI ke_spin_unlock(k_spin_lock_t *lock)
void SXAPI ke_spin_unlock(k_spin_lock_t *lock)
{
if (lock != NULL)
{
@ -28,7 +28,7 @@ void KABI ke_spin_unlock(k_spin_lock_t *lock)
return;
}
irql_t KABI ke_spin_lock_raise_irql(k_spin_lock_t *lock, irql_t irql)
irql_t SXAPI ke_spin_lock_raise_irql(k_spin_lock_t *lock, irql_t irql)
{
irql_t prev_irql = ke_get_irql();
if (lock != NULL)
@ -39,7 +39,7 @@ irql_t KABI ke_spin_lock_raise_irql(k_spin_lock_t *lock, irql_t irql)
return prev_irql;
}
void KABI ke_spin_unlock_lower_irql(k_spin_lock_t *lock, irql_t irql)
void SXAPI ke_spin_unlock_lower_irql(k_spin_lock_t *lock, irql_t irql)
{
if (lock != NULL)
{

View File

@ -49,7 +49,7 @@ static int32_t mmp_base_paddr_compare(void *tree_node, void *my_node)
}
}
status_t KABI sx_pmm_init(pmm_info_t *info)
status_t SXAPI sx_pmm_init(pmm_info_t *info)
{
if (info == NULL)
{
@ -97,7 +97,7 @@ status_t KABI sx_pmm_init(pmm_info_t *info)
// potential callers of these, since timer/interrupts queue DPC, which might trigger
// page fault (kernel heap), therefore, it must set IRQL to DISABLED
status_t KABI mm_alloc_page(uintptr_t *out)
status_t SXAPI mm_alloc_page(uintptr_t *out)
{
if (!initialized)
{
@ -131,7 +131,7 @@ status_t KABI mm_alloc_page(uintptr_t *out)
return result;
}
status_t KABI mm_query_page_attr(uintptr_t base,
status_t SXAPI mm_query_page_attr(uintptr_t base,
int32_t *out)
{
if (!initialized)
@ -168,7 +168,7 @@ status_t KABI mm_query_page_attr(uintptr_t base,
return result;
}
status_t KABI mm_free_page(uintptr_t base)
status_t SXAPI mm_free_page(uintptr_t base)
{
if (!initialized)
{

View File

@ -61,7 +61,7 @@ static handle_node_t *rfp_search_handle_node(handle_t handle)
return result == NULL ? NULL : OBTAIN_STRUCT_ADDR(result, handle_node_t, tree_node);
}
status_t KABI rf_reference_setup(void)
status_t SXAPI rf_reference_setup(void)
{
if (!initialized)
{
@ -73,7 +73,7 @@ status_t KABI rf_reference_setup(void)
return STATUS_SUCCESS;
}
status_t KABI rf_reference_create(ref_node_t *ref,
status_t SXAPI rf_reference_create(ref_node_t *ref,
callback_func_t free_func)
{
ke_assert(ke_get_irql() <= IRQL_DPC_LEVEL);
@ -89,7 +89,7 @@ status_t KABI rf_reference_create(ref_node_t *ref,
return STATUS_SUCCESS;
}
status_t KABI rf_reference_obj(ref_node_t *ref_node)
status_t SXAPI rf_reference_obj(ref_node_t *ref_node)
{
ke_assert(ke_get_irql() <= IRQL_DPC_LEVEL);
@ -105,7 +105,7 @@ status_t KABI rf_reference_obj(ref_node_t *ref_node)
return STATUS_SUCCESS;
}
status_t KABI rf_dereference_obj(ref_node_t *ref_node)
status_t SXAPI rf_dereference_obj(ref_node_t *ref_node)
{
ke_assert(ke_get_irql() <= IRQL_DPC_LEVEL);
@ -129,7 +129,7 @@ status_t KABI rf_dereference_obj(ref_node_t *ref_node)
}
static status_t KABI rf_open_obj_by_handle(handle_t handle, ref_node_t **out)
static status_t SXAPI rf_open_obj_by_handle(handle_t handle, ref_node_t **out)
{
ke_assert(ke_get_irql() <= IRQL_DPC_LEVEL);
@ -173,7 +173,7 @@ static status_t KABI rf_open_obj_by_handle(handle_t handle, ref_node_t **out)
return status;
}
static status_t KABI rf_create_handle(ref_node_t *ref,
static status_t SXAPI rf_create_handle(ref_node_t *ref,
handle_node_t *node,
handle_t *out)
{
@ -226,7 +226,7 @@ static status_t KABI rf_create_handle(ref_node_t *ref,
return result;
}
static status_t KABI rf_close_handle(handle_t handle)
static status_t SXAPI rf_close_handle(handle_t handle)
{
ke_assert(ke_get_irql() <= IRQL_DPC_LEVEL);
@ -273,7 +273,7 @@ static status_t KABI rf_close_handle(handle_t handle)
// SX Functions
// ===========================
status_t KABI sx_create_handle(ref_node_t *ref, handle_t *out)
status_t SXAPI sx_create_handle(ref_node_t *ref, handle_t *out)
{
ke_assert(ke_get_irql() <= IRQL_DPC_LEVEL);
@ -294,7 +294,7 @@ status_t KABI sx_create_handle(ref_node_t *ref, handle_t *out)
return rf_create_handle(ref, node, out);
}
status_t KABI sx_close_handle(handle_t handle)
status_t SXAPI sx_close_handle(handle_t handle)
{
ke_assert(ke_get_irql() <= IRQL_DPC_LEVEL);
@ -308,7 +308,7 @@ status_t KABI sx_close_handle(handle_t handle)
return rf_close_handle(handle);
}
status_t KABI sx_open_obj_by_handle(handle_t handle, ref_node_t **out)
status_t SXAPI sx_open_obj_by_handle(handle_t handle, ref_node_t **out)
{
ke_assert(ke_get_irql() <= IRQL_DPC_LEVEL);

View File

@ -1,11 +1,11 @@
#include "lib/avl_tree.h"
static inline int32_t KABI lbp_avl_tree_node_get_height(avl_tree_node_t *node)
static inline int32_t SXAPI lbp_avl_tree_node_get_height(avl_tree_node_t *node)
{
return node == NULL ? -1 : node->height;
}
static inline int32_t KABI lbp_avl_tree_node_get_balance_factor(avl_tree_node_t *node)
static inline int32_t SXAPI lbp_avl_tree_node_get_balance_factor(avl_tree_node_t *node)
{
if (node == NULL)
{
@ -14,7 +14,7 @@ static inline int32_t KABI lbp_avl_tree_node_get_balance_factor(avl_tree_node_t
return lbp_avl_tree_node_get_height(node->left) - lbp_avl_tree_node_get_height(node->right);
}
static avl_tree_node_t *KABI lbp_avl_tree_node_right_rotate(avl_tree_node_t *root)
static avl_tree_node_t *SXAPI lbp_avl_tree_node_right_rotate(avl_tree_node_t *root)
{
avl_tree_node_t *left_children = root->left;
//adjust parents first
@ -35,7 +35,7 @@ static avl_tree_node_t *KABI lbp_avl_tree_node_right_rotate(avl_tree_node_t *roo
return left_children;
}
static avl_tree_node_t *KABI lbp_avl_tree_node_left_rotate(avl_tree_node_t *root)
static avl_tree_node_t *SXAPI lbp_avl_tree_node_left_rotate(avl_tree_node_t *root)
{
avl_tree_node_t *right_children = root->right;
//adjust parents
@ -57,7 +57,7 @@ static avl_tree_node_t *KABI lbp_avl_tree_node_left_rotate(avl_tree_node_t *root
return right_children;
}
static avl_tree_node_t *KABI lbp_avl_tree_node_balance(avl_tree_node_t *node)
static avl_tree_node_t *SXAPI lbp_avl_tree_node_balance(avl_tree_node_t *node)
{
const int32_t bf = lbp_avl_tree_node_get_balance_factor(node);
@ -101,7 +101,7 @@ static avl_tree_node_t *KABI lbp_avl_tree_node_balance(avl_tree_node_t *node)
}
static avl_tree_node_t *KABI lbp_avl_tree_node_insert(avl_tree_node_t *root, avl_tree_node_t *node,
static avl_tree_node_t *SXAPI lbp_avl_tree_node_insert(avl_tree_node_t *root, avl_tree_node_t *node,
callback_func_t compare,
avl_tree_node_t *parent)
{
@ -288,7 +288,7 @@ static void lbp_avl_tree_swap_nodes(avl_tree_node_t *node1, avl_tree_node_t *nod
return;
}
static avl_tree_node_t *KABI lbp_avl_tree_node_delete(avl_tree_node_t *root,
static avl_tree_node_t *SXAPI lbp_avl_tree_node_delete(avl_tree_node_t *root,
avl_tree_node_t *node,
callback_func_t compare,
avl_tree_node_t **deleted_node)
@ -350,7 +350,7 @@ static avl_tree_node_t *KABI lbp_avl_tree_node_delete(avl_tree_node_t *root,
return root;
}
static avl_tree_node_t *KABI lbp_avl_tree_node_search(avl_tree_node_t *root, avl_tree_node_t *node,
static avl_tree_node_t *SXAPI lbp_avl_tree_node_search(avl_tree_node_t *root, avl_tree_node_t *node,
callback_func_t compare)
{
if (root == NULL || compare == NULL)
@ -376,7 +376,7 @@ static avl_tree_node_t *KABI lbp_avl_tree_node_search(avl_tree_node_t *root, avl
}
static void KABI lbp_avl_tree_node_init(avl_tree_node_t *it)
static void SXAPI lbp_avl_tree_node_init(avl_tree_node_t *it)
{
if (it != NULL)
{
@ -389,7 +389,7 @@ static void KABI lbp_avl_tree_node_init(avl_tree_node_t *it)
}
avl_tree_node_t *KABI lb_avl_tree_smallest(avl_tree_t *tree)
avl_tree_node_t *SXAPI lb_avl_tree_smallest(avl_tree_t *tree)
{
if (tree == NULL)
{
@ -407,7 +407,7 @@ avl_tree_node_t *KABI lb_avl_tree_smallest(avl_tree_t *tree)
return entry;
}
avl_tree_node_t *KABI lb_avl_tree_largest(avl_tree_t *tree)
avl_tree_node_t *SXAPI lb_avl_tree_largest(avl_tree_t *tree)
{
if (tree == NULL)
{
@ -426,7 +426,7 @@ avl_tree_node_t *KABI lb_avl_tree_largest(avl_tree_t *tree)
}
avl_tree_node_t *KABI lb_avl_tree_larger(avl_tree_node_t *it)
avl_tree_node_t *SXAPI lb_avl_tree_larger(avl_tree_node_t *it)
{
if (it == NULL)
{
@ -456,7 +456,7 @@ avl_tree_node_t *KABI lb_avl_tree_larger(avl_tree_node_t *it)
}
}
avl_tree_node_t *KABI lb_avl_tree_smaller(avl_tree_node_t *it)
avl_tree_node_t *SXAPI lb_avl_tree_smaller(avl_tree_node_t *it)
{
if (it == NULL)
{
@ -486,13 +486,13 @@ avl_tree_node_t *KABI lb_avl_tree_smaller(avl_tree_node_t *it)
}
}
avl_tree_node_t *KABI lb_avl_tree_search(avl_tree_t *tree, avl_tree_node_t *node)
avl_tree_node_t *SXAPI lb_avl_tree_search(avl_tree_t *tree, avl_tree_node_t *node)
{
return lbp_avl_tree_node_search(tree->root, node, tree->compare);
}
void KABI lb_avl_tree_insert(avl_tree_t *tree, avl_tree_node_t *data)
void SXAPI lb_avl_tree_insert(avl_tree_t *tree, avl_tree_node_t *data)
{
if (tree != NULL && data != NULL)
{
@ -502,7 +502,7 @@ void KABI lb_avl_tree_insert(avl_tree_t *tree, avl_tree_node_t *data)
return;
}
avl_tree_node_t *KABI lb_avl_tree_delete(avl_tree_t *tree, avl_tree_node_t *data)
avl_tree_node_t *SXAPI lb_avl_tree_delete(avl_tree_t *tree, avl_tree_node_t *data)
{
avl_tree_node_t *node = NULL;
if (tree != NULL && data != NULL)
@ -512,7 +512,7 @@ avl_tree_node_t *KABI lb_avl_tree_delete(avl_tree_t *tree, avl_tree_node_t *data
return node;
}
int32_t KABI lb_avl_tree_size(avl_tree_t *tree)
int32_t SXAPI lb_avl_tree_size(avl_tree_t *tree)
{
if (tree == NULL)
{
@ -532,7 +532,7 @@ int32_t KABI lb_avl_tree_size(avl_tree_t *tree)
return size;
}
void KABI lb_avl_tree_init(avl_tree_t *tree, callback_func_t compare)
void SXAPI lb_avl_tree_init(avl_tree_t *tree, callback_func_t compare)
{
if (tree != NULL)
{
@ -546,7 +546,7 @@ void KABI lb_avl_tree_init(avl_tree_t *tree, callback_func_t compare)
// TESTING STUFF
static int32_t KABI lbp_avl_tree_node_calculate_height(avl_tree_node_t *tree)
static int32_t SXAPI lbp_avl_tree_node_calculate_height(avl_tree_node_t *tree)
{
if (tree == NULL)
{
@ -556,7 +556,7 @@ static int32_t KABI lbp_avl_tree_node_calculate_height(avl_tree_node_t *tree)
1;
}
static bool KABI lbp_avl_tree_node_test(avl_tree_node_t *tree, callback_func_t compare)
static bool SXAPI lbp_avl_tree_node_test(avl_tree_node_t *tree, callback_func_t compare)
{
if (tree == NULL)
{
@ -592,7 +592,7 @@ static bool KABI lbp_avl_tree_node_test(avl_tree_node_t *tree, callback_func_t c
return lbp_avl_tree_node_test(tree->left, compare) && lbp_avl_tree_node_test(tree->right, compare);
}
bool KABI lb_avl_tree_validate(avl_tree_t *tree)
bool SXAPI lb_avl_tree_validate(avl_tree_t *tree)
{
if (tree == NULL)
{

View File

@ -1,6 +1,6 @@
#include "lib/linked_list.h"
static void KABI lbp_init_linked_list_node(linked_list_node_t *node)
static void SXAPI lbp_init_linked_list_node(linked_list_node_t *node)
{
if (node != NULL)
{
@ -10,7 +10,7 @@ static void KABI lbp_init_linked_list_node(linked_list_node_t *node)
return;
}
static void KABI lbp_append_node(linked_list_node_t *target, linked_list_node_t *node)
static void SXAPI lbp_append_node(linked_list_node_t *target, linked_list_node_t *node)
{
if (target == NULL || node == NULL)
{
@ -35,7 +35,7 @@ static void KABI lbp_append_node(linked_list_node_t *target, linked_list_node_t
}
// link target with node, suppose target is in the current list
static void KABI lbp_prepend_node(linked_list_node_t *target, linked_list_node_t *node)
static void SXAPI lbp_prepend_node(linked_list_node_t *target, linked_list_node_t *node)
{
if (target == NULL || node == NULL)
{
@ -59,7 +59,7 @@ static void KABI lbp_prepend_node(linked_list_node_t *target, linked_list_node_t
return;
}
static void KABI lbp_unlink_node(linked_list_node_t *node)
static void SXAPI lbp_unlink_node(linked_list_node_t *node)
{
if (node == NULL)
{
@ -79,7 +79,7 @@ static void KABI lbp_unlink_node(linked_list_node_t *node)
return;
}
void KABI lb_linked_list_init(linked_list_t *list)
void SXAPI lb_linked_list_init(linked_list_t *list)
{
if (list != NULL)
{
@ -89,7 +89,7 @@ void KABI lb_linked_list_init(linked_list_t *list)
return;
}
int32_t KABI lb_linked_list_size(linked_list_t *list)
int32_t SXAPI lb_linked_list_size(linked_list_t *list)
{
if (list == NULL)
{
@ -110,7 +110,7 @@ int32_t KABI lb_linked_list_size(linked_list_t *list)
return size;
}
void KABI lb_linked_list_push_front(linked_list_t *list, linked_list_node_t *node)
void SXAPI lb_linked_list_push_front(linked_list_t *list, linked_list_node_t *node)
{
if (list == NULL || node == NULL)
{
@ -124,7 +124,7 @@ void KABI lb_linked_list_push_front(linked_list_t *list, linked_list_node_t *nod
return;
}
void KABI lb_linked_list_push_back(linked_list_t *list, linked_list_node_t *node)
void SXAPI lb_linked_list_push_back(linked_list_t *list, linked_list_node_t *node)
{
if (list == NULL || node == NULL)
{
@ -138,7 +138,7 @@ void KABI lb_linked_list_push_back(linked_list_t *list, linked_list_node_t *node
return;
}
linked_list_node_t *KABI lb_linked_list_pop_front(linked_list_t *list)
linked_list_node_t *SXAPI lb_linked_list_pop_front(linked_list_t *list)
{
if (list == NULL)
{
@ -147,7 +147,7 @@ linked_list_node_t *KABI lb_linked_list_pop_front(linked_list_t *list)
return lb_linked_list_remove_ref(list, list->head);
}
linked_list_node_t *KABI lb_linked_list_pop_back(linked_list_t *list)
linked_list_node_t *SXAPI lb_linked_list_pop_back(linked_list_t *list)
{
if (list == NULL)
{
@ -158,7 +158,7 @@ linked_list_node_t *KABI lb_linked_list_pop_back(linked_list_t *list)
}
void KABI lb_linked_list_insert_ref(linked_list_t *list, linked_list_node_t *prev_node, linked_list_node_t *node)
void SXAPI lb_linked_list_insert_ref(linked_list_t *list, linked_list_node_t *prev_node, linked_list_node_t *node)
{
if (list == NULL || node == NULL)
{
@ -195,7 +195,7 @@ void KABI lb_linked_list_insert_ref(linked_list_t *list, linked_list_node_t *pre
}
}
void KABI lb_linked_list_insert(linked_list_t *list, int32_t index, linked_list_node_t *node)
void SXAPI lb_linked_list_insert(linked_list_t *list, int32_t index, linked_list_node_t *node)
{
if (list == NULL || index < 0 || node == NULL)
{
@ -219,7 +219,7 @@ void KABI lb_linked_list_insert(linked_list_t *list, int32_t index, linked_list_
return;
}
linked_list_node_t *KABI lb_linked_list_remove(linked_list_t *list, int32_t index)
linked_list_node_t *SXAPI lb_linked_list_remove(linked_list_t *list, int32_t index)
{
if (list == NULL || index < 0)
{
@ -235,7 +235,7 @@ linked_list_node_t *KABI lb_linked_list_remove(linked_list_t *list, int32_t inde
return lb_linked_list_remove_ref(list, cur_node);
}
linked_list_node_t *KABI lb_linked_list_remove_ref(linked_list_t *list, linked_list_node_t *node)
linked_list_node_t *SXAPI lb_linked_list_remove_ref(linked_list_t *list, linked_list_node_t *node)
{
if (list == NULL || node == NULL)
{
@ -259,7 +259,7 @@ linked_list_node_t *KABI lb_linked_list_remove_ref(linked_list_t *list, linked_l
return node;
}
linked_list_node_t *KABI lb_linked_list_get(linked_list_t *list, int32_t index)
linked_list_node_t *SXAPI lb_linked_list_get(linked_list_t *list, int32_t index)
{
if (list == NULL || index < 0 || list->head == NULL)
{
@ -271,7 +271,7 @@ linked_list_node_t *KABI lb_linked_list_get(linked_list_t *list, int32_t index)
return cur_node;
}
linked_list_node_t *KABI lb_linked_list_next(linked_list_node_t *node)
linked_list_node_t *SXAPI lb_linked_list_next(linked_list_node_t *node)
{
if (node != NULL)
{
@ -280,7 +280,7 @@ linked_list_node_t *KABI lb_linked_list_next(linked_list_node_t *node)
return node;
}
linked_list_node_t *KABI lb_linked_list_prev(linked_list_node_t *node)
linked_list_node_t *SXAPI lb_linked_list_prev(linked_list_node_t *node)
{
if (node != NULL)
{
@ -289,7 +289,7 @@ linked_list_node_t *KABI lb_linked_list_prev(linked_list_node_t *node)
return node;
}
linked_list_node_t *KABI lb_linked_list_first(linked_list_t *list)
linked_list_node_t *SXAPI lb_linked_list_first(linked_list_t *list)
{
linked_list_node_t *result = NULL;
if (list != NULL)
@ -299,7 +299,7 @@ linked_list_node_t *KABI lb_linked_list_first(linked_list_t *list)
return result;
}
linked_list_node_t *KABI lb_linked_list_last(linked_list_t *list)
linked_list_node_t *SXAPI lb_linked_list_last(linked_list_t *list)
{
linked_list_node_t *result = NULL;
if (list != NULL)
@ -309,7 +309,7 @@ linked_list_node_t *KABI lb_linked_list_last(linked_list_t *list)
return result;
}
int32_t KABI lb_linked_list_search(linked_list_t *list, linked_list_node_t *target,
int32_t SXAPI lb_linked_list_search(linked_list_t *list, linked_list_node_t *target,
callback_func_t equals)
{
if (list == NULL || target == NULL)

View File

@ -86,7 +86,7 @@ static void lbp_salloc_join(void *base)
}
}
bool KABI lb_salloc_assert(void *base, uint32_t *blk_size, bool *blk_free, uint32_t size)
bool SXAPI lb_salloc_assert(void *base, uint32_t *blk_size, bool *blk_free, uint32_t size)
{
if (base == NULL || blk_free == NULL || blk_size == NULL)
{
@ -115,7 +115,7 @@ bool KABI lb_salloc_assert(void *base, uint32_t *blk_size, bool *blk_free, uint3
}
}
void KABI lb_salloc_init(void *base, uint32_t size)
void SXAPI lb_salloc_init(void *base, uint32_t size)
{
if (base != NULL && size >= sizeof(_salloc_header))
{
@ -127,7 +127,7 @@ void KABI lb_salloc_init(void *base, uint32_t size)
return;
}
void *KABI lb_salloc(void *base, uint32_t size)
void *SXAPI lb_salloc(void *base, uint32_t size)
{
void *result = NULL;
if (base != NULL && size != 0)
@ -186,7 +186,7 @@ void *KABI lb_salloc(void *base, uint32_t size)
return result;
}
void KABI lb_sfree(void *base, void *ptr)
void SXAPI lb_sfree(void *base, void *ptr)
{
if (base != NULL && ptr != NULL)
{

View File

@ -1,7 +1,7 @@
#include "type.h"
#include "lib/sxtdlib.h"
void KABI lb_mem_copy(void *src, void *dst, uint64_t size)
void SXAPI lb_mem_copy(void *src, void *dst, uint64_t size)
{
if (src == NULL || dst == NULL)
{
@ -16,7 +16,7 @@ void KABI lb_mem_copy(void *src, void *dst, uint64_t size)
return;
}
void KABI lb_mem_set(void *src, uint8_t const val, uint64_t size)
void SXAPI lb_mem_set(void *src, uint8_t const val, uint64_t size)
{
if (src == NULL)
{
@ -30,7 +30,7 @@ void KABI lb_mem_set(void *src, uint8_t const val, uint64_t size)
return;
}
void KABI lb_mem_move(void *src, void *dst, uint64_t size)
void SXAPI lb_mem_move(void *src, void *dst, uint64_t size)
{
if (src == NULL || dst == NULL)
{
@ -58,18 +58,18 @@ void KABI lb_mem_move(void *src, void *dst, uint64_t size)
static uint32_t seed = 1;
static uint32_t max = 16777215;
uint32_t KABI lb_rand(void)
uint32_t SXAPI lb_rand(void)
{
seed = seed * 1103512986 + 29865;
return (unsigned int) (seed / 65536) % (max + 1);
}
void KABI lb_srand(uint32_t _seed)
void SXAPI lb_srand(uint32_t _seed)
{
seed = _seed;
}
void KABI lb_mrand(uint32_t _max)
void SXAPI lb_mrand(uint32_t _max)
{
max = _max;
}
@ -78,7 +78,7 @@ void KABI lb_mrand(uint32_t _max)
// String Library
//
uint64_t KABI lb_str_len(char const *str)
uint64_t SXAPI lb_str_len(char const *str)
{
uint64_t length = 0;
if (str == NULL)
@ -93,7 +93,7 @@ uint64_t KABI lb_str_len(char const *str)
return length;
}
uint64_t KABI lb_str_cmp(char const *str1, char const *str2)
uint64_t SXAPI lb_str_cmp(char const *str1, char const *str2)
{
if (str1 == NULL || str2 == NULL)
{

View File

@ -84,7 +84,7 @@ static void ginfo_push(char *case_name, bool success)
ke_printf("GINFO full, [%s] result not recorded.\n", r_case_name);
}
void KABI test_begin(char *name)
void SXAPI test_begin(char *name)
{
test_name = (name == NULL ? "Anonymous Test" : name);
for (int i = 0; i < GAT_SIZE; i++)
@ -97,7 +97,7 @@ void KABI test_begin(char *name)
}
}
void KABI test_end(void)
void SXAPI test_end(void)
{
gat_free();
int32_t total = 0, failed = 0, success = 0;
@ -135,7 +135,7 @@ void KABI test_end(void)
}
}
void KABI *talloc(uint32_t size)
void SXAPI *talloc(uint32_t size)
{
if (!gat_full())
{
@ -151,7 +151,7 @@ void KABI *talloc(uint32_t size)
return NULL;
}
void KABI run_case(char *name, bool result)
void SXAPI run_case(char *name, bool result)
{
ginfo_push(name, result);
}

View File

@ -439,7 +439,7 @@ static bool search_test(void)
}
void KABI linked_list_test(void)
void SXAPI linked_list_test(void)
{
test_begin("Linked list test");
run_case("insert_test_beginning", insert_test_beginning());

View File

@ -256,7 +256,7 @@ static bool salloc_free_all(void)
}
void KABI salloc_test(void)
void SXAPI salloc_test(void)
{
test_begin("salloc test");