Browse Source

riscv: get private variables working

This is important for anything threaded. We did it the way
amd64 did it, i.e. put it on the stack.

The privates test now passes.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Ronald G. Minnich 7 years ago
parent
commit
6e524bc143
1 changed files with 8 additions and 0 deletions
  1. 8 0
      sys/src/libc/riscv/main9.S

+ 8 - 0
sys/src/libc/riscv/main9.S

@@ -8,7 +8,15 @@ _main:
 	sd      a2,%lo(_tos)(a5)
 	ld	a0, 0(sp)
 	addi	a1, sp, 8
+	addi    sp, sp, -128
+	lui     a5,%hi(_privates)
+	sd      sp,%lo(_privates)(a5)
+
+	li      a3, 16
+	lui     a5,%hi(_nprivates)
+	sd      a3,%lo(_nprivates)(a5)
 	j main
+	addi    sp, sp, 128
 ////        auipc   gp,0xfffff
 //        addi    gp,gp,_gp
 	ret