diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-05-30 23:26:21 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-05-30 23:26:21 +0200 |
commit | d94ffb4808670993b2c434d612d432548c693832 (patch) | |
tree | ded3f05af0c1c46b5c8a7e5bfae405fe76b34ad2 /sys/src/9/bcm | |
parent | 9652f5bec54d946775892249c83059c9ca0c6440 (diff) |
kernel: do all fp state fork from procfork() (like pc kernel)
this simplifies the arm ports and keeps all the stuff in one place
instead of spreading it thru notify(), trap() and syscall() functions
and prevents useless fp state copying for kernel procs.
also make sure to save fp in notify while still splhi().
Diffstat (limited to 'sys/src/9/bcm')
-rw-r--r-- | sys/src/9/bcm/fns.h | 3 | ||||
-rw-r--r-- | sys/src/9/bcm/vfp3.c | 49 |
2 files changed, 23 insertions, 29 deletions
diff --git a/sys/src/9/bcm/fns.h b/sys/src/9/bcm/fns.h index 1c480cc14..cca55de35 100644 --- a/sys/src/9/bcm/fns.h +++ b/sys/src/9/bcm/fns.h @@ -82,9 +82,8 @@ extern void fpunoted(void); extern void fpunotify(Ureg*); extern void fpuprocrestore(Proc*); extern void fpuprocsave(Proc*); +extern void fpuprocfork(Proc*); extern void fpusysprocsetup(Proc*); -extern void fpusysrfork(Ureg*); -extern void fpusysrforkchild(Proc*, Ureg*, Proc*); extern int fpuemu(Ureg*); /* * Things called from port. diff --git a/sys/src/9/bcm/vfp3.c b/sys/src/9/bcm/vfp3.c index e87cf1d32..77070ba1c 100644 --- a/sys/src/9/bcm/vfp3.c +++ b/sys/src/9/bcm/vfp3.c @@ -239,33 +239,6 @@ fpunoted(void) up->fpstate &= ~FPillegal; } -/* - * Called early in the non-interruptible path of - * sysrfork() via the machine-dependent syscall() routine. - * Save the state so that it can be easily copied - * to the child process later. - */ -void -fpusysrfork(Ureg*) -{ - if(up->fpstate == FPactive){ - fpsave(&up->fpsave); - up->fpstate = FPinactive; - } -} - -/* - * Called later in sysrfork() via the machine-dependent - * sysrforkchild() routine. - * Copy the parent FPU state to the child. - */ -void -fpusysrforkchild(Proc *p, Ureg *, Proc *up) -{ - /* don't penalize the child, it hasn't done FP in a note handler. */ - p->fpstate = up->fpstate & ~FPillegal; -} - /* should only be called if p->fpstate == FPactive */ void fpsave(FPsave *fps) @@ -333,6 +306,28 @@ fpuprocrestore(Proc *) } /* + * The current process has been forked, + * save and copy neccesary state to child. + */ +void +fpuprocfork(Proc *p) +{ + int s; + + s = splhi(); + switch(up->fpstate & ~FPillegal){ + case FPactive: + fpsave(&up->fpsave); + up->fpstate = FPinactive; + /* no break */ + case FPinactive: + p->fpsave = up->fpsave; + p->fpstate = FPinactive; + } + splx(s); +} + +/* * Disable the FPU. * Called from sysexec() via sysprocsetup() to * set the FPU for the new process. |