All pastes #1018137 Raw Edit

j0rn

public c v1 · immutable
#1018137 ·published 2008-05-14 16:57 UTC
rendered paste body
#define __NR_exit	1#define __NR_write	4#define STDOUT_FILENO	1unsigned int jwrite (int fd, const char *buf, unsigned int len);void jexit (unsigned int code);int _start (void){	char buffer[] = "Hello world !\n", *ptr = buffer;	while (*++ptr);	jwrite(STDOUT_FILENO, buffer, ptr - buffer);	jexit(0);}unsigned int jwrite (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 jexit (unsigned int code) {	__asm__ volatile ( "int $0x80\n" : : "a" (__NR_exit), "b" ((long) (code)));}