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

标签 windows linux assembly

比如这个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/

相关文章:

linux - 通过命令/应用程序在 bash 提示符下打印的包装行前缀

我可以在 C 中的 2 个子进程之间使用相同的管道吗?

c++ - ecx 寄存器是否用于传递静态函数调用中的参数之一?

multithreading - 能否在仅部分覆盖的情况下执行单字节指令?

c - Windows 上 C 中重命名函数的权限被拒绝

c++ - 获取 MSI 产品属性

c++ - 通过双击 Windows 中的文件调用命令行程序

windows - 添加符合 SSPI 的第三方密码套件 (Windows)

linux - 即使文件存在,Jenkins 构建也因缺少文件错误而失败

c - 使用 FreeDOS 是否允许我的程序访问超过 64 K 的内存?