Last active
January 25, 2019 00:58
-
-
Save wridgers/02c6cd5edf39e36151c52ca19eb96dcf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; nasm -f elf64 yes.asm | |
; gcc -o yes yes.o | |
; ./yes | pv -a > /dev/null | |
global main | |
section .text | |
main: | |
mov rdi, 1 | |
mov rsi, msg | |
mov rdx, msg.len | |
loop: | |
mov rax, 1 | |
syscall | |
jmp loop | |
section .data | |
msg: times 16384 db "y",10 | |
.len: equ $ - msg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gcc -O3 -pipe -march=native -mtune=native yes.c -o yes | |
// ./yes | pv -a > /dev/null | |
#include <unistd.h> | |
#define LEN 1 << 15 | |
int main() { | |
char str[LEN]; | |
for (int i = 0; i < LEN; i += 2) { | |
str[i] = 'y'; | |
str[i+1] = '\n'; | |
} | |
while (write(1, str, LEN)); | |
} |
I fixed the asm
version. Should work now.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Your asm version wouldn't work for me at home either.
Issue with the c version was: