我对这个ARM装配的理解是否正确? (中断和堆栈指针功能)

时间:2017-06-01 03:18:25

标签: assembly arm

_get_stack_pointer:
  // Can be called from C
  str     sp, [sp]                  // Store the stack pointer value onto the stack
  ldr     r0, [sp]                  // Load the stack pointer value into r0
  mov     pc, lr                    // Return from function


_enable_interrupts:
  // Can be called from C
  mrs     r0, cpsr                  // Move CPSR into r0
                                    // [C]urrent [P]rogram [S]tatus [R]egister
  mov     r1, #CPSR_IRQ_INHIBIT     // Move CPSR_IRQ_INHIBIT into r1
  bic     r0, r0, r1                // Clear the CPSR_IRQ_INHIBIT bit from CPSR
  msr     cpsr_c, r0                // Move r0 into CPSR
  mov     pc, lr                    // Return from function


_disable_interrupts:
  // Can be called from C
  mrs     r0, cpsr                  // Move CPSR into r0
                                    // [C]urrent [P]rogram [S]tatus [R]egister
  mov     r1, #CPSR_IRQ_INHIBIT     // Move CPSR_IRQ_INHIBIT into r1
  orr     r0, r0, r1                // Set the CPSR_IRQ_INHIBIT bit in CPSR
  msr     cpsr_c, r0                // Move r0 into CPSR
  mov     pc, lr                    // Return from function

0 个答案:

没有答案