Does not link. After moving to the virtual address space, the linker is freaking out at all the defined 32 bit symbols for the multiboot loader.

This commit is contained in:
secXsQuared1995 2017-02-01 01:58:21 -08:00
parent 53195f144d
commit 1788338f10
11 changed files with 21 additions and 18 deletions

View File

@ -4,6 +4,9 @@
#include "g_abi.h"
#include "g_type.h"
extern void KABI ke_printf(const char*, ...);
//TODO: Get rid of this
#include "hal_print.h"
#define ke_printf(x, ...) hal_printf(x, __VA_ARGS__)
#endif

View File

@ -90,7 +90,7 @@ ret
; ============================
; int32_t KAPI hal_interlocked_compare_exchange_32(int32_t *dst, int32_t compare, int32_t val);
global hal_interlocked_compare_exchange_32
hal_interlocked_exchange:
hal_interlocked_compare_exchange_32:
mov eax, esi; eax = compare
lock cmpxchg dword [rdi], edx ; edx = val, rdi = ptr to dst
ret
@ -98,7 +98,7 @@ ret
; ============================
; int32_t KAPI hal_interlocked_increment_32(int32_t *target, int32_t increment);
global hal_interlocked_increment_32
hal_interlocked_increment:
hal_interlocked_increment_32:
lock xadd dword [rdi], esi ; [rdi] = [rdi] + esi, esi = old [rdi]
xor rax, rax
mov eax, esi

View File

@ -13,7 +13,7 @@ MULTIBOOT_HEADER_ALIGNMENT equ 8
MULTIBOOT_LOADED_MAGIC equ 0x36d76289
MULTIBOOT_MAGIC_NUMBER equ 0xE85250D6
MULTIBOOT_ARCH equ 0
MULTIBOOT_CHECK_SUM equ -(MULTIBOOT_MAGIC_NUMBER + MULTIBOOT_HEADER_SIZE + MULTIBOOT_ARCH)
MULTIBOOT_CHECK_SUM equ (0xFFFFFFFF - (MULTIBOOT_MAGIC_NUMBER + MULTIBOOT_HEADER_SIZE + MULTIBOOT_ARCH) + 1)
;align MULTIBOOT_HEADER_ALIGNMENT
MULTIBOOT_HEADER:
@ -121,7 +121,7 @@ hlt
.loaded_by_grub:
; set stack pointer
mov esp, KERNEL_STACK
mov esp, 0
; save multiboot_info*
mov esi,ebx
@ -230,7 +230,7 @@ mov gs,ax
mov ss,ax
; align 16 bytes like this for now
mov rsp,KERNEL_STACK
mov rsp, 0
mov rdi,rsi ; multiboot_info*
call hal_main
hlt
@ -246,5 +246,4 @@ times KERNEL_HEAP_SIZE db 0 ; initially 8k heap
[SECTION .stack]
[BITS 64]
align 4096 ;4k alignment
times KERNEL_STACK_SIZE db 0 ; initially 8k stack
KERNEL_STACK:
times KERNEL_STACK_SIZE db 0 ; initially 8k stack

View File

@ -7,7 +7,7 @@
#include "hal_mem.h"
#include "hal_intr.h"
#include "hal_arch.h"
#include "../lib/inc/sxtdlib.h"
#include "sxtdlib.h"
#include "s_boot.h"
extern char kernel_start[];

View File

@ -1,9 +1,10 @@
#include <hal_intr.h>
#include "hal_intr.h"
#include "hal_arch.h"
#include "s_atomic.h"
#include "s_boot.h"
#include "s_context.h"
#include "s_intr.h"
#include "s_print.h"
int32_t KABI ke_interlocked_increment_32(int32_t *target, int32_t increment)
{
@ -40,4 +41,4 @@ void KABI ke_halt_cpu()
int32_t KABI ke_get_core_id()
{
return hal_get_core_id();
}
}

View File

@ -6,7 +6,7 @@
#include "g_abi.h"
#include "g_type.h"
#include "hal_mem.h"
#include "../lib/inc/salloc.h"
#include "salloc.h"
#include "hal_arch.h"
#include "hal_intr.h"

View File

@ -4,7 +4,7 @@
*/
#include "g_abi.h"
#include "../lib/inc/sxtdlib.h"
#include "sxtdlib.h"
#include "hal_print.h"
static uint64_t text_pos;

View File

@ -8,7 +8,7 @@
#include "g_abi.h"
#include "g_type.h"
#include "../../lib/inc/linked_list.h"
#include "linked_list.h"
#define GDT_ENTRY_SIZE 8
#define GDT_ENTRY_NUM 9

View File

@ -1,5 +1,5 @@
#include "k_test_driver.h"
#include "../lib/inc/avl_tree.h"
#include "avl_tree.h"
typedef struct
{

View File

@ -1,7 +1,7 @@
#include "k_test_driver.h"
#include "../lib/inc/linked_list.h"
#include "linked_list.h"
#include "k_lib_test.h"
#include "../lib/inc/sxtdlib.h"
#include "sxtdlib.h"
typedef struct
{

View File

@ -1,5 +1,5 @@
#include "k_test_driver.h"
#include "../lib/inc/salloc.h"
#include "salloc.h"
typedef union
{