add seperate sections

This commit is contained in:
Quinten Kock 2020-12-26 23:23:43 +01:00
parent 940f077480
commit c7b7137292
2 changed files with 25 additions and 2 deletions

View File

@ -12,22 +12,30 @@ SECTIONS
.text ALIGN(4K) :
{
_text_start = .;
/* KEEP(*(.text*)) */
}
_text_end = .;
.rodata ALIGN(4K) :
{
_rodata_start = .;
/* KEEP(*(.rodata*)) */
}
_rodata_end = .;
.data ALIGN(4K) :
{
_data_start = .;
/* KEEP(*(.data*)) */
}
_data_end = .;
.bss ALIGN(4K) :
{
_bss_start = .;
/* KEEP(*(COMMON)) */
/* KEEP(*(.bss*)) */
}
_bss_end = .;
}

View File

@ -31,9 +31,24 @@ struct stivale2_header header2 = {
.tags = (uint64_t)&smp_request
};
extern void* _text_start;
extern void* _text_end;
extern void* _rodata_start;
extern void* _rodata_end;
extern void* _data_start;
extern void* _data_end;
extern void* _bss_start;
extern void* _bss_end;
void stivale2_main(struct stivale2_struct *info) {
parse_stivale2(info);
// print_stivale2_memmap(info);
print_stivale2_memmap(info);
printf("text section: %x-%x\n", &_text_start, &_text_end);
printf("rodata section: %x-%x\n", &_rodata_start, &_rodata_end);
printf("data section: %x-%x\n", &_data_start, &_data_end);
printf("bss section: %x-%x\n", &_bss_start, &_bss_end);
uint64_t* cr3;
__asm__ __volatile__ (
@ -45,7 +60,7 @@ void stivale2_main(struct stivale2_struct *info) {
printf("PAGE TABLE AT: %x\n", cr3);
loadgdt();
print_gdt();
// print_gdt();
setup_ints();