Skip to content

Commit

Permalink
rmode: add {.text,.data,.bss}.rmode section for real mode
Browse files Browse the repository at this point in the history
Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
  • Loading branch information
wipawel committed Feb 12, 2021
1 parent 1caf010 commit 0cb0d1c
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
28 changes: 28 additions & 0 deletions arch/x86/link.ld
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,34 @@ SECTIONS
*(.multiboot)
} :init

.text.rmode BLOCK(4K) : ALIGN(4K)
{
. = ALIGN(4K);
__start_text_rmode = .;
*(.text.rmode)
. = ALIGN(4K);
__end_text_rmode = .;
} :init

.bss.rmode BLOCK(4K) : ALIGN(4K)
{
. = ALIGN(4K);
__start_bss_rmode = .;
*(.bss.rmode)
*(COMMON.rmode)
. = ALIGN(4K);
__end_bss_rmode = .;
} :init

.data.rmode BLOCK(4K) : ALIGN(4K)
{
. = ALIGN(4K);
__start_data_rmode = .;
*(.data.rmode)
. = ALIGN(4K);
__end_data_rmode = .;
} :init

.note :
{
. = ALIGN(4K);
Expand Down
4 changes: 4 additions & 0 deletions include/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ typedef uint64_t off_t;
#define __data_init __section(".data.init")
#define __bss_init __section(".bss.init")

#define __text_rmode __section(".text.rmode")
#define __data_rmode __section(".data.rmode")
#define __bss_rmode __section(".bss.rmode")

#define IS_INIT_SECTION(name) \
((name) && (!strcmp(name, ".text.init") || !strcmp(name, ".data.init") || \
!strcmp(name, ".bss.init")))
Expand Down
3 changes: 3 additions & 0 deletions include/mm/pmm.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ extern unsigned long __start_data_init[], __end_data_init[];
extern unsigned long __start_bss_init[], __end_bss_init[];

extern unsigned long __start_rmode[], __end_rmode[];
extern unsigned long __start_text_rmode[], __end_text_rmode[];
extern unsigned long __start_data_rmode[], __end_data_rmode[];
extern unsigned long __start_bss_rmode[], __end_bss_rmode[];

extern struct ktf_param __start_cmdline[], __end_cmdline[];

Expand Down
3 changes: 3 additions & 0 deletions mm/pmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ addr_range_t addr_ranges[] = {
IDENT_RANGE( ".bss.init", L1_PROT, __start_bss_init, __end_bss_init ),

IDENT_RANGE( ".rmode", L1_PROT, __start_rmode, __end_rmode ),
IDENT_RANGE( ".text.rmode", L1_PROT_RO, __start_text_rmode, __end_text_rmode),
IDENT_RANGE( ".data.rmode", L1_PROT, __start_data_rmode, __end_data_rmode),
IDENT_RANGE( ".bss.rmode", L1_PROT, __start_bss_rmode, __end_bss_rmode ),

USER_RANGE( ".text.user", L1_PROT_USER_RO, __start_text_user, __end_text_user ),
USER_RANGE( ".data.user", L1_PROT_USER, __start_data_user, __end_data_user ),
Expand Down

0 comments on commit 0cb0d1c

Please sign in to comment.