Question: Again answer is not as per question: I have asked logic to get SVC number it doesn't meant to pass R0 by loading it with
Again answer is not as per question: I have asked logic to get SVC number it doesn't meant to pass R0 by loading it with const 0x20 .
Point 2 of question tells below:
(2) Two parameters are passed to the handler via R1, R2. >> R0 should not be passed. Please provide the logic to get current SVC number in SVC_handler.
I Guess my question is clear asking for alternate logic to get SVC number (alternate of instruction LDR R0, [LR, #-4] provided in below solution by chegg expert.
My question is not answered properly, I asked to provide other logic to check SVC i.e other logic instead of LDR R0, [LR, #-4].
Write an ALP program for ARM Cortex M3/4 to perform the following (1) SVC is to be called from an application task running at Thread unprivileged mode. (2) Two parameters are passed to the handler via R1, R2. (3) If the SVC number is 0x20, then the addition of the data in R1,R2 should be performed (4) Return and resume application task
; Start of program AREA MyCode, CODE, READONLY
; Define the SVC handler function SVC_Handler ; Save context of the interrupted task PUSH {LR}
; Check SVC number CMP R0, #0x20 BNE svc_not_handled
; Get parameters from R1 and R2 LDR R1, [R1] LDR R2, [R2]
; Perform addition ADD R0, R1, R2
; Restore context and return from interrupt POP {PC}
svc_not_handled ; Handle unsupported SVC numbers here, if desired
; Define the main function MAIN ; Call SVC with number 0x20 and parameters in R1 and R2 MOV R0, #0x20 MOV R1, #10 MOV R2, #20 SVC #0
; End of program
END
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
