kerneltest/e32test/system/execinfo.pl
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 #
       
     2 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 # All rights reserved.
       
     4 # This component and the accompanying materials are made available
       
     5 # under the terms of the License "Eclipse Public License v1.0"
       
     6 # which accompanies this distribution, and is available
       
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 #
       
     9 # Initial Contributors:
       
    10 # Nokia Corporation - initial contribution.
       
    11 #
       
    12 # Contributors:
       
    13 #
       
    14 # Description:
       
    15 #
       
    16 
       
    17 my $state=0;
       
    18 my @execs;
       
    19 my @fastexecs;
       
    20 my @params;
       
    21 my $npar;
       
    22 my $fast;
       
    23 my $swinum;
       
    24 while (<STDIN>) {
       
    25 	if ($state==0) {
       
    26 		if (/^(.*?)__NAKED__(.*?)\((.*)\)\s*$/) {
       
    27 			@params=split(',' , $3);
       
    28 			$npar=scalar(@params);
       
    29 			$state=1;
       
    30 		}
       
    31 	} elsif ($state==1) {
       
    32 		if (/^\s*\{\s*$/) {
       
    33 			$state=2;
       
    34 		}
       
    35 	} elsif ($state==2) {
       
    36 		if (/^\s*asm\s*\(\s*\"\s*swi(.*?)(EExec\w+)/) {
       
    37 			$swinum=$2;
       
    38 			$fast=0;
       
    39 			$state=3;
       
    40 		} elsif (/^\s*asm\s*\(\s*\"\s*swi(.*?)(EFastExec\w+)/) {
       
    41 			$swinum=$2;
       
    42 			$fast=1;
       
    43 			$state=3;
       
    44 		}
       
    45 	} elsif ($state==3) {
       
    46 		if (/^\s*\}\s*$/) {
       
    47 			$state=0;
       
    48 			my %info;
       
    49 			$info{'num'}=$swinum;
       
    50 			$info{'npar'}=$npar;
       
    51 			$info{'par1'}=$params[0] if ($npar>0);
       
    52 			$info{'par2'}=$params[1] if ($npar>1);
       
    53 			$info{'par3'}=$params[2] if ($npar>2);
       
    54 			$info{'par4'}=$params[3] if ($npar>3);
       
    55 			push @fastexecs, \%info if ($fast);
       
    56 			push @execs, \%info unless ($fast);
       
    57 		}
       
    58 	}
       
    59 }
       
    60 
       
    61 my $nsx=scalar(@execs);
       
    62 my $nfx=scalar(@fastexecs);
       
    63 
       
    64 print "Number of fast execs = $nfx\n";
       
    65 print "Number of slow execs = $nsx\n";
       
    66 
       
    67 my $i=0;
       
    68 print "\n\nstatic const SFastExecInfo[]=\n\t{\n";
       
    69 foreach (@fastexecs) {
       
    70 	my $infoRef=$_;
       
    71 	print "\t\t{\n";
       
    72 	print "\t\t$$infoRef{'num'},\n";
       
    73 	print "\t\t$$infoRef{'npar'},\n";
       
    74 	if ($$infoRef{'par1'}) {
       
    75 		print "\t\t$$infoRef{'par1'},\n";
       
    76 	} else {
       
    77 		print "\t\tNO_PAR,\n";
       
    78 	}
       
    79 	if ($$infoRef{'par2'}) {
       
    80 		print "\t\t$$infoRef{'par2'},\n";
       
    81 	} else {
       
    82 		print "\t\tNO_PAR,\n";
       
    83 	}
       
    84 	if ($$infoRef{'par3'}) {
       
    85 		print "\t\t$$infoRef{'par3'},\n";
       
    86 	} else {
       
    87 		print "\t\tNO_PAR,\n";
       
    88 	}
       
    89 	if ($$infoRef{'par4'}) {
       
    90 		print "\t\t$$infoRef{'par4'},\n";
       
    91 	} else {
       
    92 		print "\t\tNO_PAR\n";
       
    93 	}
       
    94 	if (++$i==$nfx) {
       
    95 		print "\t\t}\n";
       
    96 	} else {
       
    97 		print "\t\t},\n";
       
    98 	}
       
    99 }
       
   100 print"\t};\n";
       
   101 
       
   102 $i=0;
       
   103 print "\n\nstatic const SSlowExecInfo[]=\n\t{\n";
       
   104 foreach (@execs) {
       
   105 	my $infoRef=$_;
       
   106 	print "\t\t{\n";
       
   107 	print "\t\t$$infoRef{'num'},\n";
       
   108 	print "\t\t$$infoRef{'npar'},\n";
       
   109 	if ($$infoRef{'par1'}) {
       
   110 		print "\t\t$$infoRef{'par1'},\n";
       
   111 	} else {
       
   112 		print "\t\tNO_PAR,\n";
       
   113 	}
       
   114 	if ($$infoRef{'par2'}) {
       
   115 		print "\t\t$$infoRef{'par2'},\n";
       
   116 	} else {
       
   117 		print "\t\tNO_PAR,\n";
       
   118 	}
       
   119 	if ($$infoRef{'par3'}) {
       
   120 		print "\t\t$$infoRef{'par3'},\n";
       
   121 	} else {
       
   122 		print "\t\tNO_PAR,\n";
       
   123 	}
       
   124 	if ($$infoRef{'par4'}) {
       
   125 		print "\t\t$$infoRef{'par4'},\n";
       
   126 	} else {
       
   127 		print "\t\tNO_PAR\n";
       
   128 	}
       
   129 	if (++$i==$nsx) {
       
   130 		print "\t\t}\n";
       
   131 	} else {
       
   132 		print "\t\t},\n";
       
   133 	}
       
   134 }
       
   135 print"\t};\n";
       
   136 
       
   137 foreach (@execs) {
       
   138 	print "$$_{'num'}\n";
       
   139 }
       
   140