Put debug test stack in data instead of text
[riscv-tests.git] / debug / programs / entry.S
index 866636b1b50b7e052faaf150ae62752623a9f68d..3acd786cc226d367ddc109cb03a53e11f2601b45 100755 (executable)
@@ -1,9 +1,6 @@
-#ifndef ENTRY_S
-#define ENTRY_S
-
 #include "encoding.h"
 
-#define STACK_SIZE 1024
+#define STACK_SIZE (90 * XLEN / 8)
 
 #if XLEN == 64
 # define LREG ld
@@ -62,10 +59,11 @@ handle_reset:
 .option pop
 
   # Initialize stack pointer.
-  # Support up to 4 harts, with IDs 0--3.
+  # Give each hart STACK_SIZE of stack.
+  # Assume hart IDs are contiguous and start at 0.
   csrr  t0, CSR_MHARTID
   addi  t0, t0, 1
-  li    t1, STACK_SIZE / 4
+  li    t1, STACK_SIZE
   mul   t0, t0, t1
   la    sp, stack_bottom
   add   sp, sp, t0
@@ -108,6 +106,7 @@ wait_until_initialized:      # Wait for hart 0 to perform initialization.
   j     _init
 
 
+.align 2
 trap_entry:
   addi sp, sp, -32*REGBYTES
 
@@ -192,10 +191,10 @@ loop_forever:
   j loop_forever
 
   // Fill the stack with data so we can see if it was overrun.
+  .section .data
   .align 4
 stack_bottom:
-  .fill STACK_SIZE/4, 4, 0x22446688
+  .fill NHARTS * STACK_SIZE/4, 4, 0x22446688
 stack_top:
 initialized:
   .word 0
-#endif