From ec98c6b9b47df6df1c1fa6cf3d427414f8c2cf16 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Sun, 20 Apr 2008 02:14:23 -0700 Subject: [SPARC]: Remove SunOS and Solaris binary support. As per Documentation/feature-removal-schedule.txt Signed-off-by: David S. Miller --- arch/sparc/kernel/Makefile | 10 +- arch/sparc/kernel/entry.S | 206 +------ arch/sparc/kernel/errtbls.c | 144 ----- arch/sparc/kernel/head.S | 37 +- arch/sparc/kernel/sclow.S | 86 --- arch/sparc/kernel/signal.c | 307 +--------- arch/sparc/kernel/sparc_ksyms.c | 8 - arch/sparc/kernel/sunos_asm.S | 67 --- arch/sparc/kernel/sunos_ioctl.c | 230 -------- arch/sparc/kernel/sys_solaris.c | 35 -- arch/sparc/kernel/sys_sunos.c | 1210 --------------------------------------- arch/sparc/kernel/systbls.S | 121 ---- 12 files changed, 40 insertions(+), 2421 deletions(-) delete mode 100644 arch/sparc/kernel/errtbls.c delete mode 100644 arch/sparc/kernel/sclow.S delete mode 100644 arch/sparc/kernel/sunos_asm.S delete mode 100644 arch/sparc/kernel/sunos_ioctl.c delete mode 100644 arch/sparc/kernel/sys_solaris.c delete mode 100644 arch/sparc/kernel/sys_sunos.c (limited to 'arch/sparc/kernel') diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile index 2712bb166f6..59700aaaae9 100644 --- a/arch/sparc/kernel/Makefile +++ b/arch/sparc/kernel/Makefile @@ -9,9 +9,9 @@ EXTRA_AFLAGS := -ansi IRQ_OBJS := irq.o sun4m_irq.o sun4c_irq.o sun4d_irq.o obj-y := entry.o wof.o wuf.o etrap.o rtrap.o traps.o $(IRQ_OBJS) \ process.o signal.o ioport.o setup.o idprom.o \ - sys_sparc.o sunos_asm.o systbls.o \ - time.o windows.o cpu.o devices.o sclow.o \ - tadpole.o tick14.o ptrace.o sys_solaris.o \ + sys_sparc.o systbls.o \ + time.o windows.o cpu.o devices.o \ + tadpole.o tick14.o ptrace.o \ unaligned.o una_asm.o muldiv.o \ prom.o of_device.o devres.o @@ -25,7 +25,3 @@ obj-$(CONFIG_PCI) += ebus.o obj-$(CONFIG_SUN_PM) += apc.o pmc.o obj-$(CONFIG_MODULES) += module.o sparc_ksyms.o obj-$(CONFIG_SPARC_LED) += led.o - -ifdef CONFIG_SUNOS_EMUL -obj-y += sys_sunos.o sunos_ioctl.o -endif diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S index c2eed8f7151..135644f8add 100644 --- a/arch/sparc/kernel/entry.S +++ b/arch/sparc/kernel/entry.S @@ -1186,36 +1186,6 @@ srmmu_fault: RESTORE_ALL -#ifdef CONFIG_SUNOS_EMUL - /* SunOS uses syscall zero as the 'indirect syscall' it looks - * like indir_syscall(scall_num, arg0, arg1, arg2...); etc. - * This is complete brain damage. - */ - .globl sunos_indir -sunos_indir: - mov %o7, %l4 - cmp %o0, NR_SYSCALLS - blu,a 1f - sll %o0, 0x2, %o0 - - sethi %hi(sunos_nosys), %l6 - b 2f - or %l6, %lo(sunos_nosys), %l6 - -1: - set sunos_sys_table, %l7 - ld [%l7 + %o0], %l6 - -2: - mov %o1, %o0 - mov %o2, %o1 - mov %o3, %o2 - mov %o4, %o3 - mov %o5, %o4 - call %l6 - mov %l4, %o7 -#endif - .align 4 .globl sys_nis_syscall sys_nis_syscall: @@ -1232,6 +1202,16 @@ sys_execve: call sparc_execve mov %l5, %o7 + .globl sunos_execv +sunos_execv: + st %g0, [%sp + STACKFRAME_SZ + PT_I2] + + call sparc_execve + add %sp, STACKFRAME_SZ, %o0 + + b ret_sys_call + ld [%sp + STACKFRAME_SZ + PT_I0], %o0 + .align 4 .globl sys_pipe sys_pipe: @@ -1394,7 +1374,7 @@ ret_from_fork: b ret_sys_call ld [%sp + STACKFRAME_SZ + PT_I0], %o0 - /* Linux native and SunOS system calls enter here... */ + /* Linux native system calls enter here... */ .align 4 .globl linux_sparc_syscall linux_sparc_syscall: @@ -1472,170 +1452,6 @@ linux_syscall_trace2: st %l2, [%sp + STACKFRAME_SZ + PT_NPC] - /* - * Solaris system calls and indirect system calls enter here. - * - * I have named the solaris indirect syscalls like that because - * it seems like Solaris has some fast path syscalls that can - * be handled as indirect system calls. - mig - */ - -linux_syscall_for_solaris: - sethi %hi(sys_call_table), %l7 - b linux_sparc_syscall - or %l7, %lo(sys_call_table), %l7 - - .align 4 - .globl solaris_syscall -solaris_syscall: - cmp %g1,59 - be linux_syscall_for_solaris - cmp %g1,2 - be linux_syscall_for_solaris - cmp %g1,42 - be linux_syscall_for_solaris - cmp %g1,119 - be,a linux_syscall_for_solaris - mov 2, %g1 -1: - SAVE_ALL_HEAD - rd %wim, %l3 - - wr %l0, PSR_ET, %psr - nop - nop - mov %i0, %l5 - - call do_solaris_syscall - add %sp, STACKFRAME_SZ, %o0 - - st %o0, [%sp + STACKFRAME_SZ + PT_I0] - set PSR_C, %g2 - cmp %o0, -ERESTART_RESTARTBLOCK - bgeu 1f - ld [%sp + STACKFRAME_SZ + PT_PSR], %g3 - - /* System call success, clear Carry condition code. */ - andn %g3, %g2, %g3 - clr %l6 - b 2f - st %g3, [%sp + STACKFRAME_SZ + PT_PSR] - -1: - /* System call failure, set Carry condition code. - * Also, get abs(errno) to return to the process. - */ - sub %g0, %o0, %o0 - mov 1, %l6 - st %o0, [%sp + STACKFRAME_SZ + PT_I0] - or %g3, %g2, %g3 - st %g3, [%sp + STACKFRAME_SZ + PT_PSR] - - /* Advance the pc and npc over the trap instruction. - * If the npc is unaligned (has a 1 in the lower byte), it means - * the kernel does not want us to play magic (ie, skipping over - * traps). Mainly when the Solaris code wants to set some PC and - * nPC (setcontext). - */ -2: - ld [%sp + STACKFRAME_SZ + PT_NPC], %l1 /* pc = npc */ - andcc %l1, 1, %g0 - bne 1f - add %l1, 0x4, %l2 /* npc = npc+4 */ - st %l1, [%sp + STACKFRAME_SZ + PT_PC] - b ret_trap_entry - st %l2, [%sp + STACKFRAME_SZ + PT_NPC] - - /* kernel knows what it is doing, fixup npc and continue */ -1: - sub %l1, 1, %l1 - b ret_trap_entry - st %l1, [%sp + STACKFRAME_SZ + PT_NPC] - -#ifndef CONFIG_SUNOS_EMUL - .align 4 - .globl sunos_syscall -sunos_syscall: - SAVE_ALL_HEAD - rd %wim, %l3 - wr %l0, PSR_ET, %psr - nop - nop - mov %i0, %l5 - call do_sunos_syscall - add %sp, STACKFRAME_SZ, %o0 -#endif - - /* {net, open}bsd system calls enter here... */ - .align 4 - .globl bsd_syscall -bsd_syscall: - /* Direct access to user regs, must faster. */ - cmp %g1, NR_SYSCALLS - blu,a 1f - sll %g1, 2, %l4 - - set sys_ni_syscall, %l7 - b bsd_is_too_hard - nop - -1: - ld [%l7 + %l4], %l7 - - .globl bsd_is_too_hard -bsd_is_too_hard: - rd %wim, %l3 - SAVE_ALL - - wr %l0, PSR_ET, %psr - WRITE_PAUSE - -2: - mov %i0, %o0 - mov %i1, %o1 - mov %i2, %o2 - mov %i0, %l5 - mov %i3, %o3 - mov %i4, %o4 - call %l7 - mov %i5, %o5 - - st %o0, [%sp + STACKFRAME_SZ + PT_I0] - set PSR_C, %g2 - cmp %o0, -ERESTART_RESTARTBLOCK - bgeu 1f - ld [%sp + STACKFRAME_SZ + PT_PSR], %g3 - - /* System call success, clear Carry condition code. */ - andn %g3, %g2, %g3 - clr %l6 - b 2f - st %g3, [%sp + STACKFRAME_SZ + PT_PSR] - -1: - /* System call failure, set Carry condition code. - * Also, get abs(errno) to return to the process. - */ - sub %g0, %o0, %o0 -#if 0 /* XXX todo XXX */ - sethi %hi(bsd_xlatb_rorl), %o3 - or %o3, %lo(bsd_xlatb_rorl), %o3 - sll %o0, 2, %o0 - ld [%o3 + %o0], %o0 -#endif - mov 1, %l6 - st %o0, [%sp + STACKFRAME_SZ + PT_I0] - or %g3, %g2, %g3 - st %g3, [%sp + STACKFRAME_SZ + PT_PSR] - - /* Advance the pc and npc over the trap instruction. */ -2: - ld [%sp + STACKFRAME_SZ + PT_NPC], %l1 /* pc = npc */ - add %l1, 0x4, %l2 /* npc = npc+4 */ - st %l1, [%sp + STACKFRAME_SZ + PT_PC] - b ret_trap_entry - st %l2, [%sp + STACKFRAME_SZ + PT_NPC] - /* Saving and restoring the FPU state is best done from lowlevel code. * * void fpsave(unsigned long *fpregs, unsigned long *fsr, diff --git a/arch/sparc/kernel/errtbls.c b/arch/sparc/kernel/errtbls.c deleted file mode 100644 index ed14df7116e..00000000000 --- a/arch/sparc/kernel/errtbls.c +++ /dev/null @@ -1,144 +0,0 @@ -/* errtbls.c: Error number conversion tables. - * - * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net) - * - * Based upon preliminary work which is: - * - * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu) - */ - -#include /* Solaris errnos */ - -/* Here is the table which converts between Linux error number values - * to the equivalent under Solaris. Note that since the Linux ones - * have been set up to match exactly those of SunOS, no translation - * table is needed for that OS. - */ - -int solaris_errno[] = { - 0, - SOL_EPERM, - SOL_ENOENT, - SOL_ESRCH, - SOL_EINTR, - SOL_EIO, - SOL_ENXIO, - SOL_E2BIG, - SOL_ENOEXEC, - SOL_EBADF, - SOL_ECHILD, - SOL_EAGAIN, - SOL_ENOMEM, - SOL_EACCES, - SOL_EFAULT, - SOL_NOTBLK, - SOL_EBUSY, - SOL_EEXIST, - SOL_EXDEV, - SOL_ENODEV, - SOL_ENOTDIR, - SOL_EISDIR, - SOL_EINVAL, - SOL_ENFILE, - SOL_EMFILE, - SOL_ENOTTY, - SOL_ETXTBSY, - SOL_EFBIG, - SOL_ENOSPC, - SOL_ESPIPE, - SOL_EROFS, - SOL_EMLINK, - SOL_EPIPE, - SOL_EDOM, - SOL_ERANGE, - SOL_EWOULDBLOCK, - SOL_EINPROGRESS, - SOL_EALREADY, - SOL_ENOTSOCK, - SOL_EDESTADDRREQ, - SOL_EMSGSIZE, - SOL_EPROTOTYPE, - SOL_ENOPROTOOPT, - SOL_EPROTONOSUPPORT, - SOL_ESOCKTNOSUPPORT, - SOL_EOPNOTSUPP, - SOL_EPFNOSUPPORT, - SOL_EAFNOSUPPORT, - SOL_EADDRINUSE, - SOL_EADDRNOTAVAIL, - SOL_ENETDOWN, - SOL_ENETUNREACH, - SOL_ENETRESET, - SOL_ECONNABORTED, - SOL_ECONNRESET, - SOL_ENOBUFS, - SOL_EISCONN, - SOL_ENOTONN, - SOL_ESHUTDOWN, - SOL_ETOOMANYREFS, - SOL_ETIMEDOUT, - SOL_ECONNREFUSED, - SOL_ELOOP, - SOL_ENAMETOOLONG, - SOL_EHOSTDOWN, - SOL_EHOSTUNREACH, - SOL_ENOTEMPTY, - SOL_EPROCLIM, - SOL_EUSERS, - SOL_EDQUOT, - SOL_ESTALE, - SOL_EREMOTE, - SOL_ENOSTR, - SOL_ETIME, - SOL_ENOSR, - SOL_ENOMSG, - SOL_EBADMSG, - SOL_IDRM, - SOL_EDEADLK, - SOL_ENOLCK, - SOL_ENONET, - SOL_ERREMOTE, - SOL_ENOLINK, - SOL_EADV, - SOL_ESRMNT, - SOL_ECOMM, - SOL_EPROTO, - SOL_EMULTIHOP, - SOL_EINVAL, /* EDOTDOT XXX??? */ - SOL_REMCHG, - SOL_NOSYS, - SOL_STRPIPE, - SOL_EOVERFLOW, - SOL_EBADFD, - SOL_ECHRNG, - SOL_EL2NSYNC, - SOL_EL3HLT, - SOL_EL3RST, - SOL_NRNG, - SOL_EUNATCH, - SOL_ENOCSI, - SOL_EL2HLT, - SOL_EBADE, - SOL_EBADR, - SOL_EXFULL, - SOL_ENOANO, - SOL_EBADRQC, - SOL_EBADSLT, - SOL_EDEADLOCK, - SOL_EBFONT, - SOL_ELIBEXEC, - SOL_ENODATA, - SOL_ELIBBAD, - SOL_ENOPKG, - SOL_ELIBACC, - SOL_ENOTUNIQ, - SOL_ERESTART, - SOL_EUCLEAN, - SOL_ENOTNAM, - SOL_ENAVAIL, - SOL_EISNAM, - SOL_EREMOTEIO, - SOL_EILSEQ, - SOL_ELIBMAX, - SOL_ELIBSCN, -}; diff --git a/arch/sparc/kernel/head.S b/arch/sparc/kernel/head.S index 9a219e8b5dd..b7f1e81c8ff 100644 --- a/arch/sparc/kernel/head.S +++ b/arch/sparc/kernel/head.S @@ -78,11 +78,6 @@ sun4e_notsup: .asciz "Sparc-Linux sun4e support does not exist\n\n" .align 4 -#ifndef CONFIG_SUNOS_EMUL -#undef SUNOS_SYSCALL_TRAP -#define SUNOS_SYSCALL_TRAP SUNOS_NO_SYSCALL_TRAP -#endif - /* The Sparc trap table, bootloader gives us control at _start. */ .text .globl start, _stext, _start, __stext @@ -158,7 +153,7 @@ t_bad6f:BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x7 t_bad74:BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78) t_bad79:BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d) t_bad7e:BAD_TRAP(0x7e) BAD_TRAP(0x7f) -t_sunos:SUNOS_SYSCALL_TRAP /* SunOS System Call */ +t_bad80:BAD_TRAP(0x80) /* SunOS System Call */ t_sbkpt:BREAKPOINT_TRAP /* Software Breakpoint/KGDB */ t_divz: TRAP_ENTRY(0x82, do_hw_divzero) /* Divide by zero trap */ t_flwin:TRAP_ENTRY(0x83, do_flush_windows) /* Flush Windows Trap */ @@ -166,8 +161,8 @@ t_clwin:BAD_TRAP(0x84) /* Clean Windows Trap */ t_rchk: BAD_TRAP(0x85) /* Range Check */ t_funal:BAD_TRAP(0x86) /* Fix Unaligned Access Trap */ t_iovf: BAD_TRAP(0x87) /* Integer Overflow Trap */ -t_slowl:SOLARIS_SYSCALL_TRAP /* Slowaris System Call */ -t_netbs:NETBSD_SYSCALL_TRAP /* Net-B.S. System Call */ +t_bad88:BAD_TRAP(0x88) /* Slowaris System Call */ +t_bad89:BAD_TRAP(0x89) /* Net-B.S. System Call */ t_bad8a:BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) BAD_TRAP(0x8d) BAD_TRAP(0x8e) t_bad8f:BAD_TRAP(0x8f) t_linux:LINUX_SYSCALL_TRAP /* Linux System Call */ @@ -178,7 +173,7 @@ t_getcc:GETCC_TRAP /* Get Condition Codes */ t_setcc:SETCC_TRAP /* Set Condition Codes */ t_getpsr:GETPSR_TRAP /* Get PSR Register */ t_bada3:BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6) -t_slowi:INDIRECT_SOLARIS_SYSCALL(156) +t_bada7:BAD_TRAP(0xa7) t_bada8:BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab) t_badac:BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0) t_badb1:BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5) @@ -243,19 +238,19 @@ trapbase_cpu1: BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78) BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d) BAD_TRAP(0x7e) BAD_TRAP(0x7f) - SUNOS_SYSCALL_TRAP + BAD_TRAP(0x80) BREAKPOINT_TRAP TRAP_ENTRY(0x82, do_hw_divzero) TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85) - BAD_TRAP(0x86) BAD_TRAP(0x87) SOLARIS_SYSCALL_TRAP - NETBSD_SYSCALL_TRAP BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) + BAD_TRAP(0x86) BAD_TRAP(0x87) BAD_TRAP(0x88) + BAD_TRAP(0x89) BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f) LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94) BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99) BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e) BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6) - INDIRECT_SOLARIS_SYSCALL(156) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab) + BAD_TRAP(0xa7) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab) BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0) BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5) BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba) @@ -311,19 +306,19 @@ trapbase_cpu2: BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78) BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d) BAD_TRAP(0x7e) BAD_TRAP(0x7f) - SUNOS_SYSCALL_TRAP + BAD_TRAP(0x80) BREAKPOINT_TRAP TRAP_ENTRY(0x82, do_hw_divzero) TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85) - BAD_TRAP(0x86) BAD_TRAP(0x87) SOLARIS_SYSCALL_TRAP - NETBSD_SYSCALL_TRAP BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) + BAD_TRAP(0x86) BAD_TRAP(0x87) BAD_TRAP(0x88) + BAD_TRAP(0x89) BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f) LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94) BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99) BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e) BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6) - INDIRECT_SOLARIS_SYSCALL(156) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab) + BAD_TRAP(0xa7) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab) BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0) BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5) BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba) @@ -379,19 +374,19 @@ trapbase_cpu3: BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78) BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d) BAD_TRAP(0x7e) BAD_TRAP(0x7f) - SUNOS_SYSCALL_TRAP + BAD_TRAP(0x80) BREAKPOINT_TRAP TRAP_ENTRY(0x82, do_hw_divzero) TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85) - BAD_TRAP(0x86) BAD_TRAP(0x87) SOLARIS_SYSCALL_TRAP - NETBSD_SYSCALL_TRAP BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) + BAD_TRAP(0x86) BAD_TRAP(0x87) BAD_TRAP(0x88) + BAD_TRAP(0x89) BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f) LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94) BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99) BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e) BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6) - INDIRECT_SOLARIS_SYSCALL(156) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab) + BAD_TRAP(0xa7) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab) BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0) BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5) BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba) diff --git a/arch/sparc/kernel/sclow.S b/arch/sparc/kernel/sclow.S deleted file mode 100644 index 136e37c53d4..00000000000 --- a/arch/sparc/kernel/sclow.S +++ /dev/null @@ -1,86 +0,0 @@ -/* sclow.S: Low level special syscall handling. - * Basically these are cases where we can completely - * handle the system call without saving any state - * because we know that the process will not sleep. - * - * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) - */ - -#include -#include -#include -#include -#include -#include -#include - -#define CC_AND_RETT \ - set PSR_C, %l4; \ - andn %l0, %l4, %l4; \ - wr %l4, 0x0, %psr; \ - nop; nop; nop; \ - jmp %l2; \ - rett %l2 + 4; - -#define SC_AND_RETT \ - set PSR_C, %l4; \ - or %l0, %l4, %l4; \ - wr %l4, 0x0, %psr; \ - nop; nop; nop; \ - jmp %l2; \ - rett %l2 + 4; - -#define LABEL(func) func##_low - - .globl LABEL(sunosnop) -LABEL(sunosnop): - CC_AND_RETT - -#if (ASIZ_task_uid == 2 && ASIZ_task_euid == 2) - .globl LABEL(sunosgetuid) -LABEL(sunosgetuid): - LOAD_CURRENT(l4, l5) - ld [%l4 + TI_TASK], %l4 - lduh [%l4 + AOFF_task_uid], %i0 - lduh [%l4 + AOFF_task_euid], %i1 - CC_AND_RETT -#endif - -#if (ASIZ_task_gid == 2 && ASIZ_task_egid == 2) - .globl LABEL(sunosgetgid) -LABEL(sunosgetgid): - LOAD_CURRENT(l4, l5) - ld [%l4 + TI_TASK], %l4 - lduh [%l4 + AOFF_task_gid], %i0 - lduh [%l4 + AOFF_task_egid], %i1 - CC_AND_RETT -#endif - - .globl LABEL(sunosmctl) -LABEL(sunosmctl): - mov 0, %i0 - CC_AND_RETT - - .globl LABEL(sunosgdtsize) -LABEL(sunosgdtsize): - mov 256, %i0 - CC_AND_RETT - - .globl LABEL(getpagesize) -LABEL(getpagesize): - set PAGE_SIZE, %i0 - CC_AND_RETT - - /* XXX sys_nice() XXX */ - /* XXX sys_setpriority() XXX */ - /* XXX sys_getpriority() XXX */ - /* XXX sys_setregid() XXX */ - /* XXX sys_setgid() XXX */ - /* XXX sys_setreuid() XXX */ - /* XXX sys_setuid() XXX */ - /* XXX sys_setfsuid() XXX */ - /* XXX sys_setfsgid() XXX */ - /* XXX sys_setpgid() XXX */ - /* XXX sys_getpgid() XXX */ - /* XXX sys_setsid() XXX */ - /* XXX sys_getsid() XXX */ diff --git a/arch/sparc/kernel/signal.c b/arch/sparc/kernel/signal.c index 9994cac9507..1f730619a24 100644 --- a/arch/sparc/kernel/signal.c +++ b/arch/sparc/kernel/signal.c @@ -22,7 +22,6 @@ #include #include -#include #include #include #include /* flush_sig_insns */ @@ -454,7 +453,6 @@ setup_frame(struct sigaction *sa, struct pt_regs *regs, int signr, sigset_t *old break; case SIGSYS: if (info->si_code == (__SI_FAULT|0x100)) { - /* See sys_sunos.c */ sig_code = info->si_trapno; break; } @@ -676,291 +674,17 @@ sigsegv: force_sigsegv(signo, current); } -/* Setup a Solaris stack frame */ -static inline void -setup_svr4_frame(struct sigaction *sa, unsigned long pc, unsigned long npc, - struct pt_regs *regs, int signr, sigset_t *oldset) -{ - svr4_signal_frame_t __user *sfp; - svr4_gregset_t __user *gr; - svr4_siginfo_t __user *si; - svr4_mcontext_t __user *mc; - svr4_gwindows_t __user *gw; - svr4_ucontext_t __user *uc; - svr4_sigset_t setv; - struct thread_info *tp = current_thread_info(); - int window = 0, err; - - synchronize_user_stack(); - sfp = (svr4_signal_frame_t __user *) - get_sigframe(sa, regs, SVR4_SF_ALIGNED + sizeof(struct reg_window)); - - if (invalid_frame_pointer(sfp, sizeof(*sfp))) - goto sigill_and_return; - - /* Start with a clean frame pointer and fill it */ - err = __clear_user(sfp, sizeof(*sfp)); - - /* Setup convenience variables */ - si = &sfp->si; - uc = &sfp->uc; - gw = &sfp->gw; - mc = &uc->mcontext; - gr = &mc->greg; - - /* FIXME: where am I supposed to put this? - * sc->sigc_onstack = old_status; - * anyways, it does not look like it is used for anything at all. - */ - setv.sigbits[0] = oldset->sig[0]; - setv.sigbits[1] = oldset->sig[1]; - if (_NSIG_WORDS >= 4) { - setv.sigbits[2] = oldset->sig[2]; - setv.sigbits[3] = oldset->sig[3]; - err |= __copy_to_user(&uc->sigmask, &setv, sizeof(svr4_sigset_t)); - } else - err |= __copy_to_user(&uc->sigmask, &setv, - 2 * sizeof(unsigned int)); - - /* Store registers */ - err |= __put_user(regs->pc, &((*gr)[SVR4_PC])); - err |= __put_user(regs->npc, &((*gr)[SVR4_NPC])); - err |= __put_user(regs->psr, &((*gr)[SVR4_PSR])); - err |= __put_user(regs->y, &((*gr)[SVR4_Y])); - - /* Copy g[1..7] and o[0..7] registers */ - err |= __copy_to_user(&(*gr)[SVR4_G1], ®s->u_regs[UREG_G1], - sizeof(long) * 7); - err |= __copy_to_user(&(*gr)[SVR4_O0], ®s->u_regs[UREG_I0], - sizeof(long) * 8); - - /* Setup sigaltstack */ - err |= __put_user(current->sas_ss_sp, &uc->stack.sp); - err |= __put_user(sas_ss_flags(regs->u_regs[UREG_FP]), &uc->stack.flags); - err |= __put_user(current->sas_ss_size, &uc->stack.size); - - /* Save the currently window file: */ - - /* 1. Link sfp->uc->gwins to our windows */ - err |= __put_user(gw, &mc->gwin); - - /* 2. Number of windows to restore at setcontext(): */ - err |= __put_user(tp->w_saved, &gw->count); - - /* 3. Save each valid window - * Currently, it makes a copy of the windows from the kernel copy. - * David's code for SunOS, makes the copy but keeps the pointer to - * the kernel. My version makes the pointer point to a userland - * copy of those. Mhm, I wonder if I shouldn't just ignore those - * on setcontext and use those that are on the kernel, the signal - * handler should not be modyfing those, mhm. - * - * These windows are just used in case synchronize_user_stack failed - * to flush the user windows. - */ - for (window = 0; window < tp->w_saved; window++) { - err |= __put_user((int __user *) &(gw->win[window]), &gw->winptr[window]); - err |= __copy_to_user(&gw->win[window], - &tp->reg_window[window], - sizeof(svr4_rwindow_t)); - err |= __put_user(0, gw->winptr[window]); - } - - /* 4. We just pay attention to the gw->count field on setcontext */ - tp->w_saved = 0; /* So process is allowed to execute. */ - - /* Setup the signal information. Solaris expects a bunch of - * information to be passed to the signal handler, we don't provide - * that much currently, should use siginfo. - */ - err |= __put_user(signr, &si->siginfo.signo); - err |= __put_user(SVR4_SINOINFO, &si->siginfo.code); - if (err) - goto sigsegv; - - regs->u_regs[UREG_FP] = (unsigned long) sfp; - regs->pc = (unsigned long) sa->sa_handler; - regs->npc = (regs->pc + 4); - - /* Arguments passed to signal handler */ - if (regs->u_regs[14]){ - struct reg_window __user *rw = (struct reg_window __user *) - regs->u_regs[14]; - - err |= __put_user(signr, &rw->ins[0]); - err |= __put_user(si, &rw->ins[1]); - err |= __put_user(uc, &rw->ins[2]); - err |= __put_user(sfp, &rw->ins[6]); /* frame pointer */ - if (err) - goto sigsegv; - - regs->u_regs[UREG_I0] = signr; - regs->u_regs[UREG_I1] = (unsigned long) si; - regs->u_regs[UREG_I2] = (unsigned long) uc; - } - return; - -sigill_and_return: - do_exit(SIGILL); -sigsegv: - force_sigsegv(signr, current); -} - -asmlinkage int svr4_getcontext(svr4_ucontext_t __user *uc, struct pt_regs *regs) -{ - svr4_gregset_t __user *gr; - svr4_mcontext_t __user *mc; - svr4_sigset_t setv; - int err = 0; - - synchronize_user_stack(); - - if (current_thread_info()->w_saved) - return -EFAULT; - - err = clear_user(uc, sizeof(*uc)); - if (err) - return -EFAULT; - - /* Setup convenience variables */ - mc = &uc->mcontext; - gr = &mc->greg; - - setv.sigbits[0] = current->blocked.sig[0]; - setv.sigbits[1] = current->blocked.sig[1]; - if (_NSIG_WORDS >= 4) { - setv.sigbits[2] = current->blocked.sig[2]; - setv.sigbits[3] = current->blocked.sig[3]; - err |= __copy_to_user(&uc->sigmask, &setv, sizeof(svr4_sigset_t)); - } else - err |= __copy_to_user(&uc->sigmask, &setv, - 2 * sizeof(unsigned int)); - - /* Store registers */ - err |= __put_user(regs->pc, &uc->mcontext.greg[SVR4_PC]); - err |= __put_user(regs->npc, &uc->mcontext.greg[SVR4_NPC]); - err |= __put_user(regs->psr, &uc->mcontext.greg[SVR4_PSR]); - err |= __put_user(regs->y, &uc->mcontext.greg[SVR4_Y]); - - /* Copy g[1..7] and o[0..7] registers */ - err |= __copy_to_user(&(*gr)[SVR4_G1], ®s->u_regs[UREG_G1], - sizeof(uint) * 7); - err |= __copy_to_user(&(*gr)[SVR4_O0], ®s->u_regs[UREG_I0], - sizeof(uint) * 8); - - /* Setup sigaltstack */ - err |= __put_user(current->sas_ss_sp, &uc->stack.sp); - err |= __put_user(sas_ss_flags(regs->u_regs[UREG_FP]), &uc->stack.flags); - err |= __put_user(current->sas_ss_size, &uc->stack.size); - - /* The register file is not saved - * we have already stuffed all of it with sync_user_stack - */ - return (err ? -EFAULT : 0); -} - -/* Set the context for a svr4 application, this is Solaris way to sigreturn */ -asmlinkage int svr4_setcontext(svr4_ucontext_t __user *c, struct pt_regs *regs) -{ - svr4_gregset_t __user *gr; - unsigned long pc, npc, psr; - mm_segment_t old_fs; - sigset_t set; - svr4_sigset_t setv; - int err; - stack_t st; - - /* Fixme: restore windows, or is this already taken care of in - * svr4_setup_frame when sync_user_windows is done? - */ - flush_user_windows(); - - if (current_thread_info()->w_saved) - goto sigsegv_and_return; - - if (((unsigned long) c) & 3) - goto sigsegv_and_return; - - if (!__access_ok((unsigned long)c, sizeof(*c))) - goto sigsegv_and_return; - - /* Check for valid PC and nPC */ - gr = &c->mcontext.greg; - err = __get_user(pc, &((*gr)[SVR4_PC])); - err |= __get_user(npc, &((*gr)[SVR4_NPC])); - - if ((pc | npc) & 3) - goto sigsegv_and_return; - - /* Retrieve information from passed ucontext */ - /* note that nPC is ored a 1, this is used to inform entry.S */ - /* that we don't want it to mess with our PC and nPC */ - - /* This is pretty much atomic, no amount locking would prevent - * the races which exist anyways. - */ - err |= __copy_from_user(&setv, &c->sigmask, sizeof(svr4_sigset_t)); - - err |= __get_user(st.ss_sp, &c->stack.sp); - err |= __get_user(st.ss_flags, &c->stack.flags); - err |= __get_user(st.ss_size, &c->stack.size); - - if (err) - goto sigsegv_and_return; - - /* It is more difficult to avoid calling this function than to - call it and ignore errors. */ - old_fs = get_fs(); - set_fs(KERNEL_DS); - do_sigaltstack((const stack_t __user *) &st, NULL, - regs->u_regs[UREG_I6]); - set_fs(old_fs); - - set.sig[0] = setv.sigbits[0]; - set.sig[1] = setv.sigbits[1]; - if (_NSIG_WORDS >= 4) { - set.sig[2] = setv.sigbits[2]; - set.sig[3] = setv.sigbits[3]; - } - sigdelsetmask(&set, ~_BLOCKABLE); - spin_lock_irq(¤t->sighand->siglock); - current->blocked = set; - recalc_sigpending(); - spin_unlock_irq(¤t->sighand->siglock); - regs->pc = pc; - regs->npc = npc | 1; - err |= __get_user(regs->y, &((*gr)[SVR4_Y])); - err |= __get_user(psr, &((*gr)[SVR4_PSR])); - regs->psr &= ~(PSR_ICC); - regs->psr |= (psr & PSR_ICC); - - /* Restore g[1..7] and o[0..7] registers */ - err |= __copy_from_user(®s->u_regs[UREG_G1], &(*gr)[SVR4_G1], - sizeof(long) * 7); - err |= __copy_from_user(®s->u_regs[UREG_I0], &(*gr)[SVR4_O0], - sizeof(long) * 8); - return (err ? -EFAULT : 0); - -sigsegv_and_return: - force_sig(SIGSEGV, current); - return -EFAULT; -} - static inline void handle_signal(unsigned long signr, struct k_sigaction *ka, - siginfo_t *info, sigset_t *oldset, struct pt_regs *regs, - int svr4_signal) + siginfo_t *info, sigset_t *oldset, struct pt_regs *regs) { - if (svr4_signal) - setup_svr4_frame(&ka->sa, regs->pc, regs->npc, regs, signr, oldset); - else { - if (ka->sa.sa_flags & SA_SIGINFO) - new_setup_rt_frame(ka, regs, signr, oldset, info); - else if (current->thread.new_signal) - new_setup_frame(ka, regs, signr, oldset); - else - setup_frame(&ka->sa, regs, signr, oldset, info); - } + if (ka->sa.sa_flags & SA_SIGINFO) + new_setup_rt_frame(ka, regs, signr, oldset, info); + else if (current->thread.new_signal) + new_setup_frame(ka, regs, signr, oldset); + else + setup_frame(&ka->sa, regs, signr, oldset, info); + spin_lock_irq(¤t->sighand->siglock); sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); if (!(ka->sa.sa_flags & SA_NOMASK)) @@ -1002,17 +726,6 @@ asmlinkage void do_signal(struct pt_regs * regs, unsigned long orig_i0, int rest int signr; sigset_t *oldset; - /* - * XXX Disable svr4 signal handling until solaris emulation works. - * It is buggy - Anton - */ -#define SVR4_SIGNAL_BROKEN 1 -#ifdef SVR4_SIGNAL_BROKEN - int svr4_signal = 0; -#else - int svr4_signal = current->personality == PER_SVR4; -#endif - cookie.restart_syscall = restart_syscall; cookie.orig_i0 = orig_i0; @@ -1025,8 +738,8 @@ asmlinkage void do_signal(struct pt_regs * regs, unsigned long orig_i0, int rest if (signr > 0) { if (cookie.restart_syscall) syscall_restart(cookie.orig_i0, regs, &ka.sa); - handle_signal(signr, &ka, &info, oldset, - regs, svr4_signal); + handle_signal(signr, &ka, &info, oldset, regs); + /* a signal was successfully delivered; the saved * sigmask will have been stored in the signal frame, * and will be restored by sigreturn, so we can simply diff --git a/arch/sparc/kernel/sparc_ksyms.c b/arch/sparc/kernel/sparc_ksyms.c index 97b1de0e909..0bcf98a7ef3 100644 --- a/arch/sparc/kernel/sparc_ksyms.c +++ b/arch/sparc/kernel/sparc_ksyms.c @@ -36,12 +36,10 @@ #include #include #include -#include #include #include #include #include -#include #include #include #ifdef CONFIG_SBUS @@ -62,8 +60,6 @@ struct poll { short revents; }; -extern int svr4_getcontext (svr4_ucontext_t *, struct pt_regs *); -extern int svr4_setcontext (svr4_ucontext_t *, struct pt_regs *); extern void (*__copy_1page)(void *, const void *); extern void __memmove(void *, const void *, __kernel_size_t); extern void (*bzero_1page)(void *); @@ -204,10 +200,6 @@ EXPORT_SYMBOL(kmap_atomic); EXPORT_SYMBOL(kunmap_atomic); #endif -/* Solaris/SunOS binary compatibility */ -EXPORT_SYMBOL(svr4_setcontext); -EXPORT_SYMBOL(svr4_getcontext); - /* prom symbols */ EXPORT_SYMBOL(idprom); EXPORT_SYMBOL(prom_root_node); diff --git a/arch/sparc/kernel/sunos_asm.S b/arch/sparc/kernel/sunos_asm.S deleted file mode 100644 index 07fe86014fb..00000000000 --- a/arch/sparc/kernel/sunos_asm.S +++ /dev/null @@ -1,67 +0,0 @@ -/* $Id: sunos_asm.S,v 1.15 2000/01/11 17:33:21 jj Exp $ - * sunos_asm.S: SunOS system calls which must have a low-level - * entry point to operate correctly. - * - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - * - * Based upon preliminary work which is: - * - * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu) - */ - -#include - - .text - .align 4 - - /* When calling ret_sys_call, %o0 should contain the same - * value as in [%sp + STACKFRAME_SZ + PT_I0] */ - - /* SunOS getpid() returns pid in %o0 and ppid in %o1 */ - .globl sunos_getpid -sunos_getpid: - call sys_getppid - nop - - call sys_getpid - st %o0, [%sp + STACKFRAME_SZ + PT_I1] - - b ret_sys_call - st %o0, [%sp + STACKFRAME_SZ + PT_I0] - - /* SunOS getuid() returns uid in %o0 and euid in %o1 */ - .globl sunos_getuid -sunos_getuid: - call sys_geteuid16 - nop - - call sys_getuid16 - st %o0, [%sp + STACKFRAME_SZ + PT_I1] - - b ret_sys_call - st %o0, [%sp + STACKFRAME_SZ + PT_I0] - - /* SunOS getgid() returns gid in %o0 and egid in %o1 */ - .globl sunos_getgid -sunos_getgid: - call sys_getegid16 - nop - - call sys_getgid16 - st %o0, [%sp + STACKFRAME_SZ + PT_I1] - - b ret_sys_call - st %o0, [%sp + STACKFRAME_SZ + PT_I0] - - /* SunOS's execv() call only specifies the argv argument, the - * environment settings are the same as the calling processes. - */ - .globl sunos_execv -sunos_execv: - st %g0, [%sp + STACKFRAME_SZ + PT_I2] - - call sparc_execve - add %sp, STACKFRAME_SZ, %o0 - - b ret_sys_call - ld [%sp + STACKFRAME_SZ + PT_I0], %o0 diff --git a/arch/sparc/kernel/sunos_ioctl.c b/arch/sparc/kernel/sunos_ioctl.c deleted file mode 100644 index e613cc6a10b..00000000000 --- a/arch/sparc/kernel/sunos_ioctl.c +++ /dev/null @@ -1,230 +0,0 @@ -/* $Id: sunos_ioctl.c,v 1.34 2000/09/03 14:10:56 anton Exp $ - * sunos_ioctl.c: The Linux Operating system: SunOS ioctl compatibility. - * - * Copyright (C) 1995 Miguel de Icaza (miguel@nuclecu.unam.mx) - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if 0 -extern char sunkbd_type; -extern char sunkbd_layout; -#endif - -/* NR_OPEN is now larger and dynamic in recent kernels. */ -#define SUNOS_NR_OPEN 256 - -asmlinkage int sunos_ioctl (int fd, unsigned long cmd, unsigned long arg) -{ - int ret = -EBADF; - - if (fd >= SUNOS_NR_OPEN || !fcheck(fd)) - goto out; - - /* First handle an easy compat. case for tty ldisc. */ - if (cmd == TIOCSETD) { - int __user *p; - int ntty = N_TTY, tmp; - mm_segment_t oldfs; - - p = (int __user *) arg; - ret = -EFAULT; - if (get_user(tmp, p)) - goto out; - if (tmp == 2) { - oldfs = get_fs(); - set_fs(KERNEL_DS); - ret = sys_ioctl(fd, cmd, (unsigned long) &ntty); - set_fs(oldfs); - ret = (ret == -EINVAL ? -EOPNOTSUPP : ret); - goto out; - } - } - - /* Binary compatibility is good American knowhow fuckin' up. */ - if (cmd == TIOCNOTTY) { - ret = sys_setsid(); - goto out; - } - - /* SunOS networking ioctls. */ - switch (cmd) { - case _IOW('r', 10, struct rtentry): - ret = sys_ioctl(fd, SIOCADDRT, arg); - goto out; - case _IOW('r', 11, struct rtentry): - ret = sys_ioctl(fd, SIOCDELRT, arg); - goto out; - case _IOW('i', 12, struct ifreq): - ret = sys_ioctl(fd, SIOCSIFADDR, arg); - goto out; - case _IOWR('i', 13, struct ifreq): - ret = sys_ioctl(fd, SIOCGIFADDR, arg); - goto out; - case _IOW('i', 14, struct ifreq): - ret = sys_ioctl(fd, SIOCSIFDSTADDR, arg); - goto out; - case _IOWR('i', 15, struct ifreq): - ret = sys_ioctl(fd, SIOCGIFDSTADDR, arg); - goto out; - case _IOW('i', 16, struct ifreq): - ret = sys_ioctl(fd, SIOCSIFFLAGS, arg); - goto out; - case _IOWR('i', 17, struct ifreq): - ret = sys_ioctl(fd, SIOCGIFFLAGS, arg); - goto out; - case _IOW('i', 18, struct ifreq): - ret = sys_ioctl(fd, SIOCSIFMEM, arg); - goto out; - case _IOWR('i', 19, struct ifreq): - ret = sys_ioctl(fd, SIOCGIFMEM, arg); - goto out; - case _IOWR('i', 20, struct ifconf): - ret = sys_ioctl(fd, SIOCGIFCONF, arg); - goto out; - case _IOW('i', 21, struct ifreq): /* SIOCSIFMTU */ - ret = sys_ioctl(fd, SIOCSIFMTU, arg); - goto out; - case _IOWR('i', 22, struct ifreq): /* SIOCGIFMTU */ - ret = sys_ioctl(fd, SIOCGIFMTU, arg); - goto out; - - case _IOWR('i', 23, struct ifreq): - ret = sys_ioctl(fd, SIOCGIFBRDADDR, arg); - goto out; - case _IOW('i', 24, struct ifreq): - ret = sys_ioctl(fd, SIOCSIFBRDADDR, arg); - goto out; - case _IOWR('i', 25, struct ifreq): - ret = sys_ioctl(fd, SIOCGIFNETMASK, arg); - goto out; - case _IOW('i', 26, struct ifreq): - ret = sys_ioctl(fd, SIOCSIFNETMASK, arg); - goto out; - case _IOWR('i', 27, struct ifreq): - ret = sys_ioctl(fd, SIOCGIFMETRIC, arg); - goto out; - case _IOW('i', 28, struct ifreq): - ret = sys_ioctl(fd, SIOCSIFMETRIC, arg); - goto out; - - case _IOW('i', 30, struct arpreq): - ret = sys_ioctl(fd, SIOCSARP, arg); - goto out; - case _IOWR('i', 31, struct arpreq): - ret = sys_ioctl(fd, SIOCGARP, arg); - goto out; - case _IOW('i', 32, struct arpreq): - ret = sys_ioctl(fd, SIOCDARP, arg); - goto out; - - case _IOW('i', 40, struct ifreq): /* SIOCUPPER */ - case _IOW('i', 41, struct ifreq): /* SIOCLOWER */ - case _IOW('i', 44, struct ifreq): /* SIOCSETSYNC */ - case _IOW('i', 45, struct ifreq): /* SIOCGETSYNC */ - case _IOW('i', 46, struct ifreq): /* SIOCSSDSTATS */ - case _IOW('i', 47, struct ifreq): /* SIOCSSESTATS */ - case _IOW('i', 48, struct ifreq): /* SIOCSPROMISC */ - ret = -EOPNOTSUPP; - goto out; - - case _IOW('i', 49, struct ifreq): - ret = sys_ioctl(fd, SIOCADDMULTI, arg); - goto out; - case _IOW('i', 50, struct ifreq): - ret = sys_ioctl(fd, SIOCDELMULTI, arg); - goto out; - - /* FDDI interface ioctls, unsupported. */ - - case _IOW('i', 51, struct ifreq): /* SIOCFDRESET */ - case _IOW('i', 52, struct ifreq): /* SIOCFDSLEEP */ - case _IOW('i', 53, struct ifreq): /* SIOCSTRTFMWAR */ - case _IOW('i', 54, struct ifreq): /* SIOCLDNSTRTFW */ - case _IOW('i', 55, struct ifreq): /* SIOCGETFDSTAT */ - case _IOW('i', 56, struct ifreq): /* SIOCFDNMIINT */ - case _IOW('i', 57, struct ifreq): /* SIOCFDEXUSER */ - case _IOW('i', 58, struct ifreq): /* SIOCFDGNETMAP */ - case _IOW('i', 59, struct ifreq): /* SIOCFDGIOCTL */ - printk("FDDI ioctl, returning EOPNOTSUPP\n"); - ret = -EOPNOTSUPP; - goto out; - - case _IOW('t', 125, int): - /* More stupid tty sunos ioctls, just - * say it worked. - */ - ret = 0; - goto out; - /* Non posix grp */ - case _IOW('t', 118, int): { - int oldval, newval, __user *ptr; - - cmd = TIOCSPGRP; - ptr = (int __user *) arg; - ret = -EFAULT; - if (get_user(oldval, ptr)) - goto out; - ret = sys_ioctl(fd, cmd, arg); - __get_user(newval, ptr); - if (newval == -1) { - __put_user(oldval, ptr); - ret = -EIO; - } - if (ret == -ENOTTY) - ret = -EIO; - goto out; - } - - case _IOR('t', 119, int): { - int oldval, newval, __user *ptr; - - cmd = TIOCGPGRP; - ptr = (int __user *) arg; - ret = -EFAULT; - if (get_user(oldval, ptr)) - goto out; - ret = sys_ioctl(fd, cmd, arg); - __get_user(newval, ptr); - if (newval == -1) { - __put_user(oldval, ptr); - ret = -EIO; - } - if (ret == -ENOTTY) - ret = -EIO; - goto out; - } - } - -#if 0 - if ((cmd & 0xff00) == ('k' << 8)) { - printk ("[[KBIO: %8.8x\n", (unsigned int) cmd); - } -#endif - - ret = sys_ioctl(fd, cmd, arg); - /* so stupid... */ - ret = (ret == -EINVAL ? -EOPNOTSUPP : ret); -out: - return ret; -} - - diff --git a/arch/sparc/kernel/sys_solaris.c b/arch/sparc/kernel/sys_solaris.c deleted file mode 100644 index 2226a599248..00000000000 --- a/arch/sparc/kernel/sys_solaris.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * linux/arch/sparc/kernel/sys_solaris.c - * - * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -asmlinkage int -do_solaris_syscall (struct pt_regs *regs) -{ - static int cnt = 0; - if (++cnt < 10) printk ("No solaris handler\n"); - force_sig(SIGSEGV, current); - return 0; -} - -#ifndef CONFIG_SUNOS_EMUL -asmlinkage int -do_sunos_syscall (struct pt_regs *regs) -{ - static int cnt = 0; - if (++cnt < 10) printk ("SunOS binary emulation not compiled in\n"); - force_sig (SIGSEGV, current); - return 0; -} -#endif diff --git a/arch/sparc/kernel/sys_sunos.c b/arch/sparc/kernel/sys_sunos.c deleted file mode 100644 index f5b608bbe8a..00000000000 --- a/arch/sparc/kernel/sys_sunos.c +++ /dev/null @@ -1,1210 +0,0 @@ -/* $Id: sys_sunos.c,v 1.137 2002/02/08 03:57:14 davem Exp $ - * sys_sunos.c: SunOS specific syscall compatibility support. - * - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - * Copyright (C) 1995 Miguel de Icaza (miguel@nuclecu.unam.mx) - * - * Based upon preliminary work which is: - * - * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu) - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#ifndef KERNEL_DS -#include -#endif - -#include -#include -#include -#include /* for gethostid() */ -#include -#include - -/* For the nfs mount emulation */ -#include -#include -#include -#include -#include - -/* for sunos_select */ -#include -#include - -/* NR_OPEN is now larger and dynamic in recent kernels. */ -#define SUNOS_NR_OPEN 256 - -/* We use the SunOS mmap() semantics. */ -asmlinkage unsigned long sunos_mmap(unsigned long addr, unsigned long len, - unsigned long prot, unsigned long flags, - unsigned long fd, unsigned long off) -{ - struct file * file = NULL; - unsigned long retval, ret_type; - - if (flags & MAP_NORESERVE) { - static int cnt; - if (cnt++ < 10) - printk("%s: unimplemented SunOS MAP_NORESERVE mmap() flag\n", - current->comm); - flags &= ~MAP_NORESERVE; - } - retval = -EBADF; - if (!(flags & MAP_ANONYMOUS)) { - if (fd >= SUNOS_NR_OPEN) - goto out; - file = fget(fd); - if (!file) - goto out; - } - - retval = -EINVAL; - /* If this is ld.so or a shared library doing an mmap - * of /dev/zero, transform it into an anonymous mapping. - * SunOS is so stupid some times... hmph! - */ - if (file) { - if (imajor(file->f_path.dentry->d_inode) == MEM_MAJOR && - iminor(file->f_path.dentry->d_inode) == 5) { - flags |= MAP_ANONYMOUS; - fput(file); - file = NULL; - } - } - ret_type = flags & _MAP_NEW; - flags &= ~_MAP_NEW; - - if (!(flags & MAP_FIXED)) - addr = 0; - else { - if (ARCH_SUN4C_SUN4 && - (len > 0x20000000 || - ((flags & MAP_FIXED) && - addr < 0xe0000000 && addr + len > 0x20000000))) - goto out_putf; - - /* See asm-sparc/uaccess.h */ - if (len > TASK_SIZE - PAGE_SIZE || - addr + len > TASK_SIZE - PAGE_SIZE) - goto out_putf; - } - - flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); - down_write(¤t->mm->mmap_sem); - retval = do_mmap(file, addr, len, prot, flags, off); - up_write(¤t->mm->mmap_sem); - if (!ret_type) - retval = ((retval < PAGE_OFFSET) ? 0 : retval); - -out_putf: - if (file) - fput(file); -out: - return retval; -} - -/* lmbench calls this, just say "yeah, ok" */ -asmlinkage int sunos_mctl(unsigned long addr, unsigned long len, int function, char *arg) -{ - return 0; -} - -/* SunOS is completely broken... it returns 0 on success, otherwise - * ENOMEM. For sys_sbrk() it wants the old brk value as a return - * on success and ENOMEM as before on failure. - */ -asmlinkage int sunos_brk(unsigned long brk) -{ - int freepages, retval = -ENOMEM; - unsigned long rlim; - unsigned long newbrk, oldbrk; - - down_write(¤t->mm->mmap_sem); - if (ARCH_SUN4C_SUN4) { - if (brk >= 0x20000000 && brk < 0xe0000000) { - goto out; - } - } - - if (brk < current->mm->end_code) - goto out; - - newbrk = PAGE_ALIGN(brk); - oldbrk = PAGE_ALIGN(current->mm->brk); - retval = 0; - if (oldbrk == newbrk) { - current->mm->brk = brk; - goto out; - } - - /* - * Always allow shrinking brk - */ - if (brk <= current->mm->brk) { - current->mm->brk = brk; - do_munmap(current->mm, newbrk, oldbrk-newbrk); - goto out; - } - /* - * Check against rlimit and stack.. - */ - retval = -ENOMEM; - rlim = current->signal->rlim[RLIMIT_DATA].rlim_cur; - if (rlim >= RLIM_INFINITY) - rlim = ~0; - if (brk - current->mm->end_code > rlim) - goto out; - - /* - * Check against existing mmap mappings. - */ - if (find_vma_intersection(current->mm, oldbrk, newbrk+PAGE_SIZE)) - goto out; - - /* - * stupid algorithm to decide if we have enough memory: while - * simple, it hopefully works in most obvious cases.. Easy to - * fool it, but this should catch most mistakes. - */ - freepages = global_page_state(NR_FILE_PAGES); - freepages >>= 1; - freepages += nr_free_pages(); - freepages += nr_swap_pages; - freepages -= num_physpages >> 4; - freepages -= (newbrk-oldbrk) >> PAGE_SHIFT; - if (freepages < 0) - goto out; - /* - * Ok, we have probably got enough memory - let it rip. - */ - current->mm->brk = brk; - do_brk(oldbrk, newbrk-oldbrk); - retval = 0; -out: - up_write(¤t->mm->mmap_sem); - return retval; -} - -asmlinkage unsigned long sunos_sbrk(int increment) -{ - int error; - unsigned long oldbrk; - - /* This should do it hopefully... */ - lock_kernel(); - oldbrk = current->mm->brk; - error = sunos_brk(((int) current->mm->brk) + increment); - if (!error) - error = oldbrk; - unlock_kernel(); - return error; -} - -/* XXX Completely undocumented, and completely magic... - * XXX I believe it is to increase the size of the stack by - * XXX argument 'increment' and return the new end of stack - * XXX area. Wheee... - */ -asmlinkage unsigned long sunos_sstk(int increment) -{ - lock_kernel(); - printk("%s: Call to sunos_sstk(increment<%d>) is unsupported\n", - current->comm, increment); - unlock_kernel(); - return -1; -} - -/* Give hints to the kernel as to what paging strategy to use... - * Completely bogus, don't remind me. - */ -#define VA_NORMAL 0 /* Normal vm usage expected */ -#define VA_ABNORMAL 1 /* Abnormal/random vm usage probable */ -#define VA_SEQUENTIAL 2 /* Accesses will be of a sequential nature */ -#define VA_INVALIDATE 3 /* Page table entries should be flushed ??? */ -static char *vstrings[] = { - "VA_NORMAL", - "VA_ABNORMAL", - "VA_SEQUENTIAL", - "VA_INVALIDATE", -}; - -asmlinkage void sunos_vadvise(unsigned long strategy) -{ - /* I wanna see who uses this... */ - lock_kernel(); - printk("%s: Advises us to use %s paging strategy\n", - current->comm, - strategy <= 3 ? vstrings[strategy] : "BOGUS"); - unlock_kernel(); -} - -/* This just wants the soft limit (ie. rlim_cur element) of the RLIMIT_NOFILE - * resource limit and is for backwards compatibility with older sunos - * revs. - */ -asmlinkage long sunos_getdtablesize(void) -{ - return SUNOS_NR_OPEN; -} - -#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) - -asmlinkage unsigned long sunos_sigblock(unsigned long blk_mask) -{ - unsigned long old; - - spin_lock_irq(¤t->sighand->siglock); - old = current->blocked.sig[0]; - current->blocked.sig[0] |= (blk_mask & _BLOCKABLE); - recalc_sigpending(); - spin_unlock_irq(¤t->sighand->siglock); - return old; -} - -asmlinkage unsigned long sunos_sigsetmask(unsigned long newmask) -{ - unsigned long retval; - - spin_lock_irq(¤t->sighand->siglock); - retval = current->blocked.sig[0]; - current->blocked.sig[0] = (newmask & _BLOCKABLE); - recalc_sigpending(); - spin_unlock_irq(¤t->sighand->siglock); - return retval; -} - -/* SunOS getdents is very similar to the newer Linux (iBCS2 compliant) */ -/* getdents system call, the format of the structure just has a different */ -/* layout (d_off+d_ino instead of d_ino+d_off) */ -struct sunos_dirent { - long d_off; - unsigned long d_ino; - unsigned short d_reclen; - unsigned short d_namlen; - char d_name[1]; -}; - -struct sunos_dirent_callback { - struct sunos_dirent __user *curr; - struct sunos_dirent __user *previous; - int count; - int error; -}; - -#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de))) -#define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1)) - -static int sunos_filldir(void * __buf, const char * name, int namlen, - loff_t offset, u64 ino, unsigned int d_type) -{ - struct sunos_dirent __user *dirent; - struct sunos_dirent_callback * buf = __buf; - unsigned long d_ino; - int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1); - - buf->error = -EINVAL; /* only used if we fail.. */ - if (reclen > buf->count) - return -EINVAL; - d_ino = ino; - if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) - return -EOVERFLOW; - dirent = buf->previous; - if (dirent) - put_user(offset, &dirent->d_off); - dirent = buf->curr; - buf->previous = dirent; - put_user(d_ino, &dirent->d_ino); - put_user(namlen, &dirent->d_namlen); - put_user(reclen, &dirent->d_reclen); - copy_to_user(dirent->d_name, name, namlen); - put_user(0, dirent->d_name + namlen); - dirent = (void __user *) dirent + reclen; - buf->curr = dirent; - buf->count -= reclen; - return 0; -} - -asmlinkage int sunos_getdents(unsigned int fd, void __user *dirent, int cnt) -{ - struct file * file; - struct sunos_dirent __user *lastdirent; - struct sunos_dirent_callback buf; - int error = -EBADF; - - if (fd >= SUNOS_NR_OPEN) - goto out; - - file = fget(fd); - if (!file) - goto out; - - error = -EINVAL; - if (cnt < (sizeof(struct sunos_dirent) + 255)) - goto out_putf; - - buf.curr = (struct sunos_dirent __user *) dirent; - buf.previous = NULL; - buf.count = cnt; - buf.error = 0; - - error = vfs_readdir(file, sunos_filldir, &buf); - if (error < 0) - goto out_putf; - - lastdirent = buf.previous; - error = buf.error; - if (lastdirent) { - put_user(file->f_pos, &lastdirent->d_off); - error = cnt - buf.count; - } - -out_putf: - fput(file); -out: - return error; -} - -/* Old sunos getdirentries, severely broken compatibility stuff here. */ -struct sunos_direntry { - unsigned long d_ino; - unsigned short d_reclen; - unsigned short d_namlen; - char d_name[1]; -}; - -struct sunos_direntry_callback { - struct sunos_direntry __user *curr; - struct sunos_direntry __user *previous; - int count; - int error; -}; - -static int sunos_filldirentry(void * __buf, const char * name, int namlen, - loff_t offset, u64 ino, unsigned int d_type) -{ - struct sunos_direntry __user *dirent; - struct sunos_direntry_callback *buf = __buf; - unsigned long d_ino; - int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1); - - buf->error = -EINVAL; /* only used if we fail.. */ - if (reclen > buf->count) - return -EINVAL; - d_ino = ino; - if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) - return -EOVERFLOW; - dirent = buf->previous; - dirent = buf->curr; - buf->previous = dirent; - put_user(d_ino, &dirent->d_ino); - put_user(namlen, &dirent->d_namlen); - put_user(reclen, &dirent->d_reclen); - copy_to_user(dirent->d_name, name, namlen); - put_user(0, dirent->d_name + namlen); - dirent = (void __user *) dirent + reclen; - buf->curr = dirent; - buf->count -= reclen; - return 0; -} - -asmlinkage int sunos_getdirentries(unsigned int fd, void __user *dirent, - int cnt, unsigned int __user *basep) -{ - struct file * file; - struct sunos_direntry __user *lastdirent; - struct sunos_direntry_callback buf; - int error = -EBADF; - - if (fd >= SUNOS_NR_OPEN) - goto out; - - file = fget(fd); - if (!file) - goto out; - - error = -EINVAL; - if (cnt < (sizeof(struct sunos_direntry) + 255)) - goto out_putf; - - buf.curr = (struct sunos_direntry __user *) dirent; - buf.previous = NULL; - buf.count = cnt; - buf.error = 0; - - error = vfs_readdir(file, sunos_filldirentry, &buf); - if (error < 0) - goto out_putf; - - lastdirent = buf.previous; - error = buf.error; - if (lastdirent) { - put_user(file->f_pos, basep); - error = cnt - buf.count; - } - -out_putf: - fput(file); -out: - return error; -} - -struct sunos_utsname { - char sname[9]; - char nname[9]; - char nnext[56]; - char rel[9]; - char ver[9]; - char mach[9]; -}; - -asmlinkage int sunos_uname(struct sunos_utsname __user *name) -{ - int ret; - down_read(&uts_sem); - ret = copy_to_user(&name->sname[0], &utsname()->sysname[0], - sizeof(name->sname) - 1); - if (!ret) { - ret |= __copy_to_user(&name->nname[0], &utsname()->nodename[0], - sizeof(name->nname) - 1); - ret |= __put_user('\0', &name->nname[8]); - ret |= __copy_to_user(&name->rel[0], &utsname()->release[0], - sizeof(name->rel) - 1); - ret |= __copy_to_user(&name->ver[0], &utsname()->version[0], - sizeof(name->ver) - 1); - ret |= __copy_to_user(&name->mach[0], &utsname()->machine[0], - sizeof(name->mach) - 1); - } - up_read(&uts_sem); - return ret ? -EFAULT : 0; -} - -asmlinkage int sunos_nosys(void) -{ - struct pt_regs *regs; - siginfo_t info; - static int cnt; - - lock_kernel(); - regs = current->thread.kregs; - info.si_signo = SIGSYS; - info.si_errno = 0; - info.si_code = __SI_FAULT|0x100; - info.si_addr = (void __user *)regs->pc; - info.si_trapno = regs->u_regs[UREG_G1]; - send_sig_info(SIGSYS, &info, current); - if (cnt++ < 4) { - printk("Process makes ni_syscall number %d, register dump:\n", - (int) regs->u_regs[UREG_G1]); - show_regs(regs); - } - unlock_kernel(); - return -ENOSYS; -} - -/* This is not a real and complete implementation yet, just to keep - * the easy SunOS binaries happy. - */ -asmlinkage int sunos_fpathconf(int fd, int name) -{ - int ret; - - switch(name) { - case _PCONF_LINK: - ret = LINK_MAX; - break; - case _PCONF_CANON: - ret = MAX_CANON; - break; - case _PCONF_INPUT: - ret = MAX_INPUT; - break; - case _PCONF_NAME: - ret = NAME_MAX; - break; - case _PCONF_PATH: - ret = PATH_MAX; - break; - case _PCONF_PIPE: - ret = PIPE_BUF; - break; - case _PCONF_CHRESTRICT: /* XXX Investigate XXX */ - ret = 1; - break; - case _PCONF_NOTRUNC: /* XXX Investigate XXX */ - case _PCONF_VDISABLE: - ret = 0; - break; - default: - ret = -EINVAL; - break; - } - return ret; -} - -asmlinkage int sunos_pathconf(char __user *path, int name) -{ - int ret; - - ret = sunos_fpathconf(0, name); /* XXX cheese XXX */ - return ret; -} - -/* SunOS mount system call emulation */ - -asmlinkage int sunos_select(int width, fd_set __user *inp, fd_set __user *outp, - fd_set __user *exp, struct timeval __user *tvp) -{ - int ret; - - /* SunOS binaries expect that select won't change the tvp contents */ - ret = sys_select (width, inp, outp, exp, tvp); - if (ret == -EINTR && tvp) { - time_t sec, usec; - - __get_user(sec, &tvp->tv_sec); - __get_user(usec, &tvp->tv_usec); - - if (sec == 0 && usec == 0) - ret = 0; - } - return ret; -} - -asmlinkage void sunos_nop(void) -{ - return; -} - -/* SunOS mount/umount. */ -#define SMNT_RDONLY 1 -#define SMNT_NOSUID 2 -#define SMNT_NEWTYPE 4 -#define SMNT_GRPID 8 -#define SMNT_REMOUNT 16 -#define SMNT_NOSUB 32 -#define SMNT_MULTI 64 -#define SMNT_SYS5 128 - -struct sunos_fh_t { - char fh_data [NFS_FHSIZE]; -}; - -struct sunos_nfs_mount_args { - struct sockaddr_in __user *addr; /* file server address */ - struct nfs_fh __user *fh; /* File handle to be mounted */ - int flags; /* flags */ - int wsize; /* write size in bytes */ - int rsize; /* read size in bytes */ - int timeo; /* initial timeout in .1 secs */ - int retrans; /* times to retry send */ - char __user *hostname; /* server's hostname */ - int acregmin; /* attr cache file min secs */ - int acregmax; /* attr cache file max secs */ - int acdirmin; /* attr cache dir min secs */ - int acdirmax; /* attr cache dir max secs */ - char __user *netname; /* server's netname */ -}; - - -/* Bind the socket on a local reserved port and connect it to the - * remote server. This on Linux/i386 is done by the mount program, - * not by the kernel. - */ -static int -sunos_nfs_get_server_fd (int fd, struct sockaddr_in *addr) -{ - struct sockaddr_in local; - struct sockaddr_in server; - int try_port; - struct socket *socket; - struct inode *inode; - struct file *file; - int ret, result = 0; - - file = fget(fd); - if (!file) - goto out; - - inode = file->f_path.dentry->d_inode; - - socket = SOCKET_I(inode); - local.sin_family = AF_INET; - local.sin_addr.s_addr = htonl(INADDR_ANY); - - /* IPPORT_RESERVED = 1024, can't find the definition in the kernel */ - try_port = 1024; - do { - local.sin_port = htons (--try_port); - ret = socket->ops->bind(socket, (struct sockaddr*)&local, - sizeof(local)); - } while (ret && try_port > (1024 / 2)); - - if (ret) - goto out_putf; - - server.sin_family = AF_INET; - server.sin_addr = addr->sin_addr; - server.sin_port = NFS_PORT; - - /* Call sys_connect */ - ret = socket->ops->connect (socket, (struct sockaddr *) &server, - sizeof (server), file->f_flags); - if (ret >= 0) - result = 1; - -out_putf: - fput(file); -out: - return result; -} - -static int get_default (int value, int def_value) -{ - if (value) - return value; - else - return def_value; -} - -static int sunos_nfs_mount(char *dir_name, int linux_flags, void __user *data) -{ - int server_fd, err; - char *the_name, *mount_page; - struct nfs_mount_data linux_nfs_mount; - struct sunos_nfs_mount_args sunos_mount; - - /* Ok, here comes the fun part: Linux's nfs mount needs a - * socket connection to the server, but SunOS mount does not - * require this, so we use the information on the destination - * address to create a socket and bind it to a reserved - * port on this system - */ - if (copy_from_user(&sunos_mount, data, sizeof(sunos_mount))) - return -EFAULT; - - server_fd = sys_socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP); - if (server_fd < 0) - return -ENXIO; - - if (copy_from_user(&linux_nfs_mount.addr,sunos_mount.addr, - sizeof(*sunos_mount.addr)) || - copy_from_user(&linux_nfs_mount.root,sunos_mount.fh, - sizeof(*sunos_mount.fh))) { - sys_close (server_fd); - return -EFAULT; - } - - if (!sunos_nfs_get_server_fd (server_fd, &linux_nfs_mount.addr)){ - sys_close (server_fd); - return -ENXIO; - } - - /* Now, bind it to a locally reserved port */ - linux_nfs_mount.version = NFS_MOUNT_VERSION; - linux_nfs_mount.flags = sunos_mount.flags; - linux_nfs_mount.fd = server_fd; - - linux_nfs_mount.rsize = get_default (sunos_mount.rsize, 8192); - linux_nfs_mount.wsize = get_default (sunos_mount.wsize, 8192); - linux_nfs_mount.timeo = get_default (sunos_mount.timeo, 10); - linux_nfs_mount.retrans = sunos_mount.retrans; - - linux_nfs_mount.acregmin = sunos_mount.acregmin; - linux_nfs_mount.acregmax = sunos_mount.acregmax; - linux_nfs_mount.acdirmin = sunos_mount.acdirmin; - linux_nfs_mount.acdirmax = sunos_mount.acdirmax; - - the_name = getname(sunos_mount.hostname); - if (IS_ERR(the_name)) - return PTR_ERR(the_name); - - strlcpy(linux_nfs_mount.hostname, the_name, - sizeof(linux_nfs_mount.hostname)); - putname (the_name); - - mount_page = (char *) get_zeroed_page(GFP_KERNEL); - if (!mount_page) - return -ENOMEM; - - memcpy(mount_page, &linux_nfs_mount, sizeof(linux_nfs_mount)); - - err = do_mount("", dir_name, "nfs", linux_flags, mount_page); - - free_page((unsigned long) mount_page); - return err; -} - -asmlinkage int -sunos_mount(char __user *type, char __user *dir, int flags, void __user *data) -{ - int linux_flags = 0; - int ret = -EINVAL; - char *dev_fname = NULL; - char *dir_page, *type_page; - - if (!capable (CAP_SYS_ADMIN)) - return -EPERM; - - lock_kernel(); - /* We don't handle the integer fs type */ - if ((flags & SMNT_NEWTYPE) == 0) - goto out; - - /* Do not allow for those flags we don't support */ - if (flags & (SMNT_GRPID|SMNT_NOSUB|SMNT_MULTI|SMNT_SYS5)) - goto out; - - if (flags & SMNT_REMOUNT) - linux_flags |= MS_REMOUNT; - if (flags & SMNT_RDONLY) - linux_flags |= MS_RDONLY; - if (flags & SMNT_NOSUID) - linux_flags |= MS_NOSUID; - - dir_page = getname(dir); - ret = PTR_ERR(dir_page); - if (IS_ERR(dir_page)) - goto out; - - type_page = getname(type); - ret = PTR_ERR(type_page); - if (IS_ERR(type_page)) - goto out1; - - if (strcmp(type_page, "ext2") == 0) { - dev_fname = getname(data); - } else if (strcmp(type_page, "iso9660") == 0) { - dev_fname = getname(data); - } else if (strcmp(type_page, "minix") == 0) { - dev_fname = getname(data); - } else if (strcmp(type_page, "nfs") == 0) { - ret = sunos_nfs_mount (dir_page, flags, data); - goto out2; - } else if (strcmp(type_page, "ufs") == 0) { - printk("Warning: UFS filesystem mounts unsupported.\n"); - ret = -ENODEV; - goto out2; - } else if (strcmp(type_page, "proc")) { - ret = -ENODEV; - goto out2; - } - ret = PTR_ERR(dev_fname); - if (IS_ERR(dev_fname)) - goto out2; - ret = do_mount(dev_fname, dir_page, type_page, linux_flags, NULL); - if (dev_fname) - putname(dev_fname); -out2: - putname(type_page); -out1: - putname(dir_page); -out: - unlock_kernel(); - return ret; -} - - -asmlinkage int sunos_setpgrp(pid_t pid, pid_t pgid) -{ - int ret; - - /* So stupid... */ - if ((!pid || pid == current->pid) && - !pgid) { - sys_setsid(); - ret = 0; - } else { - ret = sys_setpgid(pid, pgid); - } - return ret; -} - -/* So stupid... */ -asmlinkage int sunos_wait4(pid_t pid, unsigned int __user *stat_addr, - int options, struct rusage __user*ru) -{ - int ret; - - ret = sys_wait4((pid ? pid : -1), stat_addr, options, ru); - return ret; -} - -asmlinkage int sunos_killpg(int pgrp, int sig) -{ - int ret; - - rcu_read_lock(); - ret = -EINVAL; - if (pgrp > 0) - ret = kill_pgrp(find_vpid(pgrp), sig, 0); - rcu_read_unlock(); - - return ret; -} - -asmlinkage int sunos_audit(void) -{ - lock_kernel(); - printk ("sys_audit\n"); - unlock_kernel(); - return -1; -} - -asmlinkage unsigned long sunos_gethostid(void) -{ - unsigned long ret; - - lock_kernel(); - ret = ((unsigned long)idprom->id_machtype << 24) | - (unsigned long)idprom->id_sernum; - unlock_kernel(); - return ret; -} - -/* sysconf options, for SunOS compatibility */ -#define _SC_ARG_MAX 1 -#define _SC_CHILD_MAX 2 -#define _SC_CLK_TCK 3 -#define _SC_NGROUPS_MAX 4 -#define _SC_OPEN_MAX 5 -#define _SC_JOB_CONTROL 6 -#define _SC_SAVED_IDS 7 -#define _SC_VERSION 8 - -asmlinkage long sunos_sysconf (int name) -{ - long ret; - - switch (name){ - case _SC_ARG_MAX: - ret = ARG_MAX; - break; - case _SC_CHILD_MAX: - ret = current->signal->rlim[RLIMIT_NPROC].rlim_cur; - break; - case _SC_CLK_TCK: - ret = HZ; - break; - case _SC_NGROUPS_MAX: - ret = NGROUPS_MAX; - break; - case _SC_OPEN_MAX: - ret = current->signal->rlim[RLIMIT_NOFILE].rlim_cur; - break; - case _SC_JOB_CONTROL: - ret = 1; /* yes, we do support job control */ - break; - case _SC_SAVED_IDS: - ret = 1; /* yes, we do support saved uids */ - break; - case _SC_VERSION: - /* mhm, POSIX_VERSION is in /usr/include/unistd.h - * should it go on /usr/include/linux? - */ - ret = 199009L; - break; - default: - ret = -1; - break; - }; - return ret; -} - -asmlinkage int sunos_semsys(int op, unsigned long arg1, unsigned long arg2, - unsigned long arg3, void *ptr) -{ - union semun arg4; - int ret; - - switch (op) { - case 0: - /* Most arguments match on a 1:1 basis but cmd doesn't */ - switch(arg3) { - case 4: - arg3=GETPID; break; - case 5: - arg3=GETVAL; break; - case 6: - arg3=GETALL; break; - case 3: - arg3=GETNCNT; break; - case 7: - arg3=GETZCNT; break; - case 8: - arg3=SETVAL; break; - case 9: - arg3=SETALL; break; - } - /* sys_semctl(): */ - /* value to modify semaphore to */ - arg4.__pad = (void __user *) ptr; - ret = sys_semctl((int)arg1, (int)arg2, (int)arg3, arg4 ); - break; - case 1: - /* sys_semget(): */ - ret = sys_semget((key_t)arg1, (int)arg2, (int)arg3); - break; - case 2: - /* sys_semop(): */ - ret = sys_semop((int)arg1, (struct sembuf __user *)arg2, (unsigned)arg3); - break; - default: - ret = -EINVAL; - break; - }; - return ret; -} - -asmlinkage int sunos_msgsys(int op, unsigned long arg1, unsigned long arg2, - unsigned long arg3, unsigned long arg4) -{ - struct sparc_stackf *sp; - unsigned long arg5; - int rval; - - switch(op) { - case 0: - rval = sys_msgget((key_t)arg1, (int)arg2); - break; - case 1: - rval = sys_msgctl((int)arg1, (int)arg2, - (struct msqid_ds __user *)arg3); - break; - case 2: - lock_kernel(); - sp = (struct sparc_stackf *)current->thread.kregs->u_regs[UREG_FP]; - arg5 = sp->xxargs[0]; - unlock_kernel(); - rval = sys_msgrcv((int)arg1, (struct msgbuf __user *)arg2, - (size_t)arg3, (long)arg4, (int)arg5); - break; - case 3: - rval = sys_msgsnd((int)arg1, (struct msgbuf __user *)arg2, - (size_t)arg3, (int)arg4); - break; - default: - rval = -EINVAL; - break; - } - return rval; -} - -asmlinkage int sunos_shmsys(int op, unsigned long arg1, unsigned long arg2, - unsigned long arg3) -{ - unsigned long raddr; - int rval; - - switch(op) { - case 0: - /* do_shmat(): attach a shared memory area */ - rval = do_shmat((int)arg1,(char __user *)arg2,(int)arg3,&raddr); - if (!rval) - rval = (int) raddr; - break; - case 1: - /* sys_shmctl(): modify shared memory area attr. */ - rval = sys_shmctl((int)arg1,(int)arg2,(struct shmid_ds __user *)arg3); - break; - case 2: - /* sys_shmdt(): detach a shared memory area */ - rval = sys_shmdt((char __user *)arg1); - break; - case 3: - /* sys_shmget(): get a shared memory area */ - rval = sys_shmget((key_t)arg1,(int)arg2,(int)arg3); - break; - default: - rval = -EINVAL; - break; - }; - return rval; -} - -#define SUNOS_EWOULDBLOCK 35 - -/* see the sunos man page read(2v) for an explanation - of this garbage. We use O_NDELAY to mark - file descriptors that have been set non-blocking - using 4.2BSD style calls. (tridge) */ - -static inline int check_nonblock(int ret, int fd) -{ - if (ret == -EAGAIN) { - struct file * file = fget(fd); - if (file) { - if (file->f_flags & O_NDELAY) - ret = -SUNOS_EWOULDBLOCK; - fput(file); - } - } - return ret; -} - -asmlinkage int sunos_read(unsigned int fd, char __user *buf, int count) -{ - int ret; - - ret = check_nonblock(sys_read(fd,buf,count),fd); - return ret; -} - -asmlinkage int sunos_readv(unsigned long fd, const struct iovec __user *vector, - long count) -{ - int ret; - - ret = check_nonblock(sys_readv(fd,vector,count),fd); - return ret; -} - -asmlinkage int sunos_write(unsigned int fd, char __user *buf, int count) -{ - int ret; - - ret = check_nonblock(sys_write(fd,buf,count),fd); - return ret; -} - -asmlinkage int sunos_writev(unsigned long fd, - const struct iovec __user *vector, long count) -{ - int ret; - - ret = check_nonblock(sys_writev(fd,vector,count),fd); - return ret; -} - -asmlinkage int sunos_recv(int fd, void __user *ubuf, int size, unsigned flags) -{ - int ret; - - ret = check_nonblock(sys_recv(fd,ubuf,size,flags),fd); - return ret; -} - -asmlinkage int sunos_send(int fd, void __user *buff, int len, unsigned flags) -{ - int ret; - - ret = check_nonblock(sys_send(fd,buff,len,flags),fd); - return ret; -} - -asmlinkage int sunos_accept(int fd, struct sockaddr __user *sa, - int __user *addrlen) -{ - int ret; - - while (1) { - ret = check_nonblock(sys_accept(fd,sa,addrlen),fd); - if (ret != -ENETUNREACH && ret != -EHOSTUNREACH) - break; - } - - return ret; -} - -#define SUNOS_SV_INTERRUPT 2 - -asmlinkage int -sunos_sigaction(int sig, const struct old_sigaction __user *act, - struct old_sigaction __user *oact) -{ - struct k_sigaction new_ka, old_ka; - int ret; - - if (act) { - old_sigset_t mask; - - if (!access_ok(VERIFY_READ, act, sizeof(*act)) || - __get_user(new_ka.sa.sa_handler, &act->sa_handler) || - __get_user(new_ka.sa.sa_flags, &act->sa_flags)) - return -EFAULT; - __get_user(mask, &act->sa_mask); - new_ka.sa.sa_restorer = NULL; - new_ka.ka_restorer = NULL; - siginitset(&new_ka.sa.sa_mask, mask); - new_ka.sa.sa_flags ^= SUNOS_SV_INTERRUPT; - } - - ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); - - if (!ret && oact) { - /* In the clone() case we could copy half consistent - * state to the user, however this could sleep and - * deadlock us if we held the signal lock on SMP. So for - * now I take the easy way out and do no locking. - * But then again we don't support SunOS lwp's anyways ;-) - */ - old_ka.sa.sa_flags ^= SUNOS_SV_INTERRUPT; - if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) || - __put_user(old_ka.sa.sa_handler, &oact->sa_handler) || - __put_user(old_ka.sa.sa_flags, &oact->sa_flags)) - return -EFAULT; - __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask); - } - - return ret; -} - - -asmlinkage int sunos_setsockopt(int fd, int level, int optname, - char __user *optval, int optlen) -{ - int tr_opt = optname; - int ret; - - if (level == SOL_IP) { - /* Multicast socketopts (ttl, membership) */ - if (tr_opt >=2 && tr_opt <= 6) - tr_opt += 30; - } - ret = sys_setsockopt(fd, level, tr_opt, optval, optlen); - return ret; -} - -asmlinkage int sunos_getsockopt(int fd, int level, int optname, - char __user *optval, int __user *optlen) -{ - int tr_opt = optname; - int ret; - - if (level == SOL_IP) { - /* Multicast socketopts (ttl, membership) */ - if (tr_opt >=2 && tr_opt <= 6) - tr_opt += 30; - } - ret = sys_getsockopt(fd, level, tr_opt, optval, optlen); - return ret; -} diff --git a/arch/sparc/kernel/systbls.S b/arch/sparc/kernel/systbls.S index 9064485dc40..5a7c4c8345c 100644 --- a/arch/sparc/kernel/systbls.S +++ b/arch/sparc/kernel/systbls.S @@ -81,124 +81,3 @@ sys_call_table: /*305*/ .long sys_set_mempolicy, sys_kexec_load, sys_move_pages, sys_getcpu, sys_epoll_pwait /*310*/ .long sys_utimensat, sys_signalfd, sys_timerfd_create, sys_eventfd, sys_fallocate /*315*/ .long sys_timerfd_settime, sys_timerfd_gettime - -#ifdef CONFIG_SUNOS_EMUL - /* Now the SunOS syscall table. */ - - .align 4 - .globl sunos_sys_table -sunos_sys_table: -/*0*/ .long sunos_indir, sys_exit, sys_fork - .long sunos_read, sunos_write, sys_open - .long sys_close, sunos_wait4, sys_creat - .long sys_link, sys_unlink, sunos_execv - .long sys_chdir, sunos_nosys, sys_mknod - .long sys_chmod, sys_lchown16, sunos_brk - .long sunos_nosys, sys_lseek, sunos_getpid - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_getuid, sunos_nosys, sys_ptrace - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sys_access, sunos_nosys, sunos_nosys - .long sys_sync, sys_kill, sys_newstat - .long sunos_nosys, sys_newlstat, sys_dup - .long sys_pipe, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_getgid - .long sunos_nosys, sunos_nosys -/*50*/ .long sunos_nosys, sys_acct, sunos_nosys - .long sunos_mctl, sunos_ioctl, sys_reboot - .long sunos_nosys, sys_symlink, sys_readlink - .long sys_execve, sys_umask, sys_chroot - .long sys_newfstat, sunos_nosys, sys_getpagesize - .long sys_msync, sys_vfork, sunos_nosys - .long sunos_nosys, sunos_sbrk, sunos_sstk - .long sunos_mmap, sunos_vadvise, sys_munmap - .long sys_mprotect, sys_madvise, sys_vhangup - .long sunos_nosys, sys_mincore, sys_getgroups16 - .long sys_setgroups16, sys_getpgrp, sunos_setpgrp - .long sys_setitimer, sunos_nosys, sys_swapon - .long sys_getitimer, sys_gethostname, sys_sethostname - .long sunos_getdtablesize, sys_dup2, sunos_nop - .long sys_fcntl, sunos_select, sunos_nop - .long sys_fsync, sys_setpriority, sys_socket - .long sys_connect, sunos_accept -/*100*/ .long sys_getpriority, sunos_send, sunos_recv - .long sunos_nosys, sys_bind, sunos_setsockopt - .long sys_listen, sunos_nosys, sunos_sigaction - .long sunos_sigblock, sunos_sigsetmask, sys_sigpause - .long sys_sigstack, sys_recvmsg, sys_sendmsg - .long sunos_nosys, sys_gettimeofday, sys_getrusage - .long sunos_getsockopt, sunos_nosys, sunos_readv - .long sunos_writev, sys_settimeofday, sys_fchown16 - .long sys_fchmod, sys_recvfrom, sys_setreuid16 - .long sys_setregid16, sys_rename, sys_truncate - .long sys_ftruncate, sys_flock, sunos_nosys - .long sys_sendto, sys_shutdown, sys_socketpair - .long sys_mkdir, sys_rmdir, sys_utimes - .long sys_sigreturn, sunos_nosys, sys_getpeername - .long sunos_gethostid, sunos_nosys, sys_getrlimit - .long sys_setrlimit, sunos_killpg, sunos_nosys - .long sunos_nosys, sunos_nosys -/*150*/ .long sys_getsockname, sunos_nosys, sunos_nosys - .long sys_poll, sunos_nosys, sunos_nosys - .long sunos_getdirentries, sys_statfs, sys_fstatfs - .long sys_oldumount, sunos_nosys, sunos_nosys - .long sys_getdomainname, sys_setdomainname - .long sunos_nosys, sys_quotactl, sunos_nosys - .long sunos_mount, sys_ustat, sunos_semsys - .long sunos_msgsys, sunos_shmsys, sunos_audit - .long sunos_nosys, sunos_getdents, sys_setsid - .long sys_fchdir, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sys_sigpending, sunos_nosys - .long sys_setpgid, sunos_pathconf, sunos_fpathconf - .long sunos_sysconf, sunos_uname, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys -/*200*/ .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys -/*250*/ .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys -/*260*/ .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys -/*270*/ .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys -/*280*/ .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys -/*290*/ .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys -/*300*/ .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys -/*310*/ .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys - -#endif -- cgit v1.2.3