[2] | 1 | # OS Assignment 6
|
---|
| 2 | # Rick van der Zwet - 0433373
|
---|
| 3 | # $Id: README.txt 619 2008-05-19 19:35:46Z rick $
|
---|
| 4 |
|
---|
| 5 | # Please let me know if you are also interested in the actual diff of
|
---|
| 6 | # the files if those brief outputs are not sufficient
|
---|
| 7 |
|
---|
| 8 | # WARNING: Using different system, Ubuntu Linux under Parallels, kernel
|
---|
| 9 | # version 2.6.24.3 on a x86 system
|
---|
| 10 | $ cd /usr/src/linux/kernel
|
---|
| 11 | $ vim sys.c
|
---|
| 12 |
|
---|
| 13 | # Syscall lives in different location
|
---|
| 14 | $ vim arch/x86/kernel/syscall_table_32.S
|
---|
| 15 | code: .long sys_multiply /* 325 *
|
---|
| 16 |
|
---|
| 17 | # __NR_syscall_max has been replaced by NR_syscalls in file
|
---|
| 18 | $ vim include/asm/unistd_32.h
|
---|
| 19 |
|
---|
| 20 | # include/linux/syscalls.h does not need to be altered anymore, as it
|
---|
| 21 | # directly links to include/asm/unistd_32.h
|
---|
| 22 |
|
---|
| 23 | # Build new kernel
|
---|
| 24 |
|
---|
| 25 | #Code used:
|
---|
| 26 | === BEGIN CODE ===
|
---|
| 27 | #include <stdio.h>
|
---|
| 28 | #include <sysexits.h>
|
---|
| 29 | #include <unistd.h>
|
---|
| 30 | int main() {
|
---|
| 31 | printf("6 * 7 = %li\n", syscall(325, 6, 7));
|
---|
| 32 | return(EX_OK);
|
---|
| 33 | }
|
---|
| 34 | === END CODE ===
|
---|
| 35 | $ gcc -Wall -o syscall-test syscall-test.c
|
---|
| 36 | $ ./syscall-test
|
---|
| 37 | # When calling it on original kernel the output is `6 * 7 = -1', the
|
---|
| 38 | # `-1' is in fact syscall error return code, due the fact the syscall
|
---|
| 39 | # does not exists yet
|
---|
| 40 |
|
---|
| 41 | # Install new kernel and reboot
|
---|
| 42 | $ ./syscall-test
|
---|
| 43 | # After rebooting the output is set to be `6 * 7 = 42`
|
---|
| 44 | $ time ./syscall-test
|
---|
| 45 | # when using larger numbers and `time' to measure output it will become
|
---|
| 46 | # clear the program is spending almost all of his time in sys(tem) mode.
|
---|
| 47 |
|
---|
| 48 |
|
---|
| 49 |
|
---|
| 50 |
|
---|
| 51 |
|
---|
| 52 |
|
---|
| 53 |
|
---|