shithub: riscv

Download patch

ref: f75bbcdd45358ac00fdf07d0107c87390b28c4cb
parent: 451b0c7976df9036ee84ad2e51f698dbe7562873
author: aiju <devnull@localhost>
date: Fri Sep 28 18:53:24 EDT 2018

5e: byte access incorrectly checked for long; brk has to round up addresses

--- a/sys/src/cmd/5e/arm.c
+++ b/sys/src/cmd/5e/arm.c
@@ -124,7 +124,7 @@
 		addr += offset;
 	if((instr & fB) == 0)
 		addr = evenaddr(addr, 3);
-	targ = vaddr(addr, 4, &seg);
+	targ = vaddr(addr, (instr & fB) == 0 ? 4 : 1, &seg);
 	switch(instr & (fB | fL)) {
 	case 0:
 		*(u32int*) targ = *Rd;
--- a/sys/src/cmd/5e/sys.c
+++ b/sys/src/cmd/5e/sys.c
@@ -254,6 +254,7 @@
 	v = arg(0);
 	if(systrace)
 		fprint(2, "brk(%#lux)\n", v);
+	v = v + 7 & -8;
 	if(v >= P->S[SEGSTACK]->start)
 		sysfatal("bss > stack, wtf?");
 	if(v < P->S[SEGBSS]->start)