@@ -107,7 +107,7 @@ psa_handle_t tfm_svcall_psa_connect(uint32_t *args, int32_t ns_caller)
107
107
return PSA_NULL_HANDLE ;
108
108
}
109
109
110
- psa_status_t tfm_svcall_psa_call (uint32_t * args , int32_t ns_caller )
110
+ psa_status_t tfm_svcall_psa_call (uint32_t * args , int32_t ns_caller , uint32_t lr )
111
111
{
112
112
psa_handle_t handle ;
113
113
psa_invec * inptr , invecs [PSA_MAX_IOVEC ];
@@ -124,14 +124,17 @@ psa_status_t tfm_svcall_psa_call(uint32_t *args, int32_t ns_caller)
124
124
in_num = (size_t )args [2 ];
125
125
outptr = (psa_outvec * )args [3 ];
126
126
/*
127
- * FixMe: 5th parameter is pushed at stack top before SVC; plus
128
- * exception stacked contents, 5th parameter is now at 8th position
129
- * in SVC handler. However, if thread mode applies FloatPoint, then
130
- * FloatPoint context is pushed into stack and then 5th parameter
131
- * will not be args[8].
132
- * Will refine it later.
127
+ * 5th parameter is pushed at stack top before SVC; plus exception stacked contents,
128
+ * 5th parameter is now at 8th position in SVC handler.
129
+ * However, if thread mode applies FloatPoint, then FloatPoint context is pushed into
130
+ * stack and then 5th parameter will be args[26].
133
131
*/
134
- out_num = (size_t )args [8 ];
132
+ if (lr & EXC_RETURN_FPU_FRAME_BASIC ) {
133
+ out_num = (size_t )args [8 ];
134
+ }
135
+ else {
136
+ out_num = (size_t )args [26 ];
137
+ }
135
138
} else {
136
139
/*
137
140
* FixMe: From non-secure caller, vec and len are composed into a new
@@ -926,7 +929,7 @@ static void tfm_svcall_psa_eoi(uint32_t *args)
926
929
/* FixMe: re-enable interrupt */
927
930
}
928
931
929
- int32_t SVC_Handler_IPC (tfm_svc_number_t svc_num , uint32_t * ctx )
932
+ int32_t SVC_Handler_IPC (tfm_svc_number_t svc_num , uint32_t * ctx , uint32_t lr )
930
933
{
931
934
switch (svc_num ) {
932
935
case TFM_SVC_SCHEDULE :
@@ -939,7 +942,7 @@ int32_t SVC_Handler_IPC(tfm_svc_number_t svc_num, uint32_t *ctx)
939
942
case TFM_SVC_PSA_CONNECT :
940
943
return tfm_svcall_psa_connect (ctx , 0 );
941
944
case TFM_SVC_PSA_CALL :
942
- return tfm_svcall_psa_call (ctx , 0 );
945
+ return tfm_svcall_psa_call (ctx , 0 , lr );
943
946
case TFM_SVC_PSA_CLOSE :
944
947
tfm_svcall_psa_close (ctx , 0 );
945
948
break ;
0 commit comments