Код: Выделить всё
bits 32
global _start
_start:
xor eax,eax
jmp short string
code:
pop esi
push byte 14
push esi
push byte 1
mov al,4
push eax
int 0x80
xor eax,eax
push eax
push eax
mov al,1
int 0x80
string:
call code
db "Hello, world!", 0x0aДолжен, по идее, печатать hello_world системным вызовом write.
Но, зараза, не печатает...
Как собираю:
Вариант1:
Код: Выделить всё
nasm -f elf -o hello2e.o hello2.asm
ld -s -o hello2e hello2e.oСоответественно, strace показвает вызов write без параметров.
Вариант2:
Код: Выделить всё
nasm -o hello2e.o hello2.asm
ld -s -b binary --entry=0x00 hello2e.oТогда он при запуске вообще выдает segfault.
Что же делать?
Где ошибка?