Hi,
I'm trying to make a Hello World program in assembly without depending
on libc. Here's what I have so far:
DATA string+0(SB)/7, $"Hello\n\z"
GLOBL string+0(SB), $7
TEXT _main+0(SB), 1, $0
// first arg; $1 = stdout
MOVL $1, (SP)
// second arg, address of string
MOVL $string+0(SB), 4(SP)
// third arg, $7 = length of string
MOVL $7, 8(SP)
// fourth argument, -1LL (vlong offset)
MOVL $-1, 12(SP)
MOVL $-1, 16(SP)
// use pwrite syscall
MOVL $51, AX
INT $64
RET
The program assembles and links fine - but executing it gives me:
8.out 1183: suicide: invalid address 0x7 in sys call pc=0x104e
It's probably something silly - I'll be extremely grateful if someone
could point out what I'm doing wrong.
Thanks!
--
Anant