Changeset b49f4ae in mainline for arch/amd64/src


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/amd64/src
Files:
3 edited

Legend:

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

    ra5d1331 rb49f4ae  
    9191 *
    9292 */
    93 void set_TS_flag(void)
     93void fpu_disable(void)
    9494{
    9595        __asm__ volatile (
     
    103103}
    104104
    105 void reset_TS_flag(void)
     105void fpu_enable(void)
    106106{
    107107        __asm__ volatile (
  • arch/amd64/src/fpu_context.c

    ra5d1331 rb49f4ae  
    3434void fpu_context_save(fpu_context_t *fctx)
    3535{
    36 }
    37 
    38 void fpu_context_restore(fpu_context_t *fctx)
    39 {
    40         if(THREAD==CPU->fpu_owner)
    41                 reset_TS_flag();
    42         else
    43                 set_TS_flag();
    44 }
    45 
    46 
    47 void fpu_lazy_context_save(fpu_context_t *fctx)
    48 {
    49         /* TODO: We need malloc that allocates on 16-byte boundary !! */
     36        /* Align on 16-byte boundary */
    5037        if (((__u64)fctx) & 0xf)
    5138                fctx = (fpu_context_t *)((((__u64)fctx) | 0xf) + 1);
     
    5744}
    5845
    59 void fpu_lazy_context_restore(fpu_context_t *fctx)
     46void fpu_context_restore(fpu_context_t *fctx)
    6047{
    6148        /* TODO: We need malloc that allocates on 16-byte boundary !! */
  • arch/amd64/src/interrupt.c

    ra5d1331 rb49f4ae  
    3939#include <symtab.h>
    4040#include <arch/asm.h>
    41 
     41#include <proc/scheduler.h>
    4242
    4343
     
    139139void nm_fault(__u8 n, __native stack[])
    140140{
    141         reset_TS_flag();
    142         if (CPU->fpu_owner != NULL) { 
    143                 fpu_lazy_context_save(&CPU->fpu_owner->saved_fpu_context);
    144                 /* don't prevent migration */
    145                 CPU->fpu_owner->fpu_context_engaged=0;
    146         }
    147         if (THREAD->fpu_context_exists)
    148                 fpu_lazy_context_restore(&THREAD->saved_fpu_context);
    149         else {
    150                 fpu_init();
    151                 THREAD->fpu_context_exists=1;
    152         }
    153         CPU->fpu_owner=THREAD;
    154         THREAD->fpu_context_engaged = 1;
     141#ifdef FPU_LAZY     
     142        scheduler_fpu_lazy_request();
     143#else
     144        panic("fpu fault");
     145#endif
    155146}
    156147
Note: See TracChangeset for help on using the changeset viewer.