ref: fcfc849dd5fd121b02c40d744adb109a94566804
parent: 20e255110cddf657898f84f9bd82bb1c8463b6aa
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Jul 7 02:26:56 EDT 2015
5e: make sure stack base is aligned to avoid unaligned memory trap on arm
--- a/sys/src/cmd/5e/proc.c
+++ b/sys/src/cmd/5e/proc.c
@@ -220,7 +220,7 @@
text = newseg(fp.txtaddr - fp.hdrsz, fp.txtsz + fp.hdrsz, SEGTEXT);
data = newseg(fp.dataddr, fp.datsz, SEGDATA);
bss = newseg(fp.dataddr + fp.datsz, fp.bsssz, SEGBSS);
- newseg(mach->utop - STACKSIZE, STACKSIZE, SEGSTACK);
+ newseg((mach->utop & ~7) - STACKSIZE, STACKSIZE, SEGSTACK);
seek(fd, fp.txtoff - fp.hdrsz, 0);
if(readn(fd, text->data, fp.txtsz + fp.hdrsz) < fp.txtsz + fp.hdrsz)
sysfatal("%r");