X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/f09e806d5032150564df39a2f7b1192c4d84cf15..f6ab9c9ababa2cf6e5c723b83ffb9362094054e8:/lunaix-os/link/linker.ld diff --git a/lunaix-os/link/linker.ld b/lunaix-os/link/linker.ld index 4ea6b4e..52ce3eb 100644 --- a/lunaix-os/link/linker.ld +++ b/lunaix-os/link/linker.ld @@ -1,78 +1,115 @@ ENTRY(start_) -/* - FUTURE: Use disk reader - A bit of messy here. - We will pull our higher half kernel out of this shit - and load it separately once we have our disk reader. -*/ - SECTIONS { . = 0x100000; /* 这里是我们的高半核初始化代码段和数据段 */ + .boot.text BLOCK(4K) : { + *(.multiboot) + *(.boot.text) + } - .hhk_init_text BLOCK(4K) : { - * (.multiboot) - arch/*.o (.hhk_init) - arch/*.o (.text) + .boot.bss BLOCK(4K) : { + *(.boot.bss) } - .hhk_init_bss BLOCK(4K) : { - arch/*.o (.bss) + .boot.data BLOCK(4K) : { + *(.boot.data) } - .hhk_init_data BLOCK(4K) : { - arch/*.o (.data) + .boot.rodata BLOCK(4K) : { + *(.boot.rodata) } - .hhk_init_rodata BLOCK(4K) : { - arch/*.o (.rodata) + .boot.bss BLOCK(4K) : { + *(.boot.rodata) } - __init_hhk_end = ALIGN(4K); + __kexec_boot_end = ALIGN(4K); + + /* ---- boot end ---- */ + + /* ---- kernel start ---- */ - /* Relocation of our higher half kernel */ . += 0xC0000000; /* 好了,我们的内核…… */ .text BLOCK(4K) : AT ( ADDR(.text) - 0xC0000000 ) { - __kernel_start = .; - kernel/*.o (.text) - hal/*.o (.text) - debug/*.o (.text) - libs/*.o (.text) - } + __kexec_start = .; + PROVIDE(__kexec_text_start = .); + + *(.text) - __usrtext_start = ALIGN(4K); - .usrtext BLOCK(4K) : AT ( ADDR(.usrtext) - 0xC0000000 ) { - * (.usrtext) + PROVIDE(__kexec_text_end = .); } - __usrtext_end = ALIGN(4K); .data BLOCK(4K) : AT ( ADDR(.data) - 0xC0000000 ) { - kernel/*.o (.data) - hal/*.o (.data) - debug/*.o (.data) - libs/*.o (.data) + *(.data) } .rodata BLOCK(4K) : AT ( ADDR(.rodata) - 0xC0000000 ) { - kernel/*.o (.rodata) - hal/*.o (.rodata) - debug/*.o (.rodata) - libs/*.o (.rodata) + *(.rodata) } .kpg BLOCK(4K) : AT ( ADDR(.kpg) - 0xC0000000 ) { - arch/*.o (.kpg) + *(.kpg) + } + + . = ALIGN(4K); + + /* for generated array, we align to address line size */ + + .lga BLOCK(4K) : AT ( ADDR(.lga) - 0xC0000000 ) { + PROVIDE(__lga_twiplugin_inits_start = .); + + KEEP(*(.lga.twiplugin_inits)); + + PROVIDE(__lga_twiplugin_inits_end = .); + + /* ---- */ + + /* align to 8 bytes, so it can cover both 32 and 64 bits address line*/ + . = ALIGN(8); + + PROVIDE(__lga_pci_dev_drivers_start = .); + + KEEP(*(.lga.pci_dev_drivers)); + + PROVIDE(__lga_pci_dev_drivers_end = .); + + /* ---- */ + + . = ALIGN(8); + + PROVIDE(__lga_rtcdev_start = .); + + KEEP(*(.lga.rtcdev)); + + PROVIDE(__lga_rtcdev_end = .); + + /* ---- */ + + . = ALIGN(8); + + PROVIDE(__lga_inputdev_start = .); + + KEEP(*(.lga.inputdev)); + + PROVIDE(__lga_inputdev_end = .); + + /* ---- */ + + . = ALIGN(8); + + PROVIDE(__lga_pseudo_dev_start = .); + + KEEP(*(.lga.pseudo_dev)); + + PROVIDE(__lga_pseudo_dev_end = .); } .bss BLOCK(4K) : AT ( ADDR(.bss) - 0xC0000000 ) { - kernel/*.o (.bss) - hal/*.o (.bss) - debug/*.o (.bss) - libs/*.o (.bss) + *(.bss) } - __kernel_end = ALIGN(4K); + __kexec_end = ALIGN(4K); } \ No newline at end of file