ref: ebf85fb7b75f0bdc3cb27693641bc34c11ca7bed
parent: 2a03ed80e4fc52c327e47e1749c97b4e2c1aa1d8
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Mar 31 21:30:16 EDT 2015
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.
--- a/sys/src/cmd/vl/sched.c
+++ b/sys/src/cmd/vl/sched.c
@@ -85,7 +85,7 @@
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 @@
/* 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 @@
int
conflict(Sch *sa, Sch *sb)
{
-
if(sa->set.ireg & sb->used.ireg)
return 1;
if(sa->set.freg & sb->used.freg)