mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-16 08:42:50 +00:00
Make psa_sim_generate.pl output the new type of server wrapper we want
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
This commit is contained in:
parent
517f4a1b4d
commit
9ab19695b5
@ -522,8 +522,9 @@ EOF
|
|||||||
push(@buffers, $n1); # Add to the list to be free()d at end
|
push(@buffers, $n1); # Add to the list to be free()d at end
|
||||||
} else {
|
} else {
|
||||||
$argname =~ s/^\*//; # Remove any leading *
|
$argname =~ s/^\*//; # Remove any leading *
|
||||||
|
my $pointer = ($argtype =~ /^psa_\w+_operation_t/) ? "*" : "";
|
||||||
print $fh <<EOF;
|
print $fh <<EOF;
|
||||||
$argtype $argname;
|
$argtype $pointer$argname;
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -574,9 +575,10 @@ EOF
|
|||||||
EOF
|
EOF
|
||||||
} else {
|
} else {
|
||||||
$argname =~ s/^\*//; # Remove any leading *
|
$argname =~ s/^\*//; # Remove any leading *
|
||||||
|
my $server_specific = ($argtype =~ /^psa_\w+_operation_t/) ? "server_" : "";
|
||||||
print $fh <<EOF;
|
print $fh <<EOF;
|
||||||
|
|
||||||
ok = psasim_deserialise_${argtype}(&pos, &remaining, &$argname);
|
ok = psasim_${server_specific}deserialise_${argtype}(&pos, &remaining, &$argname);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@ -588,7 +590,7 @@ EOF
|
|||||||
|
|
||||||
// Now we call the actual target function
|
// Now we call the actual target function
|
||||||
EOF
|
EOF
|
||||||
output_call($fh, $f, $name);
|
output_call($fh, $f, $name, 1);
|
||||||
|
|
||||||
my @outputs = grep($_->{is_output}, @$args);
|
my @outputs = grep($_->{is_output}, @$args);
|
||||||
|
|
||||||
@ -616,9 +618,10 @@ EOF
|
|||||||
my $sep = ($i == $#outputs) ? ";" : " +";
|
my $sep = ($i == $#outputs) ? ";" : " +";
|
||||||
$argtype =~ s/^const //;
|
$argtype =~ s/^const //;
|
||||||
$argname =~ s/^\*//; # Remove any leading *
|
$argname =~ s/^\*//; # Remove any leading *
|
||||||
|
my $server_specific = ($argtype =~ /^psa_\w+_operation_t/) ? "server_" : "";
|
||||||
|
|
||||||
print $fh <<EOF;
|
print $fh <<EOF;
|
||||||
psasim_serialise_${argtype}_needs($argname)$sep
|
psasim_${server_specific}serialise_${argtype}_needs($argname)$sep
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -673,9 +676,11 @@ EOF
|
|||||||
die("$0: $argname: HOW TO OUTPUT?\n");
|
die("$0: $argname: HOW TO OUTPUT?\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $server_specific = ($argtype =~ /^psa_\w+_operation_t/) ? "server_" : "";
|
||||||
|
|
||||||
print $fh <<EOF;
|
print $fh <<EOF;
|
||||||
|
|
||||||
ok = psasim_serialise_${argtype}(&rpos, &rremain, $argname);
|
ok = psasim_${server_specific}serialise_${argtype}(&rpos, &rremain, $argname);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@ -881,7 +886,7 @@ sub output_definition_begin
|
|||||||
|
|
||||||
sub output_call
|
sub output_call
|
||||||
{
|
{
|
||||||
my ($fh, $f, $name) = @_;
|
my ($fh, $f, $name, $is_server) = @_;
|
||||||
|
|
||||||
my $ret_name = $f->{return}->{name};
|
my $ret_name = $f->{return}->{name};
|
||||||
my $args = $f->{args};
|
my $args = $f->{args};
|
||||||
@ -900,6 +905,9 @@ sub output_call
|
|||||||
print $fh " $n1, $n2";
|
print $fh " $n1, $n2";
|
||||||
} else {
|
} else {
|
||||||
$argname =~ s/^\*/\&/; # Replace leading * with &
|
$argname =~ s/^\*/\&/; # Replace leading * with &
|
||||||
|
if ($is_server && $argtype =~ /^psa_\w+_operation_t/) {
|
||||||
|
$argname =~ s/^\&//; # Actually, for psa_XXX_operation_t, don't do this on the server side
|
||||||
|
}
|
||||||
print $fh " $argname";
|
print $fh " $argname";
|
||||||
}
|
}
|
||||||
my $sep = ($i == $#$args) ? "\n );" : ",";
|
my $sep = ($i == $#$args) ? "\n );" : ",";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user