I would like to override the interrupt vector number, so I tried to do this:
section .text
global _start
_start:
mov al, 0x7f
inc al
mov byte [ override + 1 ] , al
mov eax, 1
mov ebx, 1
override:
int 0x20
This code should simply call the syscall exit. But when I execute it, I get a Segmentation fault.
I don't understand why, because[ override + 1 ] should be the address of 0x20, and al is 1 byte big and I also made a typecast to byte, so they are the same size.
GDB says it happens at this line:
mov byte [ override + 1 ] , al
What is the problem here? How can it be solved?
I compile and link like this:
nasm -f elf test.asm
ld -m elf_i386 -o test test.o