osmonnb wrote on Thursday, August 29, 2019:
I am using Renesas RX MCU. In port.c prvYieldHander(), there is this code which is supposed to save stack pointer onto TCB:
MOV.L #_pxCurrentTCB, R15
MOV.L [R15], R15
MOV.L R0, [R15]
Can anybody explain the purpose of line 2?
My understanding is:
- pxCurrentTCB is a global variable, which holds the start address of the TCB of current task
- First line of code: move the content of pxCurrentTCB (which is the start address of the TCB of current task), to R15
- Second line of code: don’t know what this is doing
- Third line of code: Move R0 (which contains the address of top of stack) to the address pointed to by R15, ie. move R0 to first location of TCB
Is there anything wrong with my understanding?