Subversion Repositories HelenOS

Rev

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

Rev 2071 Rev 2082
Line 74... Line 74...
74
 * cr0.em = 0 -> we do not emulate coprocessor
74
 * cr0.em = 0 -> we do not emulate coprocessor
75
 * cr0.mp = 1 -> we do want lazy context switch
75
 * cr0.mp = 1 -> we do want lazy context switch
76
 */
76
 */
77
void cpu_setup_fpu(void)
77
void cpu_setup_fpu(void)
78
{
78
{
79
    __asm__ volatile (
79
    asm volatile (
80
        "movq %%cr0, %%rax;"
80
        "movq %%cr0, %%rax;"
81
        "btsq $1, %%rax;" /* cr0.mp */
81
        "btsq $1, %%rax;" /* cr0.mp */
82
        "btrq $2, %%rax;"  /* cr0.em */
82
        "btrq $2, %%rax;"  /* cr0.em */
83
        "movq %%rax, %%cr0;"
83
        "movq %%rax, %%cr0;"
84
 
84
 
Line 97... Line 97...
97
 * does a lazy fpu context switch.
97
 * does a lazy fpu context switch.
98
 *
98
 *
99
 */
99
 */
100
void fpu_disable(void)
100
void fpu_disable(void)
101
{
101
{
102
    __asm__ volatile (
102
    asm volatile (
103
        "mov %%cr0,%%rax;"
103
        "mov %%cr0,%%rax;"
104
        "bts $3,%%rax;"
104
        "bts $3,%%rax;"
105
        "mov %%rax,%%cr0;"
105
        "mov %%rax,%%cr0;"
106
        :
106
        :
107
        :
107
        :
Line 109... Line 109...
109
        );
109
        );
110
}
110
}
111
 
111
 
112
void fpu_enable(void)
112
void fpu_enable(void)
113
{
113
{
114
    __asm__ volatile (
114
    asm volatile (
115
        "mov %%cr0,%%rax;"
115
        "mov %%cr0,%%rax;"
116
        "btr $3,%%rax;"
116
        "btr $3,%%rax;"
117
        "mov %%rax,%%cr0;"
117
        "mov %%rax,%%cr0;"
118
        :
118
        :
119
        :
119
        :