Changeset 3396f59 in mainline for arch/amd64/src/cpu/cpu.c


Ignore:
Timestamp:
2005-09-04T08:28:55Z (20 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8ff2f3f
Parents:
005384ad
Message:

Fixed gdtr naming issues after ia32 changes.
Fixed stack alignment on new thread to by multiple of 16,
we are now ABI-correct and we do not #GP on va_arg to boot.
Fixed bad exception register names reporting.
Fixed bad _hardcoded_load_addr, which caused allocation of kernel text
frames.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • arch/amd64/src/cpu/cpu.c

    r005384ad r3396f59  
    6161};
    6262
     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 */
     70void 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 */
    6393void set_TS_flag(void)
    6494{
    6595        __asm__ volatile (
    6696                "mov %%cr0,%%rax;"
    67                 "or $8,%%rax;"
     97                "bts $3,%%rax;"
    6898                "mov %%rax,%%cr0;"
    6999                :
     
    77107        __asm__ volatile (
    78108                "mov %%cr0,%%rax;"
    79                 "btc $4,%%rax;"
     109                "btr $3,%%rax;"
    80110                "mov %%rax,%%cr0;"
    81111                :
Note: See TracChangeset for help on using the changeset viewer.