diff options
author | Gentoo <installgentoo@endianness.com> | 2020-08-12 19:45:06 +1000 |
---|---|---|
committer | Gentoo <installgentoo@endianness.com> | 2020-08-12 19:45:06 +1000 |
commit | 24d5fab3d7ff1f0d3ba6cae50935e964ee479875 (patch) | |
tree | 8c78f322c53bc51796c17a073f896e0cea13a968 | |
download | yes-24d5fab3d7ff1f0d3ba6cae50935e964ee479875.tar.gz yes-24d5fab3d7ff1f0d3ba6cae50935e964ee479875.tar.bz2 yes-24d5fab3d7ff1f0d3ba6cae50935e964ee479875.zip |
initial commit
-rw-r--r-- | makefile | 9 | ||||
-rw-r--r-- | yes.asm | 38 |
2 files changed, 47 insertions, 0 deletions
diff --git a/makefile b/makefile new file mode 100644 index 0000000..8b42a58 --- /dev/null +++ b/makefile @@ -0,0 +1,9 @@ +yes: yes.o + ld -m elf_x86_64 -o yes yes.o +yes.o: yes.asm + nasm -f elf64 yes.asm +clean: + rm *.o + rm yes +run: yes + ./yes @@ -0,0 +1,38 @@ +; Version : 0.1 +; Last update : 12/8/2020 +; Description : Do you need ultimate yes peformance? Well, you've come to the right place. +; Licence : GPLv3 +; Note : Assumes that the stack is at least 65536 bytes. + +section .data +Yes: db 0xA,'y',0xA,'y',0xA,'y',0xA,'y' ;8 bytes as the stack is written to 8 bytes at a time + +section .text + global _start + +_start: +xor ecx,ecx ;0 out the counter registor + +ALIGN 16 ;Align the stack to 16 bytes +;; rsp is pointing to the "start" of the stack +yees: inc ecx ;increment the counter every loop + +push qword[Yes] ;push 8 bytes to the stack + +test ecx,8192 ;Check for 8192 loops +je yees ;continue if amount is not reached + +;;the stack is now full of 32768 bytes of '\ny' (maybe a bit more, but that's ignored) +yes: mov eax,1 ;sys_write +mov edi,1 ;fd = STDOUT_FILENO +mov edx,65536 ;print 65536 bytes +mov rsi,rsp ;the value of rsp is the start of where the text is +syscall + +jmp yes ;print those 65536 bytes of 'y\n' forever + +;;this won't ever be reached but it's left for any future usage +exit: +mov eax, 60 ;sys_exit +xor edi, edi ;return 0 +syscall ;do sys_exit |