All pastes #1018154 Raw Edit

j0rn

public c v1 · immutable
#1018154 ·published 2008-05-14 17:10 UTC
rendered paste body
/* * gcc -nostdlib bouzin.c -o bouzin */#define __NR_exit	1#define __NR_write	4#define STDOUT_FILENO	1unsigned int write (int fd, const char *buf, unsigned int len);void exit (unsigned int code);int _start (void) {	char buffer[] = "Hello world !\n", *ptr = buffer;	while (*++ptr);	write(STDOUT_FILENO, buffer, ptr - buffer);	exit(0);}unsigned int write (int fd, const char *buf, unsigned int len) {	unsigned int result;	__asm__ volatile (		"int $0x80\n"		: "=a" (result)		: "0" (__NR_write),		  "b" ((long) (fd)),		  "c" ((long) (buf)),		  "d" ((long) (len))		: "memory"	);	return result;}void exit (unsigned int code) {	__asm__ volatile ( "int $0x80\n" : : "a" (__NR_exit), "b" ((long) (code)));}