//---------------------------------------------------------------- // hello.c // // This program shows how an application can directly enter // the Linux kernel to perform a system-call (without going // through the Standard C Runtime Library). // // compile using: $ make hello // execute using: $ ./hello // // NOTES: The 'sys_write()' function has ID-number 4 // No header-files are needed since no C Library are called // // programmer: ALLAN CRUSE // written on: 13 MAR 2003 //---------------------------------------------------------------- // No header-files are needed! char msg[] = "Hello, world!\n"; // the message-string int main( void ) { asm(" movl $4, %eax "); // EAX: system-call number asm(" movl $1, %ebx "); // EBX: file-descriptor asm(" movl $msg, %ecx "); // ECX: message-address asm(" movl $14, %edx "); // EDX: message-count asm(" int $0x80 "); // kernel trap-instruction }