From fa03afa46984fbf6eacbd5540e4e318d161cbbe0 Mon Sep 17 00:00:00 2001 From: mithe24 Date: Wed, 8 Oct 2025 13:35:41 +0200 Subject: chore(snippets): move snippetss to src/ --- snippets/allocate.s | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 snippets/allocate.s (limited to 'snippets/allocate.s') diff --git a/snippets/allocate.s b/snippets/allocate.s deleted file mode 100644 index ef80957..0000000 --- a/snippets/allocate.s +++ /dev/null @@ -1,20 +0,0 @@ -# void *allocate(int n) -# -# A naive memory allocator that simply retrieves some new space from the OS. -# It is not possible to deallocate the memory again. -.globl allocate -.type allocate, @function -allocate: - push %rdi - # 1. Find the current end of the data segment. - movq $12, %rax # brk - xorq %rdi, %rdi # 0 means we retrieve the current end. - syscall - # 2. Add the amount of memory we want to allocate. - pop %rdi # the argument - push %rax # current end, which is where the allocated memory will start - addq %rax, %rdi # compute the new end - movq $12, %rax # brk - syscall - pop %rax # the old end, which is the address of our allocated memory - ret -- cgit v1.2.3-70-g09d2