os/kernelhwsrv/kerneltest/e32test/system/execinfo.pl
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/system/execinfo.pl	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,140 @@
     1.4 +#
     1.5 +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +# All rights reserved.
     1.7 +# This component and the accompanying materials are made available
     1.8 +# under the terms of the License "Eclipse Public License v1.0"
     1.9 +# which accompanies this distribution, and is available
    1.10 +# at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +#
    1.12 +# Initial Contributors:
    1.13 +# Nokia Corporation - initial contribution.
    1.14 +#
    1.15 +# Contributors:
    1.16 +#
    1.17 +# Description:
    1.18 +#
    1.19 +
    1.20 +my $state=0;
    1.21 +my @execs;
    1.22 +my @fastexecs;
    1.23 +my @params;
    1.24 +my $npar;
    1.25 +my $fast;
    1.26 +my $swinum;
    1.27 +while (<STDIN>) {
    1.28 +	if ($state==0) {
    1.29 +		if (/^(.*?)__NAKED__(.*?)\((.*)\)\s*$/) {
    1.30 +			@params=split(',' , $3);
    1.31 +			$npar=scalar(@params);
    1.32 +			$state=1;
    1.33 +		}
    1.34 +	} elsif ($state==1) {
    1.35 +		if (/^\s*\{\s*$/) {
    1.36 +			$state=2;
    1.37 +		}
    1.38 +	} elsif ($state==2) {
    1.39 +		if (/^\s*asm\s*\(\s*\"\s*swi(.*?)(EExec\w+)/) {
    1.40 +			$swinum=$2;
    1.41 +			$fast=0;
    1.42 +			$state=3;
    1.43 +		} elsif (/^\s*asm\s*\(\s*\"\s*swi(.*?)(EFastExec\w+)/) {
    1.44 +			$swinum=$2;
    1.45 +			$fast=1;
    1.46 +			$state=3;
    1.47 +		}
    1.48 +	} elsif ($state==3) {
    1.49 +		if (/^\s*\}\s*$/) {
    1.50 +			$state=0;
    1.51 +			my %info;
    1.52 +			$info{'num'}=$swinum;
    1.53 +			$info{'npar'}=$npar;
    1.54 +			$info{'par1'}=$params[0] if ($npar>0);
    1.55 +			$info{'par2'}=$params[1] if ($npar>1);
    1.56 +			$info{'par3'}=$params[2] if ($npar>2);
    1.57 +			$info{'par4'}=$params[3] if ($npar>3);
    1.58 +			push @fastexecs, \%info if ($fast);
    1.59 +			push @execs, \%info unless ($fast);
    1.60 +		}
    1.61 +	}
    1.62 +}
    1.63 +
    1.64 +my $nsx=scalar(@execs);
    1.65 +my $nfx=scalar(@fastexecs);
    1.66 +
    1.67 +print "Number of fast execs = $nfx\n";
    1.68 +print "Number of slow execs = $nsx\n";
    1.69 +
    1.70 +my $i=0;
    1.71 +print "\n\nstatic const SFastExecInfo[]=\n\t{\n";
    1.72 +foreach (@fastexecs) {
    1.73 +	my $infoRef=$_;
    1.74 +	print "\t\t{\n";
    1.75 +	print "\t\t$$infoRef{'num'},\n";
    1.76 +	print "\t\t$$infoRef{'npar'},\n";
    1.77 +	if ($$infoRef{'par1'}) {
    1.78 +		print "\t\t$$infoRef{'par1'},\n";
    1.79 +	} else {
    1.80 +		print "\t\tNO_PAR,\n";
    1.81 +	}
    1.82 +	if ($$infoRef{'par2'}) {
    1.83 +		print "\t\t$$infoRef{'par2'},\n";
    1.84 +	} else {
    1.85 +		print "\t\tNO_PAR,\n";
    1.86 +	}
    1.87 +	if ($$infoRef{'par3'}) {
    1.88 +		print "\t\t$$infoRef{'par3'},\n";
    1.89 +	} else {
    1.90 +		print "\t\tNO_PAR,\n";
    1.91 +	}
    1.92 +	if ($$infoRef{'par4'}) {
    1.93 +		print "\t\t$$infoRef{'par4'},\n";
    1.94 +	} else {
    1.95 +		print "\t\tNO_PAR\n";
    1.96 +	}
    1.97 +	if (++$i==$nfx) {
    1.98 +		print "\t\t}\n";
    1.99 +	} else {
   1.100 +		print "\t\t},\n";
   1.101 +	}
   1.102 +}
   1.103 +print"\t};\n";
   1.104 +
   1.105 +$i=0;
   1.106 +print "\n\nstatic const SSlowExecInfo[]=\n\t{\n";
   1.107 +foreach (@execs) {
   1.108 +	my $infoRef=$_;
   1.109 +	print "\t\t{\n";
   1.110 +	print "\t\t$$infoRef{'num'},\n";
   1.111 +	print "\t\t$$infoRef{'npar'},\n";
   1.112 +	if ($$infoRef{'par1'}) {
   1.113 +		print "\t\t$$infoRef{'par1'},\n";
   1.114 +	} else {
   1.115 +		print "\t\tNO_PAR,\n";
   1.116 +	}
   1.117 +	if ($$infoRef{'par2'}) {
   1.118 +		print "\t\t$$infoRef{'par2'},\n";
   1.119 +	} else {
   1.120 +		print "\t\tNO_PAR,\n";
   1.121 +	}
   1.122 +	if ($$infoRef{'par3'}) {
   1.123 +		print "\t\t$$infoRef{'par3'},\n";
   1.124 +	} else {
   1.125 +		print "\t\tNO_PAR,\n";
   1.126 +	}
   1.127 +	if ($$infoRef{'par4'}) {
   1.128 +		print "\t\t$$infoRef{'par4'},\n";
   1.129 +	} else {
   1.130 +		print "\t\tNO_PAR\n";
   1.131 +	}
   1.132 +	if (++$i==$nsx) {
   1.133 +		print "\t\t}\n";
   1.134 +	} else {
   1.135 +		print "\t\t},\n";
   1.136 +	}
   1.137 +}
   1.138 +print"\t};\n";
   1.139 +
   1.140 +foreach (@execs) {
   1.141 +	print "$$_{'num'}\n";
   1.142 +}
   1.143 +