如何在 NASM 中推送 64 位 int? [英] How to push a 64bit int in NASM?

查看:21
本文介绍了如何在 NASM 中推送 64 位 int?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试推送一个 64 位整数,但在组装 NASM 时似乎希望将其视为 DWORD 而不是 QWORD.

I'm trying to push a 64bit integer but when assembling NASM seems to want to see it as a DWORD not a QWORD.

我正在使用 ASM 创建 shellcode 我需要将 64 位 DLL 注入 64 位进程.第一个 QWORD 是旧指令指针,第二个是包含 DLL 地址的地址,第三个是 LoadLibrary 的地址.占位符在运行时填充.

I'm using ASM to create the shellcode I need to inject a 64bit DLL into a 64bit process. The first QWORD is the old instruction pointer, the second is the address containing the address of the DLL, the third is the address of LoadLibrary. The placeholders are filled in at runtime.

section .text
global _start   

_start:
BITS 64
PUSH QWORD 0xACEACEACACEACEAC
PUSHFQ
push rax
PUSH QWORD 0xACEACEACACEACEAC
MOV RAX, 0xACEACEACACEACEAC
CALL RAX
pop RAX
POPFQ
RETN

推荐答案

没有 push imm64 指令.作为解决方法,您可以执行以下操作之一:

There is no push imm64 instruction. As a workaround you can do one of the following:

  1. 通过一个寄存器:mov rax, 0xACEACEACACEACEAC;推拉克斯
  2. 遍历内存:push qword [rel foo]
  3. 分两部分写: push dword low32;mov dword [rsp+4], high32sub rsp,8;mov 双字 [rsp],low32;mov dword [rsp+4], high32
  4. 如果您的直接允许,请使用符号扩展

这篇关于如何在 NASM 中推送 64 位 int?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆