Add hulk.linker_addresses module
This commit is contained in:
parent
bf9a005dbc
commit
153a8d43f1
@ -6,8 +6,7 @@ module hulk.hippo;
|
|||||||
import hulk.header;
|
import hulk.header;
|
||||||
import hulk.bootinfo;
|
import hulk.bootinfo;
|
||||||
import hulk.klog;
|
import hulk.klog;
|
||||||
|
import hulk.linker_addresses;
|
||||||
extern extern(C) ubyte * _hulk_bss_size;
|
|
||||||
|
|
||||||
struct hippo
|
struct hippo
|
||||||
{
|
{
|
||||||
@ -50,7 +49,7 @@ struct hippo
|
|||||||
size_t usable_memory;
|
size_t usable_memory;
|
||||||
ulong[2][5] reserved = [
|
ulong[2][5] reserved = [
|
||||||
[header.bootinfo.hulk_phys, cast(ulong)header.total_size],
|
[header.bootinfo.hulk_phys, cast(ulong)header.total_size],
|
||||||
[header.bootinfo.bss_phys, cast(ulong)&_hulk_bss_size],
|
[header.bootinfo.bss_phys, LinkerAddresses.hulk_bss_size],
|
||||||
[header.bootinfo.stack_phys, header.stack_size],
|
[header.bootinfo.stack_phys, header.stack_size],
|
||||||
[cast(ulong)header.bootinfo.fb.buffer, header.bootinfo.fb.height * header.bootinfo.fb.stride],
|
[cast(ulong)header.bootinfo.fb.buffer, header.bootinfo.fb.height * header.bootinfo.fb.stride],
|
||||||
[header.bootinfo.pt_phys, header.bootinfo.pt_size],
|
[header.bootinfo.pt_phys, header.bootinfo.pt_size],
|
||||||
|
@ -3,37 +3,45 @@ SECTIONS
|
|||||||
. = 0xFFFF800000000000;
|
. = 0xFFFF800000000000;
|
||||||
_hulk_mem_start = .;
|
_hulk_mem_start = .;
|
||||||
|
|
||||||
.hulk_header BLOCK(4K) : ALIGN(4K)
|
.hulk_header :
|
||||||
{
|
{
|
||||||
*(.hulk_header)
|
*(.hulk_header)
|
||||||
}
|
}
|
||||||
_hulk_header_size = . - _hulk_mem_start;
|
|
||||||
|
|
||||||
.text BLOCK(4K) : ALIGN(4K)
|
. = ALIGN(4K);
|
||||||
|
_hulk_text_start = .;
|
||||||
|
|
||||||
|
.text :
|
||||||
{
|
{
|
||||||
*(.text)
|
*(.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
.rodata BLOCK(4K) : ALIGN(4K)
|
. = ALIGN(4K);
|
||||||
|
_hulk_text_end = .;
|
||||||
|
|
||||||
|
.rodata :
|
||||||
{
|
{
|
||||||
*(.rodata)
|
*(.rodata)
|
||||||
}
|
}
|
||||||
|
|
||||||
.data BLOCK(4K) : ALIGN(4K)
|
. = ALIGN(4K);
|
||||||
|
|
||||||
|
.data :
|
||||||
{
|
{
|
||||||
*(.data)
|
*(.data)
|
||||||
}
|
}
|
||||||
|
|
||||||
.bss BLOCK(4K) : ALIGN(4K)
|
. = ALIGN(4K);
|
||||||
{
|
|
||||||
_hulk_bss_start = .;
|
_hulk_bss_start = .;
|
||||||
|
|
||||||
|
.bss :
|
||||||
|
{
|
||||||
*(COMMON)
|
*(COMMON)
|
||||||
*(.bss)
|
*(.bss)
|
||||||
}
|
}
|
||||||
_hulk_bss_size = . - _hulk_bss_start;
|
|
||||||
|
|
||||||
. = ALIGN(4K);
|
. = ALIGN(4K);
|
||||||
|
_hulk_bss_size = . - _hulk_bss_start;
|
||||||
_hulk_mem_end = .;
|
_hulk_mem_end = .;
|
||||||
_hulk_total_size = _hulk_mem_end - _hulk_mem_start;
|
_hulk_total_size = _hulk_mem_end - _hulk_mem_start;
|
||||||
}
|
}
|
||||||
|
41
src/hulk/linker_addresses.d
Normal file
41
src/hulk/linker_addresses.d
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
* This module provides access to linker-defined symbols.
|
||||||
|
*/
|
||||||
|
module hulk.linker_addresses;
|
||||||
|
|
||||||
|
private extern extern(C) __gshared ubyte _hulk_mem_start;
|
||||||
|
private extern extern(C) __gshared ubyte _hulk_bss_start;
|
||||||
|
private extern extern(C) __gshared ubyte _hulk_bss_size;
|
||||||
|
private extern extern(C) __gshared ubyte _hulk_mem_end;
|
||||||
|
private extern extern(C) __gshared ubyte _hulk_total_size;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This struct provides access to linker-defined symbols.
|
||||||
|
*/
|
||||||
|
public struct LinkerAddresses
|
||||||
|
{
|
||||||
|
public static @property ulong hulk_mem_start()
|
||||||
|
{
|
||||||
|
return cast(ulong)&_hulk_mem_start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static @property ulong hulk_bss_start()
|
||||||
|
{
|
||||||
|
return cast(ulong)&_hulk_bss_start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static @property ulong hulk_bss_size()
|
||||||
|
{
|
||||||
|
return cast(ulong)&_hulk_bss_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static @property ulong hulk_mem_end()
|
||||||
|
{
|
||||||
|
return cast(ulong)&_hulk_mem_end;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static @property ulong hulk_total_size()
|
||||||
|
{
|
||||||
|
return cast(ulong)&_hulk_total_size;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user