We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
what does this piece of code means in SVC handler and how are the svc number is passed from application to handler ?
SVC_Handler PROC EXPORT SVC_Handler [WEAK] IMPORT SVC_Handler_Main TST lr, #4 ITE EQ MRSEQ r0, MSP MRSNE r0, PSP B SVC_Handler_Main ENDP
/*below code is placed in main*/
void SVC_Handler_Main( unsigned int *svc_args ){ unsigned int svc_number;
svc_number = ( ( char * )svc_args[ 6 ] )[ -2 ] ; switch( svc_number ) { case 0: break; case 1:break; default: /* unknown SVC */ break;
Hello, I believe the below article explain more:developer.arm.com/.../latest
Hello Teggi,
Just a quick look into the code in my understand the svc_args[6] points to the return address. An array index "-2" with the pointer typecast to char will points to 2 bytes earlier the LR. That will be the part of SVC number in the previous instruction which is the SVC.
Chandrasekar