对于一个任务,我需要创建简单的外壳代码,但不允许它包含\x80。
注意:要在linux上进行系统调用,比如写或退出,您需要这一行:int 0x80__,它最终将生成包括\x80在内的外壳代码。
不过,我需要进行系统调用,所以我现在的想法是使用一个变量作为中断向量号。例如,0x40,然后乘以2,所以在外壳代码中最终会有一个\x40,而不是\x80。
问题是,int没有将变量作为参数,我尝试这样做是为了进行测试:
section .data
nr db 0x80
section .text
global _start
_start:
xor eax, eax
inc eax
xor ebx, ebx
mov ebx, 0x1
int [nr]然后得到
错误:操作码和操作数的组合无效
,我怎么才能让我的想法奏效呢?或者您对这个问题有不同的解决方案?
PS。sysenter和syscall不工作->非法指令
我在x86-32位机上使用nasm。
发布于 2015-12-05 22:41:00
也许是这样的,但不要在严肃的代码中使用它!
format ELF executable
use32
entry start
segment executable writeable
start:
;<some code>
inc byte [ here + 1 ] ;<or some other math>
jmp here
here:
int 0x7f
segment readable writeable(这是电码)
https://stackoverflow.com/questions/34110045
复制相似问题