Changeset 3396f59 in mainline for arch/amd64/src/cpu/cpu.c
- Timestamp:
- 2005-09-04T08:28:55Z (20 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8ff2f3f
- Parents:
- 005384ad
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/amd64/src/cpu/cpu.c
r005384ad r3396f59 61 61 }; 62 62 63 64 /** Setup flags on processor so that we can use the FPU 65 * 66 * cr0.osfxsr = 1 -> we do support fxstor/fxrestor 67 * cr0.em = 0 -> we do not emulate coprocessor 68 * cr0.mp = 1 -> we do want lazy context switch 69 */ 70 void cpu_setup_fpu(void) 71 { 72 __asm__ volatile ( 73 "movq %%cr0, %%rax;" 74 "btsq $1, %%rax;" /* cr0.mp */ 75 "btrq $2, %%rax;" /* cr0.em */ 76 "movq %%rax, %%cr0;" 77 78 "movq %%cr4, %%rax;" 79 "bts $9, %%rax;" /* cr4.osfxsr */ 80 "movq %%rax, %%cr4;" 81 : 82 : 83 :"%rax" 84 ); 85 } 86 87 /** Set the TS flag to 1. 88 * 89 * If a thread accesses coprocessor, exception is run, which 90 * does a lazy fpu context switch. 91 * 92 */ 63 93 void set_TS_flag(void) 64 94 { 65 95 __asm__ volatile ( 66 96 "mov %%cr0,%%rax;" 67 " or $8,%%rax;"97 "bts $3,%%rax;" 68 98 "mov %%rax,%%cr0;" 69 99 : … … 77 107 __asm__ volatile ( 78 108 "mov %%cr0,%%rax;" 79 "bt c $4,%%rax;"109 "btr $3,%%rax;" 80 110 "mov %%rax,%%cr0;" 81 111 :
Note:
See TracChangeset
for help on using the changeset viewer.