Subversion Repositories HelenOS-historic

Rev

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

Rev 296 Rev 309
Line 31... Line 31...
31
#include <arch.h>
31
#include <arch.h>
32
#include <cpu.h>
32
#include <cpu.h>
33
 
33
 
34
void fpu_context_save(fpu_context_t *fctx)
34
void fpu_context_save(fpu_context_t *fctx)
35
{
35
{
36
}
-
 
37
 
-
 
38
void fpu_context_restore(fpu_context_t *fctx)
-
 
39
{
-
 
40
    if(THREAD==CPU->fpu_owner)
-
 
41
        reset_TS_flag();
-
 
42
    else
-
 
43
        set_TS_flag();
-
 
44
}
-
 
45
 
-
 
46
 
-
 
47
void fpu_lazy_context_save(fpu_context_t *fctx)
-
 
48
{
-
 
49
    /* TODO: We need malloc that allocates on 16-byte boundary !! */
36
    /* Align on 16-byte boundary */
50
    if (((__u64)fctx) & 0xf)
37
    if (((__u64)fctx) & 0xf)
51
        fctx = (fpu_context_t *)((((__u64)fctx) | 0xf) + 1);
38
        fctx = (fpu_context_t *)((((__u64)fctx) | 0xf) + 1);
52
 
39
 
53
    __asm__ volatile (
40
    __asm__ volatile (
54
        "fxsave %0"
41
        "fxsave %0"
55
        : "=m"(*fctx)
42
        : "=m"(*fctx)
56
        );
43
        );
57
}
44
}
58
 
45
 
59
void fpu_lazy_context_restore(fpu_context_t *fctx)
46
void fpu_context_restore(fpu_context_t *fctx)
60
{
47
{
61
    /* TODO: We need malloc that allocates on 16-byte boundary !! */
48
    /* TODO: We need malloc that allocates on 16-byte boundary !! */
62
    if (((__u64)fctx) & 0xf)
49
    if (((__u64)fctx) & 0xf)
63
        fctx = (fpu_context_t *)((((__u64)fctx) | 0xf) + 1);
50
        fctx = (fpu_context_t *)((((__u64)fctx) | 0xf) + 1);
64
    __asm__ volatile (
51
    __asm__ volatile (