Changeset 54ca3523 in mainline
- Timestamp:
- 2005-05-20T17:04:55Z (20 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0cb0a72
- Parents:
- c01bd280
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/ia32/Makefile.inc
rc01bd280 r54ca3523 14 14 15 15 CPPFLAGS=$(DEFS) -nostdinc -I../include 16 CFLAGS=$(CPPFLAGS) -nostdlib -fno-builtin -fomit-frame-pointer -Wmissing-prototypes -Werror -O 016 CFLAGS=$(CPPFLAGS) -nostdlib -fno-builtin -fomit-frame-pointer -Wmissing-prototypes -Werror -O3 17 17 LFLAGS=-M -no-check-sections -T ../arch/ia32/_link.ld 18 18 -
arch/ia32/include/fpu_context.h
rc01bd280 r54ca3523 1 1 /* 2 * Copyright (C) 200 1-2004 Jakub Jermar2 * Copyright (C) 2005 Jakub Vana 3 3 * All rights reserved. 4 4 * -
arch/ia32/src/fpu_context.c
rc01bd280 r54ca3523 1 1 /* 2 # 3 #Copyright (C) 2005 Jakub Vana4 #All rights reserved.5 # 6 #Redistribution and use in source and binary forms, with or without7 #modification, are permitted provided that the following conditions8 #are met:9 # 10 #- Redistributions of source code must retain the above copyright11 #notice, this list of conditions and the following disclaimer.12 #- Redistributions in binary form must reproduce the above copyright13 #notice, this list of conditions and the following disclaimer in the14 #documentation and/or other materials provided with the distribution.15 #- The name of the author may not be used to endorse or promote products16 #derived from this software without specific prior written permission.17 # 18 #THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR19 #IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES20 #OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.21 #IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,22 #INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT23 #NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,24 #DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY25 #THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT26 #(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF27 #THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.28 # 29 */2 * 3 * Copyright (C) 2005 Jakub Vana 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 10 * - Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * - Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * - The name of the author may not be used to endorse or promote products 16 * derived from this software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * 29 */ 30 30 31 31 #include <fpu_context.h> 32 32 #include <arch.h> 33 33 #include <cpu.h> 34 35 34 36 35 void fpu_context_save(fpu_context_t *fctx) … … 80 79 void fpu_init(void) 81 80 { 82 83 "fninit;"84 81 asm( 82 "fninit;" 83 ); 85 84 } 86 -
arch/ia32/src/interrupt.c
rc01bd280 r54ca3523 97 97 void nm_fault(__u8 n, __u32 stack[]) 98 98 { 99 100 // printf("-1\n");101 99 reset_TS_flag(); 102 100 if ((CPU->fpu_owner)!=NULL) 103 101 { 104 // printf("tid:%d \n", THREAD->tid);105 // printf("owner:%d\n", (CPU->fpu_owner)->tid);106 102 fpu_lazy_context_save(&((CPU->fpu_owner)->saved_fpu_context)); 107 108 // printf("owner 2\n"); 109 (CPU->fpu_owner)->fpu_context_engaged=0; /* Enables migration */ 110 // printf("owner 3\n"); 111 103 (CPU->fpu_owner)->fpu_context_engaged=0; /* don't prevent migration */ 112 104 } 113 // printf("0\n");114 105 if(THREAD->fpu_context_exists) fpu_lazy_context_restore(&(THREAD->saved_fpu_context)); 115 106 else {fpu_init();THREAD->fpu_context_exists=1;} 116 // printf("1\n");117 107 CPU->fpu_owner=THREAD; 118 // printf("2\n");119 120 // printf("3\n");121 // panic("#NM fault\n");122 108 } 123 109 -
arch/ia64/include/fpu_context.h
rc01bd280 r54ca3523 1 1 /* 2 * Copyright (C) 2005 Jakub Jermar2 * Copyright (C) 2005 Jakub Vana 3 3 * All rights reserved. 4 4 * -
arch/ia64/src/fpu_context.c
rc01bd280 r54ca3523 1 1 /* 2 # 3 #Copyright (C) 2005 Jakub Vana4 #All rights reserved.5 # 6 #Redistribution and use in source and binary forms, with or without7 #modification, are permitted provided that the following conditions8 #are met:9 # 10 #- Redistributions of source code must retain the above copyright11 #notice, this list of conditions and the following disclaimer.12 #- Redistributions in binary form must reproduce the above copyright13 #notice, this list of conditions and the following disclaimer in the14 #documentation and/or other materials provided with the distribution.15 #- The name of the author may not be used to endorse or promote products16 #derived from this software without specific prior written permission.17 # 18 #THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR19 #IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES20 #OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.21 #IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,22 #INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT23 #NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,24 #DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY25 #THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT26 #(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF27 #THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.28 # 29 */2 * 3 * Copyright (C) 2005 Jakub Vana 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 10 * - Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * - Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * - The name of the author may not be used to endorse or promote products 16 * derived from this software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * 29 */ 30 30 31 31 #include <fpu_context.h> -
arch/mips/include/fpu_context.h
rc01bd280 r54ca3523 1 1 /* 2 * Copyright (C) 200 1-2004 Jakub Jermar2 * Copyright (C) 2005 Jakub Vana 3 3 * All rights reserved. 4 4 * -
arch/mips/src/fpu_context.c
rc01bd280 r54ca3523 1 1 /* 2 # 3 #Copyright (C) 2005 Jakub Vana4 #All rights reserved.5 # 6 #Redistribution and use in source and binary forms, with or without7 #modification, are permitted provided that the following conditions8 #are met:9 # 10 #- Redistributions of source code must retain the above copyright11 #notice, this list of conditions and the following disclaimer.12 #- Redistributions in binary form must reproduce the above copyright13 #notice, this list of conditions and the following disclaimer in the14 #documentation and/or other materials provided with the distribution.15 #- The name of the author may not be used to endorse or promote products16 #derived from this software without specific prior written permission.17 # 18 #THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR19 #IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES20 #OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.21 #IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,22 #INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT23 #NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,24 #DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY25 #THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT26 #(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF27 #THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.28 # 29 */2 * 3 * Copyright (C) 2005 Jakub Vana 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 10 * - Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * - Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * - The name of the author may not be used to endorse or promote products 16 * derived from this software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * 29 */ 30 30 31 31 #include <fpu_context.h> -
include/fpu_context.h
rc01bd280 r54ca3523 1 /* 2 * Copyright (C) 2005 Jakubi Vana 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 1 28 2 29 #ifndef fpu_context_h … … 15 42 16 43 #endif /*fpu_context_h*/ 44 -
src/Makefile.config
rc01bd280 r54ca3523 6 6 7 7 # Support for symetric multiprocessors 8 SMP=__SMP__8 #SMP=__SMP__ 9 9 10 10 # Improved support for hyperthreading … … 18 18 19 19 # Uncomment if you want to run in the test mode 20 TEST=__TEST__20 #TEST=__TEST__ 21 21 22 22 TEST_FILE=test.c -
test/fpu/fpu1/test.c
rc01bd280 r54ca3523 44 44 45 45 #define THREADS 150*2 46 #define ATTEMPTS 10 46 47 47 48 #define E_10e8 271828182 … … 55 56 static void e(void *data) 56 57 { 58 int i; 57 59 double e,d,le,f; 58 le=-1;59 e=0;60 f=1;61 60 62 61 waitq_sleep(&can_start); 63 62 64 for(d=1;e!=le;d*=f,f+=1) { 65 le=e; 66 e=e+1/d; 63 for (i = 0; i<ATTEMPTS; i++) { 64 le=-1; 65 e=0; 66 f=1; 67 68 for(d=1;e!=le;d*=f,f+=1) { 69 le=e; 70 e=e+1/d; 71 } 72 73 if((int)(100000000*e)!=E_10e8) 74 panic("tid%d: e*10e8=%d\n", THREAD->tid, (int) 100000000*e); 67 75 } 68 76 69 if((int)(100000000*e)==E_10e8) { 70 atomic_inc((int *) &threads_ok); 71 } 72 else 73 printf("tid%d: e*10e8=%d)\n", THREAD->tid, (int) 100000000*e); 77 atomic_inc((int *) &threads_ok); 74 78 } 75 79 76 80 static void pi(void *data) 77 81 { 78 double lpi = -1, pi = 0;79 double ab, ad;80 int n;82 int i; 83 double lpi, pi; 84 double n, ab, ad; 81 85 82 86 waitq_sleep(&can_start); 83 87 84 for (n=2, ab = sqrt(2); lpi != pi; n *= 2, ab = ad) {85 double sc, cd;86 88 87 sc = sqrt(1 - (ab*ab/4)); 88 cd = 1 - sc; 89 ad = sqrt(ab*ab/4 + cd*cd); 90 lpi = pi; 91 pi = 2 * n * ad; 92 } 89 for (i = 0; i<ATTEMPTS; i++) { 90 lpi = -1; 91 pi = 0; 93 92 94 if((int)(100000000*pi)==PI_10e8) { 95 atomic_inc((int *) &threads_ok); 93 for (n=2, ab = sqrt(2); lpi != pi; n *= 2, ab = ad) { 94 double sc, cd; 95 96 sc = sqrt(1 - (ab*ab/4)); 97 cd = 1 - sc; 98 ad = sqrt(ab*ab/4 + cd*cd); 99 lpi = pi; 100 pi = 2 * n * ad; 101 } 102 103 if((int)(100000000*pi)!=PI_10e8) 104 panic("tid%d: pi*10e8=%d\n", THREAD->tid, (int) 100000000*pi); 96 105 } 97 else 98 printf("tid%d: pi*10e8=%d)\n", THREAD->tid, (int) 100000000*pi);106 107 atomic_inc((int *) &threads_ok); 99 108 } 100 109
Note:
See TracChangeset
for help on using the changeset viewer.