1 #ifndef __LUNAIX_BSTAGE_H
2 #define __LUNAIX_BSTAGE_H
3 #include <lunaix/types.h>
4 #include <lunaix/boot_generic.h>
6 extern ptr_t __multiboot_addr;
8 extern u8_t __kboot_start[];
9 extern u8_t __kboot_end[];
11 #define boot_text __attribute__((section(".boot.text")))
12 #define boot_data __attribute__((section(".boot.data")))
13 #define boot_bss __attribute__((section(".boot.bss")))
16 Bridge the far symbol to the vicinity.
18 Which is a workaround for relocation
19 issue where symbol define in kernel
20 code is too far away from the boot code.
22 #ifdef CONFIG_ARCH_X86_64
23 #define __bridge_farsym(far_sym) \
25 ".section .boot.data\n" \
27 ".globl __lc_" #far_sym "\n" \
28 "__lc_" #far_sym ":\n" \
29 ".8byte " #far_sym "\n" \
32 extern unsigned long __lc_##far_sym[];
33 #define bridge_farsym(far_sym) __bridge_farsym(far_sym)
35 #define ___far(far_sym) (__lc_##far_sym[0])
36 #define __far(far_sym) ___far(far_sym)
39 #define __bridge_farsym(far_sym) extern unsigned long far_sym[]
40 #define ___far(far_sym) ((ptr_t)far_sym)
41 #define bridge_farsym(far_sym) __bridge_farsym(far_sym);
42 #define __far(far_sym) ___far(far_sym)
49 #endif /* __LUNAIX_BSTAGE_H */