Assembly 为什么即使在'bx lr'行之后仍会执行以下ARM汇编代码?

Assembly 为什么即使在'bx lr'行之后仍会执行以下ARM汇编代码?,assembly,arm,Assembly,Arm,我正在从C调用下面的ARM汇编函数。我希望它在第一次bx lr之后返回到C程序,而不是继续向下 .global init_secure_monitor init_secure_monitor: bx lr ldr r0, =msg bl puts mov pc, lr /* code */ ldr r0, =msg bl puts @File ends 我可以看到正在

我正在从C调用下面的ARM汇编函数。我希望它在第一次
bx lr
之后返回到C程序,而不是继续向下

.global init_secure_monitor
init_secure_monitor:
        bx lr
        ldr r0, =msg
        bl puts
        mov pc, lr
        /* code */
        ldr r0, =msg
        bl puts
        @File ends
我可以看到正在打印2个MSG。但不应打印任何内容。我使用了两种方法返回
bx-lr
mov-pc,lr

我做错了什么

下面是C代码,我正在调用ARM

   // end secure memory                                                                              |        @ -------------------------
                                                                                                      |        movs pc, lr
    printf("_reloc_begin: 0x%x\n", &_reloc_begin);                                                    |
    printf("_reloc_end  : 0x%x\n", &_reloc_end);                                                      |/*
                                                                                                      | * Monitor Initialization
    init_secure_monitor(norm_begin);                                                                  | *
    //init_secure_monitor(boot_linux_kernel_entry);                                                   | * This is called the first time the Secure world wishes to
    //init_secure_monitor(normal_world_func);                                                         | * transit to the Normal world.
    printf("You should not come to here!\n");  

使用调试器。显示你的C代码。确保你没有弄乱arm vs thumb模式。arm vs thumb只会崩溃而不会打印东西…你能在调用者和被调用者周围显示disassembly(这将支持/排除arm/thumb以及潜在的其他可能性)你确定你正在查看的汇编程序代码是实际被调用的代码吗?(例如,链接器以某种方式从某个地方链接了不同的init_secure_monitor(),或者您修改的汇编程序文件实际上没有重新组装?)