shithub: riscv

Download patch

ref: 1cff9ab4e8412d5c6b6a3cbca720fbc4bcccecd9
parent: a7925e3ecb2b58c19e52c7ea36f041aab1407398
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Wed Mar 25 09:56:04 EDT 2015

ape: fix main9 for mips

--- a/sys/src/ape/lib/ap/mips/main9.s
+++ b/sys/src/ape/lib/ap/mips/main9.s
@@ -10,26 +10,24 @@
 
 	/* _tos = arg */
 	MOVW	R1, _tos(SB)
-/*
-	MOVW	$0,FCR31
-	NOR	R0,R0
-	MOVD	$0.5, F26
-	SUBD	F26, F26, F24
-	ADDD	F26, F26, F28
-	ADDD	F28, F28, F30
-*/
-	MOVW	$12(SP), R1
+
+	MOVW	$p-68(SP), R1
 	MOVW	R1, _errnoloc(SB)
-	MOVW	$16(SP), R1
+	ADDU	$4, R1
 	MOVW	R1, _privates(SB)
 	MOVW	$NPRIVATES, R1
 	MOVW	R1, _nprivates(SB)
 
 	JAL	_envsetup(SB)
+
+	/* main(argc, argv, environ); */
 	MOVW	inargc-4(FP), R1
 	MOVW	$inargv+0(FP), R2
+	MOVW	environ(SB), R3
 	MOVW	R1, 4(R29)
 	MOVW	R2, 8(R29)
+	MOVW	R3, 12(R29)
+
 	JAL	main(SB)
 loop:
 	MOVW	R1, 4(R29)
--- a/sys/src/ape/lib/ap/mips/main9p.s
+++ b/sys/src/ape/lib/ap/mips/main9p.s
@@ -10,19 +10,12 @@
 
 	/* _tos = arg */
 	MOVW	R1, _tos(SB)
-/*
-	MOVW	$0,FCR31
-	NOR	R0,R0
-	MOVD	$0.5, F26
-	SUBD	F26, F26, F24
-	ADDD	F26, F26, F28
-	ADDD	F28, F28, F30
-*/
-	MOVW	$12(SP), R1
+
+	MOVW	$p-68(SP), R1
 	MOVW	R1, _errnoloc(SB)
-	MOVW	$16(SP), R1
+	ADDU	$4, R1
 	MOVW	R1, _privates(SB)
-	MOVW	$NPRIVATES, R1
+	MOVW	$(NPRIVATES-1), R1
 	MOVW	R1, _nprivates(SB)
 
 	/* _profmain(); */