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