gpt4 book ai didi

linux - 汇编中 EAX,1 和 EBX,1 的区别?

转载 作者:太空宇宙 更新时间:2023-11-04 10:41:40 25 4
gpt4 key购买 nike

section     .text
global _start ;must be declared for linker (ld)

_start: ;tell linker entry point

mov edx,len ;message length
mov ecx,msg ;message to write
mov ebx,1 ;file descriptor (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel

mov eax,1 ;system call number (sys_exit)
int 0x80 ;call kernel

section .data

msg db 'Hello, world!',0xa ;our dear string
len equ $ - msg ;length of our dear string

内核源代码引用:

当系统读取到 EAX,1 而不是 EBX,1 时,它如何知道它必须退出?因为 1 表示 Sys_Exit。

最佳答案

这个组件在我们所说的 ABI(应用程序二进制接口(interface))中定义。这应该有所帮助:What is Application Binary Interface (ABI)?

关于linux - 汇编中 EAX,1 和 EBX,1 的区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34906910/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com