assembly - 'ret' 指令在不同 UEFI 实现上的行为是否不同?
问题描述
我有一个简单的打印字符串程序作为 UEFI 应用程序的一部分。我正在尝试使用输出控制台函数 OUTPUT_STRING 在屏幕上连续打印三个字符串
我正在努力的部分如下:
;--some code above this--
;Print information string
mov rcx, [CONOUT]
lea rdx, [info]
call [CONOUT_PRINT_STRING]
lea rdx, [info2]
call printString
mov rcx, [CONOUT]
lea rdx, [info3]
call [CONOUT_PRINT_STRING]
;--some code between this--
;prints a string
;rdx = the address of the string
printString:
mov rcx, [CONOUT]
call [CONOUT_PRINT_STRING]
ret
;--some code below this--
在 Qemu 中,这将正确打印所有三个字符串(位于 info、info2 和 info3)。但是,在我桌面的 BIOS 上,它将打印前两个字符串,而不打印第三个字符串。
将代码修改为以下内容会使所有三个字符串都在两台计算机上打印:
;--some code above this--
;Print information string
mov rcx, [CONOUT]
lea rdx, [info]
call [CONOUT_PRINT_STRING]
lea rdx, [info2]
call printString
next:
mov rcx, [CONOUT]
lea rdx, [info3]
call [CONOUT_PRINT_STRING]
;--some code between this--
;prints a string
;rdx = the address of the string
printString:
mov rcx, [CONOUT]
call [CONOUT_PRINT_STRING]
push next
ret
;--some code below this--
但是,这违背了 this 作为函数的目的,因为我希望能够在我的应用程序中多次使用它。
我的问题是,为什么 ret 在我的桌面 UEFI 实现上没有做我期望它做的事情?是因为我的程序,还是 UEFI 本身?(作为参考,我的主板是 AsRock Steel Legend B450M,BIOS 版本 4.10)
如果这是我的程序问题,我该如何解决?
谢谢!
解决方案
推荐阅读
- node.js - 阻止发布节点应用程序
- hadoop - RecordReader如何向Hadoop中的mapper发送数据
- javascript - Discord JS 发送数据这样的图像
- themes - 如何更改 osclass Bender 主题中的搜索栏默认值(即 php 程序员)?
- assembly - 如何在 p3sim 汇编程序中生成伪随机数
- excel - 将数据复制到下一个空列
- java - 将包含uri路径的字符串转换为arraylist
- php - 在 ajax 上处理弹出窗口并且不显示在 html 上
- ios - 防止重复存储到领域
- javascript - vuex-persist 库提到的延迟问题是什么?