Changeset 6de2480e in mainline


Ignore:
Timestamp:
2005-05-19T11:55:15Z (20 years ago)
Author:
Jakub Vana <jakub.vana@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f3ebb64
Parents:
1eee8383
Message:

IA-32 FPU lazy context switching.
Doesn't work on Bochs and sometimes produces wrong results on P4.
Seems to work on VMware and PII.

Build script for IA-32 changed to build floppy images (image.bin) 1440K long.

Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • arch/ia32/boot/Makefile

    r1eee8383 r6de2480e  
    66        dd if=boot.bin of=../../../src/image.bin bs=512 conv=sync
    77        -cat ../../../src/kernel.bin >>../../../src/image.bin
     8        dd if=/dev/zero of=../../../src/image.bin bs=1 seek=$(KERNEL_SIZE) count=`expr 1474560 - $(KERNEL_SIZE)`
    89
    910boot.bin: boot.o
  • arch/ia32/include/interrupt.h

    r1eee8383 r6de2480e  
    7878extern void gp_fault(__u8 n, __u32 stack[]);
    7979extern void nm_fault(__u8 n, __u32 stack[]);
     80extern void ss_fault(__u8 n, __u32 stack[]);
    8081extern void page_fault(__u8 n, __u32 stack[]);
    8182extern void syscall(__u8 n, __u32 stack[]);
  • arch/ia32/src/fpu_context.c

    r1eee8383 r6de2480e  
    5252void fpu_lazy_context_save(fpu_context_t *fctx)
    5353{
     54    printf("");
    5455    asm(
    5556        "mov %0,%%eax;"
    5657        "fxsave (%%eax);"
    57         "ret;"
    5858        :"=m"(fctx)
    5959        :
    60         :"%eax"
     60        :"eax"
    6161    ); 
     62    printf("");
    6263}
    6364
    6465void fpu_lazy_context_restore(fpu_context_t *fctx)
    6566{
     67    printf("");
    6668    asm(
    6769        "mov %0,%%eax;"
    6870        "fxrstor (%%eax);"
    69         "ret;"
    7071        :"=m"(fctx)
    7172        :
    72         :"%eax"
     73        :"eax"
    7374    );
     75    printf("");   
    7476}
    7577
  • arch/ia32/src/interrupt.c

    r1eee8383 r6de2480e  
    8686}
    8787
     88void ss_fault(__u8 n, __u32 stack[])
     89{
     90        printf("stack[0]=%X, %%eip=%X, %%cs=%X, flags=%X\n", stack[0], stack[1], stack[2], stack[3]);
     91        printf("%%eax=%L, %%ebx=%L, %%ecx=%L, %%edx=%L,\n%%edi=%L, %%esi=%L, %%ebp=%L, %%esp=%L\n", stack[-2], stack[-5], stack[-3], stack[-4], stack[-9], stack[-8], stack[-1], stack);
     92        printf("stack: %X, %X, %X, %X\n", stack[4], stack[5], stack[6], stack[7]);
     93        panic("Stack fault\n");
     94}
     95
     96
    8897void nm_fault(__u8 n, __u32 stack[])
    8998{
    9099
     100//      printf("-1\n");       
     101        reset_TS_flag();
    91102        if ((CPU->fpu_owner)!=NULL)
    92103        { 
    93                 fpu_lazy_context_save(&((CPU->fpu_owner)->saved_fpu_context));
     104//              printf("owner %X\n",(int)(&((CPU->fpu_owner)->saved_fpu_context)));       
     105                fpu_lazy_context_save(&((CPU->fpu_owner)->saved_fpu_context));
     106
     107//              printf("owner 2\n");
    94108                (CPU->fpu_owner)->fpu_context_engaged=0; /* Enables migration */
     109//              printf("owner 3\n");       
     110
    95111        }
    96        
     112//      printf("0\n");
    97113        if(THREAD->fpu_context_exists) fpu_lazy_context_restore(&(THREAD->saved_fpu_context));
    98114        else {fpu_init();THREAD->fpu_context_exists=1;}
    99 
     115//      printf("1\n");
    100116        CPU->fpu_owner=THREAD;
    101 
    102         reset_TS_flag();
     117//      printf("2\n");
    103118       
     119//      printf("3\n"); 
    104120//      panic("#NM fault\n");
    105121}
  • arch/ia32/src/pm.c

    r1eee8383 r6de2480e  
    122122        trap_register(13, gp_fault);
    123123        trap_register( 7, nm_fault);
     124        trap_register(12, ss_fault);
    124125}
    125126
  • src/Makefile.config

    r1eee8383 r6de2480e  
    1818
    1919# Uncomment if you want to run in the test mode
    20 #TEST=__TEST__
     20TEST=__TEST__
    2121
    2222TEST_FILE=test.c
     
    2626#TEST_DIR=synch/rwlock2/
    2727#TEST_DIR=synch/rwlock3/
    28 TEST_DIR=synch/rwlock4/
     28#TEST_DIR=synch/rwlock4/
    2929#TEST_DIR=synch/rwlock5/
    3030#TEST_DIR=synch/semaphore1/
    3131#TEST_DIR=synch/semaphore2/
     32TEST_DIR=fp/fp0
Note: See TracChangeset for help on using the changeset viewer.