I am trying to create a file in 32 bit assembly, however when the file is created the name is constrained to only four characters. I am not sure why this happens. here is my code;
.section .data
.equ SYS_WRITE, 4
.equ SYS_CREAT, 8
.equ SYS_OPEN, 5
.equ SYS_CLOSE, 6
.equ O_CREAT_WRONLY_TRUNC, 03101
.equ LINUX_SYSCALL, 0x80
name:
.ascii "t.txt\0"
.section .text
.global _start
_start:
movl %esp, %ebp
pushl name
movl $SYS_OPEN, %eax
movl %esp, %ebx
movl $O_CREAT_WRONLY_TRUNC, %ecx
movl $0666, %edx
int $LINUX_SYSCALL
movl %eax, %esi
movl $SYS_CLOSE, %eax
movl %esi, %ebx
int $LINUX_SYSCALL
movl $1, %eax
int $LINUX_SYSCALL
And compiling code via terminal;
as --32 touchfile.s -o touchfile.o
ld touchfile.o -o touchfile -m elf_i386
./touchfile