summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2015-04-01 01:30:16 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2015-04-01 01:30:16 +0200
commitebf85fb7b75f0bdc3cb27693641bc34c11ca7bed (patch)
tree4cd81823ab4db780db70ca3e3f8888876fc554fa
parent2a03ed80e4fc52c327e47e1749c97b4e2c1aa1d8 (diff)
downloadplan9front-ebf85fb7b75f0bdc3cb27693641bc34c11ca7bed.tar.xz
vl: prevent stack altering instructions to be hoisted above loads
fixes bug with libmemdraw where the linker would hoist the final ADD $const, SP at the end over loads from the stack causing the front to fall off once a interrupt hits.
-rw-r--r--sys/src/cmd/vl/sched.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/src/cmd/vl/sched.c b/sys/src/cmd/vl/sched.c
index efa88a755..7537cf1c6 100644
--- a/sys/src/cmd/vl/sched.c
+++ b/sys/src/cmd/vl/sched.c
@@ -85,7 +85,7 @@ sched(Prog *p0, Prog *pe)
for(t=s+1; t<=se; t++) {
if(!(t->p.mark & LOAD))
continue;
- if(t->p.mark & BRANCH)
+ if(t->p.mark & BRANCH || t->set.ireg & (1<<REGSP))
break;
if(conflict(s, t))
break;
@@ -102,7 +102,7 @@ sched(Prog *p0, Prog *pe)
/* put schedule fodder above load */
for(t=s+1; t<=se; t++) {
- if(t->p.mark & BRANCH)
+ if(t->p.mark & BRANCH || t->set.ireg & (1<<REGSP))
break;
if(s > sch && conflict(s-1, t))
continue;
@@ -634,7 +634,6 @@ offoverlap(Sch *sa, Sch *sb)
int
conflict(Sch *sa, Sch *sb)
{
-
if(sa->set.ireg & sb->used.ireg)
return 1;
if(sa->set.freg & sb->used.freg)