feat: start of paging setup

This commit is contained in:
2022-05-14 17:01:10 +02:00
parent e850dabc8b
commit 6c32c430d0
7 changed files with 224 additions and 112 deletions

114
linker.ld
View File

@@ -6,66 +6,76 @@ ENTRY(_start)
kernel image. */
SECTIONS
{
/* Begin putting sections at 1 MiB, a conventional place for kernels to be
loaded at by the bootloader. */
. = 1M;
_kernel_start = .;
/* Begin putting sections at 1 MiB, a conventional place for kernels to be
loaded at by the bootloader. */
. = 1M;
_kernel_start = .;
.data.boot ALIGN(4K) : {
*(.multiboot)
*(.data.boot)
}
.text.boot ALIGN(4K) : {
*(.text.boot)
}
.bss.boot ALIGN(4K) : {
*(.bss.boot)
}
/* First put the multiboot header, as it is required to be put very early
early in the image or the bootloader won't recognize the file format.
Next we'll put the .text section. */
.text BLOCK(4K) : ALIGN(4K)
{
*(.multiboot)
*(.text)
}
. += 0xC0000000;
/* First put the multiboot header, as it is required to be put very early
early in the image or the bootloader won't recognize the file format.
Next we'll put the .text section. */
.text ALIGN(4K) : AT(ADDR(.text)-0xC0000000)
{
*(.text)
}
/* Read-only data. */
.rodata BLOCK(4K) : ALIGN(4K)
{
*(.rodata)
}
/* Read-only data. */
.rodata ALIGN(4K) : AT(ADDR(.rodata)-0xC0000000)
{
*(.rodata)
}
/* Read-write data (initialized) */
.data BLOCK(4K) : ALIGN(4K)
{
*(.data)
/* Read-write data (initialized) */
.data ALIGN(4K) : AT(ADDR(.data)-0xC0000000)
{
*(.data)
. = ALIGN(16);
__start_pci_driver = .;
*(SORT(.pci_driver.*))
__stop_pci_driver = .;
. = ALIGN(16);
__start_pci_driver = .;
*(SORT(.pci_driver.*))
__stop_pci_driver = .;
. = ALIGN(16);
__start_block_dev_driver = .;
*(SORT(.block_dev_driver.*))
__stop_block_dev_driver = .;
. = ALIGN(16);
__start_block_dev_driver = .;
*(SORT(.block_dev_driver.*))
__stop_block_dev_driver = .;
. = ALIGN(16);
__start_vfs_driver = .;
*(SORT(.vfs_driver.*))
__stop_vfs_driver = .;
. = ALIGN(16);
__start_vfs_driver = .;
*(SORT(.vfs_driver.*))
__stop_vfs_driver = .;
. = ALIGN(16);
__start_init = .;
*(SORT(.init.*))
__stop_init = .;
}
. = ALIGN(16);
__start_init = .;
*(SORT(.init.*))
__stop_init = .;
}
/* Read-write data (uninitialized) and stack */
.bss BLOCK(4K) : ALIGN(4K)
{
*(COMMON)
*(.bss)
}
_kernel_end = .;
/* Read-write data (uninitialized) and stack */
.bss ALIGN(4K) : AT(ADDR(.bss)-0xC0000000)
{
*(COMMON)
*(.bss)
}
_kernel_end = . - 0xC0000000;
/DISCARD/ : {
*(.eh_frame);
*(.comment);
*(.note.gnu.build-id);
}
/DISCARD/ : {
*(.eh_frame);
*(.comment);
*(.note.gnu.build-id);
}
/* The compiler may produce other sections, by default it will put them in
a segment with the same name. Simply add stuff here as needed. */
/* The compiler may produce other sections, by default it will put them in
a segment with the same name. Simply add stuff here as needed. */
}