gpt4 book ai didi

windows - Subsystem for Unix Application on Windows 如何在汇编中实现系统调用?

转载 作者:可可西里 更新时间:2023-11-01 10:39:42 25 4
gpt4 key购买 nike

比如这个linux系统调用int $0x80

SUA 是否实现了类似的东西?如果是这样,命令是什么?

这个特定的代码是我想更改以在 SUA 上使用的代码

#cpuid.s Sample program to extract the processor Vendor ID
.section .data
output:
.ascii "The processor Vendor ID is 'xxxxxxxxxxxxx'\n"
.section .text
.globl _start
_start:
movl $0, %eax
cpuid
movl $output, %edi
movl %ebx, 28(%edi)
movl %edx, 32(%edi)
movl %ecx, 36(%edi)
movl $4, %eax
movl $1, %ebx
movl $output, %ecx
movl $42, %edx
int $0x80
movl $1, %eax
movl $0, %ebx
int $0x80

最佳答案

它是 Unix 的子系统,而不是运行 Linux 的整台计算机。

int 0x80 是一种在 Linux 上调用系统调用的方法。就 POSIX 而言,这是一个实现细节,而 POSIX 实际上是 Linux 和 SUA 的共同点。所以我想说,虽然 Linux(在 x86 上)确实支持系统调用 0x80,但我认为 Windows 上的 SUA 没有理由需要这样做。那是因为 SUA 不是一个与 Linux 具有这种级别兼容性的系统。如果您在 Linux 上构建程序,它可能会使用 int 0x80,但如果您在 SUA 下构建它以实现进行系统调用的目标,您可能会发现它做了一些完全不同的事情。

你想完成什么?

关于windows - Subsystem for Unix Application on Windows 如何在汇编中实现系统调用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6318697/

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