From 28fbc837eaff40b0f992233e583f8352f13dddfe Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Sat, 13 Jul 2024 23:27:06 -0700 Subject: Dynamic allocation for file data! --- file.inc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'file.inc') diff --git a/file.inc b/file.inc index 3415c4f..bfbf8e0 100644 --- a/file.inc +++ b/file.inc @@ -1,6 +1,7 @@ %ifndef FILE_INC %define FILE_INC -%define FBUF_DEFAULT_SIZE 1024*32 +%define FBUF_DEFAULT_SIZE 16 +%define FBUF_ALLOC_SIZE 1024*32 %ifndef SYS_INC %include "sys.inc" %endif @@ -96,6 +97,20 @@ ffopen: pop rbp ret +ffread: + push rbp + mov rbp, rsp + mov rdi, [rax + fd] + mov rdi, [rdi] + mov rsi, [rax + buffer] + mov rdx, [rax + size] + mov rax, SYS_READ + syscall + ;; + mov rsp, rbp + pop rbp + ret + print_filedata: push rbp mov rbp, rsp -- cgit v1.2.1