summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2017-11-16 23:15:08 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2017-11-16 23:15:08 +0100
commit435a9a150ea5d3eae891503be0224ea9c9d29bab (patch)
treec5075fa60c1733a216ed75a7102aba3801027083
parent859d5c9146a31c65c538ce799ed3eccd30e1e78d (diff)
downloadplan9front-435a9a150ea5d3eae891503be0224ea9c9d29bab.tar.xz
9pc64: handle special case in fpurestore() for procexec()/procsetup()
when a process does an exec, it calls procsetup() which unconditionally sets the sets the TS flag and fpstate=FPinit and fpurestore() should not revert the fpstate.
-rw-r--r--sys/src/9/pc64/main.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/sys/src/9/pc64/main.c b/sys/src/9/pc64/main.c
index 458ff0c16..c6580c63d 100644
--- a/sys/src/9/pc64/main.c
+++ b/sys/src/9/pc64/main.c
@@ -721,16 +721,14 @@ void
fpurestore(int ostate)
{
int astate = up->fpstate;
- if((astate & ~(FPnouser|FPkernel|FPindexm)) == FPactive)
- _stts();
- if((astate & FPindexm) == (ostate & FPindexm)){
- if((ostate & ~(FPnouser|FPkernel|FPindexm)) == FPactive){
- if((astate & ~(FPpush|FPnouser|FPkernel|FPindexm)) != FPactive)
- goto saved;
+ if(astate == (FPpush | (ostate & ~FPillegal))){
+ if((ostate & ~(FPnouser|FPkernel|FPindexm)) == FPactive)
_clts();
- }
} else {
- saved:
+ if(astate == FPinit) /* don't restore on procexec()/procsetup() */
+ return;
+ if((astate & ~(FPnouser|FPkernel|FPindexm)) == FPactive)
+ _stts();
up->fpsave = up->fpslot[ostate>>FPindexs];
ostate = FPinactive | (ostate & (FPillegal|FPpush|FPnouser|FPkernel|FPindexm));
}