Changeset b49f4ae in mainline for arch/ia32


Ignore:
Timestamp:
2005-09-06T09:56:26Z (20 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
50a4e25
Parents:
a5d1331
Message:

Added architecture independent hooks for fpu lazy context switching.
It is enabled by defining FPU_LAZY

Location:
arch/ia32
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • arch/ia32/Makefile.inc

    ra5d1331 rb49f4ae  
    88
    99
    10 DEFS:=-DARCH=$(ARCH)
     10DEFS:=-DARCH=$(ARCH) -DFPU_LAZY
    1111
    1212ifdef SMP
  • arch/ia32/Makefile.inc.cross

    ra5d1331 rb49f4ae  
    88LD=$(IA-32_BINUTILS_DIR)/$(IA-32_TARGET)-ld
    99OBJCOPY=$(IA-32_BINUTILS_DIR)/$(IA-32_TARGET)-objcopy
     10OBJDUMP=$(IA-32_BINUTILS_DIR)/$(IA-32_TARGET)-objdump
    1011
    1112BFD_NAME=elf32-i386
    1213BFD_ARCH=i386
    1314
    14 DEFS:=-DARCH=$(ARCH)
     15DEFS:=-DARCH=$(ARCH) -DFPU_LAZY
    1516
    1617ifdef SMP
     
    2526CFLAGS=$(CPPFLAGS) -nostdlib -fno-builtin -fomit-frame-pointer -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3
    2627LFLAGS=-M -no-check-sections
     28
     29../arch/$(ARCH)/_link.ld: ../arch/$(ARCH)/_link.ld.in
     30        $(CC) $(CFLAGS) -E -x c $< | grep -v "^\#" > $@
    2731
    2832arch_sources= \
  • arch/ia32/include/cpu.h

    ra5d1331 rb49f4ae  
    4242};
    4343
    44 
    45 void set_TS_flag(void);
    46 void reset_TS_flag(void);
    47 
    4844#endif
  • arch/ia32/include/fpu_context.h

    ra5d1331 rb49f4ae  
    3838
    3939
    40 
    4140#endif
  • arch/ia32/src/cpu/cpu.c

    ra5d1331 rb49f4ae  
    6363};
    6464
    65 void set_TS_flag(void)
     65void fpu_disable(void)
    6666{
    67         asm
    68         (
     67        __asm__ volatile (
    6968                "mov %%cr0,%%eax;"
    7069                "or $8,%%eax;"
     
    7675}
    7776
    78 void reset_TS_flag(void)
     77void fpu_enable(void)
    7978{
    80         asm
    81         (
     79        __asm__ volatile (
    8280                "mov %%cr0,%%eax;"
    8381                "and $0xffFFffF7,%%eax;"
  • arch/ia32/src/fpu_context.c

    ra5d1331 rb49f4ae  
    3434void fpu_context_save(fpu_context_t *fctx)
    3535{
    36 }
    37 
    38 
    39 void fpu_context_restore(fpu_context_t *fctx)
    40 {
    41         if (THREAD==CPU->fpu_owner)
    42                 reset_TS_flag();
    43         else {
    44                 set_TS_flag();
    45                 if (CPU->fpu_owner != NULL)
    46                         (CPU->fpu_owner)->fpu_context_engaged=1;
    47         }
    48 }
    49 
    50 
    51 void fpu_lazy_context_save(fpu_context_t *fctx)
    52 {
    5336        __asm__ volatile (
    5437                "fnsave %0"
     
    5740}
    5841
    59 void fpu_lazy_context_restore(fpu_context_t *fctx)
     42
     43void fpu_context_restore(fpu_context_t *fctx)
    6044{
    6145        __asm__ volatile (
  • arch/ia32/src/interrupt.c

    ra5d1331 rb49f4ae  
    110110void nm_fault(__u8 n, __native stack[])
    111111{
    112         reset_TS_flag();
    113         if (CPU->fpu_owner != NULL) { 
    114                 fpu_lazy_context_save(&((CPU->fpu_owner)->saved_fpu_context));
    115                 CPU->fpu_owner->fpu_context_engaged=0; /* don't prevent migration */
    116         }
    117         if (THREAD->fpu_context_exists)
    118                 fpu_lazy_context_restore(&(THREAD->saved_fpu_context));
    119         else {
    120                 fpu_init();
    121                 THREAD->fpu_context_exists=1;
    122         }
    123         CPU->fpu_owner=THREAD;
     112#ifdef FPU_LAZY     
     113        scheduler_fpu_lazy_request();
     114#else
     115        panic("fpu fault");
     116#endif
    124117}
    125118
Note: See TracChangeset for help on using the changeset viewer.