kernel.ld: slight rewrite, use memory regions for ram instead of static offset
This commit is contained in:
parent
6f5746a805
commit
57be90da84
1 changed files with 11 additions and 10 deletions
|
@ -1,14 +1,13 @@
|
||||||
OUTPUT_ARCH( "riscv" )
|
OUTPUT_ARCH( "riscv" )
|
||||||
ENTRY( _entry ) /* See: entry.S */
|
ENTRY( _entry ) /* See: entry.S */
|
||||||
|
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
RAM (rwx) : ORIGIN = 0x80000000, LENGTH = 128M
|
||||||
|
}
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* ensure that entry.S / _entry is at 0x80000000,
|
|
||||||
* where qemu's -kernel jumps.
|
|
||||||
*/
|
|
||||||
. = 0x80000000;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This section contains the code. This is, the machine language instructions
|
* This section contains the code. This is, the machine language instructions
|
||||||
* that will be executed by the processor. In here we will find symbols
|
* that will be executed by the processor. In here we will find symbols
|
||||||
|
@ -35,7 +34,7 @@ SECTIONS
|
||||||
|
|
||||||
/* Define symbol etext to be the current location. */
|
/* Define symbol etext to be the current location. */
|
||||||
PROVIDE(etext = .);
|
PROVIDE(etext = .);
|
||||||
} :text
|
} > RAM :text
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This contains any data that is marked as read only.
|
* This contains any data that is marked as read only.
|
||||||
|
@ -47,7 +46,7 @@ SECTIONS
|
||||||
*(.srodata*) /* do not need to distinguish this from .rodata */
|
*(.srodata*) /* do not need to distinguish this from .rodata */
|
||||||
. = ALIGN(16);
|
. = ALIGN(16);
|
||||||
*(.rodata*)
|
*(.rodata*)
|
||||||
}
|
} > RAM
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This section contains initialized global and static variables.
|
* This section contains initialized global and static variables.
|
||||||
|
@ -58,7 +57,7 @@ SECTIONS
|
||||||
*(.sdata*) /* do not need to distinguish this from .data */
|
*(.sdata*) /* do not need to distinguish this from .data */
|
||||||
. = ALIGN(16);
|
. = ALIGN(16);
|
||||||
*(.data*)
|
*(.data*)
|
||||||
}
|
} > RAM
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Contains all uninitialized global and static var iables. These are usually
|
* Contains all uninitialized global and static var iables. These are usually
|
||||||
|
@ -71,10 +70,12 @@ SECTIONS
|
||||||
*(.sbss*) /* do not need to distinguish this from .bss */
|
*(.sbss*) /* do not need to distinguish this from .bss */
|
||||||
. = ALIGN(16);
|
. = ALIGN(16);
|
||||||
*(.bss*)
|
*(.bss*)
|
||||||
}
|
} > RAM
|
||||||
|
|
||||||
/* Define symbol end as current location, note that this is not aligned, see vm.c */
|
/* Define symbol end as current location, note that this is not aligned, see vm.c */
|
||||||
PROVIDE(kernel_end = .);
|
PROVIDE(kernel_end = .);
|
||||||
|
PROVIDE(__heap_start = ALIGN(32));
|
||||||
|
PROVIDE(__heap_end = ORIGIN(RAM) + LENGTH(RAM));
|
||||||
}
|
}
|
||||||
|
|
||||||
PHDRS {
|
PHDRS {
|
||||||
|
|
Loading…
Add table
Reference in a new issue