C_dumping-ground/nostdlib.c

33 lines
549 B
C
Raw Normal View History

2022-04-09 15:05:23 -04:00
char *dicks = "good bye world\n";
//totally not stolen
long unsigned int strlen(const char *str) {
long unsigned int len = 0;
while(str[len]) len++;
return len;
}
int puts(const char *aids) {
long unsigned int stringlength = strlen(dicks);
asm volatile (
"mov $1, %%rdi\n"
"mov $1, %%rax\n"
"syscall" :: "S"(aids), "d"(stringlength)
);
return 1;
}
void _start(){
puts(dicks);
asm volatile (
"mov $60, %rax\n"
"mov $1, %rdi\n"
"syscall"
);
}