Changeset 79f1f38f in mainline


Ignore:
Timestamp:
2005-05-09T00:35:09Z (20 years ago)
Author:
Jakub Vana <jakub.vana@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9db5b66
Parents:
9c926f3
Message:

Functions for switching TS flag.

Location:
arch/ia32
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • arch/ia32/include/cpu.h

    r9c926f3 r79f1f38f  
    3131
    3232#include <config.h>
     33#include <proc/thread.h>
    3334#include <typedefs.h>
    3435#include <arch/pm.h>
     
    4748        int stepping;
    4849        struct tss *tss;
     50        thread_t *fpu_owner;
    4951};
    5052
    5153
     54void set_TS_flag(void);
     55void reset_TS_flag(void);
     56
    5257#endif
  • arch/ia32/src/cpu/cpu.c

    r9c926f3 r79f1f38f  
    6262};
    6363
     64void set_TS_flag(void)
     65{
     66        asm
     67        (
     68                "mov %%cr0,%%eax;"
     69                "or $8,%%eax;"
     70                "mov %%eax,%%cr0;"
     71                :
     72                :
     73                :"%eax"
     74        );
     75}
     76
     77void reset_TS_flag(void)
     78{
     79        asm
     80        (
     81                "mov %%cr0,%%eax;"
     82                "and $0xffFFffF7,%%eax;"
     83                "mov %%eax,%%cr0;"
     84                :
     85                :
     86                :"%eax"
     87        );     
     88}
     89
     90
     91
    6492void cpu_arch_init(void)
    6593{
    6694        CPU->arch.tss = tss_p;
     95        CPU->arch.fpu_owner=NULL;
    6796}
    6897
  • arch/ia32/src/fpu_context.c

    r9c926f3 r79f1f38f  
    3030
    3131#include <fpu_context.h>
     32#include <arch.h>
     33#include <cpu.h>
     34
    3235
    3336void fpu_context_save(fpu_context_t *fctx)
     
    3841void fpu_context_restore(fpu_context_t *fctx)
    3942{
     43        if(THREAD==CPU->arch.fpu_owner) reset_TS_flag();
     44        else set_TS_flag();
    4045}
    4146
Note: See TracChangeset for help on using the changeset viewer.