#!/bin/sh # This is a shell archive (produced by GNU sharutils 4.2.1). # To extract the files from this archive, save it to some FILE, remove # everything before the `!/bin/sh' line above, then type `sh FILE'. # # Made on 2007-09-04 07:09 PDT by . # Source directory was `/home/ws/castor/swiss_2.2.3/tpdsrc/umod/crash-lib'. # # Existing files will *not* be overwritten unless `-c' is specified. # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 20772 -r--r--r-- pcore.c # 8776 -r--r--r-- lc_core.h # 9144 -r--r--r-- lc_core_i386.h # save_IFS="${IFS}" IFS="${IFS}:" gettext_dir=FAILED locale_dir=FAILED first_param="$1" for dir in $PATH do if test "$gettext_dir" = FAILED && test -f $dir/gettext \ && ($dir/gettext --version >/dev/null 2>&1) then set `$dir/gettext --version 2>&1` if test "$3" = GNU then gettext_dir=$dir fi fi if test "$locale_dir" = FAILED && test -f $dir/shar \ && ($dir/shar --print-text-domain-dir >/dev/null 2>&1) then locale_dir=`$dir/shar --print-text-domain-dir` fi done IFS="$save_IFS" if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED then echo=echo else TEXTDOMAINDIR=$locale_dir export TEXTDOMAINDIR TEXTDOMAIN=sharutils export TEXTDOMAIN echo="$gettext_dir/gettext -s" fi if touch -am -t 200112312359.59 $$.touch >/dev/null 2>&1 && test ! -f 200112312359.59 -a -f $$.touch; then shar_touch='touch -am -t $1$2$3$4$5$6.$7 "$8"' elif touch -am 123123592001.59 $$.touch >/dev/null 2>&1 && test ! -f 123123592001.59 -a ! -f 123123592001.5 -a -f $$.touch; then shar_touch='touch -am $3$4$5$6$1$2.$7 "$8"' elif touch -am 1231235901 $$.touch >/dev/null 2>&1 && test ! -f 1231235901 -a -f $$.touch; then shar_touch='touch -am $3$4$5$6$2 "$8"' else shar_touch=: echo $echo 'WARNING: not restoring timestamps. Consider getting and' $echo "installing GNU \`touch', distributed in GNU File Utilities..." echo fi rm -f 200112312359.59 123123592001.59 123123592001.5 1231235901 $$.touch # if mkdir _sh32530; then $echo 'x -' 'creating lock directory' else $echo 'failed to create lock directory' exit 1 fi # ============= pcore.c ============== if test -f 'pcore.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'pcore.c' '(file already exists)' else $echo 'x -' extracting 'pcore.c' '(binary)' sed 's/^X//' << 'SHAR_EOF' | uudecode && begin 600 pcore.c M+RH@8V]R92YC"B`J($1U;7!I;F<@86X@14Q&("AG9&(M*2!C;VUP871I8FQE M(&-O7)I9VAT("A#*2`R,#`V(#-005)D871A($EN8RX*("H@("`@("!- M;V1I9FEE9"!B>2!#87-T;W(@1G4@9F]R('5S92!W:71H("=CPH@("`@("`@("`@("`@("`@:68@*"AC='-P M(#T@9FEL;%]T87-K7W-T"!;)61=.B`E2AM+"!M87)K*3L*("`@ M("`@("`@("`@("`@("`@("`@("`@9V5T7W1H'0H M=&%S:RD["B`@("`*"B`@("`@("`@;65MPH@("`@("`@("`@("`@("`@9G!R:6YT9BAF<"P@(G!R('1APH@("`@ M("`@("`@("`@("`@9G!R:6YT9BAF<"P@(F=E=%]PPH@("`@("`@('9O:60@*G1S M<"P@*FUM<"P@*G9M87!P+"`J=FU?;F5X=#L*("`@("`@("!K861DPH@("`@("`@("`@("`@("`@9G!R:6YT9BAF<"P@ M(D9!24Q54D4@;W!E;FEN9R!C;W)E(&9I;&4A7&XB*3L*("`@("`@("`@("`@ M("`@(')E='5R;CL*("`@("`@("!]"@H@("`@("`@('1S<"`](&9I;&Q?=&%S M:U]S=')U8W0H=&%S:RD["B`@("`@("`@:68H='-P(#T]($Y53$PI(&=O=&\@ M9F%I;&5D.PH*("`@("`@("!T8R`]('1A"!;)61=.B`EPH@("`@ M("`@("`@("`@("`@;6%R:SUM86QL;V,H,3`R-"D["B`@("`@("`@("`@("`@ M("!M87)K6S!=(#T@)UPP)SL*("`@("`@("`@("`@("`@(&-H:6QD(#T@54E. M5"AT2AE;&8N95]I M9&5N="P@14Q&34%'+"!314Q&34%'*3L*("`@("`@("!E;&8N95]I9&5N=%M% M25]#3$%34UT@/2!%3$9?0TQ!4U,["B`@("`@("`@96QF+F5?:61E;G1;14E? M1$%405T@/2!%3$9?1$%403L*("`@("`@("!E;&8N95]I9&5N=%M%25]615)3 M24].72`]($567T-54E)%3E0["B`@("`@("`@;65M2`](#`["B`@("`@("`@96QF+F5?<&AO9F8@/2!S M:7IE;V8H96QF*3L@("`@("`O*B!S=&%R="!O9B!PF4@/2!S:7IE;V8H96QF*3L* M("`@("`@("!E;&8N95]P:&5N='-I>F4@/2!S:7IE;V8HPH@("`@("`@("`@("`@("`@9G!R:6YT9BAO9G`L(")7F4H(D-/4D4B+"!325I%*'1A MF4H(D-/4D4B+"!S:7IE;V8H96QF7V9PPH@("`@("`@("`@("`@("`@:68H9G!U7W9A M;&ED*'1HF5O9BAE;&9?9G!R M96=S971?="DI.PH@("`@("`@("`@("`@("`@?0H@("`@("`@('T*"B`@("`@ M("`@<&YH9'(N<%]T>7!E(#T@4%1?3D]413L*("`@("`@("!P;FADB`](#`["B`@ M("`@("`@<&YH9'(N<%]F;&%GF5O9B!N;W1EBD["B`@("`@("`@?0H@("`@("`@(&-O'0I*3L*("`@("`@("`@("`@("`@('-Z(#T@96YD("T@61U;7`H=FUA M7V9L86=S*2`_('-Z(#H@,#L@+RH@9&]N)W0@9'5M<"`J+PH@("`@("`@("`@ M("`@("`@<&ADCL*("`@("`@("`@("`@("`@('9M87`@/2`H M=6QO;F'0["B`@("`@("`@?0H*("`@("`@("!C;W)E7V1U;7!? MPH@("`@("`@("`@("`@("`@9G!R:6YT9BAO9G`L(")7PH@("`@("`@ M("`@("`@("`@9G!R:6YT9BAO9G`L(")7PH@("`@("`@("`@("`@("`@9V]T M;R!F86EL960["B`@("`@("`@?0H*("`@("`@("`O*B!%3$8@9G!U(&YO=&4@ M*B\*("`@("`@("!I9B@A8V]R95]G971?9G!U*'1A7!E(#T@3E1?4%)&4%)%1SL*"B`@("`@("`@("`@("`@ M("!I9BA#4D%32$1%0E5'*#$I*2!["B`@("`@("`@("`@("`@("`@("`@("`@ M(&9P7!E(#T@3E1?4%)35$%455,["B`@ M("`@("`@("`@("`@("!PPH@("`@("`@("`@("`@ M("`@("`@("`@("!F<')I;G1F*&]F<"P@(E=R:71I;F<@14Q&('1H"4P.'@@870@)6QD7&XB+"`H:6YT*2!T:')E M861;:5TL(&9T96QL*&-OF5O9BAS=')U8W0@96QF7W!R M7!E(#T@3E1?4%)&4%)%1SL*"B`@("`@("`@("`@("`@("`@("`@ M("`@(&EF*$-205-(1$5"54F5O9BAE M;&9?9G!R96=S971?="DI.PH@("`@("`@("`@("`@("`@("`@("`@("`@("`@ M("`@(&-OF5O9BAE;&9?9G!R M96=S971?="DI*2!["B`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@ M9V]T;R!F86EL960["B`@("`@("`@("`@("`@("`@("`@("`@('T*("`@("`@ M("`@("`@("`@('T@96QS92!["B`@("`@("`@("`@("`@("`@("`@("`@("\J M(%A86"!G;W1O(&9A:6QE9#L@*B\*("`@("`@("`@("`@("`@('T*("`@("`@ M("!]"@H@("`@("`@("\J($5,1B!L;V%DPH@("`@("`@ M("`@("`@("`@9V]T;R!F86EL960["B`@("`@("`@?0H*("`@("`@("!I9BA# M4D%32$1%0E5'*#$I*2!["B`@("`@("`@("`@("`@("!F<')I;G1F*&]F<"P@ M(E=R:71I;F<@14Q&(&QO861S(&%T("5L9%QN(BP@(&9T96QL*&-OPH@("`@("`@("`@("`@("`@:6YT(&X@/2`P.PH*("`@ M("`@("`@("`@("`@('9M87!P(#T@9FEL;%]V;6%?8V%C:&4H=FUA<"D["@H@ M("`@("`@("`@("`@("`@'0@/2!63TE$7U!44BAV;6%P M<"`K($]&1E-%5"AV;5]A61U;7`H=FUA7V9L86=S*2D@>PH@("`@("`@("`@("`@("`@("`@ M("`@("!N(#T@8V]R95]D=6UP7W!G6YO<'-I MPH@ M("`@("`@('LB<&-O7-P='(@/2!-14U"15)?3T9&4T54*")T87-K7W-T MPH@("`@("`@(&EN="!C M.PH@("`@("`@(&EN="!T:')E861?;6]D92`](#`["B`@("`@("`@=6QO;F<@ M=F%L=64["B`@("`@("`@8VAAPH@("`@("`@("`@("`@("`@8V%S M92`G;RPH@("`@("`@ M("`@("`@("`@8VUD7W5S86=E*'!C+3YC=7)C;60L(%-93D]04TE3*3L*("`@ M("`@("!]"@H@("`@("`@(&EF("A#4D%32$1%0E5'*#$I*2!["B`@("`@("`@ M("`@("`@("!F<')I;G1F*&9P+"`B87)G(&ES("5S7&XB+"!A&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'pcore.c:' 'MD5 check failed' c41cff00dd7e05141b1c584af4ce5000 pcore.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'pcore.c'`" test 20772 -eq "$shar_count" || $echo 'pcore.c:' 'original size' '20772,' 'current size' "$shar_count!" fi fi # ============= lc_core.h ============== if test -f 'lc_core.h' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'lc_core.h' '(file already exists)' else $echo 'x -' extracting 'lc_core.h' '(binary)' sed 's/^X//' << 'SHAR_EOF' | uudecode && begin 600 lc_core.h M+RH@:6YC;'5D92]L8U]C;W)E+F@*("H*("H@1&5F:6YE7)I9VAT("A#*2`R,#`R($E"32!$975T#`P,#`P,#`T"B-D969I;F4@5DU?24\@("`@("`@("`@(#!X M,#`P,#0P,#`@"B-D969I;F4@5DU?1U)/5U-54"`@("`@(#!X,#`P,#`R,#`* M(V1E9FEN92!635]'4D]74T1/5TX@("`@,'@P,#`P,#$P,"`*(V1E9FEN92!6 M35]%6$5#551!0DQ%("`@,'@P,#`P,3`P,`HC9&5F:6YE(%9-7U-(05)%1"`@ M("`@("`P>#`P,#`P,#`X"@H*(V1E9FEN92!01E]2("`@("`@("`@("`@,'@T M"B-D969I;F4@4$9?5R`@("`@("`@("`@(#!X,@HC9&5F:6YE(%!&7U@@("`@ M("`@("`@("`P>#$*(V1E9FEN92!01E]$54U00T]212`@("`@("`H,55,/#PS M*0H*+RH@8FET('9E71E(&]R9&5R("HO M"B-D969I;F4@14Q&1$%403),4T(@("`@(#$*(V1E9FEN92!%3$9$051!,DU3 M0B`@("`@,@H*"B-D969I;F4@2DM M,2DI+RAY*2DJ*'DI*0HC9&5F:6YE($-47U1/7U-%0U,H>"D@("`H*'@I("\@ M2%HI"B-D969I;F4@0U1?5$]?55-%0U,H>"D@("@H*'@I("4@2%HI("H@,3`P M,#`P,"](6BD*"B\J(#,R(&)I="`J+PIT>7!E9&5F('5I;G0S,E]T($5L9C,R M7T%D9'(["G1Y<&5D968@=6EN=#$V7W0@16QF,S)?2&%L9CL*='EP961E9B!U M:6YT,S)?="!%;&8S,E]/9F8["G1Y<&5D968@=6EN=#,R7W0@16QF,S)?5V]R M9#L*"G1Y<&5D968@F4["B`@("`@("`@16QF,S)?2&%L9B`@("!E7W!H96YT#L*?2!% M;&8S,E]%:&1R.PH*='EP961E9B!S=')U8W0@96QF,S)?<&ADPH@("`@ M("`@($5L9C,R7U=O7!E.PH@("`@("`@($5L9C,R7T]F9B`@ M("`@<%]O9F9S970["B`@("`@("`@16QF,S)?061DCL*("`@("`@("!%;&8S,E]7;W)D("`@('!?9FQA9W,["B`@("`@("`@16QF M,S)?5V]R9"`@("!P7V%L:6=N.PI]($5L9C,R7U!H9'(["@IT>7!E9&5F('-T MF4@*B\*("`@("`@("`@($5L9C,R M7U=O7!E("HO"GT@16QF,S)?3FADPH@('5I;G0X M7W0@95]I9&5N=%LQ-ET["B`@16QF-C1?2&%L9B!E7W1Y<&4["B`@16QF-C1? M2&%L9B!E7VUA8VAI;F4["B`@16QF-C1?5V]R9"!E7W9EF4["B`@16QF-C1?2&%L9B!E7W-H;G5M.PH@($5L9C8T7TAA;&8@95]S M:'-T#L*?2!%;&8V-%]%:&1R.PH*='EP961E9B!S=')U8W0@96QF-C1? M<&ADPH)16QF-C1?5V]R9"!P7W1Y<&4["@E%;&8V-%]7;W)D('!?9FQA M9W,["@E%;&8V-%]/9F8@<%]O9F9S970[("`@("`@("`@("`O*B!396=M96YT M(&9I;&4@;V9FCL@("`@("`@("`O*B!396=M96YT M('-I>F4@:6X@9FEL92`J+PH)16QF-C1?6'=OCL@("`@("`@ M("`@+RH@4V5G;65N="!S:7IE(&EN(&UE;6]R>2`J+PH)16QF-C1?6'=OF4@*B\*("!%;&8V-%]7;W)D(&Y?9&5S8W-Z.R`@+RH@0V]N=&5N="!S:7IE M("HO"B`@16QF-C1?5V]R9"!N7W1Y<&4[("`@("\J($-O;G1E;G0@='EP92`J M+PI]($5L9C8T7TYH9'(["@H*+RH@*B\*"@IS=')U8W0@=&US(`I["B`@("`@ M("`@8VQO8VM?="!T;7-?=71I;64["B`@("`@("`@8VQO8VM?="!T;7-?F4H8VAABD@"GL*("`@("`@("!I;G0@PH@("`@("`@("`@("`@ M("`@PH@("`@("`@ M("`@("`@("`@CL@IB`@7!E M.R`@('P@(`H@*B`@("`@("`@("`@("`@("`@("`@("`@*RTM+2TM+2TM+2TM M+2TM+2TM+2TM+2TM+2TK"B`J("`@("`@("`@("!W2AAPH@("`@("`@(&MA9&1R7W0@ M861DPH@("`@("`@("`@("`@("`@("`@("`@("!R8R`] M(')E861M96TH861DPH@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@ M(&-N="LK.PH@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@('=R:71T M96XK*SL*("`@("`@("`@("`@("`@("`@("`@("`@?0H@("`@("`@("`@("`@ M("`@?0H*("`@("`@("`@("`@("`@(&EF("@A=W)I='1E;BD@>PH@("`@("`@ M("`@("`@("`@("`@("`@("`O+R!F<')I;G1F*&9P+"`B3D]413H@:'5N:R!A M="!P86=E(#!X)3`X>"%<;B(L(&%D9'(I.PH@("`@("`@("`@("`@("`@("`@ M("`@("!C;W)E7V1U;7!?&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'lc_core.h:' 'MD5 check failed' 398ee3bef4efdafa6cdc63c50df127e8 lc_core.h SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'lc_core.h'`" test 8776 -eq "$shar_count" || $echo 'lc_core.h:' 'original size' '8776,' 'current size' "$shar_count!" fi fi # ============= lc_core_i386.h ============== if test -f 'lc_core_i386.h' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'lc_core_i386.h' '(file already exists)' else $echo 'x -' extracting 'lc_core_i386.h' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'lc_core_i386.h' && /* asm-i386/lc_core.h X * X * Defines the architecture-dependent parts for the core. X * X * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, X * IBM Corporation X * Author(s) Stefan Schlosser X * X */ extern int defcpu; X #define ELF_PRARGSZ (80) #define ELF_CLASS ELFCLASS32 #define ELF_DATA ELFDATA2LSB #define ELF_ARCH EM_386 #define HZ 100 X #define elfhdr elf32_hdr #define elf_phdr elf32_phdr #define elf_note elf32_note X typedef unsigned long kaddr_t; X #define core_print_regs(pr_reg) \ X core_print_i386_regs((elf_greg_t *)pr_reg) X #define core_print_fpregs(fpu) \ X core_print_i387_regs((elf_fpregset_t *)fpu) X X #define ELF_NGREG 17 typedef uint32_t elf_greg_t; typedef elf_greg_t elf_gregset_t[ELF_NGREG]; X struct fpregset_t { X long cwd; X long swd; X long twd; X long fip; X long fcs; X long foo; X long fos; X long st_space[20]; /* 8*10 bytes for each FP-reg = 80 bytes */ }; X typedef struct fpregset_t elf_fpregset_t; X struct elf_siginfo { X int32_t si_signo; /* signal number */ X int32_t si_code; /* extra code */ X int32_t si_errno; /* errno */ }; X struct elf_prstatus { X struct elf_siginfo pr_info; /* Info associated with signal */ X int16_t pr_cursig; /* Current signal */ X uint32_t pr_sigpend; /* Set of pending signals */ X uint32_t pr_sighold; /* Set of held signals */ X pid_t pr_pid; X pid_t pr_ppid; X pid_t pr_pgrp; X pid_t pr_sid; X struct timeval pr_utime; /* User time */ X struct timeval pr_stime; /* System time */ X struct timeval pr_cutime; /* Cumulative user time */ X struct timeval pr_cstime; /* Cumulative system time */ X elf_gregset_t pr_reg; /* GP registers */ X int32_t pr_fpvalid; /* True if math co-processor being used. */ }; X struct elf_prpsinfo { X X char pr_state; /* numeric process state */ X char pr_sname; /* char for pr_state */ X char pr_zomb; /* zombie */ X char pr_nice; /* nice val */ X unsigned long pr_flag; /* flags */ X unsigned short pr_uid; X unsigned short pr_gid; X int pr_pid, pr_ppid, pr_pgrp, pr_sid; X /* Lots missing */ X char pr_fname[16]; /* filename of executable */ X char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */ }; X /* X * core_print_regs() X * - print registers X */ static void core_print_i386_regs(elf_greg_t *r) { X int i; X const char *regs[] = { "ebx", "ecx", "edx", "esi", "edi", "ebp", X "eax", "ds", "es", "fs", "gs", X "orig_eax", "eip", "cs", X "efl", "uesp", "ss"}; X fprintf(fp, "i386 regs: \n"); X X for(i=0; icwd, fpu->swd, fpu->twd, fpu->fip, fpu->fcs, fpu->foo, fpu->fos); X X fprintf(fp, " st_space[]: "); X for(i=0; i<20; i++) { X if(!(i % 5)) { X fprintf(fp, "\n "); X } X fprintf(fp, "[%d] %ld ", i, fpu->st_space[i]); X } X fprintf(fp, "\n"); X } X X /* X * core_get_regs() X * - get registers of task X */ int core_get_regs(elf_gregset_t *pr_reg, kaddr_t task, void *tsp) { X elf_gregset_t regs; X int pt_regs_struct_sz = SIZE(pt_regs); X X /* X * XXX CLF the registers in dha are almost certainly kernel X * mode registers which is not what one wants. X * There's probably a better place to do the equiv of this. X */ X if(0 && is_task_active(task)) { X X if (ACTIVE()) { X fprintf(fp, "UNABLE to get regs on live system!\n"); X return 1; X } X X } else { X /* registers are located at the end of kernel stack */ X void *rsp; X rsp = alloca(pt_regs_struct_sz); X X readmem(task + STACKSIZE() - pt_regs_struct_sz, KVADDR, X rsp, pt_regs_struct_sz, "pt_regs", FAULT_ON_ERROR); X X regs[0] = UINT(rsp + MEMBER_OFFSET("pt_regs", "ebx")); X regs[1] = UINT(rsp + MEMBER_OFFSET("pt_regs", "ecx")); X regs[2] = UINT(rsp + MEMBER_OFFSET("pt_regs", "edx")); X regs[3] = UINT(rsp + MEMBER_OFFSET("pt_regs", "esi")); X regs[4] = UINT(rsp + MEMBER_OFFSET("pt_regs", "edi")); X regs[5] = UINT(rsp + MEMBER_OFFSET("pt_regs", "ebp")); X regs[6] = UINT(rsp + MEMBER_OFFSET("pt_regs", "eax")); X regs[7] = UINT(rsp + MEMBER_OFFSET("pt_regs", "xds")); X regs[8] = UINT(rsp + MEMBER_OFFSET("pt_regs", "xes")); X regs[9] = UINT(rsp + MEMBER_OFFSET("pt_regs", "xds")); X regs[10] = UINT(rsp + MEMBER_OFFSET("pt_regs", "xds")); X regs[11] = UINT(rsp + MEMBER_OFFSET("pt_regs", "orig_eax")); X regs[12] = UINT(rsp + MEMBER_OFFSET("pt_regs", "eip")); X regs[13] = UINT(rsp + MEMBER_OFFSET("pt_regs", "xcs")); X regs[14] = UINT(rsp + MEMBER_OFFSET("pt_regs", "eflags")); X regs[15] = UINT(rsp + MEMBER_OFFSET("pt_regs", "esp")); X regs[16] = UINT(rsp + MEMBER_OFFSET("pt_regs", "xss")); X } X X memcpy(pr_reg, ®s, sizeof(elf_gregset_t)); X return 0; } X /* X * copy_fpu_fsave() X * - copy fsave registers X */ void copy_fpu_fsave(void *tsp, elf_fpregset_t *fpu) { X kaddr_t *fsave; X X fsave = tsp + OFFSET(task_struct_thread) X + MEMBER_OFFSET("thread_struct", "i387") X + MEMBER_OFFSET("i387_union", "fsave"); X memcpy(fpu, fsave, STRUCT_SIZE("user_i387_struct")); X } X /* X * copy_fpu_fxsave() X * - copy fxsave registers X */ void copy_fpu_fxsave(void *tsp, elf_fpregset_t *fpu) { X int i; X kaddr_t *fxsave, *to, *from; X X fxsave = tsp + MEMBER_OFFSET("task_struct", "thread") X + MEMBER_OFFSET("thread_struct", "i387") X + MEMBER_OFFSET("i387_union", "fxsave"); X X /* get the fxsave */ X memcpy(fpu, fxsave, 7 * sizeof(long)); X return; X to = (kaddr_t *)&fpu->st_space[0]; X from = tsp + MEMBER_OFFSET("task_struct", "thread") X + MEMBER_OFFSET("thread_struct", "i387") X + MEMBER_OFFSET("i387_union", "fxsave") X + MEMBER_OFFSET("i387_fxsave_struct", "st_space[0]"); X X /* copy from fxsave to fpu */ X for ( i = 0 ; i < 8 ; i++) { X memcpy(to, from, 5 * sizeof(unsigned short)); X to += 5; from += 8; X } } X /* X * fpu_valid() X * - validate if fpu was used X */ int fpu_valid(kaddr_t task) { X static int math_offset, math_size; X int used_math; X X void *tsp; X X X if (math_offset == 0) { X math_offset = MEMBER_OFFSET("task_struct", "used_math"); X math_size = MEMBER_SIZE("task_struct", "used_math"); X } X X tsp = fill_task_struct(task); X X switch(math_size) { X case 2: X used_math = SHORT(tsp + math_offset); X break; X case 4: X used_math = INT(tsp + math_offset); X break; X default: X fprintf(fp, "unexpected used_math size %d\n", math_size); X exit(1); X } X if (used_math) { X return 1; X } else { X return 0; X } } X #define X86_FEATURE_FXSR (0*32+24) int test_bit(int nr, unsigned int * addr) { X return ((1UL << (nr & 31)) & (((const volatile unsigned int *) addr)[nr >> 5])) != 0; } X /* X * get_fpu() X * - get the fpu registers X */ int core_get_fpu(kaddr_t task, elf_fpregset_t *fpu) { X void *cpu, *tsp; X X tsp = fill_task_struct(task); X X if(!fpu_valid(task)) { X return 1; X } X if(is_task_active(task)) { X return 1; X } X cpu = alloca(SIZE(cpuinfo_x86)); X X readmem(symbol_value("boot_cpu_data"), KVADDR, cpu, SIZE(cpuinfo_x86), X "cpuinfo_x86", FAULT_ON_ERROR); X X if(test_bit(X86_FEATURE_FXSR, X (unsigned int *)(cpu + MEMBER_OFFSET("cpuinfo_x86", "x86_capability")))) { X copy_fpu_fxsave(tsp, fpu); X } else { X copy_fpu_fsave(tsp, fpu); X } X return 0; } X X X SHAR_EOF (set 20 07 01 19 14 33 36 'lc_core_i386.h'; eval "$shar_touch") && chmod 0444 'lc_core_i386.h' || $echo 'restore of' 'lc_core_i386.h' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'lc_core_i386.h:' 'MD5 check failed' 53456a4ad15ff629561aef54b725592e lc_core_i386.h SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'lc_core_i386.h'`" test 9144 -eq "$shar_count" || $echo 'lc_core_i386.h:' 'original size' '9144,' 'current size' "$shar_count!" fi fi rm -fr _sh32530 exit 0