1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
#include "u.h"
#include "../port/lib.h"
#include "mem.h"
#include "dat.h"
#include "fns.h"
int
fpudevprocio(Proc* proc, void* a, long n, uintptr offset, int write)
{
/*
* Called from procdevtab.read and procdevtab.write
* allow user process access to the FPU registers.
* This is the only FPU routine which is called directly
* from the port code; it would be nice to have dynamic
* creation of entries in the device file trees...
*/
USED(proc, a, n, offset, write);
return 0;
}
void
fpunotify(Ureg*)
{
/*
* Called when a note is about to be delivered to a
* user process, usually at the end of a system call.
* Note handlers are not allowed to use the FPU so
* the state is marked (after saving if necessary) and
* checked in the Device Not Available handler.
*/
}
void
fpunoted(void)
{
/*
* Called from sysnoted() via the machine-dependent
* noted() routine.
* Clear the flag set above in fpunotify().
*/
}
void
fpuprocsave(Proc*)
{
/*
* Called from sched() and sleep() via the machine-dependent
* procsave() routine.
* About to go in to the scheduler.
* If the process wasn't using the FPU
* there's nothing to do.
*/
}
void
fpuprocrestore(Proc*)
{
/*
* The process has been rescheduled and is about to run.
* Nothing to do here right now. If the process tries to use
* the FPU again it will cause a Device Not Available
* exception and the state will then be restored.
*/
}
void
fpuprocfork(Proc*)
{
/*
* The current process has been forked, save and copy neccesary
* state to child. Nothing to do here, child proc starts with FPinit.
*/
}
void
fpusysprocsetup(Proc*)
{
/*
* Disable the FPU.
* Called from sysexec() via sysprocsetup() to
* set the FPU for the new process.
*/
}
void
fpuinit(void)
{
}
int
fpuemu(Ureg* ureg)
{
int nfp;
if(waserror()){
splhi();
postnote(up, 1, up->errstr, NDebug);
return 1;
}
spllo();
nfp = fpiarm(ureg);
splhi();
poperror();
return nfp;
}
|