Subversion Repositories HelenOS-historic

Rev

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

Rev 326 Rev 332
Line 29... Line 29...
29
 
29
 
30
#include <fpu_context.h>
30
#include <fpu_context.h>
31
#include <arch.h>
31
#include <arch.h>
32
#include <cpu.h>
32
#include <cpu.h>
33
 
33
 
-
 
34
/** Save FPU (mmx, sse) context using fxsave instruction */
34
void fpu_context_save(fpu_context_t *fctx)
35
void fpu_context_save(fpu_context_t *fctx)
35
{
36
{
36
    /* Align on 16-byte boundary */
37
    /* Align on 16-byte boundary */
37
    if (((__u64)fctx) & 0xf)
38
    if (((__u64)fctx) & 0xf)
38
        fctx = (fpu_context_t *)((((__u64)fctx) | 0xf) + 1);
39
        fctx = (fpu_context_t *)((((__u64)fctx) | 0xf) + 1);
Line 41... Line 42...
41
        "fxsave %0"
42
        "fxsave %0"
42
        : "=m"(*fctx)
43
        : "=m"(*fctx)
43
        );
44
        );
44
}
45
}
45
 
46
 
-
 
47
/** Restore FPU (mmx,sse) context using fxrstor instruction */
46
void fpu_context_restore(fpu_context_t *fctx)
48
void fpu_context_restore(fpu_context_t *fctx)
47
{
49
{
48
    /* Align on 16-byte boundary */
50
    /* Align on 16-byte boundary */
49
    if (((__u64)fctx) & 0xf)
51
    if (((__u64)fctx) & 0xf)
50
        fctx = (fpu_context_t *)((((__u64)fctx) | 0xf) + 1);
52
        fctx = (fpu_context_t *)((((__u64)fctx) | 0xf) + 1);