Inline Assembler for wrapper function doesn't work for some reason
I'm trying to write a wrapper function for read() system call , using asm volatile , but it won't work , since the res doesn't change its value . Here's the code : ssize_t my_read(int fd, void *buf, size_t count) { ssize_t res; __asm__ volatile( "int $0x80" /* make the request to the OS */ : "=a" (res), /* return result in eax ("a") */ "+b" (fd), /* pass arg1 in ebx ("b") */ "+c" (buf), /* pass arg2 in ecx ("c") */ "+d" (count) /* pass arg3 in edx ("d") */ : "a" (5) /* passing the system call for read to %eax , with call number 5 */ : "memory", "cc"); /* announce to the compiler that the