syscall table patch
linas at austin.ibm.com
linas at austin.ibm.com
Sat Nov 8 03:36:13 EST 2003
Can someone apply the patch below, harmonizing the syscall table
in misc.S with the #define syscalls in unistd.h ? Its a 'trivial'
patch; what it really does is to make it easier for other
non-mainstream kernel extensions to add new system calls
'cleanly' to include/asm/unistd.h and arch/ppc64/kernel/misc.S
without making an ugly hash of things.
Since several people commented about having a syscall table written
in C, I also append a 'sample' implementation in C. There are two
or three things to note about this:
-- table initialization is now done at runtime, rather than at
compile time.
-- C compiler wants function prototypes to be really happy,
and this patch doesn't provide them. Does anybody want them?
The C-code patch is incomplete right now, its just for flavour,
if the maintainers want such a thing & will include it, let me know
& I can finish work on it.
--linas
p.s. the patch is against stock marcello-2.4.22 although I think
it should apply cleanly to just about any recent kernel.
-------------- next part --------------
Index: arch/ppc64/kernel/misc.S
===================================================================
RCS file: /home/linas/cvsroot/linux24/arch/ppc64/kernel/misc.S,v
retrieving revision 1.1.1.2
diff -u -p -u -p -r1.1.1.2 misc.S
--- arch/ppc64/kernel/misc.S 23 Oct 2003 20:07:43 -0000 1.1.1.2
+++ arch/ppc64/kernel/misc.S 7 Nov 2003 16:14:01 -0000
@@ -593,6 +593,7 @@ _GLOBAL(arch_kernel_thread)
#ifdef CONFIG_BINFMT_ELF32
/* Why isn't this a) automatic, b) written in 'C'? */
+/* because a) its not regular enough, b) C function protoypes needed */
.balign 8
_GLOBAL(sys_call_table32)
.llong .sys_ni_syscall /* 0 - old "setup()" system call */
@@ -819,8 +820,35 @@ _GLOBAL(sys_call_table32)
.llong .sys_fremovexattr /* 220 */
.llong .sys_futex
#endif
+ .llong .sys_ni_syscall /* 208 */
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall /* 210 */
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall /* 215 */
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall /* 220 */
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall /* 225 */
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall /* 230 */
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
.llong .sys_perfmonctl /* Put this here for now ... */
- .rept NR_syscalls-222
+ .rept NR_syscalls-235
.llong .sys_ni_syscall
.endr
#endif
@@ -1050,7 +1078,34 @@ _GLOBAL(sys_call_table)
.llong .sys_fremovexattr /* 220 */
.llong .sys_futex
#endif
+ .llong .sys_ni_syscall /* 208 */
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall /* 210 */
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall /* 215 */
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall /* 220 */
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall /* 225 */
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall /* 230 */
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
+ .llong .sys_ni_syscall
.llong .sys_perfmonctl /* Put this here for now ... */
- .rept NR_syscalls-222
+ .rept NR_syscalls-235
.llong .sys_ni_syscall
.endr
-------------- next part --------------
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#include <asm/unistd.h>
void * sys_call_table[x_NR_num_syscalls];
#ifdef CONFIG_BINFMT_ELF32
void * sys_call_table32[x_NR_num_syscalls];
#endif
/* System Call Table Entry */
#ifdef CONFIG_BINFMT_ELF32
#define SCTE(name,handler32,handler64) \
extern void handler32(void); \
extern void handler64(void); \
sys_call_table_32[__NR_##name] = handler32; \
sys_call_table [__NR_##name] = handler64;
#else
#define SCTE(name,handler32,handler64) \
extern void handler64(void); \
sys_call_table [__NR_##name] = handler64;
#endif
void
setup_syscall_table (void)
{
#define __NR_noop 0
SCTE(noop, sys_ni_syscall, sys_ni_syscall)
SCTE(exit, sys32_exit, sys_exit)
SCTE(fork, sys32_fork, sys_fork)
SCTE(read, sys_read, sys_read)
SCTE(write, sys_write, sys_write)
SCTE(open, sys32_open, sys_open)
SCTE(close, sys_close, sys_close)
SCTE(waitpid, sys32_waitpid, sys_waitpid)
SCTE(creat, sys32_creat, sys_creat)
SCTE(link, sys_link, sys_link)
SCTE(unlink, sys_unlink, sys_unlink)
SCTE(execve, sys32_execve, sys_execve)
SCTE(chdir, sys_chdir, sys_chdir)
SCTE(time, sys32_time, sys64_time)
SCTE(mknod, sys_mknod, sys_mknod)
SCTE(chmod, sys_chmod, sys_chmod)
SCTE(lchown, sys_lchown, sys_lchown)
SCTE(break, sys_ni_syscall, sys_ni_syscall)
SCTE(oldstat, sys32_stat, sys_stat)
SCTE(lseek, sys32_lseek, sys_lseek)
SCTE(getpid, sys_getpid , sys_getpid)
SCTE(mount, sys32_mount, sys_mount)
SCTE(umount, sys_oldumount, sys_ni_syscall)
SCTE(setuid, sys_setuid, sys_setuid)
SCTE(getuid, sys_getuid, sys_getuid)
SCTE(stime, ppc64_sys32_stime, ppc64_sys_stime)
SCTE(ptrace, sys32_ptrace, sys_ptrace)
SCTE(alarm, sys_alarm, sys_alarm)
SCTE(oldfstat, sys32_fstat, sys_fstat)
SCTE(pause, sys32_pause, sys_pause)
SCTE(utime, sys32_utime, sys_utime)
SCTE(stty, sys_ni_syscall, sys_ni_syscall)
SCTE(gtty, sys_ni_syscall, sys_ni_syscall)
SCTE(access, sys32_access, sys_access)
SCTE(nice, sys32_nice, sys_nice)
SCTE(ftime, sys_ni_syscall, sys_ni_syscall)
SCTE(sync, sys_sync, sys_sync)
SCTE(kill, sys32_kill, sys_kill)
SCTE(rename, sys_rename, sys_rename)
SCTE(mkdir, sys32_mkdir, sys_mkdir)
SCTE(rmdir, sys_rmdir, sys_rmdir)
SCTE(dup, sys_dup, sys_dup)
SCTE(pipe, sys_pipe, sys_pipe)
SCTE(times, sys32_times, sys_times)
SCTE(prof, sys_ni_syscall, sys_ni_syscall)
SCTE(brk, sys_brk, sys_brk)
SCTE(setgid, sys_setgid, sys_setgid)
SCTE(getgid, sys_getgid, sys_getgid)
SCTE(signal, sys_signal, sys_signal)
SCTE(geteuid, sys_geteuid, sys_geteuid)
SCTE(getegid, sys_getegid, sys_getegid)
SCTE(acct, sys_acct, sys_acct)
SCTE(umount2, sys32_umount, sys_umount)
SCTE(lock, sys_ni_syscall, sys_ni_syscall)
SCTE(ioctl, sys32_ioctl, sys_ioctl)
SCTE(fcntl, sys32_fcntl, sys_fcntl)
SCTE(mpx, sys_ni_syscall, sys_ni_syscall)
SCTE(setpgid, sys32_setpgid, sys_setpgid)
SCTE(ulimit, sys_ni_syscall, sys_ni_syscall)
SCTE(oldolduname, sys_olduname, sys_ni_syscall)
SCTE(umask, sys32_umask, sys_umask)
SCTE(chroot, sys_chroot, sys_chroot)
SCTE(ustat, sys_ustat, sys_ustat)
SCTE(dup2, sys_dup2, sys_dup2)
SCTE(getppid, sys_getppid, sys_getppid)
SCTE(getpgrp, sys_getpgrp, sys_getpgrp)
SCTE(setsid, sys_setsid, sys_setsid)
SCTE(sigaction, sys32_sigaction, sys_sigaction)
SCTE(sgetmask, sys_sgetmask, sys_sgetmask)
SCTE(ssetmask, sys32_ssetmask, sys_ssetmask)
SCTE(setreuid, sys_setreuid, sys_setreuid)
SCTE(setregid, sys_setregid, sys_setregid)
SCTE(sigsuspend, sys_sigsuspend, sys_sigsuspend)
SCTE(sigpending, sys32_sigpending, sys_sigpending)
SCTE(sethostname, sys32_sethostname, sys_sethostname)
SCTE(setrlimit, sys32_setrlimit, sys_setrlimit)
SCTE(getrlimit, sys32_old_getrlimit, sys_ni_syscall)
SCTE(getrusage, sys32_getrusage, sys_getrusage)
SCTE(gettimeofday, sys32_gettimeofday, sys_gettimeofday)
SCTE(settimeofday, sys32_settimeofday, sys_settimeofday)
SCTE(getgroups, sys32_getgroups, sys_getgroups)
SCTE(setgroups, sys32_setgroups, sys_setgroups)
SCTE(select, sys_ni_syscall, sys_ni_syscall)
SCTE(symlink, sys_symlink, sys_symlink)
SCTE(oldlstat, sys32_lstat, sys_lstat)
SCTE(readlink, sys32_readlink, sys_readlink)
SCTE(uselib, sys_uselib, sys_uselib)
SCTE(swapon, sys32_swapon, sys_swapon)
SCTE(reboot, sys32_reboot, sys_reboot)
SCTE(readdir, old32_readdir, sys_ni_syscall)
SCTE(mmap, sys32_mmap, sys_mmap)
SCTE(munmap, sys_munmap, sys_munmap)
SCTE(truncate, sys_truncate, sys_truncate)
SCTE(ftruncate, sys_ftruncate, sys_ftruncate)
SCTE(fchmod, sys_fchmod, sys_fchmod)
SCTE(fchown, sys_fchown, sys_fchown)
SCTE(getpriority, sys32_getpriority, sys_getpriority)
SCTE(setpriority, sys32_setpriority, sys_setpriority)
SCTE(profil, sys_ni_syscall, sys_ni_syscall)
SCTE(statfs, sys32_statfs, sys_statfs)
SCTE(fstatfs, sys32_fstatfs, sys_fstatfs)
SCTE(ioperm, sys_ioperm, sys_ioperm)
SCTE(socketcall, sys32_socketcall, sys_socketcall)
SCTE(syslog, sys32_syslog, sys_syslog)
SCTE(setitimer, sys32_setitimer, sys_setitimer)
SCTE(getitimer, sys32_getitimer, sys_getitimer)
SCTE(stat, sys32_newstat, sys_newstat)
SCTE(lstat, sys32_newlstat, sys_newlstat)
SCTE(fstat, sys32_newfstat, sys_newfstat)
SCTE(olduname, sys_uname, sys_uname)
SCTE(iopl, sys_ni_syscall, sys_ni_syscall)
SCTE(vhangup, sys_vhangup, sys_vhangup)
SCTE(idle, sys_ni_syscall, sys_ni_syscall)
SCTE(vm86, sys_ni_syscall, sys_ni_syscall)
SCTE(wait4, sys32_wait4, sys_wait4)
SCTE(swapoff, sys_swapoff, sys_swapoff)
SCTE(sysinfo, sys32_sysinfo, sys_sysinfo)
SCTE(ipc, sys32_ipc, sys_ipc)
SCTE(fsync, sys_fsync, sys_fsync)
SCTE(sigreturn, ppc32_sigreturn, ppc64_sigreturn)
SCTE(clone, sys32_clone, sys_clone)
SCTE(setdomainname, sys32_setdomainname, sys_setdomainname)
SCTE(uname, ppc64_newuname, ppc64_newuname)
SCTE(modify_ldt, sys_ni_syscall, sys_ni_syscall)
SCTE(adjtimex, sys32_adjtimex, sys_adjtimex)
SCTE(mprotect, sys_mprotect, sys_mprotect)
SCTE(sigprocmask, sys32_sigprocmask, sys_sigprocmask)
SCTE(create_module, sys32_create_module, sys_create_module)
SCTE(init_module, sys32_init_module, sys_init_module)
SCTE(delete_module, sys32_delete_module, sys_delete_module)
SCTE(get_kernel_syms, sys32_get_kernel_syms, sys_get_kernel_syms)
SCTE(quotactl, sys32_quotactl, sys_quotactl)
SCTE(getpgid, sys32_getpgid, sys_getpgid)
SCTE(fchdir, sys_fchdir, sys_fchdir)
SCTE(bdflush, sys32_bdflush, sys_bdflush)
SCTE(sysfs, sys32_sysfs, sys_sysfs)
SCTE(personality, sys32_personality, sys_personality)
SCTE(afs_syscall, sys_ni_syscall, sys_ni_syscall)
SCTE(setfsuid, sys_setfsuid, sys_setfsuid)
SCTE(setfsgid, sys_setfsgid, sys_setfsgid)
SCTE(_llseek, sys_llseek, sys_llseek)
SCTE(getdents, sys32_getdents, sys_getdents)
SCTE(_newselect, ppc32_select, sys_select)
SCTE(flock, sys_flock, sys_flock)
SCTE(msync, sys32_msync, sys_msync)
SCTE(readv, sys32_readv, sys_readv)
SCTE(writev, sys32_writev, sys_writev)
SCTE(getsid, sys32_getsid, sys_getsid)
SCTE(fdatasync, sys_fdatasync, sys_fdatasync)
SCTE(_sysctl, sys32_sysctl, sys_sysctl)
SCTE(mlock, sys_mlock, sys_mlock)
SCTE(munlock, sys_munlock, sys_munlock)
SCTE(mlockall, sys32_mlockall, sys_mlockall)
SCTE(munlockall, sys_munlockall, sys_munlockall)
SCTE(sched_setparam, sys32_sched_setparam, sys_sched_setparam)
SCTE(sched_getparam, sys32_sched_getparam, sys_sched_getparam)
SCTE(sched_setscheduler, sys32_sched_setscheduler, sys_sched_setscheduler)
SCTE(sched_getscheduler, sys32_sched_getscheduler, sys_sched_getscheduler)
SCTE(sched_yield, sys_sched_yield, sys_sched_yield)
SCTE(sched_get_priority_max, sys32_sched_get_priority_max, sys_sched_get_priority_max)
SCTE(sched_get_priority_min, sys32_sched_get_priority_min, sys_sched_get_priority_min)
SCTE(sched_rr_get_interval, sys32_sched_rr_get_interval, sys_sched_rr_get_interval)
SCTE(nanosleep, sys32_nanosleep, sys_nanosleep)
SCTE(mremap, sys32_mremap, sys_mremap)
SCTE(setresuid, sys_setresuid, sys_setresuid)
SCTE(getresuid, sys_getresuid, sys_getresuid)
SCTE(query_module, sys32_query_module, sys_query_module)
SCTE(poll, sys_poll, sys_poll)
SCTE(nfsservctl, sys32_nfsservctl, sys_nfsservctl)
SCTE(setresgid, sys_setresgid, sys_setresgid)
SCTE(getresgid, sys_getresgid, sys_getresgid)
SCTE(prctl, sys32_prctl, sys_prctl)
SCTE(rt_sigreturn, ppc32_rt_sigreturn, ppc64_rt_sigreturn)
SCTE(rt_sigaction, sys32_rt_sigaction, sys_rt_sigaction)
SCTE(rt_sigprocmask, sys32_rt_sigprocmask, sys_rt_sigprocmask)
SCTE(rt_sigpending, sys32_rt_sigpending, sys_rt_sigpending)
SCTE(rt_sigtimedwait, sys32_rt_sigtimedwait, sys_rt_sigtimedwait)
SCTE(rt_sigqueueinfo, sys32_rt_sigqueueinfo, sys_rt_sigqueueinfo)
SCTE(rt_sigsuspend, sys32_rt_sigsuspend, sys_rt_sigsuspend)
SCTE(pread, sys32_pread, sys_pread)
SCTE(pwrite, sys32_pwrite, sys_pwrite)
SCTE(chown, sys_chown, sys_chown)
SCTE(getcwd, sys_getcwd, sys_getcwd)
SCTE(capget, sys_capget, sys_capget)
SCTE(capset, sys_capset, sys_capset)
SCTE(sigaltstack, sys32_sigaltstack, sys_sigaltstack)
SCTE(sendfile, sys32_sendfile, sys_sendfile)
SCTE(getpmsg, sys_ni_syscall, sys_ni_syscall)
SCTE(putpmsg, sys_ni_syscall, sys_ni_syscall)
SCTE(vfork, sys32_vfork, sys_vfork)
SCTE(ugetrlimit, sys32_getrlimit, sys_getrlimit)
SCTE(readahead, sys32_readahead, sys_readahead)
SCTE(mmap2, ppc32_mmap2, sys_ni_syscall)
SCTE(truncate64, sys32_truncate64, sys_ni_syscall)
SCTE(ftruncate64, sys32_ftruncate64, sys_ni_syscall)
SCTE(stat64, sys_stat64, sys_ni_syscall)
SCTE(lstat64, sys_lstat64, sys_ni_syscall)
SCTE(fstat64, sys_fstat64, sys_ni_syscall)
SCTE(pciconfig_read, sys32_pciconfig_read, sys_pciconfig_read)
SCTE(pciconfig_write, sys32_pciconfig_write, sys_pciconfig_write)
SCTE(pciconfig_iobase, sys_pciconfig_iobase, sys_pciconfig_iobase)
SCTE(multiplexer, sys_ni_syscall, sys_ni_syscall)
SCTE(getdents64, sys_getdents64, sys_getdents64)
SCTE(pivot_root, sys_pivot_root, sys_pivot_root)
SCTE(fcntl64, sys32_fcntl64, sys_ni_syscall)
SCTE(madvise, sys_madvise, sys_madvise)
SCTE(mincore, sys_mincore, sys_mincore)
SCTE(gettid, sys_gettid, sys_gettid)
SCTE(tkill, sys_ni_syscall, sys_ni_syscall)
SCTE(setxattr, sys_ni_syscall, sys_ni_syscall)
SCTE(lsetxattr, sys_ni_syscall, sys_ni_syscall)
SCTE(fsetxattr, sys_ni_syscall, sys_ni_syscall)
SCTE(getxattr, sys_ni_syscall, sys_ni_syscall)
SCTE(lgetxattr, sys_ni_syscall, sys_ni_syscall)
SCTE(fgetxattr, sys_ni_syscall, sys_ni_syscall)
SCTE(listxattr, sys_ni_syscall, sys_ni_syscall)
SCTE(llistxattr, sys_ni_syscall, sys_ni_syscall)
SCTE(flistxattr, sys_ni_syscall, sys_ni_syscall)
SCTE(removexattr, sys_ni_syscall, sys_ni_syscall)
SCTE(lremovexattr, sys_ni_syscall, sys_ni_syscall)
SCTE(fremovexattr, sys_ni_syscall, sys_ni_syscall)
SCTE(futex, sys_ni_syscall, sys_ni_syscall)
SCTE(sched_setaffinity, sys_ni_syscall, sys_ni_syscall)
SCTE(sched_getaffinity, sys_ni_syscall, sys_ni_syscall)
SCTE(security, sys_ni_syscall, sys_ni_syscall)
SCTE(tuxcall, sys_ni_syscall, sys_ni_syscall)
SCTE(sendfile64, sys_ni_syscall, sys_ni_syscall)
SCTE(io_setup, sys_ni_syscall, sys_ni_syscall)
SCTE(io_destroy, sys_ni_syscall, sys_ni_syscall)
SCTE(io_getevents, sys_ni_syscall, sys_ni_syscall)
SCTE(io_submit, sys_ni_syscall, sys_ni_syscall)
SCTE(io_cancel, sys_ni_syscall, sys_ni_syscall)
SCTE(alloc_hugepages, sys_ni_syscall, sys_ni_syscall)
SCTE(free_hugepages, sys_ni_syscall, sys_ni_syscall)
SCTE(exit_group, sys_ni_syscall, sys_ni_syscall)
SCTE(perfmonctl, sys_perfmonctl, sys_perfmonctl)
}
More information about the Linuxppc64-dev
mailing list