Subversion Repositories HelenOS

Rev

Rev 1787 | Rev 2082 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1787 Rev 1877
Line 24... Line 24...
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
27
 */
28
 
28
 
29
 /** @addtogroup ia32  
29
/** @addtogroup ia32   
30
 * @{
30
 * @{
31
 */
31
 */
32
/** @file
32
/** @file
33
 *
33
 *
34
 */
34
 */
Line 37... Line 37...
37
#include <arch.h>
37
#include <arch.h>
38
#include <cpu.h>
38
#include <cpu.h>
39
 
39
 
40
typedef void (*fpu_context_function)(fpu_context_t *fctx);
40
typedef void (*fpu_context_function)(fpu_context_t *fctx);
41
 
41
 
42
static fpu_context_function fpu_save,fpu_restore;
42
static fpu_context_function fpu_save, fpu_restore;
43
 
-
 
44
 
-
 
45
 
43
 
46
static void fpu_context_f_save(fpu_context_t *fctx)
44
static void fpu_context_f_save(fpu_context_t *fctx)
47
{
45
{
48
    __asm__ volatile (
46
    __asm__ volatile (
49
        "fnsave %0"
47
        "fnsave %0"
Line 86... Line 84...
86
/*
84
/*
87
    Setup using not fxsr instruction
85
    Setup using not fxsr instruction
88
*/
86
*/
89
void fpu_fsr(void)
87
void fpu_fsr(void)
90
{
88
{
91
    fpu_save=fpu_context_f_save;
89
    fpu_save = fpu_context_f_save;
92
    fpu_restore=fpu_context_f_restore;
90
    fpu_restore = fpu_context_f_restore;
93
}
91
}
94
 
92
 
95
 
-
 
96
 
-
 
97
void fpu_context_save(fpu_context_t *fctx)
93
void fpu_context_save(fpu_context_t *fctx)
98
{
94
{
99
    fpu_save(fctx);
95
    fpu_save(fctx);
100
}
96
}
101
 
97
 
102
void fpu_context_restore(fpu_context_t *fctx)
98
void fpu_context_restore(fpu_context_t *fctx)
103
{
99
{
104
    fpu_restore(fctx);
100
    fpu_restore(fctx);
105
}
101
}
106
 
102
 
107
 
-
 
108
 
-
 
109
void fpu_init()
103
void fpu_init()
110
{
104
{
111
    uint32_t help0=0,help1=0;
105
    uint32_t help0 = 0, help1 = 0;
112
    __asm__ volatile (
106
    __asm__ volatile (
113
        "fninit;\n"
107
        "fninit;\n"
114
        "stmxcsr %0\n"
108
        "stmxcsr %0\n"
115
        "mov %0,%1;\n"
109
        "mov %0,%1;\n"
116
        "or %2,%1;\n"
110
        "or %2,%1;\n"
117
        "mov %1,%0;\n"
111
        "mov %1,%0;\n"
118
        "ldmxcsr %0;\n"
112
        "ldmxcsr %0;\n"
119
        :"+m"(help0),"+r"(help1)
113
        : "+m" (help0), "+r" (help1)
120
        :"i"(0x1f80)
114
        : "i" (0x1f80)
121
    );
115
    );
122
}
116
}
123
 
117
 
124
 /** @}
118
/** @}
125
 */
119
 */
126
 
-