| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
|  | 2 | * linux/arch/h8300/kernel/sys_h8300.c | 
|  | 3 | * | 
|  | 4 | * This file contains various random system calls that | 
|  | 5 | * have a non-standard calling sequence on the H8/300 | 
|  | 6 | * platform. | 
|  | 7 | */ | 
|  | 8 |  | 
|  | 9 | #include <linux/errno.h> | 
|  | 10 | #include <linux/sched.h> | 
|  | 11 | #include <linux/mm.h> | 
|  | 12 | #include <linux/smp.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | #include <linux/sem.h> | 
|  | 14 | #include <linux/msg.h> | 
|  | 15 | #include <linux/shm.h> | 
|  | 16 | #include <linux/stat.h> | 
|  | 17 | #include <linux/syscalls.h> | 
|  | 18 | #include <linux/mman.h> | 
|  | 19 | #include <linux/file.h> | 
| Yoshinori Sato | 0cd82ef | 2007-08-22 14:01:24 -0700 | [diff] [blame] | 20 | #include <linux/fs.h> | 
| Adrian Bunk | cba4fbb | 2007-10-16 23:29:24 -0700 | [diff] [blame] | 21 | #include <linux/ipc.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 |  | 
|  | 23 | #include <asm/setup.h> | 
|  | 24 | #include <asm/uaccess.h> | 
|  | 25 | #include <asm/cachectl.h> | 
|  | 26 | #include <asm/traps.h> | 
| Arnd Bergmann | fe74290 | 2006-10-02 02:18:34 -0700 | [diff] [blame] | 27 | #include <asm/unistd.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | /* sys_cacheflush -- no support.  */ | 
|  | 30 | asmlinkage int | 
|  | 31 | sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len) | 
|  | 32 | { | 
|  | 33 | return -EINVAL; | 
|  | 34 | } | 
|  | 35 |  | 
|  | 36 | asmlinkage int sys_getpagesize(void) | 
|  | 37 | { | 
|  | 38 | return PAGE_SIZE; | 
|  | 39 | } | 
|  | 40 |  | 
|  | 41 | #if defined(CONFIG_SYSCALL_PRINT) | 
|  | 42 | asmlinkage void syscall_print(void *dummy,...) | 
|  | 43 | { | 
|  | 44 | struct pt_regs *regs = (struct pt_regs *) ((unsigned char *)&dummy-4); | 
|  | 45 | printk("call %06lx:%ld 1:%08lx,2:%08lx,3:%08lx,ret:%08lx\n", | 
|  | 46 | ((regs->pc)&0xffffff)-2,regs->orig_er0,regs->er1,regs->er2,regs->er3,regs->er0); | 
|  | 47 | } | 
|  | 48 | #endif | 
| Arnd Bergmann | fe74290 | 2006-10-02 02:18:34 -0700 | [diff] [blame] | 49 |  | 
|  | 50 | /* | 
|  | 51 | * Do a system call from kernel instead of calling sys_execve so we | 
|  | 52 | * end up with proper pt_regs. | 
|  | 53 | */ | 
|  | 54 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | 
|  | 55 | { | 
|  | 56 | register long res __asm__("er0"); | 
| Yoshinori Sato | 8778beb | 2007-06-01 00:47:01 -0700 | [diff] [blame] | 57 | register char *const *_c __asm__("er3") = envp; | 
|  | 58 | register char *const *_b __asm__("er2") = argv; | 
| Arnd Bergmann | fe74290 | 2006-10-02 02:18:34 -0700 | [diff] [blame] | 59 | register const char * _a __asm__("er1") = filename; | 
| Arnd Bergmann | fe74290 | 2006-10-02 02:18:34 -0700 | [diff] [blame] | 60 | __asm__ __volatile__ ("mov.l %1,er0\n\t" | 
|  | 61 | "trapa	#0\n\t" | 
|  | 62 | : "=r" (res) | 
|  | 63 | : "g" (__NR_execve), | 
|  | 64 | "g" (_a), | 
|  | 65 | "g" (_b), | 
|  | 66 | "g" (_c) | 
|  | 67 | : "cc", "memory"); | 
|  | 68 | return res; | 
|  | 69 | } | 
|  | 70 |  | 
|  | 71 |  |