MentOS  0.8.0
The Mentoring Operating System
fpu.h
Go to the documentation of this file.
1 #pragma once
12 
13 #include "stdint.h"
14 
16 typedef struct env87 {
18  long en_cw;
20  long en_sw;
22  long en_tw;
24  long en_fip;
26  unsigned short en_fcs;
28  unsigned short en_opcode;
30  long en_foo;
32  long en_fos;
34 
36 typedef struct fpacc87 {
38  unsigned char fp_bytes[10];
40 
42 typedef struct save87 {
48  unsigned char sv_pad0[4];
49  /*
50  * Bogus padding for emulators. Emulators should use their own
51  * struct and arrange to store into this struct (ending here)
52  * before it is inspected for ptracing or for core dumps. Some
53  * emulators overwrite the whole struct. We have no good way of
54  * knowing how much padding to leave. Leave just enough for the
55  * GPL emulator's i387_union (176 bytes total).
56  */
58  unsigned char sv_pad[64];
60 
62 typedef struct envxmm {
88 
90 typedef struct xmmacc {
92  unsigned char xmm_bytes[16];
94 
96 typedef struct savexmm {
100  struct {
104  unsigned char fp_pad[6];
105  } sv_fp[8];
109  unsigned char sv_pad[224];
110 } __attribute__((__aligned__(16))) savexmm;
111 
113 typedef union savefpu {
119 
122 void switch_fpu(void);
123 
126 void unswitch_fpu(void);
127 
130 int fpu_install(void);
131 
struct save87 save87
Floating point context.
struct fpacc87 fpacc87
Contents of each floating point accumulator.
int fpu_install(void)
Enable the FPU context handling.
Definition: fpu.c:170
struct envxmm envxmm
Stores the XMM environment.
struct xmmacc xmmacc
Contents of each SSE extended accumulator.
void unswitch_fpu(void)
Called during a context switch to load the FPU registers status of the currently running thread insid...
Definition: fpu.c:165
struct env87 env87
Environment information of floating point unit.
void switch_fpu(void)
Called during a context switch to save the FPU registers status of the currently running thread.
Definition: fpu.c:160
union savefpu savefpu
Stores FPU registers details.
Standard integer data-types.
unsigned short uint16_t
Define the unsigned 16-bit integer.
Definition: stdint.h:24
unsigned int uint32_t
Define the unsigned 32-bit integer.
Definition: stdint.h:18
Environment information of floating point unit.
Definition: fpu.h:16
long en_foo
Floating operand offset.
Definition: fpu.h:30
long en_fip
Floating point instruction pointer.
Definition: fpu.h:24
long en_sw
Status word (16bits).
Definition: fpu.h:20
unsigned short en_fcs
Floating code segment selector.
Definition: fpu.h:26
long en_fos
Floating operand segment selector.
Definition: fpu.h:32
unsigned short en_opcode
Opcode last executed (11 bits).
Definition: fpu.h:28
long en_cw
Control word (16bits).
Definition: fpu.h:18
long en_tw
Tag word (16bits).
Definition: fpu.h:22
Stores the XMM environment.
Definition: fpu.h:62
uint32_t en_foo
Floating operand offset.
Definition: fpu.h:78
uint32_t en_mxcsr
SSE sontorol/status register.
Definition: fpu.h:84
uint16_t en_pad1
Padding.
Definition: fpu.h:82
uint16_t en_sw
Status word (16bits).
Definition: fpu.h:66
uint16_t en_opcode
Opcode last executed (11 bits).
Definition: fpu.h:70
uint16_t en_cw
Control word (16bits).
Definition: fpu.h:64
uint32_t en_fip
Floating point instruction pointer.
Definition: fpu.h:72
uint16_t en_pad0
Padding.
Definition: fpu.h:76
uint16_t en_tw
Tag word (16bits).
Definition: fpu.h:68
uint32_t en_mxcsr_mask
Valid bits in mxcsr.
Definition: fpu.h:86
uint16_t en_fcs
Floating code segment selector.
Definition: fpu.h:74
uint16_t en_fos
Floating operand segment selector.
Definition: fpu.h:80
Contents of each floating point accumulator.
Definition: fpu.h:36
unsigned char fp_bytes[10]
Easy to access bytes.
Definition: fpu.h:38
Floating point context.
Definition: fpu.h:42
env87 sv_env
Floating point control/status.
Definition: fpu.h:44
unsigned char sv_pad[64]
Padding used by emulators.
Definition: fpu.h:58
fpacc87 sv_ac[8]
Accumulator contents, 0-7.
Definition: fpu.h:46
unsigned char sv_pad0[4]
Padding for (now unused) saved status word.
Definition: fpu.h:48
Stores the XMM context.
Definition: fpu.h:96
unsigned char sv_pad[224]
Padding.
Definition: fpu.h:109
unsigned char fp_pad[6]
Padding.
Definition: fpu.h:104
struct savexmm::@0 sv_fp[8]
TODO: Comment.
xmmacc sv_xmm[8]
TODO: Comment.
Definition: fpu.h:107
envxmm sv_env
TODO: Comment.
Definition: fpu.h:98
fpacc87 fp_acc
TODO: Comment.
Definition: fpu.h:102
Contents of each SSE extended accumulator.
Definition: fpu.h:90
unsigned char xmm_bytes[16]
TODO: Comment.
Definition: fpu.h:92
Stores FPU registers details.
Definition: fpu.h:113
savexmm sv_xmm
Stores the XMM context.
Definition: fpu.h:117
save87 sv_87
Stores the floating point context.
Definition: fpu.h:115