Compare commits

..

No commits in common. "8ae1a6e8768e4ec48a2ea6f80360bf9c843d33f8" and "a05124885e0901e5a4f5fb4ce332ea1c49b85098" have entirely different histories.

6 changed files with 4 additions and 48 deletions

View File

@ -6,7 +6,7 @@ SRC := $(wildcard $(SRCDIR)/*.asm)
OBJ := $(patsubst $(SRCDIR)/%.asm,$(OBJDIR)/%.o,$(SRC)) OBJ := $(patsubst $(SRCDIR)/%.asm,$(OBJDIR)/%.o,$(SRC))
CC = gcc CC = gcc
CFLAGS = -g CFLAGS = -g -no-pie
AS = nasm AS = nasm
ASFLAGS = -f elf64 -g ASFLAGS = -f elf64 -g

View File

@ -8,4 +8,3 @@ size_t ft_strlen(const char *str);
int ft_strcmp( const char *first, const char *second); int ft_strcmp( const char *first, const char *second);
ssize_t ft_write(int fd, const void *buf, size_t count); ssize_t ft_write(int fd, const void *buf, size_t count);
char *ft_strdup(const char *s); char *ft_strdup(const char *s);
ssize_t ft_read(int fildes, void *buf, size_t nbyte);

View File

@ -1,25 +0,0 @@
extern __errno_location
section .text
global ft_read
ft_read:
xor rax, rax
syscall
cmp rax, 0
jne syscall_failed
ret
syscall_failed:
neg rax
mov rbx, rax
call __errno_location wrt ..plt
mov [rax], rbx
mov rax, -1
ret

View File

@ -10,7 +10,7 @@ section .text
mov rbx, rdi mov rbx, rdi
mov rdi, rax mov rdi, rax
call malloc wrt ..plt call malloc
cmp rax, 0 cmp rax, 0
je error je error

View File

@ -1,23 +1,6 @@
extern __errno_location
section .text section .text
global ft_write global ft_write
ft_write: ft_write:
mov rax, 1 mov rax, 1
syscall syscall
cmp rax, 0
jne syscall_failed
ret
syscall_failed:
neg rax
mov rbx, rax
call __errno_location wrt ..plt
mov [rax], rbx
mov rax, -1
ret ret

View File

@ -78,5 +78,4 @@ int main()
printf("\n"); printf("\n");
ft_write(1, "bozo\n", 5); ft_write(1, "bozo\n", 5);
printf("%s\n", ft_strdup("sdsfsd"));
} }