From fcfc849dd5fd121b02c40d744adb109a94566804 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Tue, 7 Jul 2015 06:26:56 +0200 Subject: [PATCH] 5e: make sure stack base is aligned to avoid unaligned memory trap on arm --- sys/src/cmd/5e/proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/src/cmd/5e/proc.c b/sys/src/cmd/5e/proc.c index b1ef6dc9b..1ef8d0872 100644 --- a/sys/src/cmd/5e/proc.c +++ b/sys/src/cmd/5e/proc.c @@ -220,7 +220,7 @@ loadtext(char *file, int argc, char **argv) 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");