# OS Assignment 6 # Rick van der Zwet - 0433373 # $Id: README.txt 619 2008-05-19 19:35:46Z rick $ # Please let me know if you are also interested in the actual diff of # the files if those brief outputs are not sufficient # WARNING: Using different system, Ubuntu Linux under Parallels, kernel # version 2.6.24.3 on a x86 system $ cd /usr/src/linux/kernel $ vim sys.c # Syscall lives in different location $ vim arch/x86/kernel/syscall_table_32.S code: .long sys_multiply /* 325 * # __NR_syscall_max has been replaced by NR_syscalls in file $ vim include/asm/unistd_32.h # include/linux/syscalls.h does not need to be altered anymore, as it # directly links to include/asm/unistd_32.h # Build new kernel #Code used: === BEGIN CODE === #include #include #include int main() { printf("6 * 7 = %li\n", syscall(325, 6, 7)); return(EX_OK); } === END CODE === $ gcc -Wall -o syscall-test syscall-test.c $ ./syscall-test # When calling it on original kernel the output is `6 * 7 = -1', the # `-1' is in fact syscall error return code, due the fact the syscall # does not exists yet # Install new kernel and reboot $ ./syscall-test # After rebooting the output is set to be `6 * 7 = 42` $ time ./syscall-test # when using larger numbers and `time' to measure output it will become # clear the program is spending almost all of his time in sys(tem) mode.