Procházet zdrojové kódy

Allocate stacks for all the harts

Vadim Kaushan před 6 roky
rodič
revize
b04261e0a9
1 změnil soubory, kde provedl 6 přidání a 0 odebrání
  1. 6 0
      riscv-rt/link.x

+ 6 - 0
riscv-rt/link.x

@@ -1,5 +1,7 @@
 PROVIDE(_stext = ORIGIN(REGION_TEXT));
 PROVIDE(_stack_start = ORIGIN(REGION_STACK) + LENGTH(REGION_STACK));
+PROVIDE(_max_hart_id = 0);
+PROVIDE(_hart_stack_size = 2K);
 PROVIDE(_heap_size = 0);
 
 PROVIDE(trap_handler = default_trap_handler);
@@ -131,6 +133,10 @@ ASSERT(_stext + SIZEOF(.text) < ORIGIN(REGION_TEXT) + LENGTH(REGION_TEXT), "
 ERROR(riscv-rt): The .text section must be placed inside the REGION_TEXT region.
 Set _stext to an address smaller than 'ORIGIN(REGION_TEXT) + LENGTH(REGION_TEXT)'");
 
+ASSERT(SIZEOF(.stack) > (_max_hart_id + 1) * _hart_stack_size, "
+ERROR(riscv-rt): .stack section is too small for allocating stacks for all the harts.
+Consider changing `_max_hart_id` or `_hart_stack_size`.");
+
 ASSERT(SIZEOF(.got) == 0, "
 .got section detected in the input files. Dynamic relocations are not
 supported. If you are linking to C code compiled using the `gcc` crate