Add HULK header; map virtual memory for HULK bss section

This commit is contained in:
josh committed 2022-03-21 16:31:01 -04:00
1 parent c58284761a
commit 15559b0a56
5 files changed
+59 -20

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
/**
* HULK image header.
*/
module hulk.header;
/**
* Header describing the HULK image.
*/
struct Header
{
/**
* Total size of memory to be mapped.
*
* The OS loader must ensure that virtual memory is mapped for this entire
* size.
* This value is really an integer, but is stored as a pointer because it
* is provided by the linker and LDC does not like us to cast it.
*/
void * total_size;
/** Entry point. */
void * entry;
}
+9 -1
View File
@@ -3,16 +3,24 @@
*/
module hulk.hulk;
import hulk.header;
import hulk.bootinfo;
import hos.memory;
import ldc.attributes;
extern extern(C) __gshared ubyte _hulk_total_size;
@(ldc.attributes.section(".hulk_header"))
private __gshared Header hulk_header = {
&_hulk_total_size,
&hulk_start,
};
/**
* HULK entry point.
*
* @param bootinfo Pointer to HULK boot information structure.
*/
@(ldc.attributes.section(".hulk_start"))
extern(C) void hulk_start(ulong rdi, ulong rsi, ulong rdx, BootInfo * bootinfo)
{
for (size_t y = 100u; y < 120u; y++)
+7 -8
View File
@@ -1,21 +1,19 @@
ENTRY(hulk_start)
SECTIONS
{
. = 0x0000400000000000;
_hulk_mem_start = .;
.text BLOCK(4K) : ALIGN(4K)
{
*(.hulk_start)
*(.text)
}
.rodata BLOCK(4K) : ALIGN(4K)
{
*(.hulk_header)
*(.rodata)
}
.text BLOCK(4K) : ALIGN(4K)
{
*(.text)
}
.data BLOCK(4K) : ALIGN(4K)
{
*(.data)
@@ -30,4 +28,5 @@ SECTIONS
. = ALIGN(4K);
_hulk_mem_end = .;
_hulk_total_size = _hulk_mem_end - _hulk_mem_start;
}