Я плохо разбираюсь в ассемблере, не подскажете как это организовано?
Код
313 void xPortPendSVHandler( void )
314 {
315 /* This is a naked function. */
316
317 __asm volatile
318 (
319 " mrs r0, psp \n"
320 " \n"
321 " ldr r3, pxCurrentTCBConst \n" /* Get the location of the current TCB. */
322 " ldr r2, [r3] \n"
323 " \n"
324 " stmdb r0!, {r4-r11} \n" /* Save the remaining registers. */
325 " str r0, [r2] \n" /* Save the new top of stack into the first member of the TCB. */
326 " \n"
327 " stmdb sp!, {r3, r14} \n"
328 " mov r0, %0 \n"
329 " msr basepri, r0 \n"
330 " bl vTaskSwitchContext \n"
331 " mov r0, #0 \n"
332 " msr basepri, r0 \n"
333 " ldmia sp!, {r3, r14} \n"
334 " \n" /* Restore the context, including the critical nesting count. */
335 " ldr r1, [r3] \n"
336 " ldr r0, [r1] \n" /* The first item in pxCurrentTCB is the task top of stack. */
337 " ldmia r0!, {r4-r11} \n" /* Pop the registers. */
338 " msr psp, r0 \n"
339 " bx r14 \n"
340 " \n"
341 " .align 2 \n"
342 "pxCurrentTCBConst: .word pxCurrentTCB \n"
343 ::"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY)
344 );
345 }
314 {
315 /* This is a naked function. */
316
317 __asm volatile
318 (
319 " mrs r0, psp \n"
320 " \n"
321 " ldr r3, pxCurrentTCBConst \n" /* Get the location of the current TCB. */
322 " ldr r2, [r3] \n"
323 " \n"
324 " stmdb r0!, {r4-r11} \n" /* Save the remaining registers. */
325 " str r0, [r2] \n" /* Save the new top of stack into the first member of the TCB. */
326 " \n"
327 " stmdb sp!, {r3, r14} \n"
328 " mov r0, %0 \n"
329 " msr basepri, r0 \n"
330 " bl vTaskSwitchContext \n"
331 " mov r0, #0 \n"
332 " msr basepri, r0 \n"
333 " ldmia sp!, {r3, r14} \n"
334 " \n" /* Restore the context, including the critical nesting count. */
335 " ldr r1, [r3] \n"
336 " ldr r0, [r1] \n" /* The first item in pxCurrentTCB is the task top of stack. */
337 " ldmia r0!, {r4-r11} \n" /* Pop the registers. */
338 " msr psp, r0 \n"
339 " bx r14 \n"
340 " \n"
341 " .align 2 \n"
342 "pxCurrentTCBConst: .word pxCurrentTCB \n"
343 ::"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY)
344 );
345 }